diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2016-11-07 02:45:13 +0000 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2016-11-07 02:45:13 +0000 |
commit | 3d451b46246c091fc6fb91c65e119af9cb82243a (patch) | |
tree | 939d335d1369c37b6486b95992d9dea8d39f31ec | |
parent | e29b49fdc614b9a8dfd668dc42e40d87cd381df4 (diff) |
dgit: fetch_from_archive: Break out _record_1 and _2.
We are going to want to reuse these bits of the fetch finishing-up.
No functional change right now.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
-rwxr-xr-x | dgit | 30 |
1 files changed, 20 insertions, 10 deletions
@@ -2650,6 +2650,24 @@ sub mergeinfo_version ($) { return getfield( (mergeinfo_getclogp $_[0]), 'Version' ); } +sub fetch_from_archive_record_1 ($) { + my ($hash) = @_; + runcmd @git, qw(update-ref -m), "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); + if (act_local()) { + cmdoutput @upd_cmd; + } else { + dryrun_report @upd_cmd; + } +} + sub fetch_from_archive () { ensure_setup_existing_tree(); @@ -2963,10 +2981,7 @@ END if $lastpush_hash; $chkff->($lastfetch_hash, 'local tracking tip (last fetch)'); - runcmd @git, qw(update-ref -m), "dgit fetch $csuite", - 'DGIT_ARCHIVE', $hash; - cmdoutput @git, qw(log -n2), $hash; - # ... gives git a chance to complain if our commit is malformed + fetch_from_archive_record_1($hash); if (defined $skew_warning_vsn) { mkpath '.git/dgit'; @@ -2986,12 +3001,7 @@ END } if ($lastfetch_hash ne $hash) { - my @upd_cmd = (@git, qw(update-ref -m), 'dgit fetch', lrref(), $hash); - if (act_local()) { - cmdoutput @upd_cmd; - } else { - dryrun_report @upd_cmd; - } + fetch_from_archive_record_2($hash); } lrfetchref_used lrfetchref(); |