git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Glen Choo <chooglen@google.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] docs: document zero bits in index "mode"
Date: Wed, 01 Feb 2023 08:56:42 -0800	[thread overview]
Message-ID: <xmqqmt5xwchh.fsf@gitster.g> (raw)
In-Reply-To: <20230201024041.29401-1-chooglen@google.com> (Glen Choo's message of "Wed, 1 Feb 2023 10:40:41 +0800")

Glen Choo <chooglen@google.com> writes:

> Documentation/gitformat-index.txt describes the "mode" as 32 bits, but
> only documents 16 bits. Document the missing 16 bits and specify that
> 'unused' bits must be zero.

I actually think the bottom 16-bit should just be described as
allowing only a limited set of possible values and list them all,
but this is good as an incremental improvement [*]

Thanks.


>    32-bit mode, split into (high to low bits)
>  
> +    16-bit unused, must be zero
> +
>      4-bit object type
>        valid values in binary are 1000 (regular file), 1010 (symbolic link)
>        and 1110 (gitlink)
>  
> -    3-bit unused
> +    3-bit unused, must be zero
>  
>      9-bit unix permission. Only 0755 and 0644 are valid for regular files.
>      Symbolic links and gitlinks have value 0 in this field.


[Footnote]

If I am not mistaken, there are only four possible values allowed.
So, instead of "split into...", we could just say

        32-bit "mode", which can be one of

          Regular non-executable file     100644
          Regular executable file         100755
          Symbolic link                   120000
          Git link                        160000

        No other values are allowed.

but we can move one step at a time ;-)


      parent reply	other threads:[~2023-02-01 16:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-01  2:40 [PATCH] docs: document zero bits in index "mode" Glen Choo
2023-02-01  2:46 ` Glen Choo
2023-02-01 16:56 ` Junio C Hamano [this message]

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqmt5xwchh.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=chooglen@google.com \
    --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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).