git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Parkins <andyparkins@gmail.com>
To: git@vger.kernel.org
Cc: "Stian Haklev" <shaklev@gmail.com>
Subject: Re: Fwd: Problem: git doesn't update working dir (always) when checkout'ing other branch
Date: Tue, 22 May 2007 09:04:37 +0100	[thread overview]
Message-ID: <200705220904.39487.andyparkins@gmail.com> (raw)
In-Reply-To: <566574ef0705212105k1387cf41n18e076c0bdf47ec6@mail.gmail.com>

On Tuesday 2007 May 22, Stian Haklev wrote:

> git --version > ../file1

Good stuff.  The ">" only redirects stdout to file1; stderr would still be 
written to your terminal - did you notice any errors from this script?  Could 
you run again, but append "2>&1" to the end of each redirecting line?

> git status >> ../file1
Seemed fine after this.

> echo checking out works with old >> ../file1
> git checkout works-with-old >> ../file1
Seemed fine after this.

> git status >> ../file1
Seemed fine after this.

> git checkout master >> ../file1
> git status >> ../file1

Kaboom!

> # On branch master 
> # Changes to be committed:
> #   (use "git reset HEAD <file>..." to unstage)
> #
> #       deleted:    NOTES
> #       modified:   display-page.rb
> #       deleted:    eee_darwin
> #       modified:   gui.rb
> #       modified:   htmlshrinker-data.rb
> #       modified:   htmlshrinker.rb
> #       modified:   mongrel-web-gui.rb
> #       modified:   mongrel-web.rb
> #       modified:   zarchive.rb
> #       new file:   zcompress.rb
> #       modified:   zdump-7z.rb
> #       modified:   zdump.rb
> #       modified:   zipdoc.rb
> #       deleted:    zutil.rb

Wow.  I've never seen anything like that.  Neither the index nor the working 
tree has actually been updated - but HEAD now points at master.

What was the output of that last git-checkout (unfortunately it outputs to 
stderr not stdout, so you'll need the "2>&1" at the end of each line in your 
script)?  git-checkout won't change HEAD unless the change of index and 
working tree worked.  I can't see the path through the git-checkout script 
that would have done what you're describing.  I think it's going to need a 
guru on this one, however, we'll keep at it until I can't think of any more 
questions :-)

Do you observe the same behaviour on all repositories or just this one 
particular repository?

What's the form of this repository?  That is to say, is works-with-old a 
branch from master or is it an independent branch?  e.g.

  0 -- * -- * -- * (master)             0 -- * -- * -- * (master)
                                    or        \
  0 -- * -- * -- * (works-with-old)            * -- * -- * (works-with-old)
                     
I assume once you get into this broken state that running "git-reset --hard" 
restores the working tree back to master?

Does changing that last checkout to "git-checkout -f master" improve things?


Andy

-- 
Dr Andy Parkins, M Eng (hons), MIET
andyparkins@gmail.com

      reply	other threads:[~2007-05-22  8:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <566574ef0705210157j14cb7c56h62392c6193472a98@mail.gmail.com>
2007-05-21  8:59 ` Fwd: Problem: git doesn't update working dir (always) when checkout'ing other branch Stian Haklev
2007-05-21  9:16   ` Andy Parkins
2007-05-22  4:05     ` Stian Haklev
2007-05-22  8:04       ` Andy Parkins [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200705220904.39487.andyparkins@gmail.com \
    --to=andyparkins@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=shaklev@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).