Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » Problem with renaming file
Problem with renaming file [message #649285] Tue, 18 January 2011 15:26 Go to next message
razu  is currently offline razu Friend
Messages: 1
Registered: January 2011
Junior Member
Hi,

I'm trying to rename a file in my project, but EGit detects that operation as removing file and adding new one. In the result I'm loosing history of that file.

Is anyone has that problem too?

Version of eclipse: eclipse-java-helios-SR1-linux-gtk-x86_64
Version of EGit/JGit: 0.10.1
Re: Problem with renaming file [message #649429 is a reply to message #649285] Wed, 19 January 2011 08:49 Go to previous messageGo to next message
Marcin  is currently offline Marcin Friend
Messages: 1
Registered: January 2011
Junior Member
Hi all,

i guess my problem is somehow connected to above. After conflict, followed by file rename I lose git revision history and eventualy I can lose file changes!

I tried to write it down in a sort of algoritm:

Lets say person A commits and pushes file C rename operation to repository.
Then person B pulls changes and discovers a conflict on file C.
After resolving conflict, person B commits to repository but forgets to push.
Next, person A issues another C file rename operation (commit,push).
When person B try to push, finds it impossible and needs to pull changes.
That makes him/her:
- lose git revision history. Running 'Show in history' on project root show less revisions than executing 'git log'.
- becase of file rename (remove, add operation) person B can't merge his/her changes and loses them! My guess is that EGIT loses file C history before the rename and becouse of that person B can't make a successful merge.

I wanted to use git in my production project but this bug is too dangerous to even start with EGIT.

I'm using SpringSource Tool Suite (Build Id: 201008251000) with EGIT 0.10.1 on 64bit Ubuntu.
If you have any questions please ask.

best regards
Marcin

Re: Problem with renaming file [message #650171 is a reply to message #649285] Sat, 22 January 2011 10:09 Go to previous messageGo to next message
Robin Rosenberg is currently offline Robin RosenbergFriend
Messages: 332
Registered: July 2009
Senior Member
razu skrev 2011-01-18 16:26:
> Hi,
>
> I'm trying to rename a file in my project, but EGit detects that
> operation as removing file and adding new one. In the result I'm loosing
> history of that file.
>
> Is anyone has that problem too?
>
> Version of eclipse: eclipse-java-helios-SR1-linux-gtk-x86_64
> Version of EGit/JGit: 0.10.1

Git does not track file renames. It just add the new name and removes
the old name. The C version tries to track content moves during various
operations, e.g. merge and log (on demand). There is code in JGit to
perform rename detection, but it is only invoked in a few places yet and
not from EGit.

Adding the rename/rewrite detected to EGit is probably not that hard, in
fact it should be trivial, but you also want it to be shown in a
meaningful way, which leaves some opportunity for creativity since that
could probably be implemented in more than one way. There are also many
places where you want it.

Quickdiff (only Follow, not Rewrite)
History (Follow and Rewrite, how to annotate?)
Compare Version (Rename only, Different names, recursive rename detection?)
Commit Dialog (Both, how to annotate?)
Decorators (how to decorate)

This bug talks about the history view:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=302549

I added separate bugs for the others too, since they need unique
solutions in the UI.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=335081
https://bugs.eclipse.org/bugs/show_bug.cgi?id=335082
https://bugs.eclipse.org/bugs/show_bug.cgi?id=335083
https://bugs.eclipse.org/bugs/show_bug.cgi?id=335084


-- robin
Re: Problem with renaming file [message #1805363 is a reply to message #650171] Fri, 12 April 2019 16:25 Go to previous messageGo to next message
Antoine Tran is currently offline Antoine TranFriend
Messages: 2
Registered: April 2019
Junior Member
Hi,

From all the issues referenced here, it seems the fixes are merged before egit / jgit 5.3.0.2019031308. However, this is the version I use in Eclipse 2019-03 and I still cannot rebase on a branch that has renamed files. Using git 2.21.0 with the same rebase, I have no issue. With Egit, I have conflict and I compare a blank file with the old file. And I tried updating eclipse but got nothing. Also, I thought the rename could be resolved using merge recursive strategy, but I couldn't change the merge strategy in preference, as this is imposed by Jgit.

Is-there something I missed? Thank you.
Re: Problem with renaming file [message #1805730 is a reply to message #1805363] Mon, 22 April 2019 19:37 Go to previous message
Thomas Wolf is currently offline Thomas WolfFriend
Messages: 576
Registered: August 2016
Senior Member
JGit doesn't implement rename detection in merges. Compare bug 372606.
Previous Topic:Rename merge does not work - is there any workaround?
Next Topic:commit-id plugin reports that .gitconfig is invalid
Goto Forum:
  


Current Time: Fri Apr 19 18:45:01 GMT 2024

Powered by FUDForum. Page generated in 0.04143 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top