Skip to content

Commit e7749ae

Browse files
committed
disable generating full history for renamed files by default
fixes #1773
1 parent c57bc5a commit e7749ae

File tree

5 files changed

+16
-11
lines changed

5 files changed

+16
-11
lines changed

OpenGrok

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,13 @@
4242
# through project, it's good to have Verbose
4343
# Mode enabled too, cost of this is one more
4444
# traversal of the project before indexing it(*)
45-
# - OPENGROK_DISABLE_RENAMED_FILES_HISTORY Disable getting full history of
45+
# - OPENGROK_RENAMED_FILES_HISTORY If set to "on", get full history of
4646
# renamed files for SCMs that support it (Git,
4747
# Mercurial).
48-
# The default is handle the history which makes
49-
# indexing slower, especially in the presence of
48+
# The default is off.
49+
# When set to on, the indexing is slower,
50+
# especially in the presence of
5051
# lots of renamed files in the repository.
51-
# Set it to non-empty value to disable the
52-
# renamed files history handling.
5352
# - OPENGROK_GENERATE_HISTORY Influence history cache generation
5453
# Following values are recognized:
5554
# on - enabled (default)
@@ -286,9 +285,11 @@ DefaultInstanceConfiguration()
286285
GENERATE_HISTORY="${GENERATE_HISTORY} -H"
287286
fi
288287

289-
if [ -n "$OPENGROK_DISABLE_RENAMED_FILES_HISTORY" ]
288+
if [ "$OPENGROK_RENAMED_FILES_HISTORY" != "on" ]
290289
then
291-
DISABLE_RENAMED_FILES_HISTORY="-D"
290+
RENAMED_FILES_HISTORY="-D off"
291+
else
292+
RENAMED_FILES_HISTORY="-D on"
292293
fi
293294

294295
# OPTIONAL: override depth of scanning for repositories
@@ -819,7 +820,7 @@ CommonInvocation()
819820
${IGNORE_PATTERNS} \
820821
${HISTORY_TAGS} \
821822
${GENERATE_HISTORY} \
822-
${DISABLE_RENAMED_FILES_HISTORY} \
823+
${RENAMED_FILES_HISTORY} \
823824
${SCAN_DEPTH} \
824825
${PROGRESS} \
825826
${OPENGROK_CTAGS:+-c} ${OPENGROK_CTAGS} \

src/org/opensolaris/opengrok/configuration/Configuration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ public Configuration() {
371371
setGenerateHtml(true);
372372
setGroups(new TreeSet<>());
373373
setGroupsCollapseThreshold(4);
374-
setHandleHistoryOfRenamedFiles(true);
374+
setHandleHistoryOfRenamedFiles(false);
375375
setHistoryCache(true);
376376
setHistoryCacheTime(30);
377377
setHistoryEnabled(true);

src/org/opensolaris/opengrok/index/CommandLineOptions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public CommandLineOptions() {
7878
options.add(new Option('C', null, "Print per project percentage progress information(I/O extensive, since one read through dir structure is made before indexing, needs -v, otherwise it just goes to the log)"));
7979
options.add(new Option('c', "/path/to/ctags", "Path to Exuberant Ctags from http://ctags.sf.net by default takes the Exuberant Ctags in PATH."));
8080
options.add(new Option('d', "/path/to/data/root", "The directory where OpenGrok stores the generated data"));
81-
options.add(new Option('D', null, "Disable generating history for renamed files. Makes indexing faster for repositories with lots of renamed files."));
81+
options.add(new Option('D', ON_OFF, "Enable or disable generating history for renamed files. If set to on, makes history indexing slower for repositories with lots of renamed files."));
8282
options.add(new Option('e', null, "Economical - consumes less disk space. It does not generate hyper text cross reference files offline, but will do so on demand - which could be sightly slow."));
8383
options.add(new Option('G', null, "Assign commit tags to all entries in history for all repositories."));
8484
options.add(new Option('H', null, "Get history for all repositories"));

src/org/opensolaris/opengrok/index/Indexer.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,8 @@ public static void main(String argv[]) {
246246
break;
247247
}
248248
case 'D':
249-
cfg.setHandleHistoryOfRenamedFiles(false);
249+
cfg.setHandleHistoryOfRenamedFiles(getopt.getOptarg().
250+
equals("on"));
250251
break;
251252
case 'e':
252253
cfg.setGenerateHtml(false);

test/org/opensolaris/opengrok/history/GitRepositoryTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import org.opensolaris.opengrok.util.TestRepository;
4343

4444
import static org.junit.Assert.*;
45+
import org.opensolaris.opengrok.configuration.RuntimeEnvironment;
4546

4647
/**
4748
*
@@ -351,6 +352,7 @@ private void runRenamedTest(String fname, String cset, String content) throws Ex
351352

352353
@Test
353354
public void testRenamedHistory() throws Exception {
355+
RuntimeEnvironment.getInstance().setHandleHistoryOfRenamedFiles(true);
354356
File root = new File(repository.getSourceRoot(), "git");
355357
GitRepository gitrepo
356358
= (GitRepository) RepositoryFactory.getRepository(root);
@@ -381,6 +383,7 @@ public void testRenamedHistory() throws Exception {
381383

382384
@Test
383385
public void testRenamedSingleHistory() throws Exception {
386+
RuntimeEnvironment.getInstance().setHandleHistoryOfRenamedFiles(true);
384387
File root = new File(repository.getSourceRoot(), "git");
385388
GitRepository gitrepo
386389
= (GitRepository) RepositoryFactory.getRepository(root);

0 commit comments

Comments
 (0)