Skip to content

Commit 450d4c0

Browse files
Miklos Vajnagitster
authored andcommitted
rename_ref(): handle the case when the reflog of a ref does not exist
We tried to check if a reflog of a ref is a symlink without first checking if it exists, which is a bug. Signed-off-by: Miklos Vajna <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent eca35a2 commit 450d4c0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

refs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -966,7 +966,7 @@ int rename_ref(const char *oldref, const char *newref, const char *logmsg)
966966
const char *symref = NULL;
967967
int is_symref = 0;
968968

969-
if (S_ISLNK(loginfo.st_mode))
969+
if (log && S_ISLNK(loginfo.st_mode))
970970
return error("reflog for %s is a symlink", oldref);
971971

972972
symref = resolve_ref(oldref, orig_sha1, 1, &flag);

0 commit comments

Comments
 (0)