Merge branch 'tg/fetch-prune-exit-code-fix'

When "git fetch --prune" failed to prune the refs it wanted to
prune, the command issued error messages but exited with exit
status 0, which has been corrected.

* tg/fetch-prune-exit-code-fix:
  fetch --prune: exit with error if pruning fails
This commit is contained in:
Junio C Hamano
2022-02-11 16:56:01 -08:00
2 changed files with 17 additions and 4 deletions

View File

@ -1610,12 +1610,14 @@ static int do_fetch(struct transport *transport,
* don't care whether --tags was specified.
*/
if (rs->nr) {
prune_refs(rs, ref_map, transport->url);
retcode = prune_refs(rs, ref_map, transport->url);
} else {
prune_refs(&transport->remote->fetch,
ref_map,
transport->url);
retcode = prune_refs(&transport->remote->fetch,
ref_map,
transport->url);
}
if (retcode != 0)
retcode = 1;
}
if (fetch_and_consume_refs(transport, ref_map, worktrees)) {
free_refs(ref_map);