unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Steinar Bang <sb@dod.no>
To: Dan Nicolaescu <dann@gnu.org>
Cc: 8756@debbugs.gnu.org
Subject: bug#8756: 23.3; vc-git.el doesn't use --follow argument in vc-git-print-log
Date: Tue, 29 Nov 2011 18:29:27 +0100	[thread overview]
Message-ID: <87vcq2ygzs.fsf@dod.no> (raw)
In-Reply-To: <yxqmxbgkl9r.fsf@fencepost.gnu.org> (Dan Nicolaescu's message of "Mon, 28 Nov 2011 16:08:32 -0500")

>>>>> Dan Nicolaescu <dann@gnu.org>:
> Steinar Bang <sb@dod.no> writes:

>> ....  The first problem I ran into, was that the emacs 23.1 version
>> of `vc-git-print-log' used "git rev-list" instead of "git log".  And
>> only "git log" supports "--follow" to track renames

> vc-git-print-log currently uses "git log", so your changes should not
> be needed.

Something similar wille be needed, if vc-git-print-log is supposed to
support a files argument of more than a single file, since "--follow" is
only supported for a single file.

#begin_example
  sb@somehost:~$ git log --follow ~/apps/share/emacs23/site-lisp/vc-git.el ~/.emacs
  usage: git logs can only follow renames on one pathname at a time
  sb@somehost:~$ git log --follow 
  usage: git logs can only follow renames on one pathname at a time
#end_example

> To solve this problem please figure out the git command (or set of
> commands) that produces the expected diff.  Anything displayed in the
> log buffer can be considered as available.  After that we need to figure
> out how to make VC use that/those command(s).

To be able to get a working diff beyond the rename, you need the path to
where the file used to be.  If you add the "--name-only" flag to "git
log", you will get an extra line containing the path of the file, in a
form that can be given to a "git diff".

Using the log result at the bottom, here's an example that gives a
useful diff, using the path of the first commit:
#begin_example
  sb@somehost:~$ git diff a92a3d062dac1b0ec5eece4ed6f9570e59f1a69b 8d304db76993a0da0894b3d30794a2c5ec4927fe -- apps/share/emacs/site-lisp/vc-git.el
  diff --git a/apps/share/emacs/site-lisp/vc-git.el b/apps/share/emacs/site-lisp/vc-git.el
  index b9b63ce..e4b0188 100644
  --- a/apps/share/emacs/site-lisp/vc-git.el
  +++ b/apps/share/emacs/site-lisp/vc-git.el
  @@ -604,7 +604,7 @@ for the --graph option."
          (apply 'vc-git-command buffer
                 'async files
                 (append
  -               '("log" "--no-color")
  +               '("log" "--follow" "--no-color")
                  (when shortlog
                    '("--graph" "--decorate" "--date=short"
                       "--pretty=tformat:%d%h  %ad  %s" "--abbrev-commit"))
#end_example

Blame for a path beyond the rename also works, just use the commit you
want to blame from, and the path of that commit in the log buffer:
 git blame a92a3d062dac1b0ec5eece4ed6f9570e59f1a69b -- apps/share/emacs/site-lisp/vc-git.e

Here's the example of a diff output with paths I used to get the above
commands.  The rename commit is a50a042e5af770928eaa8b636517d66bc2a13ee7
and the path given on that log entry, is the new path.

#begin_example
  sb@somehost:~$ git log --follow --name-only ~/apps/share/emacs23/site-lisp/vc-git.el
  commit ae93673cf7a325ac6882b73a4280cfba3fca41e9
  Author: Steinar Bang <sb@dod.no>
  Date:   Mon Nov 28 23:12:47 2011 +0100
  
      Make `vc-git-print-log' on a single file use "git log --follow" instead of "git rev-list".
      
      This is to make the `C-x v l' command show log entries across file
      renames.
      
      Only partially successful, since diffs, annotate, and finding the
      version of the file, doesn't work across the renaming boundary.
  
  apps/share/emacs23/site-lisp/vc-git.el
  
  commit 4098e78805561b9af3e29184a8133baaf6d16621
  Author: Steinar Bang <sb@dod.no>
  Date:   Mon Nov 28 10:28:49 2011 +0100
  
      Emacs 23.1 version of vc-git.el.
  
  apps/share/emacs23/site-lisp/vc-git.el
  
  commit a50a042e5af770928eaa8b636517d66bc2a13ee7
  Author: Steinar Bang <sb@dod.no>
  Date:   Thu Jun 23 19:26:28 2011 +0200
  
      Load the locally modified vc-git.el only for emacs23 (fails on emacs22).
  
  apps/share/emacs23/site-lisp/vc-git.el
  
  commit 8d304db76993a0da0894b3d30794a2c5ec4927fe
  Author: Steinar Bang <sb@dod.no>
  Date:   Sun May 29 22:24:58 2011 +0200
  
      Use the --follow flag on the "git log" command, to get full history across file moves in vc-git-print-log.
  
  apps/share/emacs/site-lisp/vc-git.el
  
  commit a92a3d062dac1b0ec5eece4ed6f9570e59f1a69b
  Author: Steinar Bang <sb@dod.no>
  Date:   Sun May 29 22:23:51 2011 +0200
  
      Adding the vc-git.el from emacs 23.3.
  
  apps/share/emacs/site-lisp/vc-git.el
#end_example





  reply	other threads:[~2011-11-29 17:29 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-29 20:17 bug#8756: 23.3; vc-git.el doesn't use --follow argument in vc-git-print-log Steinar Bang
2011-05-31  5:25 ` Dan Nicolaescu
2011-11-28 20:21   ` Steinar Bang
2011-11-28 21:08     ` Dan Nicolaescu
2011-11-29 17:29       ` Steinar Bang [this message]
2011-12-01 18:15         ` Dan Nicolaescu
2011-12-01 21:44           ` Steinar Bang
2011-12-01 21:57             ` Steinar Bang
2014-01-09 19:21               ` Glenn Morris
2014-01-11  1:40                 ` Dan Nicolaescu
2014-01-11 14:15                   ` Steinar Bang
2014-01-11 23:32                     ` Steinar Bang
2014-01-12  1:46                     ` Dan Nicolaescu
2014-01-12  3:57                       ` Eli Zaretskii
2014-01-12 10:15                       ` Steinar Bang
2014-01-12 10:45                         ` Steinar Bang
2014-07-30 20:35 ` bug#8756: " Dmitry Dzhus
2019-11-03 14:32   ` Lars Ingebrigtsen
2019-11-03 18:48     ` Dmitry Gutov
2019-11-08 20:44       ` Lars Ingebrigtsen

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=87vcq2ygzs.fsf@dod.no \
    --to=sb@dod.no \
    --cc=8756@debbugs.gnu.org \
    --cc=dann@gnu.org \
    /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).