git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git-checkout and SUBDIRECTORY_OK='Yes'

From
Junio C Hamano <junkio@cox.net>
Date
Dec 23, 2005, 17:56 UTC
Message-ID
<7vwthv7l4v.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<7virtge7fb.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <junkio@cox.net> writes:
> Jon Nelson <jnelson-git@jamponi.net> 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.

Previous: Junio C Hamano
Message 3 of 3 in “git-checkout and SUBDIRECTORY_OK='Yes'”
  1. Jon NelsonDec 23, 2005
  2. Junio C HamanoDec 23, 2005
  3. Junio C HamanoDec 23, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.