guberm / tortoisegit

Automatically exported from code.google.com/p/tortoisegit
0 stars 0 forks source link

The status of files which are not checked when commit will be confused #2529

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago

Let us suppose we have 3 files, the contents of these 3 files are all the same, 
just call them 1.txt 2.txt 3.txt, now we rename 1.txt to 11.txt, delete 2.txt 
but keep local file, delete 3.txt not keep local file. and modify some other 
files, such as 4.txt
now the staus of the files are like this:
$ git status
On branch master
Your branch is ahead of 'origin/master' by 13 commits.
(use "git push" to publish your local commits)

Changes to be committed:
(use "git reset HEAD ..." to unstage)

    renamed:    1.txt -> 11.txt
    deleted:    2.txt
    deleted:    3.txt

Changes not staged for commit:
(use "git add ..." to update what will be committed)
(use "git checkout -- ..." to discard changes in working directory)

    modified:   4.txt

Untracked files:
(use "git add ..." to include in what will be committed)

    2.txt

now we use tortoise git to commit, on the commit dialogbox, we only select 
4.txt, make the other 3 files unselected, and then commit, after commitment ,we 
can see the status of files is like this

$ git status
On branch master
Your branch is ahead of 'origin/master' by 14 commits.
(use "git push" to publish your local commits)

Changes not staged for commit:
(use "git add/rm ..." to update what will be committed)
(use "git checkout -- ..." to discard changes in working directory)

    deleted:    1.txt
    deleted:    3.txt

Untracked files:
(use "git add ..." to include in what will be committed)

    11.txt

no changes added to commit (use "git add" and/or "git commit -a")

the status now is different from that before commit,
1) 2.txt become a normal git file, not a deleted file
2) 1.txt has been renamed to 11.txt, but now appears, that means 1.txt and 
11.txt exist at the same time
3) 11.txt becomes a new file, not a renamed file

this time we commit again and select all the files to commit, we can see the 
file 2.txt which we want to delete now become a normal file.

I think when we handle those unchecked rename files when commit we should 
consider the original file name and mofied file name. When add those unchecked 
files to index after commit, we should use git_index_remove API to remove the 
original file from the index

The version of TortoiseGit is 1.8.8.0
git version is 1.9.0.msysgit.0  
On Win7

Original issue reported on code.google.com by 79113...@qq.com on 26 Jun 2015 at 9:21

GoogleCodeExporter commented 9 years ago
The version of TortoiseGit is 1.8.8.0
git version is 1.9.0.msysgit.0  

Both version are too old.
ATM, the last one are
TortoiseGit 1.8.14.0
Git for Windows 1.9.5.msysgit.1
Please update.

Original comment by yuelinho...@gmail.com on 26 Jun 2015 at 9:34

GoogleCodeExporter commented 9 years ago
I just tested the your steps with TortoiseGit 1.8.14.0 and Gfw 1.9.5.msysgit.1.
The behavior is different.

Do you want TortoiseGit to memorize the original status of un-selected files 
which have been removed from index and re-do the remove operation after first 
commit?

Original comment by yuelinho...@gmail.com on 26 Jun 2015 at 12:22