forked from src-d/hercules
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
src-dGH-355: Handle duplicates in --people-dict and extend docs
Signed-off-by: Oliver Bristow <[email protected]>
- Loading branch information
Showing
4 changed files
with
37 additions
and
8 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 |
---|---|---|
|
@@ -223,7 +223,14 @@ and add the unknown email to the list of that developer's emails. | |
|
||
If `--people-dict` is specified, it should point to a text file with the custom identities. The | ||
format is: every line is a single developer, it contains all the matching emails and names separated | ||
by `|`. The case is ignored. | ||
by `|`. The case is ignored. Example file contents: | ||
``` | ||
Linus Torvalds|[email protected] | ||
Vadim Markovtsev|[email protected]|[email protected] | ||
``` | ||
|
||
If `--people-dict` is not specified a [`.mailmap`](https://git-scm.com/docs/git-check-mailmap) file | ||
will be used if it exists in the latest commit. | ||
|
||
#### Overwrites matrix | ||
|
||
|
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 |
---|---|---|
|
@@ -177,19 +177,32 @@ func TestIdentityDetectorLoadPeopleDict(t *testing.T) { | |
id := fixtureIdentityDetector() | ||
err := id.LoadPeopleDict(path.Join("..", "..", "test_data", "identities")) | ||
assert.Nil(t, err) | ||
assert.Equal(t, len(id.PeopleDict), 7) | ||
assert.Equal(t, len(id.PeopleDict), 10) | ||
assert.Contains(t, id.PeopleDict, "linus torvalds") | ||
assert.Contains(t, id.PeopleDict, "[email protected]") | ||
assert.Contains(t, id.PeopleDict, "vadim markovtsev") | ||
assert.Contains(t, id.PeopleDict, "[email protected]") | ||
assert.Contains(t, id.PeopleDict, "[email protected]") | ||
assert.Contains(t, id.PeopleDict, "máximo cuadros") | ||
assert.Contains(t, id.PeopleDict, "[email protected]") | ||
assert.Equal(t, len(id.ReversedPeopleDict), 4) | ||
assert.Contains(t, id.PeopleDict, "duplicate") | ||
assert.Contains(t, id.PeopleDict, "[email protected]") | ||
assert.Contains(t, id.PeopleDict, "[email protected]") | ||
|
||
assert.Equal(t, len(id.ReversedPeopleDict), 5) | ||
assert.Equal(t, id.ReversedPeopleDict[0], "Linus Torvalds") | ||
assert.Equal(t, id.ReversedPeopleDict[1], "Vadim Markovtsev") | ||
assert.Equal(t, id.ReversedPeopleDict[2], "Máximo Cuadros") | ||
assert.Equal(t, id.ReversedPeopleDict[3], AuthorMissingName) | ||
assert.Equal(t, id.ReversedPeopleDict[3], "Duplicate") | ||
assert.Equal(t, id.ReversedPeopleDict[4], AuthorMissingName) | ||
|
||
assert.Equal(t, id.PeopleDict["duplicate"], id.PeopleDict["[email protected]"]) | ||
assert.Equal(t, id.PeopleDict["duplicate"], id.PeopleDict["[email protected]"]) | ||
|
||
assert.Equal(t, id.PeopleDict["vadim markovtsev"], id.PeopleDict["[email protected]"]) | ||
assert.Equal(t, id.PeopleDict["vadim markovtsev"], id.PeopleDict["[email protected]"]) | ||
|
||
assert.NotEqual(t, id.PeopleDict["duplicate"], id.PeopleDict["vadim markovtsev"]) | ||
} | ||
|
||
func TestIdentityDetectorLoadPeopleDictWrongPath(t *testing.T) { | ||
|
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
Linus Torvalds|[email protected] | ||
Vadim Markovtsev|[email protected]|[email protected] | ||
Máximo Cuadros|[email protected] | ||
Máximo Cuadros|[email protected] | ||
Duplicate|[email protected] | ||
Duplicate|[email protected] |