git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Git::SVN: handle missing ref_id case correctly
@ 2015-01-10 14:35 Ramkumar Ramachandra
  2015-01-10 15:12 ` Ramkumar Ramachandra
  0 siblings, 1 reply; 5+ messages in thread
From: Ramkumar Ramachandra @ 2015-01-10 14:35 UTC (permalink / raw)
  To: Git List; +Cc: Eric Wong

$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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] Git::SVN: handle missing ref_id case correctly
  2015-01-10 14:35 [PATCH] Git::SVN: handle missing ref_id case correctly Ramkumar Ramachandra
@ 2015-01-10 15:12 ` Ramkumar Ramachandra
  2015-01-10 22:13   ` Eric Wong
  0 siblings, 1 reply; 5+ messages in thread
From: Ramkumar Ramachandra @ 2015-01-10 15:12 UTC (permalink / raw)
  To: Git List; +Cc: Eric Wong

Ramkumar Ramachandra wrote:
> -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';

This is probably not a functional change; please look at the second hunk.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Git::SVN: handle missing ref_id case correctly
  2015-01-10 15:12 ` Ramkumar Ramachandra
@ 2015-01-10 22:13   ` Eric Wong
  2015-01-10 22:14     ` Ramkumar Ramachandra
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Wong @ 2015-01-10 22:13 UTC (permalink / raw)
  To: Ramkumar Ramachandra; +Cc: Git List

Ramkumar Ramachandra <artagnon@gmail.com> wrote:
> Ramkumar Ramachandra wrote:
> > -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';
> 
> This is probably not a functional change; please look at the second hunk.

It is functional, maybe someone will use GIT_SVN_ID=0 ?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Git::SVN: handle missing ref_id case correctly
  2015-01-10 22:13   ` Eric Wong
@ 2015-01-10 22:14     ` Ramkumar Ramachandra
  2015-01-10 22:18       ` Ramkumar Ramachandra
  0 siblings, 1 reply; 5+ messages in thread
From: Ramkumar Ramachandra @ 2015-01-10 22:14 UTC (permalink / raw)
  To: Eric Wong; +Cc: Git List

Eric Wong wrote:
> It is functional, maybe someone will use GIT_SVN_ID=0 ?

Right. Kindly drop the first hunk.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Git::SVN: handle missing ref_id case correctly
  2015-01-10 22:14     ` Ramkumar Ramachandra
@ 2015-01-10 22:18       ` Ramkumar Ramachandra
  0 siblings, 0 replies; 5+ messages in thread
From: Ramkumar Ramachandra @ 2015-01-10 22:18 UTC (permalink / raw)
  To: Eric Wong; +Cc: Git List

Ramkumar Ramachandra wrote:
>> It is functional, maybe someone will use GIT_SVN_ID=0 ?
>
> Right. Kindly drop the first hunk.

Amendment: there are actually many other places where variables are
checked without "defined", so I doubt we want to put up with the extra
ugliness to allow "0".

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-01-10 22:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-10 14:35 [PATCH] Git::SVN: handle missing ref_id case correctly Ramkumar Ramachandra
2015-01-10 15:12 ` Ramkumar Ramachandra
2015-01-10 22:13   ` Eric Wong
2015-01-10 22:14     ` Ramkumar Ramachandra
2015-01-10 22:18       ` Ramkumar Ramachandra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).