Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] Difference of behavior between native git and jgit

Hi,

I push a review to reproduce the bug. Hope it can help you.
https://git.eclipse.org/r/19059


Le 28/11/2013 13:47, Halstrick, Christian a écrit :

Hi,

 

I think that’s a bug in JGit. I agree to Tomasz that jgit and cgit should behave the same here. I can also reproduce that in step 8 we loose the unsaved content in file a. That’s a severe bug you found. The semantic which git wants to provide is described in case 16 of [1]. When we are in step 8 of your test and inspect path ‘a’ then we find

-          In HEAD we see a tree

-          In worktree we see file with content x

-          In index we see file with content x

-          In MERGE (the commit which we want to checkout) a file with content y

In this situation ‘clean’ is true and ‘I==H’ and ‘I==M’ are both false. The result is that the checkout should fail. I’ll check why we haven’t detected that in our tests up to now and maybe a fix.

 

[1] https://www.kernel.org/pub/software/scm/git/docs/git-read-tree.html#_two_tree_merge

 

 

 

From: jgit-dev-bounces@xxxxxxxxxxx [mailto:jgit-dev-bounces@xxxxxxxxxxx] On Behalf Of Axel RICHARD
Sent: Donnerstag, 28. November 2013 10:49
To: jgit-dev@xxxxxxxxxxx
Subject: [jgit-dev] Difference of behavior between native git and jgit

 

Hi,

I found a difference between native git and jgit. I try a simple test with few steps :

1. Create file 'a'
2. Add & Commit
3. Create branch 'br1'
4. Replace file 'a' (Rm 'a') by folder 'a' with a file 'c' inside
5. Add & Commit
6. Replace folder 'a' (Rm 'a') by a new file 'a'
7. Add 'a'
8. Checkout branch 'br1'

With native git, I get this message after the checkout: "error: Your local changes to the following files would be overwritten by checkout: a
Please, commit your changes or stash them before you can switch branches. Aborting"
But with jgit, there is no error after calling the checkout, and the file 'a' is deleted from the working tree.

Is it a normal behavior to have this difference ? Did I do something wrong in my test case ?

Thank you in advance

-- 
Axel RICHARD

-- 
Axel RICHARD
begin:vcard
fn:Axel RICHARD
n:RICHARD;Axel
org:Obeo
adr;quoted-printable:BP 20773 - ESPACE PERFORMANCE LA FLEURIAYE;;7, boulevard Amp=C3=A8re;CARQUEFOU;;44481;FRANCE
email;internet:axel.richard@xxxxxxx
title:Eclipse Modeling Consultant
tel;work:02.51.13.55.88
url:http://www.obeo.fr
version:2.1
end:vcard


Back to the top