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/src/org/eclipse/jgit | |
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/src/org/eclipse/jgit')
3 files changed, 4 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java index 850ff49695..955c50b376 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java @@ -425,6 +425,7 @@ public class RebaseCommand extends GitCommand<RebaseResult> { refUpdate.setNewObjectId(commitId); refUpdate.setRefLogIdent(refLogIdent); refUpdate.setRefLogMessage(refLogMessage, false); + refUpdate.setForceRefLog(true); if (currentRef != null) refUpdate.setExpectedOldObjectId(currentRef.getObjectId()); else diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/StashCreateCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/StashCreateCommand.java index 21b06e637a..77a7fffb70 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/StashCreateCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/StashCreateCommand.java @@ -212,6 +212,7 @@ public class StashCreateCommand extends GitCommand<RevCommit> { refUpdate.setNewObjectId(commitId); refUpdate.setRefLogIdent(refLogIdent); refUpdate.setRefLogMessage(refLogMessage, false); + refUpdate.setForceRefLog(true); if (currentRef != null) refUpdate.setExpectedOldObjectId(currentRef.getObjectId()); else diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ReflogWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ReflogWriter.java index 15fbe98209..d1bd922201 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ReflogWriter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ReflogWriter.java @@ -47,9 +47,9 @@ package org.eclipse.jgit.internal.storage.file; import static org.eclipse.jgit.lib.Constants.HEAD; import static org.eclipse.jgit.lib.Constants.R_HEADS; +import static org.eclipse.jgit.lib.Constants.R_NOTES; import static org.eclipse.jgit.lib.Constants.R_REFS; import static org.eclipse.jgit.lib.Constants.R_REMOTES; -import static org.eclipse.jgit.lib.Constants.R_STASH; import java.io.File; import java.io.FileNotFoundException; @@ -250,6 +250,6 @@ public class ReflogWriter { return refName.equals(HEAD) || refName.startsWith(R_HEADS) || refName.startsWith(R_REMOTES) - || refName.equals(R_STASH); + || refName.startsWith(R_NOTES); } } |