| 1 | package main |
| 2 | |
| 3 | import "testing" |
| 4 | |
| 5 | // A push is refused until the host converges, so what reads as a push has |
| 6 | // to be everything git-shell would run as receive-pack. git-shell turns |
| 7 | // "git" and any whitespace into "git-" before it looks the command up. |
| 8 | func TestEverySpellingOfReceivePackIsAPush(t *testing.T) { |
| 9 | for command, push := range map[string]bool{ |
| 10 | "git-receive-pack 'project.git'": true, |
| 11 | "git receive-pack 'project.git'": true, |
| 12 | "git\treceive-pack 'project.git'": true, |
| 13 | "git-receive-pack": true, |
| 14 | "git-upload-pack 'project.git'": false, |
| 15 | "git upload-pack 'project.git'": false, |
| 16 | "git-upload-archive 'project.git'": false, |
| 17 | "env": false, |
| 18 | } { |
| 19 | if got := isPush(command); got != push { |
| 20 | t.Errorf("isPush(%q) = %v, want %v", command, got, push) |
| 21 | } |
| 22 | } |
| 23 | } |