diff options
author | Kees Cook <keescook@chromium.org> | 2021-11-30 16:11:24 -0800 |
---|---|---|
committer | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2021-12-13 17:28:18 -0500 |
commit | 36971ee3ad62a56f40c3663a82b7475151df2a77 (patch) | |
tree | bc77dd172eaca0f21bf97ba9d3c9a7d608700b5c | |
parent | e2dc648b93b77e45fde736ecbff8d0080fca41ff (diff) | |
download | korg-helpers-36971ee3ad62a56f40c3663a82b7475151df2a77.tar.gz |
patchwork-bot: Allow limiting heads to single branch
To sanely use a single git repository with multiple worktrees, it must
be possible to limit the commits by branch (otherwise all commits are
visible for all worktrees). Add an optional "branch" argument for this
limit.
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Link: https://lore.kernel.org/r/20211201001126.4106635-4-keescook@chromium.org
-rw-r--r-- | git-patchwork-bot.example.yaml | 2 | ||||
-rwxr-xr-x | git-patchwork-bot.py | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/git-patchwork-bot.example.yaml b/git-patchwork-bot.example.yaml index d6140ed..c3f6c1e 100644 --- a/git-patchwork-bot.example.yaml +++ b/git-patchwork-bot.example.yaml @@ -52,6 +52,8 @@ repos: 'pub/scm/linux/kernel/git/khilman/linux-amlogic.git': # For the notification emails treename: 'khilman/linux-amlogic.git' + # Optional: limit checking to a single branch (instead of --heads) + #branch: 'origin/master' # For the notification emails, must include %s commitlink: 'https://git.kernel.org/khilman/linux-amlogic/c/%.12s' # Only notify for commits where committer email exactly matches one diff --git a/git-patchwork-bot.py b/git-patchwork-bot.py index dc10fd0..fc4d9e3 100755 --- a/git-patchwork-bot.py +++ b/git-patchwork-bot.py @@ -409,9 +409,9 @@ def git_run_command(gitdir, args, stdin=None): return output -def git_get_repo_heads(gitdir): +def git_get_repo_heads(gitdir, branch): refs = list() - lines = git_get_command_lines(gitdir, ['show-ref', '--heads']) + lines = git_get_command_lines(gitdir, ['show-ref', branch]) if lines is not None: for line in lines: (commit_id, refname) = line.split() @@ -1049,7 +1049,7 @@ def housekeeping(pname): def pwrun(repo, rsettings): - git_heads = git_get_repo_heads(repo) + git_heads = git_get_repo_heads(repo, branch=rsettings.get('branch', '--heads')) if not git_heads: logger.info('Could not get the latest ref in %s', repo) sys.exit(1) |