aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Zamarin <arthurzam@gentoo.org>2023-03-05 21:52:58 +0200
committerArthur Zamarin <arthurzam@gentoo.org>2023-03-05 21:52:58 +0200
commit41b813487245d68407640a36ece5d2320e6c1af9 (patch)
tree8ebb11402f56d0e97cdc3ac84eeec4660c938b5a
parentcommit: use removeprefix (diff)
downloadpkgdev-41b813487245d68407640a36ece5d2320e6c1af9.tar.gz
pkgdev-41b813487245d68407640a36ece5d2320e6c1af9.tar.bz2
pkgdev-41b813487245d68407640a36ece5d2320e6c1af9.zip
commit: compute commit title for commit related files only
In cases were multiples files are staged for commit across packages, but we run `pkgdev commit .` in one of them, it was adding and committing only the current package, but computing the message based on both of them. Resolves: https://github.com/pkgcore/pkgdev/issues/122 Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
-rw-r--r--src/pkgdev/scripts/pkgdev_commit.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/pkgdev/scripts/pkgdev_commit.py b/src/pkgdev/scripts/pkgdev_commit.py
index c85c7b1..98cbb78 100644
--- a/src/pkgdev/scripts/pkgdev_commit.py
+++ b/src/pkgdev/scripts/pkgdev_commit.py
@@ -48,6 +48,9 @@ class ArgumentParser(cli.ArgumentParser):
if namespace.edit:
args.append("--edit")
namespace.commit_args = args
+ namespace.git_args_paths = list(
+ filter(os.path.exists, (s for s in args if not s.startswith("-")))
+ )
return namespace, []
@@ -575,6 +578,7 @@ class GitChanges(UserDict):
"--cached",
"-z",
"HEAD",
+ *self._options.git_args_paths,
stdout=subprocess.PIPE,
)