git-codereview: disable message about skipped cherry-picks in sync
Sync very frequently is done to zero out submitted CLs.
New git versions print
hint: use --reapply-cherry-picks to include skipped commits
hint: Disable this message with "git config advice.skippedCherryPicks false"
This message is noise more often than signal, so disable it during sync.
Change-Id: Ida8867cbd614027f43bbbe6e6389a8920aae5293
Reviewed-on: https://go-review.googlesource.com/c/review/+/351209
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
diff --git a/git-codereview/sync.go b/git-codereview/sync.go
index 2d93bcb..f8233f1 100644
--- a/git-codereview/sync.go
+++ b/git-codereview/sync.go
@@ -56,10 +56,16 @@
// We want to pull in the remote changes from the upstream branch
// and rebase the current pending commit (if any) on top of them.
// If there is no pending commit, the pull will do a fast-forward merge.
+ //
+ // The -c advice.skippedCherryPicks=false disables this message:
+ //
+ // hint: use --reapply-cherry-picks to include skipped commits
+ // hint: Disable this message with "git config advice.skippedCherryPicks false"
+ //
if *verbose > 1 {
- run("git", "pull", "-q", "-r", "-v", "origin", strings.TrimPrefix(b.OriginBranch(), "origin/"))
+ run("git", "-c", "advice.skippedCherryPicks=false", "pull", "-q", "-r", "-v", "origin", strings.TrimPrefix(b.OriginBranch(), "origin/"))
} else {
- run("git", "pull", "-q", "-r", "origin", strings.TrimPrefix(b.OriginBranch(), "origin/"))
+ run("git", "-c", "advice.skippedCherryPicks=false", "pull", "-q", "-r", "origin", strings.TrimPrefix(b.OriginBranch(), "origin/"))
}
b = CurrentBranch() // discard any cached information
diff --git a/git-codereview/sync_test.go b/git-codereview/sync_test.go
index 31f4800..884168c 100644
--- a/git-codereview/sync_test.go
+++ b/git-codereview/sync_test.go
@@ -118,15 +118,15 @@
// also exercising -v parsing.
testMain(t, "sync", "-v=true")
testNoStdout(t)
- testPrintedStderr(t, "git pull -q -r origin main")
+ testPrintedStderr(t, "git -c advice.skippedCherryPicks=false pull -q -r origin main")
testMain(t, "sync", "-v=1")
testNoStdout(t)
- testPrintedStderr(t, "git pull -q -r origin main")
+ testPrintedStderr(t, "git -c advice.skippedCherryPicks=false pull -q -r origin main")
testMain(t, "sync", "-v")
testNoStdout(t)
- testPrintedStderr(t, "git pull -q -r origin main")
+ testPrintedStderr(t, "git -c advice.skippedCherryPicks=false pull -q -r origin main")
testMain(t, "sync", "-v=false")
testNoStdout(t)