GitPython 3.1.53__tar.gz → 3.1.54__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. {gitpython-3.1.53 → gitpython-3.1.54/GitPython.egg-info}/PKG-INFO +1 -1
  2. {gitpython-3.1.53/GitPython.egg-info → gitpython-3.1.54}/PKG-INFO +1 -1
  3. gitpython-3.1.54/VERSION +1 -0
  4. {gitpython-3.1.53 → gitpython-3.1.54}/doc/source/changes.rst +15 -0
  5. {gitpython-3.1.53 → gitpython-3.1.54}/git/__init__.py +1 -1
  6. {gitpython-3.1.53 → gitpython-3.1.54}/git/cmd.py +7 -0
  7. {gitpython-3.1.53 → gitpython-3.1.54}/git/diff.py +12 -2
  8. {gitpython-3.1.53 → gitpython-3.1.54}/git/index/base.py +16 -2
  9. {gitpython-3.1.53 → gitpython-3.1.54}/git/repo/base.py +5 -0
  10. gitpython-3.1.53/VERSION +0 -1
  11. {gitpython-3.1.53 → gitpython-3.1.54}/AUTHORS +0 -0
  12. {gitpython-3.1.53 → gitpython-3.1.54}/CHANGES +0 -0
  13. {gitpython-3.1.53 → gitpython-3.1.54}/CONTRIBUTING.md +0 -0
  14. {gitpython-3.1.53 → gitpython-3.1.54}/GitPython.egg-info/SOURCES.txt +0 -0
  15. {gitpython-3.1.53 → gitpython-3.1.54}/GitPython.egg-info/dependency_links.txt +0 -0
  16. {gitpython-3.1.53 → gitpython-3.1.54}/GitPython.egg-info/not-zip-safe +0 -0
  17. {gitpython-3.1.53 → gitpython-3.1.54}/GitPython.egg-info/requires.txt +0 -0
  18. {gitpython-3.1.53 → gitpython-3.1.54}/GitPython.egg-info/top_level.txt +0 -0
  19. {gitpython-3.1.53 → gitpython-3.1.54}/LICENSE +0 -0
  20. {gitpython-3.1.53 → gitpython-3.1.54}/MANIFEST.in +0 -0
  21. {gitpython-3.1.53 → gitpython-3.1.54}/README.md +0 -0
  22. {gitpython-3.1.53 → gitpython-3.1.54}/doc/.gitignore +0 -0
  23. {gitpython-3.1.53 → gitpython-3.1.54}/doc/Makefile +0 -0
  24. {gitpython-3.1.53 → gitpython-3.1.54}/doc/requirements.txt +0 -0
  25. {gitpython-3.1.53 → gitpython-3.1.54}/doc/source/conf.py +0 -0
  26. {gitpython-3.1.53 → gitpython-3.1.54}/doc/source/index.rst +0 -0
  27. {gitpython-3.1.53 → gitpython-3.1.54}/doc/source/intro.rst +0 -0
  28. {gitpython-3.1.53 → gitpython-3.1.54}/doc/source/quickstart.rst +0 -0
  29. {gitpython-3.1.53 → gitpython-3.1.54}/doc/source/reference.rst +0 -0
  30. {gitpython-3.1.53 → gitpython-3.1.54}/doc/source/roadmap.rst +0 -0
  31. {gitpython-3.1.53 → gitpython-3.1.54}/doc/source/tutorial.rst +0 -0
  32. {gitpython-3.1.53 → gitpython-3.1.54}/git/compat.py +0 -0
  33. {gitpython-3.1.53 → gitpython-3.1.54}/git/config.py +0 -0
  34. {gitpython-3.1.53 → gitpython-3.1.54}/git/db.py +0 -0
  35. {gitpython-3.1.53 → gitpython-3.1.54}/git/exc.py +0 -0
  36. {gitpython-3.1.53 → gitpython-3.1.54}/git/index/__init__.py +0 -0
  37. {gitpython-3.1.53 → gitpython-3.1.54}/git/index/fun.py +0 -0
  38. {gitpython-3.1.53 → gitpython-3.1.54}/git/index/typ.py +0 -0
  39. {gitpython-3.1.53 → gitpython-3.1.54}/git/index/util.py +0 -0
  40. {gitpython-3.1.53 → gitpython-3.1.54}/git/objects/__init__.py +0 -0
  41. {gitpython-3.1.53 → gitpython-3.1.54}/git/objects/base.py +0 -0
  42. {gitpython-3.1.53 → gitpython-3.1.54}/git/objects/blob.py +0 -0
  43. {gitpython-3.1.53 → gitpython-3.1.54}/git/objects/commit.py +0 -0
  44. {gitpython-3.1.53 → gitpython-3.1.54}/git/objects/fun.py +0 -0
  45. {gitpython-3.1.53 → gitpython-3.1.54}/git/objects/submodule/__init__.py +0 -0
  46. {gitpython-3.1.53 → gitpython-3.1.54}/git/objects/submodule/base.py +0 -0
  47. {gitpython-3.1.53 → gitpython-3.1.54}/git/objects/submodule/root.py +0 -0
  48. {gitpython-3.1.53 → gitpython-3.1.54}/git/objects/submodule/util.py +0 -0
  49. {gitpython-3.1.53 → gitpython-3.1.54}/git/objects/tag.py +0 -0
  50. {gitpython-3.1.53 → gitpython-3.1.54}/git/objects/tree.py +0 -0
  51. {gitpython-3.1.53 → gitpython-3.1.54}/git/objects/util.py +0 -0
  52. {gitpython-3.1.53 → gitpython-3.1.54}/git/py.typed +0 -0
  53. {gitpython-3.1.53 → gitpython-3.1.54}/git/refs/__init__.py +0 -0
  54. {gitpython-3.1.53 → gitpython-3.1.54}/git/refs/head.py +0 -0
  55. {gitpython-3.1.53 → gitpython-3.1.54}/git/refs/log.py +0 -0
  56. {gitpython-3.1.53 → gitpython-3.1.54}/git/refs/reference.py +0 -0
  57. {gitpython-3.1.53 → gitpython-3.1.54}/git/refs/remote.py +0 -0
  58. {gitpython-3.1.53 → gitpython-3.1.54}/git/refs/symbolic.py +0 -0
  59. {gitpython-3.1.53 → gitpython-3.1.54}/git/refs/tag.py +0 -0
  60. {gitpython-3.1.53 → gitpython-3.1.54}/git/remote.py +0 -0
  61. {gitpython-3.1.53 → gitpython-3.1.54}/git/repo/__init__.py +0 -0
  62. {gitpython-3.1.53 → gitpython-3.1.54}/git/repo/fun.py +0 -0
  63. {gitpython-3.1.53 → gitpython-3.1.54}/git/types.py +0 -0
  64. {gitpython-3.1.53 → gitpython-3.1.54}/git/util.py +0 -0
  65. {gitpython-3.1.53 → gitpython-3.1.54}/pyproject.toml +0 -0
  66. {gitpython-3.1.53 → gitpython-3.1.54}/requirements.txt +0 -0
  67. {gitpython-3.1.53 → gitpython-3.1.54}/setup.cfg +0 -0
  68. {gitpython-3.1.53 → gitpython-3.1.54}/setup.py +0 -0
  69. {gitpython-3.1.53 → gitpython-3.1.54}/test-requirements.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: GitPython
3
- Version: 3.1.53
3
+ Version: 3.1.54
4
4
  Summary: GitPython is a Python library used to interact with Git repositories
5
5
  Home-page: https://github.com/gitpython-developers/GitPython
6
6
  Author: Sebastian Thiel, Michael Trier
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: GitPython
3
- Version: 3.1.53
3
+ Version: 3.1.54
4
4
  Summary: GitPython is a Python library used to interact with Git repositories
5
5
  Home-page: https://github.com/gitpython-developers/GitPython
6
6
  Author: Sebastian Thiel, Michael Trier
@@ -0,0 +1 @@
1
+ 3.1.54
@@ -2,6 +2,21 @@
2
2
  Changelog
3
3
  =========
4
4
 
5
+ 3.1.54
6
+ ======
7
+
8
+ A security fix for
9
+
10
+ * https://github.com/gitpython-developers/GitPython/security/advisories/GHSA-r9mr-m37c-5fr3
11
+ * https://github.com/gitpython-developers/GitPython/security/advisories/GHSA-6p8h-3wgx-97gf
12
+ * https://github.com/gitpython-developers/GitPython/security/advisories/GHSA-fjr4-x663-mwxc#event-857190
13
+
14
+ If you can, also try and provide feedback on the upcoming v4 branch
15
+ https://github.com/gitpython-developers/GitPython/pull/2177 - patches welcome.
16
+
17
+ See the following for all changes.
18
+ https://github.com/gitpython-developers/GitPython/releases/tag/3.1.54
19
+
5
20
  3.1.53
6
21
  ======
7
22
 
@@ -86,7 +86,7 @@ __all__ = [
86
86
  "to_hex_sha",
87
87
  ]
88
88
 
89
- __version__ = '3.1.53'
89
+ __version__ = '3.1.54'
90
90
 
91
91
  from typing import Any, List, Optional, Sequence, TYPE_CHECKING, Tuple, Union
92
92
 
@@ -1039,11 +1039,18 @@ class Git(metaclass=_GitMeta):
1039
1039
  option for option in cls._unpack_args([arg for arg in args if arg is not None]) if option.startswith("-")
1040
1040
  ]
1041
1041
  if kwargs:
1042
+ split_single_char_options = kwargs.get("split_single_char_options", True)
1042
1043
  for key, value in kwargs.items():
1043
1044
  values = value if isinstance(value, (list, tuple)) else (value,)
1044
1045
  if any(value is True or (value is not False and value is not None) for value in values):
1045
1046
  key = str(key)
1046
1047
  options.append(f"-{key}" if len(key) == 1 else f"--{dashify(key)}")
1048
+ if len(key) == 1 and split_single_char_options:
1049
+ options.extend(
1050
+ str(value)
1051
+ for value in values
1052
+ if value is not True and value not in (False, None) and str(value).startswith("-")
1053
+ )
1047
1054
  return options
1048
1055
 
1049
1056
  AutoInterrupt: TypeAlias = _AutoInterrupt
@@ -9,7 +9,7 @@ import enum
9
9
  import re
10
10
  import warnings
11
11
 
12
- from git.cmd import handle_process_output
12
+ from git.cmd import Git, handle_process_output
13
13
  from git.compat import defenc
14
14
  from git.objects.blob import Blob
15
15
  from git.objects.util import mode_str_to_int
@@ -35,7 +35,6 @@ from git.types import PathLike, Literal
35
35
  if TYPE_CHECKING:
36
36
  from subprocess import Popen
37
37
 
38
- from git.cmd import Git
39
38
  from git.objects.base import IndexObject
40
39
  from git.objects.commit import Commit
41
40
  from git.objects.tree import Tree
@@ -190,6 +189,7 @@ class Diffable:
190
189
  other: Union[DiffConstants, "Tree", "Commit", str, None] = INDEX,
191
190
  paths: Union[PathLike, List[PathLike], Tuple[PathLike, ...], None] = None,
192
191
  create_patch: bool = False,
192
+ allow_unsafe_options: bool = False,
193
193
  **kwargs: Any,
194
194
  ) -> "DiffIndex[Diff]":
195
195
  """Create diffs between two items being trees, trees and index or an index and
@@ -219,6 +219,10 @@ class Diffable:
219
219
  applied makes the self to other. Patches are somewhat costly as blobs have
220
220
  to be read and diffed.
221
221
 
222
+ :param allow_unsafe_options:
223
+ If ``True``, allow options such as ``--output`` that can write to arbitrary
224
+ filesystem paths.
225
+
222
226
  :param kwargs:
223
227
  Additional arguments passed to :manpage:`git-diff(1)`, such as ``R=True`` to
224
228
  swap both sides of the diff.
@@ -231,6 +235,12 @@ class Diffable:
231
235
  an instance of :class:`~git.objects.tree.Tree` or
232
236
  :class:`~git.objects.commit.Commit`, or a git command error will occur.
233
237
  """
238
+ if not allow_unsafe_options:
239
+ Git.check_unsafe_options(
240
+ options=Git._option_candidates([other], kwargs),
241
+ unsafe_options=self.repo.unsafe_git_revision_options,
242
+ )
243
+
234
244
  args: List[Union[PathLike, Diffable]] = []
235
245
  args.append("--abbrev=40") # We need full shas.
236
246
  args.append("--full-index") # Get full index paths, not only filenames.
@@ -23,6 +23,7 @@ from gitdb.base import IStream
23
23
  from gitdb.db import MemoryDB
24
24
 
25
25
  from git.compat import defenc, force_bytes
26
+ from git.cmd import Git
26
27
  import git.diff as git_diff
27
28
  from git.exc import CheckoutError, GitCommandError, GitError, InvalidGitRepositoryError
28
29
  from git.objects import Blob, Commit, Object, Submodule, Tree
@@ -1492,6 +1493,7 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable):
1492
1493
  ] = git_diff.INDEX,
1493
1494
  paths: Union[PathLike, List[PathLike], Tuple[PathLike, ...], None] = None,
1494
1495
  create_patch: bool = False,
1496
+ allow_unsafe_options: bool = False,
1495
1497
  **kwargs: Any,
1496
1498
  ) -> git_diff.DiffIndex[git_diff.Diff]:
1497
1499
  """Diff this index against the working copy or a :class:`~git.objects.tree.Tree`
@@ -1504,6 +1506,12 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable):
1504
1506
  Will only work with indices that represent the default git index as they
1505
1507
  have not been initialized with a stream.
1506
1508
  """
1509
+ if not allow_unsafe_options:
1510
+ Git.check_unsafe_options(
1511
+ options=Git._option_candidates([other], kwargs),
1512
+ unsafe_options=self.repo.unsafe_git_revision_options,
1513
+ )
1514
+
1507
1515
  # Only run if we are the default repository index.
1508
1516
  if self._file_path != self._index_path():
1509
1517
  raise AssertionError("Cannot call %r on indices that do not represent the default git index" % self.diff())
@@ -1560,7 +1568,13 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable):
1560
1568
  # Invert the existing R flag.
1561
1569
  cur_val = kwargs.get("R", False)
1562
1570
  kwargs["R"] = not cur_val
1563
- return other.diff(self.INDEX, paths, create_patch, **kwargs)
1571
+ return other.diff(
1572
+ self.INDEX,
1573
+ paths,
1574
+ create_patch,
1575
+ allow_unsafe_options=allow_unsafe_options,
1576
+ **kwargs,
1577
+ )
1564
1578
  # END diff against other item handling
1565
1579
 
1566
1580
  # If other is not None here, something is wrong.
@@ -1568,4 +1582,4 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable):
1568
1582
  raise ValueError("other must be None, Diffable.INDEX, a Tree or Commit, was %r" % other)
1569
1583
 
1570
1584
  # Diff against working copy - can be handled by superclass natively.
1571
- return super().diff(other, paths, create_patch, **kwargs)
1585
+ return super().diff(other, paths, create_patch, allow_unsafe_options=allow_unsafe_options, **kwargs)
@@ -149,6 +149,8 @@ class Repo:
149
149
  # Can override configuration variables that execute arbitrary commands:
150
150
  "--config",
151
151
  "-c",
152
+ # Can install hooks that execute during clone:
153
+ "--template",
152
154
  ]
153
155
  """Options to :manpage:`git-clone(1)` that allow arbitrary commands to be executed.
154
156
 
@@ -159,6 +161,9 @@ class Repo:
159
161
  The ``--config``/``-c`` option allows users to override configuration variables like
160
162
  ``protocol.allow`` and ``core.gitProxy`` to execute arbitrary commands:
161
163
  https://git-scm.com/docs/git-clone#Documentation/git-clone.txt---configltkeygtltvaluegt
164
+
165
+ The ``--template`` option can install hooks that execute during clone:
166
+ https://git-scm.com/docs/git-clone#Documentation/git-clone.txt---templatetemplate-directory
162
167
  """
163
168
 
164
169
  unsafe_git_archive_options = [
gitpython-3.1.53/VERSION DELETED
@@ -1 +0,0 @@
1
- 3.1.53
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes