chiark / gitweb /
git-debrebase: resolve_upstream_version: Return $used too
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 1 Mar 2019 18:19:06 +0000 (18:19 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 1 Mar 2019 20:35:22 +0000 (20:35 +0000)
Update both callers but right now they just throw the information
away.  So no overall functional change.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
git-debrebase

index 829ab82..20e5728 100755 (executable)
@@ -2008,6 +2008,7 @@ sub upstream_commitish_search ($$) {
 sub resolve_upstream_version ($$) {
     my ($new_upstream, $upstream_version) = @_;
 
+    my $used = $new_upstream;
     if (!defined $new_upstream) {
        my @tried;
        $new_upstream = upstream_commitish_search $upstream_version, \@tried;
@@ -2018,10 +2019,12 @@ sub resolve_upstream_version ($$) {
                " Check version, and specify upstream commitish explicitly.",
                "@tried";
        }
+       $used = $tried[-1];
     }
     $new_upstream = git_rev_parse $new_upstream;
 
-    return $new_upstream;
+    return ($new_upstream, $used);
+    # used is a human-readable idea of what we found
 }
 
 sub cmd_new_upstream () {
@@ -2043,7 +2046,8 @@ sub cmd_new_upstream () {
 
     my $new_upstream = shift @ARGV;
     my $new_upstream_version = upstreamversion  $new_version;
-    $new_upstream =
+    my $new_upstream_used;
+    ($new_upstream, $new_upstream_used) =
        resolve_upstream_version $new_upstream, $new_upstream_version;
 
     record_ffq_auto();
@@ -2549,7 +2553,7 @@ sub cmd_convert_from_gbp () {
     my ($upstream_spec) = @ARGV;
 
     my $upstream_version = upstreamversion $version;
-    my $upstream =
+    my ($upstream, $upstream_used) =
        resolve_upstream_version($upstream_spec, $upstream_version);
 
     my ($old_head, $gdrlastinfo) = begin_convert_from();