Skip to content

find_commit.dart hardcodes master branch #115476

Closed
@cbracken

Description

@cbracken

When looking up git commits, find_commit.dart uses a git log invocation here:

return git(secondaryRepoDirectory, <String>[
'log',
'--format=%H',
'--until=${anchor.timestamp.toIso8601String()}',
'--max-count=1',
secondaryBranch,
'--',
]);

This is called from here:

print(findCommit(
primaryRepoDirectory: primaryRepo,
primaryBranch: git(primaryRepo, <String>['rev-parse', '--abbrev-ref', 'HEAD']).trim(),
primaryTrunk: 'master',
secondaryRepoDirectory: secondaryRepo,
secondaryBranch: 'master',
).trim());

Since we hardcode master as both the primary and secondary repo branches, it will fail for repos that have only a main branch and no master, such as flutter/cocoon.

See example failure here:
https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8797370543676737825/+/u/Customer_testing/customer_testing/test_stderr

Related, but we should probably fail whichever tools are using find_commit.dart if the lookup fails. In the log above it looks like even though the lookup fails, we continue on and run the tests anyway:

git -C ../../bin/cache/pkg/tests checkout
dart --enable-asserts run_tests.dart

Note the lack of SHA in the checkout command, which I presume is meant to be there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: crashStack traces logged to the consoleteam-infraOwned by Infrastructure team

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions