Re: [PATCH] Make git reflog expire honour core.sharedRepository.

4 messages, 3 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH] Make git reflog expire honour core.sharedRepository.

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:44:46

Pierre Habouzit [off-list ref] writes:
quoted hunk
Signed-off-by: Pierre Habouzit <redacted>
---
 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?

Re: [PATCH] Make git reflog expire honour core.sharedRepository.

From: Pierre Habouzit <hidden>
Date: 2016-06-15 22:44:46

On Sun, Jun 15, 2008 at 10:47:51PM +0000, Junio C Hamano wrote:
Pierre Habouzit [off-list ref] writes:
quoted
Signed-off-by: Pierre Habouzit <redacted>
---
 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

Re: [PATCH] Make git reflog expire honour core.sharedRepository.

From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:44:46

Hi,

On Sun, 15 Jun 2008, Junio C Hamano wrote:
Pierre Habouzit [off-list ref] writes:
quoted
Signed-off-by: Pierre Habouzit <redacted>
---
 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

Re: [PATCH] Make git reflog expire honour core.sharedRepository.

From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:44:46

Hi,

On Mon, 16 Jun 2008, Johannes Schindelin wrote:
On Sun, 15 Jun 2008, Junio C Hamano wrote:
quoted
Pierre Habouzit [off-list ref] writes:
quoted
Signed-off-by: Pierre Habouzit <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help