Skip to content

Commit 910d964

Browse files
author
Vladimir Kotal
committed
cleanup git version check
it is not needed after the recent JGit changes
1 parent 8dae5a7 commit 910d964

File tree

1 file changed

+1
-24
lines changed

1 file changed

+1
-24
lines changed

opengrok-indexer/src/main/java/org/opengrok/indexer/history/GitRepository.java

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@
8989
import org.opengrok.indexer.util.Executor;
9090
import org.opengrok.indexer.util.ForbiddenSymlinkException;
9191
import org.opengrok.indexer.util.LazilyInstantiate;
92-
import org.opengrok.indexer.util.Version;
9392

9493
import static org.opengrok.indexer.history.HistoryEntry.TAGS_SEPARATOR;
9594

@@ -117,19 +116,6 @@ public class GitRepository extends RepositoryWithPerPartesHistory {
117116
private static final int CSET_LEN = 8;
118117
private static final String ABBREV_LOG = "--abbrev=" + CSET_LEN;
119118

120-
/**
121-
* All git commands that emit date that needs to be parsed by
122-
* {@code getDateFormat()} should use this option.
123-
*/
124-
private static final String GIT_DATE_OPT = "--date=iso8601-strict";
125-
126-
/**
127-
* Minimum git version which supports the date format.
128-
*
129-
* @see #GIT_DATE_OPT
130-
*/
131-
private static final Version MINIMUM_VERSION = new Version(2, 1, 2);
132-
133119
/**
134120
* This is a static replacement for 'working' field. Effectively, check if git is working once in a JVM
135121
* instead of calling it for every GitRepository instance.
@@ -156,16 +142,7 @@ public GitRepository() {
156142
private static boolean isGitWorking() {
157143
String repoCommand = getCommand(GitRepository.class, CMD_PROPERTY_KEY, CMD_FALLBACK);
158144
Executor exec = new Executor(new String[] {repoCommand, "--version"});
159-
if (exec.exec(false) == 0) {
160-
final String outputVersion = exec.getOutputString();
161-
final String version = outputVersion.replaceAll(".*? version (\\d+(\\.\\d+)*).*", "$1");
162-
try {
163-
return Version.from(version).compareTo(MINIMUM_VERSION) >= 0;
164-
} catch (NumberFormatException ex) {
165-
LOGGER.log(Level.WARNING, String.format("Unable to detect git version from %s", outputVersion), ex);
166-
}
167-
}
168-
return false;
145+
return (exec.exec(false) == 0);
169146
}
170147

171148
/**

0 commit comments

Comments
 (0)