git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 28, 2021, 17:17 UTC
Message-ID
<xmqqilxhrrva.fsf@gitster.g>
In-Reply-To
<7eef3538f3c3015c4f446961ddca78e2868fe644.1635438124.git.gitgitgadget@gmail.com>
"Jean-Noël Avila via GitGitGadget"  <gitgitgadget@gmail.com> writes:
Show 24 quoted lines
> ---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
-- 
2.33.1-984-g9137471b0c
Previous: Jean-Noël Avila via GitGitGadgetNext: Junio C Hamano
Message 33 of 49 in “doc: fix grammar rules in commands'syntax”
  1. doc: fix grammar rules in commands'syntaxJean-Noël Avila via GitGitGadget, Oct 26, 2021
  2. Eric SunshineOct 26, 2021
  3. Jean-Noël AvilaOct 27, 2021
  4. Martin ÅgrenOct 27, 2021
  5. Eric SunshineOct 27, 2021
  6. Jean-Noël AvilaOct 28, 2021
  7. Martin ÅgrenOct 28, 2021
  8. 0/9 doc: fix grammar rules in commands' syntaxJean-Noël Avila via GitGitGadget, Oct 28, 2021
  9. 1/9 doc: fix git credential synopsisJean-Noël Avila via GitGitGadget, Oct 28, 2021
  10. 2/9 doc: split placeholders as individual tokensJean-Noël Avila via GitGitGadget, Oct 28, 2021
  11. Martin ÅgrenOct 28, 2021
  12. 3/9 doc: express grammar placeholders between angle bracketsJean-Noël Avila via GitGitGadget, Oct 28, 2021
  13. Eric SunshineOct 28, 2021
  14. Junio C HamanoOct 28, 2021
  15. 4/9 doc: use only hyphens as word separators in placeholdersJean-Noël Avila via GitGitGadget, Oct 28, 2021
  16. Martin ÅgrenOct 28, 2021
  17. Junio C HamanoOct 28, 2021
  18. Eli SchwartzOct 31, 2021
  19. Jean-Noël AVILAOct 31, 2021
  20. Junio C HamanoNov 1, 2021
  21. Jean-Noël AvilaNov 3, 2021
  22. Junio C HamanoNov 3, 2021
  23. Johannes SchindelinNov 4, 2021
  24. Junio C HamanoNov 4, 2021
  25. Eli SchwartzNov 7, 2021
  26. 5/9 doc: git-ls-files: express options as optional alternativesJean-Noël Avila via GitGitGadget, Oct 28, 2021
  27. 7/9 doc: uniformize <URL> placeholders' caseJean-Noël Avila via GitGitGadget, Oct 28, 2021
  28. Junio C HamanoOct 28, 2021
  29. 6/9 doc: use three dots for indicating repetition instead of starJean-Noël Avila via GitGitGadget, Oct 28, 2021
  30. 8/9 doc: git-http-push: describe the refs as pattern pairsJean-Noël Avila via GitGitGadget, Oct 28, 2021
  31. Junio C HamanoOct 28, 2021
  32. 9/9 doc: git-init: clarify file modes in octal.Jean-Noël Avila via GitGitGadget, Oct 28, 2021
  33. Junio C HamanoOct 28, 2021
  34. Junio C HamanoOct 28, 2021
  35. Junio C HamanoOct 28, 2021
  36. 00/10 doc: fix grammar rules in commands' syntaxJean-Noël Avila, Nov 6, 2021
  37. 01/10 doc: fix git credential synopsisJean-Noël Avila, Nov 6, 2021
  38. 02/10 doc: split placeholders as individual tokensJean-Noël Avila, Nov 6, 2021
  39. 03/10 doc: express grammar placeholders between angle bracketsJean-Noël Avila, Nov 6, 2021
  40. 04/10 doc: use only hyphens as word separators in placeholdersJean-Noël Avila, Nov 6, 2021
  41. 05/10 doc: git-ls-files: express options as optional alternativesJean-Noël Avila, Nov 6, 2021
  42. 06/10 doc: use three dots for indicating repetition instead of starJean-Noël Avila, Nov 6, 2021
  43. 07/10 doc: uniformize <URL> placeholders' caseJean-Noël Avila, Nov 6, 2021
  44. 08/10 doc: git-http-push: describe the refs as pattern pairsJean-Noël Avila, Nov 6, 2021
  45. 09/10 doc: git-init: clarify file modes in octal.Jean-Noël Avila, Nov 6, 2021
  46. Johannes AltmanningerNov 7, 2021
  47. 10/10 init doc: --shared=0xxx does not give umask but perm bitsJean-Noël Avila, Nov 6, 2021
  48. Johannes AltmanningerNov 7, 2021
  49. Junio C HamanoNov 9, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.