@@ -199,6 +199,18 @@ class Repo:
199199 "-o" ,
200200 ]
201201
202+ unsafe_git_blame_options = unsafe_git_revision_options + [
203+ # These options read from arbitrary files and expose their contents through blame output.
204+ "--contents" ,
205+ "-S" ,
206+ "--ignore-revs-file" ,
207+ ]
208+
209+ unsafe_git_diff_options = unsafe_git_revision_options + [
210+ # Reads caller-controlled order patterns from an arbitrary file.
211+ "-O" ,
212+ ]
213+
202214 # Invariants
203215 config_level : ConfigLevels_Tup = ("system" , "user" , "global" , "repository" )
204216 """Represents the configuration level of a configuration file."""
@@ -1149,7 +1161,7 @@ def blame_incremental(
11491161 :manpage:`git-rev-parse(1)` is a valid option.
11501162
11511163 :param allow_unsafe_options:
1152- Allow unsafe options in revision argument, like ``--output``.
1164+ Allow unsafe options in revision argument, like ``--output`` or ``--contents`` .
11531165
11541166 :return:
11551167 Lazy iterator of :class:`BlameEntry` tuples, where the commit indicates the
@@ -1161,7 +1173,9 @@ def blame_incremental(
11611173 """
11621174 if not allow_unsafe_options :
11631175 Git .check_unsafe_options (
1164- options = Git ._option_candidates ([rev ], kwargs ), unsafe_options = self .unsafe_git_revision_options
1176+ options = Git ._option_candidates ([rev ], kwargs ),
1177+ unsafe_options = self .unsafe_git_blame_options ,
1178+ clusterable_short_options = "46bceflnpqstvw" ,
11651179 )
11661180
11671181 data : bytes = self .git .blame (rev , "--" , file , p = True , incremental = True , stdout_as_string = False , ** kwargs )
@@ -1253,7 +1267,7 @@ def blame(
12531267 :manpage:`git-rev-parse(1)` is a valid option.
12541268
12551269 :param allow_unsafe_options:
1256- Allow unsafe options in revision argument, like ``--output``.
1270+ Allow unsafe options in revision argument, like ``--output`` or ``--contents`` .
12571271
12581272 :return:
12591273 list: [git.Commit, list: [<line>]]
@@ -1269,7 +1283,8 @@ def blame(
12691283 if not allow_unsafe_options :
12701284 Git .check_unsafe_options (
12711285 options = Git ._option_candidates ([rev , rev_opts_list ], kwargs ),
1272- unsafe_options = self .unsafe_git_revision_options ,
1286+ unsafe_options = self .unsafe_git_blame_options ,
1287+ clusterable_short_options = "46bceflnpqstvw" ,
12731288 )
12741289 data : bytes = self .git .blame (rev , * rev_opts_list , "--" , file , p = True , stdout_as_string = False , ** kwargs )
12751290 commits : Dict [str , Commit ] = {}
0 commit comments