git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Beller <sbeller@google.com>
To: Brandon Williams <bmwill@google.com>
Cc: Junio C Hamano <gitster@pobox.com>,
	"git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: [PATCHv2 3/4] cache.h: document add_[file_]to_index
Date: Wed, 18 Jan 2017 16:08:22 -0800	[thread overview]
Message-ID: <CAGZ79kY_nbHuThnSDAyLhEwnRWYEQBmMLS4RtGPKOzYt_9Bgsg@mail.gmail.com> (raw)
In-Reply-To: <20170119000037.GF10641@google.com>

On Wed, Jan 18, 2017 at 4:00 PM, Brandon Williams <bmwill@google.com> wrote:
> On 01/18, Stefan Beller wrote:
>> Signed-off-by: Stefan Beller <sbeller@google.com>
>> ---
>>  cache.h | 21 ++++++++++++++++-----
>>  1 file changed, 16 insertions(+), 5 deletions(-)
>>
>> diff --git a/cache.h b/cache.h
>> index 87eccdb211..03c46b9b99 100644
>> --- a/cache.h
>> +++ b/cache.h
>> @@ -609,13 +609,24 @@ extern int remove_index_entry_at(struct index_state *, int pos);
>>
>>  extern void remove_marked_cache_entries(struct index_state *istate);
>>  extern int remove_file_from_index(struct index_state *, const char *path);
>> -#define ADD_CACHE_VERBOSE 1
>> -#define ADD_CACHE_PRETEND 2
>> -#define ADD_CACHE_IGNORE_ERRORS      4
>> -#define ADD_CACHE_IGNORE_REMOVAL 8
>> -#define ADD_CACHE_INTENT 16
>> +
>> +#define ADD_CACHE_VERBOSE 1          /* verbose */
>> +#define ADD_CACHE_PRETEND 2          /* dry run */
>> +#define ADD_CACHE_IGNORE_ERRORS 4    /* ignore errors */
>> +#define ADD_CACHE_IGNORE_REMOVAL 8   /* do not remove files from index */
>> +#define ADD_CACHE_INTENT 16          /* intend to add later; stage empty file */
>
> I usually prefer having defines like these use shift operators to set
> the desired bit '(1<<2)' instead of '4', etc.  Is there a preference for
> git as a whole?  I know this is just a documentation change so maybe
> this isn't even the place to discuss this.

eh, and I forgot to remove the comments that Junio thought of as redundant.
I agree that (1<<N)) is usually better than the actual number. But I think
we do not want to change that for the same reason as we don't want to add
these comments there: Digging into history just got more complicated here.
("Who introduced ADD_CACHE_INTENT and why?" you need to skip the
reformatting/adding document patch to actually find the answer.)

Thanks for spotting,
Stefan

>
> --
> Brandon Williams

  reply	other threads:[~2017-01-19  0:16 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-17 23:34 [PATCH 0/4] start documenting core functions Stefan Beller
2017-01-17 23:35 ` [PATCH 1/4] document index_name_pos Stefan Beller
2017-01-18 21:11   ` Junio C Hamano
2017-01-18 22:02     ` Stefan Beller
2017-01-17 23:35 ` [PATCH 2/4] remove_index_entry_at: move documentation to cache.h Stefan Beller
2017-01-18 21:16   ` Junio C Hamano
2017-01-18 22:06     ` Stefan Beller
2017-01-17 23:35 ` [PATCH 3/4] document add_[file_]to_index Stefan Beller
2017-01-18 21:22   ` Junio C Hamano
2017-01-18 22:09     ` Stefan Beller
2017-01-17 23:35 ` [PATCH 4/4] documentation: retire unfinished documentation Stefan Beller
2017-01-18 21:23   ` Junio C Hamano
2017-01-18 23:21 ` [PATCHv2 0/4] start documenting core functions Stefan Beller
2017-01-18 23:21   ` [PATCHv2 1/4] cache.h: document index_name_pos Stefan Beller
2017-01-19  3:18     ` [PATCHv3 0/4] start documenting core functions Stefan Beller
2017-01-19  3:18       ` [PATCHv3 1/4] cache.h: document index_name_pos Stefan Beller
2017-01-19 20:17         ` Junio C Hamano
2017-01-19  3:18       ` [PATCHv3 2/4] cache.h: document remove_index_entry_at Stefan Beller
2017-01-19  3:18       ` [PATCHv3 3/4] cache.h: document add_[file_]to_index Stefan Beller
2017-01-19  3:18       ` [PATCHv3 4/4] documentation: retire unfinished documentation Stefan Beller
2017-01-18 23:21   ` [PATCHv2 2/4] cache.h: document remove_index_entry_at Stefan Beller
2017-01-18 23:21   ` [PATCHv2 3/4] cache.h: document add_[file_]to_index Stefan Beller
2017-01-19  0:00     ` Brandon Williams
2017-01-19  0:08       ` Stefan Beller [this message]
2017-01-18 23:21   ` [PATCHv2 4/4] documentation: retire unfinished documentation Stefan Beller

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=CAGZ79kY_nbHuThnSDAyLhEwnRWYEQBmMLS4RtGPKOzYt_9Bgsg@mail.gmail.com \
    --to=sbeller@google.com \
    --cc=bmwill@google.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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).