Bug 314232

Summary: git commit cannot rename files: instead it creates and deletes in a two-stage commit process.
Product: [Developer tools] kdevplatform Reporter: Jeremy W. Murphy <jeremy.william.murphy>
Component: gitAssignee: kdevelop-bugs-null
Status: RESOLVED FIXED    
Severity: normal CC: aleixpol
Priority: NOR    
Version: git master   
Target Milestone: 1.3.0   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:

Description Jeremy W. Murphy 2013-02-01 04:20:52 UTC
Usually, renaming a file in a git repository is committed in one step as a rename.  However if you commit using the git plugin in KDevelop, then any renames are committed first as a file creation (of the new file), then the old files are deleted on the next commit.

It's not a problem with the rename action in the git plugin, because you can rename in KDevelop and then commit using git at the command line with no problems.
Comment 1 Aleix Pol 2013-02-27 16:04:00 UTC
Can you explain a little more what you mean? How do you rename then?
Comment 2 Jeremy W. Murphy 2013-02-28 00:03:19 UTC
Right-click on a file in the Projects tab and choose Rename.
Comment 3 Aleix Pol 2013-02-28 00:40:05 UTC
Here it worked fine. Can you please describe how you do it...?
Comment 4 Jeremy W. Murphy 2013-02-28 01:17:43 UTC
I just tested it again, still happens.

Create a file and Git->Add it to your project.
Using KDevelop, Rename the file.
At this point...
* $ git status: Says that the old file is renamed to the new file.
* Project->Git->Commit: the overview looks like it is deleting the old file and creating the new file, but only the new file is listed as Modified.
Now if I go ahead with the Commit in KDevelop, afterwards...
* $ git status: Deletion of the old file is listed as a change to be committed.  I.e.: although it was deleted from the filesystem, KDevelop did not commit the change to the repository.
So another commit has to be made to complete the rename, although now it hasn't been actually renamed, but files with different names and identical content were created and then deleted in consecutive commits.
Comment 5 Aleix Pol 2013-03-01 03:36:28 UTC
Git commit f07500c0a6e38cb5f32280f4bc7f116046eb9c67 by Aleix Pol.
Committed on 01/03/2013 at 04:35.
Pushed by apol into branch 'master'.

Improve git status support

When a file is renamed, report the name that has been removed too, so that
when we commit it, the removed files are passed too.

M  +18   -13   plugins/git/gitplugin.cpp

http://commits.kde.org/kdevplatform/f07500c0a6e38cb5f32280f4bc7f116046eb9c67
Comment 6 Aleix Pol 2013-03-01 03:36:51 UTC
Git commit 09d1eb16d35c2401dcf0fe2dcf5526efde31422b by Aleix Pol.
Committed on 01/03/2013 at 04:35.
Pushed by apol into branch '1.5'.

Improve git status support

When a file is renamed, report the name that has been removed too, so that
when we commit it, the removed files are passed too.

M  +18   -13   plugins/git/gitplugin.cpp

http://commits.kde.org/kdevplatform/09d1eb16d35c2401dcf0fe2dcf5526efde31422b