diff options
author | Dave Borowitz <dborowitz@google.com> | 2017-08-02 10:39:27 -0400 |
---|---|---|
committer | David Pursehouse <david.pursehouse@gmail.com> | 2017-09-30 12:01:19 +0100 |
commit | 2bbe15abd412d62a6d5a9ccddda73920943cb6f0 (patch) | |
tree | 81d66caab30e23ce7167a4eb4820009e08433419 /org.eclipse.jgit.test/tst/org/eclipse/jgit/api | |
parent | 77a28e0d5805da2880ff79a5b54250e7e0b7c9c6 (diff) | |
download | jgit-2bbe15abd412d62a6d5a9ccddda73920943cb6f0.tar.gz jgit-2bbe15abd412d62a6d5a9ccddda73920943cb6f0.zip |
ReflogWriter: Align auto-creation defaults with C git
Per git-config(1), core.logAllRefUpdates auto-creates reflogs for HEAD
and for refs under heads, notes, tags, and for HEAD. Add notes and
remove stash from ReflogWriter#shouldAutoCreateLog. Explicitly force
writing reflogs for refs/stash at call sites, now that this is
supported.
Change-Id: I3a46d2c2703b7c243e0ee2bbf6948279800c485c
Diffstat (limited to 'org.eclipse.jgit.test/tst/org/eclipse/jgit/api')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/api/StashListCommandTest.java | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/StashListCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/StashListCommandTest.java index a7e0ab9f51..d658a53942 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/StashListCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/StashListCommandTest.java @@ -51,6 +51,7 @@ import java.util.Iterator; import org.eclipse.jgit.junit.RepositoryTestCase; import org.eclipse.jgit.lib.Constants; +import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.RefUpdate; import org.eclipse.jgit.lib.RefUpdate.Result; import org.eclipse.jgit.revwalk.RevCommit; @@ -94,9 +95,7 @@ public class StashListCommandTest extends RepositoryTestCase { git.add().addFilepattern("file.txt").call(); RevCommit commit = git.commit().setMessage("create file").call(); - RefUpdate update = db.updateRef(Constants.R_STASH); - update.setNewObjectId(commit); - assertEquals(Result.NEW, update.update()); + assertEquals(Result.NEW, newStashUpdate(commit).update()); StashListCommand command = git.stashList(); Collection<RevCommit> stashed = command.call(); @@ -117,13 +116,8 @@ public class StashListCommandTest extends RepositoryTestCase { git.add().addFilepattern("file.txt").call(); RevCommit commit2 = git.commit().setMessage("edit file").call(); - RefUpdate create = db.updateRef(Constants.R_STASH); - create.setNewObjectId(commit1); - assertEquals(Result.NEW, create.update()); - - RefUpdate update = db.updateRef(Constants.R_STASH); - update.setNewObjectId(commit2); - assertEquals(Result.FAST_FORWARD, update.update()); + assertEquals(Result.NEW, newStashUpdate(commit1).update()); + assertEquals(Result.FAST_FORWARD, newStashUpdate(commit2).update()); StashListCommand command = git.stashList(); Collection<RevCommit> stashed = command.call(); @@ -133,4 +127,11 @@ public class StashListCommandTest extends RepositoryTestCase { assertEquals(commit2, iter.next()); assertEquals(commit1, iter.next()); } + + private RefUpdate newStashUpdate(ObjectId newId) throws Exception { + RefUpdate ru = db.updateRef(Constants.R_STASH); + ru.setNewObjectId(newId); + ru.setForceRefLog(true); + return ru; + } } |