* git-checkout sometimes silently fails @ 2008-05-06 19:22 Andrew Morton 2008-05-06 21:50 ` Alex Riesen 0 siblings, 1 reply; 10+ messages in thread From: Andrew Morton @ 2008-05-06 19:22 UTC (permalink / raw) To: git I've had this happen before and I don't know what to do to make it stop. Usually sufficient fiddling will prevent it from happening. y:/usr/src/git26> cat .git/branches/linux-next git+ssh://master.kernel.org/pub/scm/linux/kernel/git/sfr/linux-next.git y:/usr/src/git26> git-checkout master Switched to branch "master" y:/usr/src/git26> cat kernel/*.c|sum 34439 2057 y:/usr/src/git26> git-checkout linux-next Switched to branch "linux-next" y:/usr/src/git26> cat kernel/*.c|sum 34439 2057 y:/usr/src/git26> git-checkout origin Note: moving to "origin" which isn't a local branch If you want to create a new branch from this checkout, you may do so (now or later) by using -b with the checkout command again. Example: git checkout -b <new_branch_name> HEAD is now at 5717922... Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb y:/usr/src/git26> cat kernel/*.c|sum 34439 2057 y:/usr/src/git26> git --version git version 1.5.5.rc1 help? ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: git-checkout sometimes silently fails 2008-05-06 19:22 git-checkout sometimes silently fails Andrew Morton @ 2008-05-06 21:50 ` Alex Riesen 2008-05-07 0:10 ` Andrew Morton 0 siblings, 1 reply; 10+ messages in thread From: Alex Riesen @ 2008-05-06 21:50 UTC (permalink / raw) To: Andrew Morton; +Cc: git Andrew Morton, Tue, May 06, 2008 21:22:56 +0200: > > I've had this happen before and I don't know what to do to make it stop. > Usually sufficient fiddling will prevent it from happening. > > > y:/usr/src/git26> cat .git/branches/linux-next > git+ssh://master.kernel.org/pub/scm/linux/kernel/git/sfr/linux-next.git > > y:/usr/src/git26> git-checkout master > Switched to branch "master" > y:/usr/src/git26> cat kernel/*.c|sum > 34439 2057 > y:/usr/src/git26> git-checkout linux-next > Switched to branch "linux-next" > y:/usr/src/git26> cat kernel/*.c|sum > 34439 2057 This is not a good indication of a failed checkout (they could point to the same commit, for one). Try "gitk master...linux-next" (or "git log master..linux-next", "git diff master linux-next") > y:/usr/src/git26> git-checkout origin > Note: moving to "origin" which isn't a local branch > If you want to create a new branch from this checkout, you may do so > (now or later) by using -b with the checkout command again. Example: > git checkout -b <new_branch_name> > HEAD is now at 5717922... Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb This is not an error. The commit was checked out (and HEAD was "detached"). > y:/usr/src/git26> cat kernel/*.c|sum > 34439 2057 Again, it is no indication nothing happened. "gitk HEAD...linux-next" > y:/usr/src/git26> git --version > git version 1.5.5.rc1 > > help? Look at "git branch -av" (it shows both local and remote branches and commits they point to). Maybe it will give you a hint. "gitk --all" is interesting too, seldom though (it becomes very confusing very fast if you have many branches with complicated history each). ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: git-checkout sometimes silently fails 2008-05-06 21:50 ` Alex Riesen @ 2008-05-07 0:10 ` Andrew Morton 2008-05-07 0:19 ` Junio C Hamano ` (2 more replies) 0 siblings, 3 replies; 10+ messages in thread From: Andrew Morton @ 2008-05-07 0:10 UTC (permalink / raw) To: Alex Riesen; +Cc: git On Tue, 6 May 2008 23:50:49 +0200 Alex Riesen <raa.lkml@gmail.com> wrote: > Andrew Morton, Tue, May 06, 2008 21:22:56 +0200: > > > > I've had this happen before and I don't know what to do to make it stop. > > Usually sufficient fiddling will prevent it from happening. > > > > > > y:/usr/src/git26> cat .git/branches/linux-next > > git+ssh://master.kernel.org/pub/scm/linux/kernel/git/sfr/linux-next.git > > > > y:/usr/src/git26> git-checkout master > > Switched to branch "master" > > y:/usr/src/git26> cat kernel/*.c|sum > > 34439 2057 > > y:/usr/src/git26> git-checkout linux-next > > Switched to branch "linux-next" > > y:/usr/src/git26> cat kernel/*.c|sum > > 34439 2057 > > This is not a good indication of a failed checkout (they could point > to the same commit, for one). How could they? linux-next includes a directory called ./Next and a file in that directory called ./Next/Trees, and that is not present after the `git-checkout linux-next'. > Try "gitk master...linux-next" (or "git > log master..linux-next", "git diff master linux-next") These come up empty. But there is a 12.4MB diff between mainline and linux-next. > > y:/usr/src/git26> git-checkout origin > > Note: moving to "origin" which isn't a local branch > > If you want to create a new branch from this checkout, you may do so > > (now or later) by using -b with the checkout command again. Example: > > git checkout -b <new_branch_name> > > HEAD is now at 5717922... Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb > > This is not an error. The commit was checked out (and HEAD was > "detached"). > > > y:/usr/src/git26> cat kernel/*.c|sum > > 34439 2057 > > Again, it is no indication nothing happened. "gitk HEAD...linux-next" > > > y:/usr/src/git26> git --version > > git version 1.5.5.rc1 > > > > help? > > Look at "git branch -av" (it shows both local and remote branches and > commits they point to). y:/usr/src/git26> git-branch -av | grep '^\*' * master 5717922 Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb y:/usr/src/git26> git-checkout linux-next Switched to branch "linux-next" y:/usr/src/git26> git-branch -av | grep '^\*' * linux-next 5717922 Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb y:/usr/src/git26> ls -l Next ls: cannot access Next: No such file or directory > Maybe it will give you a hint. "gitk --all" is > interesting too, seldom though (it becomes very confusing very fast if > you have many branches with complicated history each). hm, lots of stuff there. Thing is, sometimes `git-checkout linux-next' works. Sometimes it inexplicably doesn't work and there is no indication from git that it didn't work. Usually my git problems are root-caused down to my lack of a PhD in hermeneutic metaphysiology, but not this time, methinks ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: git-checkout sometimes silently fails 2008-05-07 0:10 ` Andrew Morton @ 2008-05-07 0:19 ` Junio C Hamano 2008-05-07 0:43 ` Andrew Morton 2008-05-07 15:09 ` J. Bruce Fields 2008-05-07 0:19 ` Jeff King 2008-05-07 8:51 ` Johannes Sixt 2 siblings, 2 replies; 10+ messages in thread From: Junio C Hamano @ 2008-05-07 0:19 UTC (permalink / raw) To: Andrew Morton; +Cc: Alex Riesen, git Andrew Morton <akpm@linux-foundation.org> writes: > y:/usr/src/git26> git-branch -av | grep '^\*' > * master 5717922 Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb > y:/usr/src/git26> git-checkout linux-next > Switched to branch "linux-next" > y:/usr/src/git26> git-branch -av | grep '^\*' > * linux-next 5717922 Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb So your two local branches 'master' and 'linux-next' both point at the same commit, 5717922. "git checkout <branchname>" is to check out the local branch name. You expect "git checkout master" and then "git checkout linux-next" to check out two different commits because linux-next _should_ have been updated to the latest from sfr repository. But it appears to me that that is not the case. Perhaps "git fetch linux-next" hasn't been run, before "git checkout" was attempted? ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: git-checkout sometimes silently fails 2008-05-07 0:19 ` Junio C Hamano @ 2008-05-07 0:43 ` Andrew Morton 2008-05-07 15:09 ` J. Bruce Fields 1 sibling, 0 replies; 10+ messages in thread From: Andrew Morton @ 2008-05-07 0:43 UTC (permalink / raw) To: Junio C Hamano; +Cc: Alex Riesen, git On Tue, 06 May 2008 17:19:01 -0700 Junio C Hamano <gitster@pobox.com> wrote: > Andrew Morton <akpm@linux-foundation.org> writes: > > > y:/usr/src/git26> git-branch -av | grep '^\*' > > * master 5717922 Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb > > y:/usr/src/git26> git-checkout linux-next > > Switched to branch "linux-next" > > y:/usr/src/git26> git-branch -av | grep '^\*' > > * linux-next 5717922 Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb > > So your two local branches 'master' and 'linux-next' both point at the > same commit, 5717922. > > "git checkout <branchname>" is to check out the local branch name. You > expect "git checkout master" and then "git checkout linux-next" to check > out two different commits because linux-next _should_ have been updated to > the latest from sfr repository. But it appears to me that that is not the > case. I did a git-fetch of linux-next yesterday. > Perhaps "git fetch linux-next" hasn't been run, before "git checkout" was > attempted? I reran `git-fetch linux-next' and that downlaoded a heap of stuff (perhaps necause linux-next rebases every time?) and after this, `git-checkout linux-next' gives me what I expect. But how come I couldn't check out yesterday's linux-next? ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: git-checkout sometimes silently fails 2008-05-07 0:19 ` Junio C Hamano 2008-05-07 0:43 ` Andrew Morton @ 2008-05-07 15:09 ` J. Bruce Fields 1 sibling, 0 replies; 10+ messages in thread From: J. Bruce Fields @ 2008-05-07 15:09 UTC (permalink / raw) To: Junio C Hamano; +Cc: Andrew Morton, Alex Riesen, git On Tue, May 06, 2008 at 05:19:01PM -0700, Junio C Hamano wrote: > Andrew Morton <akpm@linux-foundation.org> writes: > > > y:/usr/src/git26> git-branch -av | grep '^\*' > > * master 5717922 Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb > > y:/usr/src/git26> git-checkout linux-next > > Switched to branch "linux-next" > > y:/usr/src/git26> git-branch -av | grep '^\*' > > * linux-next 5717922 Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb > > So your two local branches 'master' and 'linux-next' both point at the > same commit, 5717922. > > "git checkout <branchname>" is to check out the local branch name. You > expect "git checkout master" and then "git checkout linux-next" to check > out two different commits because linux-next _should_ have been updated to > the latest from sfr repository. But it appears to me that that is not the > case. > > Perhaps "git fetch linux-next" hasn't been run, before "git checkout" was > attempted? Might also be worth checking whether there happens to be a tag (or something else?) named the same as one of the branches? I remember the public -mm git repo, for example, having a tag named "master". Yuch. Grepping through git-for-each-ref output might shed some light. --b. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: git-checkout sometimes silently fails 2008-05-07 0:10 ` Andrew Morton 2008-05-07 0:19 ` Junio C Hamano @ 2008-05-07 0:19 ` Jeff King 2008-05-07 0:54 ` Andrew Morton 2008-05-07 8:51 ` Johannes Sixt 2 siblings, 1 reply; 10+ messages in thread From: Jeff King @ 2008-05-07 0:19 UTC (permalink / raw) To: Andrew Morton; +Cc: Alex Riesen, git On Tue, May 06, 2008 at 05:10:52PM -0700, Andrew Morton wrote: > > > y:/usr/src/git26> git-checkout master > > > Switched to branch "master" > > > y:/usr/src/git26> cat kernel/*.c|sum > > > 34439 2057 > > > y:/usr/src/git26> git-checkout linux-next > > > Switched to branch "linux-next" > > > y:/usr/src/git26> cat kernel/*.c|sum > > > 34439 2057 > > > > This is not a good indication of a failed checkout (they could point > > to the same commit, for one). > > How could they? linux-next includes a directory called ./Next and a file > in that directory called ./Next/Trees, and that is not present after the > `git-checkout linux-next'. But you don't show us that in your example. There is nothing in your example to indicate that they are not simply pointing at the same commit... > > Try "gitk master...linux-next" (or "git > > log master..linux-next", "git diff master linux-next") > > These come up empty. But there is a 12.4MB diff between mainline and > linux-next. And if these all come up empty, then they _are_ pointing to the same commit. When you say "but there is a 12.4MB diff..." do you mean "there _should_ be such a diff?" In that case, it seems that your linux-next ref is pointing to an unexpected commit. So the problem is not with git-checkout, but rather that you are not checking out what you think you are checking out. And so we need to figure out how you got into that state. What command did you use to create the linux-next branch? Have you used git-reset to move the branch tip around? -Peff ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: git-checkout sometimes silently fails 2008-05-07 0:19 ` Jeff King @ 2008-05-07 0:54 ` Andrew Morton 2008-05-07 1:32 ` Björn Steinbrink 0 siblings, 1 reply; 10+ messages in thread From: Andrew Morton @ 2008-05-07 0:54 UTC (permalink / raw) To: Jeff King; +Cc: Alex Riesen, git On Tue, 6 May 2008 20:19:19 -0400 Jeff King <peff@peff.net> wrote: > On Tue, May 06, 2008 at 05:10:52PM -0700, Andrew Morton wrote: > > > > > y:/usr/src/git26> git-checkout master > > > > Switched to branch "master" > > > > y:/usr/src/git26> cat kernel/*.c|sum > > > > 34439 2057 > > > > y:/usr/src/git26> git-checkout linux-next > > > > Switched to branch "linux-next" > > > > y:/usr/src/git26> cat kernel/*.c|sum > > > > 34439 2057 > > > > > > This is not a good indication of a failed checkout (they could point > > > to the same commit, for one). > > > > How could they? linux-next includes a directory called ./Next and a file > > in that directory called ./Next/Trees, and that is not present after the > > `git-checkout linux-next'. > > But you don't show us that in your example. There is nothing in your > example to indicate that they are not simply pointing at the same > commit... > > > > Try "gitk master...linux-next" (or "git > > > log master..linux-next", "git diff master linux-next") > > > > These come up empty. But there is a 12.4MB diff between mainline and > > linux-next. > > And if these all come up empty, then they _are_ pointing to the same > commit. When you say "but there is a 12.4MB diff..." do you mean "there > _should_ be such a diff?" In that case, it seems that your linux-next > ref is pointing to an unexpected commit. > > So the problem is not with git-checkout, but rather that you are not > checking out what you think you are checking out. That sounds a decent theory. > And so we need to > figure out how you got into that state. Well it happens pretty regularly. I have now lost that state but I'll save it next time. I'm not able to pinpoint exactly what causes it to occur. > What command did you use to create the linux-next branch? I edited y:/usr/src/git26> cat .git/branches/linux-next git+ssh://master.kernel.org/pub/scm/linux/kernel/git/sfr/linux-next.git and did git-fetch once per day, approx. > Have you used > git-reset to move the branch tip around? My git-fetching script does that: doit() { tree=$1 upstream=$2 cd $GIT_TREE git reset --hard "$upstream" git fetch "$tree" || exit 1 git merge --no-commit 'test merge' HEAD FETCH_HEAD > /dev/null { git_header "$tree" git log --no-merges ORIG_HEAD..FETCH_HEAD git diff --patch-with-stat ORIG_HEAD } >$PULL/$tree.patch { echo DESC echo $tree.patch echo EDESC git_header "$tree" git log --no-merges ORIG_HEAD..FETCH_HEAD } >$PULL/$tree.txt git reset --hard "$upstream" } (Linus suggested an updated version of this but afaict that won't change anything) But, as I say, usually this script leaves the tree in a sane state. But sometimes it leaves it in a i-cant-check-stuff-out state. It's not specific to linux-next, either: I've seen this for a long time, on and off. Prior to linux-next's existence. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: git-checkout sometimes silently fails 2008-05-07 0:54 ` Andrew Morton @ 2008-05-07 1:32 ` Björn Steinbrink 0 siblings, 0 replies; 10+ messages in thread From: Björn Steinbrink @ 2008-05-07 1:32 UTC (permalink / raw) To: Andrew Morton; +Cc: Jeff King, Alex Riesen, git On 2008.05.06 17:54:42 -0700, Andrew Morton wrote: > On Tue, 6 May 2008 20:19:19 -0400 Jeff King <peff@peff.net> wrote: > > > On Tue, May 06, 2008 at 05:10:52PM -0700, Andrew Morton wrote: > > > > > > > y:/usr/src/git26> git-checkout master > > > > > Switched to branch "master" > > > > > y:/usr/src/git26> cat kernel/*.c|sum > > > > > 34439 2057 > > > > > y:/usr/src/git26> git-checkout linux-next > > > > > Switched to branch "linux-next" > > > > > y:/usr/src/git26> cat kernel/*.c|sum > > > > > 34439 2057 > > > > > > > > This is not a good indication of a failed checkout (they could point > > > > to the same commit, for one). > > > > > > How could they? linux-next includes a directory called ./Next and a file > > > in that directory called ./Next/Trees, and that is not present after the > > > `git-checkout linux-next'. > > > > But you don't show us that in your example. There is nothing in your > > example to indicate that they are not simply pointing at the same > > commit... > > > > > > Try "gitk master...linux-next" (or "git > > > > log master..linux-next", "git diff master linux-next") > > > > > > These come up empty. But there is a 12.4MB diff between mainline and > > > linux-next. > > > > And if these all come up empty, then they _are_ pointing to the same > > commit. When you say "but there is a 12.4MB diff..." do you mean "there > > _should_ be such a diff?" In that case, it seems that your linux-next > > ref is pointing to an unexpected commit. > > > > So the problem is not with git-checkout, but rather that you are not > > checking out what you think you are checking out. > > That sounds a decent theory. > > > And so we need to > > figure out how you got into that state. > > Well it happens pretty regularly. I have now lost that state but I'll save > it next time. I'm not able to pinpoint exactly what causes it to occur. > > > What command did you use to create the linux-next branch? > > I edited > > y:/usr/src/git26> cat .git/branches/linux-next > git+ssh://master.kernel.org/pub/scm/linux/kernel/git/sfr/linux-next.git > > and did git-fetch once per day, approx. > > > Have you used > > git-reset to move the branch tip around? > > My git-fetching script does that: > > doit() > { > tree=$1 > upstream=$2 > > cd $GIT_TREE > git reset --hard "$upstream" > git fetch "$tree" || exit 1 > git merge --no-commit 'test merge' HEAD FETCH_HEAD > /dev/null > > { > git_header "$tree" > git log --no-merges ORIG_HEAD..FETCH_HEAD > git diff --patch-with-stat ORIG_HEAD > } >$PULL/$tree.patch > { > echo DESC > echo $tree.patch > echo EDESC > git_header "$tree" > git log --no-merges ORIG_HEAD..FETCH_HEAD > } >$PULL/$tree.txt > git reset --hard "$upstream" > } > > (Linus suggested an updated version of this but afaict that won't change > anything) > > But, as I say, usually this script leaves the tree in a sane state. But > sometimes it leaves it in a i-cant-check-stuff-out state. It's not > specific to linux-next, either: I've seen this for a long time, on and off. > Prior to linux-next's existence. Hm, that very much looks like it would mess things up whenever you're not on the upstream branch already. While this should do no harm: git checkout master doit linux-next master This will make your linux-next branch point to the same commit as master: git checkout linux-next doit linux-next master Adding a '"git checkout "$upstream"' (maybe with -f?) before the first reset --hard should avoid that then. Björn ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: git-checkout sometimes silently fails 2008-05-07 0:10 ` Andrew Morton 2008-05-07 0:19 ` Junio C Hamano 2008-05-07 0:19 ` Jeff King @ 2008-05-07 8:51 ` Johannes Sixt 2 siblings, 0 replies; 10+ messages in thread From: Johannes Sixt @ 2008-05-07 8:51 UTC (permalink / raw) To: Andrew Morton; +Cc: Alex Riesen, git Andrew Morton schrieb: > y:/usr/src/git26> git-branch -av | grep '^\*' > * master 5717922 Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb > y:/usr/src/git26> git-checkout linux-next > Switched to branch "linux-next" > y:/usr/src/git26> git-branch -av | grep '^\*' > * linux-next 5717922 Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb You did not show us the output of 'git branch -av'. Do you happen to see something like this in the output: * master 5717922 Merge branch 'for_linus' linux-next 5717922 Merge branch 'for_linus' linux-next/HEAD 1234567 Something completely different linux-next/master 1234567 Something completely different In this case, your local branch 'linux-next' is probably a left-over from earlier experiments. The last two branches are actually what you want to refer to. Normally, the 'linux-next/HEAD' part allows you to refer to 'linux-next/master' by saying simply 'linux-next'. But unfortunately, your local branch name 'linux-next' takes precedence. 'git fetch' never updates your local branch, but only 'linux-next/master' (and its alias 'linux-next/HEAD' aka 'linux-next'). To return to a sane state, do 'git branch -D linux-next'. -- Hannes ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2008-05-07 15:11 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-05-06 19:22 git-checkout sometimes silently fails Andrew Morton 2008-05-06 21:50 ` Alex Riesen 2008-05-07 0:10 ` Andrew Morton 2008-05-07 0:19 ` Junio C Hamano 2008-05-07 0:43 ` Andrew Morton 2008-05-07 15:09 ` J. Bruce Fields 2008-05-07 0:19 ` Jeff King 2008-05-07 0:54 ` Andrew Morton 2008-05-07 1:32 ` Björn Steinbrink 2008-05-07 8:51 ` Johannes Sixt
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).