GNU bug report logs - #35420
Support git in ediff-patch-file

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> linkov.net>

Date: Wed, 24 Apr 2019 21:42:02 UTC

Severity: wishlist

Tags: patch

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 35420 in the body.
You can then email your comments to 35420 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#35420; Package emacs. (Wed, 24 Apr 2019 21:42:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Juri Linkov <juri <at> linkov.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 24 Apr 2019 21:42:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: bug-gnu-emacs <at> gnu.org
Subject: Support git in ediff-patch-file
Date: Thu, 25 Apr 2019 00:38:43 +0300
[Message part 1 (text/plain, inline)]
This patch adds support for git patches to ediff-patch-file:

[ediff-ptch.git.patch (text/x-diff, inline)]
diff --git a/lisp/vc/ediff-ptch.el b/lisp/vc/ediff-ptch.el
index 4178b5a8c0..5c71c2c8cb 100644
--- a/lisp/vc/ediff-ptch.el
+++ b/lisp/vc/ediff-ptch.el
@@ -297,11 +297,15 @@ ediff-fixup-patch-map
 	      ;; file names. This is a heuristic intended to improve guessing
 	      (let ((default-directory (file-name-directory filename)))
 		(unless (or (file-name-absolute-p base-dir1)
-			    (file-name-absolute-p base-dir2)
-			    (not (file-exists-p base-dir1))
-			    (not (file-exists-p base-dir2)))
-		  (setq base-dir1 ""
-			base-dir2 "")))
+			    (file-name-absolute-p base-dir2))
+		  (if (and (file-exists-p base-dir1)
+			   (file-exists-p base-dir2))
+		      (setq base-dir1 ""
+			    base-dir2 "")
+		    (when (and (string-match-p "^a/" base-dir1)
+			       (string-match-p "^b/" base-dir2))
+		      (setq base-dir1 "a/"
+			    base-dir2 "b/")))))
 	      (or (string= (car proposed-file-names) "/dev/null")
 		  (setcar proposed-file-names
 			  (ediff-file-name-sans-prefix

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35420; Package emacs. (Thu, 25 Apr 2019 06:15:02 GMT) Full text and rfc822 format available.

Message #8 received at 35420 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: 35420 <at> debbugs.gnu.org
Subject: Re: bug#35420: Support git in ediff-patch-file
Date: Thu, 25 Apr 2019 09:14:21 +0300
> From: Juri Linkov <juri <at> linkov.net>
> Date: Thu, 25 Apr 2019 00:38:43 +0300
> 
> +		    (when (and (string-match-p "^a/" base-dir1)
> +			       (string-match-p "^b/" base-dir2))
> +		      (setq base-dir1 "a/"
> +			    base-dir2 "b/")))))

I think I saw the file names begin with i/ and w/ instead of a/ and
b/.  Not sure when/why this happens.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35420; Package emacs. (Thu, 25 Apr 2019 07:54:02 GMT) Full text and rfc822 format available.

Message #11 received at 35420 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 35420 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#35420: Support git in ediff-patch-file
Date: Thu, 25 Apr 2019 09:53:16 +0200
>>>>> On Thu, 25 Apr 2019 09:14:21 +0300, Eli Zaretskii <eliz <at> gnu.org> said:

    >> From: Juri Linkov <juri <at> linkov.net> Date: Thu, 25 Apr 2019
    >> 00:38:43 +0300
    >> 
    >> + (when (and (string-match-p "^a/" base-dir1) + (string-match-p
    >> "^b/" base-dir2)) + (setq base-dir1 "a/" + base-dir2 "b/")))))

    Eli> I think I saw the file names begin with i/ and w/ instead of
    Eli> a/ and b/.  Not sure when/why this happens.

You get i/, w/ and/or c/ when you run 'git diff' inside your working
tree, depending on whether the changed file is in the 'i'ndex,
'w'orking tree, or 'c'ache (also known as the staging area). Things
like 'git format-patch' and 'git show' use a/ and b/ by default.

And of course, since this is git, you can tell it to use other
prefixes using '--src-prefix' and '--dst-prefix'.

Robert




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35420; Package emacs. (Thu, 25 Apr 2019 08:48:02 GMT) Full text and rfc822 format available.

Message #14 received at 35420 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: 35420 <at> debbugs.gnu.org, juri <at> linkov.net
Subject: Re: bug#35420: Support git in ediff-patch-file
Date: Thu, 25 Apr 2019 11:46:33 +0300
> From: Robert Pluim <rpluim <at> gmail.com>
> Cc: Juri Linkov <juri <at> linkov.net>,  35420 <at> debbugs.gnu.org
> Date: Thu, 25 Apr 2019 09:53:16 +0200
> 
> You get i/, w/ and/or c/ when you run 'git diff' inside your working
> tree, depending on whether the changed file is in the 'i'ndex,
> 'w'orking tree, or 'c'ache (also known as the staging area). Things
> like 'git format-patch' and 'git show' use a/ and b/ by default.
> 
> And of course, since this is git, you can tell it to use other
> prefixes using '--src-prefix' and '--dst-prefix'.

Thanks.  I guess we'd like to support these use cases as well, right?

Also, what's the situation with hg?  Is it similar?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35420; Package emacs. (Thu, 25 Apr 2019 09:13:02 GMT) Full text and rfc822 format available.

Message #17 received at 35420 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 35420 <at> debbugs.gnu.org, juri <at> linkov.net
Subject: Re: bug#35420: Support git in ediff-patch-file
Date: Thu, 25 Apr 2019 11:12:45 +0200
>>>>> On Thu, 25 Apr 2019 11:46:33 +0300, Eli Zaretskii <eliz <at> gnu.org> said:

    >> From: Robert Pluim <rpluim <at> gmail.com> Cc: Juri Linkov
    >> <juri <at> linkov.net>, 35420 <at> debbugs.gnu.org Date: Thu, 25 Apr 2019
    >> 09:53:16 +0200
    >> 
    >> You get i/, w/ and/or c/ when you run 'git diff' inside your
    >> working tree, depending on whether the changed file is in the
    >> 'i'ndex, 'w'orking tree, or 'c'ache (also known as the staging
    >> area). Things like 'git format-patch' and 'git show' use a/ and
    >> b/ by default.
    >> 
    >> And of course, since this is git, you can tell it to use other
    >> prefixes using '--src-prefix' and '--dst-prefix'.

    Eli> Thanks.  I guess we'd like to support these use cases as
    Eli> well, right?

Yes, that would be a good improvement.

    Eli> Also, what's the situation with hg?  Is it similar?

I donʼt use hg, but based on a quick test it uses a/ and b/

Robert




Reply sent to Juri Linkov <juri <at> linkov.net>:
You have taken responsibility. (Sun, 05 May 2019 19:53:02 GMT) Full text and rfc822 format available.

Notification sent to Juri Linkov <juri <at> linkov.net>:
bug acknowledged by developer. (Sun, 05 May 2019 19:53:02 GMT) Full text and rfc822 format available.

Message #22 received at 35420-done <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Robert Pluim <rpluim <at> gmail.com>, 35420-done <at> debbugs.gnu.org
Subject: Re: bug#35420: Support git in ediff-patch-file
Date: Sun, 05 May 2019 22:51:56 +0300
>> You get i/, w/ and/or c/ when you run 'git diff' inside your working
>> tree, depending on whether the changed file is in the 'i'ndex,
>> 'w'orking tree, or 'c'ache (also known as the staging area). Things
>> like 'git format-patch' and 'git show' use a/ and b/ by default.
>> 
>> And of course, since this is git, you can tell it to use other
>> prefixes using '--src-prefix' and '--dst-prefix'.
>
> Thanks.  I guess we'd like to support these use cases as well, right?

I implemented support for these cases as well and pushed to master.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 03 Jun 2019 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 325 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.