Skip to content

Commit

Permalink
[#1927] Increase minimum version required for Git (#2028)
Browse files Browse the repository at this point in the history
Currently, RepoSense requires a minimum Git version of 2.14, with an
additional requirement of version 2.23 for the --find-previous-authors
flag. Supporting Git version 2.14 while requiring Git version 2.23 for
certain features adds complexity in the form of a Git version checker
to disable features depending on Git version 2.23.

Let's increase the minimum Git version required from 2.14 to 2.23.
  • Loading branch information
jq1836 authored Aug 19, 2023
1 parent b25d1fe commit a537db6
Show file tree
Hide file tree
Showing 11 changed files with 2 additions and 158 deletions.
2 changes: 1 addition & 1 deletion docs/dg/settingUp.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
**Prerequisites:**
* **JDK `1.8.0_60`** up to **`17`** ([download :fas-download:](https://www.oracle.com/technetwork/java/javase/downloads/index.html)).
* **Node.js** `16.19.1` to the latest minor version for `18` ([download :fas-download:](https://www.npmjs.com/get-npm)).
* **git `2.14`** or later ([download :fas-download:](https://git-scm.com/downloads)).
* **git `2.23`** or later ([download :fas-download:](https://git-scm.com/downloads)).

<box type="info" seamless>

Expand Down
6 changes: 0 additions & 6 deletions docs/ug/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,6 @@ Binary file formats, such as `jpg`, `png`,`exe`,`zip`, `rar`, `docx`, and `pptx`
* Alias: `-F` (uppercase F)
* Example:`--find-previous-authors` or `-F`

<box type="info" seamless>

* This flag only works on **git `2.23`** or later.
* If an earlier version of **git** is used, RepoSense can still run but this flag will be ignored.
</box>

<!-- ------------------------------------------------------------------------------------------------------ -->

### `--help`, `-h`
Expand Down
2 changes: 1 addition & 1 deletion docs/ug/generatingReports.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ For other types of repositories, external links are disabled.

1. **Ensure you have the prerequisites**:
* **Java 8** (JRE `1.8.0_60`) or later ([download :fas-download:](https://www.java.com/en/)).
* **git `2.14`** or later on the command line. ([download :fas-download:](https://git-scm.com/downloads)).<br> run `git --version` in your OS terminal to confirm the version.
* **git `2.23`** or later on the command line. ([download :fas-download:](https://git-scm.com/downloads)).<br> run `git --version` in your OS terminal to confirm the version.

1. **Download the latest JAR file** from our [releases](https://github.com/reposense/RepoSense/releases/latest).

Expand Down
9 changes: 0 additions & 9 deletions src/main/java/reposense/RepoSense.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

import net.sourceforge.argparse4j.helper.HelpScreenException;
import reposense.git.GitConfig;
import reposense.git.GitVersion;
import reposense.model.CliArguments;
import reposense.model.RepoConfiguration;
import reposense.model.ReportConfiguration;
Expand All @@ -33,8 +32,6 @@ public class RepoSense {
private static final int SERVER_PORT_NUMBER = 9000;
private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("E MMM d HH:mm:ss yyyy z");
private static final String VERSION_UNSPECIFIED = "unspecified";
private static final String FINDING_PREVIOUS_AUTHORS_INVALID_VERSION_WARNING_MESSAGE =
"--find-previous-authors/-F requires git version 2.23 and above. Feature will be disabled for this run";

/**
* The entry point of the program.
Expand Down Expand Up @@ -69,12 +66,6 @@ public static void main(String[] args) {
RepoConfiguration.setIsFindingPreviousAuthorsPerformedToRepoConfigs(configs,
cliArguments.isFindingPreviousAuthorsPerformed());

if (RepoConfiguration.isAnyRepoFindingPreviousAuthors(configs)
&& !GitVersion.isGitVersionSufficientForFindingPreviousAuthors()) {
logger.warning(FINDING_PREVIOUS_AUTHORS_INVALID_VERSION_WARNING_MESSAGE);
RepoConfiguration.setToFalseIsFindingPreviousAuthorsPerformedToRepoConfigs(configs);
}

List<String[]> globalGitConfig = GitConfig.getGlobalGitLfsConfig();
if (globalGitConfig.size() != 0) {
GitConfig.setGlobalGitLfsConfig(GitConfig.SKIP_SMUDGE_CONFIG_SETTINGS);
Expand Down
69 changes: 0 additions & 69 deletions src/main/java/reposense/git/GitVersion.java

This file was deleted.

4 changes: 0 additions & 4 deletions src/main/java/reposense/model/RepoConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,6 @@ public static void setIsFindingPreviousAuthorsPerformedToRepoConfigs(List<RepoCo
}
}

public static void setToFalseIsFindingPreviousAuthorsPerformedToRepoConfigs(List<RepoConfiguration> configs) {
configs.stream().forEach(config -> config.setIsFindingPreviousAuthorsPerformed(false));
}

public static void setHasAuthorConfigFileToRepoConfigs(List<RepoConfiguration> configs,
boolean setHasAuthorConfigFile) {
configs.stream().forEach(config -> config.setHasAuthorConfigFile(setHasAuthorConfigFile));
Expand Down
10 changes: 0 additions & 10 deletions src/systemtest/java/reposense/ConfigSystemTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@
import java.util.List;

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.parallel.Execution;
import org.junit.jupiter.api.parallel.ExecutionMode;

import reposense.git.GitVersion;
import reposense.model.SupportedDomainUrlMap;
import reposense.parser.SinceDateArgumentType;
import reposense.report.ErrorSummary;
Expand All @@ -31,8 +29,6 @@ public class ConfigSystemTest {
private static final String OUTPUT_DIRECTORY = "ft_temp";
private static final Path REPORT_DIRECTORY_PATH = Paths.get(OUTPUT_DIRECTORY, "reposense-report");

private static final String GIT_VERSION_INSUFFICIENT_MESSAGE = "Git version 2.23.0 and above necessary to run test";

private static boolean didNotCloneRepoNormally = true;

@BeforeEach
Expand Down Expand Up @@ -115,9 +111,6 @@ public void test30DaysFromUntilDateWithShallowCloning() {
*/
@Test
public void testSinceBeginningDateRangeWithFindPreviousAuthors() {
Assumptions.assumeTrue(GitVersion.isGitVersionSufficientForFindingPreviousAuthors(),
GIT_VERSION_INSUFFICIENT_MESSAGE);

InputBuilder inputBuilder = initInputBuilder()
.addSinceDate(SinceDateArgumentType.FIRST_COMMIT_DATE_SHORTHAND)
.addUntilDate("2/3/2019")
Expand All @@ -129,9 +122,6 @@ public void testSinceBeginningDateRangeWithFindPreviousAuthors() {

@Test
public void test30DaysFromUntilDateWithFindPreviousAuthors() {
Assumptions.assumeTrue(GitVersion.isGitVersionSufficientForFindingPreviousAuthors(),
GIT_VERSION_INSUFFICIENT_MESSAGE);

InputBuilder inputBuilder = initInputBuilder()
.addUntilDate("1/11/2017")
.addFindPreviousAuthors();
Expand Down
6 changes: 0 additions & 6 deletions src/test/java/reposense/authorship/FileAnalyzerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@
import java.util.stream.Collectors;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import reposense.authorship.model.FileInfo;
import reposense.authorship.model.FileResult;
import reposense.git.GitCheckout;
import reposense.git.GitVersion;
import reposense.model.Author;
import reposense.model.CommitHash;
import reposense.model.FileType;
Expand Down Expand Up @@ -96,7 +94,6 @@ public void blameTest() {

@Test
public void blameWithPreviousAuthorsTest() {
Assumptions.assumeTrue(GitVersion.isGitVersionSufficientForFindingPreviousAuthors());
config.setSinceDate(PREVIOUS_AUTHOR_BLAME_TEST_SINCE_DATE);
config.setUntilDate(PREVIOUS_AUTHOR_BLAME_TEST_UNTIL_DATE);
config.setIsFindingPreviousAuthorsPerformed(true);
Expand Down Expand Up @@ -131,7 +128,6 @@ public void blameTestDateRange() throws Exception {

@Test
public void blameWithPreviousAuthorsTestDateRange() throws Exception {
Assumptions.assumeTrue(GitVersion.isGitVersionSufficientForFindingPreviousAuthors());
config.setSinceDate(PREVIOUS_AUTHOR_BLAME_TEST_SINCE_DATE);
config.setUntilDate(PREVIOUS_AUTHOR_BLAME_TEST_UNTIL_DATE);
config.setIsFindingPreviousAuthorsPerformed(true);
Expand Down Expand Up @@ -184,7 +180,6 @@ public void analyzeTextFile_blameTestFileIgnoreFakeAuthorCommitFullHash_success(

@Test
public void analyzeFile_blameWithPreviousAuthorsIgnoreFirstCommitThatChangedLine_assignLineToUnknownAuthor() {
Assumptions.assumeTrue(GitVersion.isGitVersionSufficientForFindingPreviousAuthors());
config.setSinceDate(PREVIOUS_AUTHOR_BLAME_TEST_SINCE_DATE);
config.setUntilDate(PREVIOUS_AUTHOR_BLAME_TEST_UNTIL_DATE);
config.setIsFindingPreviousAuthorsPerformed(true);
Expand Down Expand Up @@ -237,7 +232,6 @@ public void analyzeTextFile_blameTestFileIgnoreAllCommit_success() {

@Test
public void analyzeFile_blameWithPreviousAuthorTestFileIgnoreAllCommit_success() {
Assumptions.assumeTrue(GitVersion.isGitVersionSufficientForFindingPreviousAuthors());
config.setSinceDate(PREVIOUS_AUTHOR_BLAME_TEST_SINCE_DATE);
config.setUntilDate(PREVIOUS_AUTHOR_BLAME_TEST_UNTIL_DATE);
config.setIsFindingPreviousAuthorsPerformed(true);
Expand Down
2 changes: 0 additions & 2 deletions src/test/java/reposense/git/GitBlameTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import java.util.regex.Pattern;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -35,7 +34,6 @@ public void blameRaw_nonExistentFile_throwsRunTimeException() {

@Test
public void blameWithPreviousAuthorsRaw_validFile_success() {
Assumptions.assumeTrue(GitVersion.isGitVersionSufficientForFindingPreviousAuthors());
config.setBranch(TEST_REPO_BLAME_WITH_PREVIOUS_AUTHORS_BRANCH);
GitCheckout.checkoutBranch(config.getRepoRoot(), TEST_REPO_BLAME_WITH_PREVIOUS_AUTHORS_BRANCH);
createTestIgnoreRevsFile(AUTHOR_TO_IGNORE_BLAME_COMMIT_LIST_07082021);
Expand Down
47 changes: 0 additions & 47 deletions src/test/java/reposense/git/GitVersionTest.java

This file was deleted.

3 changes: 0 additions & 3 deletions src/test/java/reposense/model/RepoConfigurationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -574,9 +574,6 @@ public void repoConfig_userEnvironmentCannotRunFindPreviousAuthors_setFindPrevio
RepoConfiguration.setIsFindingPreviousAuthorsPerformedToRepoConfigs(actualConfigs,
cliArguments.isFindingPreviousAuthorsPerformed());

// Assume by default that the environment does not support Find Previous Authors feature
RepoConfiguration.setToFalseIsFindingPreviousAuthorsPerformedToRepoConfigs(actualConfigs);

RepoConfiguration repoBetaActualConfig = actualConfigs.get(0);
RepoConfiguration repoDeltaActualConfig = actualConfigs.get(1);
TestRepoCloner.cloneAndBranch(repoBetaActualConfig);
Expand Down

0 comments on commit a537db6

Please sign in to comment.