提交 a7e66ae3 编写于 作者: M Matt Draisey 提交者: Junio C Hamano

[PATCH] Make do_each_ref() follow symlinks.

Because there is no reason not to, and this makes things a bit
safer when running "git prune".

[jc: I do not necessarily agree with the reasoning of the
original author that it is a good way to keep "git prune" from
stomping on objects to have a symlink that points at .git/refs
of the repository A in the .git/refs of the repository B when
repository A borrows object database from repository B.  For one
thing, the object database that everybody borrows objects from
may not even have its own .git/refs hierarchy.  Come to think of
it, maybe we should disallow symlink inside .git/refs hierarchy;
we update the files there by creat/rename pair, so having
symlinks would not work anyway when you do anything that would
update them.]
Signed-off-by: NJunio C Hamano <junkio@cox.net>
上级 abe05822
......@@ -46,7 +46,7 @@ static int do_for_each_ref(const char *base, int (*fn)(const char *path, const u
if (namelen > 255)
continue;
memcpy(path + baselen, de->d_name, namelen+1);
if (lstat(git_path("%s", path), &st) < 0)
if (stat(git_path("%s", path), &st) < 0)
continue;
if (S_ISDIR(st.st_mode)) {
retval = do_for_each_ref(path, fn);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册