From c4af2b031e13e282462ea8ae4311bfabe115ae9d Mon Sep 17 00:00:00 2001 From: Adam Bender Date: Wed, 11 Jun 2025 19:12:34 -0700 Subject: git-codereview: explicitly include the codereview subcommand in suggested commands If a user does not have the recommended aliases in their .gitconfig, the suggested command will not work. Several suggestions have the codereview subcommand already; this change updates all suggestions to include it. Change-Id: I3613f24172c2d90a7038f263cad93cbdcddbbbca Reviewed-on: https://go-review.googlesource.com/c/review/+/681176 LUCI-TryBot-Result: Go LUCI Reviewed-by: Junyang Shao Reviewed-by: Sean Liao Reviewed-by: Cherry Mui Auto-Submit: Sean Liao --- git-codereview/hook_test.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'git-codereview/hook_test.go') diff --git a/git-codereview/hook_test.go b/git-codereview/hook_test.go index 218b425..0c1e5cb 100644 --- a/git-codereview/hook_test.go +++ b/git-codereview/hook_test.go @@ -239,13 +239,13 @@ func TestHookPreCommit(t *testing.T) { trun(t, gt.client, "git", "add", ".") testMainDied(t, "hook-invoke", "pre-commit") - testPrintedStderr(t, "gofmt needs to format these files (run 'git gofmt'):", + testPrintedStderr(t, "gofmt needs to format these files (run 'git codereview gofmt'):", "bad.go", "!good.go", fromSlash("!test/bad"), fromSlash("test/bench/bad.go")) write(t, gt.client+"/broken.go", brokenGo, 0644) trun(t, gt.client, "git", "add", "broken.go") testMainDied(t, "hook-invoke", "pre-commit") - testPrintedStderr(t, "gofmt needs to format these files (run 'git gofmt'):", + testPrintedStderr(t, "gofmt needs to format these files (run 'git codereview gofmt'):", "bad.go", "!good.go", fromSlash("!test/bad"), fromSlash("test/bench/bad.go"), "gofmt reported errors:", "broken.go") } @@ -265,19 +265,19 @@ func TestHookChangeGofmt(t *testing.T) { t.Logf("invoking commit hook explicitly") testMainDied(t, "hook-invoke", "pre-commit") - testPrintedStderr(t, "gofmt needs to format these files (run 'git gofmt'):", "bad.go") + testPrintedStderr(t, "gofmt needs to format these files (run 'git codereview gofmt'):", "bad.go") t.Logf("change without hook installed") testCommitMsg = "foo: msg" testMainDied(t, "change") - testPrintedStderr(t, "gofmt needs to format these files (run 'git gofmt'):", "bad.go", "!running: git") + testPrintedStderr(t, "gofmt needs to format these files (run 'git codereview gofmt'):", "bad.go", "!running: git") t.Logf("change with hook installed") restore := testInstallHook(t, gt) defer restore() testCommitMsg = "foo: msg" testMainDied(t, "change") - testPrintedStderr(t, "gofmt needs to format these files (run 'git gofmt'):", "bad.go", "!running: git") + testPrintedStderr(t, "gofmt needs to format these files (run 'git codereview gofmt'):", "bad.go", "!running: git") } func TestHookPreCommitDetachedHead(t *testing.T) { @@ -295,7 +295,7 @@ func TestHookPreCommitDetachedHead(t *testing.T) { trun(t, gt.client, "git", "checkout", "HEAD^0") testMainDied(t, "hook-invoke", "pre-commit") - testPrintedStderr(t, "gofmt needs to format these files (run 'git gofmt'):", "bad.go") + testPrintedStderr(t, "gofmt needs to format these files (run 'git codereview gofmt'):", "bad.go") /* OLD TEST, back when we disabled gofmt in detached head, -- cgit v1.3