git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Two bugs with renaming
@ 2008-03-19 23:21 John Goerzen
  2008-03-20  0:51 ` Junio C Hamano
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: John Goerzen @ 2008-03-19 23:21 UTC (permalink / raw)
  To: git

Hi folks,

I have a transcript of a Git session that illustrates two odd bugs
with Git renaming.  Command output is truncated except where
interesting.

Bug #1 causes git to refuse to change to a different branch, claiming
that uncommitted changes exist, even when git status says there are none.
Bug #2 causes git to refuse to merge unrelated changes.

Tested with Git 1.5.4.4.

jgoerzen@katherina:/tmp$ mkdir testrepo
jgoerzen@katherina:/tmp$ cd testrepo
jgoerzen@katherina:/tmp/testrepo$ git init
jgoerzen@katherina:/tmp/testrepo$ mkdir files
jgoerzen@katherina:/tmp/testrepo$ echo hi > files/delete.me
jgoerzen@katherina:/tmp/testrepo$ git add .
jgoerzen@katherina:/tmp/testrepo$ git commit -m 'Added files/delete.me'
jgoerzen@katherina:/tmp/testrepo$ git checkout -b testbranch
Switched to a new branch "testbranch"
jgoerzen@katherina:/tmp/testrepo$ git mv files files.upstream
jgoerzen@katherina:/tmp/testrepo$ git commit -m 'Renamed files to files.upstream'
Created commit 7b6e9c5: Renamed files to files.upstream
 1 files changed, 0 insertions(+), 0 deletions(-)
 rename {files => files.upstream}/delete.me (100%)
jgoerzen@katherina:/tmp/testrepo$ git status
# On branch testbranch
nothing to commit (working directory clean)

#######
# We can still change branches here...

jgoerzen@katherina:/tmp/testrepo$ git co master
Switched to branch "master"
jgoerzen@katherina:/tmp/testrepo$ git co testbranch
Switched to branch "testbranch"

#######
# Now here comes bug #1...

jgoerzen@katherina:/tmp/testrepo$ ln -s /tmp/nonexistant files
jgoerzen@katherina:/tmp/testrepo$ git add files
jgoerzen@katherina:/tmp/testrepo$ git commit -m 'Added files as symlink'
jgoerzen@katherina:/tmp/testrepo$ git status
# On branch testbranch
nothing to commit (working directory clean)
jgoerzen@katherina:/tmp/testrepo$ git checkout master
fatal: Untracked working tree file 'files.upstream/delete.me' would be removed by merge.

#######
# Hrm, but that file really is tracked, AND it didn't show up in git status!

$ git log files.upstream/delete.me | cat
commit 7b6e9c5d0fb268b5bca4985b407fe35aa2a7bd6d
Author: John Goerzen <jgoerzen@complete.org>
Date:   Wed Mar 19 18:12:12 2008 -0500

    Renamed files to files.upstream

#######
# Well, let's work around this and check out master anyhow.

jgoerzen@katherina:/tmp/testrepo$ git checkout -f master
Switched to branch "master"
jgoerzen@katherina:/tmp/testrepo$ ls -l
total 0
drwxr-xr-x 2 jgoerzen jgoerzen 22 Mar 19 18:13 files
drwxr-xr-x 2 jgoerzen jgoerzen 22 Mar 19 18:12 files.upstream

#######
# Yeow!  What's files.upstream doing here?  It wasn't on this branch, and
# we had no uncommitted changes on the other branch.

jgoerzen@katherina:/tmp/testrepo$ rm -r files.upstream
jgoerzen@katherina:/tmp/testrepo$ git rm files.upstream/delete.me
rm 'files.upstream/delete.me'
jgoerzen@katherina:/tmp/testrepo$ git status
# On branch master
nothing to commit (working directory clean)

#######
# Set up bug #2

jgoerzen@katherina:/tmp/testrepo$ echo foo > foo
jgoerzen@katherina:/tmp/testrepo$ git add foo
jgoerzen@katherina:/tmp/testrepo$ git commit -m 'Added foo'
jgoerzen@katherina:/tmp/testrepo$ git checkout testbranch
Switched to branch "testbranch"
jgoerzen@katherina:/tmp/testrepo$ ls -l
total 0
lrwxrwxrwx 1 jgoerzen jgoerzen 16 Mar 19 18:14 files -> /tmp/nonexistant
drwxr-xr-x 2 jgoerzen jgoerzen 22 Mar 19 18:14 files.upstream
jgoerzen@katherina:/tmp/testrepo$ git merge master
fatal: Entry 'files/delete.me' would be overwritten by merge. Cannot merge.
Merge with strategy recursive failed.

########
# And there's bug #2
#
# Note that it doesn't matter what strategy is attempted.

Thanks for any insight.

-- John

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-03-20  4:46 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-19 23:21 Two bugs with renaming John Goerzen
2008-03-20  0:51 ` Junio C Hamano
2008-03-20  2:06   ` Jeff King
2008-03-20  2:30   ` John Goerzen
2008-03-20  0:56 ` Jeff King
2008-03-20  1:24 ` Björn Steinbrink
2008-03-20  4:12 ` Linus Torvalds
2008-03-20  4:22   ` Linus Torvalds
2008-03-20  4:45   ` Junio C Hamano

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).