Skip to content

Commit afc3655

Browse files
committed
Merge branch 'master' into stable-7.3
* master: Update maven plugins Use the same ordering/locking in delete() as C git Change-Id: Ie31317681b79a2fd281cebd16e5052b1bde394fb
2 parents 5ed259f + 795f4d9 commit afc3655

File tree

3 files changed

+43
-37
lines changed

3 files changed

+43
-37
lines changed

org.eclipse.jgit.packaging/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
<properties>
3232
<java.version>17</java.version>
33-
<tycho-version>4.0.12</tycho-version>
33+
<tycho-version>4.0.13</tycho-version>
3434
<target-platform>jgit-4.32</target-platform>
3535
<project.build.outputTimestamp>${git.commit.time}</project.build.outputTimestamp>
3636
</properties>
@@ -233,7 +233,7 @@
233233
<plugin>
234234
<groupId>io.github.git-commit-id</groupId>
235235
<artifactId>git-commit-id-maven-plugin</artifactId>
236-
<version>9.0.1</version>
236+
<version>9.0.2</version>
237237
<executions>
238238
<execution>
239239
<id>get-the-git-infos</id>

org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -701,41 +701,47 @@ void delete(RefDirectoryUpdate update) throws IOException {
701701
}
702702
String name = dst.getName();
703703

704-
// Write the packed-refs file using an atomic update. We might
705-
// wind up reading it twice, before and after the lock, to ensure
706-
// we don't miss an edit made externally.
707-
PackedRefList packed = getPackedRefs();
708-
if (packed.contains(name)) {
709-
inProcessPackedRefsLock.lock();
704+
// Get and keep the packed-refs lock while updating packed-refs and
705+
// removing any loose ref
706+
inProcessPackedRefsLock.lock();
707+
try {
708+
LockFile lck = lockPackedRefsOrThrow();
710709
try {
711-
LockFile lck = lockPackedRefsOrThrow();
712-
try {
710+
// Write the packed-refs file using an atomic update. We might
711+
// wind up reading it twice, before and after checking if the
712+
// ref to delete is included or not, to ensure
713+
// we don't rely on a PackedRefList that is a result of in-memory
714+
// or NFS caching.
715+
PackedRefList packed = getPackedRefs();
716+
if (packed.contains(name)) {
717+
// Force update our packed-refs snapshot before writing
713718
packed = refreshPackedRefs();
714719
int idx = packed.find(name);
715720
if (0 <= idx) {
716721
commitPackedRefs(lck, packed.remove(idx), packed, true);
717722
}
718-
} finally {
719-
lck.unlock();
720723
}
721-
} finally {
722-
inProcessPackedRefsLock.unlock();
723-
}
724-
}
725724

726-
RefList<LooseRef> curLoose, newLoose;
727-
do {
728-
curLoose = looseRefs.get();
729-
int idx = curLoose.find(name);
730-
if (idx < 0)
731-
break;
732-
newLoose = curLoose.remove(idx);
733-
} while (!looseRefs.compareAndSet(curLoose, newLoose));
725+
RefList<LooseRef> curLoose, newLoose;
726+
do {
727+
curLoose = looseRefs.get();
728+
int idx = curLoose.find(name);
729+
if (idx < 0) {
730+
break;
731+
}
732+
newLoose = curLoose.remove(idx);
733+
} while (!looseRefs.compareAndSet(curLoose, newLoose));
734734

735-
int levels = levelsIn(name) - 2;
736-
delete(logFor(name), levels);
737-
if (dst.getStorage().isLoose()) {
738-
deleteAndUnlock(fileFor(name), levels, update);
735+
int levels = levelsIn(name) - 2;
736+
delete(logFor(name), levels);
737+
if (dst.getStorage().isLoose()) {
738+
deleteAndUnlock(fileFor(name), levels, update);
739+
}
740+
} finally {
741+
lck.unlock();
742+
}
743+
} finally {
744+
inProcessPackedRefsLock.unlock();
739745
}
740746

741747
modCnt.incrementAndGet();

pom.xml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,10 @@
138138
<maven-javadoc-plugin-version>3.11.2</maven-javadoc-plugin-version>
139139
<gson-version>2.13.1</gson-version>
140140
<bouncycastle-version>1.80</bouncycastle-version>
141-
<spotbugs-maven-plugin-version>4.9.2.0</spotbugs-maven-plugin-version>
142-
<maven-project-info-reports-plugin-version>3.8.0</maven-project-info-reports-plugin-version>
141+
<spotbugs-maven-plugin-version>4.9.3.0</spotbugs-maven-plugin-version>
142+
<maven-project-info-reports-plugin-version>3.9.0</maven-project-info-reports-plugin-version>
143143
<maven-jxr-plugin-version>3.6.0</maven-jxr-plugin-version>
144-
<maven-surefire-plugin-version>3.5.2</maven-surefire-plugin-version>
144+
<maven-surefire-plugin-version>3.5.3</maven-surefire-plugin-version>
145145
<maven-surefire-report-plugin-version>${maven-surefire-plugin-version}</maven-surefire-report-plugin-version>
146146
<maven-compiler-plugin-version>3.14.0</maven-compiler-plugin-version>
147147
<plexus-compiler-version>2.13.0</plexus-compiler-version>
@@ -305,7 +305,7 @@
305305
<plugin>
306306
<groupId>org.jacoco</groupId>
307307
<artifactId>jacoco-maven-plugin</artifactId>
308-
<version>0.8.12</version>
308+
<version>0.8.13</version>
309309
</plugin>
310310
<plugin>
311311
<groupId>org.apache.maven.plugins</groupId>
@@ -337,12 +337,12 @@
337337
<plugin>
338338
<groupId>org.apache.maven.plugins</groupId>
339339
<artifactId>maven-deploy-plugin</artifactId>
340-
<version>3.1.3</version>
340+
<version>3.1.4</version>
341341
</plugin>
342342
<plugin>
343343
<groupId>org.apache.maven.plugins</groupId>
344344
<artifactId>maven-install-plugin</artifactId>
345-
<version>3.1.3</version>
345+
<version>3.1.4</version>
346346
</plugin>
347347
<plugin>
348348
<groupId>org.apache.maven.plugins</groupId>
@@ -357,7 +357,7 @@
357357
<plugin>
358358
<groupId>org.springframework.boot</groupId>
359359
<artifactId>spring-boot-maven-plugin</artifactId>
360-
<version>3.4.3</version>
360+
<version>3.5.0</version>
361361
</plugin>
362362
<plugin>
363363
<groupId>org.eclipse.dash</groupId>
@@ -623,7 +623,7 @@
623623
<plugin>
624624
<groupId>io.github.git-commit-id</groupId>
625625
<artifactId>git-commit-id-maven-plugin</artifactId>
626-
<version>9.0.1</version>
626+
<version>9.0.2</version>
627627
<executions>
628628
<execution>
629629
<id>get-the-git-infos</id>
@@ -642,7 +642,7 @@
642642
<plugin>
643643
<groupId>org.codehaus.gmavenplus</groupId>
644644
<artifactId>gmavenplus-plugin</artifactId>
645-
<version>4.1.1</version>
645+
<version>4.2.0</version>
646646
<dependencies>
647647
<dependency>
648648
<groupId>org.apache.groovy</groupId>

0 commit comments

Comments
 (0)