Re: [BUG] 'git mv a/fileA b/fileB' causes 'c/fileC' to be deleted
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:42
"Michael Cassar" [off-list ref] 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
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.