chiark / gitweb /
Dgit::upstream_commitish_search: fail if more than one tag exists
[dgit.git] / 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 ($$) {