You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When executing JGit's FetchCommand with setRemoveDeletedRefs(true), the operation fails with LOCK_FAILURE when attempting to delete remote-tracking branches that have been deleted from the remote repository. This occurs specifically when new branches are created with names that are prefixes of the deleted branches.
Use Case Context
Many CI/CD and build systems maintain a local cache of Git repositories to:
Reduce network bandwidth usage
Speed up build times
Minimize load on Git servers
These cache repositories typically:
Only perform fetch operations to stay up-to-date
Use checkout operations to switch to specific revisions
Never perform write operations other than updating remote refs
Need to clean up deleted remote refs to prevent accumulation of stale references
Steps to Reproduce
Initial Setup:
# Create and initialize original repository
mkdir original-repo &&cd original-repo
git init
# Create initial commitecho"test"> test.txt
git add test.txt
git commit -m "Initial commit"# Create a branch with a longer name
git checkout -b qa/20250321
git push origin qa/20250321
Clone Setup:
# Clone the repository
git clone original-repo /tmp/repoCloned
Branch Manipulation:
# In original repository
git push origin --delete qa/20250321 # Delete remote branch
git branch -d qa/20250321 # Delete local branch# Create new branch that is a prefix of deleted branch
git checkout -b qa
git push origin qa
Run the following Java code against the cloned repository:
The operation fails with LOCK_FAILURE when attempting to update the references. Example output:
Expected behavior
The fetch operation should successfully remove the deleted remote-tracking branch (qa/20250321) and create the new remote-tracking branch (qa), keep consistent with git fetch --prune.
Relevant log output
Other information
No response
The text was updated successfully, but these errors were encountered:
Version
7.2.0
Operating System
MacOS, Linux/Unix
Bug description
When executing JGit's
FetchCommand
withsetRemoveDeletedRefs(true)
, the operation fails withLOCK_FAILURE
when attempting to delete remote-tracking branches that have been deleted from the remote repository. This occurs specifically when new branches are created with names that are prefixes of the deleted branches.Use Case Context
Many CI/CD and build systems maintain a local cache of Git repositories to:
These cache repositories typically:
Steps to Reproduce
Initial Setup:
Clone Setup:
# Clone the repository git clone original-repo /tmp/repoCloned
Branch Manipulation:
Run the following Java code against the cloned repository:
Actual behavior
The operation fails with
LOCK_FAILURE
when attempting to update the references. Example output:Expected behavior
The fetch operation should successfully remove the deleted remote-tracking branch (
qa/20250321
) and create the new remote-tracking branch (qa
), keep consistent withgit fetch --prune
.Relevant log output
Other information
No response
The text was updated successfully, but these errors were encountered: