aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java
diff options
context:
space:
mode:
authorMario Molina <mmolimar@gmail.com>2018-12-26 10:48:05 +0100
committerJonathan Nieder <jrn@google.com>2019-01-07 20:00:11 -0500
commit6c8240a75126013b7f4588d78e66baa54e89cbfc (patch)
tree2545b4c16768e6a6f256bce5808fbf642adf48ca /org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java
parent062822dc41013b5c2e5174f7670351b034b4c022 (diff)
downloadjgit-6c8240a75126013b7f4588d78e66baa54e89cbfc.tar.gz
jgit-6c8240a75126013b7f4588d78e66baa54e89cbfc.zip
Return 'this' from setters in commands
To avoid breaking ABI, take the opportunity to give these setters (hopefully sometimes better) names and deprecate their old names. Change-Id: Ib45011678c3d941f8ecc1a1e0fdf4c09cdc337e3 Signed-off-by: Mario Molina <mmolimar@gmail.com> Signed-off-by: Jonathan Nieder <jrn@google.com>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java42
1 files changed, 36 insertions, 6 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java
index 01d070cbd9..2136e51c44 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java
@@ -96,9 +96,9 @@ public class StashApplyCommand extends GitCommand<ObjectId> {
private String stashRef;
- private boolean applyIndex = true;
+ private boolean restoreIndex = true;
- private boolean applyUntracked = true;
+ private boolean restoreUntracked = true;
private boolean ignoreRepositoryState;
@@ -196,7 +196,7 @@ public class StashApplyCommand extends GitCommand<ObjectId> {
.getParent(1));
ObjectId stashHeadCommit = stashCommit.getParent(0);
ObjectId untrackedCommit = null;
- if (applyUntracked && stashCommit.getParentCount() == 3)
+ if (restoreUntracked && stashCommit.getParentCount() == 3)
untrackedCommit = revWalk.parseCommit(stashCommit.getParent(2));
ResolveMerger merger = (ResolveMerger) strategy.newMerger(repo);
@@ -216,7 +216,7 @@ public class StashApplyCommand extends GitCommand<ObjectId> {
dc, merger.getResultTreeId());
dco.setFailOnConflict(true);
dco.checkout(); // Ignoring failed deletes....
- if (applyIndex) {
+ if (restoreIndex) {
ResolveMerger ixMerger = (ResolveMerger) strategy
.newMerger(repo, true);
ixMerger.setCommitNames(new String[] { "stashed HEAD", //$NON-NLS-1$
@@ -277,9 +277,24 @@ public class StashApplyCommand extends GitCommand<ObjectId> {
*
* @param applyIndex
* true (default) if the command should restore the index state
+ * @deprecated use {@link #setRestoreIndex} instead
*/
+ @Deprecated
public void setApplyIndex(boolean applyIndex) {
- this.applyIndex = applyIndex;
+ this.restoreIndex = applyIndex;
+ }
+
+ /**
+ * Whether to restore the index state
+ *
+ * @param restoreIndex
+ * true (default) if the command should restore the index state
+ * @return {@code this}
+ * @since 5.3
+ */
+ public StashApplyCommand setRestoreIndex(boolean restoreIndex) {
+ this.restoreIndex = restoreIndex;
+ return this;
}
/**
@@ -302,9 +317,24 @@ public class StashApplyCommand extends GitCommand<ObjectId> {
* @param applyUntracked
* true (default) if the command should restore untracked files
* @since 3.4
+ * @deprecated use {@link #setRestoreUntracked} instead
*/
+ @Deprecated
public void setApplyUntracked(boolean applyUntracked) {
- this.applyUntracked = applyUntracked;
+ this.restoreUntracked = applyUntracked;
+ }
+
+ /**
+ * Whether the command should restore untracked files
+ *
+ * @param restoreUntracked
+ * true (default) if the command should restore untracked files
+ * @return {@code this}
+ * @since 5.3
+ */
+ public StashApplyCommand setRestoreUntracked(boolean restoreUntracked) {
+ this.restoreUntracked = restoreUntracked;
+ return this;
}
private void resetIndex(RevTree tree) throws IOException {