Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] Wrong values returned in MergeResult#getConflicts()

Hi,

I am sending the files with the changes attached, just in case i could not publish the changes.

Best regards,

Alcemir Santos
www.alcemirsantos.com

Attachment: ConflictBasedRepositoryTestCase.java
Description: Binary data

Attachment: MergeResult.java
Description: Binary data


On Apr 22, 2016, at 8:29 PM, Alcemir R. Santos <alcemir.santos@xxxxxxxxx> wrote:

Hi,

I added assertions to the test case and reimplemented the method in a a way that fits to the documentation. The test case is green but the ideal would have different others cases.

 I am trying to publish the edit, but I am getting:
 "Code Review - Error
  500 Internal server error"
while trying to publish the changes.


Atenciosamente,
--
Alcemir Rodrigues Santos
.:: RiSE Labs 
.:: www.alcemirsantos.com

"Quem é John Galt?"

On Fri, Apr 22, 2016 at 5:31 PM, Alcemir R. Santos <alcemir.santos@xxxxxxxxx> wrote:
Hi,

Please let me know if I can somehow help in the way of finding a solution. 

I am not really familiar with the JGit code (just started to use it), but as I also have the environment for contribution set here I will also try to find one.


Best regards,
--
Alcemir Rodrigues Santos
.:: RiSE Labs 
.:: www.alcemirsantos.com

"Who's John Galt?"

On Fri, Apr 22, 2016 at 5:01 PM, Christian Halstrick <christian.halstrick@xxxxxxxxx> wrote:
Hi,

I wrote some parts of the code and I have to admit: I also don't fully understand org.eclipse.jgit.api.MergeResult anymore. There is the low-level org.eclipse.jgit.merge.MergeResult and this seems to have the right content. But the api level class contains some bugs (and is far to complicated if it takes so long to analyse this problem). What I did up to know: I temporarily took your unit test and brought it to JGit test classes (https://git.eclipse.org/r/#/c/71232/). I added more toString() methods to MergeResult/MergeChunk (https://git.eclipse.org/r/#/c/71231/). Additionally I added some System.out.println to the test and when I execute the test I get what I pasted below. The low-level MergeResults which are added to the api level MergeResult show correctly how the conflicts are detected. But the API level MergeResult seem to miss some information. Will continue to investigate:

Here is what I get when I do the merge with native git and inspect the workingtreefiles afterwards (btw: I have configured "git config merge.conflictstyle=diff3"):

chris@vblub14:/tmp/jgit_test_8097925874040451262_tmp/tmp_4912665237122255536$ cat Bar.java 
1
2
<<<<<<< HEAD
3
4-master
||||||| merged common ancestors
3
4
=======
3-side
4-side
5
>>>>>>> f5c2c18e746e847de0b7a45329d08c291538b094
chris@vblub14:/tmp/jgit_test_8097925874040451262_tmp/tmp_4912665237122255536$ cat Foo.java 
1
2
3
<<<<<<< HEAD
4-master
||||||| merged common ancestors
4
=======
4-side
>>>>>>> f5c2c18e746e847de0b7a45329d08c291538b094
5
6
7
8

Here is the output of your test which I incorporated into jgit in https://git.eclipse.org/r/#/c/71232:

Adding org.eclipse.jgit.merge.MergeResult: {#sequences:3, chunks:[{state:NO_CONFLICT, sequenceIndex:0, begin:0, end:3}, {state:FIRST_CONFLICTING_RANGE, sequenceIndex:1, begin:3, end:4}, {state:NEXT_CONFLICTING_RANGE, sequenceIndex:2, begin:3, end:4}, {state:NO_CONFLICT, sequenceIndex:0, begin:4, end:8}]}
Adding org.eclipse.jgit.merge.MergeResult: {#sequences:3, chunks:[{state:NO_CONFLICT, sequenceIndex:0, begin:0, end:2}, {state:FIRST_CONFLICTING_RANGE, sequenceIndex:1, begin:2, end:4}, {state:NEXT_CONFLICTING_RANGE, sequenceIndex:2, begin:2, end:5}]}
Conflicts in file Foo.java
  Conflict #0
    Chunk for commit d0b09434547df8d59783f44c11f24b5b8e11c61a 1250379778 -t--sp starts on line #0
    Chunk for commit 9b1b18f5525cfec97e326f9bbf2385ef7a30b2ab 1250379778 -t--sp starts on line #3
Conflicts in file Bar.java
  Conflict #0
    Chunk for commit d0b09434547df8d59783f44c11f24b5b8e11c61a 1250379778 -t--sp starts on line #0
    Chunk for commit 9b1b18f5525cfec97e326f9bbf2385ef7a30b2ab 1250379778 -t--sp starts on line #2
mResult.toStringExt(): {mergedCommits:[d0b09434547df8d59783f44c11f24b5b8e11c61a, 9b1b18f5525cfec97e326f9bbf2385ef7a30b2ab], base:f84a5343f91466a0f0cf50c90d766090970a7c7c, newHead:null, mergeStatus:Conflicting, description:null, mergeStrategy:recursive, failingPaths:[], checkoutConflicts:[], conflicts:[Foo.java->[[0][0]:0, [0][1]:3, [0][2]:3], Bar.java->[[0][0]:0, [0][1]:2, [0][2]:2]]}

Ciao
  Chris




Back to the top