commit - dec54a7421874b547a977b2295288fb7e25e36c7
commit + 2d039a22b1141f81861fbd3b6f6c17beac2cd033
blob - 24b30398d007490be70e3941041b88a4cafb3251
blob + a620d48156afe5eef8a7fbcddcd0199e7c474b00
--- vc-got.el
+++ vc-got.el
(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
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'."