From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Steinar Bang Newsgroups: gmane.emacs.bugs 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 Message-ID: <87wragnf08.fsf@dod.no> References: <87sjrxl0r1.fsf@dod.no> <878vn0yp42.fsf@dod.no> <87vcq2ygzs.fsf@dod.no> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1322775961 14580 80.91.229.12 (1 Dec 2011 21:46:01 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 1 Dec 2011 21:46:01 +0000 (UTC) Cc: 8756@debbugs.gnu.org To: Dan Nicolaescu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Dec 01 22:45:57 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RWES5-0004rS-Bp for geb-bug-gnu-emacs@m.gmane.org; Thu, 01 Dec 2011 22:45:57 +0100 Original-Received: from localhost ([::1]:35176 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RWES4-0005Jl-S0 for geb-bug-gnu-emacs@m.gmane.org; Thu, 01 Dec 2011 16:45:56 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:47788) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RWES1-0005Jg-Nr for bug-gnu-emacs@gnu.org; Thu, 01 Dec 2011 16:45:54 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RWES0-0005A8-51 for bug-gnu-emacs@gnu.org; Thu, 01 Dec 2011 16:45:53 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:48131) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RWES0-0005A4-3L for bug-gnu-emacs@gnu.org; Thu, 01 Dec 2011 16:45:52 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1RWESA-0005Dd-CQ for bug-gnu-emacs@gnu.org; Thu, 01 Dec 2011 16:46:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Steinar Bang Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 01 Dec 2011 21:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8756 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 8756-submit@debbugs.gnu.org id=B8756.132277590419991 (code B ref 8756); Thu, 01 Dec 2011 21:46:02 +0000 Original-Received: (at 8756) by debbugs.gnu.org; 1 Dec 2011 21:45:04 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RWERC-0005CA-FD for submit@debbugs.gnu.org; Thu, 01 Dec 2011 16:45:03 -0500 Original-Received: from rainey.bang.priv.no ([212.110.185.190]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RWER8-0005Bh-IF for 8756@debbugs.gnu.org; Thu, 01 Dec 2011 16:45:00 -0500 In-Reply-To: (Dan Nicolaescu's message of "Thu, 01 Dec 2011 13:15:16 -0500") User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/23.1 (gnu/linux) X-SA-Exim-Connect-IP: 84.208.231.161 X-SA-Exim-Rcpt-To: too long (recipient list exceeded maximum allowed size of 8 bytes) X-SA-Exim-Mail-From: sb@dod.no X-SA-Exim-Version: 4.2.1 (built Mon, 22 Mar 2010 06:51:10 +0000) X-SA-Exim-Scanned: Yes (on rainey.bang.priv.no) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Thu, 01 Dec 2011 16:46:02 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:54575 Archived-At: >>>>> Dan Nicolaescu : > 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