From 69c829b93f1daa866c277a1c2966aaf0f8a2cadb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Wcis=C5=82o?= Date: Tue, 7 Jan 2025 22:18:18 +0100 Subject: [PATCH] Generalization of the `.git/MERGE_MSG' path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In general the `MERGE_MSG' file doesn't need to be located under the local `.git' directory. In these cases the script `ciq-cherry-pick.py' will fail. An example would be a git repository created with `git-worktree'. Assume the current directory contains a regular git repository `some-project' with a branch `branch-x' and some commit with a hash ‹some-commit›. Without this change the last command would fail while it shouldn't ,---- | cd some-project | git worktree add ../some-project-branch-x branch-x | cd ../some-project-branch-x | python3 ‹kernel-src-tree-tools-dir›/ciq-cherry-pick.py --sha ‹some-commit› `---- In case of the `some-project-branch-x' repoitory the `MERGE_MSG' file is under `some-project/.git/worktrees/some-project-branch-x/MERGE_MSG'. --- ciq-cherry-pick.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ciq-cherry-pick.py b/ciq-cherry-pick.py index 513f65d..3cac8bd 100644 --- a/ciq-cherry-pick.py +++ b/ciq-cherry-pick.py @@ -1,11 +1,12 @@ import argparse import os import subprocess +import git from ciq_helpers import CIQ_cherry_pick_commit_standardization from ciq_helpers import CIQ_original_commit_author_to_tag_string # from ciq_helpers import * -MERGE_MSG = '.git/MERGE_MSG' +MERGE_MSG = git.Repo(os.getcwd()).git_dir + '/MERGE_MSG' if __name__ == '__main__': print("CIQ custom cherry picker")