Bug report: 'git rebase' confusing files with initially equal content

From: Bernhard Graf <hidden>
Date: 2016-07-14 14:18:11

With the following steps content from one file ends up in another file 
by using 'git rebase' (and clobbers the original content).
It is rather straight forward and I discovered this behaviour when 
trying to replay http://gitforteams.com/resources/rebasing.html .
The special thing is, that both files have the same content at start.

   $ mkdir rebase
   $ cd rebase
   git --version
   git version 2.9.0
   $ git init
   Initialized empty Git repository in /home/graf/projects/git/rebase/.git/
   $ echo stub >file1
   $ echo stub >file2
   $ git add .
   $ git commit -m 'add stub'
   [master (root-commit) 0cb53e9] Add stubs
    2 files changed, 2 insertions(+)
    create mode 100644 file1
    create mode 100644 file2
   $ git checkout -b feature/1
   Switched to a new branch 'feature/1'
   $ echo line1 >file1
   $ git commit -am 'Add content'
   [feature/1 2f3dcc7] Add content
    1 file changed, 1 insertion(+), 1 deletion(-)
   $ git checkout master
   Switched to branch 'master'
   $ git rm file1
   rm 'file1'
   $ git commit -m 'Delete file1'
   [master 1b18590] Delete file1
    1 file changed, 1 deletion(-)
    delete mode 100644 file1
   $ git checkout feature/1
   Switched to branch 'feature/1'
   $ echo line2 >>file1
   $ git commit -am 'Add more content'
   [feature/1 36be376] Add more content
    1 file changed, 1 insertion(+)
   $ cat file1
   line1
   line2
   $ cat file2
   stub
   $ git rebase master
   First, rewinding head to replay your work on top of it...
   Applying  Add content
   Using index info to reconstruct a base tree...
   A	file1
   Falling back to patching base and 3-way merge...
   Auto-merging file2
   Applying  Add more content
   Using index info to reconstruct a base tree...
   A	file1
   Falling back to patching base and 3-way merge...
   Auto-merging file2
   $ ls -l
   total 8
   -rw-r--r--  1 graf  users  12 14 Jul 13:16 file2
   $ cat file2
   line1
   line2

If instead file1 and file2 initially had different contents, 'git 
rebase' runs into a merge conflict, so the user can fix it appropriatly.

I suppose this is related to the fact that Git manages the repo by file 
contents only. Still this is nothing what I would expect (and neither 
accept).

-- 
Bernhard Graf
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help