Skip to content

Commit

Permalink
Merge pull request hound-search#240 from bschlenk/reponames
Browse files Browse the repository at this point in the history
Remove lowercasing of repo names
  • Loading branch information
kellegous committed Mar 23, 2017
2 parents c68f905 + 0b31a1c commit d6a73ac
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 56 deletions.
4 changes: 2 additions & 2 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ func parseAsBool(v string) bool {
}

func parseAsRepoList(v string, idx map[string]*searcher.Searcher) []string {
v = strings.TrimSpace(strings.ToLower(v))
v = strings.TrimSpace(v)
var repos []string
if v == "*" {
for repo, _ := range idx {
for repo := range idx {
repos = append(repos, repo)
}
return repos
Expand Down
2 changes: 1 addition & 1 deletion cmds/houndd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func makeTemplateData(cfg *config.Config) (interface{}, error) {

res := map[string]*config.Repo{}
for name, repo := range cfg.Repos {
res[strings.ToLower(name)] = repo
res[name] = repo
}

b, err := json.Marshal(res)
Expand Down
7 changes: 1 addition & 6 deletions searcher/searcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"os"
"path/filepath"
"runtime"
"strings"
"sync"
"time"

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

searchers[strings.ToLower(name)] = s
searchers[name] = s
}

if err := refs.removeUnclaimed(); err != nil {
Expand Down
3 changes: 1 addition & 2 deletions ui/assets/js/hound.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ var Model = {
var all = this.repos,
seen = {};
return repos.filter(function(repo) {
repo = repo.toLowerCase();
var valid = all[repo] && !seen[repo];
seen[repo] = true;
return valid;
Expand All @@ -131,7 +130,7 @@ var Model = {
var data = JSON.parse(ModelData),
repos = {};
for (var name in data) {
repos[name.toLowerCase()] = data[name];
repos[name] = data[name];
}
this.repos = repos;
next();
Expand Down
90 changes: 45 additions & 45 deletions ui/bindata.go

Large diffs are not rendered by default.

0 comments on commit d6a73ac

Please sign in to comment.