chiark / gitweb /
Move git_rev_parse into Dgit.pm (renaming it from rev_parse
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 17 May 2015 13:45:39 +0000 (14:45 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 31 May 2015 10:54:15 +0000 (11:54 +0100)
Debian/Dgit.pm
dgit

index 00b4aa5..2c9c9f9 100644 (file)
@@ -18,7 +18,7 @@ BEGIN {
     @EXPORT      = qw(debiantag server_branch server_ref
                       stat_exists fail waitstatusmsg failedcmd
                       cmdoutput cmdoutput_errok
-                      git_for_each_ref
+                      git_rev_parse git_for_each_ref
                       git_for_each_tag_referring
                       $package_re $component_re $deliberately_re
                       $branchprefix
@@ -177,6 +177,10 @@ sub cmdoutput {
     return $d;
 }
 
+sub git_rev_parse ($) {
+    return cmdoutput qw(git rev-parse), "$_[0]~0";
+}
+
 sub git_for_each_ref ($$) {
     my ($pattern,$func) = @_;
     # calls $func->($objid,$objtype,$fullrefname,$reftail);
diff --git a/dgit b/dgit
index 4f0329a..c6a3596 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -1271,16 +1271,12 @@ sub ensure_we_have_orig () {
     }
 }
 
-sub rev_parse ($) {
-    return cmdoutput @git, qw(rev-parse), "$_[0]~0";
-}
-
 sub is_fast_fwd ($$) {
     my ($ancestor,$child) = @_;
     my @cmd = (@git, qw(merge-base), $ancestor, $child);
     my $mb = cmdoutput_errok @cmd;
     if (defined $mb) {
-       return rev_parse($mb) eq rev_parse($ancestor);
+       return git_rev_parse($mb) eq git_rev_parse($ancestor);
     } else {
        $?==256 or failedcmd @cmd;
        return 0;
@@ -1658,7 +1654,7 @@ sub dopush ($) {
 #    runcmd @git, qw(fetch -p ), "$alioth_git/$package.git",
 #        map { lref($_).":".rref($_) }
 #        (uploadbranch());
-    my $head = rev_parse('HEAD');
+    my $head = git_rev_parse('HEAD');
     if (!$changesfile) {
        my $multi = "$buildproductsdir/".
            "${package}_".(stripepoch $cversion)."_multi.changes";
@@ -2403,7 +2399,7 @@ sub build_maybe_quilt_fixup () {
     #     6. Back in the main tree, fast forward to the new HEAD
 
     my $clogp = parsechangelog();
-    my $headref = rev_parse('HEAD');
+    my $headref = git_rev_parse('HEAD');
 
     prep_ud();
     changedir $ud;