summaryrefslogtreecommitdiff
path: root/builtin/commit.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-02-05 22:54:11 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-02-05 22:54:11 (GMT)
commitda07df3ee3ff8c9d676db6be04a76ead1d9919d8 (patch)
treeac1af8bb8c69573847fb454fd6c603ab7e1ee674 /builtin/commit.c
parent9496acc1449e3e536f50eed081df0702b54cf0a8 (diff)
parentea56518dfe4c7934a6895f25edf0f18d2930e4fd (diff)
downloadgit-da07df3ee3ff8c9d676db6be04a76ead1d9919d8.zip
git-da07df3ee3ff8c9d676db6be04a76ead1d9919d8.tar.gz
git-da07df3ee3ff8c9d676db6be04a76ead1d9919d8.tar.bz2
Merge branch 'js/fopen-harder' into maint
Some codepaths used fopen(3) when opening a fixed path in $GIT_DIR (e.g. COMMIT_EDITMSG) that is meant to be left after the command is done. This however did not work well if the repository is set to be shared with core.sharedRepository and the umask of the previous user is tighter. They have been made to work better by calling unlink(2) and retrying after fopen(3) fails with EPERM. * js/fopen-harder: Handle more file writes correctly in shared repos commit: allow editing the commit message even in shared repos
Diffstat (limited to 'builtin/commit.c')
-rw-r--r--builtin/commit.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/commit.c b/builtin/commit.c
index d054f84..89bf6ad 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -761,7 +761,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
hook_arg2 = "";
}
- s->fp = fopen(git_path(commit_editmsg), "w");
+ s->fp = fopen_for_writing(git_path(commit_editmsg));
if (s->fp == NULL)
die_errno(_("could not open '%s'"), git_path(commit_editmsg));