Skip to content

Commit

Permalink
[#363] Make the commits info analysis case insensitive (#364)
Browse files Browse the repository at this point in the history
CommitInfoExtractor uses git log to extract users' commits info.
However, by default, the author matching pattern used in git log is
case sensitive.

This can cause the CommitInfoAnalyzer to miss out some or all their
commits in the analysis. As a result, some authors do not have any
ramps shown in their ramp chart, even though their code view shows line
contributions.

To resolve this problem, let's set the git log regex patterns to be
case insensitive.
  • Loading branch information
eugenepeh authored Oct 10, 2018
1 parent c05f000 commit 8229759
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/reposense/system/CommandRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class CommandRunner {
public static String gitLog(RepoConfiguration config, Author author) {
Path rootPath = Paths.get(config.getRepoRoot());

String command = "git log --no-merges ";
String command = "git log --no-merges -i ";
command += convertToGitDateRangeArgs(config.getSinceDate(), config.getUntilDate());
command += " --pretty=format:\"%H|%aN|%ad|%s\" --date=iso --shortstat";
command += convertToFilterAuthorArgs(author);
Expand Down
8 changes: 8 additions & 0 deletions src/test/java/reposense/system/CommandRunnerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ public void gitLog_fakeAuthorNameOnly_success() {
Assert.assertTrue(TestUtil.compareNumberExpectedCommitsToGitLogLines(4, content));
}

@Test
public void gitLog_authorNameIncorrectCase_success() {
Author fakeAuthorName = new Author(FAKE_AUTHOR_NAME.toUpperCase());

String content = CommandRunner.gitLog(config, fakeAuthorName);
Assert.assertTrue(TestUtil.compareNumberExpectedCommitsToGitLogLines(4, content));
}

@Test
public void gitLog_fakeAuthorNameWithSpecialCharacter_success() {
Author fakeAuthorWithSpecialCharacter = new Author(FAKE_AUTHOR_NAME.replace("fake", "#()!"));
Expand Down

0 comments on commit 8229759

Please sign in to comment.