"martin f. krafft" <madduck@xxxxxxxxxxx> writes: > git-sh-setup might set GIT_DIR, but not export it. When git-pull, for > instance, calls cd_to_toplevel, it changes the working directory, and later > calls git-ls-files, which does *not* inherit GIT_DIR since it's not imported. "Not exporting GIT_DIR" was very much deliberately done when git-sh-setup was introduced, and it is caller(includer)'s responsibility to export GIT_DIR when necessary. Depending on callers, some did not want to export GIT_DIR, because exporting GIT_DIR means a bit more than that you are at the toplevel of the tree (e.g. it tells the command not to do the usual discovery of .git directory) and they have places in their codepath they cannot cd up when running a git command internally, and/or they do not want to cd up but they know what they run does GIT_DIR discovery on their own. I do not recall which exact callers they were, though. Do people recall the details? Many scripted Porcelains were rewritten in C, and the need to be careful and selective about when to export and when not to export might have been removed already in which case it would be Ok to solve whatever you are trying to solve like this patch does, but this change needs very careful vetting to make sure that you did not break other scripts with this change. This arrangement predates separate work-tree by many months. It could be that what needs fixing is the separate work-tree code. In any case, this patch is a bit worrying. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html