Re: [PATCH] mergetool: Provide an empty file when no base exists

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jan 19, 2012 at 11:00 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> David Aguilar <davvid@xxxxxxxxx> writes:
>
>> Some mergetools cannot cope when $BASE is missing.
>> This can happen when two branches add the same file.
>> Provide an empty file to make these tools happy.
>>
>> Reported-by: Jason Wenger <jcwenger@xxxxxxxxx>
>> Signed-off-by: David Aguilar <davvid@xxxxxxxxx>
>> ---
>>  git-mergetool.sh     |    6 +++++-
>>  t/t7610-mergetool.sh |   27 ++++++++++++++++++++++++++-
>>  2 files changed, 31 insertions(+), 2 deletions(-)
>>
>> diff --git a/git-mergetool.sh b/git-mergetool.sh
>> index 085e213..8521b81 100755
>> --- a/git-mergetool.sh
>> +++ b/git-mergetool.sh
>> @@ -224,7 +224,11 @@ merge_file () {
>>      mv -- "$MERGED" "$BACKUP"
>>      cp -- "$BACKUP" "$MERGED"
>>
>> -    base_present   && checkout_staged_file 1 "$MERGED" "$BASE"
>> +    if base_present; then
>> +     checkout_staged_file 1 "$MERGED" "$BASE"
>> +    else
>> +     touch "$BASE"
>> +    fi
>
> Using "touch" for things like this is a disease.
>
> You not just want to make sure it exists, but also you want to make sure
> it is empty, so it would make your intention more explicit and clear if
> you wrote this as
>
>        >"$BASE"
>
> instead.
>
> I also wonder if it may help mergetools if we come up with a fake base
> image using the common material between the two files, in a way similar to
> how git-merge-one-file.sh does it (look for "Added $4 in both, but
> differently"), but obviously it would belong to a separate patch.
>
> Thanks.

Ah, thanks for the pointer.  I'll resend shortly.  A "fake base" would
be very helpful.
-- 
            David
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]