Files
git/builtin
Martin Ågren 812d6b0075 read-cache: drop explicit CLOSE_LOCK-flag
`write_locked_index()` takes two flags: `COMMIT_LOCK` and `CLOSE_LOCK`.
At most one is allowed. But it is also possible to use no flag, i.e.,
`0`. But when `write_locked_index()` calls `do_write_index()`, the
temporary file, a.k.a. the lockfile, will be closed. So passing `0` is
effectively the same as `CLOSE_LOCK`, which seems like a bug.

We might feel tempted to restructure the code in order to close the file
later, or conditionally. It also feels a bit unfortunate that we simply
"happen" to close the lock by way of an implementation detail of
lockfiles. But note that we need to close the temporary file before
`stat`-ing it, at least on Windows. See 9f41c7a6b (read-cache: close
index.lock in do_write_index, 2017-04-26).

Drop `CLOSE_LOCK` and make it explicit that `write_locked_index()`
always closes the lock. Whether it is also committed is governed by the
remaining flag, `COMMIT_LOCK`.

This means we neither have nor suggest that we have a mode to write the
index and leave the file open. Whatever extra contents we might
eventually want to write, we should probably write it from within
`write_locked_index()` itself anyway.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-10-07 10:20:56 +09:00
..
2017-10-06 10:07:18 +09:00
2017-10-06 10:07:18 +09:00
2016-11-22 13:55:20 -08:00
2017-09-06 13:11:25 +09:00
2017-09-28 14:47:53 +09:00
2017-06-24 14:28:41 -07:00
2017-10-06 10:07:17 +09:00
2017-09-29 11:23:43 +09:00
2017-03-31 08:33:56 -07:00
2017-08-26 22:55:09 -07:00
2017-09-29 11:23:43 +09:00
2017-09-25 15:24:09 +09:00
2017-09-25 15:24:07 +09:00
2017-06-24 14:28:41 -07:00
2017-06-24 14:28:41 -07:00
2017-09-19 10:47:57 +09:00
2017-08-03 13:11:02 -07:00
2017-09-19 10:47:52 +09:00
2017-08-26 22:55:09 -07:00
2017-08-22 10:29:03 -07:00
2017-06-24 14:28:41 -07:00
2017-09-19 10:47:55 +09:00
2017-08-03 13:11:02 -07:00
2017-08-22 10:29:03 -07:00
2017-01-23 18:51:56 -08:00
2017-09-19 10:47:55 +09:00
2017-06-24 14:28:41 -07:00