提交 83525227 编写于 作者: J Johannes Schindelin 提交者: Junio C Hamano

Fix core.sharedRepository = 2

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: NJohannes Schindelin <johannes.schindelin@gmx.de>
Tested-by: Nmartin f krafft <madduck@madduck.net>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 55feb120
......@@ -38,6 +38,7 @@ static int update_info_refs(int force)
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);
......@@ -227,6 +228,7 @@ static int update_info_packs(int force)
return error("cannot open %s", name);
write_pack_info_file(fp);
fclose(fp);
adjust_shared_perm(name);
rename(name, infofile);
return 0;
}
......
......@@ -364,6 +364,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
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"))
......@@ -372,6 +373,9 @@ int git_config_perm(const char *var, const char *value)
!strcmp(value, "world") ||
!strcmp(value, "everybody"))
return PERM_EVERYBODY;
i = atoi(value);
if (i > 1)
return i;
}
return git_config_bool(var, value);
}
......
#!/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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册