GNU bug report logs - #64055
31.0.50; log-view-modify-change-comment support for Git and Hg

Previous Next

Package: emacs;

Reported by: Morgan Smith <Morgan.J.Smith <at> outlook.com>

Date: Tue, 13 Jun 2023 23:05:02 UTC

Severity: normal

Tags: patch

Found in version 27.0.50

Full log


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

From: Sean Whitton <spwhitton <at> spwhitton.name>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Morgan.J.Smith <at> outlook.com, 64055 <at> debbugs.gnu.org, dgutov <at> yandex.ru
Subject: Re: Implementation of modifying VC change comments for Git
Date: Tue, 22 Oct 2024 16:25:52 +0800
Hello,

Thanks for trying the manual rebase.

On Mon 21 Oct 2024 at 04:48pm +03, Eli Zaretskii wrote:

> But let me describe what I did and saw, to make sure I did it
> correctly.
>
>>     git rebase --autosquash -i REV~1
>> 
>> where REV is the sha1 of the commit whose message you intend to edit.
>
> At this point "git log" shows a revision with my amended log message
> (let's call this AMENDED-REV), followed by the revision with the
> original log message (let's call it ORIG-REV).  So my Git command
> looks like this:
>
>   git rebase --autosquash -i ORIG-REV~1
>
> After this step, I see this in the editor (where I indented the text
> by 2 columns):
>
>   pick bf73d7e Foobar with some Unicode אבגד ą ě č
>   # pick bc3c567b2b136d040fd13373b6594c1ec026fec6 Foobar with some Unicode אבגד ą ě č

There are two things about this output that are unexpected to me:

- The first line of the AMENDED-REV message does not appear to start
  with "amend!".  I thought that you confirmed in a previous message
  that the commit messsage of AMENDED-REV did have this structure:

    amend! <ORIG-REV sha1>

    <AMENDED-REV amended message>

- The line for the AMENDED-REV message is commented out.  That means
  that git-rebase proposes to drop the commit.  I would guess that git
  wants to drop it because it introduces no content changes.

> Does this mean it didn't work? or did I misinterpret the steps?

I think that there are two possibilities.  If you lost the magic
"amend!" commit then please try again with an AMENDED-REV whose commit
message has the special "amend!" structure.

You can create one manually by passing --allow-empty to git-commit, or
you can use the previous version of my patch with everything except the
call to git-commit commented out -- here's the diff doing the
commenting-out again, if you need it.

On the other hand, if your AMENDED-REV does have the special "amend!"
structure, then I think we have to conclude that the older Git you have
does not support these special "amend!" commits at all, and so we can't
support it for log-view-modify-change-comment.

--8<---------------cut here---------------start------------->8---
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 59d5386bc72..d2ada63f71e 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -2042,8 +2042,8 @@ vc-git-modify-change-comment
     ;;     % git commit --allow-empty -m...
     ;;     % git rebase --autosquash -i REV~1
     ;;     % git stash pop
-    (unless nothing-staged
-      (vc-git-command nil 0 nil "stash" "push"))
+    ;; (unless nothing-staged
+    ;;   (vc-git-command nil 0 nil "stash" "push"))
     (unwind-protect
         (progn
           (when (cl-intersection '("--author" "--date") args
@@ -2064,12 +2064,15 @@ vc-git-modify-change-comment
                           (list "-m" message))
                         args)))
       (when (and msg-file (file-exists-p msg-file))
-        (delete-file msg-file)))
-    (with-environment-variables (("GIT_SEQUENCE_EDITOR" "true"))
-      (vc-git-command nil 0 nil "rebase" "--autosquash" "-i"
-                      (format "%s~1" rev)))
-    (unless nothing-staged
-      (vc-git-command nil 0 nil "stash" "pop" "--index"))))
+        ;; (delete-file msg-file)
+        ))
+    ;; (with-environment-variables (("GIT_SEQUENCE_EDITOR" "true"))
+    ;;   (vc-git-command nil 0 nil "rebase" "--autosquash" "-i"
+    ;;                   (format "%s~1" rev)))
+    ;; (unless nothing-staged
+    ;;   (vc-git-command nil 0 nil "stash" "pop" "--index"))
+    (message "temporary file is: %s" msg-file)
+    ))

 (defvar vc-git-extra-menu-map
   (let ((map (make-sparse-keymap)))
--8<---------------cut here---------------end--------------->8---

-- 
Sean Whitton




This bug report was last modified 104 days ago.

Previous Next


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