From 6241847aa6a2674b5a0f1f33d08b25c72b99146e Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 1 Feb 2008 13:56:41 -0500 Subject: [PATCH] improve handling of upstream pristine-tar branch --- debian/changelog | 3 +++ pristine-tar | 15 +++++---------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/debian/changelog b/debian/changelog index ad75ce1..a5f9845 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,9 @@ pristine-tar (0.6) UNRELEASED; urgency=low name. This way if there is a local upstream branch and a remote one, it will use the local one. If there's only a remote one, it'll use that. Closes: #463566 + * Handle the case where this is no local pristine-tar branch. If there + is exactly one remote branch, use it for checkout. If more than one or + none, show a nice error message. (Cyril Brulebois) -- Joey Hess Fri, 01 Feb 2008 13:33:04 -0500 diff --git a/pristine-tar b/pristine-tar index 853f0f8..b7a1783 100755 --- a/pristine-tar +++ b/pristine-tar @@ -480,23 +480,18 @@ sub checkoutdelta { my $vcs=vcstype(); if ($vcs eq "git") { - # Check a local pristine-tar branch exists + # Check that a local $branch exists my @reflines=map { chomp; $_ } `git show-ref \Q$branch\E`; if (! grep { "refs/heads/$branch" eq $_ } @reflines) { - # a local pristine-tar branch is missing - message "no local pristine-tar branch found"; if (scalar @reflines == 0) { - error 'no pristine-tar branch at all, use "pristine-tar commit" first'; + error "no $branch branch found, use \"pristine-tar commit\" first"; } elsif (scalar @reflines == 1) { - my $proposed=$reflines[0]; - $proposed =~ s/^.*\s+//; - message "Q: Do you want to create one from the $proposed branch? [Y/n]"; - # Prompt here. - error "still no local pristine-tar branch"; + ($branch)=$reflines[0]=~/^[A-Za-z0-9]+\s(.*)/; } else { - error 'Several remote pristine-tar branches exist, use "git-branch pristine-tar $remote/pristine-tar" to create a local pristine-tar branch'; + error "Several remote $branch branches exist. Run \"git branch --track $branch \" to create a local $branch branch\n". + join("\n", @reflines); } } -- 2.7.4