git-codereview: print gofmt commands in verbose mode
Change-Id: I589b8daa3504b99374796079bace5a9f4aa0620d
Reviewed-on: https://go-review.googlesource.com/2194
Reviewed-by: Russ Cox <rsc@golang.org>
diff --git a/git-codereview/doc.go b/git-codereview/doc.go
index 7ef3940..8f57107 100644
--- a/git-codereview/doc.go
+++ b/git-codereview/doc.go
@@ -35,7 +35,7 @@
All commands accept these global flags:
-The -v flag prints all Git commands that make changes.
+The -v flag prints all commands that make changes.
The -n flag prints all commands that would be run, but does not run them.
diff --git a/git-codereview/gofmt.go b/git-codereview/gofmt.go
index 529364b..4507a2b 100644
--- a/git-codereview/gofmt.go
+++ b/git-codereview/gofmt.go
@@ -193,6 +193,9 @@
}
}
+ if *verbose > 1 {
+ fmt.Fprintln(stderr(), commandString("gofmt", args))
+ }
cmd := exec.Command("gofmt", args...)
var stdout, stderr bytes.Buffer
cmd.Stdout = &stdout
@@ -235,6 +238,7 @@
for i, name := range updateIndex {
fmt.Fprintf(&buf, "100644 %s\t%s\n", hashes[i], name)
}
+ verbosef("git update-index --index-info")
cmd := exec.Command("git", "update-index", "--index-info")
cmd.Stdin = &buf
out, err := cmd.CombinedOutput()
diff --git a/git-codereview/review.go b/git-codereview/review.go
index fe8867e..cc8b937 100644
--- a/git-codereview/review.go
+++ b/git-codereview/review.go
@@ -31,7 +31,7 @@
flags.Usage = func() {
fmt.Fprintf(stderr(), usage, os.Args[0], os.Args[0])
}
- flags.Var(verbose, "v", "report git commands")
+ flags.Var(verbose, "v", "report commands")
flags.BoolVar(noRun, "n", false, "print but do not run commands")
}
@@ -48,7 +48,7 @@
See the docs for details: https://godoc.org/golang.org/x/review/git-codereview
-The -v flag prints all Git commands that make changes.
+The -v flag prints all commands that make changes.
The -n flag prints all commands that would be run, but does not run them.
Available commands: