aboutsummaryrefslogtreecommitdiff
path: root/git-codereview/submit_test.go
AgeCommit message (Collapse)Author
2025-06-17git-codereview: explicitly include the codereview subcommand in suggested ↵Adam Bender
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 <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Junyang Shao <shaojunyang@google.com> Reviewed-by: Sean Liao <sean@liao.dev> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Sean Liao <sean@liao.dev>
2023-10-02git-codereview: use strings.Cutv1.7.0Dmitri Shuralyov
Basic cut functionality is available in the standard library as of Go 1.18, so today's supported Go versions (1.21 & 1.20) can use it. Also simplify some slice and map code while here. Change-Id: Ie887fc2dad542cd9a830974cf9c8373baa81ad8b Reviewed-on: https://go-review.googlesource.com/c/review/+/531955 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
2021-01-07git-codereview: add a few more testsRuss Cox
Change-Id: I17ad065e8b4c1eb00cdd2f17af82be76bae4fc09 Reviewed-on: https://go-review.googlesource.com/c/review/+/279717 Trust: Russ Cox <rsc@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2021-01-07git-codereview: update tests for "main" branch defaultRuss Cox
"git init ." leaves me on "main" now, not "master". Update tests to expect that, and update the "tracking" message too (otherwise the tests fail). Because not all gits agree about the initial branch name, set it explicitly too in the test. Fixes #42926. Change-Id: If3adb3bb53beba9efcd75cad0f081f59fba85fe7 Reviewed-on: https://go-review.googlesource.com/c/review/+/279873 Trust: Russ Cox <rsc@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Austin Clements <austin@google.com>
2020-03-11git-codereview: remove use of MergeableRuss Cox
Mergeable has been removed from the Gerrit API - it was too expensive to maintain, had racy semantics, and was too little used. As of right now, git submit fails because it doesn't see "mergeable":true in the JSON. Remove the use of it in git-codereview. Change-Id: I12c821b9dbc44183a689d510dd20104eab5a0043 Reviewed-on: https://go-review.googlesource.com/c/review/+/222937 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Andrew Bonventre <andybons@golang.org>
2019-12-16git-codereview: write hooks with execute permission in testsBryan C. Mills
The 'write' helper function previously assumed file permission 0666. We don't actually need these files to be world-writable, but we do need specific ones — scripts executed as Git commit hooks — to be executable, at least on certain platforms. Also use t.Helper() to produce more useful log lines for failures. (That was added in order to diagnose TryBot failures.) Fixes golang/go#32836 Change-Id: I2d670563f42778ef8cf645445420756599c37ac6 Reviewed-on: https://go-review.googlesource.com/c/review/+/211477 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Alexander Rakoczy <alex@golang.org>
2017-11-16git-codereview: add support for DΟ NΟT MAILRuss Cox
Also create a local DΟ NΟT SUBMIT check, although the Gerrit server is also taking care of that. While we're here, make fixup! and squash! commits non-mailable as well. (In the all caps text above the big Os are really Omicrons. Otherwise the CL would not be mailable or submittable.) Change-Id: Id1a9806b0d395d1a0bfc50ed7d7d22c64a48a2f1 Reviewed-on: https://go-review.googlesource.com/76877 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-02-05git-codereview: accept any commit spelling for mail and submitAustin Clements
Currently the mail and submit subcommands only accept commit hashes. This makes them inconsistent with other git commands (git is hard enough without having to remember another convention) and makes working with multi-commit branches cumbersome. Change mail and submit to accept any standard commit spelling. In particular, this makes it possible to use HEAD-relative names: "git mail HEAD" sends the whole current branch. We still require that the named commit be pending on the current branch to avoid accidentally naming a completely unrelated commit. Change-Id: If84d315e0fc32118a5283adfbca7a3b56f3c098c Reviewed-on: https://go-review.googlesource.com/19271 Reviewed-by: Russ Cox <rsc@golang.org>
2016-01-13git-codereview: skip TestSubmitInteractive on windows (fixes build)Alex Brainman
Updates golang/go#13406 Change-Id: Iadc8586253e794947f5048676d317f55bd1d6b62 Reviewed-on: https://go-review.googlesource.com/18557 Reviewed-by: Austin Clements <austin@google.com>
2015-11-11git-codereview: add interactive mode to submitAustin Clements
This adds a -i option to submit that brings up a list of commits to submit in an editor (a la git rebase -i), lets the user edit the list, and then submits the specified commits in the specified order. Change-Id: I88149140527c987ae856aac2598f0a992fe5654d Reviewed-on: https://go-review.googlesource.com/16677 Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-11-11git-codereview: allow multiple commit hashes for submitAustin Clements
This adds support to the submit subcommand for passing and submitting multiple commit hashes. Change-Id: Id030b07cac21d11acbeb8015fde9cb9e1acb1479 Reviewed-on: https://go-review.googlesource.com/16674 Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-01-06git-codereview: begin to handle multiple-change branchesRuss Cox
Gerrit supports multiple-change branches, and we'd like to make git-codereview useful for people using this mode of work. This CL is the first step. - remove error message on detecting a multiple-change branch - require 'git submit hash' in multiple-change branch - make git submit, git sync cleanup safe for multiple-change branch - adjust git pending output to show full information about multiple-change branch - add pending -c to show only current branch, since output is getting long We're not advertising or supporting this mode yet. For now the only way to enter it is to run 'git commit' to create the second commit. Perhaps eventually we will support something like 'git change -new'. Change-Id: I8284a7c230503061d3e6d7cce0be7d8d05c9b2a3 Reviewed-on: https://go-review.googlesource.com/2110 Reviewed-by: Andrew Gerrand <adg@golang.org> Reviewed-by: Austin Clements <austin@google.com>
2014-12-18git-codereview: rename from 'git-review' to 'git-codereview'Andrew Gerrand
Mostly trivial search and replace, except for hooks.go which includes a special case to remove the old git-review hooks. Change-Id: Ic0792bb3e26607e5e0ead88958e46c3ac08288cd Reviewed-on: https://go-review.googlesource.com/1741 Reviewed-by: Russ Cox <rsc@golang.org>