[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/vc-got 2d039a2 089/145: fix vc-dir listing on sub-direc
From: |
ELPA Syncer |
Subject: |
[elpa] externals/vc-got 2d039a2 089/145: fix vc-dir listing on sub-directories |
Date: |
Thu, 9 Sep 2021 15:58:40 -0400 (EDT) |
branch: externals/vc-got
commit 2d039a22b1141f81861fbd3b6f6c17beac2cd033
Author: Omar Polo <op@omarpolo.com>
Commit: Omar Polo <op@omarpolo.com>
fix vc-dir listing on sub-directories
Refactor vc-got--status so it a) correctly manages files and b)
returns filenames relative to the directory.
fixes #13
---
vc-got.el | 55 ++++++++++++++++++++++++++++++-------------------------
1 file changed, 30 insertions(+), 25 deletions(-)
diff --git a/vc-got.el b/vc-got.el
index 24b3039..a620d48 100755
--- a/vc-got.el
+++ b/vc-got.el
@@ -212,7 +212,7 @@ worktree."
(when reverse '("-R"))
path)))))
-(defun vc-got--status (status-codes dir-or-file &rest files)
+(defun vc-got--status (status-codes dir-or-file files)
"Return a list of lists '(FILE STATUS STAGE-STATUS).
DIR-OR-FILE can be either a directory or a file. If FILES is
given, return the status of those files, otherwise the status of
@@ -220,30 +220,35 @@ DIR-OR-FILE. STATUS-CODES is either nil, or a string
that's
passed as the -s flag to got status to limit the types of status
to report (e.g. \"CD\" to report only conflicts and deleted
files)."
- (vc-got-with-worktree dir-or-file
- (with-temp-buffer
- (let (process-file-side-effects)
- (when (zerop (vc-got--call "status"
- (when status-codes (list "-s" status-codes))
- (or files dir-or-file)))
- (goto-char (point-min))
- (cl-loop until (eobp)
- ;; the format of each line is
- ;; <status-char> <stage-char> <spc> <filename> \n
- collect (let* ((file-status (prog1
(vc-got--parse-status-char
- (char-after))
- (forward-char)))
- (stage-status (prog1
(vc-got--parse-stage-char
- (char-after))
- (forward-char)))
- (filename (progn
- (forward-char)
- (buffer-substring (point)
-
(line-end-position)))))
- (list filename
- (or file-status (and stage-status 'staged))
- stage-status))
- do (forward-line)))))))
+ (with-temp-buffer
+ (let* ((default-directory (expand-file-name
+ (if (file-directory-p dir-or-file)
+ dir-or-file
+ (file-name-directory dir-or-file))))
+ (root (vc-got-root default-directory))
+ (process-file-side-effects))
+ (when (zerop (vc-got--call "status"
+ (when status-codes (list "-s" status-codes))
+ (or files dir-or-file)))
+ (goto-char (point-min))
+ (cl-loop until (eobp)
+ ;; the format of each line is
+ ;; <status-char> <stage-char> <spc> <filename> \n
+ collect (let* ((file-status (prog1 (vc-got--parse-status-char
+ (char-after))
+ (forward-char)))
+ (stage-status (prog1 (vc-got--parse-stage-char
+ (char-after))
+ (forward-char)))
+ (filename (progn
+ (forward-char)
+ (buffer-substring (point)
+
(line-end-position)))))
+ (list (file-relative-name (expand-file-name
filename root)
+ default-directory)
+ (or file-status (and stage-status 'staged))
+ stage-status))
+ do (forward-line))))))
(defun vc-got--parse-status-char (c)
"Parse status char C into a symbol accepted by `vc-state'."
- [elpa] externals/vc-got 6b6c8a7 064/145: fundamentals for staging changes, (continued)
- [elpa] externals/vc-got 6b6c8a7 064/145: fundamentals for staging changes, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 93562d9 073/145: fix default directory during stage operation, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 67332ba 076/145: docs fixes, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 5b4a6b9 069/145: more docs, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got a323f60 071/145: show list of files when committing staged stuff, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got daae979 066/145: implement vc-got-stage-commit to commit staged changes, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got dcb5b83 083/145: extract the filtering to its own function, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 76d978f 082/145: minor tweaks, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got cb97383 085/145: ignore ignored files but not up-to-date ones, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 445e2bd 087/145: typo, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 2d039a2 089/145: fix vc-dir listing on sub-directories,
ELPA Syncer <=
- [elpa] externals/vc-got 2b7241a 086/145: revamp readme, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 5fb2f47 099/145: implement revision-completion-table, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 0a3316a 091/145: implement log-view-mode, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 8014bde 101/145: implement half create-tag, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got e9a5df0 098/145: make vc-annotate-show-diff-revision-at-line works, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 567c17a 093/145: vc-got trims '----' by itself now, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 1870c8b 094/145: add a space when prompting for the push/pull operations, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got c151c25 095/145: implement vc-got-find-file-hook, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got 8ec0bb7 107/145: guard vc-got-diff against nil files, ELPA Syncer, 2021/09/09
- [elpa] externals/vc-got db89d6f 114/145: add a wrapper for the update command, ELPA Syncer, 2021/09/09