Skip to content

Commit 0812464

Browse files
dschoGit for Windows Build Agent
authored andcommitted
fixup! Add config option windows.appendAtomically
We need to be very careful _not_ to read the config too early. The reason is that some Git commands want to delay reading the config until they configured something beforehand. For example, `cmd_commit()` sets the `warn_on_auto_comment_char = true` before reading the config, implicitly telling the function `check_auto_comment_char_config()` to warn (once) when encountering the corresponding, deprecated construct. If `mingw_open()` reads the config already at the point when the gitdir is discovered, i.e. way before `cmd_commit()` can do its thing, that global flag will still be `false` when the warning should be produced. Earlier, we already had to fiddle with the condition, to ensure that the commondir is already initialized (and therefore it should be safe to read the config). That was still not enough, apparently. The symptom is that both t3404.86 (rebase -i respects core.commentchar=auto) and t7502.85 (core.commentChar=auto is rejected) will fail. The good news is that the config setting we want to read in `mingw_open()` concerns itself with _appending to files_, something we will never do before reaching `cmd_commit()`. Therefore, simply extending the guard around config reading makes this logic "delayed enough" so that aforementioned test cases pass successfully. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 6c33db9 commit 0812464

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

compat/mingw.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,7 @@ int mingw_open (const char *filename, int oflags, ...)
942942
* Only set append_atomically to default value(1) when repo is initialized
943943
* and fail to get config value
944944
*/
945-
if (append_atomically < 0 && the_repository && the_repository->commondir &&
945+
if ((oflags & O_APPEND) && append_atomically < 0 && the_repository && the_repository->commondir &&
946946
repo_config_get_bool(the_repository, "windows.appendatomically", &append_atomically))
947947
append_atomically = 1;
948948

0 commit comments

Comments
 (0)