summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c976d41)
raw | patch | inline | side by side (parent: c976d41)
author | Lars Hjemli <hjemli@gmail.com> | |
Wed, 29 Nov 2006 20:44:56 +0000 (21:44 +0100) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Wed, 6 Dec 2006 07:50:57 +0000 (23:50 -0800) |
The current check for symlinked reflogs was based on stat(2), which is
utterly embarrassing.
Fix it, and add a matching testcase.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
utterly embarrassing.
Fix it, and add a matching testcase.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
refs.c | patch | blob | history | |
t/t3200-branch.sh | patch | blob | history |
index cdedb45f00d2a9c379b5cfbf78086f8d2f9eaba1..c23561e1582980e01c827540de0e0a43bf2547d3 100644 (file)
--- a/refs.c
+++ b/refs.c
struct ref_lock *lock;
char msg[PATH_MAX*2 + 100];
struct stat loginfo;
- int log = !stat(git_path("logs/%s", oldref), &loginfo);
+ int log = !lstat(git_path("logs/%s", oldref), &loginfo);
if (S_ISLNK(loginfo.st_mode))
return error("reflog for %s is a symlink", oldref);
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index afaa8536a9342d6597e82dc8b96ad8b9becafad6..5782c30b03a7e7bb7d244d305e13e856eed40a89 100755 (executable)
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
git-branch -m s/s s &&
test -f .git/logs/refs/heads/s'
+test_expect_failure \
+ 'git-branch -m u v should fail when the reflog for u is a symlink' \
+ 'git-branch -l u &&
+ mv .git/logs/refs/heads/u real-u &&
+ ln -s real-u .git/logs/refs/heads/u &&
+ git-branch -m u v'
+
test_done