]> git.ipfire.org Git - thirdparty/git.git/commitdiff
refs/files-backend: work around -Wunused-parameter
authorJunio C Hamano <gitster@pobox.com>
Fri, 30 Aug 2024 19:33:13 +0000 (12:33 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 30 Aug 2024 19:34:04 +0000 (12:34 -0700)
This is needed to build things with -Werror=unused-parameter on a
platform without symbolic link support.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs/files-backend.c

index 1cff65f6ae548b4f6a78b984a7ecc50c8e29969f..4c5573b19c96965c844e2ea7dad2abced7f1f9ec 100644 (file)
@@ -1946,10 +1946,13 @@ static int commit_ref_update(struct files_ref_store *refs,
        return 0;
 }
 
+#ifdef NO_SYMLINK_HEAD
+#define create_ref_symlink(a, b) (-1)
+#else
 static int create_ref_symlink(struct ref_lock *lock, const char *target)
 {
        int ret = -1;
-#ifndef NO_SYMLINK_HEAD
+
        char *ref_path = get_locked_file_path(&lock->lk);
        unlink(ref_path);
        ret = symlink(target, ref_path);
@@ -1957,9 +1960,9 @@ static int create_ref_symlink(struct ref_lock *lock, const char *target)
 
        if (ret)
                fprintf(stderr, "no symlink - falling back to symbolic ref\n");
-#endif
        return ret;
 }
+#endif
 
 static int create_symref_lock(struct ref_lock *lock, const char *target,
                              struct strbuf *err)