Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Clone

Read only, no credentials:

https://rodent.software/vole.git

Write over SSH with a registered key:

git clone ssh://git@rodent.software:2222/vole.git

A free and open-source forge that lives in your Git repo.

Show real accounts as repository contributors

a32a859a08276681497be390d6f7195098a97ab4 · Keenan Nemetz · 5d ago · parent 802e0e52

Show real accounts as repository contributors

Count contributors from the change and issue records instead of the author text in commits: changes merged, issues those changes fixed, issues the reporter opened that were fixed, and reviews that named the merged head. The overview lists accounts by that work with compact icon counts and full labels in tooltips. The shortlog-derived contributor table and its refresh path are gone.

core/git/stats_test.go −67

@@ -1,67 +0,0 @@
1 package git
2
3 import (
4 "os"
5 "os/exec"
6 "path/filepath"
7 "strings"
8 "testing"
9 )
10
11 // contributorsRepo writes two commits by one author and one by another, so the
12 // order and the identity parsing are both exercised.
13 func contributorsRepo(t *testing.T) string {
14 t.Helper()
15 dir := t.TempDir()
16 run := func(env []string, args ...string) {
17 t.Helper()
18 cmd := exec.Command("git", args...)
19 cmd.Dir = dir
20 cmd.Env = append(os.Environ(),
21 "GIT_CONFIG_GLOBAL=/dev/null", "GIT_CONFIG_SYSTEM=/dev/null",
22 "GIT_AUTHOR_NAME=vole", "GIT_AUTHOR_EMAIL=vole@example.com",
23 "GIT_COMMITTER_NAME=vole", "GIT_COMMITTER_EMAIL=vole@example.com")
24 cmd.Env = append(cmd.Env, env...)
25 if out, err := cmd.CombinedOutput(); err != nil {
26 t.Fatalf("git %s: %v: %s", strings.Join(args, " "), err, out)
27 }
28 }
29 run(nil, "init", "-q", "-b", "main")
30 commit := func(file, who, email string) {
31 t.Helper()
32 if err := os.WriteFile(filepath.Join(dir, file), []byte(file+"\n"), 0o644); err != nil {
33 t.Fatal(err)
34 }
35 run(nil, "add", "-A")
36 run([]string{"GIT_AUTHOR_NAME=" + who, "GIT_AUTHOR_EMAIL=" + email}, "commit", "-qm", who)
37 }
38 commit("a.txt", "Ada", "ada@example.com")
39 commit("b.txt", "Ada", "ada@example.com")
40 commit("c.txt", "Grace", "grace@example.com")
41 return dir
42 }
43
44 func TestContributorsCountsAuthors(t *testing.T) {
45 r := open(t, contributorsRepo(t))
46 got, err := r.Contributors("main")
47 if err != nil {
48 t.Fatalf("Contributors: %v", err)
49 }
50 if len(got) != 2 {
51 t.Fatalf("contributors = %+v, want two", got)
52 }
53 if got[0].Name != "Ada" || got[0].Commits != 2 || got[0].Email != "ada@example.com" {
54 t.Fatalf("first contributor = %+v", got[0])
55 }
56 if got[1].Name != "Grace" || got[1].Commits != 1 {
57 t.Fatalf("second contributor = %+v", got[1])
58 }
59 }
60
61 func TestContributorsEmptyRevision(t *testing.T) {
62 r := open(t, contributorsRepo(t))
63 got, err := r.Contributors("")
64 if err != nil || got != nil {
65 t.Fatalf("empty revision = %+v, %v", got, err)
66 }
67 }