Skip to contentSkip to conversation

git-svn: allow "0" in SVN path components

PATCH In review Eric Wong 2 participants 2 messages Dec 12, 2016

lore
Share & tools
lore

Eric Wong

author
#0 lore raw

PATCH 1/1 git-svn: allow "0" in SVN path components

Blindly checking a path component for falsiness is unwise, as "0" is false to Perl, but a valid pathname component for SVN (or any filesystem).

Found via random code reading.

---
Junio: this bugfix should go to "maint".
Will push along with a doc fix for Juergen.

 perl/Git/SVN/Ra.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
perl/Git/SVN/Ra.pm +1 -1
index e764696801..56ad9870bc 100644
@@ -606,7 +606,7 @@ sub minimize_url {
 			my $latest = $ra->get_latest_revnum;
 			$ra->get_log("", $latest, 0, 1, 0, 1, sub {});
 		};
-	} while ($@ && ($c = shift @components));
+	} while ($@ && defined($c = shift @components));
 
 	return canonicalize_url($url);
 }
Signature · 1 line
EW
#1 lore raw
Quoted 19 lines · Eric Wong

Blindly checking a path component for falsiness is unwise, as "0" is false to Perl, but a valid pathname component for SVN (or any filesystem).

Found via random code reading.

---
Junio: this bugfix should go to "maint".
Will push along with a doc fix for Juergen.

 perl/Git/SVN/Ra.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
perl/Git/SVN/Ra.pm +0 -0
index e764696801..56ad9870bc 100644

perl/Git/SVN/Ra.pm sub minimize_url { · line 612

Quoted 8 lines
perl/Git/SVN/Ra.pm +1 -1
@@ -606,7 +606,7 @@ sub minimize_url {
 			my $latest = $ra->get_latest_revnum;
 			$ra->get_log("", $latest, 0, 1, 0, 1, sub {});
 		};
-	} while ($@ && ($c = shift @components));
+	} while ($@ && defined($c = shift @components));
 
 	return canonicalize_url($url);
 }

Makes sense to me. Thanks.