@@ -269,13 +269,21 @@ def summary(self) -> Union[str, bytes]:
269269 else :
270270 return self .message .split (b"\n " , 1 )[0 ]
271271
272- def count (self , paths : Union [PathLike , Sequence [PathLike ]] = "" , ** kwargs : Any ) -> int :
272+ def count (
273+ self ,
274+ paths : Union [PathLike , Sequence [PathLike ]] = "" ,
275+ allow_unsafe_options : bool = False ,
276+ ** kwargs : Any ,
277+ ) -> int :
273278 """Count the number of commits reachable from this commit.
274279
275280 :param paths:
276281 An optional path or a list of paths restricting the return value to commits
277282 actually containing the paths.
278283
284+ :param allow_unsafe_options:
285+ Allow unsafe options, like ``--output``.
286+
279287 :param kwargs:
280288 Additional options to be passed to :manpage:`git-rev-list(1)`. They must not
281289 alter the output style of the command, or parsing will yield incorrect
@@ -284,6 +292,11 @@ def count(self, paths: Union[PathLike, Sequence[PathLike]] = "", **kwargs: Any)
284292 :return:
285293 An int defining the number of reachable commits
286294 """
295+ if not allow_unsafe_options :
296+ Git .check_unsafe_options (
297+ options = Git ._option_candidates ([], kwargs ), unsafe_options = self .unsafe_git_rev_options
298+ )
299+
287300 # Yes, it makes a difference whether empty paths are given or not in our case as
288301 # the empty paths version will ignore merge commits for some reason.
289302 if paths :
0 commit comments