From b8802097af006890846f7c752f5b5d45fe40d070 Mon Sep 17 00:00:00 2001 From: Kemal Zebari Date: Fri, 25 Oct 2024 23:31:30 -0700 Subject: [PATCH] Add check for co-author email = author email --- services/repository/contributors_graph.go | 4 ++++ .../ab/60139e57bea4f9dc090a72cf97b7236d152a4b | Bin 0 -> 166 bytes .../f7/eee4e802f39ec0dadc5f872c86d4ee440b741d | Bin 0 -> 206 bytes .../branch-with-duplicated-co-author-entries | 2 +- 4 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 tests/gitea-repositories-meta/user2/repo2.git/objects/ab/60139e57bea4f9dc090a72cf97b7236d152a4b create mode 100644 tests/gitea-repositories-meta/user2/repo2.git/objects/f7/eee4e802f39ec0dadc5f872c86d4ee440b741d diff --git a/services/repository/contributors_graph.go b/services/repository/contributors_graph.go index 41c9c4f8ab..fa2d2360ec 100644 --- a/services/repository/contributors_graph.go +++ b/services/repository/contributors_graph.go @@ -161,6 +161,10 @@ func getExtendedCommitStats(repo *git.Repository, revision string /*, limit int break } coAuthorName, coAuthorEmail, err := util.ParseCommitTrailerValueWithAuthor(line) + if authorEmail == coAuthorEmail { + // Authors shouldn't be co-authors too. + continue + } if err != nil { continue } diff --git a/tests/gitea-repositories-meta/user2/repo2.git/objects/ab/60139e57bea4f9dc090a72cf97b7236d152a4b b/tests/gitea-repositories-meta/user2/repo2.git/objects/ab/60139e57bea4f9dc090a72cf97b7236d152a4b new file mode 100644 index 0000000000000000000000000000000000000000..5c4919fb1bdd8644a53c2e48bc84cf1683027a97 GIT binary patch literal 166 zcmV;X09pTd0fo*%3PLdq1W?yKMfRek`T3~@5q04`(*B5owNfj1e0u}8!@OZ~E#=;U zd|35n21&iz!bYaVJS{=8Wn!PABxB1l;%+9(?xoG11LCYXh`&w~i3S@bFSe5~1wr(} zGp2b=IQ{fnZE&d-&e~vqtu<*o+E>f#VcT5G0lW~$D9jPoNQiEv<6XCZE>Mibhyoi7 U!@1M4K(}|_e#^uC09~I$mL=&?)Bpeg literal 0 HcmV?d00001 diff --git a/tests/gitea-repositories-meta/user2/repo2.git/objects/f7/eee4e802f39ec0dadc5f872c86d4ee440b741d b/tests/gitea-repositories-meta/user2/repo2.git/objects/f7/eee4e802f39ec0dadc5f872c86d4ee440b741d new file mode 100644 index 0000000000000000000000000000000000000000..1e3c7faf58db56aa27e93e2f5e56685ba13971c0 GIT binary patch literal 206 zcmV;<05Sh~0o9PfN<%RaMP27B<_BI$@{&wPib#dx5BLF-WP*jpJVFZEuQ#9@H@bE+ zTrT&(VN$F0JirBWH@XOj7c|LnRl|68FKWjk~-J;25-7NjyfG zbIM7RX0)jgMzm|l##?q#@pZhm4yV@O$Q=%)waEQZ-nniU*`-z=z@YIVc%lG{My=Is zr`?c0IZI@nHu%k{mo4)Ucy3j8H7oVhmM;OxOZ>Qp)A@FT<8_`xnK91vL*-upzr0d? I0-?Q|(ach0^8f$< literal 0 HcmV?d00001 diff --git a/tests/gitea-repositories-meta/user2/repo2.git/refs/heads/branch-with-duplicated-co-author-entries b/tests/gitea-repositories-meta/user2/repo2.git/refs/heads/branch-with-duplicated-co-author-entries index c17567e1fb..f8c5eee90d 100644 --- a/tests/gitea-repositories-meta/user2/repo2.git/refs/heads/branch-with-duplicated-co-author-entries +++ b/tests/gitea-repositories-meta/user2/repo2.git/refs/heads/branch-with-duplicated-co-author-entries @@ -1 +1 @@ -79a64f10ca2ea21fa2a94102751f0dd9f2c15ce8 +f7eee4e802f39ec0dadc5f872c86d4ee440b741d