From: Junio C Hamano <gitster@pobox.com>
To: Yurii Shevtsov <ungetch@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH/RFC][GSoC] diff-no-index: transform "$directory $file" args to "$directory/$file $file"
Date: Sat, 21 Mar 2015 11:18:25 -0700 [thread overview]
Message-ID: <xmqqsicyciz2.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <CAHLaBN+x3SVL9+jDzeSEMapVd2BVrwQuVx_7ENspjbUPrium_A@mail.gmail.com> (Yurii Shevtsov's message of "Sat, 21 Mar 2015 14:50:32 +0200")
Yurii Shevtsov <ungetch@gmail.com> writes:
> diff --git a/diff-no-index.c b/diff-no-index.c
> index 265709b..9a3439a 100644
> --- a/diff-no-index.c
> +++ b/diff-no-index.c
> @@ -97,8 +97,39 @@ static int queue_diff(struct diff_options *o,
> if (get_mode(name1, &mode1) || get_mode(name2, &mode2))
> return -1;
>
> - if (mode1 && mode2 && S_ISDIR(mode1) != S_ISDIR(mode2))
> - return error("file/directory conflict: %s, %s", name1, name2);
> + if (mode1 && mode2 && S_ISDIR(mode1) != S_ISDIR(mode2)) {
> + struct strbuf path;
> + const char *dir, *file;
> + char *filename, *dirname = 0;
> + int i, ret = 0;
If you have two directories, a and b, under which there are two
files a/sub/file and b/sub (i.e. 'sub' in a/ is a directory and b/
is a file), and if you say "git diff --no-index a b", what happens?
- the caller of this function gives a and b in name1 and name2;
- we do not come in this codepath as both are directories;
- we read from a/ and b/ and fill p1 and p2 with names of paths in
the directories -- p1 and p2 will both have 'sub';
- queue_diff() is recursively called to compare a/sub and b/sub;
- now we have name1 = a/sub and name2 = b/sub;
- we come in this codepath, and they are turned into comparison
between a/sub/sub and b/sub.
The last step is simply crazy.
Hmmmm, is vger reinjecting an old message, or you sent an older and
wrong version of a patch by mistake? We discussed why doing this in
queue_diff() is wrong in the thread that has $gmane/265543 in it,
and I was expecting to see a logic like this in the caller.
Puzzled...
next prev parent reply other threads:[~2015-03-21 18:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-21 12:50 [PATCH/RFC][GSoC] diff-no-index: transform "$directory $file" args to "$directory/$file $file" Yurii Shevtsov
2015-03-21 18:18 ` Junio C Hamano [this message]
2015-03-21 19:08 ` Yurii Shevtsov
2015-03-22 2:39 ` Eric Sunshine
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=xmqqsicyciz2.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=ungetch@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.