GNU bug report logs -
#21166
24.4; vc-mode and git error on newly added file to new repository
Previous Next
Reported by: Ed Avis <eda <at> waniasset.com>
Date: Fri, 31 Jul 2015 14:44:02 UTC
Severity: minor
Tags: confirmed
Found in versions 24.5, 24.4
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
On 07/31/2015 08:27 PM, Ed Avis wrote:
> I guess you don't have to add an extra process call but just check for this error message, and if so, show the diff as from an empty tree.
That's a good point, but doing an extra process call depending on the
result of the first is also non-trivial here, because the first call is
often asynchronous, and we handle those in a not particularly composable
way.
For instance, this patch doesn't work reliably:
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 9522328..b556de1 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -1032,13 +1032,18 @@ or BRANCH^ (where \"^\" can be repeated)."
command
"--exit-code"
(append (vc-switches 'git 'diff)
- (list "-p" (or rev1 "HEAD") rev2 "--")))
+ (list "-p" rev1 rev2 "--")))
(vc-git-command (or buffer "*vc-diff*") 1 files
"difftool" "--exit-code" "--no-prompt" "-x"
(concat "diff "
(mapconcat 'identity
(vc-switches nil 'diff) " "))
- rev1 rev2 "--"))))
+ rev1 rev2 "--"))
+ (vc-run-delayed
+ (when (looking-at "fatal: bad revision 'HEAD'")
+ (let ((inhibit-read-only t))
+ (erase-buffer)
+ (vc-git-diff files "4b825dc642cb6eb9a060e54bf8d69288fbee4904"
rev2 buffer async))))))
(defun vc-git-revision-table (_files)
;; What about `files'?!? --Stef
This bug report was last modified 4 years and 227 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.