Community
Participate
Working Groups
Hello; We ran into an interesting bug with JGit with the use of FetchCommand openjdk version "1.8.0_232" OpenJDK Runtime Environment (build 1.8.0_232-8u232-b09-1~deb9u1-b09) jgit version: org.eclipse.jgit:org.eclipse.jgit:5.6.1.202002131546-r Relevant snippet: Git git = Git.open(new File("./my-repo")); FetchCommand cmd = git.fetch(); FetchResult result = cmd.call(); The Git directory contains a ref in the *packed_ref* file called `origin/release` cat packed-refs| grep origin/release 32db1780da0c32959a312496e556af4bf701767c refs/remotes/origin/release One of the commands incoming are to create a new ref `origin/release/v1.18` CREATE: 0000000000000000000000000000000000000000 579d87aea9a5558b6bde512c2da672f30361ee69 refs/remotes/origin/release/v1.18 JGit tries to detect this case in checkConflictingNames https://github.com/eclipse/jgit/blob/f40b39345cd9b54473ee871bff401fe3d394ffe3/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackedBatchRefUpdate.java#L273 https://github.com/eclipse/jgit/blob/f40b39345cd9b54473ee871bff401fe3d394ffe3/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackedBatchRefUpdate.java#L165 Unfortunately, the RefDb update is aborted however the FetchResult is returned *successfully* giving the appearance that everything was OK. I consider this to be a bug; and the aborted transaction should be surfaced to the caller.
If it wasn't clear from the first comment: since a prefix of the ref (origin/release) already exists in the ref database; the creation of the new ref (release/v1.18) & all other refs from the `fetch` result are aborted.