chiark / gitweb /
Dgit.pm: resolve_upstream_version: Report tag, where sensible
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 17 Jul 2019 02:16:29 +0000 (03:16 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 17 Jul 2019 02:25:44 +0000 (03:25 +0100)
This affect what is show in commit messages (including the parseable
parts) made by dgit and git-debrebase.  Now they prefer to refer to
the tag name if the caller specified refs/tags/ and the tag name is
a nice one.

This is not expected to make much difference for human callers (who
will probably not explicitly qualify their tag refs).  But it will
make a difference for scripts.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Debian/Dgit.pm

index a5030df78c86b1cc0e562454040505accc4a7079..9c1a08e7e28641661833e0bf1d1dd080c72664ac 100644 (file)
@@ -656,7 +656,10 @@ sub resolve_upstream_version ($$) {
        }
        $used = $tried[-1];
        $message = f_ 'using upstream from git tag %s', $used;
-    }
+    } elsif ($new_upstream =~ m{^refs/tags/($versiontag_re)$}s) {
+       $message = f_ 'using upstream from git tag %s', $1;
+       $used = $1;
+    }  
     $new_upstream = git_rev_parse $new_upstream;
 
     return ($new_upstream, $used, $message);