From: Junio C Hamano <gitster@pobox.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: "Dmitry V. Levin" <ldv@altlinux.org>,
"Shawn O. Pearce" <spearce@spearce.org>,
Git Mailing List <git@vger.kernel.org>, Jeff King <peff@peff.net>
Subject: Re: [PATCH 1/2] Fix "git diff" setup code
Date: Fri, 14 Sep 2007 11:19:55 -0700 [thread overview]
Message-ID: <7v4phxaz3o.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <alpine.LFD.0.999.0709141014130.16478@woody.linux-foundation.org> (Linus Torvalds's message of "Fri, 14 Sep 2007 10:17:39 -0700 (PDT)")
Linus Torvalds <torvalds@linux-foundation.org> writes:
> For some inexplicable reason, "git diff" would call "diff_setup_done()"
> iff we hadn't given an explicit output format.
>
> That makes no sense, since much of what diff_setup_done() does is exactly
> about checking the output format!
We did not even have _any_ setup_done() call in "git diff"
itself in the original, because setup_revisions() has its own
call to setup_done(), and it always called setup_revisions()
before you reached that part of the code you have in your patch.
Commit 047fbe906b375e8a3a7564ad0e4443f62dd528a2 ("builtin-diff:
turn recursive on when defaulting to --patch format.") added the
call to setup_done() only when we are defaulting to output
format, to re-validate the consistency of output format options.
The screw-up was commit fcfa33ec905fcde1c16e7cbbe00d7147b89f1f01
(diff: make more cases implicit --no-index) that made the call
to setup_revisions() conditional if setup_diff_no_index()
decides to take over, but it forgot that setup_diff_no_index()
does not call setup_done().
So I tend to think the attached is a better fix.
---
diff-lib.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/diff-lib.c b/diff-lib.c
index f5568c3..da55713 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -298,6 +298,8 @@ int setup_diff_no_index(struct rev_info *revs,
revs->diffopt.nr_paths = 2;
revs->diffopt.no_index = 1;
revs->max_count = -2;
+ if (diff_setup_done(&revs->diffopt) < 0)
+ die("diff_setup_done failed");
return 0;
}
next prev parent reply other threads:[~2007-09-14 18:20 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-05 23:49 [PATCH 1/2] git-commit: Disallow unchanged tree in non-merge mode Dmitry V. Levin
2007-09-06 2:25 ` Shawn O. Pearce
2007-09-06 10:16 ` Dmitry V. Levin
[not found] ` <20070909044648.GH18160@spearce.org>
[not found] ` <7vir6fjmuv.fsf@gitster.siamese.dyndns.org>
[not found] ` <20070913035137.GM3099@spearce.org>
[not found] ` <7vr6l2gxyw.fsf@gitster.siamese.dyndns.org>
[not found] ` <20070914000108.GE3619@basalt.office.altlinux.org>
[not found] ` <7vr6l2f6k1.fsf@gitster.siamese.dyndns.org>
[not found] ` <alpine.LFD.0.999.0709131850060.16478@woody.linux-foundation.org>
[not found] ` <20070914024303.GH3619@basalt.office.altlinux.org>
[not found] ` <alpine.LFD.0.999.0709132123570.16478@woody.linux-foundation.org>
2007-09-14 17:14 ` Linus Torvalds
2007-09-14 17:17 ` [PATCH 1/2] Fix "git diff" setup code Linus Torvalds
2007-09-14 17:39 ` [PATCH 2/2] Fix the rename detection limit checking Linus Torvalds
2007-09-14 18:44 ` Linus Torvalds
2007-09-14 18:49 ` Linus Torvalds
2007-09-14 18:19 ` Junio C Hamano [this message]
2007-09-14 18:30 ` [PATCH 1/2] Fix "git diff" setup code Linus Torvalds
2007-09-14 19:11 ` Junio C Hamano
2007-09-14 19:46 ` Linus Torvalds
[not found] ` <20070914050410.GA11402@coredump.intra.peff.net>
[not found] ` <alpine.LFD.0.999.0709132215250.16478@woody.linux-foundation.org>
2007-09-14 18:24 ` [PATCH 1/2] git-commit: Disallow unchanged tree in non-merge mode 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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7v4phxaz3o.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=ldv@altlinux.org \
--cc=peff@peff.net \
--cc=spearce@spearce.org \
--cc=torvalds@linux-foundation.org \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).