mirror of
https://github.com/git/git.git
synced 2026-08-10 17:15:14 +00:00
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
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user