From 4e3757ff0e2347b1ed2ebf4ad0225e34e7c2adc0 Mon Sep 17 00:00:00 2001 From: Julia Beliaeva Date: Fri, 16 Jun 2017 19:16:37 +0300 Subject: [PATCH] [git] extract method for --no-walk parameter --- .../git4idea/src/git4idea/history/GitHistoryUtils.java | 3 +-- plugins/git4idea/src/git4idea/history/GitLogUtil.java | 8 ++++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/plugins/git4idea/src/git4idea/history/GitHistoryUtils.java b/plugins/git4idea/src/git4idea/history/GitHistoryUtils.java index b54f277c42b0..b662fdd04263 100644 --- a/plugins/git4idea/src/git4idea/history/GitHistoryUtils.java +++ b/plugins/git4idea/src/git4idea/history/GitHistoryUtils.java @@ -614,8 +614,7 @@ public class GitHistoryUtils { public static String[] formHashParameters(@NotNull GitVcs vcs, @NotNull Collection hashes) { List parameters = ContainerUtil.newArrayList(); - String noWalk = GitVersionSpecialty.NO_WALK_UNSORTED.existsIn(vcs.getVersion()) ? "--no-walk=unsorted" : "--no-walk"; - parameters.add(noWalk); + parameters.add(GitLogUtil.getNoWalkParameter(vcs)); parameters.addAll(hashes); return ArrayUtil.toStringArray(parameters); diff --git a/plugins/git4idea/src/git4idea/history/GitLogUtil.java b/plugins/git4idea/src/git4idea/history/GitLogUtil.java index dd41a1f7de4a..b8855ab7aa3a 100644 --- a/plugins/git4idea/src/git4idea/history/GitLogUtil.java +++ b/plugins/git4idea/src/git4idea/history/GitLogUtil.java @@ -372,8 +372,7 @@ public class GitLogUtil { return false; }); - readRecordsFromHandler(project, root, false, true, recordCollector, handler, - GitVersionSpecialty.NO_WALK_UNSORTED.existsIn(vcs.getVersion()) ? "--no-walk=unsorted" : "--no-walk", "--stdin"); + readRecordsFromHandler(project, root, false, true, recordCollector, handler, getNoWalkParameter(vcs), "--stdin"); recordCollector.finish(); if (!inputError.isNull()) { @@ -381,6 +380,11 @@ public class GitLogUtil { } } + @NotNull + public static String getNoWalkParameter(@NotNull GitVcs vcs) { + return GitVersionSpecialty.NO_WALK_UNSORTED.existsIn(vcs.getVersion()) ? "--no-walk=unsorted" : "--no-walk"; + } + @NotNull private static List createConfigParameters(boolean withChanges) { return Registry.is("git.diff.renameLimit.infinity") && withChanges ?