From: Michael J Gruber <git@drmicha.warpmail.net>
To: Joshua Juran <jjuran@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [Annoyance] "git log .." thinks ".." is ambiguous
Date: Tue, 03 May 2011 08:33:06 +0200 [thread overview]
Message-ID: <4DBFA1A2.6050409@drmicha.warpmail.net> (raw)
In-Reply-To: <FB837238-9953-4FD8-BC52-5C0AB061C291@gmail.com>
Joshua Juran venit, vidit, dixit 03.05.2011 03:57:
> On May 2, 2011, at 12:15 PM, Junio C Hamano wrote:
>
>> diff --git a/revision.c b/revision.c
>> index f4b8b38..26271d1 100644
>> --- a/revision.c
>> +++ b/revision.c
>> @@ -905,14 +905,26 @@ int handle_revision_arg(const char *arg,
>> struct rev_info *revs,
>> const char *this = arg;
>> int symmetric = *next == '.';
>> unsigned int flags_exclude = flags ^ UNINTERESTING;
>> + static const char head_by_default[] = "HEAD";
>>
>> *dotdot = 0;
>> next += symmetric;
>>
>> if (!*next)
>> - next = "HEAD";
>> + next = head_by_default;
>> if (dotdot == arg)
>> - this = "HEAD";
>> + this = head_by_default;
>> + if (this == head_by_default && next == head_by_default &&
>> + !symmetric) {
>
> Is there a reason not to write
>
> const char *head_by_default = "HEAD";
>
> or even
>
> const char *const head_by_default = "HEAD";
>
> instead? Loading a static array and checking an init flag is a
> pessimization versus just pointing into a read-only segment.
Because of the comparisons later on: this == "HEAD" is not the same.
Michael
next prev parent reply other threads:[~2011-05-03 6:33 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-02 19:15 [Annoyance] "git log .." thinks ".." is ambiguous Junio C Hamano
2011-05-02 19:33 ` Jeff King
2011-05-02 19:36 ` Jeff King
2011-05-02 20:36 ` Junio C Hamano
2011-05-02 20:42 ` Jeff King
2011-05-02 20:56 ` [PATCH v2] specifying ranges: we did not mean to make ".." an empty set Junio C Hamano
2011-05-02 21:01 ` Jeff King
2011-05-02 21:48 ` Junio C Hamano
2011-05-03 6:39 ` Michael J Gruber
2011-05-03 17:38 ` Junio C Hamano
2011-05-04 6:55 ` Michael J Gruber
2011-05-04 15:36 ` Junio C Hamano
2011-05-04 18:00 ` Junio C Hamano
2011-05-03 1:57 ` [Annoyance] "git log .." thinks ".." is ambiguous Joshua Juran
2011-05-03 6:33 ` Michael J Gruber [this message]
2011-05-03 8:17 ` Joshua Juran
2011-05-03 8:45 ` Michael J Gruber
2011-05-03 19:00 ` Junio C Hamano
2011-05-03 8:38 ` John Szakmeister
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=4DBFA1A2.6050409@drmicha.warpmail.net \
--to=git@drmicha.warpmail.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jjuran@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.