[PATCH] git-svn: warn instead of dying when commit data is missing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Christian Couder <christian.couder@xxxxxxxxx> wrote:
> On Fri, Jun 24, 2016 at 10:06 PM, Eric Wong <e@xxxxxxxxx> wrote:
> > Jacob Godserv <jacobgodserv@xxxxxxxxx> wrote:
> >> > Christian (Cc-ed) also noticed the problem a few weeks ago
> >> > and took a more drastic approach by having git-svn die
> >> > instead of warning:
> >> > http://mid.gmane.org/1462604323-18545-1-git-send-email-chriscool@xxxxxxxxxxxxx
> >> > which landed as commit 523a33ca17c76bee007d7394fb3930266c577c02
> >> > in git.git: https://bogomips.org/mirrors/git.git/patch?id=523a33ca17c7
> >> >
> >> > Is dying here too drastic and maybe warn is preferable?
> >>
> >> In my opinion this is too drastic. It keeps me from storing
> >> git-specific data on a git-svn mirror.
> >
> > I tend to agree, but will wait to see what Christian thinks.
> 
> Yeah a warning is probably enough.

OK, patch below.

> Another possibility would be to default to an error that tells people
> about a configuration variable that could let them decide depending on
> their workflow if this should be an error, a warning or just be
> ignored.

I think that's too much.  I'm not a fan of having too many
configuration variables to throw on users.

------8<------
Subject: [PATCH] git-svn: warn instead of dying when commit data is missing

It is possible to have refs globbed by git-svn which stores data
purely in git; gently skip those instead of dying and assuming
user error.

ref: http://mid.gmane.org/CALi1mtdtNF_GtzyPTbfb7N51wwxsFY7zm8hsgwxr3tHcZZboyg@xxxxxxxxxxxxxx

Suggested-by: Jacob Godserv <jacobgodserv@xxxxxxxxx>
Cc: Christian Couder <chriscool@xxxxxxxxxxxxx>
Signed-off-by: Eric Wong <e@xxxxxxxxx>
---
 perl/Git/SVN.pm | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm
index bee1e7d..018beb8 100644
--- a/perl/Git/SVN.pm
+++ b/perl/Git/SVN.pm
@@ -97,8 +97,12 @@ sub resolve_local_globs {
 				    "existing: $existing\n",
 				    " globbed: $refname\n";
 			}
-			my $u = (::cmt_metadata("$refname"))[0] or die
-			    "$refname: no associated commit metadata\n";
+			my $u = (::cmt_metadata("$refname"))[0];
+			if (!defined($u)) {
+				warn
+"W: $refname: no associated commit metadata from SVN, skipping\n";
+				next;
+			}
 			$u =~ s!^\Q$url\E(/|$)!! or die
 			  "$refname: '$url' not found in '$u'\n";
 			if ($pathname ne $u) {
-- 
EW
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]