From 17d95a647aba8c37d9ac34d97e4eed729aa46f67 Mon Sep 17 00:00:00 2001 From: Naseer Ahmed Date: Tue, 20 Aug 2013 17:28:51 -0700 Subject: [PATCH] HistoryGuru: Skip history creation for defined directories If a project has an .opengrok_skip_history file, skip creating it's historycache Fixes #652 --- OpenGrok | 3 +++ README.txt | 5 +++++ src/org/opensolaris/opengrok/history/HistoryGuru.java | 9 +++++++++ src/org/opensolaris/opengrok/index/IgnoredNames.java | 1 + 4 files changed, 18 insertions(+) diff --git a/OpenGrok b/OpenGrok index 6dd6300abb5..6f9951dcd9e 100755 --- a/OpenGrok +++ b/OpenGrok @@ -212,6 +212,9 @@ DefaultInstanceConfiguration() # OPTIONAL: Ignore these patterns as names of files or directories #IGNORE_PATTERNS="-i dummy" + # To ignore skipping just the history cache creation for a particular + # directory and all of it's subdirectories, touch an empty + # .opengrok_skip_history file at the root of that directory # OPTIONAL: Enable Projects # (Every directory in SRC_ROOT is considered a separate project) diff --git a/README.txt b/README.txt index eeeead6441b..6c659ebdd6a 100644 --- a/README.txt +++ b/README.txt @@ -117,6 +117,11 @@ by OpenGrok. Note that OpenGrok ignores symbolic links. +If you want to skip indexing the history of a particular directory +(and all of it's subdirectories), you can touch .opengrok_skip_history at the root +of that directory + + 4.2 Using Opengrok wrapper script to create indexes --------------------------------------------------- diff --git a/src/org/opensolaris/opengrok/history/HistoryGuru.java b/src/org/opensolaris/opengrok/history/HistoryGuru.java index 1a913ddcdb6..ef931025cc6 100644 --- a/src/org/opensolaris/opengrok/history/HistoryGuru.java +++ b/src/org/opensolaris/opengrok/history/HistoryGuru.java @@ -304,6 +304,15 @@ private void addRepositories(File[] files, Collection repos, */ private void addRepositories(File[] files, Collection repos, IgnoredNames ignoredNames, boolean recursiveSearch, int depth) { + for (File file : files) { + Repository repository = null; + if (file.getName().equals(".opengrok_skip_history")) { + log.log(Level.INFO, "Skipping history cache creation for " + + file.getParentFile().getAbsolutePath() + + " and it's subdirectories"); + return; + } + } for (File file : files) { Repository repository = null; try { diff --git a/src/org/opensolaris/opengrok/index/IgnoredNames.java b/src/org/opensolaris/opengrok/index/IgnoredNames.java index 6cd1308ad52..e21fe3f5a79 100644 --- a/src/org/opensolaris/opengrok/index/IgnoredNames.java +++ b/src/org/opensolaris/opengrok/index/IgnoredNames.java @@ -73,6 +73,7 @@ public final class IgnoredNames extends Filter { ".sln", ".vsmdi", ".dll", + ".opengrok_skip_history", }; public IgnoredNames() {