write_file(): drop "fatal" parameter
All callers except three passed 1 for the "fatal" parameter to ask this function to die upon error, but to a casual reader of the code, it was not all obvious what that 1 meant. Instead, split the function into two based on a common write_file_v() that takes the flag, introduce write_file_gently() as a new way to attempt creating a file without dying on error, and make three callers to call it. Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
2
setup.c
2
setup.c
@ -404,7 +404,7 @@ static void update_linked_gitdir(const char *gitfile, const char *gitdir)
|
||||
|
||||
strbuf_addf(&path, "%s/gitfile", gitdir);
|
||||
if (stat(path.buf, &st) || st.st_mtime + 24 * 3600 < time(NULL))
|
||||
write_file(path.buf, 0, "%s\n", gitfile);
|
||||
write_file_gently(path.buf, "%s\n", gitfile);
|
||||
strbuf_release(&path);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user