Skip to content

Commit 0b31a1c

Browse files
committed
Remove lowercasing of repo names
The lowercasing of repo names is entirely unnecessary, and only serves to complicate things for anyone trying to use the rest api. By keeping the repo names intact, there is no longer a need to first call the repos endpoint in order to lookup an actual name, if the name is the only piece of information that is needed.
1 parent 795d14a commit 0b31a1c

File tree

5 files changed

+50
-56
lines changed

5 files changed

+50
-56
lines changed

api/api.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,10 @@ func parseAsBool(v string) bool {
101101
}
102102

103103
func parseAsRepoList(v string, idx map[string]*searcher.Searcher) []string {
104-
v = strings.TrimSpace(strings.ToLower(v))
104+
v = strings.TrimSpace(v)
105105
var repos []string
106106
if v == "*" {
107-
for repo, _ := range idx {
107+
for repo := range idx {
108108
repos = append(repos, repo)
109109
}
110110
return repos

cmds/houndd/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ func makeTemplateData(cfg *config.Config) (interface{}, error) {
7979

8080
res := map[string]*config.Repo{}
8181
for name, repo := range cfg.Repos {
82-
res[strings.ToLower(name)] = repo
82+
res[name] = repo
8383
}
8484

8585
b, err := json.Marshal(res)

searcher/searcher.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"os"
1111
"path/filepath"
1212
"runtime"
13-
"strings"
1413
"sync"
1514
"time"
1615

@@ -267,10 +266,6 @@ func init() {
267266
// occurred and no other return values are valid. If an error occurs that is specific
268267
// to a particular searcher, that searcher will not be present in the searcher map and
269268
// will have an error entry in the error map.
270-
//
271-
// NOTE: The keys in the searcher map will be normalized to lower case, but not such
272-
// transformation will be done on the error map to make it easier to match those errors
273-
// back to the original repo name.
274269
func MakeAll(cfg *config.Config) (map[string]*Searcher, map[string]error, error) {
275270
errs := map[string]error{}
276271
searchers := map[string]*Searcher{}
@@ -290,7 +285,7 @@ func MakeAll(cfg *config.Config) (map[string]*Searcher, map[string]error, error)
290285
continue
291286
}
292287

293-
searchers[strings.ToLower(name)] = s
288+
searchers[name] = s
294289
}
295290

296291
if err := refs.removeUnclaimed(); err != nil {

ui/assets/js/hound.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ var Model = {
105105
var all = this.repos,
106106
seen = {};
107107
return repos.filter(function(repo) {
108-
repo = repo.toLowerCase();
109108
var valid = all[repo] && !seen[repo];
110109
seen[repo] = true;
111110
return valid;
@@ -131,7 +130,7 @@ var Model = {
131130
var data = JSON.parse(ModelData),
132131
repos = {};
133132
for (var name in data) {
134-
repos[name.toLowerCase()] = data[name];
133+
repos[name] = data[name];
135134
}
136135
this.repos = repos;
137136
next();

ui/bindata.go

Lines changed: 45 additions & 45 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)