unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: "Nicolás Ojeda Bär" <n.oje.bar@gmail.com>, 55871@debbugs.gnu.org
Subject: bug#55871: Acknowledgement (27.1; vc-git.el log view 'a', 'f', 'd' do not work when following renames)
Date: Mon, 12 Dec 2022 01:02:45 +0200	[thread overview]
Message-ID: <f90b87ca-4b22-5dae-f6f3-1e9b6d63a4ac@yandex.ru> (raw)
In-Reply-To: <78f97339-2aca-0dbd-4cb4-3532af78a895@yandex.ru>

On 18/08/2022 05:10, Dmitry Gutov wrote:
> I experimented with --follow myself in the past, and it is annoying in 
> that it skips commits, some of which are visible in the log when you 
> don't use --follow, details here: 
> https://stackoverflow.com/questions/46487476/git-log-follow-graph-skips-commits
> 
> So I figured the approach in (3) has something to do with it. But it 
> seems not to be the case.

I've tried another idea: to pre-process the file's history and pass all 
historical file names to 'git log' inside vc-git-print-log.

Unfortunately, that delays the appearance of the log significantly. In 
the Emacs repo that comes down to several seconds, which seems 
unacceptable. But that would fix both the problems with a/f/d and the 
bug described in the SO question above.

Looking around for how other software deals with it, it seems GitHub has 
found a satisfactory solution which adds a new UI element with basically 
zero performance cost.

At first it was implemented in a Chrome extension for it 
(https://github.com/jeffstieler/github-follow-extension), but then added 
to the core functionality this summer 
(https://github.blog/changelog/2022-06-06-view-commit-history-across-file-renames-and-moves/).

This gif shows the workflow: 
https://i0.wp.com/user-images.githubusercontent.com/4021812/171795153-4f327a04-eb27-4d46-acb1-73d2e82ce4c5.gif?ssl=1

We should be able to do something similar.

Step 1: Drop the '--follow' argument in all cases.

Step 2: After the log is finished printing, we detect somehow that the 
last commit was a rename one. Perhaps using an additional process call, 
or perhaps by adding some output to the process which we'll hide through 
font-lock or process filter. When it is a rename, we print a message at 
the end, saying the file has been renamed. And a button saying e.g. 
"Print Previous Log", which would print the history for the previous 
name. That history should also include the missing commits from the SO 
question.

Not sure how to deal with duplicating file names best (like etc/NEWS has 
been the name of many files in the Emacs repo): either limiting the 
first revision to start from -- but that keep bring back the missing 
commit problem, oh well -- or some other way.

Can't exactly check what GitHub is doing, because they don't actually 
provide this for NEWS.24, guess because it was not a straight rename: 
https://github.com/emacs-mirror/emacs/commits/master/etc/NEWS.24

But

   git log -M50% -C --stat 5f8947c7007d1d8 -n 1

at least detects it as a copy if not a rename. Guess they didn't adopt 
the whole follow-renames logic, and we can do better.

I don't have any code to show, but it shouldn't require too many changes.





  parent reply	other threads:[~2022-12-11 23:02 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-09  9:54 bug#55871: 27.1; vc-git.el log view 'a', 'f', 'd' do not work when following renames Nicolás Ojeda Bär
     [not found] ` <handler.55871.B.16547851264967.ack@debbugs.gnu.org>
2022-06-10 17:31   ` bug#55871: Acknowledgement (27.1; vc-git.el log view 'a', 'f', 'd' do not work when following renames) Nicolás Ojeda Bär
2022-08-18  2:10     ` Dmitry Gutov
2022-09-06 10:56       ` bug#55871: 27.1; vc-git.el log view 'a', 'f', 'd' do not work when following renames Lars Ingebrigtsen
2022-09-06 12:12         ` Nicolás Ojeda Bär
2022-09-06 12:13           ` Lars Ingebrigtsen
2022-12-03  2:02           ` Dmitry Gutov
2022-12-11 23:02       ` Dmitry Gutov [this message]
2022-12-12 16:44         ` bug#55871: Acknowledgement (27.1; vc-git.el log view 'a', 'f', 'd' do not work when following renames) Nicolás Ojeda Bär
2022-12-13  1:23           ` Dmitry Gutov
2023-12-14  0:52             ` Dmitry Gutov
2023-12-14  1:23               ` Dmitry Gutov
2023-12-15  2:01                 ` Dmitry Gutov
2023-12-15 13:05                   ` Eli Zaretskii
2023-12-15 14:39                     ` Dmitry Gutov
2023-12-15 15:10                       ` Eli Zaretskii
2023-12-15 20:45                         ` Dmitry Gutov
2023-12-16  7:21                           ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f90b87ca-4b22-5dae-f6f3-1e9b6d63a4ac@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=55871@debbugs.gnu.org \
    --cc=n.oje.bar@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).