Skip to content

Commit

Permalink
refs/files-backend: work around -Wunused-parameter
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
gitster committed Aug 30, 2024
1 parent 4590f2e commit ab8bcd2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions refs/files-backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -1946,20 +1946,23 @@ 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);
free(ref_path);

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)
Expand Down

0 comments on commit ab8bcd2

Please sign in to comment.