summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 55feb12)
raw | patch | inline | side by side (parent: 55feb12)
author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | |
Wed, 11 Jul 2007 14:18:17 +0000 (15:18 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 11 Jul 2007 20:52:16 +0000 (13:52 -0700) |
For compatibility reasons, "git init --shared=all" does not write
"all" into the config, but a number. In the shared setup, you
really have to support even older clients on the _same_ repository.
But git_config_perm() did not pick up on it.
Also, "git update-server-info" failed to pick up on the shared
permissions.
This patch fixes both issues, and adds a test to prove it.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Tested-by: martin f krafft <madduck@madduck.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
"all" into the config, but a number. In the shared setup, you
really have to support even older clients on the _same_ repository.
But git_config_perm() did not pick up on it.
Also, "git update-server-info" failed to pick up on the shared
permissions.
This patch fixes both issues, and adds a test to prove it.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Tested-by: martin f krafft <madduck@madduck.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
server-info.c | patch | blob | history | |
setup.c | patch | blob | history | |
t/t1301-shared-repo.sh | [new file with mode: 0755] | patch | blob |
diff --git a/server-info.c b/server-info.c
index f9be5a7f60c1cc5208e7c91367ecb28014106f18..0d1312ca56d52daa3fc692984d4d3abaf3425791 100644 (file)
--- a/server-info.c
+++ b/server-info.c
return error("unable to update %s", path0);
for_each_ref(add_info_ref, NULL);
fclose(info_ref_fp);
+ adjust_shared_perm(path1);
rename(path1, path0);
free(path0);
free(path1);
return error("cannot open %s", name);
write_pack_info_file(fp);
fclose(fp);
+ adjust_shared_perm(name);
rename(name, infofile);
return 0;
}
index bb26f3af96da2a257d020c87760fa6dc74e8f1d7..7b07144af7b0ea96eb2fcd65098331768e46ca3b 100644 (file)
--- a/setup.c
+++ b/setup.c
int git_config_perm(const char *var, const char *value)
{
if (value) {
+ int i;
if (!strcmp(value, "umask"))
return PERM_UMASK;
if (!strcmp(value, "group"))
!strcmp(value, "world") ||
!strcmp(value, "everybody"))
return PERM_EVERYBODY;
+ i = atoi(value);
+ if (i > 1)
+ return i;
}
return git_config_bool(var, value);
}
diff --git a/t/t1301-shared-repo.sh b/t/t1301-shared-repo.sh
--- /dev/null
+++ b/t/t1301-shared-repo.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+#
+# Copyright (c) 2007 Johannes Schindelin
+#
+
+test_description='Test shared repository initialization'
+
+. ./test-lib.sh
+
+test_expect_success 'shared=all' '
+ mkdir sub &&
+ cd sub &&
+ git init --shared=all &&
+ test 2 = $(git config core.sharedrepository)
+'
+
+test_expect_success 'update-server-info honors core.sharedRepository' '
+ : > a1 &&
+ git add a1 &&
+ test_tick &&
+ git commit -m a1 &&
+ umask 0277 &&
+ git update-server-info &&
+ test 444 = $(stat -c %a .git/info/refs)
+'
+
+test_done