Skip to content

Commit b46c37b

Browse files
pvts-matPlaidCat
authored andcommitted
Generalization of the `.git/MERGE_MSG' path
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'.
1 parent 62b7f1a commit b46c37b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ciq-cherry-pick.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import argparse
22
import os
33
import subprocess
4+
import git
45
from ciq_helpers import CIQ_cherry_pick_commit_standardization
56
from ciq_helpers import CIQ_original_commit_author_to_tag_string
67
# from ciq_helpers import *
78

8-
MERGE_MSG = '.git/MERGE_MSG'
9+
MERGE_MSG = git.Repo(os.getcwd()).git_dir + '/MERGE_MSG'
910

1011
if __name__ == '__main__':
1112
print("CIQ custom cherry picker")

0 commit comments

Comments
 (0)