summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Pearce <spearce@spearce.org>2016-01-06 12:05:46 -0800
committerShawn Pearce <spearce@spearce.org>2016-01-06 12:05:46 -0800
commit4c9eda17bea2a5f9c2d4905d2a9e43cc832a432d (patch)
treed9cbc7ead4c5c654196fbd3a33bec3d282b7f779
parent4c574b39b40be466bfe7d6aaaa011bd5a2e9023b (diff)
downloadjgit-4c9eda17bea2a5f9c2d4905d2a9e43cc832a432d.tar.gz
jgit-4c9eda17bea2a5f9c2d4905d2a9e43cc832a432d.zip
InMemoryRepository: Abort BatchRefUpdate if a command previously failed
If any command has already been marked as failing, fail the entire batch. Change-Id: I1692240841aa4f4cb252bdccbc6f11d9246929c1
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/InMemoryRepository.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/InMemoryRepository.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/InMemoryRepository.java
index cdebb7a8fc..205d3c7f8a 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/InMemoryRepository.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/InMemoryRepository.java
@@ -310,6 +310,11 @@ public class InMemoryRepository extends DfsRepository {
Map<ObjectId, ObjectId> peeled = new HashMap<>();
try (RevWalk rw = new RevWalk(getRepository())) {
for (ReceiveCommand c : cmds) {
+ if (c.getResult() != ReceiveCommand.Result.NOT_ATTEMPTED) {
+ reject(cmds);
+ return;
+ }
+
if (!ObjectId.zeroId().equals(c.getNewId())) {
try {
RevObject o = rw.parseAny(c.getNewId());