* [PATCH] Make git reflog expire honour core.sharedRepository.
@ 2008-06-15 21:37 Pierre Habouzit
2008-06-15 22:47 ` Junio C Hamano
0 siblings, 1 reply; 5+ messages in thread
From: Pierre Habouzit @ 2008-06-15 21:37 UTC (permalink / raw)
To: git; +Cc: gitster, joerg, Pierre Habouzit
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
---
builtin-reflog.c | 1 +
t/t1301-shared-repo.sh | 15 +++++++++++++++
2 files changed, 16 insertions(+), 0 deletions(-)
Some people like to have logAllRefUpdates even for bare repositories, and if
shared, git-gc breaks them.
diff --git a/builtin-reflog.c b/builtin-reflog.c
index 897d1dc..430929f 100644
--- a/builtin-reflog.c
+++ b/builtin-reflog.c
@@ -308,6 +308,7 @@ static int expire_reflog(const char *ref, const unsigned char *sha1, int unused,
} else if (cmd->updateref && commit_ref(lock)) {
status |= error("Couldn't set %s", lock->ref_name);
}
+ adjust_shared_perm(log_file);
}
free(newlog_path);
free(log_file);
diff --git a/t/t1301-shared-repo.sh b/t/t1301-shared-repo.sh
index 5e4252a..6c78c8b 100755
--- a/t/t1301-shared-repo.sh
+++ b/t/t1301-shared-repo.sh
@@ -83,4 +83,19 @@ do
done
+test_expect_success 'git reflog expire honors core.sharedRepository' '
+ git config core.sharedRepository group &&
+ git reflog expire --all &&
+ actual="$(ls -l .git/logs/refs/heads/master)" &&
+ case "$actual" in
+ -rw-rw-*)
+ : happy
+ ;;
+ *)
+ echo Ooops, .git/logs/refs/heads/master is not 0662 [$actual]
+ false
+ ;;
+ esac
+'
+
test_done
--
1.5.6.rc3.149.gaacb0.dirty
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] Make git reflog expire honour core.sharedRepository.
2008-06-15 21:37 [PATCH] Make git reflog expire honour core.sharedRepository Pierre Habouzit
@ 2008-06-15 22:47 ` Junio C Hamano
2008-06-15 22:55 ` Pierre Habouzit
2008-06-16 15:15 ` Johannes Schindelin
0 siblings, 2 replies; 5+ messages in thread
From: Junio C Hamano @ 2008-06-15 22:47 UTC (permalink / raw)
To: Pierre Habouzit; +Cc: git, gitster, joerg
Pierre Habouzit <madcoder@debian.org> writes:
> Signed-off-by: Pierre Habouzit <madcoder@debian.org>
> ---
> builtin-reflog.c | 1 +
> t/t1301-shared-repo.sh | 15 +++++++++++++++
> 2 files changed, 16 insertions(+), 0 deletions(-)
>
> Some people like to have logAllRefUpdates even for bare repositories, and if
> shared, git-gc breaks them.
>
> diff --git a/builtin-reflog.c b/builtin-reflog.c
> index 897d1dc..430929f 100644
> --- a/builtin-reflog.c
> +++ b/builtin-reflog.c
> @@ -308,6 +308,7 @@ static int expire_reflog(const char *ref, const unsigned char *sha1, int unused,
> } else if (cmd->updateref && commit_ref(lock)) {
> status |= error("Couldn't set %s", lock->ref_name);
> }
> + adjust_shared_perm(log_file);
Why is it sane to do this unconditionally, instead of putting in another
else or something?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Make git reflog expire honour core.sharedRepository.
2008-06-15 22:47 ` Junio C Hamano
@ 2008-06-15 22:55 ` Pierre Habouzit
2008-06-16 15:15 ` Johannes Schindelin
1 sibling, 0 replies; 5+ messages in thread
From: Pierre Habouzit @ 2008-06-15 22:55 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, gitster, joerg
[-- Attachment #1: Type: text/plain, Size: 1376 bytes --]
On Sun, Jun 15, 2008 at 10:47:51PM +0000, Junio C Hamano wrote:
> Pierre Habouzit <madcoder@debian.org> writes:
>
> > Signed-off-by: Pierre Habouzit <madcoder@debian.org>
> > ---
> > builtin-reflog.c | 1 +
> > t/t1301-shared-repo.sh | 15 +++++++++++++++
> > 2 files changed, 16 insertions(+), 0 deletions(-)
> >
> > Some people like to have logAllRefUpdates even for bare repositories, and if
> > shared, git-gc breaks them.
> >
> > diff --git a/builtin-reflog.c b/builtin-reflog.c
> > index 897d1dc..430929f 100644
> > --- a/builtin-reflog.c
> > +++ b/builtin-reflog.c
> > @@ -308,6 +308,7 @@ static int expire_reflog(const char *ref, const unsigned char *sha1, int unused,
> > } else if (cmd->updateref && commit_ref(lock)) {
> > status |= error("Couldn't set %s", lock->ref_name);
> > }
> > + adjust_shared_perm(log_file);
>
> Why is it sane to do this unconditionally, instead of putting in another
> else or something?
Huh indeed, the proper patch should have been:
- }
+ } else {
+ adjust_shared_perm(log_file);
+ }
It was inattention on my end, I focused more on writing a test case
than on the one liner fix. Sorry.
--
·O· Pierre Habouzit
··O madcoder@debian.org
OOO http://www.madism.org
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Make git reflog expire honour core.sharedRepository.
2008-06-15 22:47 ` Junio C Hamano
2008-06-15 22:55 ` Pierre Habouzit
@ 2008-06-16 15:15 ` Johannes Schindelin
2008-06-16 15:19 ` Johannes Schindelin
1 sibling, 1 reply; 5+ messages in thread
From: Johannes Schindelin @ 2008-06-16 15:15 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Pierre Habouzit, git, gitster, joerg
Hi,
On Sun, 15 Jun 2008, Junio C Hamano wrote:
> Pierre Habouzit <madcoder@debian.org> writes:
>
> > Signed-off-by: Pierre Habouzit <madcoder@debian.org>
> > ---
> > builtin-reflog.c | 1 +
> > t/t1301-shared-repo.sh | 15 +++++++++++++++
> > 2 files changed, 16 insertions(+), 0 deletions(-)
> >
> > Some people like to have logAllRefUpdates even for bare repositories, and if
> > shared, git-gc breaks them.
> >
> > diff --git a/builtin-reflog.c b/builtin-reflog.c
> > index 897d1dc..430929f 100644
> > --- a/builtin-reflog.c
> > +++ b/builtin-reflog.c
> > @@ -308,6 +308,7 @@ static int expire_reflog(const char *ref, const unsigned char *sha1, int unused,
> > } else if (cmd->updateref && commit_ref(lock)) {
> > status |= error("Couldn't set %s", lock->ref_name);
> > }
> > + adjust_shared_perm(log_file);
>
> Why is it sane to do this unconditionally, instead of putting in another
> else or something?
Because adjust_shared_perm() checks for shared_repository, and returns
when there is nothing to do.
IMO this is a sane convention, since you _never_ want to do this
unconditionally anyway, and you avoid a lot of identical "if () adjust()"
constructs.
Ciao,
Dscho
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Make git reflog expire honour core.sharedRepository.
2008-06-16 15:15 ` Johannes Schindelin
@ 2008-06-16 15:19 ` Johannes Schindelin
0 siblings, 0 replies; 5+ messages in thread
From: Johannes Schindelin @ 2008-06-16 15:19 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Pierre Habouzit, git, gitster, joerg
Hi,
On Mon, 16 Jun 2008, Johannes Schindelin wrote:
> On Sun, 15 Jun 2008, Junio C Hamano wrote:
>
> > Pierre Habouzit <madcoder@debian.org> writes:
> >
> > > Signed-off-by: Pierre Habouzit <madcoder@debian.org>
> > > ---
> > > builtin-reflog.c | 1 +
> > > t/t1301-shared-repo.sh | 15 +++++++++++++++
> > > 2 files changed, 16 insertions(+), 0 deletions(-)
> > >
> > > Some people like to have logAllRefUpdates even for bare repositories, and if
> > > shared, git-gc breaks them.
> > >
> > > diff --git a/builtin-reflog.c b/builtin-reflog.c
> > > index 897d1dc..430929f 100644
> > > --- a/builtin-reflog.c
> > > +++ b/builtin-reflog.c
> > > @@ -308,6 +308,7 @@ static int expire_reflog(const char *ref, const unsigned char *sha1, int unused,
> > > } else if (cmd->updateref && commit_ref(lock)) {
> > > status |= error("Couldn't set %s", lock->ref_name);
> > > }
> > > + adjust_shared_perm(log_file);
> >
> > Why is it sane to do this unconditionally, instead of putting in another
> > else or something?
>
> Because adjust_shared_perm() checks for shared_repository, and returns
> when there is nothing to do.
Ooops. I think I missed your point, namely that this should only be done
when no error occurred. I just blame it on the short snippet.
Sorry,
Dscho
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-06-16 15:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-15 21:37 [PATCH] Make git reflog expire honour core.sharedRepository Pierre Habouzit
2008-06-15 22:47 ` Junio C Hamano
2008-06-15 22:55 ` Pierre Habouzit
2008-06-16 15:15 ` Johannes Schindelin
2008-06-16 15:19 ` Johannes Schindelin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox