chiark / gitweb /
Dgit::upstream_commitish_search: fail if more than one tag exists
authorSean Whitton <spwhitton@spwhitton.name>
Wed, 27 May 2020 20:49:07 +0000 (13:49 -0700)
committerSean Whitton <spwhitton@spwhitton.name>
Thu, 28 May 2020 00:55:22 +0000 (17:55 -0700)
We should not assume we know which the user wants to merge, as
git-deborig does not.

Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Reported-by: David Bremner <bremner@debian.org>
Reviewed-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Debian/Dgit.pm

index 5d898ae5f6ab1c33e1f2f043d5c684bd1fe5005b..4e1965702c1d8c980d9ecad86f40c415873fee4f 100644 (file)
@@ -634,12 +634,14 @@ sub git_check_unmodified () {
 sub upstream_commitish_search ($$) {
     my ($upstream_version, $tried) = @_;
     # todo: at some point maybe use git-deborig to do this
+    my @found;
     foreach my $tagpfx ('', 'v', 'upstream/') {
        my $tag = $tagpfx.(dep14_version_mangle $upstream_version);
        my $new_upstream = git_get_ref "refs/tags/$tag";
        push @$tried, $tag;
-       return $new_upstream if length $new_upstream;
+       push @found, $tag if $new_upstream;
     }
+    return $found[0] if @found == 1;
 }
 
 sub resolve_upstream_version ($$) {