diff options
author | Hal Canary <halcanary@google.com> | 2017-01-30 12:27:14 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-01-30 17:47:31 +0000 |
commit | c349f7f6aecbdb304ae5cd05bb599ab87b0e3418 (patch) | |
tree | 95088685856abea7676895a988959c0c446b6681 /experimental | |
parent | 5917a252bff9f4ba0916de4eaa365220776318e1 (diff) |
experimental/documentation/gerrit.md: improvements
https://skia.googlesource.com/skia/+/master/experimental/documentation/gerrit.md
NOTRY=true
Change-Id: I90d8e16e9d6146fefe0199bb98d5f8eea31d4e8f
Reviewed-on: https://skia-review.googlesource.com/7750
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
Diffstat (limited to 'experimental')
-rw-r--r-- | experimental/documentation/gerrit.md | 32 | ||||
-rw-r--r-- | experimental/tools/setup-gerrit | 44 |
2 files changed, 59 insertions, 17 deletions
diff --git a/experimental/documentation/gerrit.md b/experimental/documentation/gerrit.md index e30458b408..4a6b2db390 100644 --- a/experimental/documentation/gerrit.md +++ b/experimental/documentation/gerrit.md @@ -4,16 +4,11 @@ Using Gerrit without git-cl setup ----- - cd ...skia_source_dir... +<pre class="code"><code> +cd ...skia_source_dir... - curl -Lo .git/hooks/commit-msg \ - https://skia-review.googlesource.com/tools/hooks/commit-msg - - chmod +x .git/hooks/commit-msg - - git remote set-url origin https://skia.googlesource.com/skia.git - - git config branch.autosetuprebase always +sh [experimental/tools/setup-gerrit](../tools/setup-gerrit) +</code></pre> creating a change @@ -32,13 +27,13 @@ creating a change 3. Squash the commits: - MSG="$(git log --format='%B' ^@{u} @)" - git reset --soft $(git merge-base @ @{u}) - git commit -m "$MSG" -e + git squash-commits + + This is only needed if you have more than one commit on your branch. 4. Push to Gerrit - git push origin @:refs/for/master%cc=reviews@skia.org + git gerrit-push-master updating a change @@ -48,12 +43,15 @@ updating a change 1. Edit your commits more. echo 3 > whitespace.txt - git commit -a --amend --reuse-message=@ + git amend-head + +2. Re-squash if needed. (Not needed if you only amended your original commit.) + -2. Re-squash if needed. +3. Push to Gerrit. + git gerrit-push-master this is a message -3. Push to Gerrit + The title of this patchset will be "this is a message". - git push origin @:refs/for/master%m=this_is_a_message diff --git a/experimental/tools/setup-gerrit b/experimental/tools/setup-gerrit new file mode 100644 index 0000000000..be372b6975 --- /dev/null +++ b/experimental/tools/setup-gerrit @@ -0,0 +1,44 @@ +#! /bin/sh + +# Copyright 2017 Google Inc. +# +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +set -x +set -e + +cd "$(dirname "$0")/../.." + + +### Configure the Change-Id commit-msg Git hook + +commit_message_path="$(git rev-parse --git-dir)/hooks/commit-msg" + +curl -Lo "$commit_message_path" \ + 'https://gerrit-review.googlesource.com/tools/hooks/commit-msg' + +chmod +x "$commit_message_path" + +### Verify that origin points at the canonical origin, not github + +git remote set-url origin 'https://skia.googlesource.com/skia.git' + +### Skia uses a linear history, so rebase-on-pull is a good idea + +git config branch.autoSetupRebase 'always' + +### this alias does the heavy lifting of talking to gerrit + +git config alias.gerrit-push-master \ + '!f() { git push origin @:refs/for/master%m=$(echo "$*"|sed "s/[^a-zA-Z0-9]/_/g");};f' + +### this alias ensures that your branch has ony one commit on it + +git config alias.squash-commits \ + '!MSG="$(git log --format=%B ^@{u} @)";git reset --soft $(git merge-base @ @{u});git commit -m "$MSG" -e' + +### Amend the HEAD head commit without changing the commit message + +git config alias.amend-head 'commit --all --amend --reuse-message=@' + |