Re: [PATCH 09/11] read-cache: require flags for `write_locked_index()`

2017-10-02 Thread Martin Ågren
On 2 October 2017 at 06:14, Martin Ågren wrote: > On 2 October 2017 at 05:49, Junio C Hamano wrote: >> Martin Ågren writes: >> >>> ... Instead, require that one of the >>> flags is set. Adjust documentation and the assert we

Re: [PATCH 09/11] read-cache: require flags for `write_locked_index()`

2017-10-02 Thread Jeff King
On Sun, Oct 01, 2017 at 04:56:10PM +0200, Martin Ågren wrote: > `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,

Re: [PATCH 09/11] read-cache: require flags for `write_locked_index()`

2017-10-01 Thread Martin Ågren
On 2 October 2017 at 05:49, Junio C Hamano wrote: > Martin Ågren writes: > >> ... Instead, require that one of the >> flags is set. Adjust documentation and the assert we already have for >> checking that we don't have too many flags. Add a macro

Re: [PATCH 09/11] read-cache: require flags for `write_locked_index()`

2017-10-01 Thread Junio C Hamano
Martin Ågren writes: > ... Instead, require that one of the > flags is set. Adjust documentation and the assert we already have for > checking that we don't have too many flags. Add a macro `HAS_SINGLE_BIT` > (inspired by `HAS_MULTI_BITS`) to simplify this check and

[PATCH 09/11] read-cache: require flags for `write_locked_index()`

2017-10-01 Thread Martin Ågren
`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