GNU bug report logs - #38343
27.0.50; vc git: Cannot edit outgoing log (like git commit --amend)

Previous Next

Package: emacs;

Reported by: Fredrik Nyqvist <fredrik.nyqvist94 <at> gmail.com>

Date: Sat, 23 Nov 2019 10:03:01 UTC

Severity: normal

Tags: patch

Found in version 27.0.50

Fixed in version 31.1

Done: Sean Whitton <spwhitton <at> spwhitton.name>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 38343 in the body.
You can then email your comments to 38343 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#38343; Package emacs. (Sat, 23 Nov 2019 10:03:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Fredrik Nyqvist <fredrik.nyqvist94 <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 23 Nov 2019 10:03:04 GMT) Full text and rfc822 format available.

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

From: Fredrik Nyqvist <fredrik.nyqvist94 <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.0.50; vc git: Cannot edit outgoing log (like git commit --amend)
Date: Sat, 23 Nov 2019 11:01:46 +0100
[Message part 1 (text/plain, inline)]
Hi,

I would like to use vc mode to edit an outgoing commit message.

Steps to reproduce:
1. emacs -Q /path/to/git/repo
2. Edit a file and then
3. Run vc-next-action to create a commit: C-x v v
4. Write a commit message and end with C-c C-c
5. Now Open the outgoing log (vc-log-outgoing) : C-x v O
6. Try to edit the commit message (log-view-modify-change-comment): e

This message is printed:

log-view-current-file: Unable to determine the current file


In GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.5)
 of 2019-11-23 built on gnu
Repository revision: 6d4d00c63417e3479e978a373f252b9f2709ce39
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12004000
System Description: Debian GNU/Linux 10 (buster)

Recent messages:
Auto-saving...done
Specified image bit depth is not supported by XRender [2 times]

Configured features:
XPM JPEG TIFF GIF PNG SOUND DBUS GSETTINGS GLIB NOTIFY INOTIFY
LIBSELINUX GNUTLS FREETYPE HARFBUZZ XFT ZLIB TOOLKIT_SCROLL_BARS GTK3
X11 XDBE XIM MODULES THREADS PDUMPER GMP

Important settings:
  value of $LANG: sv_SE.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Dired by name

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(help-mode pp shadow sort mail-extr emacsbug message rmc puny
format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg
epg-config gnus-util rmail rmail-loaddefs text-property-search time-date
subr-x seq byte-opt gv bytecomp byte-compile cconv mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs
cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
dired dired-loaddefs tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame minibuffer cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote threads dbusbind
inotify dynamic-setting system-font-setting font-render-setting
move-toolbar gtk x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 49936 10334)
 (symbols 48 6110 0)
 (strings 32 15815 1297)
 (string-bytes 1 516576)
 (vectors 16 10114)
 (vector-slots 8 132119 14836)
 (floats 8 23 70)
 (intervals 56 347 6)
 (buffers 1000 16))
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38343; Package emacs. (Mon, 25 Nov 2019 12:17:01 GMT) Full text and rfc822 format available.

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

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Fredrik Nyqvist <fredrik.nyqvist94 <at> gmail.com>, 38343 <at> debbugs.gnu.org
Subject: Re: bug#38343: 27.0.50; vc git: Cannot edit outgoing log (like git
 commit --amend)
Date: Mon, 25 Nov 2019 13:48:01 +0200
On 23.11.2019 12:01, Fredrik Nyqvist wrote:

> I would like to use vc mode to edit an outgoing commit message.
> 
> Steps to reproduce:
> 1. emacs -Q /path/to/git/repo
> 2. Edit a file and then
> 3. Run vc-next-action to create a commit: C-x v v
> 4. Write a commit message and end with C-c C-c
> 5. Now Open the outgoing log (vc-log-outgoing) : C-x v O
> 6. Try to edit the commit message (log-view-modify-change-comment): e
> 
> This message is printed:
> 
> log-view-current-file: Unable to determine the current file

Yes. This feature seems unfinished, and it was never updated for the 
newer VC systems.

However, we have an option for amending the last commit (press C-x C-e 
in an already open log-edit buffer). It only works with Git and Hg now.

It would be good to unify these two features somehow.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38343; Package emacs. (Mon, 25 Nov 2019 20:17:02 GMT) Full text and rfc822 format available.

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

From: Fredrik Nyqvist <fredrik.nyqvist94 <at> gmail.com>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 38343 <at> debbugs.gnu.org
Subject: Re: bug#38343: 27.0.50; vc git: Cannot edit outgoing log (like git
 commit --amend)
Date: Mon, 25 Nov 2019 21:16:02 +0100
[Message part 1 (text/plain, inline)]
Yes, I have tried the option you mention to edit the last commit with C-x
C-e and it is working fine.
But It seems that it only allows amending the last commit if I have edited
a file.

As I understand it I need to edit a file and then do vc-next-action to get
to the log-edit buffer
where you can do C-x C-e.

I could not find a way to do this if just the commit message is supposed to
be updated.

Den mån 25 nov. 2019 kl 12:48 skrev Dmitry Gutov <dgutov <at> yandex.ru>:

> On 23.11.2019 12:01, Fredrik Nyqvist wrote:
>
> > I would like to use vc mode to edit an outgoing commit message.
> >
> > Steps to reproduce:
> > 1. emacs -Q /path/to/git/repo
> > 2. Edit a file and then
> > 3. Run vc-next-action to create a commit: C-x v v
> > 4. Write a commit message and end with C-c C-c
> > 5. Now Open the outgoing log (vc-log-outgoing) : C-x v O
> > 6. Try to edit the commit message (log-view-modify-change-comment): e
> >
> > This message is printed:
> >
> > log-view-current-file: Unable to determine the current file
>
> Yes. This feature seems unfinished, and it was never updated for the
> newer VC systems.
>
> However, we have an option for amending the last commit (press C-x C-e
> in an already open log-edit buffer). It only works with Git and Hg now.
>

It would be good to unify these two features somehow.
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38343; Package emacs. (Mon, 25 Nov 2019 22:50:02 GMT) Full text and rfc822 format available.

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

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Fredrik Nyqvist <fredrik.nyqvist94 <at> gmail.com>
Cc: 38343 <at> debbugs.gnu.org
Subject: Re: bug#38343: 27.0.50; vc git: Cannot edit outgoing log (like git
 commit --amend)
Date: Tue, 26 Nov 2019 00:49:18 +0200
On 25.11.2019 22:16, Fredrik Nyqvist wrote:
> Yes, I have tried the option you mention to edit the last commit with 
> C-x C-e and it is working fine.
> But It seems that it only allows amending the last commit if I have 
> edited a file.

Yes. Not sure how to change an arbitrary commit in Git anyway (without 
interactive rebase). The best approximation looks like this:

https://stackoverflow.com/a/48999882/615245

> As I understand it I need to edit a file and then do vc-next-action to 
> get to the log-edit buffer
> where you can do C-x C-e.

Yes.

> I could not find a way to do this if just the commit message is supposed 
> to be updated.

And that is indeed the main downside of our current solution.

(The way to do it is to edit, call vc-next-action, then undo the edit in 
the file, but commit the amended message anyway. Which could be more 
efficient).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38343; Package emacs. (Tue, 26 Nov 2019 20:45:02 GMT) Full text and rfc822 format available.

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

From: Fredrik Nyqvist <fredrik.nyqvist94 <at> gmail.com>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 38343 <at> debbugs.gnu.org
Subject: Re: bug#38343: 27.0.50; vc git: Cannot edit outgoing log (like git
 commit --amend)
Date: Tue, 26 Nov 2019 21:43:54 +0100
[Message part 1 (text/plain, inline)]
Den mån 25 nov. 2019 kl 23:49 skrev Dmitry Gutov <dgutov <at> yandex.ru>:

> On 25.11.2019 22:16, Fredrik Nyqvist wrote:
> > Yes, I have tried the option you mention to edit the last commit with
> > C-x C-e and it is working fine.
> > But It seems that it only allows amending the last commit if I have
> > edited a file.
>
> Yes. Not sure how to change an arbitrary commit in Git anyway (without
> interactive rebase). The best approximation looks like this:
>
> https://stackoverflow.com/a/48999882/615245


I am not sure how to do it in a good way either. Maybe the option to edit
an
older commit message could be skipped for vc-git. And then just allow amend
on the latest one.
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38343; Package emacs. (Wed, 27 Nov 2019 00:11:01 GMT) Full text and rfc822 format available.

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

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Fredrik Nyqvist <fredrik.nyqvist94 <at> gmail.com>
Cc: 38343 <at> debbugs.gnu.org
Subject: Re: bug#38343: 27.0.50; vc git: Cannot edit outgoing log (like git
 commit --amend)
Date: Wed, 27 Nov 2019 02:10:33 +0200
On 26.11.2019 22:43, Fredrik Nyqvist wrote:
> Den mån 25 nov. 2019 kl 23:49 skrev Dmitry Gutov <dgutov <at> yandex.ru 
> <mailto:dgutov <at> yandex.ru>>:
> 
>     On 25.11.2019 22:16, Fredrik Nyqvist wrote:
>      > Yes, I have tried the option you mention to edit the last commit
>     with
>      > C-x C-e and it is working fine.
>      > But It seems that it only allows amending the last commit if I have
>      > edited a file.
> 
>     Yes. Not sure how to change an arbitrary commit in Git anyway (without
>     interactive rebase). The best approximation looks like this:
> 
>     https://stackoverflow.com/a/48999882/615245
> 
> 
> I am not sure how to do it in a good way either. Maybe the option to 
> edit an
> older commit message could be skipped for vc-git. And then just allow amend
> on the latest one.

The question is how to skip. Error in the end, after the user has 
already written the new commit message?

Or add a backend predicate action, like "can edit revision ##". That's 
one more action, though.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38343; Package emacs. (Wed, 27 Nov 2019 20:12:01 GMT) Full text and rfc822 format available.

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

From: Fredrik Nyqvist <fredrik.nyqvist94 <at> gmail.com>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 38343 <at> debbugs.gnu.org
Subject: Re: bug#38343: 27.0.50; vc git: Cannot edit outgoing log (like git
 commit --amend)
Date: Wed, 27 Nov 2019 21:11:36 +0100
[Message part 1 (text/plain, inline)]
Den ons 27 nov. 2019 kl 01:10 skrev Dmitry Gutov <dgutov <at> yandex.ru>:

> On 26.11.2019 22:43, Fredrik Nyqvist wrote:
> > Den mån 25 nov. 2019 kl 23:49 skrev Dmitry Gutov <dgutov <at> yandex.ru
> > <mailto:dgutov <at> yandex.ru>>:
> >
> >     On 25.11.2019 22:16, Fredrik Nyqvist wrote:
> >      > Yes, I have tried the option you mention to edit the last commit
> >     with
> >      > C-x C-e and it is working fine.
> >      > But It seems that it only allows amending the last commit if I
> have
> >      > edited a file.
> >
> >     Yes. Not sure how to change an arbitrary commit in Git anyway
> (without
> >     interactive rebase). The best approximation looks like this:
> >
> >     https://stackoverflow.com/a/48999882/615245
> >
> >
> > I am not sure how to do it in a good way either. Maybe the option to
> > edit an
> > older commit message could be skipped for vc-git. And then just allow
> amend
> > on the latest one.
>
> The question is how to skip. Error in the end, after the user has
> already written the new commit message?
>
> Or add a backend predicate action, like "can edit revision ##". That's
> one more action, though.
>

If the user is trying to edit an older commit message from the log-buffer
(with log-view-modify-change-comment) I think an error message is good,
before writing the commit message ("can't edit revision ##"). I feel that
it will be more clear at least.

Also we should think about how to handle a commit that has already been
pushed. In this case I guess a force push is needed, but maybe that is not
good to hide. Maybe it is better to just allow edit on local commits then.
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38343; Package emacs. (Wed, 27 Nov 2019 22:09:01 GMT) Full text and rfc822 format available.

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

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Fredrik Nyqvist <fredrik.nyqvist94 <at> gmail.com>
Cc: 38343 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#38343: 27.0.50; vc git: Cannot edit outgoing log (like git
 commit --amend)
Date: Thu, 28 Nov 2019 00:08:40 +0200
On 27.11.2019 22:11, Fredrik Nyqvist wrote:
> 
> 
> Den ons 27 nov. 2019 kl 01:10 skrev Dmitry Gutov <dgutov <at> yandex.ru 
> <mailto:dgutov <at> yandex.ru>>:
> 
>     On 26.11.2019 22:43, Fredrik Nyqvist wrote:
>      > Den mån 25 nov. 2019 kl 23:49 skrev Dmitry Gutov
>     <dgutov <at> yandex.ru <mailto:dgutov <at> yandex.ru>
>      > <mailto:dgutov <at> yandex.ru <mailto:dgutov <at> yandex.ru>>>:
>      >
>      >     On 25.11.2019 22:16, Fredrik Nyqvist wrote:
>      >      > Yes, I have tried the option you mention to edit the last
>     commit
>      >     with
>      >      > C-x C-e and it is working fine.
>      >      > But It seems that it only allows amending the last commit
>     if I have
>      >      > edited a file.
>      >
>      >     Yes. Not sure how to change an arbitrary commit in Git anyway
>     (without
>      >     interactive rebase). The best approximation looks like this:
>      >
>      > https://stackoverflow.com/a/48999882/615245
>      >
>      >
>      > I am not sure how to do it in a good way either. Maybe the option to
>      > edit an
>      > older commit message could be skipped for vc-git. And then just
>     allow amend
>      > on the latest one.
> 
>     The question is how to skip. Error in the end, after the user has
>     already written the new commit message?
> 
>     Or add a backend predicate action, like "can edit revision ##". That's
>     one more action, though.
> 
> 
> If the user is trying to edit an older commit message from the 
> log-buffer (with log-view-modify-change-comment) I think an error 
> message is good, before writing the commit message ("can't edit revision 
> ##"). I feel that it will be more clear at least.

Then it seems like we'd also have to introduce a new predicate backend 
action (like "can I edit this revision"). Given a recent discussion with 
our maintainer, I'm not confident we're allowed to do that.

> Also we should think about how to handle a commit that has already been 
> pushed. In this case I guess a force push is needed, but maybe that is 
> not good to hide. Maybe it is better to just allow edit on local commits 
> then.

Yeah, it's going to be a choice. Sometimes editing even a commit that's 
been pushed is okay (if it's on a personal branch). We already allow 
doing that with 'C-x C-e', so I'd rather we only gave out a warning 
(with yes-no prompt). The aforementioned predicate could do that job, too.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38343; Package emacs. (Thu, 28 Nov 2019 20:50:02 GMT) Full text and rfc822 format available.

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

From: Fredrik Nyqvist <fredrik.nyqvist94 <at> gmail.com>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 38343 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#38343: 27.0.50; vc git: Cannot edit outgoing log (like git
 commit --amend)
Date: Thu, 28 Nov 2019 21:48:57 +0100
[Message part 1 (text/plain, inline)]
Den ons 27 nov. 2019 kl 23:08 skrev Dmitry Gutov <dgutov <at> yandex.ru>:

> On 27.11.2019 22:11, Fredrik Nyqvist wrote:
> >
> >
> > Den ons 27 nov. 2019 kl 01:10 skrev Dmitry Gutov <dgutov <at> yandex.ru
> > <mailto:dgutov <at> yandex.ru>>:
> >
> >     On 26.11.2019 22:43, Fredrik Nyqvist wrote:
> >      > Den mån 25 nov. 2019 kl 23:49 skrev Dmitry Gutov
> >     <dgutov <at> yandex.ru <mailto:dgutov <at> yandex.ru>
> >      > <mailto:dgutov <at> yandex.ru <mailto:dgutov <at> yandex.ru>>>:
> >      >
> >      >     On 25.11.2019 22:16, Fredrik Nyqvist wrote:
> >      >      > Yes, I have tried the option you mention to edit the last
> >     commit
> >      >     with
> >      >      > C-x C-e and it is working fine.
> >      >      > But It seems that it only allows amending the last commit
> >     if I have
> >      >      > edited a file.
> >      >
> >      >     Yes. Not sure how to change an arbitrary commit in Git anyway
> >     (without
> >      >     interactive rebase). The best approximation looks like this:
> >      >
> >      > https://stackoverflow.com/a/48999882/615245
> >      >
> >      >
> >      > I am not sure how to do it in a good way either. Maybe the option
> to
> >      > edit an
> >      > older commit message could be skipped for vc-git. And then just
> >     allow amend
> >      > on the latest one.
> >
> >     The question is how to skip. Error in the end, after the user has
> >     already written the new commit message?
> >
> >     Or add a backend predicate action, like "can edit revision ##".
> That's
> >     one more action, though.
> >
> >
> > If the user is trying to edit an older commit message from the
> > log-buffer (with log-view-modify-change-comment) I think an error
> > message is good, before writing the commit message ("can't edit revision
> > ##"). I feel that it will be more clear at least.
>
> Then it seems like we'd also have to introduce a new predicate backend
> action (like "can I edit this revision"). Given a recent discussion with
> our maintainer, I'm not confident we're allowed to do that.
>
> OK I understand.


> > Also we should think about how to handle a commit that has already been
> > pushed. In this case I guess a force push is needed, but maybe that is
> > not good to hide. Maybe it is better to just allow edit on local commits
> > then.
>
> Yeah, it's going to be a choice. Sometimes editing even a commit that's
> been pushed is okay (if it's on a personal branch). We already allow
> doing that with 'C-x C-e', so I'd rather we only gave out a warning
> (with yes-no prompt). The aforementioned predicate could do that job, too.
>

That sounds good to me. At least so that log-view-modify-change-comment
works the same way as 'C-x C-e'.
[Message part 2 (text/html, inline)]

Forcibly Merged 38343 64055. Request was from Sean Whitton <spwhitton <at> spwhitton.name> to control <at> debbugs.gnu.org. (Tue, 04 Mar 2025 04:18:02 GMT) Full text and rfc822 format available.

Disconnected #38343 from all other report(s). Request was from Sean Whitton <spwhitton <at> spwhitton.name> to control <at> debbugs.gnu.org. (Tue, 04 Mar 2025 04:27:02 GMT) Full text and rfc822 format available.

Reply sent to Sean Whitton <spwhitton <at> spwhitton.name>:
You have taken responsibility. (Tue, 04 Mar 2025 04:28:02 GMT) Full text and rfc822 format available.

Notification sent to Fredrik Nyqvist <fredrik.nyqvist94 <at> gmail.com>:
bug acknowledged by developer. (Tue, 04 Mar 2025 04:28:02 GMT) Full text and rfc822 format available.

Message #38 received at 38343-done <at> debbugs.gnu.org (full text, mbox):

From: Sean Whitton <spwhitton <at> spwhitton.name>
To: 38343-done <at> debbugs.gnu.org
Subject: feature in 31.1
Date: Tue, 04 Mar 2025 12:27:14 +0800
Version: 31.1

This is available now.

-- 
Sean Whitton




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 01 Apr 2025 11:25:00 GMT) Full text and rfc822 format available.

This bug report was last modified 39 days ago.

Previous Next


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