* [PATCH] update-server-info: honor core.sharedRepository
@ 2007-07-11 12:39 Johannes Schindelin
2007-07-11 13:56 ` martin f krafft
0 siblings, 1 reply; 4+ messages in thread
From: Johannes Schindelin @ 2007-07-11 12:39 UTC (permalink / raw
To: martin f krafft; +Cc: git, gitster
Earlier, update-server-info used the umask, even if
core.sharedRepository = 1.
Noticed by madduck on IRC.
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
Does this work for you?
server-info.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/server-info.c b/server-info.c
index f9be5a7..0d1312c 100644
--- a/server-info.c
+++ b/server-info.c
@@ -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;
}
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] update-server-info: honor core.sharedRepository
2007-07-11 12:39 [PATCH] update-server-info: honor core.sharedRepository Johannes Schindelin
@ 2007-07-11 13:56 ` martin f krafft
2007-07-11 14:18 ` [PATCH] Fix core.sharedRepository = 2 Johannes Schindelin
0 siblings, 1 reply; 4+ messages in thread
From: martin f krafft @ 2007-07-11 13:56 UTC (permalink / raw
To: Johannes Schindelin; +Cc: git, gitster
[-- Attachment #1: Type: text/plain, Size: 746 bytes --]
also sprach Johannes Schindelin <Johannes.Schindelin@gmx.de> [2007.07.11.1439 +0200]:
> Earlier, update-server-info used the umask, even if
> core.sharedRepository = 1.
>
> Noticed by madduck on IRC.
> Does this work for you?
Yes, it does, but only if I put = all/group into the config. init-db
--shared=all however sets core.sharedRepository=2, and then
update-server-info produces a 0660 file.
This may be another bug...
Thanks!
--
martin; (greetings from the heart of the sun.)
\____ echo mailto: !#^."<*>"|tr "<*> mailto:" net@madduck
spamtraps: madduck.bogus@madduck.net
"even if you persuade me, you won't persuade me."
-- aristophanes
[-- Attachment #2: Digital signature (GPG/PGP) --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] Fix core.sharedRepository = 2
2007-07-11 13:56 ` martin f krafft
@ 2007-07-11 14:18 ` Johannes Schindelin
2007-07-11 14:52 ` martin f krafft
0 siblings, 1 reply; 4+ messages in thread
From: Johannes Schindelin @ 2007-07-11 14:18 UTC (permalink / raw
To: martin f krafft; +Cc: git, gitster
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>
---
On Wed, 11 Jul 2007, martin f krafft wrote:
> also sprach Johannes Schindelin <Johannes.Schindelin@gmx.de>
> > Earlier, update-server-info used the umask, even if
> > core.sharedRepository = 1.
> >
> > Noticed by madduck on IRC.
> > Does this work for you?
>
> Yes, it does, but only if I put = all/group into the config.
> init-db --shared=all however sets core.sharedRepository=2, and
> then update-server-info produces a 0660 file.
Should be fixed now.
server-info.c | 2 ++
setup.c | 4 ++++
t/t1301-shared-repo.sh | 27 +++++++++++++++++++++++++++
3 files changed, 33 insertions(+), 0 deletions(-)
create mode 100755 t/t1301-shared-repo.sh
diff --git a/server-info.c b/server-info.c
index f9be5a7..0d1312c 100644
--- a/server-info.c
+++ b/server-info.c
@@ -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;
}
diff --git a/setup.c b/setup.c
index bb26f3a..7b07144 100644
--- a/setup.c
+++ b/setup.c
@@ -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);
}
diff --git a/t/t1301-shared-repo.sh b/t/t1301-shared-repo.sh
new file mode 100755
index 0000000..bb5f302
--- /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
--
1.5.3.rc0.2783.gf3f7
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Fix core.sharedRepository = 2
2007-07-11 14:18 ` [PATCH] Fix core.sharedRepository = 2 Johannes Schindelin
@ 2007-07-11 14:52 ` martin f krafft
0 siblings, 0 replies; 4+ messages in thread
From: martin f krafft @ 2007-07-11 14:52 UTC (permalink / raw
To: Johannes Schindelin; +Cc: git, gitster
[-- Attachment #1: Type: text/plain, Size: 481 bytes --]
also sprach Johannes Schindelin <Johannes.Schindelin@gmx.de> [2007.07.11.1618 +0200]:
> This patch fixes both issues, and adds a test to prove it.
I also tested it and can confirm.
--
martin; (greetings from the heart of the sun.)
\____ echo mailto: !#^."<*>"|tr "<*> mailto:" net@madduck
spamtraps: madduck.bogus@madduck.net
"wer ein warum hat, dem ist kein wie zu schwer."
- friedrich nietzsche
[-- Attachment #2: Digital signature (GPG/PGP) --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-07-11 14:52 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-11 12:39 [PATCH] update-server-info: honor core.sharedRepository Johannes Schindelin
2007-07-11 13:56 ` martin f krafft
2007-07-11 14:18 ` [PATCH] Fix core.sharedRepository = 2 Johannes Schindelin
2007-07-11 14:52 ` martin f krafft
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).