GNU bug report logs - #57400
29.0.50; Support sending patches from VC directly

Previous Next

Package: emacs;

Reported by: Antoine Kalmbach <ane <at> iki.fi>

Date: Thu, 25 Aug 2022 08:49:01 UTC

Severity: normal

Found in version 29.0.50

Done: Philip Kaludercic <philipk <at> posteo.net>

Bug is archived. No further changes may be made.

Full log


Message #310 received at 57400 <at> debbugs.gnu.org (full text, mbox):

From: Philip Kaludercic <philipk <at> posteo.net>
To: Juri Linkov <juri <at> linkov.net>
Cc: Robert Pluim <rpluim <at> gmail.com>, 57400 <at> debbugs.gnu.org,
 Antoine Kalmbach <ane <at> iki.fi>
Subject: Re: bug#57400: 29.0.50; Support sending patches from VC directly
Date: Thu, 13 Oct 2022 20:25:03 +0000
[Message part 1 (text/plain, inline)]
Philip Kaludercic <philipk <at> posteo.net> writes:

> Juri Linkov <juri <at> linkov.net> writes:
>
>>>>> I have done all of the above and am prepared to push the changes, but
>>>>> before I do I was wondering if anyone would have any objections to the
>>>>> following changes to vc-git.el:
>>>>
>>>> Indeed, abbreviated commits are more usable.  But please wait a little
>>>> for more comments.
>>>
>>> Also note that this change would also only affect working-revision and
>>> previous-revision.  If necessary or preferred, I could also modify the
>>> changes to only affect working-revision.
>>
>> Nicer names would be better everywhere, including previous-revision.
>> But: In my recent mail to RMS I raised questions about 'C-u C-x v ='.
>> And when I tried your patch then the default value for "HEAD"
>> often is very strange.  For example, try to type 'C-u C-x v ='
>> on the file lisp/paren.el.  Here is what it shows:
>>
>>   Older revision [remotes/origin/scratch/eglot2emacs~488]: 
>>
>> I wonder where comes "eglot2emacs" from when the current branch is master?
>
> Hmm, it looks like Git tried to find a symbolic reference at any cost,
> so it found some branch found a relative commit.  I'll try and find out
> if there is a way to avoid this, and only use symbolic references if
> there is no positional offset.

This patch should prevent these kinds things from happening:

[Message part 2 (text/plain, inline)]
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 5d564f3c94..47c9082368 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -2030,14 +2030,17 @@ vc-git--run-command-string
                     (setq ok nil))))))
     (and ok str)))
 
-(defun vc-git-symbolic-commit (commit)
+(defun vc-git-symbolic-commit (commit &optional force)
   "Translate COMMIT string into symbolic form.
-Returns nil if not possible."
+Returns nil if not possible.  If the optional argument FORCE is
+non-nil, revisions containing positional
+arguments (e.g. \"master~8\") will also be accepted."
   (and commit
        (let ((name (with-temp-buffer
                      (and
                       (vc-git--out-ok "name-rev" "--name-only" commit)
                       (goto-char (point-min))
+                      (or force (not (looking-at "^.*[~^].*$" t)))
                       (= (forward-line 2) 1)
                       (bolp)
                       (buffer-substring-no-properties (point-min)

This bug report was last modified 2 years and 219 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.