From: Junio C Hamano Date: Fri, 23 Dec 2005 17:56:16 GMT Subject: Re: git-checkout and SUBDIRECTORY_OK='Yes' Message-ID: <7vwthv7l4v.fsf@assigned-by-dhcp.cox.net> In-Reply-To: <7virtge7fb.fsf@assigned-by-dhcp.cox.net> Junio C Hamano writes: > Jon Nelson writes: > >> Is it safe to set SUBDIRECTORY_OK='Yes' in git-checkout.sh? > This patch *might* work, or it may not... I've done some tests and it seems to work (it is in the proposed updates branch). In git.git working tree, here is what happens: $ git checkout pu ;# start from pu $ cd Documentation $ echo >>git-daemon.txt ;# smudge $ git checkout -- git-daemon.txt ;# restore $ git diff -r --name-status ;# no change $ git checkout master git-daemon.txt ;# pick from tree $ git diff master -r --name-status ;# (1) $ git diff -r --name-status ;# (2) $ git diff pu -r --name-status ;# (3) M Documentation/git-daemon.txt (1) does not show any because it did take the file out of master branch, and git-daemon.txt is the only file different under Documentation/ between master and pu. (2) does not show any because "checkout master git-daemon.txt" updated the path both in index and working tree. (3) shows the path indeed is different between master and pu. The change relies on ls-tree showing full paths regardless of where it gets started (because the output is fed to --index-info form of git-update-index). If we are going to take the "ls-tree prefix truncation" patch from Linus, either we also need to update "git-update-index --index-info" to match this.