git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Git::SVN: handle missing ref_id case correctly

From
Ramkumar Ramachandra <artagnon@gmail.com>
Date
Jan 10, 2015, 14:35 UTC
Message-ID
<1420900510-78522-1-git-send-email-artagnon@gmail.com>

$ENV{GIT_SVN_ID} will return a string, so check it with defined. Also, ref_id should not match "refs/remotes/".

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 perl/Git/SVN.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm
index d9a52a5..06ff216 100644
--- a/perl/Git/SVN.pm
+++ b/perl/Git/SVN.pm
@@ -40,7 +40,7 @@ BEGIN {
 our $_follow_parent  = 1;
 our $_minimize_url   = 'unset';
 our $default_repo_id = 'svn';
-our $default_ref_id  = $ENV{GIT_SVN_ID} || 'git-svn';
+our $default_ref_id  = defined $ENV{GIT_SVN_ID} ? $ENV{GIT_SVN_ID} : 'git-svn';
 
 my ($_gc_nr, $_gc_period);
 
@@ -2365,7 +2365,7 @@ sub _new {
 
 	# Older repos imported by us used $GIT_DIR/svn/foo instead of
 	# $GIT_DIR/svn/refs/remotes/foo when tracking refs/remotes/foo
-	if ($ref_id =~ m{^refs/remotes/(.*)}) {
+	if ($ref_id =~ m{^refs/remotes/(.+)}) {
 		my $old_dir = "$ENV{GIT_DIR}/svn/$1";
 		if (-d $old_dir && ! -d $dir) {
 			$dir = $old_dir;
-- 
2.2.1
Next: Ramkumar Ramachandra
Message 1 of 5 in “Git::SVN: handle missing ref_id case correctly”
  1. Git::SVN: handle missing ref_id case correctlyRamkumar Ramachandra, Jan 10, 2015
  2. Ramkumar RamachandraJan 10, 2015
  3. Eric WongJan 10, 2015
  4. Ramkumar RamachandraJan 10, 2015
  5. Ramkumar RamachandraJan 10, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.