Repository navigation
Add UI for editing ignores (fixes #502) - #721
Conversation
4662b1f to
2e3fb2b
Compare
|
+1 to a GUI for ignores. About the syntax, Open Hub selected the robots.txt syntax for reasons explained in the blog post (See also discussion in the forums) Thanks! |
|
Just starting to look at it, two things strike me. First, I think we should stick to JSON format in the REST interface here too, something like a The second is I'm not sure about adding ignores by default. In principle it seems like a good idea to ignore crap files per default, but the effects are kind of nasty due to other stuff. For example, ignoring |
|
I disagree with the JSON idea. It's like replacing file downloads with a JSON wrapper... We are retrieving and uploading the file exactly as its defined, what's the purpose of wrapping in as part of JSON? The reason I proposed the "default ignores" is because btsync did it, and because its a nice way to define what the format for the ignores are. I can remove the default ignores if you wish. |
I disagree. :) We're not shuffling a file, we're shuffling an array of strings. If nothing else, it's a shorter way to do roughly the same amount of work. This body, err := ioutil.ReadAll(r.Body)
if err != nil {
http.Error(w, err.Error(), 500)
return
}
r.Body.Close()
var lines []string
scanner := bufio.NewScanner(bytes.NewReader(body))
for scanner.Scan() {
lines = append(lines, strings.TrimSpace(scanner.Text()))
}
err = m.SetIgnores(qs.Get("repo"), lines)becomes just var input map[string][]string
err = json.NewDecoder(r.Body).Decode(&input)
r.Body.Close()
if err != nil {
http.Error(w, err.Error(), 500)
return
}
err = m.SetIgnores(qs.Get("repo"), input["ignore"])It would be even cleaner if we'd just serialized it as a []string, but I'll go with the earlier argument of holding the interface homogenous (with straight JSON objects).
I agree with this, and would have liked it in there. It's the sane thing to do. But I suspect that with the other stuff unfixed, it's going to cause more problems than it avoids. Basically, we just need to correctly handle deletes of non-empty directories (i.e. those containing ignored files) in a better way, that doesn't make the directory re-materialize on other nodes. This should be solved by my |
584a192 to
902924c
Compare
|
Updated |
902924c to
709570a
Compare
Feel free to suggest better texts/messages, as I am usually pretty bad at it.