Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 529314

Summary: FetchCommand with duplicate refspec results in "Duplicate ref" error
Product: [Technology] JGit Reporter: Marc Strapetz <marc.strapetz>
Component: JGitAssignee: Project Inbox <jgit.core-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: matthias.sohn, michal.barano, twolf
Version: 4.9   
Target Milestone: 4.9.4   
Hardware: PC   
OS: All   
See Also: https://git.eclipse.org/r/114823
https://bugs.eclipse.org/bugs/show_bug.cgi?id=529400
https://git.eclipse.org/r/127669
https://git.eclipse.org/c/jgit/jgit.git/commit/?id=65a0cfc82a75146113b9e138cb9fdd5f04c018d0
Whiteboard:

Description Marc Strapetz CLA 2017-12-30 05:33:03 EST
When having a duplicate duplicate refspec in the .git/config file, like:

[remote "test"]
    fetch = +refs/heads/*:refs/remotes/origin/*
    fetch = refs/heads/*:refs/remotes/origin/*

Invoking FetchCommand will fail when trying to delete a stale ref:

Caused by: java.io.IOException: Duplicate ref: refs/remotes/origin/branch
	at org.eclipse.jgit.internal.storage.file.PackedBatchRefUpdate.lockLooseRefs(PackedBatchRefUpdate.java:347)
	at org.eclipse.jgit.internal.storage.file.PackedBatchRefUpdate.execute(PackedBatchRefUpdate.java:192)
	at org.eclipse.jgit.lib.BatchRefUpdate.execute(BatchRefUpdate.java:633)
	at org.eclipse.jgit.transport.FetchProcess.executeImp(FetchProcess.java:225)
	... 28 more
Comment 1 Eclipse Genie CLA 2017-12-30 05:35:13 EST
New Gerrit change created: https://git.eclipse.org/r/114823
Comment 2 MichaƂ Baranowski CLA 2018-03-07 05:28:45 EST
Hi, When we can expect the bug to be fixed?
Comment 3 Eclipse Genie CLA 2018-08-19 15:03:49 EDT
New Gerrit change created: https://git.eclipse.org/r/127669
Comment 4 Eclipse Genie CLA 2018-08-22 22:44:07 EDT
Gerrit change https://git.eclipse.org/r/127669 was merged to [stable-4.9].
Commit: http://git.eclipse.org/c/jgit/jgit.git/commit/?id=65a0cfc82a75146113b9e138cb9fdd5f04c018d0
Comment 5 Thomas Wolf CLA 2018-08-23 07:07:53 EDT
Was fixed on stable-4.9, now needs merging up. Set Target milestone to 4.9.3.
Comment 6 Thomas Wolf CLA 2018-08-25 13:21:31 EDT
Fixed on stable-4.9, so it would be in 4.9.4, 4.10.1, 4.11.2, 5.0.3, and it is in 5.1 (current master), which is available from the EGit nightly update site at http://download.eclipse.org/egit/updates-nightly/ .