]> xenbits.xensource.com Git - people/gdunlap/xsatool/commitdiff
Repo: Refuse to execute without a command except for 'git clone'
authorGeorge Dunlap <george.dunlap@citrix.com>
Mon, 26 Jun 2017 11:12:55 +0000 (12:12 +0100)
committerGeorge Dunlap <george.dunlap@citrix.com>
Mon, 26 Jun 2017 11:22:04 +0000 (12:22 +0100)
Running with a non-open repo could destroy the wrong data.

Signed-off-by: George Dunlap <george.dunlap@citrix.com>
git.go

diff --git a/git.go b/git.go
index e91d57864322fa09d875c8d1e66a982e9640ddcd..0226d566868dcaa297e1a0a0df3a3cbbdd2b35d9 100644 (file)
--- a/git.go
+++ b/git.go
@@ -40,6 +40,8 @@ func (r Repo) gitCmd(args ...string) (out []byte, err error) {
        x := append([]string(nil), args...)
        if r.Path != "" {
                x = append([]string{"-C", r.Path}, x...)
+       } else if x[0] != "clone" {
+               panic("No path!\n")
        }
        fmt.Println(x)
        out, err = exec.Command("git", x...).CombinedOutput()