summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2018-06-26 18:25:13 +0100
committerIan Jackson <ijackson@chiark.greenend.org.uk>2018-06-26 19:20:52 +0100
commit11c8c965c3419fddf2444a7497b45b65f05d3db5 (patch)
tree41657d3be31ab8fe808b040834a1dda42db6173d
parent3c2fdc3b9e35352aabbc8b09c286aba2fbfab2ac (diff)
ref updates: Introduce update_ref_cmd
Currently the comment about `message may be modified' is rather misleading, since there is no code to do that - but it explains the semantics of the new function. We change the appropriate subset of the git update-ref call sites. These are precisely the ones where we previously specified a message with -m, except for the quilt cache (where we use the reflog message as the cache lookup key). The calls are updates of internal refs etc. We end up using qw(git) rather than @git. Otherwise no functional change. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
-rw-r--r--Debian/Dgit.pm9
-rwxr-xr-xdgit13
-rwxr-xr-xgit-debrebase2
3 files changed, 15 insertions, 9 deletions
diff --git a/Debian/Dgit.pm b/Debian/Dgit.pm
index 57b79e8..2bac485 100644
--- a/Debian/Dgit.pm
+++ b/Debian/Dgit.pm
@@ -51,7 +51,7 @@ BEGIN {
git_rev_parse git_cat_file
git_get_ref git_get_symref git_for_each_ref
git_for_each_tag_referring is_fast_fwd
- git_check_unmodified
+ git_check_unmodified git_update_ref_cmd
$package_re $component_re $deliberately_re
$distro_re $versiontag_re $series_filename_re
$extra_orig_namepart_re
@@ -492,6 +492,13 @@ sub is_fast_fwd ($$) {
}
}
+sub git_update_ref_cmd {
+ # returns qw(git update-ref), qw(-m), @_
+ # except that message may be modified to honour GIT_REFLOG_ACTION
+ my $msg = shift @_;
+ return qw(git update-ref -m), $msg, @_;
+}
+
sub changedir ($) {
my ($newdir) = @_;
printdebug "CD $newdir\n";
diff --git a/dgit b/dgit
index 5c9cdc3..bbfaea1 100755
--- a/dgit
+++ b/dgit
@@ -2851,15 +2851,14 @@ sub mergeinfo_version ($) {
sub fetch_from_archive_record_1 ($) {
my ($hash) = @_;
- runcmd @git, qw(update-ref -m), "dgit fetch $csuite",
- 'DGIT_ARCHIVE', $hash;
+ runcmd git_update_ref_cmd "dgit fetch $csuite", 'DGIT_ARCHIVE', $hash;
cmdoutput @git, qw(log -n2), $hash;
# ... gives git a chance to complain if our commit is malformed
}
sub fetch_from_archive_record_2 ($) {
my ($hash) = @_;
- my @upd_cmd = (@git, qw(update-ref -m), 'dgit fetch', lrref(), $hash);
+ my @upd_cmd = (git_update_ref_cmd 'dgit fetch', lrref(), $hash);
if (act_local()) {
cmdoutput @upd_cmd;
} else {
@@ -3850,7 +3849,7 @@ sub maybe_split_brain_save ($$$) {
# => message fragment "$saved" describing disposition of $dgitview
return "commit id $dgitview" unless defined $split_brain_save;
my @cmd = (shell_cmd 'cd "$1"; shift', $maindir,
- @git, qw(update-ref -m),
+ git_update_ref_cmd
"dgit --dgit-view-save $msg HEAD=$headref",
$split_brain_save, $dgitview);
runcmd @cmd;
@@ -4050,7 +4049,7 @@ sub plain_overwrite_pseudomerge ($$$) {
$clogp, $head, $archive_hash, $i_arch_v,
"dgit", $m;
- runcmd @git, qw(update-ref -m), $m, 'HEAD', $r, $head;
+ runcmd git_update_ref_cmd $m, 'HEAD', $r, $head;
progress "Make pseudo-merge of $i_arch_v->[0] into your HEAD.";
return $r;
@@ -4496,7 +4495,7 @@ END
runcmd_ordryrun @git,
qw(-c push.followTags=false push), access_giturl(), @pushrefs;
- runcmd_ordryrun @git, qw(update-ref -m), 'dgit push', lrref(), $dgithead;
+ runcmd_ordryrun git_update_ref_cmd 'dgit push', lrref(), $dgithead;
supplementary_message(<<'END');
Push failed, while obtaining signatures on the .changes and .dsc.
@@ -6437,7 +6436,7 @@ sub cmd_quilt_fixup {
sub import_dsc_result {
my ($dstref, $newhash, $what_log, $what_msg) = @_;
- my @cmd = (@git, qw(update-ref -m), $what_log, $dstref, $newhash);
+ my @cmd = (git_update_ref_cmd $what_log, $dstref, $newhash);
runcmd @cmd;
check_gitattrs($newhash, "source tree");
diff --git a/git-debrebase b/git-debrebase
index fd05c6b..fe11251 100755
--- a/git-debrebase
+++ b/git-debrebase
@@ -118,7 +118,7 @@ sub run_deferred_updates ($) {
confess 'dangerous internal error' unless all_snags_summarised();
- my @upd_cmd = (@git, qw(update-ref --stdin -m), "debrebase: $mrest");
+ my @upd_cmd = (git_update_ref_cmd "debrebase: $mrest", qw(--stdin));
debugcmd '>|', @upd_cmd;
open U, "|-", @upd_cmd or die $!;
foreach (@deferred_updates) {