@@ -199,6 +199,19 @@ 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+ "--orderfile" ,
213+ ]
214+
202215 # Invariants
203216 config_level : ConfigLevels_Tup = ("system" , "user" , "global" , "repository" )
204217 """Represents the configuration level of a configuration file."""
@@ -1149,7 +1162,7 @@ def blame_incremental(
11491162 :manpage:`git-rev-parse(1)` is a valid option.
11501163
11511164 :param allow_unsafe_options:
1152- Allow unsafe options in revision argument, like ``--output``.
1165+ Allow unsafe options in revision argument, like ``--output`` or ``--contents`` .
11531166
11541167 :return:
11551168 Lazy iterator of :class:`BlameEntry` tuples, where the commit indicates the
@@ -1161,7 +1174,9 @@ def blame_incremental(
11611174 """
11621175 if not allow_unsafe_options :
11631176 Git .check_unsafe_options (
1164- options = Git ._option_candidates ([rev ], kwargs ), unsafe_options = self .unsafe_git_revision_options
1177+ options = Git ._option_candidates ([rev ], kwargs ),
1178+ unsafe_options = self .unsafe_git_blame_options ,
1179+ clusterable_short_options = "46bceflnpqstvw" ,
11651180 )
11661181
11671182 data : bytes = self .git .blame (rev , "--" , file , p = True , incremental = True , stdout_as_string = False , ** kwargs )
@@ -1253,7 +1268,7 @@ def blame(
12531268 :manpage:`git-rev-parse(1)` is a valid option.
12541269
12551270 :param allow_unsafe_options:
1256- Allow unsafe options in revision argument, like ``--output``.
1271+ Allow unsafe options in revision argument, like ``--output`` or ``--contents`` .
12571272
12581273 :return:
12591274 list: [git.Commit, list: [<line>]]
@@ -1269,7 +1284,8 @@ def blame(
12691284 if not allow_unsafe_options :
12701285 Git .check_unsafe_options (
12711286 options = Git ._option_candidates ([rev , rev_opts_list ], kwargs ),
1272- unsafe_options = self .unsafe_git_revision_options ,
1287+ unsafe_options = self .unsafe_git_blame_options ,
1288+ clusterable_short_options = "46bceflnpqstvw" ,
12731289 )
12741290 data : bytes = self .git .blame (rev , * rev_opts_list , "--" , file , p = True , stdout_as_string = False , ** kwargs )
12751291 commits : Dict [str , Commit ] = {}
0 commit comments