Thread (2 messages) flat view 2 messages, 2 authors, 2016-06-15

Re: [PATCH] Let "git svn" run "git gc --auto" occasionally

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

Eric Wong [off-list ref] writes:
quoted
quoted
 sub init_vars {
-	if (defined $_repack) {
-		$_repack = 1000 if ($_repack <= 0);
-		$_repack_nr = $_repack;
-		$_repack_flags ||= '-d';
-	}
+	$_repack = 1000 unless (defined $_repack && $_repack > 0);
+	$_repack_nr = $_repack;
+	$_repack_flags ||= '-d';
 }
 
 sub verify_remotes_sanity {
Thanks, but I think you need to do something about this part:

2154:	if (defined $_repack && (--$_repack_nr == 0)) {

I'd say 

	if ($_repack && (--$_repack_nr == 0)) {
init_vars() is called unconditionally, and always defines $_repack.
It could actually just be:

	if (--$_repack_nr == 0) {
But that means predecremented --$_repack_nr will count -1, -2, ...
until it wraps around when the user said "--repack=0", meaning
"never repack".  Instead you made it "do not repack for a many
many many rounds".

Which would be perfectly fine in practice but somehow feels a
bit dirty to me.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help