From: Junio C Hamano Date: Sat, 26 Nov 2005 10:59:51 GMT Subject: Re: [PATCH 0/8] Make C-level operable from subdirectories Message-ID: <7vzmnr1xp4.fsf@assigned-by-dhcp.cox.net> In-Reply-To: <7voe477n4i.fsf_-_@assigned-by-dhcp.cox.net> Junio C Hamano writes: > Linus Torvalds writes: > >> On Fri, 25 Nov 2005, Junio C Hamano wrote: >>> >>> I once advocated for an environment to name the top of working >>> tree directory --- it might make sense to resurrect that one. >> >> Please don't. >> >> We should just make the scripts do it automatically instead. > > Here comes an 8-patch series. > > [PATCH 1/8] git-apply: work from subdirectory. > [PATCH 2/8] peek-remote: honor proxy config even from subdirectory. > [PATCH 3/8] fsck-objects: work from subdirectory. > [PATCH 4/8] checkout-index: work from subdirectory. > [PATCH 5/8] hash-object: work within subdirectory. > [PATCH 6/8] ls-tree: work from subdirectory. > [PATCH 7/8] Make networking commands to work from a subdirectory. > [PATCH 8/8] Make the rest of commands work from a subdirectory. In case it was not obvious,... I think your GIT_DIR=`git-rev-parse --git-dir` patch would make things work better on top of these changes, while making many of them silently do funny things as you warned. For example, among the ones I mentioned in my previous message: - git-checkout with or without -b to switch branches work. This is because "git-read-tree -u" is not constrained by the current directory and operates on the whole working tree. - git-checkout ... works as expected. It takes cwd relative paths and updates the index and working tree for only specified paths from the named ent. - git-checkout -f works in a confusing way; only the files under the current directory is updated. This is because "git-checkout-index -a" behaves that way. git-checkout -f to revert to the current HEAD is probably good to work this way, but doing this while switching branches is too confusing. - git-reset --hard also works in a funny way. It leaves paths outside the current directory intact, because ls-tree reports only the files in the current directory while ls-files reports all. - git-prune works. git-tag works as before. It could be argued that it was a mistake that [PATCH 4/8] and [PATCH 6/8] changed checkout-index and ls-tree to limit their scope to the current directory, but that is consistent with what rev-list (log and whatchanged) and diff do, and might be debatably useful. Which suggests that things like git-checkout and git-reset whose normal mode of operation should be whole-tree should chdir up and do the path prefixing to convert original cwd relative paths to repository relative.