Why does git-bisect have to be run from the top level directory of the working tree?

Looking at some commits in the project, I see one by Marcel M. Cary (marcel@oak.homeunix.org)

He says in a commit (it happens to be about git-pull but I think it is relevant)

“git pull” fails because POSIX shells have a notion of current working
directory that is different from getcwd(). The shell stores this path
in PWD. As a result, “cd ../” can be interpreted differently in a
shell script than chdir(“../”) in a C program. The shell interprets
“../” by essentially stripping the last textual path component from
PWD, whereas C chdir() follows the “..” link in the current directory
on the filesystem. When PWD is a symlink, these are different
destinations. As a result, Git’s C commands find the correct
top-level working tree, and shell scripts do not.

https://github.com/git/git/commit/08fc0608657ee91bc85276667804c36a93138c7d

SO I’d say part of the reason is because git-bisect is a shell script which can’t be trusted to find the toplevel on its own (when symlinks are involved).

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)