Re: [PATCH v3] diff-no-index: exit(1) if 'diff --quiet <repo file> <external file>' finds changes

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

 



On Tue, Jun 19, 2012 at 9:58 AM, Jeff King <peff@xxxxxxxx> wrote:
> On Tue, Jun 19, 2012 at 09:05:40AM -0400, Tim Henigan wrote:
>
>> As a side note, I found that these tests fail if a relative path is
>> used for the file in 'non/git'.  In other words, this passes:
>>
>>     test_expect_code 0 git diff --quiet a
>> "$TRASH_DIRECTORY/test-outside/non/git/matching-file"
>>
>> but this fails:
>>
>>     test_expect_code 0 git diff --quiet a ../non/git/matching-file
>>
>> This surprised me, but I have not investigated any further.
>
> The problem is that path_outside_repo in diff-no-index.c does not bother
> handling relative paths at all, and just assumes they are inside the
> repository. This is obviously not true if the path starts with "..", in
> which case you would need to compare the number of ".." with the current
> depth in the repository.
>
> prefix_path already does this (and is what generates the later
> "../non/git/matching-file is not in the repository" message). We could
> perhaps get rid of path_outside_repo and just re-use prefix_path's
> logic, something like (not tested):

With your patch applied, I was able to use relative paths in my tests.
 I also confirmed that all the t4*.sh tests pass.

For what its worth, your patch looks correct to me.  Existing
consumers of 'prefix_path' should get the same results as before and
the one added xmalloc is paired with a free.
--
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]