| Age | Commit message (Collapse) | Author |
|
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>
|
|
io/ioutil is now deprecated. Use non-deprecated equivalents.
Change-Id: Iad1cc9c14dbdad3a6f9ada25072bc194bace4081
Reviewed-on: https://go-review.googlesource.com/c/review/+/543615
Reviewed-by: qiulaidongfeng <2645477756@qq.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
|
|
Display warning message when a hook is already installed and is
different from the one installed by git-codereview.
Improves upon CL 184417.
Fixes golang/go#16777
Change-Id: I7579a3e86572e8b74f92317973e7cc7094b3942d
Reviewed-on: https://go-review.googlesource.com/c/review/+/377034
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
|
|
"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>
|
|
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>
|
|
Gerrit requires 'Change-Id:' lines to be included in each commit
message, but they are not the only kind of 'metadata line' that might
appear in a commit message. Metadata lines observed by other systems
include 'Bug:' and 'Signed-off-by:'. This change ensures that the
commit-msg hook adds its 'Change-Id:' line to the set of metadata lines,
separated only by a single linefeed, rather than creating a new set by
inserting two line feeds.
Change-Id: Ia3bdce6f52f663685eea1e648874ef81ddb2bd91
Reviewed-on: https://go-review.googlesource.com/c/review/+/169097
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
|
|
git 2.13.0 changed the behavior of git rev-parse --git-path from
printing a path relative to the repo root to printing a path relative
to the working directory. This breaks git-codereview's hook
installation when a git-codereview command is invoked from a directory
other than the repo root, since it will try to resolve this path as
relative to the repo root.
Fix this by running git rev-parse from the repo root, so it behaves
the same either way.
Fixes golang/go#19477.
Change-Id: Ia5e1b81da5041365d817daf9f5979df0772ede4b
Reviewed-on: https://go-review.googlesource.com/38010
Reviewed-by: Russ Cox <rsc@golang.org>
|
|
If the commit message is verbose it shows the diff being committed. This
can be shown by either `git commit --verbose` or setting the following
in your git config:
[commit]
verbose = true
The diff is uncomented and shown after a "everything below will be
removed" comment section. Identify it and do remove everything under it,
as otherwise the diff would get mixed up with the commit message.
Fixes golang/go#16376.
Change-Id: Ia69aeaf36a1c8471da423a142fb233168d455a5d
Reviewed-on: https://go-review.googlesource.com/25342
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
|
|
Loading codereview.cfg from origin/master
effictively means that users have to ask permission
to use git-codereview.
With this change, users can opt to add the file,
.gitignore it, and forget about it.
Looking in origin/master also makes it hard
to try out git-codereview on a project
without having to commit to it.
Instead of requiring codereview.cfg be checked in
anywhere, just look on the filesystem for it.
I can't figure out why I ever thought
doing otherwise was a good idea.
There are some other related fixes floating around,
which might also be good to put in,
but this is seems like a good stop-gap,
since it is a minimal change;
codereview.cfg continues to work for anyone
currently using it.
Related: golang/go#15616
Related: golang/go#15073
Change-Id: I1e377819f8eb8c8fecf9f022459551a3e8b93d48
Reviewed-on: https://go-review.googlesource.com/24001
Reviewed-by: Andrew Gerrand <adg@golang.org>
|
|
Use 'git rev-parse' to obtain the repo root (toplevel) and the hooks
directory (git-path hooks).
Git knows better how to handle more complex scenarios, e.g. in a
linked worktree (created using "git worktree add"), ".git" is not
a directory but a regular file, that contains the path to the linked
gitdir, that then contains the path to the main gitdir. The hooks
should be there.
For older version git versions without --git-path (and without
worktree), fallback to the previous approach.
Updates golang/go#12182.
Change-Id: I7a90362409fc5000282db95c4ec2ab5052ae59a8
Reviewed-on: https://go-review.googlesource.com/19882
Run-TryBot: Andrew Gerrand <adg@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
|
|
Every time I accidentally type 'git pending' in a non-Gerrit repository,
that command installs hooks, and then I have to zero the hook files
to keep working.
First, don't install the hooks if this looks like a non-Gerrit git repo.
That seems like it will play well with others.
But, people might also want to use the non-Gerrit parts of the tool,
so if people do say 'git codereview hooks', let that install them.
And then if the hooks are invoked in a non-Gerrit repo, selectively
disable the Gerrit-specific parts. For example, if it's not a Gerrit repo
we might still want to check and fix 'Fixes #N' lines if directed by the
config, but we don't want to add Change-Id lines.
Now that things are a bit better behaved, also leave the hooks on
in detached head mode. I've found that it's quite frustrating not
to have the hooks on when working midway through git rebase -i.
If we find reasons that the hooks were off we can try to figure out
how to split the difference.
Fixes golang/go#12170.
Change-Id: I69fa156ce4fd11c0c84416088cd972957ce1ce6d
Reviewed-on: https://go-review.googlesource.com/19560
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Austin Clements <austin@google.com>
|
|
Detection of Rietveld-style fix messages is already in place as a warning,
but was broken when we added feature to rewrite issue references in commit edbdf1a7 .
To fix this, we automatically reformat the fix message into the GitHub style.
We also forget to write the change to the fix message back,
if we do not also need to write Change-Id and origin branch.
This change also fixes this.
Fixes golang/go#11472
Change-Id: Ie77358867e38cf976a0688b6e2f80525dae3891e
Reviewed-on: https://go-review.googlesource.com/15754
Reviewed-by: Andrew Gerrand <adg@golang.org>
|
|
This should help prevent the situation in CL 8653.
Change-Id: I03e4868656a86e69e11f3e0545feb1681fb0f628
Reviewed-on: https://go-review.googlesource.com/8671
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
|
|
We have a single repo against which all issues are filed.
GitHub supports closing issues in other repos,
but it is easy to forget to use the magic syntax.
To fix that, rewrite issue references in the commit msg hook.
To that end, introduce a repo-level config file,
located at REPOROOT/codereview.cfg.
The config is always read from origin/master.
Config lines are of the form "key: value".
Lines beginning with # are comments.
To designate a repo as the issues repo, add
issuerepo: USERNAME/REPO
to the config.
Fixes golang/go#9273.
Change-Id: I31ec98883641bbf0c149f3619769231f6a452512
Reviewed-on: https://go-review.googlesource.com/4131
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
|
|
Fixes #9648
Change-Id: I86995c262fee31eb17c1dcb6c9e48fe632b78cf0
Reviewed-on: https://go-review.googlesource.com/6425
Reviewed-by: Russ Cox <rsc@golang.org>
|
|
Change-Id: I0fc5df1e23cf18a78aa0339ac16901214d7924e4
Reviewed-on: https://go-review.googlesource.com/5552
Reviewed-by: Andrew Gerrand <adg@golang.org>
|
|
Fixes golang/go#9522
Change-Id: Ic06feda22711fe320a789957620af98f38f1df8f
Reviewed-on: https://go-review.googlesource.com/4130
Reviewed-by: Andrew Gerrand <adg@golang.org>
|
|
The tests of git-codereview fail if the aliases are not configured for
"git codereview change" to "git change". This can be fixed by simply using the full
commands for the codereview commands.
Change-Id: I6b8df2610d0956a8153ce6190d0677d7f2b12ac9
Reviewed-on: https://go-review.googlesource.com/2976
Reviewed-by: Andrew Gerrand <adg@golang.org>
|
|
Change-Id: I9b0b178188a8095af14445f90a16dc32050556f5
Reviewed-on: https://go-review.googlesource.com/2784
Reviewed-by: Andrew Gerrand <adg@golang.org>
|
|
For example this will add [dev.cc] to the work on the dev.cc (C to Go conversion) branch,
and it will add [release-branch.go1.4] to the upcoming 1.4.1 cherry-pick CLs.
Change-Id: I59fff85ced61453796b52c738a47ea1fc4a5bf36
Reviewed-on: https://go-review.googlesource.com/2782
Reviewed-by: Andrew Gerrand <adg@golang.org>
|
|
- "git gofmt" uses "git checkout-index" command that is broken if
used with many arguments - limit number of arguments passed to
"git checkout-index";
- change / into \ on windows when matching git output on windows;
- add .gitattributes to test repository to make it look more like
all real Go repositories;
- make sure no files left behind in /tmp on windows.
Fixes golang/go#9433.
Change-Id: Ifceacfffd1cd4b02190d7e941611d0d0f3c48cdd
Reviewed-on: https://go-review.googlesource.com/2089
Reviewed-by: Russ Cox <rsc@golang.org>
|
|
- make it clearer what the random git command at the end of failures means
- avoid some problems with detached HEAD mode in hooks run during git rebase
- redirect all stdout/stderr into test buffers
Change-Id: I102f22fc870f69c884728eaa46ecc95792d5b795
Reviewed-on: https://go-review.googlesource.com/2011
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
|
|
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>
|