git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [BUG] 'git mv a/fileA b/fileB' causes 'c/fileC' to be deleted

From
Junio C Hamano <junkio@cox.net>
Date
Oct 1, 2006, 17:34 UTC
Message-ID
<7vpsdc0wkz.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<750170aa0610010721p66899ba5pcc7efa13be4cd10a@mail.gmail.com>
"Michael Cassar" <m.e.cassar@gmail.com> writes:
> Is this just me being an idiot, or could there be a bigger problem
> here?
>
> Please CC me in any replies.

There could be a bigger problem, but it does not seem to easily reproduce as you noted in the message. It could be that some unrelated thing in the working tree is playing a role in this breakage, but I do not think of offhand what that is.

Here is what I just ran.

-- >8 cut >8 -- #!/bin/sh

report () {
	echo
	echo "* $*"
	echo
}

rm -fr test0 mkdir test0 cd test0

report working tree preparation mkdir -p partA papers/unsorted papers/all-papers echo outline >partA/outline.txt echo Thesis >papers/unsorted/Thesis.pdf

report repository initialization git init-db

report initial import git add papers partA git commit -m 'initial' git show --root --stat --summary

report run mv git mv papers/unsorted/Thesis.pdf papers/all-papers/Thesis.pdf

report before commit git diff --stat HEAD

report make a commit git commit -m 'moved a file'

report final result git show --stat --summary -- 8< cut 8< --

and I did not see the breakage. Care to show a bit more details on your working tree? I do not think this depends on any contents of the individual files, but

Show 19 quoted lines
> Here is a transcript. These results are reproducable using the same
> files, but I can't seem to reproduce with different files.
>
> ## Create initial respository
>
> [mike@simba ~] git version
> git version 1.4.2.1
>
> [mike@simba ~] mkdir repos; cd repos
>
> [mike@simba ~/repos] git init-db
> defaulting to local storage area
>
> [mike@simba ~/repos] cp -r ~/thesis_work/* .
>
> [mike@simba ~/repos] ls -a
> .  ..  .git  metathesis  notes  papers  partA
>
> [mike@simba ~/repos] git add metathesis notes papers partA

output from "find metathesis notes papers partA -ls" and "git ls-files -s" at this step may be a starter.

Previous: Michael CassarNext: Michael Cassar
Message 2 of 5 in “[BUG] 'git mv a/fileA b/fileB' causes 'c/fileC' to be deleted”
  1. Michael CassarOct 1, 2006
  2. Junio C HamanoOct 1, 2006
  3. Michael CassarOct 2, 2006
  4. Junio C HamanoOct 2, 2006
  5. Junio C HamanoOct 2, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.