path: root/dgit
diff options
authorIan Jackson <>2018-06-21 01:00:41 +0100
committerIan Jackson <>2018-06-21 01:11:11 +0100
commit1967603885cd0fe76230fdfa9c026238da6c12a9 (patch)
treee54fa0b263aa27386033012b7070ff5569c94fcc /dgit
parenta57e3b1aaf62ca5d28b4e65fdaf46340067b5748 (diff)
dgit: Non-noop git fetch is not available with --dry-run, so fail
When fetch or push wants git fetch (other than in a situation where it happes to be a noop) but --dry-run was specified, we would loop with a false coplaint about git fetch. False, because we didn't actually run git fetch so of course it didn't do anything. Instead, fail with an explanation. Closes:#871317. This does not occur, and we do not fail, if git-fetch would be a no-op. We can tell when this is the case, because we use git-ls-remote too. This leads to one suggestion for a workaround for the user, which is to do a not --dry-run fetch first. Signed-off-by: Ian Jackson <>
Diffstat (limited to 'dgit')
1 files changed, 5 insertions, 0 deletions
diff --git a/dgit b/dgit
index 961d974..3409e18 100755
--- a/dgit
+++ b/dgit
@@ -2757,6 +2757,11 @@ END
my $want = $wantr{$rrefname};
next if $got eq $want;
if (!defined $objgot{$want}) {
+ fail <<END unless act_local();
+--dry-run specified but we actually wanted the results of git fetch,
+so this is not going to work. Try running dgit fetch first,
+or using --damp-run instead of --dry-run.
print STDERR <<END;
warning: git ls-remote suggests we want $lrefname
warning: and it should refer to $want