diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2025-06-03 10:13:58 +0200 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2025-06-03 10:13:58 +0200 |
commit | afc36558e22aba4a750d7e96b5c660ef2fc53f44 (patch) | |
tree | 6794553602da75963e7e85f98a45822958957db4 | |
parent | 5ed259fac4f45c46db36876c441cd4a1b080209a (diff) | |
parent | 795f4d97111f725dc29906e73f2ed5073193da09 (diff) | |
download | jgit-afc36558e22aba4a750d7e96b5c660ef2fc53f44.tar.gz jgit-afc36558e22aba4a750d7e96b5c660ef2fc53f44.zip |
Merge branch 'master' into stable-7.3
* master:
Update maven plugins
Use the same ordering/locking in delete() as C git
Change-Id: Ie31317681b79a2fd281cebd16e5052b1bde394fb
-rw-r--r-- | org.eclipse.jgit.packaging/pom.xml | 4 | ||||
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java | 58 | ||||
-rw-r--r-- | pom.xml | 18 |
3 files changed, 43 insertions, 37 deletions
diff --git a/org.eclipse.jgit.packaging/pom.xml b/org.eclipse.jgit.packaging/pom.xml index 8b25ff1674..ebda2fdbc8 100644 --- a/org.eclipse.jgit.packaging/pom.xml +++ b/org.eclipse.jgit.packaging/pom.xml @@ -30,7 +30,7 @@ <properties> <java.version>17</java.version> - <tycho-version>4.0.12</tycho-version> + <tycho-version>4.0.13</tycho-version> <target-platform>jgit-4.32</target-platform> <project.build.outputTimestamp>${git.commit.time}</project.build.outputTimestamp> </properties> @@ -233,7 +233,7 @@ <plugin> <groupId>io.github.git-commit-id</groupId> <artifactId>git-commit-id-maven-plugin</artifactId> - <version>9.0.1</version> + <version>9.0.2</version> <executions> <execution> <id>get-the-git-infos</id> diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java index 05f1ef53a1..319a9ed710 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java @@ -701,41 +701,47 @@ public class RefDirectory extends RefDatabase { } String name = dst.getName(); - // Write the packed-refs file using an atomic update. We might - // wind up reading it twice, before and after the lock, to ensure - // we don't miss an edit made externally. - PackedRefList packed = getPackedRefs(); - if (packed.contains(name)) { - inProcessPackedRefsLock.lock(); + // Get and keep the packed-refs lock while updating packed-refs and + // removing any loose ref + inProcessPackedRefsLock.lock(); + try { + LockFile lck = lockPackedRefsOrThrow(); try { - LockFile lck = lockPackedRefsOrThrow(); - try { + // Write the packed-refs file using an atomic update. We might + // wind up reading it twice, before and after checking if the + // ref to delete is included or not, to ensure + // we don't rely on a PackedRefList that is a result of in-memory + // or NFS caching. + PackedRefList packed = getPackedRefs(); + if (packed.contains(name)) { + // Force update our packed-refs snapshot before writing packed = refreshPackedRefs(); int idx = packed.find(name); if (0 <= idx) { commitPackedRefs(lck, packed.remove(idx), packed, true); } - } finally { - lck.unlock(); } - } finally { - inProcessPackedRefsLock.unlock(); - } - } - RefList<LooseRef> curLoose, newLoose; - do { - curLoose = looseRefs.get(); - int idx = curLoose.find(name); - if (idx < 0) - break; - newLoose = curLoose.remove(idx); - } while (!looseRefs.compareAndSet(curLoose, newLoose)); + RefList<LooseRef> curLoose, newLoose; + do { + curLoose = looseRefs.get(); + int idx = curLoose.find(name); + if (idx < 0) { + break; + } + newLoose = curLoose.remove(idx); + } while (!looseRefs.compareAndSet(curLoose, newLoose)); - int levels = levelsIn(name) - 2; - delete(logFor(name), levels); - if (dst.getStorage().isLoose()) { - deleteAndUnlock(fileFor(name), levels, update); + int levels = levelsIn(name) - 2; + delete(logFor(name), levels); + if (dst.getStorage().isLoose()) { + deleteAndUnlock(fileFor(name), levels, update); + } + } finally { + lck.unlock(); + } + } finally { + inProcessPackedRefsLock.unlock(); } modCnt.incrementAndGet(); @@ -138,10 +138,10 @@ <maven-javadoc-plugin-version>3.11.2</maven-javadoc-plugin-version> <gson-version>2.13.1</gson-version> <bouncycastle-version>1.80</bouncycastle-version> - <spotbugs-maven-plugin-version>4.9.2.0</spotbugs-maven-plugin-version> - <maven-project-info-reports-plugin-version>3.8.0</maven-project-info-reports-plugin-version> + <spotbugs-maven-plugin-version>4.9.3.0</spotbugs-maven-plugin-version> + <maven-project-info-reports-plugin-version>3.9.0</maven-project-info-reports-plugin-version> <maven-jxr-plugin-version>3.6.0</maven-jxr-plugin-version> - <maven-surefire-plugin-version>3.5.2</maven-surefire-plugin-version> + <maven-surefire-plugin-version>3.5.3</maven-surefire-plugin-version> <maven-surefire-report-plugin-version>${maven-surefire-plugin-version}</maven-surefire-report-plugin-version> <maven-compiler-plugin-version>3.14.0</maven-compiler-plugin-version> <plexus-compiler-version>2.13.0</plexus-compiler-version> @@ -305,7 +305,7 @@ <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> - <version>0.8.12</version> + <version>0.8.13</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> @@ -337,12 +337,12 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-deploy-plugin</artifactId> - <version>3.1.3</version> + <version>3.1.4</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-install-plugin</artifactId> - <version>3.1.3</version> + <version>3.1.4</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> @@ -357,7 +357,7 @@ <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> - <version>3.4.3</version> + <version>3.5.0</version> </plugin> <plugin> <groupId>org.eclipse.dash</groupId> @@ -623,7 +623,7 @@ <plugin> <groupId>io.github.git-commit-id</groupId> <artifactId>git-commit-id-maven-plugin</artifactId> - <version>9.0.1</version> + <version>9.0.2</version> <executions> <execution> <id>get-the-git-infos</id> @@ -642,7 +642,7 @@ <plugin> <groupId>org.codehaus.gmavenplus</groupId> <artifactId>gmavenplus-plugin</artifactId> - <version>4.1.1</version> + <version>4.2.0</version> <dependencies> <dependency> <groupId>org.apache.groovy</groupId> |