mirror of
https://github.com/git/git.git
synced 2026-04-12 01:40:10 +02:00
commit: allow editing the commit message even in shared repos
It was pointed out by Yaroslav Halchenko that the file containing the commit message is writable only by the owner, which means that we have to rewrite it from scratch in a shared repository. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
833e48259e
commit
79d7582e32
13
wrapper.c
13
wrapper.c
@@ -375,6 +375,19 @@ FILE *xfdopen(int fd, const char *mode)
|
||||
return stream;
|
||||
}
|
||||
|
||||
FILE *fopen_for_writing(const char *path)
|
||||
{
|
||||
FILE *ret = fopen(path, "w");
|
||||
|
||||
if (!ret && errno == EPERM) {
|
||||
if (!unlink(path))
|
||||
ret = fopen(path, "w");
|
||||
else
|
||||
errno = EPERM;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int xmkstemp(char *template)
|
||||
{
|
||||
int fd;
|
||||
|
||||
Reference in New Issue
Block a user