git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* using git-difftool -d when cherry-picking
@ 2016-04-27  9:12 Jan Smets
  2016-04-30  1:19 ` David Aguilar
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Smets @ 2016-04-27  9:12 UTC (permalink / raw)
  To: git

Hi

Please consider following example

#!/bin/bash
rm -rf /tmp/gittest
mkdir /tmp/gittest
cd /tmp/gittest

git init

echo $RANDOM > testfile
git add testfile
git commit -m test -a

git branch X
git checkout X
echo $RANDOM > testfile
git add testfile
git commit -m test -a

git checkout master
echo $RANDOM > testfile
git add testfile
git commit -m test -a

git cherry-pick X
git diff --raw
git difftool -d


This emulates a merge conflict when using git-cerry-pick.

$ git diff --raw
:000000 100644 0000000... 0000000... U  testfile
:100644 100644 a04e026... 0000000... M  testfile

When executing git difftool with the -d option :

/usr/lib/git-core/git-difftool line 260: File exists

A possible solution is to build an unique list in @working_tree

The purpose is to edit/resolve the conflict in the difftool.

Thanks!

-- 
Smets Jan
jan@smets.cx

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: using git-difftool -d when cherry-picking
  2016-04-27  9:12 using git-difftool -d when cherry-picking Jan Smets
@ 2016-04-30  1:19 ` David Aguilar
  2016-04-30 10:50   ` Jan Smets
  0 siblings, 1 reply; 3+ messages in thread
From: David Aguilar @ 2016-04-30  1:19 UTC (permalink / raw)
  To: Jan Smets; +Cc: git

On Wed, Apr 27, 2016 at 11:12:25AM +0200, Jan Smets wrote:
> Hi
> 
> Please consider following example
> 
> #!/bin/bash
> rm -rf /tmp/gittest
> mkdir /tmp/gittest
> cd /tmp/gittest
> 
> git init
> 
> echo $RANDOM > testfile
> git add testfile
> git commit -m test -a
> 
> git branch X
> git checkout X
> echo $RANDOM > testfile
> git add testfile
> git commit -m test -a
> 
> git checkout master
> echo $RANDOM > testfile
> git add testfile
> git commit -m test -a
> 
> git cherry-pick X
> git diff --raw
> git difftool -d
> 
> 
> This emulates a merge conflict when using git-cerry-pick.
> 
> $ git diff --raw
> :000000 100644 0000000... 0000000... U  testfile
> :100644 100644 a04e026... 0000000... M  testfile
> 
> When executing git difftool with the -d option :
> 
> /usr/lib/git-core/git-difftool line 260: File exists
> 
> A possible solution is to build an unique list in @working_tree
> 
> The purpose is to edit/resolve the conflict in the difftool.


That could be useful.  git-mergetool is intended to be used when
merge conflicts exist, but it sounds like you may have already
found a possible solution by making @working_tree unique.  Have
you tested that to see if it skirts around the issue?

If you have a patch I'd be happy to help review and test it.
-- 
David

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: using git-difftool -d when cherry-picking
  2016-04-30  1:19 ` David Aguilar
@ 2016-04-30 10:50   ` Jan Smets
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Smets @ 2016-04-30 10:50 UTC (permalink / raw)
  To: David Aguilar; +Cc: git

On Sat, Apr 30, 2016 at 3:19 AM, David Aguilar <davvid@gmail.com> wrote:
> On Wed, Apr 27, 2016 at 11:12:25AM +0200, Jan Smets wrote:
>> Hi
>>
>> Please consider following example
>>
>> #!/bin/bash
>> rm -rf /tmp/gittest
>> mkdir /tmp/gittest
>> cd /tmp/gittest
>>
>> git init
>>
>> echo $RANDOM > testfile
>> git add testfile
>> git commit -m test -a
>>
>> git branch X
>> git checkout X
>> echo $RANDOM > testfile
>> git add testfile
>> git commit -m test -a
>>
>> git checkout master
>> echo $RANDOM > testfile
>> git add testfile
>> git commit -m test -a
>>
>> git cherry-pick X
>> git diff --raw
>> git difftool -d
>>
>>
>> This emulates a merge conflict when using git-cerry-pick.
>>
>> $ git diff --raw
>> :000000 100644 0000000... 0000000... U  testfile
>> :100644 100644 a04e026... 0000000... M  testfile
>>
>> When executing git difftool with the -d option :
>>
>> /usr/lib/git-core/git-difftool line 260: File exists
>>
>> A possible solution is to build an unique list in @working_tree
>>
>> The purpose is to edit/resolve the conflict in the difftool.
>
>
> That could be useful.  git-mergetool is intended to be used when
> merge conflicts exist, but it sounds like you may have already
> found a possible solution by making @working_tree unique.  Have
> you tested that to see if it skirts around the issue?
>
> If you have a patch I'd be happy to help review and test it.

Something like this seems to work.

26a27,32
> sub uniq
> {
>         my %seen;
>         grep !$seen{$_}++, @_;
> }
>
251a258
>     my @unique_working_tree = uniq( @working_tree );
256c263
<     for my $file (@working_tree) {
---
>     for my $file (@unique_working_tree) {

TMTOWTDI

Thanks !

-- 
Smets Jan
jan@smets.cx

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-04-30 10:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-27  9:12 using git-difftool -d when cherry-picking Jan Smets
2016-04-30  1:19 ` David Aguilar
2016-04-30 10:50   ` Jan Smets

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 NNTP newsgroup(s).