From: Tim Henigan <tim.henigan@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [PATCH v3] diff-no-index: exit(1) if 'diff --quiet <repo file> <external file>' finds changes
Date: Tue, 19 Jun 2012 12:47:08 -0400 [thread overview]
Message-ID: <CAFouetgRq1qkqJmThJJeu=Mdx9jS0c9dw7NPSwuJUOSpskCY2A@mail.gmail.com> (raw)
In-Reply-To: <20120619135814.GA3210@sigill.intra.peff.net>
On Tue, Jun 19, 2012 at 9:58 AM, Jeff King <peff@peff.net> 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.
next prev parent reply other threads:[~2012-06-19 16:47 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-18 19:28 [PATCH v3] diff-no-index: exit(1) if 'diff --quiet <repo file> <external file>' finds changes Tim Henigan
2012-06-18 19:45 ` Jeff King
2012-06-18 20:09 ` Junio C Hamano
2012-06-19 13:05 ` Tim Henigan
2012-06-19 13:58 ` Jeff King
2012-06-19 16:47 ` Tim Henigan [this message]
2012-06-20 13:38 ` Tim Henigan
2012-06-20 16:06 ` Jeff King
2012-06-20 18:44 ` Junio C Hamano
2012-06-20 18:52 ` Jeff King
2012-06-20 19:21 ` Junio C Hamano
2012-06-21 15:07 ` Tim Henigan
2012-06-21 16:55 ` Junio C Hamano
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAFouetgRq1qkqJmThJJeu=Mdx9jS0c9dw7NPSwuJUOSpskCY2A@mail.gmail.com' \
--to=tim.henigan@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
/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.
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).