Commit b74c90f
read_cache: roll back lock in
`update_index_if_able()` used to always commit the lock or roll it back.
Commit 03b8664 (read-cache: new API write_locked_index instead of
write_index/write_cache, 2014-06-13) stopped rolling it back in case a
write was not even attempted. This change in behavior is not motivated
in the commit message and appears to be accidental: the `else`-path was
removed, although that changed the behavior in case the `if` shortcuts.
Reintroduce the rollback and document this behavior. While at it, move
the documentation on this function from the function definition to the
function declaration in cache.h.
If `write_locked_index(..., COMMIT_LOCK)` fails, it will roll back the
lock for us (see the previous commit).
Noticed-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>update_index_if_able()
1 parent df60cf5 commit b74c90f
2 files changed
+6
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
734 | 734 | | |
735 | 735 | | |
736 | 736 | | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
737 | 741 | | |
738 | 742 | | |
739 | 743 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2176 | 2176 | | |
2177 | 2177 | | |
2178 | 2178 | | |
2179 | | - | |
2180 | | - | |
2181 | | - | |
2182 | 2179 | | |
2183 | 2180 | | |
2184 | 2181 | | |
2185 | 2182 | | |
2186 | 2183 | | |
| 2184 | + | |
| 2185 | + | |
2187 | 2186 | | |
2188 | 2187 | | |
2189 | 2188 | | |
| |||
0 commit comments