aboutsummaryrefslogtreecommitdiff
path: root/git-codereview
diff options
context:
space:
mode:
Diffstat (limited to 'git-codereview')
-rw-r--r--git-codereview/gofmt.go4
-rw-r--r--git-codereview/reword.go12
-rw-r--r--git-codereview/submit_test.go4
3 files changed, 5 insertions, 15 deletions
diff --git a/git-codereview/gofmt.go b/git-codereview/gofmt.go
index ca5f798..1df3e43 100644
--- a/git-codereview/gofmt.go
+++ b/git-codereview/gofmt.go
@@ -253,9 +253,7 @@ func runGofmt(flags int) (files []string, stderrText string) {
}
}
if flags&gofmtCommand != 0 {
- for _, file := range localFiles {
- args = append(args, file)
- }
+ args = append(args, localFiles...)
}
if *verbose > 1 {
diff --git a/git-codereview/reword.go b/git-codereview/reword.go
index 5948502..8f12405 100644
--- a/git-codereview/reword.go
+++ b/git-codereview/reword.go
@@ -142,11 +142,11 @@ func cmdReword(args []string) {
text = "# " + text // restore split separator
// Pull out # hash header line and body.
- hdr, body, _ := cut(text, "\n")
+ hdr, body, _ := strings.Cut(text, "\n")
// Cut blank lines at start and end of body but keep newline-terminated.
for body != "" {
- line, rest, _ := cut(body, "\n")
+ line, rest, _ := strings.Cut(body, "\n")
if line != "" {
break
}
@@ -221,14 +221,6 @@ func cmdReword(args []string) {
run("git", "reset", "--soft", newHash)
}
-func cut(s, sep string) (before, after string, ok bool) {
- i := strings.Index(s, sep)
- if i < 0 {
- return s, "", false
- }
- return s[:i], s[i+len(sep):], true
-}
-
var rewordProlog = `Rewording multiple commit messages.
The # lines separate the different commits and must be left unchanged.
`
diff --git a/git-codereview/submit_test.go b/git-codereview/submit_test.go
index 29f9c02..3e18fd8 100644
--- a/git-codereview/submit_test.go
+++ b/git-codereview/submit_test.go
@@ -250,12 +250,12 @@ func testSubmitMultiple(t *testing.T, gt *gitTest, srv *gerritServer) (*GerritCh
cl1 := GerritChange{
Status: "NEW",
CurrentRevision: hash1,
- Labels: map[string]*GerritLabel{"Code-Review": &GerritLabel{Approved: new(GerritAccount)}},
+ Labels: map[string]*GerritLabel{"Code-Review": {Approved: new(GerritAccount)}},
}
cl2 := GerritChange{
Status: "NEW",
CurrentRevision: hash2,
- Labels: map[string]*GerritLabel{"Code-Review": &GerritLabel{Approved: new(GerritAccount)}},
+ Labels: map[string]*GerritLabel{"Code-Review": {Approved: new(GerritAccount)}},
}
srv.setReply("/a/changes/proj~main~I0000001", gerritReply{f: func() gerritReply {