git-revert with conflicts to behave as git-merge with conflicts
[gitweb.git] / refs.c
diff --git a/refs.c b/refs.c
index 305c1a92cca8e546a91b578df227212acc96279c..3d100df85c4ca9f2f54c22a5c771014a8ba10f38 100644 (file)
--- 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,7 +731,7 @@ 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));