Skip to content
This repository was archived by the owner on Sep 29, 2024. It is now read-only.
This repository was archived by the owner on Sep 29, 2024. It is now read-only.

Incorrect behavior of git_buildbot.py script with --first-parent option  #24

Open

Description

@ivanov17

I use git_buildbot.py script for my project and prefer "true merges" in my git repositories. So I use the --first-parent script option for my builds.

Unfortunately, the behavior of the script with this option is currently incorrect. It only prevents merged commits from being added if changes are added when the branch is updated:

if newrev != baserev:
# Not a pure rewind
options = "--reverse --pretty=oneline"
if first_parent:
# Add the --first-parent to avoid adding the merge commits which
# have already been tested.
options += ' --first-parent'
f = subprocess.Popen(shlex.split("git rev-list %s %s..%s" %
(options, baserev, newrev)),
stdout=subprocess.PIPE)
gen_changes(f, branch)

The first problem is that the changes are lost. For merge commits, merge pseudo-changes are added, and if the commit does not have its own changes, only merge is added:

if re.match(r"^Merge: .*$", line):
files.append('merge')

This would only be useful when the fact of merging and not change is important.

So if this option is enabled, all changes merged using a merge commit must be added.

The second problem is that when adding a branch, this logic is fully ignored:

f3 = subprocess.Popen(
shlex.split("git rev-list --reverse --pretty=oneline --stdin %s" % newrev),
stdin=f2.stdout,
stdout=subprocess.PIPE
)

If the branch has no history yet, there is no problem. But otherwise changes are added for every commit. If changes will also be added from merge commits, they will be duplicated and builds will be triggered twice.

Again, when this option is enabled, changes must not be added from merged commits when adding a branch. The behavior must be the same as when updating a branch.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions