* bug? - git-checkout treeish paths ignores deleted files
@ 2007-10-09 0:58 Mark Levedahl
2007-10-09 1:52 ` Wincent Colaiuta
0 siblings, 1 reply; 4+ messages in thread
From: Mark Levedahl @ 2007-10-09 0:58 UTC (permalink / raw)
To: Git Mailing List
Shouldn't "git checkout topic path" make the directory tree rooted at
path identical to what is on branch topic? It doesn't.
Try this:
mkdir test
cd test
git init
touch a b
git add a b
git commit -m 'base'
git checkout -b topic
git rm a
git commit -m 'removed a'
git checkout master
git checkout topic .
...and the result is...
ls
a b
instead of
b
Mark
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: bug? - git-checkout treeish paths ignores deleted files
2007-10-09 0:58 bug? - git-checkout treeish paths ignores deleted files Mark Levedahl
@ 2007-10-09 1:52 ` Wincent Colaiuta
2007-10-09 3:39 ` Mark Levedahl
0 siblings, 1 reply; 4+ messages in thread
From: Wincent Colaiuta @ 2007-10-09 1:52 UTC (permalink / raw)
To: Mark Levedahl; +Cc: Git Mailing List
El 9/10/2007, a las 2:58, Mark Levedahl escribió:
> Shouldn't "git checkout topic path" make the directory tree
> rooted at path identical to what is on branch topic? It doesn't.
>
> Try this:
>
> mkdir test
> cd test
> git init
> touch a b
> git add a b
> git commit -m 'base'
> git checkout -b topic
> git rm a
> git commit -m 'removed a'
> git checkout master
> git checkout topic .
>
> ...and the result is...
> ls
> a b
>
> instead of
> b
No, the behaviour is correct.
- first you removed the file on the topic branch; at the same time
you removed it from your working tree
- then you switched back to the master branch and so the file was
added back to your working tree
- then you switched back to the topic branch, and seeing as the file
"a" is not being tracked in the topic branch Git doesn't touch it
In general, Git only meddles with stuff that you've told it to track.
This is actually a good thing in most cases because it makes some
workflows involving dirty trees or trees with untracked content
somewhat more convenient.
Cheers,
Wincent
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: bug? - git-checkout treeish paths ignores deleted files
2007-10-09 1:52 ` Wincent Colaiuta
@ 2007-10-09 3:39 ` Mark Levedahl
2007-10-09 10:20 ` Wincent Colaiuta
0 siblings, 1 reply; 4+ messages in thread
From: Mark Levedahl @ 2007-10-09 3:39 UTC (permalink / raw)
To: Wincent Colaiuta; +Cc: Git Mailing List
Wincent Colaiuta wrote:
> El 9/10/2007, a las 2:58, Mark Levedahl escribió:
>
>> Shouldn't "git checkout topic path" make the directory tree rooted
>> at path identical to what is on branch topic? It doesn't.
>>
>>
>
> No, the behaviour is correct.
>
> - first you removed the file on the topic branch; at the same time you
> removed it from your working tree
> - then you switched back to the master branch and so the file was
> added back to your working tree
> - then you switched back to the topic branch, and seeing as the file
> "a" is not being tracked in the topic branch Git doesn't touch it
>
> In general, Git only meddles with stuff that you've told it to track.
> This is actually a good thing in most cases because it makes some
> workflows involving dirty trees or trees with untracked content
> somewhat more convenient.
>
> Cheers,
> Wincent
>
>
I'm not convinced...
"git checkout branch dir" should make dir have the same value it would
get if I just did "git checkout branch". The latter command will ignore
files only if they are untracked in *both* HEAD and branch. I fail to
see why the path-limited version of git-checkout should give a different
result on the part it is asked to affect than the non-path limited
version. This is very inconsistent and I'm having a hard time
understanding what workflow it will help.
Mark
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: bug? - git-checkout treeish paths ignores deleted files
2007-10-09 3:39 ` Mark Levedahl
@ 2007-10-09 10:20 ` Wincent Colaiuta
0 siblings, 0 replies; 4+ messages in thread
From: Wincent Colaiuta @ 2007-10-09 10:20 UTC (permalink / raw)
To: Mark Levedahl; +Cc: Git Mailing List
El 9/10/2007, a las 5:39, Mark Levedahl escribió:
> I'm not convinced...
>
> "git checkout branch dir" should make dir have the same value it
> would get if I just did "git checkout branch". The latter command
> will ignore files only if they are untracked in *both* HEAD and
> branch. I fail to see why the path-limited version of git-checkout
> should give a different result on the part it is asked to affect
> than the non-path limited version. This is very inconsistent and
> I'm having a hard time understanding what workflow it will help.
I don't know the historical reasons for the difference but it's
explained in the second para of the man page:
When <paths> are given, this command does not switch branches. It
updates the named paths in the working tree from the index file
(i.e.
it runs git-checkout-index -f -u), or from a named commit.
So when you supply "." as a path it's not actually switching
branches. So that's why you see the different behaviour; it's
intentionally different. Like I said, I don't know the reasons why
but I imagine it's to make it easy to grab specific files from other
branches without actually switching.
Cheers,
Wincent
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-10-09 10:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-09 0:58 bug? - git-checkout treeish paths ignores deleted files Mark Levedahl
2007-10-09 1:52 ` Wincent Colaiuta
2007-10-09 3:39 ` Mark Levedahl
2007-10-09 10:20 ` Wincent Colaiuta
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).