Paul Martin
2016-04-30 a502d96a860456ec5e8c96761db70f7cabb74751
src/site/tickets_using.mkd
@@ -28,7 +28,7 @@
    ...add a single commit...
    git push origin HEAD:refs/for/new
    # read ticket id from server output
    git branch --set-upstream-to=origin/ticket/{id}
    git branch -u origin/ticket/{id}
### Creating the first Patchset for an Existing Ticket
@@ -42,14 +42,14 @@
    cd repo
    git checkout -b ticket/{id}
    ...add one or more commits...
    git push --set-upstream origin ticket/{id}
    git push -u origin ticket/{id}
### Safely adding commits to a Patchset for an Existing Ticket
*Who can add commits to an existing patchset?*
1. The author of the ticket
2. The author of the initial patchset
1. The ticket author
2. The initial patchset author
3. The person set as *responsible*
4. Any user with write (RW) permissions to the repository
@@ -58,6 +58,14 @@
    git pull --ff-only
    ...add one or more commits...
    git push
### Checking-Out a Named Branch for an Existing Ticket with a Patchset
If you prefer to name your local ticket branches rather than using the default integer ids, you can do this with a little more syntax.
    git checkout -b my_fix --track origin/ticket/{id}
This will create a local branch named *my_fix* which tracks the upstream ticket branch.
### Rewriting a Patchset (amend, rebase, squash)
@@ -76,21 +84,18 @@
### Updating your copy of a rewritten Patchset
If a patchset has been rewritten you can no longer simply *pull* to update.  Let's assume your checkout *does not* have any unshared commits - i.e. it represents the previous patchset.  The simplest way to update your branch to the current patchset is to reset it.
If a patchset has been rewritten you can no longer simply *pull* to update.  Let's assume your checkout **does not** have any unshared commits - i.e. it represents the previous patchset.  The simplest way to update your branch to the current patchset is to reset it using the `-B` checkout flag.
    git fetch && git checkout ticket/{id}
    git reset --hard origin/ticket/{id}
    git fetch && git checkout -B ticket/{id}
If you *do* have unshared commits then you'll could make a new temporary branch and then cherry-pick your changes onto the rewritten patchset.
If you **do** have unshared commits then you'll could make a new temporary branch and then cherry-pick your changes onto the rewritten patchset.
    git branch oldticket ticket/{id}
    git fetch && git checkout ticket/{id}
    git reset --hard origin/ticket/{id}
    git fetch && git checkout -B ticket/{id}
    git cherry-pick <commitid1> <commitid2>
    git branch -D oldticket
Since Git is a powerful and flexible tool, there are no doubt several other strategies you could use to resolve this situation.
Git is a very flexible tool, there are no doubt several other strategies you could use to resolve this situation.  The above solution is just one way.
### Ticket RefSpecs
@@ -148,7 +153,7 @@
### Merging Patchsets
The Gitblit web ui offers a merge button which *should work* but is not fully tested.  Gitblit does verify that you can cleanly merge a patchset to the integration branch.
The Gitblit web ui offers a merge button which will work for clean merges of a patchset to the integration branch.
There are complicated merge scenarios for which it may be best to merge using your Git client.  There are several ways to do this, here is a safe merge strategy which pulls into a new branch and then fast-forwards your integration branch, assuming you were happy with the pull (merge).
@@ -183,6 +188,8 @@
- -1, needs improvement: please do not merge
- -2, vetoed: patchset may not be merged
Only users with write (RW) permissions to the repository can give a +2 and -2 score.  All other users are allowed to score +/-1.
Only users with write (RW) permissions to the repository can give a +2 and -2 score.  All other users are allowed to score +/-1.  If the repository is configured to *require approval* then then +2 score has an important meaning.  The merge button will only be shown if there is at least one +2 score and no -2 scores.  If there is a -2 score, the merge is blocked by the web ui.  Users with RW permissions, however, can still manually merge and push the patchset to the integration branch; Gitblit does not enforce vetoed patchsets on push.
#### Reviews and Updated or Rewritten Patchsets
If the patchset is updated or rewritten, all former review scores are ignored; review scores apply to specific revisions of patchsets - they are not blanket approvals/disapprovals.