unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Clément Pit--Claudel" <clement.pitclaudel@live.com>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: 27953@debbugs.gnu.org
Subject: bug#27953: vc-region-history doesn't follow renames
Date: Sat, 5 Aug 2017 15:06:00 +0200	[thread overview]
Message-ID: <3eb66411-a4c1-78e7-4ec1-324fee770702@live.com> (raw)
In-Reply-To: <jwvpocb5k06.fsf-monnier+emacsbugs@gnu.org>


[-- Attachment #1.1.1: Type: text/plain, Size: 775 bytes --]

On 2017-08-04 19:21, Stefan Monnier wrote:
>> Indeed, `git log -p --follow -L5,25:file.c' doesn't work.  But `git
>> log -p --follow -L5,25:file.c file.c' does work (note the extra mention of
>> the file name).
> 
> Hmm... what's the difference between
> 
>     git log -p -L5,25:file.c
> and
>     git log -p -L5,25:file.c file.c

The second one allows --follow; the first one doesn't.  I don't know what differences they may be beyond that :/

> Would this issue deserve a bug-report to Git?

Possibly; it's a bit intimidating.

>> Any arguments against the attached patch?
> 
> I'd suggest to compute (file-relative-name file) only once, and to add
> bug#27953 to the comment, but otherwise, looks good.

Attached an updated version :)

Clément.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.1.2: 0001-Follow-renames-in-vc-git-region-history.patch --]
[-- Type: text/x-patch; name="0001-Follow-renames-in-vc-git-region-history.patch", Size: 1288 bytes --]

From 78959b7c2bb7a13c4ab965e2617e3e9eec127b35 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cl=C3=A9ment=20Pit--Claudel?= <clement.pitclaudel@live.com>
Date: Fri, 4 Aug 2017 17:03:20 +0200
Subject: [PATCH] Follow renames in vc-git-region-history

* lisp/vc/vc-git.el (vc-git-region-history): Pass --follow.  This
requires a path spec, so pass that too.
---
 lisp/vc/vc-git.el | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index cc3e295..7d13dfe 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -1159,8 +1159,11 @@ vc-git-region-history
                 (- (+ curno curcnt) (+ headno headcnt)))))
       (setq lto (- lto (or to-offset last-offset)))
       (setq lfrom (- lfrom (or to-offset last-offset)))))
-  (vc-git-command buffer 'async nil "log" "-p" ;"--follow" ;FIXME: not supported?
-                  (format "-L%d,%d:%s" lfrom lto (file-relative-name file))))
+  (let ((file-relname (file-relative-name file)))
+    (vc-git-command buffer 'async nil "log" "-p" "--follow"
+              (format "-L%d,%d:%s" lfrom lto file-relname)
+              ;; Must include one path spec for --follow to work (#27953)
+              file-relname)))
 
 (require 'diff-mode)
 
-- 
2.7.4


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  parent reply	other threads:[~2017-08-05 13:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-04 15:12 bug#27953: vc-region-history doesn't follow renames Clément Pit--Claudel
2017-08-04 17:21 ` Stefan Monnier
2017-08-04 17:40   ` Andreas Schwab
2017-08-05 13:06   ` Clément Pit--Claudel [this message]
2017-08-05 17:05     ` Kyle Meyer
2017-08-05 17:23       ` Eli Zaretskii
2017-08-05 18:03         ` Andreas Schwab
2017-08-05 18:26           ` Eli Zaretskii
2017-08-05 20:06             ` Kyle Meyer
2017-08-05 17:27       ` Clément Pit--Claudel
2017-08-05 20:55         ` Kyle Meyer
2017-08-05 18:08       ` Andreas Schwab

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=3eb66411-a4c1-78e7-4ec1-324fee770702@live.com \
    --to=clement.pitclaudel@live.com \
    --cc=27953@debbugs.gnu.org \
    --cc=monnier@IRO.UMontreal.CA \
    /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).