1diff --git a/config.example.scfg b/config.example.scfg
2index 3ba89594f3683497a1ab44cdff372ed1eb1dfebc..2ed13cd3141e7cb4451521ef61950560e369b770 100644
3--- a/config.example.scfg
4+++ b/config.example.scfg
5@@ -16,7 +16,12 @@ # alphabetical-asc
6 # alphabetical-desc
7 # lastcommit-asc
8 # lastcommit-desc
9+# default: unordered
10 order-by lastcommit-asc
11+
12+# removes ".git" suffix from the name of the repository.
13+# default: false
14+remove-suffix true
15
16 # repository section is order dependent where the first repository has priority
17 # in case of conflict. Repository has also priority over scan. The order
18diff --git a/pkg/config/config.go b/pkg/config/config.go
19index 60a34443248c65059a5aeed1b49e6055acab33fa..9dbf449a264d682aabc025b2d2b90f6a0e1ef828 100644
20--- a/pkg/config/config.go
21+++ b/pkg/config/config.go
22@@ -9,6 +9,7 @@ "os"
23 "path"
24 "path/filepath"
25 "strconv"
26+ "strings"
27
28 "git.gabrielgio.me/cerrado/pkg/u"
29 "git.sr.ht/~emersion/go-scfg"
30@@ -41,14 +42,15 @@
31 // configuration represents file configuration.
32 // fields needs to be exported to cmp to work
33 configuration struct {
34- Scans []*scan
35- RootReadme string
36+ AESKey string
37 ListenAddr string
38+ OrderBy string
39 Passphrase string
40- SyntaxHighlight string
41- AESKey string
42- OrderBy string
43+ RemoveSuffix bool
44 Repositories []*GitRepositoryConfiguration
45+ RootReadme string
46+ Scans []*scan
47+ SyntaxHighlight string
48 }
49
50 // This is a per repository configuration.
51@@ -65,13 +67,14 @@ // database repositories).
52 // This holds all the function necessary to ask for configuration
53 // information.
54 ConfigurationRepository struct {
55- rootReadme string
56- listenAddr string
57- passphrase []byte
58 aesKey []byte
59- syntaxHighlight string
60+ listenAddr string
61 orderBy OrderBy
62+ passphrase []byte
63+ removeSuffix bool
64 repositories []*GitRepositoryConfiguration
65+ rootReadme string
66+ syntaxHighlight string
67 }
68 )
69
70@@ -93,6 +96,7 @@ passphrase: []byte(config.Passphrase),
71 repositories: config.Repositories,
72 rootReadme: config.RootReadme,
73 syntaxHighlight: config.SyntaxHighlight,
74+ removeSuffix: config.RemoveSuffix,
75 orderBy: parseOrderBy(config.OrderBy),
76 }
77
78@@ -172,8 +176,14 @@ }
79
80 fullPath := path.Join(scanPath, e.Name())
81 if !c.repoExits(fullPath) {
82+
83+ name := e.Name()
84+ if c.removeSuffix {
85+ name = strings.TrimSuffix(name, ".git")
86+ }
87+
88 c.repositories = append(c.repositories, &GitRepositoryConfiguration{
89- Name: e.Name(),
90+ Name: name,
91 Path: fullPath,
92 Public: public,
93 })
94@@ -234,6 +244,11 @@ if err != nil {
95 return nil, err
96 }
97
98+ err = setRemoveSuffix(block, &config.RemoveSuffix)
99+ if err != nil {
100+ return nil, err
101+ }
102+
103 err = setRepositories(block, &config.Repositories)
104 if err != nil {
105 return nil, err
106@@ -347,6 +362,11 @@
107 func setListenAddr(block scfg.Block, listenAddr *string) error {
108 scanDir := block.Get("listen-addr")
109 return setString(scanDir, listenAddr)
110+}
111+
112+func setRemoveSuffix(block scfg.Block, remove *bool) error {
113+ scanDir := block.Get("remove-suffix")
114+ return setBool(scanDir, remove)
115 }
116
117 func setScan(block scfg.Block, scans *[]*scan) error {
118diff --git a/pkg/config/config_test.go b/pkg/config/config_test.go
119index cc58ce966db251429c66f6fa18baaa4eda2b339f..949238e511b755d33df8f9181fbcdb18263b6021 100644
120--- a/pkg/config/config_test.go
121+++ b/pkg/config/config_test.go
122@@ -110,6 +110,8 @@ listen-addr unix://var/run/cerrado/cerrado.sock
123 passphrase $2a$14$VnB/ZcB1DUDkMnosRA6Y7.dj8h5eroslDxTeXlLwfQX/x86mh6WAq
124 aes-key 8XHptZxSWCGs1m7QzztX5zNQ7D9NiQevVX0DaUTNMbDpRwFzoJiB0U7K6O/kqIt01jJVgzBUfiR8ES46ZLLb4w==
125 syntax-highlight monokailight
126+order-by lastcommit-desc
127+remove-suffix true
128
129 scan "/srv/git" {
130 public true
131@@ -134,6 +136,8 @@ ListenAddr: "unix://var/run/cerrado/cerrado.sock",
132 Passphrase: "$2a$14$VnB/ZcB1DUDkMnosRA6Y7.dj8h5eroslDxTeXlLwfQX/x86mh6WAq",
133 AESKey: "8XHptZxSWCGs1m7QzztX5zNQ7D9NiQevVX0DaUTNMbDpRwFzoJiB0U7K6O/kqIt01jJVgzBUfiR8ES46ZLLb4w==",
134 SyntaxHighlight: "monokailight",
135+ OrderBy: "lastcommit-desc",
136+ RemoveSuffix: true,
137 Repositories: []*GitRepositoryConfiguration{
138 {
139 Name: "linux.git",