* I think git show is broken @ 2012-08-28 17:38 Matthew Caron 2012-08-28 17:48 ` Matthew Caron 0 siblings, 1 reply; 5+ messages in thread From: Matthew Caron @ 2012-08-28 17:38 UTC (permalink / raw) To: git (otherwise, there was a very strange change made to its functionality, which the documentation does not reflect) Old, working git: === $ git --version git version 1.7.0.4 $ git show --quiet --abbrev-commit --pretty=oneline 47a7aee54553fb718c376cfa9d7de4389a391e33 47a7aee Fix hyperlinks for dependent tickets (#7139, #4976). === New, "broken" git: === $ git --version git version 1.7.9.5 $ git show --quiet --abbrev-commit --pretty=oneline 47a7aee54553fb718c376cfa9d7de4389a391e33 47a7aee Fix hyperlinks for dependent tickets (#7139, #4976). diff --git a/mastertickets/web_ui.py b/mastertickets/web_ui.py index a91b862..698ed98 100644 --- a/mastertickets/web_ui.py +++ b/mastertickets/web_ui.py @@ -32,7 +32,7 @@ class MasterTicketsModule(Component): use_gs = BoolOption('mastertickets', 'use_gs', default=False, doc='If enabled, use ghostscript to produce nicer output.') - FIELD_XPATH = 'div[@id="ticket"]/table[@class="properties"]/td[@headers="h_%s"]/text()' + FIELD_XPATH = './/div[@id="ticket"]/table[@class="properties"]//td[@headers="h_%s"]/text()' fields = set(['blocking', 'blockedby']) # IRequestFilter methods === It appears as though the new functionality always puts out a "medium" verbosity diff. Though the manpage says that it honors pretty=oneline, it does not seem to. I searched around the message logs, etc. and would have expected this change to have thrown everyone else into as much upheaval as it has in my organization, and found nothing. Am I missing something? Thanks in advance. -- Matthew Caron, Software Build Engineer Sixnet, a Red Lion business | www.sixnet.com +1 (518) 877-5173 x138 office ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: I think git show is broken 2012-08-28 17:38 I think git show is broken Matthew Caron @ 2012-08-28 17:48 ` Matthew Caron 2012-08-28 21:29 ` Jeff King 0 siblings, 1 reply; 5+ messages in thread From: Matthew Caron @ 2012-08-28 17:48 UTC (permalink / raw) To: Matthew Caron; +Cc: git On 08/28/2012 01:38 PM, Matthew Caron wrote: > (otherwise, there was a very strange change made to its functionality, > which the documentation does not reflect) Never mind. I was looking in the wrong spot. The issue is not with --pretty=oneline, it's with --quiet. In 1.7.0.4, --quiet worked like -s. It no longer does in 1.7.9.5. Switching to -s cures the problem. -- Matthew Caron, Software Build Engineer Sixnet, a Red Lion business | www.sixnet.com +1 (518) 877-5173 x138 office ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: I think git show is broken 2012-08-28 17:48 ` Matthew Caron @ 2012-08-28 21:29 ` Jeff King 2012-08-28 22:36 ` Junio C Hamano 0 siblings, 1 reply; 5+ messages in thread From: Jeff King @ 2012-08-28 21:29 UTC (permalink / raw) To: Matthew Caron; +Cc: Junio C Hamano, Carlos Martín Nieto, git On Tue, Aug 28, 2012 at 01:48:27PM -0400, Matthew Caron wrote: > On 08/28/2012 01:38 PM, Matthew Caron wrote: > >(otherwise, there was a very strange change made to its functionality, > >which the documentation does not reflect) > > Never mind. > > I was looking in the wrong spot. The issue is not with > --pretty=oneline, it's with --quiet. In 1.7.0.4, --quiet worked like > -s. It no longer does in 1.7.9.5. Switching to -s cures the problem. Yes, that is what's going on. But it's still a regression. There was some discussion of what --quiet should do here: http://thread.gmane.org/gmane.comp.version-control.git/171357 which resulted in a patch that took away --quiet. But then this thread: http://thread.gmane.org/gmane.comp.version-control.git/174665 resulted in restoring it as a synonym for "-s". Unfortunately there's a bug in that fix, which you are seeing. Patch is below. -- >8 -- Subject: [PATCH] log: fix --quiet synonym for -s Originally the "--quiet" option was parsed by the diff-option parser into the internal QUICK option. This had the effect of silencing diff output from the log (which was not intended, but happened to work and people started to use it). But it also had other odd side effects at the diff level (for example, it would suppress the second commit in "git show A B"). To fix this, commit 1c40c36 converted log to parse-options and handled the "quiet" option separately, not passing it on to the diff code. However, it simply ignored the option, which was a regression for people using it as a synonym for "-s". Commit 01771a8 then fixed that by interpreting the option to add DIFF_FORMAT_NO_OUTPUT to the list of output formats. However, that commit did not fix it in all cases. It sets the flag after setup_revisions is called. Naively, this makes sense because you would expect the setup_revisions parser to overwrite our output format flag if "-p" or another output format flag is seen. However, that is not how the NO_OUTPUT flag works. We actually store it in the bit-field as just another format. At the end of setup_revisions, we call diff_setup_done, which post-processes the bitfield and clears any other formats if we have set NO_OUTPUT. By setting the flag after setup_revisions is done, diff_setup_done does not have a chance to make this tweak, and we end up with other format options still set. As a result, the flag would have no effect in "git log -p --quiet" or "git show --quiet". Fix it by setting the format flag before the call to setup_revisions. Signed-off-by: Jeff King <peff@peff.net> --- builtin/log.c | 2 +- t/t7007-show.sh | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/builtin/log.c b/builtin/log.c index ecc2793..c22469c 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -109,9 +109,9 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix, PARSE_OPT_KEEP_ARGV0 | PARSE_OPT_KEEP_UNKNOWN | PARSE_OPT_KEEP_DASHDASH); - argc = setup_revisions(argc, argv, rev, opt); if (quiet) rev->diffopt.output_format |= DIFF_FORMAT_NO_OUTPUT; + argc = setup_revisions(argc, argv, rev, opt); /* Any arguments at this point are not recognized */ if (argc > 1) diff --git a/t/t7007-show.sh b/t/t7007-show.sh index a40cd36..e41fa00 100755 --- a/t/t7007-show.sh +++ b/t/t7007-show.sh @@ -108,4 +108,16 @@ test_expect_success 'showing range' ' test_cmp expect actual.filtered ' +test_expect_success '-s suppresses diff' ' + echo main3 >expect && + git show -s --format=%s main3 >actual && + test_cmp expect actual +' + +test_expect_success '--quiet suppresses diff' ' + echo main3 >expect && + git show --quiet --format=%s main3 >actual && + test_cmp expect actual +' + test_done -- 1.7.11.5.10.g3c8125b ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: I think git show is broken 2012-08-28 21:29 ` Jeff King @ 2012-08-28 22:36 ` Junio C Hamano 2012-08-28 22:45 ` Jeff King 0 siblings, 1 reply; 5+ messages in thread From: Junio C Hamano @ 2012-08-28 22:36 UTC (permalink / raw) To: Jeff King; +Cc: Matthew Caron, Carlos Martín Nieto, git Jeff King <peff@peff.net> writes: > Yes, that is what's going on. But it's still a regression. There was > some discussion of what --quiet should do here: > > http://thread.gmane.org/gmane.comp.version-control.git/171357 > > which resulted in a patch that took away --quiet. But then this thread: > > http://thread.gmane.org/gmane.comp.version-control.git/174665 > > resulted in restoring it as a synonym for "-s". Unfortunately there's a > bug in that fix, which you are seeing. Patch is below. Thanks for digging this through to the bottom. > ... > However, that commit did not fix it in all cases. It sets > the flag after setup_revisions is called. Naively, this > makes sense because you would expect the setup_revisions > parser to overwrite our output format flag if "-p" or > another output format flag is seen. > > However, that is not how the NO_OUTPUT flag works. We > actually store it in the bit-field as just another format. > At the end of setup_revisions, we call diff_setup_done, > which post-processes the bitfield and clears any other > formats if we have set NO_OUTPUT. By setting the flag after > setup_revisions is done, diff_setup_done does not have a > chance to make this tweak, and we end up with other format > options still set. > > As a result, the flag would have no effect in "git log -p > --quiet" or "git show --quiet". Fix it by setting the > format flag before the call to setup_revisions. This also means that git show --name-status --quiet will start erroring out, if I am not recalling what diff_setup_done() does. Which pretty much means "--quiet" given to the "log" family is truly a synonym to "-s", as the error condition that triggers is exactly the same for this: git show --name-status -s which is fine, I think. > Signed-off-by: Jeff King <peff@peff.net> > --- > builtin/log.c | 2 +- > t/t7007-show.sh | 12 ++++++++++++ > 2 files changed, 13 insertions(+), 1 deletion(-) > > diff --git a/builtin/log.c b/builtin/log.c > index ecc2793..c22469c 100644 > --- a/builtin/log.c > +++ b/builtin/log.c > @@ -109,9 +109,9 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix, > PARSE_OPT_KEEP_ARGV0 | PARSE_OPT_KEEP_UNKNOWN | > PARSE_OPT_KEEP_DASHDASH); > > - argc = setup_revisions(argc, argv, rev, opt); > if (quiet) > rev->diffopt.output_format |= DIFF_FORMAT_NO_OUTPUT; > + argc = setup_revisions(argc, argv, rev, opt); > > /* Any arguments at this point are not recognized */ > if (argc > 1) > diff --git a/t/t7007-show.sh b/t/t7007-show.sh > index a40cd36..e41fa00 100755 > --- a/t/t7007-show.sh > +++ b/t/t7007-show.sh > @@ -108,4 +108,16 @@ test_expect_success 'showing range' ' > test_cmp expect actual.filtered > ' > > +test_expect_success '-s suppresses diff' ' > + echo main3 >expect && > + git show -s --format=%s main3 >actual && > + test_cmp expect actual > +' > + > +test_expect_success '--quiet suppresses diff' ' > + echo main3 >expect && > + git show --quiet --format=%s main3 >actual && > + test_cmp expect actual > +' > + > test_done ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: I think git show is broken 2012-08-28 22:36 ` Junio C Hamano @ 2012-08-28 22:45 ` Jeff King 0 siblings, 0 replies; 5+ messages in thread From: Jeff King @ 2012-08-28 22:45 UTC (permalink / raw) To: Junio C Hamano; +Cc: Matthew Caron, Carlos Martín Nieto, git On Tue, Aug 28, 2012 at 03:36:26PM -0700, Junio C Hamano wrote: > > As a result, the flag would have no effect in "git log -p > > --quiet" or "git show --quiet". Fix it by setting the > > format flag before the call to setup_revisions. > > This also means that > > git show --name-status --quiet > > will start erroring out, if I am not recalling what diff_setup_done() > does. Which pretty much means "--quiet" given to the "log" family > is truly a synonym to "-s", as the error condition that triggers is > exactly the same for this: > > git show --name-status -s > > which is fine, I think. Yes, I noticed that. I think it is fine for "--quiet" to be a true synonym for "-s" here. Though I am puzzled why we would error out on "--name-status -s" but not "--patch -s". What is the difference between "--name-status" and "--patch" here? Shouldn't "-s" override all formatting options? And one final thing I noticed that is probably not worth the trouble to fix: the position of "-s" is independent of its effect. Normally options which override each other would be position dependent, so: git log --relative-date --date=local and git log --date=local --relative-date would both throw away the first option and let the latter take effect. But doing: git log --patch -s and git log -s --patch will always have "-s" take over. I don't think it's a huge deal, and fixing it would be a pain. We'd have to take NO_OUTPUT out of the bit-field and make it a special option, and fix any callers who try to be clever about recognizing NO_OUTPUT as a specifically-given option. And then for "--quiet", we'd have to handle it at its proper spot on the command-line, which would mean converting log's parse-options invocation to be step-wise. Probably not worth it for a minor bit of consistency that nobody has actually complained about. -Peff ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-08-28 22:46 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-08-28 17:38 I think git show is broken Matthew Caron 2012-08-28 17:48 ` Matthew Caron 2012-08-28 21:29 ` Jeff King 2012-08-28 22:36 ` Junio C Hamano 2012-08-28 22:45 ` Jeff King
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).