commit:     41b813487245d68407640a36ece5d2320e6c1af9
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sun Mar  5 19:52:58 2023 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sun Mar  5 19:52:58 2023 +0000
URL:        
https://gitweb.gentoo.org/proj/pkgcore/pkgdev.git/commit/?id=41b81348

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 <AT> gentoo.org>

 src/pkgdev/scripts/pkgdev_commit.py | 4 ++++
 1 file changed, 4 insertions(+)

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,
         )
 

Reply via email to