Skip to content

Commit

Permalink
DAOS-16678 ci: fetch in gen_commit_pragmas.py
Browse files Browse the repository at this point in the history
Run git fetch before git merge-base in case the repo is outdated.

Test-tag: pr,vm

Required-githooks: true

Signed-off-by: Dalton Bohning <[email protected]>
  • Loading branch information
daltonbohning authored and yuvale2 committed Nov 12, 2024
1 parent d924a57 commit 6db8e59
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions ci/gen_commit_pragmas.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,18 @@ def git_files_changed(target):
return [os.path.join(git_root, path) for path in result.stdout.decode().split('\n') if path]


def git_fetch():
"""Run git fetch.
Returns:
str: the fetch result
"""
result = subprocess.run(
['git', 'fetch'],
stdout=subprocess.PIPE, check=True, cwd=PARENT_DIR)
return result.stdout.decode().rstrip('\n')


def git_merge_base(*commits):
"""Run git merge-base.
Expand Down Expand Up @@ -104,6 +116,9 @@ def main():
help="git target to as reference diff")
args = parser.parse_args()

# Fetch latest repo
git_fetch()

commit_pragmas = gen_commit_pragmas(git_merge_base('HEAD', args.target))
for pragma, value in commit_pragmas.items():
print(f'{pragma}: {value}')
Expand Down

0 comments on commit 6db8e59

Please sign in to comment.