ls-files: --others should not say unmerged paths are unknown.
[gitweb.git] / refs.c
diff --git a/refs.c b/refs.c
index 97506a4ebdfbd164abad6be76d7160db171d9148..a52b038eefdf22fce20d1a81180c97def0613cdb 100644 (file)
--- a/refs.c
+++ b/refs.c
@@ -116,14 +116,17 @@ const char *resolve_ref(const char *path, unsigned char *sha1, int reading)
 
 int create_symref(const char *git_HEAD, const char *refs_heads_master)
 {
-#if USE_SYMLINK_HEAD
-       unlink(git_HEAD);
-       return symlink(refs_heads_master, git_HEAD);
-#else
        const char *lockpath;
        char ref[1000];
        int fd, len, written;
 
+#if USE_SYMLINK_HEAD
+       unlink(git_HEAD);
+       if (!symlink(refs_heads_master, git_HEAD))
+               return 0;
+       fprintf(stderr, "no symlink - falling back to symbolic ref\n");
+#endif
+
        len = snprintf(ref, sizeof(ref), "ref: %s\n", refs_heads_master);
        if (sizeof(ref) <= len) {
                error("refname too long: %s", refs_heads_master);
@@ -144,7 +147,6 @@ int create_symref(const char *git_HEAD, const char *refs_heads_master)
                return -3;
        }
        return 0;
-#endif
 }
 
 int read_ref(const char *filename, unsigned char *sha1)