Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/refs.c b/refs.c
index d7f4aa5d87..f003a0b108 100644
--- a/refs.c
+++ b/refs.c
@@ -721,7 +721,8 @@ static int log_ref_write(struct ref_lock *lock,
char *logrec;
const char *committer;
- if (log_all_ref_updates) {
+ if (log_all_ref_updates &&
+ !strncmp(lock->ref_name, "refs/heads/", 11)) {
if (safe_create_leading_directories(lock->log_file) < 0)
return error("unable to create directory for %s",
lock->log_file);
@@ -730,10 +731,20 @@ static int log_ref_write(struct ref_lock *lock,
logfd = open(lock->log_file, oflags, 0666);
if (logfd < 0) {
- if (!log_all_ref_updates && errno == ENOENT)
+ if (!(oflags & O_CREAT) && errno == ENOENT)
return 0;
- return error("Unable to append to %s: %s",
- lock->log_file, strerror(errno));
+
+ if ((oflags & O_CREAT) && errno == EISDIR) {
+ if (remove_empty_directories(lock->log_file)) {
+ return error("There are still logs under '%s'",
+ lock->log_file);
+ }
+ logfd = open(lock->log_file, oflags, 0666);
+ }
+
+ if (logfd < 0)
+ return error("Unable to append to %s: %s",
+ lock->log_file, strerror(errno));
}
committer = git_committer_info(1);