[PATCH v10 10/15] contrib: related: group persons with same email
Suggested-by: Duy Nguyen <pclouds@gmail.com>
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
contrib/related/git-related | 2 +-
contrib/related/test-related.t | 12 ++++--------
2 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/contrib/related/git-related b/contrib/related/git-related
index f94f5f4..3399307 100755
--- a/contrib/related/git-related
+++ b/contrib/related/git-related
@@ -56,7 +56,7 @@ class Persons
end
def self.get(name, email)
- id = [name, email]
+ id = email.downcase
person = @@index[id]
if not person
person = @@index[id] = Person.new(name, email)
diff --git a/contrib/related/test-related.t b/contrib/related/test-related.t
index 9da2693..a19ad32 100755
--- a/contrib/related/test-related.t
+++ b/contrib/related/test-related.t
@@ -44,8 +44,7 @@ test_expect_success "others" "
git format-patch --stdout -1 master > patch &&
git related patch | sort > actual &&
cat > expected <<-EOF &&
- John Doe <john@doe.com> (author: 33%)
- John Poppins <john@doe.com> (author: 33%)
+ John Poppins <john@doe.com> (author: 66%)
Jon Stewart <jon@stewart.com> (reviewer: 33%, author: 33%)
EOF
test_cmp expected actual
@@ -56,8 +55,7 @@ test_expect_success "multiple patches" "
git format-patch --stdout -1 master^ > patch2 &&
git related patch1 patch2 | sort > actual &&
cat > expected <<-EOF &&
- John Doe <john@doe.com> (author: 25%)
- John Poppins <john@doe.com> (author: 25%)
+ John Poppins <john@doe.com> (author: 50%)
Jon Stewart <jon@stewart.com> (reviewer: 25%, author: 25%)
Pablo Escobar <pablo@escobar.com> (author: 25%)
EOF
@@ -67,8 +65,7 @@ test_expect_success "multiple patches" "
test_expect_success "from committish" "
git related -1 master | sort > actual &&
cat > expected <<-EOF &&
- John Doe <john@doe.com> (author: 33%)
- John Poppins <john@doe.com> (author: 33%)
+ John Poppins <john@doe.com> (author: 66%)
Jon Stewart <jon@stewart.com> (reviewer: 33%, author: 33%)
EOF
test_cmp expected actual
@@ -77,8 +74,7 @@ test_expect_success "from committish" "
test_expect_success "from single rev committish" "
git related -1 master | sort > actual &&
cat > expected <<-EOF &&
- John Doe <john@doe.com> (author: 33%)
- John Poppins <john@doe.com> (author: 33%)
+ John Poppins <john@doe.com> (author: 66%)
Jon Stewart <jon@stewart.com> (reviewer: 33%, author: 33%)
EOF
test_cmp expected actual
--
1.8.4-fc