-
-
Notifications
You must be signed in to change notification settings - Fork 954
-
The method Commit.diff
supports a paths
parameter to limit diff to specified paths. However, it is more convenient sometimes to exclude files/directories. And since this feature is supported by the git
command, it makes to support excluding files/directories in the method Commit.diff
.
Beta Was this translation helpful? Give feedback.
All reactions
Did you try to use **kwargs
which will be passed to the git diff
command directly? Invocations would look like repo.head.commit.diff(diff_filter='a')
.
Replies: 1 comment 3 replies
-
Did you try to use **kwargs
which will be passed to the git diff
command directly? Invocations would look like repo.head.commit.diff(diff_filter='a')
.
Beta Was this translation helpful? Give feedback.
All reactions
-
If I want to explicitly exclude one file/folder from the git diff, I can get this via the CLI using git diff <SHA> ':(exclude)path/to/exclude'
as suggested in https://stackoverflow.com/a/39943727.
How can I achieve this with git.diff
since the exclude in not a named parameter. Hence I don't know what to specify for the **kwargs
Beta Was this translation helpful? Give feedback.
All reactions
-
Currently there is no support for using **kwargs
for unnamed git flags, unfortunately excluding the suggested use case.
It's certainly possible to allow settings unnamed git flags through **kwargs
with a set of special names, maybe like git_arg_01="value"
.
Beta Was this translation helpful? Give feedback.
All reactions
-
Thanks for your answer. It shomehow pointed me into the right direction. It just works via *args
. So git.diff(<SHA>, ":(exclude)path/to/exclude")
did it.
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1