{"thread":{"id":"8981","subject":"[PATCH] update-server-info: honor core.sharedRepository","startedAt":"2007-07-11T12:39:09Z","lastAt":"2007-07-11T14:52:04Z","messageCount":4,"participants":["Johannes Schindelin","martin f krafft"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"47028","messageId":"Pine.LNX.4.64.0707111338360.4516@racer.site","threadId":"8981","inReplyTo":null,"subject":"[PATCH] update-server-info: honor core.sharedRepository","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-07-11T12:39:09Z","receivedAt":"2007-07-11T12:39:09Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nEarlier, update-server-info used the umask, even if\ncore.sharedRepository = 1.\n\nNoticed by madduck on IRC.\n\nSigned-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n\n---\n\n\tDoes this work for you?\n\n server-info.c |    2 ++\n 1 files changed, 2 insertions(+), 0 deletions(-)\n\ndiff --git a/server-info.c b/server-info.c\nindex f9be5a7..0d1312c 100644\n--- a/server-info.c\n+++ b/server-info.c\n@@ -38,6 +38,7 @@ static int update_info_refs(int force)\n \t\treturn error(\"unable to update %s\", path0);\n \tfor_each_ref(add_info_ref, NULL);\n \tfclose(info_ref_fp);\n+\tadjust_shared_perm(path1);\n \trename(path1, path0);\n \tfree(path0);\n \tfree(path1);\n@@ -227,6 +228,7 @@ static int update_info_packs(int force)\n \t\treturn error(\"cannot open %s\", name);\n \twrite_pack_info_file(fp);\n \tfclose(fp);\n+\tadjust_shared_perm(name);\n \trename(name, infofile);\n \treturn 0;\n }\n"},{"id":"47032","messageId":"20070711135656.GA28593@piper.oerlikon.madduck.net","threadId":"8981","inReplyTo":"Pine.LNX.4.64.0707111338360.4516@racer.site","subject":"Re: [PATCH] update-server-info: honor core.sharedRepository","fromName":"martin f krafft","fromEmail":"madduck@madduck.net","sentAt":"2007-07-11T13:56:56Z","receivedAt":"2007-07-11T13:56:56Z","isPatch":true,"sender":{"key":"madduck@madduck.net","avatar":null},"body":"also sprach Johannes Schindelin <Johannes.Schindelin@gmx.de> [2007.07.11.1439 +0200]:\n> Earlier, update-server-info used the umask, even if\n> core.sharedRepository = 1.\n> \n> Noticed by madduck on IRC.\n> \tDoes this work for you?\n\nYes, it does, but only if I put = all/group into the config. init-db\n--shared=all however sets core.sharedRepository=2, and then\nupdate-server-info produces a 0660 file.\n\nThis may be another bug...\n\nThanks!\n\n-- \nmartin;              (greetings from the heart of the sun.)\n  \\____ echo mailto: !#^.\"<*>\"|tr \"<*> mailto:\" net@madduck\n \nspamtraps: madduck.bogus@madduck.net\n \n\"even if you persuade me, you won't persuade me.\"\n                                                       -- aristophanes\n"},{"id":"47034","messageId":"Pine.LNX.4.64.0707111517050.4516@racer.site","threadId":"8981","inReplyTo":"20070711135656.GA28593@piper.oerlikon.madduck.net","subject":"[PATCH] Fix core.sharedRepository = 2","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-07-11T14:18:17Z","receivedAt":"2007-07-11T14:18:17Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nFor compatibility reasons, \"git init --shared=all\" does not write\n\"all\" into the config, but a number.  In the shared setup, you\nreally have to support even older clients on the _same_ repository.\n\nBut git_config_perm() did not pick up on it.\n\nAlso, \"git update-server-info\" failed to pick up on the shared\npermissions.\n\nThis patch fixes both issues, and adds a test to prove it.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n\n\tOn Wed, 11 Jul 2007, martin f krafft wrote:\n\n\t> also sprach Johannes Schindelin <Johannes.Schindelin@gmx.de>\n\t> > Earlier, update-server-info used the umask, even if\n\t> > core.sharedRepository = 1.\n\t> > \n\t> > Noticed by madduck on IRC.\n\t> > \tDoes this work for you?\n\t>\t \n\t> Yes, it does, but only if I put = all/group into the config. \n\t> init-db --shared=all however sets core.sharedRepository=2, and \n\t> then update-server-info produces a 0660 file.\n\n\tShould be fixed now.\n\n server-info.c          |    2 ++\n setup.c                |    4 ++++\n t/t1301-shared-repo.sh |   27 +++++++++++++++++++++++++++\n 3 files changed, 33 insertions(+), 0 deletions(-)\n create mode 100755 t/t1301-shared-repo.sh\n\ndiff --git a/server-info.c b/server-info.c\nindex f9be5a7..0d1312c 100644\n--- a/server-info.c\n+++ b/server-info.c\n@@ -38,6 +38,7 @@ static int update_info_refs(int force)\n \t\treturn error(\"unable to update %s\", path0);\n \tfor_each_ref(add_info_ref, NULL);\n \tfclose(info_ref_fp);\n+\tadjust_shared_perm(path1);\n \trename(path1, path0);\n \tfree(path0);\n \tfree(path1);\n@@ -227,6 +228,7 @@ static int update_info_packs(int force)\n \t\treturn error(\"cannot open %s\", name);\n \twrite_pack_info_file(fp);\n \tfclose(fp);\n+\tadjust_shared_perm(name);\n \trename(name, infofile);\n \treturn 0;\n }\ndiff --git a/setup.c b/setup.c\nindex bb26f3a..7b07144 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -364,6 +364,7 @@ const char *setup_git_directory_gently(int *nongit_ok)\n int git_config_perm(const char *var, const char *value)\n {\n \tif (value) {\n+\t\tint i;\n \t\tif (!strcmp(value, \"umask\"))\n \t\t\treturn PERM_UMASK;\n \t\tif (!strcmp(value, \"group\"))\n@@ -372,6 +373,9 @@ int git_config_perm(const char *var, const char *value)\n \t\t    !strcmp(value, \"world\") ||\n \t\t    !strcmp(value, \"everybody\"))\n \t\t\treturn PERM_EVERYBODY;\n+\t\ti = atoi(value);\n+\t\tif (i > 1)\n+\t\t\treturn i;\n \t}\n \treturn git_config_bool(var, value);\n }\ndiff --git a/t/t1301-shared-repo.sh b/t/t1301-shared-repo.sh\nnew file mode 100755\nindex 0000000..bb5f302\n--- /dev/null\n+++ b/t/t1301-shared-repo.sh\n@@ -0,0 +1,27 @@\n+#!/bin/sh\n+#\n+# Copyright (c) 2007 Johannes Schindelin\n+#\n+\n+test_description='Test shared repository initialization'\n+\n+. ./test-lib.sh\n+\n+test_expect_success 'shared=all' '\n+\tmkdir sub &&\n+\tcd sub &&\n+\tgit init --shared=all &&\n+\ttest 2 = $(git config core.sharedrepository)\n+'\n+\n+test_expect_success 'update-server-info honors core.sharedRepository' '\n+\t: > a1 &&\n+\tgit add a1 &&\n+\ttest_tick &&\n+\tgit commit -m a1 &&\n+\tumask 0277 &&\n+\tgit update-server-info &&\n+\ttest 444 = $(stat -c %a .git/info/refs)\n+'\n+\n+test_done\n-- \n1.5.3.rc0.2783.gf3f7\n"},{"id":"47038","messageId":"20070711145204.GA5768@piper.oerlikon.madduck.net","threadId":"8981","inReplyTo":"Pine.LNX.4.64.0707111517050.4516@racer.site","subject":"Re: [PATCH] Fix core.sharedRepository = 2","fromName":"martin f krafft","fromEmail":"madduck@madduck.net","sentAt":"2007-07-11T14:52:04Z","receivedAt":"2007-07-11T14:52:04Z","isPatch":true,"sender":{"key":"madduck@madduck.net","avatar":null},"body":"also sprach Johannes Schindelin <Johannes.Schindelin@gmx.de> [2007.07.11.1618 +0200]:\n> This patch fixes both issues, and adds a test to prove it.\n\nI also tested it and can confirm.\n\n-- \nmartin;              (greetings from the heart of the sun.)\n  \\____ echo mailto: !#^.\"<*>\"|tr \"<*> mailto:\" net@madduck\n \nspamtraps: madduck.bogus@madduck.net\n \n\"wer ein warum hat, dem ist kein wie zu schwer.\"\n                                                 - friedrich nietzsche\n"}]}