aboutsummaryrefslogtreecommitdiff
path: root/git-codereview/reword.go
diff options
context:
space:
mode:
Diffstat (limited to 'git-codereview/reword.go')
-rw-r--r--git-codereview/reword.go12
1 files changed, 2 insertions, 10 deletions
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.
`