From: Junio C Hamano <gitster@pobox.com>
To: Alex Riesen <raa.lkml@gmail.com>
Cc: Jay Soffian <jaysoffian@gmail.com>,
git@vger.kernel.org,
Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: Re: [PATCH] branch: optionally setup branch.*.merge from upstream local branches
Date: Tue, 19 Feb 2008 16:55:31 -0800 [thread overview]
Message-ID: <7vzltwe9a4.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <7v4pc4fo6y.fsf@gitster.siamese.dyndns.org> (Junio C. Hamano's message of "Tue, 19 Feb 2008 16:48:05 -0800")
Junio C Hamano <gitster@pobox.com> writes:
> Alex Riesen <raa.lkml@gmail.com> writes:
>
>> Well, it could also mean that there is no rules yet, and you can
>> do the next sane thing of your choice.
>>
>>> enum color_branch {
>>> COLOR_BRANCH_RESET = 0,
>>> COLOR_BRANCH_PLAIN = 1,
>>> COLOR_BRANCH_REMOTE = 2,
>>> COLOR_BRANCH_LOCAL = 3,
>>> COLOR_BRANCH_CURRENT = 4,
>>> };
>
> This enum is used as an index into branch_colors[] array. ...
> ... But we would want to leave a clue for people who would
> want to touch this later that individual values have some
> meaning, more than just that they have to be distinct.
> ...
>>> enum CAPABILITY {
>>> NOLOGIN = 0,
>>> UIDPLUS,
>>> LITERALPLUS,
>>> NAMESPACE,
>>> };
>
> This seems to be meant to match the order in the corresponding
> cap_list[] array, so this cannot be reshuffled (iow, it is
> similar to color_branch).
Side note. My preference for enum that indexes an array is to
use the latter, not spelling everything out like "color_branch"
does. The first one being 0 and everybody else increments by 1
is a good enough clue that you cannot arbitrarily reshuffle them
(as opposed to everbody left to the default). After being
warned with the clue, somebody who is adding new elements to the
array and defining a symbolic index to the element will know to
append to the list, not just insert into an arbitrary place.
Spelling out all the rest explicitly like "color_branch" one
does is wasteful (new entries would need to carry "= (n+1)"),
pointless (you cannot write anything but "= (n+1)" because it is
an array index), and misleading (it makes you wonder if the
specific values have meaning other than being used for an array
index).
next prev parent reply other threads:[~2008-02-20 0:56 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-19 2:07 [PATCH] branch: optionally setup branch.*.merge from upstream local branches Jay Soffian
2008-02-19 2:19 ` Jay Soffian
2008-02-19 10:55 ` Johannes Schindelin
2008-02-19 13:42 ` Jay Soffian
2008-02-19 13:59 ` Jay Soffian
2008-02-19 14:01 ` Johannes Schindelin
2008-02-19 5:52 ` Junio C Hamano
2008-02-19 13:40 ` Jay Soffian
2008-02-19 7:44 ` Alex Riesen
2008-02-19 13:49 ` Jay Soffian
2008-02-19 13:53 ` Johannes Schindelin
2008-02-20 0:13 ` Alex Riesen
2008-02-20 0:48 ` Junio C Hamano
2008-02-20 0:55 ` Junio C Hamano [this message]
-- strict thread matches above, loose matches on Subject: below --
2008-02-18 13:53 Jay Soffian
2008-02-18 14:05 ` Johannes Schindelin
2008-02-18 14:38 ` Jay Soffian
2008-02-18 18:47 ` Johannes Schindelin
2008-02-18 20:59 ` Junio C Hamano
2008-02-18 13:24 Jay Soffian
2008-02-18 13:29 ` Johannes Schindelin
2008-02-18 19:00 ` Mike Hommey
2008-02-18 12:04 Jay Soffian
2008-02-18 12:14 ` Johannes Schindelin
2008-02-18 12:40 ` Jay Soffian
2008-02-18 13:24 ` Johannes Schindelin
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=7vzltwe9a4.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=jaysoffian@gmail.com \
--cc=raa.lkml@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 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).