diff options
author | Taylor Blau <me@ttaylorr.com> | 2022-11-19 02:43:10 +0300 |
---|---|---|
committer | Taylor Blau <me@ttaylorr.com> | 2022-11-19 02:43:11 +0300 |
commit | 35dc2cf03fdb5de830f2194d86b0eea8367ed1e4 (patch) | |
tree | 9feefd2c5459d7a00a8772f4400288734ec9caee /sequencer.c | |
parent | ad9096881d451bdb56d713a4c7d271dda3662cb2 (diff) | |
parent | 44da9e08413ec6a579ce4238acf1937b333836fe (diff) |
Merge branch 'vd/update-refs-delete'
`git rebase --update-refs` would delete references when all `update-ref`
commands in the sequencer were removed, which has been corrected.
* vd/update-refs-delete:
rebase --update-refs: avoid unintended ref deletion
Diffstat (limited to 'sequencer.c')
-rw-r--r-- | sequencer.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sequencer.c b/sequencer.c index f0f1af4d47..edb01643e1 100644 --- a/sequencer.c +++ b/sequencer.c @@ -4128,11 +4128,14 @@ static int write_update_refs_state(struct string_list *refs_to_oids) struct string_list_item *item; char *path; - if (!refs_to_oids->nr) - return 0; - path = rebase_path_update_refs(the_repository->gitdir); + if (!refs_to_oids->nr) { + if (unlink(path) && errno != ENOENT) + result = error_errno(_("could not unlink: %s"), path); + goto cleanup; + } + if (safe_create_leading_directories(path)) { result = error(_("unable to create leading directories of %s"), path); |