From: Junio C Hamano <gitster@pobox.com>
To: Dennis Kaarsemaker <dennis@kaarsemaker.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] log -g: ignore revision parameters that have no reflog
Date: Tue, 02 Feb 2016 16:21:55 -0800 [thread overview]
Message-ID: <xmqqegcuprrw.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <1454455961-10640-1-git-send-email-dennis@kaarsemaker.net> (Dennis Kaarsemaker's message of "Wed, 3 Feb 2016 00:32:41 +0100")
Dennis Kaarsemaker <dennis@kaarsemaker.net> writes:
> + if (revs->reflog_info) {
> + /*
> + * The reflog iterator gets confused when fed things that don't
> + * have reflogs. Help it along a bit
> + */
> + if (strchr(arg, '@') != arg &&
Is this merely an expensive way to write *arg != '@', or is there
something else I am missing?
> + !dwim_ref(arg, strchrnul(arg, '@')-arg, sha1, &dotdot))
> + die("only refs can have reflogs");
Is "foo@23" a forbidden branch name?
Is this looking for a dotdot? If you are introducing a new scope,
you can afford to invent a variable with a name that reflects its
purpose.
Style: a binary operation like '-' (subtract) have SP on both sides
of it.
> + if(!reflog_exists(dotdot))
Style: one SP between a syntactic keyword like 'if' and opening
parenthesis is required.
I have a suspicion that in your final "fixed" code, it may be a
better design not to let the command line argument for "-g"
processing pass through this function at all.
For example, what should "git log -g master next" do? Merge two
reflog entries in chronological order and show each of them as if
they are thrown at "git show" one by one? Does that mesh well with
other options like "--date-order/--topo-order"?
For another example, what should "git log -g master..next" do?
Or "git log -g master^^^"?
These are merely a few example inputs I can think of off in 5
seconds and I think none of the above makes much sense, but parsing
these is the primary purpose of this function.
So, I dunno. I gave a few "coding" comments, but I am not sure if
you are touching the right codepath in the first place.
next prev parent reply other threads:[~2016-02-03 0:22 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-31 11:52 git log -g bizarre behaviour Dennis Kaarsemaker
2016-02-01 23:37 ` Junio C Hamano
2016-02-02 8:28 ` Dennis Kaarsemaker
2016-02-02 19:32 ` Junio C Hamano
2016-02-02 20:22 ` Dennis Kaarsemaker
2016-02-02 20:42 ` Junio C Hamano
2016-02-02 23:32 ` [PATCH] log -g: ignore revision parameters that have no reflog Dennis Kaarsemaker
2016-02-03 0:21 ` Junio C Hamano [this message]
2016-02-03 12:35 ` Dennis Kaarsemaker
2016-02-03 18:32 ` 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=xmqqegcuprrw.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=dennis@kaarsemaker.net \
--cc=git@vger.kernel.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.
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.