Re: Sparse checkout not working as expected (colons in filenames on Windows)
- From
Philip Oakley <philipoakley@iee.org>
- Date
- Mar 24, 2015, 23:43 UTC
- Message-ID
- <90D5D4B5F2ED41A6AB07E291004AA615@PhilipOakley>
- In-Reply-To
- <CACsJy8BOuhohQzaGzD+4cthqOaL4sz1ADRD-ekhFhKt4wMcg7A@mail.gmail.com>
From: "Duy Nguyen" <pclouds@gmail.com>
Show 60 quoted lines
> On Fri, Mar 20, 2015 at 6:07 AM, Philip Oakley <philipoakley@iee.org> > wrote: >> Hi, I was expecting that sparse checkout could be used to avoid the >> checking >> out, by git, of files which have colons in their name into the >> worktree when >> on Windows. >> >> Yue Lin Ho reported on the Msygit list [1] that he had a repo where >> there >> was already committed a file with a colon in it's name, which was a >> needed >> file and had been committed by a Linux user. The problem was how to >> work >> with that repo on a Windows box where such a file is prohibited to >> exist on >> the FS (hence the expectation that a sparse checkout would suffice). >> Yue has >> created a short test repo [2] >> >> Even after getting the pathspec escaping right, I still haven't been >> able to >> make this expected behaviour work [3]. >> >> Am I wrong to expect that sparse checkout (and the skip-worktree bit) >> can be >> used to avoid files with undesirable filenames hitting the OS's file >> system? >> >> If it should be OK, what's the correct recipe? >> >> -- >> Philip >> >> [1] >> https://groups.google.com/forum/?hl=en_US?hl%3Den#!topic/msysgit/D4HcHRpxPgU >> "How to play around with the filename with colon on Windows?" >> [2] Test repo https://github.com/t-pascal/tortoisegit-colons >> >> [3] test sequence:: >> $ mkdir colons && cd colons >> $ git clone -n https://github.com/t-pascal/tortoisegit-colons >> $ cd tortoisegit-colons/ >> $ git config core.sparseCheckout true >> $ cat .git/info/sparse-checkout # external editor >> /* >> !ifcfg-eth0\:0 > > Colons have no special meaning in gitignore rules and therefore need > not be escaped. The backslash is considered a literal character in > this case, probably not what you want. > >> $ git update-index --skip-worktree -- ifcfg-eth0\:0 >> Ignoring path ifcfg-eth0:0 >> $ git checkout -b test 7f35d34bc6160cc # tip commit, we are still >> unborn! >> error: Invalid path 'ifcfg-eth0:0 >> D ifcfg-eth0:0 >> Switched to a new branch 'test' > --
I've corrected the sparse-checkout, but won't the command line 'git update-index --skip-worktree' will still need it? (demo commands below)
That said, the final error (which I'd missed in the earlier post) is: fatal: make_cache_entry failed for path 'ifcfg-eth0:0'
This is on the Windows (pre-compiled msysgit at v1.9.5) Git bash, so could be a catch path in that code for make_cache_entry (I've not checked the code yet). So at the moment it doesn't look like sparse checkout can be used to avoid colons in windows on-disk files based on the current code. -- Philip
Philip@PHILIPOAKLEY /d/Git_repos/colons $ cd tortoisegit-colons/
Philip@PHILIPOAKLEY /d/Git_repos/colons/tortoisegit-colons (test) $ git update-index --skip-worktree -- ifcfg-eth0\:0 Ignoring path ifcfg-eth0:0
Philip@PHILIPOAKLEY /d/Git_repos/colons/tortoisegit-colons (test) $ git reset error: Invalid path 'ifcfg-eth0:0' fatal: make_cache_entry failed for path 'ifcfg-eth0:0'