-
Notifications
You must be signed in to change notification settings - Fork 758
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixes #3367
- Loading branch information
Vladimir Kotal
committed
Apr 9, 2021
1 parent
96ffc67
commit 93915c6
Showing
7 changed files
with
72 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
*/ | ||
|
||
/* | ||
* Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. | ||
* Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved. | ||
* Portions Copyright (c) 2017, 2020, Chris Fraire <[email protected]>. | ||
* Portions Copyright (c) 2020, Aleksandr Kirillov <[email protected]>. | ||
*/ | ||
|
@@ -232,6 +232,8 @@ public final class Configuration { | |
*/ | ||
private boolean handleHistoryOfRenamedFiles; | ||
|
||
private boolean mergeCommitsEnabled; | ||
|
||
public static final double defaultRamBufferSize = 16; | ||
|
||
/** | ||
|
@@ -541,6 +543,7 @@ public Configuration() { | |
//mandoc is default(String) | ||
setMaxSearchThreadCount(2 * Runtime.getRuntime().availableProcessors()); | ||
setMaxRevisionThreadCount(Runtime.getRuntime().availableProcessors()); | ||
setMergeCommitsEnabled(true); | ||
setMessageLimit(500); | ||
setNavigateWindowEnabled(false); | ||
setNestingMaximum(1); | ||
|
@@ -831,6 +834,14 @@ public void setHandleHistoryOfRenamedFiles(boolean enable) { | |
this.handleHistoryOfRenamedFiles = enable; | ||
} | ||
|
||
public void setMergeCommitsEnabled(boolean flag) { | ||
this.mergeCommitsEnabled = flag; | ||
} | ||
|
||
public boolean isMergeCommitsEnabled() { | ||
return mergeCommitsEnabled; | ||
} | ||
|
||
public boolean isNavigateWindowEnabled() { | ||
return navigateWindowEnabled; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
*/ | ||
|
||
/* | ||
* Copyright (c) 2006, 2019, Oracle and/or its affiliates. All rights reserved. | ||
* Copyright (c) 2006, 2021, Oracle and/or its affiliates. All rights reserved. | ||
* Portions Copyright (c) 2018, Chris Fraire <[email protected]>. | ||
*/ | ||
package org.opengrok.indexer.configuration; | ||
|
@@ -83,6 +83,11 @@ public class Project implements Comparable<Project>, Nameable, Serializable { | |
*/ | ||
private Boolean historyEnabled = null; | ||
|
||
/** | ||
* This flag enables/disables per project merge commits. | ||
*/ | ||
private Boolean mergeCommitsEnabled = null; | ||
|
||
/** | ||
* This marks the project as (not)ready before initial index is done. this | ||
* is to avoid all/multi-project searches referencing this project from | ||
|
@@ -237,6 +242,13 @@ public boolean isHandleRenamedFiles() { | |
return handleRenamedFiles != null && handleRenamedFiles; | ||
} | ||
|
||
/** | ||
* @return true if merge commits are enabled. | ||
*/ | ||
public boolean isMergeCommitsEnabled() { | ||
return mergeCommitsEnabled != null && mergeCommitsEnabled; | ||
} | ||
|
||
/** | ||
* @param flag true if project should handle renamed files, false otherwise. | ||
*/ | ||
|
@@ -258,6 +270,13 @@ public void setHistoryEnabled(boolean flag) { | |
this.historyEnabled = flag; | ||
} | ||
|
||
/** | ||
* @param flag true if project's repositories should deal with merge commits. | ||
*/ | ||
public void setMergeCommitsEnabled(boolean flag) { | ||
this.mergeCommitsEnabled = flag; | ||
} | ||
|
||
/** | ||
* Return groups where this project belongs. | ||
* | ||
|
@@ -322,6 +341,11 @@ public final void completeWithDefaults() { | |
if (navigateWindowEnabled == null) { | ||
setNavigateWindowEnabled(env.isNavigateWindowEnabled()); | ||
} | ||
|
||
// Allow project to override global setting of merge commits. | ||
if (mergeCommitsEnabled == null) { | ||
setMergeCommitsEnabled(env.isMergeCommitsEnabled()); | ||
} | ||
} | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
*/ | ||
|
||
/* | ||
* Copyright (c) 2006, 2020, Oracle and/or its affiliates. All rights reserved. | ||
* Copyright (c) 2006, 2021, Oracle and/or its affiliates. All rights reserved. | ||
* Portions Copyright (c) 2017, 2020, Chris Fraire <[email protected]>. | ||
*/ | ||
package org.opengrok.indexer.configuration; | ||
|
@@ -1251,6 +1251,14 @@ public boolean isHandleHistoryOfRenamedFiles() { | |
return syncReadConfiguration(Configuration::isHandleHistoryOfRenamedFiles); | ||
} | ||
|
||
public void setMergeCommitsEnabled(boolean flag) { | ||
syncWriteConfiguration(flag, Configuration::setMergeCommitsEnabled); | ||
} | ||
|
||
public boolean isMergeCommitsEnabled() { | ||
return syncReadConfiguration(Configuration::isMergeCommitsEnabled); | ||
} | ||
|
||
public void setNavigateWindowEnabled(boolean navigateWindowEnabled) { | ||
syncWriteConfiguration(navigateWindowEnabled, Configuration::setNavigateWindowEnabled); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
*/ | ||
|
||
/* | ||
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. | ||
* Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved. | ||
* Portions Copyright (c) 2017, 2020, Chris Fraire <[email protected]>. | ||
*/ | ||
package org.opengrok.indexer.history; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
*/ | ||
|
||
/* | ||
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. | ||
* Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved. | ||
* Portions Copyright (c) 2017, 2019, Chris Fraire <[email protected]>. | ||
*/ | ||
package org.opengrok.indexer.history; | ||
|
@@ -77,6 +77,8 @@ public class RepositoryInfo implements Serializable { | |
private boolean handleRenamedFiles; | ||
@DTOElement | ||
private boolean historyEnabled; | ||
@DTOElement | ||
private boolean mergeCommitsEnabled; | ||
|
||
/** | ||
* Empty constructor to support serialization. | ||
|
@@ -110,6 +112,20 @@ public void setHandleRenamedFiles(boolean flag) { | |
this.handleRenamedFiles = flag; | ||
} | ||
|
||
/** | ||
* @return true if the repository handles merge commits. | ||
*/ | ||
public boolean isMergeCommitsEnabled() { | ||
return this.mergeCommitsEnabled; | ||
} | ||
|
||
/** | ||
* @param flag true if the repository should handle merge commits, false otherwise. | ||
*/ | ||
public void setMergeCommitsEnabled(boolean flag) { | ||
this.mergeCommitsEnabled = flag; | ||
} | ||
|
||
/** | ||
* @return true if the repository should have history cache. | ||
*/ | ||
|
@@ -293,11 +309,13 @@ public void fillFromProject() { | |
if (proj != null) { | ||
setHistoryEnabled(proj.isHistoryEnabled()); | ||
setHandleRenamedFiles(proj.isHandleRenamedFiles()); | ||
setMergeCommitsEnabled(proj.isMergeCommitsEnabled()); | ||
} else { | ||
RuntimeEnvironment env = RuntimeEnvironment.getInstance(); | ||
|
||
setHistoryEnabled(env.isHistoryEnabled()); | ||
setHandleRenamedFiles(env.isHandleHistoryOfRenamedFiles()); | ||
setMergeCommitsEnabled(env.isMergeCommitsEnabled()); | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
*/ | ||
|
||
/* | ||
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. | ||
* Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved. | ||
* Portions Copyright (c) 2019, 2020, Chris Fraire <[email protected]>. | ||
*/ | ||
package org.opengrok.indexer.history; | ||
|
@@ -34,6 +34,7 @@ | |
import org.opengrok.indexer.condition.ConditionalRun; | ||
import org.opengrok.indexer.condition.ConditionalRunRule; | ||
import org.opengrok.indexer.condition.RepositoryInstalled; | ||
import org.opengrok.indexer.configuration.RuntimeEnvironment; | ||
import org.opengrok.indexer.util.TestRepository; | ||
import org.opengrok.indexer.web.Util; | ||
|
||
|
@@ -59,6 +60,7 @@ public static void setUpClass() throws Exception { | |
repository = new TestRepository(); | ||
repository.create(GitRepositoryOctopusTest.class.getResourceAsStream( | ||
"/history/git-octopus.zip")); | ||
RuntimeEnvironment.getInstance().setMergeCommitsEnabled(true); | ||
} | ||
|
||
@AfterClass | ||
|