Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH 10/19] reset --keep: only write index file once

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:55:42

Martin von Zweigbergk [off-list ref] writes:
"git reset --keep" calls reset_index_file() twice, first doing a
two-way merge to the target revision, updating the index and worktree,
and then resetting the index. After each call, we write the index
file.

In the unlikely event that the second call to reset_index_file()
fails, the index will have been merged to the target revision, but
HEAD will not be updated, leaving the user with a dirty index.

By moving the locking, writing and committing out of
reset_index_file() and into the caller, we can avoid writing the index
twice, thereby making the sure we don't end up in the half-way reset
state.
Nice.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help