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: Thu, 01 Dec 2011 22:44:38 +0100	[thread overview]
Message-ID: <87wragnf08.fsf@dod.no> (raw)
In-Reply-To: <yxqty5k40qz.fsf@fencepost.gnu.org> (Dan Nicolaescu's message of "Thu, 01 Dec 2011 13:15:16 -0500")

>>>>> Dan Nicolaescu <dann@gnu.org>:

> Is it possible to compute the file name just the sha1?  That would allow
> us to avoid using --name-only.

Maybe.

From what I learnt when I asked a question on the git list[1], here is
an example on the rename commit:

 1. first do a diff-tree on the commit where the rename takes place
    #+begin_example
      sb@somehost:~$ git diff-tree -M a50a042e5af770928eaa8b636517d66bc2a13ee7
      a50a042e5af770928eaa8b636517d66bc2a13ee7
      :100644 100644 f6a9be87a391c29bf58467e6cda8ffc2375a1471 e1dadc8553ec388b790a4c4dd3f3b6e498f9eedc M      .emacs
      :040000 040000 beff95d4c2f3d62e7d41f061738b86e3187ec887 155295fd0ad500419a0b5e2d4c571334675fbae0 M      apps
    #+end_example
    As you can see, nothing obvious here, so you have to try "diff -M"
    on the different sha1 pairs.  I, as a human, can see that the
    first one isn't an obvious candidate.  But a program would have to
    try all of them
 2. do "diff -M" on the sha1 pairs of diff-tree results to find the
    renames
    #+begin_example
      sb@somehost:~$ git diff -M f6a9be87a391c29bf58467e6cda8ffc2375a1471 e1dadc8553ec388b790a4c4dd3f3b6e498f9eedc
      diff --git a/f6a9be87a391c29bf58467e6cda8ffc2375a1471 b/e1dadc8553ec388b790a4c4dd3f3b6e498f9eedc
      index f6a9be8..e1dadc8 100644
      --- a/f6a9be87a391c29bf58467e6cda8ffc2375a1471
      +++ b/e1dadc8553ec388b790a4c4dd3f3b6e498f9eedc
      @@ -63,6 +63,8 @@ to be something different.")
             (push (concat apps-dir "/share/emacs21/site-lisp") load-path))
         (if running-emacs22
             (push (concat apps-dir "/share/emacs22/site-lisp") load-path))
      +  (if running-emacs23
      +      (push (concat apps-dir "/share/emacs23/site-lisp") load-path))
         (setq apps-bin (concat apps-dir "/bin"))
         (when (file-directory-p apps-elisp)
           (add-to-list 'load-path apps-elisp))
      sb@somehost:~$ git diff -M beff95d4c2f3d62e7d41f061738b86e3187ec887 155295fd0ad500419a0b5e2d4c571334675fbae0
      diff --git a/share/emacs/site-lisp/vc-git.el b/share/emacs23/site-lisp/vc-git.el
      similarity index 100%
      rename from share/emacs/site-lisp/vc-git.el
      rename to share/emacs23/site-lisp/vc-git.el
    #+end_example

So... I guess is possible.  But you have to work your way back through
each commit in the history, and look for "rename to" and "rename from",
and keep track of all renames as you work your way backwards.

Wnen I think of it, it would be simpler to do a "git log --follow
--name-only" and just regexp out the paths and commits and get an alist
from commit to path, or something like that...?  Actually, you probably
don't have to create that alist, just doing "git log --follow
--name-only" just to get the path when you need it, maybe...?

[1] Question asked on the git list
    http://thread.gmane.org/gmane.comp.version-control.git/186009/focus=186032





  reply	other threads:[~2011-12-01 21:44 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
2011-12-01 18:15         ` Dan Nicolaescu
2011-12-01 21:44           ` Steinar Bang [this message]
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=87wragnf08.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).