diff mbox series

[v2,9/9] doc: git-init: clarify file modes in octal.

Message ID 7eef3538f3c3015c4f446961ddca78e2868fe644.1635438124.git.gitgitgadget@gmail.com (mailing list archive)
State Superseded
Headers show
Series doc: fix grammar rules in commands' syntax | expand

Commit Message

Jean-Noël Avila Oct. 28, 2021, 4:22 p.m. UTC
From: =?UTF-8?q?Jean-No=C3=ABl=20Avila?= <jn.avila@free.fr>

The previous explanation was mixing the format with the identity of
the field.

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
---
 Documentation/git-init.txt | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

Comments

Junio C Hamano Oct. 28, 2021, 5:17 p.m. UTC | #1
"Jean-Noël Avila via GitGitGadget"  <gitgitgadget@gmail.com> writes:

> ---shared[=(false|true|umask|group|all|world|everybody|0xxx)]::
> +--shared[=(false|true|umask|group|all|world|everybody|<umask>)]::
>  
>  Specify that the Git repository is to be shared amongst several users.  This
>  allows users belonging to the same group to push into that
> @@ -110,13 +110,15 @@ the repository permissions.
>  
>  Same as 'group', but make the repository readable by all users.
>  
> -'0xxx'::
> +'<umask>'::
>  
> -'0xxx' is an octal number and each file will have mode '0xxx'. '0xxx' will
> -override users' umask(2) value (and not only loosen permissions as 'group' and
> -'all' does). '0640' will create a repository which is group-readable, but not
> -group-writable or accessible to others. '0660' will create a repo that is
> -readable and writable to the current user and group, but inaccessible to others.
> +'<umask>' is an 3-digit octal number prefixed with `0` and each file
> +will have mode '<umask>'. '<umask>' will override users' umask(2)
> +value (and not only loosen permissions as 'group' and 'all'
> +does). '0640' will create a repository which is group-readable, but
> +not group-writable or accessible to others. '0660' will create a repo
> +that is readable and writable to the current user and group, but
> +inaccessible to others.

Giving it a name that reflects the meaning is a great change.

Unfortunately, I think the original text is wrong to call it umask,
as this is bitwise opposite of umask(2).  umask 027 for example
means that we *drop* bits 020 and 007, causing the group members
*losing* write access, and other folks *losing* all access, from the
resulting filesystem entity.  But with this, as the description
says, you would write "0640" to mean "group members cannot write,
others have no access".

How about calling it <perm> (or <perm-bits>)?

----- >8 --------- >8 --------- >8 --------- >8 -----
From: Jean-Noël Avila <jn.avila@free.fr>
Subject: [PATCH] doc: git-init: clarify file modes in octal.

The previous explanation was mixing the format with the identity of
the field.

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---

 * Giving a "3-digit octal prefixed with `0`" would work fine, but
   technically, the value is parsed as an octal without the `0`
   prefix and there is no requirement for the number of digits,
   either.  But giving a stricter-than-necessary instruction is
   probably a good idea in this case.  It makes the description
   simpler.

 Documentation/git-init.txt | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/Documentation/git-init.txt b/Documentation/git-init.txt
index fdb7b3f367..af0d2ee182 100644
--- a/Documentation/git-init.txt
+++ b/Documentation/git-init.txt
@@ -79,7 +79,7 @@ repository.  If not specified, fall back to the default name (currently
 `master`, but this is subject to change in the future; the name can be
 customized via the `init.defaultBranch` configuration variable).
 
---shared[=(false|true|umask|group|all|world|everybody|0xxx)]::
+--shared[=(false|true|umask|group|all|world|everybody|<perm>)]::
 
 Specify that the Git repository is to be shared amongst several users.  This
 allows users belonging to the same group to push into that
@@ -110,13 +110,15 @@ the repository permissions.
 
 Same as 'group', but make the repository readable by all users.
 
-'0xxx'::
+'<perm>'::
 
-'0xxx' is an octal number and each file will have mode '0xxx'. '0xxx' will
-override users' umask(2) value (and not only loosen permissions as 'group' and
-'all' does). '0640' will create a repository which is group-readable, but not
-group-writable or accessible to others. '0660' will create a repo that is
-readable and writable to the current user and group, but inaccessible to others.
+'<perm>' is an 3-digit octal number prefixed with `0` and each file
+will have mode '<perm>'. '<perm>' will override users' umask(2)
+value (and not only loosen permissions as 'group' and 'all'
+does). '0640' will create a repository which is group-readable, but
+not group-writable or accessible to others. '0660' will create a repo
+that is readable and writable to the current user and group, but
+inaccessible to others.
 --
 
 By default, the configuration flag `receive.denyNonFastForwards` is enabled
Junio C Hamano Oct. 28, 2021, 5:25 p.m. UTC | #2
Junio C Hamano <gitster@pobox.com> writes:

> How about calling it <perm> (or <perm-bits>)?

I think it is better to queue your original as-is, as a part of the
topic whose theme is to correct the formatting and phrasing without
changing the spirit of the existing text.

Fixing the "umask confusion" should be left to a separate patch on
top.

----- >8 --------- >8 --------- >8 --------- >8 -----
Subject: init doc: --shared=0xxx does not give umask but perm bits

The description that 0640 makes sure that the group members can read
the repository is correct, but calling that octal number a <umask>
is wrong.  Let's call it <perm>, as the value is used to set the
permission bits.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 Documentation/git-init.txt | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git c/Documentation/git-init.txt w/Documentation/git-init.txt
index af0d2ee182..42268ada22 100644
--- c/Documentation/git-init.txt
+++ w/Documentation/git-init.txt
@@ -79,7 +79,7 @@ repository.  If not specified, fall back to the default name (currently
 `master`, but this is subject to change in the future; the name can be
 customized via the `init.defaultBranch` configuration variable).
 
---shared[=(false|true|umask|group|all|world|everybody|<umask>)]::
+--shared[=(false|true|umask|group|all|world|everybody|<perm>)]::
 
 Specify that the Git repository is to be shared amongst several users.  This
 allows users belonging to the same group to push into that
@@ -110,15 +110,16 @@ the repository permissions.
 
 Same as 'group', but make the repository readable by all users.
 
-'<umask>'::
+'<perm>'::
 
-'<umask>' is an 3-digit octal number prefixed with `0` and each file
-will have mode '<umask>'. '<umask>' will override users' umask(2)
+'<perm>' is an 3-digit octal number prefixed with `0` and each file
+will have mode '<perm>'. '<perm>' will override users' umask(2)
 value (and not only loosen permissions as 'group' and 'all'
 does). '0640' will create a repository which is group-readable, but
 not group-writable or accessible to others. '0660' will create a repo
 that is readable and writable to the current user and group, but
-inaccessible to others.
+inaccessible to others (directories and executable files get their
+`x` bit from the `r` bit for corresponding classes of uses).
 --
 
 By default, the configuration flag `receive.denyNonFastForwards` is enabled
diff mbox series

Patch

diff --git a/Documentation/git-init.txt b/Documentation/git-init.txt
index fdb7b3f367d..af0d2ee1825 100644
--- a/Documentation/git-init.txt
+++ b/Documentation/git-init.txt
@@ -79,7 +79,7 @@  repository.  If not specified, fall back to the default name (currently
 `master`, but this is subject to change in the future; the name can be
 customized via the `init.defaultBranch` configuration variable).
 
---shared[=(false|true|umask|group|all|world|everybody|0xxx)]::
+--shared[=(false|true|umask|group|all|world|everybody|<umask>)]::
 
 Specify that the Git repository is to be shared amongst several users.  This
 allows users belonging to the same group to push into that
@@ -110,13 +110,15 @@  the repository permissions.
 
 Same as 'group', but make the repository readable by all users.
 
-'0xxx'::
+'<umask>'::
 
-'0xxx' is an octal number and each file will have mode '0xxx'. '0xxx' will
-override users' umask(2) value (and not only loosen permissions as 'group' and
-'all' does). '0640' will create a repository which is group-readable, but not
-group-writable or accessible to others. '0660' will create a repo that is
-readable and writable to the current user and group, but inaccessible to others.
+'<umask>' is an 3-digit octal number prefixed with `0` and each file
+will have mode '<umask>'. '<umask>' will override users' umask(2)
+value (and not only loosen permissions as 'group' and 'all'
+does). '0640' will create a repository which is group-readable, but
+not group-writable or accessible to others. '0660' will create a repo
+that is readable and writable to the current user and group, but
+inaccessible to others.
 --
 
 By default, the configuration flag `receive.denyNonFastForwards` is enabled