Gerrit trivial rebase detection ignores whitespace

Bug #1057506 reported by Jeremy Stanley
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Core Infrastructure
Fix Released
Medium
Jeremy Stanley

Bug Description

The recently-implemented trivial rebase detection hook on review.openstack.org's Gerrit instance ( https://bugs.launchpad.net/openstack-ci/+bug/881184 ) is working as designed upstream but works on a premise which is less helpful for whitespace-significant languages. In particular, it relies on git patch-id which squashes all whitespace characters between patches prior to comparing them.

Several possible approaches are being explored to modify this behavior, but the current line of thinking is that code reviews for OpenStack should only be automatically reapplied if there are no whitespace changes in a rebase (offset/linecount changes only). The script should still comment on a new patchset indicating that it notices only whitespace changes, similar to how it identifies patchsets containing only commit message changes.

Jeremy Stanley (fungi)
Changed in openstack-ci:
status: New → In Progress
assignee: nobody → Jeremy Stanley (fungi)
Monty Taylor (mordred)
Changed in openstack-ci:
milestone: none → grizzly
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to openstack-ci-puppet (master)

Fix proposed to branch: master
Review: https://review.openstack.org/13775

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to openstack-ci-puppet (master)

Reviewed: https://review.openstack.org/13775
Committed: http://github.com/openstack/openstack-ci-puppet/commit/2be93cc22e35a07c1c082308ac52d8b8635dc9ef
Submitter: Jenkins
Branch: master

commit 2be93cc22e35a07c1c082308ac52d8b8635dc9ef
Author: Jeremy Stanley <email address hidden>
Date: Thu Sep 27 18:15:49 2012 +0000

    Gerrit Whitespace Change Detection

    Consider whitespace changes significant enough not to reapply code
    reviews, but still comment if that's all which changed between
    patchsets. This addresses bug 1057506.

    * modules/openstack_project/files/gerrit/scripts/trivial_rebase.py
    (GetPatchId): Add a flag called consider_whitespace, but defaulting to
    False so as to preserve default behavior of the module. Add conditional
    behavior to replace all spaces and tabs with percent signs before
    calculating the patch-id hash.
    (Main): Add a --whitespace command-line option to turn on whitespace
    change checking. If enabled and if normal GetPatchId calls return a
    match, re-run with consider_whitespace set to True and apply a comment
    to the new patchset in Gerrit if the result is non-matching.

    * modules/openstack_project/templates/gerrit_patchset-created.erb: Add
    --whitespace to the trivial_rebase.py invocation, enabling whitespace
    checking.

    Change-Id: I89c479614a637717cf515a5d3f6d03b5f7830581

Changed in openstack-ci:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.