# gitformat-index.txt has a gap in the "mode" description?

2 messages from 2023-01-31 to 2023-01-31. Participants: Glen Choo, Junio C Hamano.
Thread: https://gitlist.dev/t/59166

## Glen Choo, 2023-01-31 16:43

Subject: gitformat-index.txt has a gap in the "mode" description?
Message-ID: <kl6l357qy7r2.fsf@chooglen-macbookpro.roam.corp.google.com>
URL: https://gitlist.dev/e/kl6l357qy7r2.fsf%40chooglen-macbookpro.roam.corp.google.com

```

According to gitformat-index.txt [1], "mode" is 32 bits, but we've only
documented 16 bits. I tried poking around read-cache.c, and my
impression is that other 16 are just NUL. If so, it would be worth
documenting that they're unused, especially since we documented
unused bits right in that section.

[1] https://github.com/git/git/blob/master/Documentation/gitformat-index.txt#L84

```

## Junio C Hamano, 2023-01-31 19:26

Subject: Re: gitformat-index.txt has a gap in the "mode" description?
Message-ID: <xmqqmt5yy08d.fsf@gitster.g>
URL: https://gitlist.dev/e/xmqqmt5yy08d.fsf%40gitster.g
In-Reply-To: <kl6l357qy7r2.fsf@chooglen-macbookpro.roam.corp.google.com>

```
Glen Choo <chooglen@google.com> writes:

> According to gitformat-index.txt [1], "mode" is 32 bits, but we've only
> documented 16 bits. I tried poking around read-cache.c, and my
> impression is that other 16 are just NUL. If so, it would be worth
> documenting that they're unused, especially since we documented
> unused bits right in that section.
>
> [1] https://github.com/git/git/blob/master/Documentation/gitformat-index.txt#L84

Good thinking.  The existing explanation starts with "32-bit mode,
split into (high to low bits)", followed by "4-bit object type", as
if the "4-bit object type" occupies bits 29-32, which is not quite
what we want to say.

By the way, we should avoid saying "unused" but be more explicit and
say "must be zero".  The latter has no ambiguity but the former can
be misinterpreted to allow any garbage.

Thanks.

```
