Change dir to clone_via_grant
Yue Lin Ho於 2015年3月17日星期二 UTC+8下午12時01分56秒寫道:
Hi:Assume I got one repository which comes from a Linux user,and there is one file which have a colon in its filename,and clone that repository on Windows...(Actually, I got real one for testing.Because the filename with colon is not allowed in Windows,the file is not created/checkout.Then git will treat it as a deleted file. See:User@PC /d/Repo/tortoisegit-colons (master)$ git statusOn branch masterYour branch is up-to-date with 'origin/master'.Changes to be committed:(use "git reset HEAD <file>..." to unstage)deleted: ifcfg-eth0:0
Assume the Windows users never modify that file and the Linux user needs that file.What am I supposed do on that file?
Try using "Sparse Checkout". It's hidden in the manuals, and you create an "ignore" file that states which files shouln not be checked out into the working tree (so Windows File System doesn't/shouldn't see them). The Index (staging area) knows that they are part of that directory tree, so status and other commands don't get confused, and you should be able to carry on OK.I've not used it my self, but have plans regarding a wider 'Narrow/Sparse' repo functionality for [Enterprise] cases where you don't want Random.J.Coder to actually have a fully copy of your repo, and only have available those specific directories allocated to them, yet still have a fully functional Push/Fetch/Pull capability similar to the Shallow clones.
On 2015-03-18 00:13, Yue Lin Ho wrote:
> Philip Oakley於 2015年3月18日星期三 UTC+8上午1時27分34秒寫道:
>
>> Try using "Sparse Checkout".
>
> I did this test:
>
> User@PC /d/Temp/tortoisegit-colons (master)
> $ git config core.sparseCheckout true
>
> User@PC /d/Temp/tortoisegit-colons (master)
> $ echo README.md > .git/info/sparse-checkout
>
> Dev@DEV-PC /d/Temp/tortoisegit-colons (master)
> $ git read-tree --reset -u HEAD
> error: Invalid path 'ifcfg-eth0:0'
>
>
> Not sure I am doing the right thing about sparse checkout. :P
You cannot use the sparse checkout feature to fix the problem when it
already occurred. In other words, if the file has already been "checked
out", i.e. if is part of the staging area and Git tried to write it out,
then it is already too late.
Unfortunately, the sparseCheckout feature only works in conjunction with
a `sparse-checkout` file, otherwise the list of files not to be checked
out is assumed to be empty.
This here procedure works here:
```bash
$ git clone -n https://github.com/t-pascal/tortoisegit-colons
...
$ cd tortoisegit-colons
$ git config -c core.sparseCheckout true
$ echo README.md > .git/info/sparse-checkout
$ git checkout master
```
After this command, the index is already messed up. You
should set the sparse checkout *directly* after cloning with the `-n`
flag. Before anything else. And then `git checkout master`.
I fear that it might be necessary to get familiar with the index and
with the flags set in it. In particular the details when it is modified,
initialized and how the Git commands interact with the working
directory. As Philip indicated, this is one of the more obscure Git
functions, and it will not be easy to use it without knowing the
internals that are involved in it. So I guess just copy-pasting commands
from my mails will not do any good...
Unfortunately, at this point I need to bow out of the mail thread (too
much other Git for Windows work).
Johannes Schindelin於 2015年3月18日星期三 UTC+8下午5時16分26秒寫道:
On 2015-03-18 08:39, Yue Lin Ho wrote:
> Yue Lin Ho於 2015年3月18日星期三 UTC+8下午3時27分06秒寫道:
>> Johannes Schindelin於 2015年3月18日星期三 UTC+8下午3時08分58秒寫道:
>>> On 2015-03-18 00:13, Yue Lin Ho wrote:
>>> > Philip Oakley於 2015年3月18日星期三 UTC+8上午1時27分34秒寫道:
>>> This here procedure works here:
>>> ```bash
>>> $ git clone -n https://github.com/t-pascal/tortoisegit-colons
>>> ...
>>> $ cd tortoisegit-colons
>>> $ git config -c core.sparseCheckout true
>>> $ echo README.md > .git/info/sparse-checkout
>>> $ git checkout master
>>> ```
> vagrant@precise64:/vagrant/git$ git clone -n
> https://github.com/t-pascal/tortoisegit-colons test3
> vagrant@precise64:/vagrant/git$ cd test3
> vagrant@precise64:/vagrant/git/test3$ git status
> vagrant@precise64:/vagrant/git/test3$ *git reset HEAD ifcfg-eth0:0*
Why reset?
Just another way to not commit the deleted ifcfg-eth0:0 file with other changes.After this command, the index is already messed up. You
should set the sparse checkout *directly* after cloning with the `-n`
flag. Before anything else. And then `git checkout master`.
I fear that it might be necessary to get familiar with the index and
with the flags set in it. In particular the details when it is modified,
initialized and how the Git commands interact with the working
directory. As Philip indicated, this is one of the more obscure Git
functions, and it will not be easy to use it without knowing the
internals that are involved in it. So I guess just copy-pasting commands
from my mails will not do any good...So, I prefer assume unchanged. :-)
Just to clarify that my proposed use of Sparse checkout was to set the file with a _negative_ pathspec, such that everything bar the colon-in-filename could be checked out , but that the colon file would stay firmly inside the repository's object store, and never try to get into the file system.
The index would still know and love it and believe it to be part of the worktree of its parent directory, but Windows wouldn't care.In particular see 'git help read-tree' for the Sparse Checkout explanation and how to ignore the file 'unwanted' ;-)That all said, I haven't used the facility personally.
From: Yue Lin HoPhilip Oakley於 2015年3月19日星期四 UTC+8上午6時13分54秒寫道:Re-tried "-n" of clone
User@PC /d/Repo$ git clone -n https://github.com/t-pascal/tortoisegit-colons.git test10
[snip]
User@PC /d/Repo$ cd test10User@PC /d/Repo/test10 (master)$ echo README.md > .git/info/sparse-checkoutUser@PC /d/Repo/test10 (master)$ git checkout mastererror: Invalid path 'ifcfg-eth0:0'D ifcfg-eth0:0Already on 'master'Your branch is up-to-date with 'origin/master'.User@PC /d/Repo/test10 (master)$ echo xxx > README.mdUser@PC /d/Repo/test10 (master)$ git add README.mdUser@PC /d/Repo/test10 (master)$ git commit -m "modified README.md"[master 66a5d8c] modified README.md2 files changed, 1 insertion(+), 20 deletions(-)rewrite README.md (100%)delete mode 100644 ifcfg-eth0:0
Sad for that file is deleted in new commit. :-/
is the one that I expected to be changed.You should be setting (as I understand it)$ echo /* > .git/info/sparse-checkout$ echo !ifcfg-eth0:0 >> .git/info/sparse-checkoutso that that file is excluded from the checkout. Without the negative "!" you don't exclude that file from the checkout. Though it maybe that the code isn't selective enough to avoid the file system while it's doing that check.I haven't had chance to check any of this, so ... I may be wrong.
Philip Oakley於 2015年3月19日星期四 UTC+8上午6時13分54秒寫道:Johannes Schindelin於 2015年3月18日星期三 UTC+8下午5時16分26秒寫道:
On 2015-03-18 08:39, Yue Lin Ho wrote:
> Yue Lin Ho於 2015年3月18日星期三 UTC+8下午3時27分06秒寫道:
>> Johannes Schindelin於 2015年3月18日星期三 UTC+8下午3時08分58秒寫道:
>>> On 2015-03-18 00:13, Yue Lin Ho wrote:
>>> > Philip Oakley於 2015年3月18日星期三 UTC+8上午1時27分34秒寫道:
>>> This here procedure works here:
>>> ```bash
>>> $ git clone -n https://github.com/t-pascal/tortoisegit-colons
>>> ...
>>> $ cd tortoisegit-colons
>>> $ git config -c core.sparseCheckout true
>>> $ echo README.md > .git/info/sparse-checkout
>>> $ git checkout master
>>> ```
I fear that it might be necessary to get familiar with the index and
Philip@PHILIPOAKLEY /d/Git_repos/tortoisegit-colons (master)
$ git update-index --skip-worktree -- ifcfg-eth0\:0
Ignoring path ifcfg-eth0:0So it says it's ignoring OK but then no amount of attemting to
managed to get to the scenario where the sparse checkout worked as I expected.I will report it upstream to g...@vger.kernel.org to see if they can help.Philip