GitPython 3.1.58__tar.gz → 3.1.59__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.58 → gitpython-3.1.59/GitPython.egg-info}/PKG-INFO +1 -1
  2. {gitpython-3.1.58/GitPython.egg-info → gitpython-3.1.59}/PKG-INFO +1 -1
  3. gitpython-3.1.59/VERSION +1 -0
  4. {gitpython-3.1.58 → gitpython-3.1.59}/doc/source/changes.rst +17 -0
  5. {gitpython-3.1.58 → gitpython-3.1.59}/git/__init__.py +1 -1
  6. {gitpython-3.1.58 → gitpython-3.1.59}/git/cmd.py +7 -4
  7. {gitpython-3.1.58 → gitpython-3.1.59}/git/config.py +5 -1
  8. {gitpython-3.1.58 → gitpython-3.1.59}/git/db.py +24 -1
  9. {gitpython-3.1.58 → gitpython-3.1.59}/git/diff.py +4 -3
  10. {gitpython-3.1.58 → gitpython-3.1.59}/git/index/base.py +2 -1
  11. {gitpython-3.1.58 → gitpython-3.1.59}/git/objects/submodule/base.py +11 -1
  12. {gitpython-3.1.58 → gitpython-3.1.59}/git/refs/tag.py +6 -4
  13. {gitpython-3.1.58 → gitpython-3.1.59}/git/repo/base.py +22 -4
  14. gitpython-3.1.58/VERSION +0 -1
  15. {gitpython-3.1.58 → gitpython-3.1.59}/AUTHORS +0 -0
  16. {gitpython-3.1.58 → gitpython-3.1.59}/CHANGES +0 -0
  17. {gitpython-3.1.58 → gitpython-3.1.59}/CONTRIBUTING.md +0 -0
  18. {gitpython-3.1.58 → gitpython-3.1.59}/GitPython.egg-info/SOURCES.txt +0 -0
  19. {gitpython-3.1.58 → gitpython-3.1.59}/GitPython.egg-info/dependency_links.txt +0 -0
  20. {gitpython-3.1.58 → gitpython-3.1.59}/GitPython.egg-info/not-zip-safe +0 -0
  21. {gitpython-3.1.58 → gitpython-3.1.59}/GitPython.egg-info/requires.txt +0 -0
  22. {gitpython-3.1.58 → gitpython-3.1.59}/GitPython.egg-info/top_level.txt +0 -0
  23. {gitpython-3.1.58 → gitpython-3.1.59}/LICENSE +0 -0
  24. {gitpython-3.1.58 → gitpython-3.1.59}/MANIFEST.in +0 -0
  25. {gitpython-3.1.58 → gitpython-3.1.59}/README.md +0 -0
  26. {gitpython-3.1.58 → gitpython-3.1.59}/doc/.gitignore +0 -0
  27. {gitpython-3.1.58 → gitpython-3.1.59}/doc/Makefile +0 -0
  28. {gitpython-3.1.58 → gitpython-3.1.59}/doc/requirements.txt +0 -0
  29. {gitpython-3.1.58 → gitpython-3.1.59}/doc/source/conf.py +0 -0
  30. {gitpython-3.1.58 → gitpython-3.1.59}/doc/source/index.rst +0 -0
  31. {gitpython-3.1.58 → gitpython-3.1.59}/doc/source/intro.rst +0 -0
  32. {gitpython-3.1.58 → gitpython-3.1.59}/doc/source/quickstart.rst +0 -0
  33. {gitpython-3.1.58 → gitpython-3.1.59}/doc/source/reference.rst +0 -0
  34. {gitpython-3.1.58 → gitpython-3.1.59}/doc/source/roadmap.rst +0 -0
  35. {gitpython-3.1.58 → gitpython-3.1.59}/doc/source/tutorial.rst +0 -0
  36. {gitpython-3.1.58 → gitpython-3.1.59}/git/compat.py +0 -0
  37. {gitpython-3.1.58 → gitpython-3.1.59}/git/exc.py +0 -0
  38. {gitpython-3.1.58 → gitpython-3.1.59}/git/index/__init__.py +0 -0
  39. {gitpython-3.1.58 → gitpython-3.1.59}/git/index/fun.py +0 -0
  40. {gitpython-3.1.58 → gitpython-3.1.59}/git/index/typ.py +0 -0
  41. {gitpython-3.1.58 → gitpython-3.1.59}/git/index/util.py +0 -0
  42. {gitpython-3.1.58 → gitpython-3.1.59}/git/objects/__init__.py +0 -0
  43. {gitpython-3.1.58 → gitpython-3.1.59}/git/objects/base.py +0 -0
  44. {gitpython-3.1.58 → gitpython-3.1.59}/git/objects/blob.py +0 -0
  45. {gitpython-3.1.58 → gitpython-3.1.59}/git/objects/commit.py +0 -0
  46. {gitpython-3.1.58 → gitpython-3.1.59}/git/objects/fun.py +0 -0
  47. {gitpython-3.1.58 → gitpython-3.1.59}/git/objects/submodule/__init__.py +0 -0
  48. {gitpython-3.1.58 → gitpython-3.1.59}/git/objects/submodule/root.py +0 -0
  49. {gitpython-3.1.58 → gitpython-3.1.59}/git/objects/submodule/util.py +0 -0
  50. {gitpython-3.1.58 → gitpython-3.1.59}/git/objects/tag.py +0 -0
  51. {gitpython-3.1.58 → gitpython-3.1.59}/git/objects/tree.py +0 -0
  52. {gitpython-3.1.58 → gitpython-3.1.59}/git/objects/util.py +0 -0
  53. {gitpython-3.1.58 → gitpython-3.1.59}/git/py.typed +0 -0
  54. {gitpython-3.1.58 → gitpython-3.1.59}/git/refs/__init__.py +0 -0
  55. {gitpython-3.1.58 → gitpython-3.1.59}/git/refs/head.py +0 -0
  56. {gitpython-3.1.58 → gitpython-3.1.59}/git/refs/log.py +0 -0
  57. {gitpython-3.1.58 → gitpython-3.1.59}/git/refs/reference.py +0 -0
  58. {gitpython-3.1.58 → gitpython-3.1.59}/git/refs/remote.py +0 -0
  59. {gitpython-3.1.58 → gitpython-3.1.59}/git/refs/symbolic.py +0 -0
  60. {gitpython-3.1.58 → gitpython-3.1.59}/git/remote.py +0 -0
  61. {gitpython-3.1.58 → gitpython-3.1.59}/git/repo/__init__.py +0 -0
  62. {gitpython-3.1.58 → gitpython-3.1.59}/git/repo/fun.py +0 -0
  63. {gitpython-3.1.58 → gitpython-3.1.59}/git/types.py +0 -0
  64. {gitpython-3.1.58 → gitpython-3.1.59}/git/util.py +0 -0
  65. {gitpython-3.1.58 → gitpython-3.1.59}/pyproject.toml +0 -0
  66. {gitpython-3.1.58 → gitpython-3.1.59}/requirements.txt +0 -0
  67. {gitpython-3.1.58 → gitpython-3.1.59}/setup.cfg +0 -0
  68. {gitpython-3.1.58 → gitpython-3.1.59}/setup.py +0 -0
  69. {gitpython-3.1.58 → gitpython-3.1.59}/test-requirements.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: GitPython
3
- Version: 3.1.58
3
+ Version: 3.1.59
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.58
3
+ Version: 3.1.59
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.59
@@ -2,6 +2,23 @@
2
2
  Changelog
3
3
  =========
4
4
 
5
+ 3.1.59
6
+ ======
7
+
8
+ Security fixes for
9
+
10
+ * https://github.com/gitpython-developers/GitPython/security/advisories/GHSA-5xxx-qhh7-9287
11
+ * https://github.com/gitpython-developers/GitPython/security/advisories/GHSA-3wxw-xv34-2frg
12
+ * https://github.com/gitpython-developers/GitPython/security/advisories/GHSA-8mcc-hrx5-hvxc
13
+ * https://github.com/gitpython-developers/GitPython/security/advisories/GHSA-284h-m62q-gf8w
14
+ * https://github.com/gitpython-developers/GitPython/security/advisories/GHSA-7833-fr7j-v32q
15
+
16
+ If you can, also try and provide feedback on the upcoming v4 branch
17
+ https://github.com/gitpython-developers/GitPython/pull/2177 - patches welcome.
18
+
19
+ See the following for all changes.
20
+ https://github.com/gitpython-developers/GitPython/releases/tag/3.1.59
21
+
5
22
  3.1.58
6
23
  ======
7
24
 
@@ -86,7 +86,7 @@ __all__ = [
86
86
  "to_hex_sha",
87
87
  ]
88
88
 
89
- __version__ = '3.1.58'
89
+ __version__ = '3.1.59'
90
90
 
91
91
  from typing import Any, List, Optional, Sequence, TYPE_CHECKING, Tuple, Union
92
92
 
@@ -652,6 +652,7 @@ class Git(metaclass=_GitMeta):
652
652
  unsafe_git_ls_remote_options = [
653
653
  # This option allows arbitrary command execution in git-ls-remote.
654
654
  "--upload-pack",
655
+ "--exec",
655
656
  ]
656
657
 
657
658
  unsafe_git_pathspec_from_file_options = [
@@ -976,7 +977,9 @@ class Git(metaclass=_GitMeta):
976
977
  return dashify(option_tokens[0])
977
978
 
978
979
  @classmethod
979
- def check_unsafe_options(cls, options: List[str], unsafe_options: List[str]) -> None:
980
+ def check_unsafe_options(
981
+ cls, options: List[str], unsafe_options: List[str], clusterable_short_options: str = "46flnqsv"
982
+ ) -> None:
980
983
  """Raise :class:`~git.exc.UnsafeOptionError` for blocked option spellings.
981
984
 
982
985
  In addition to exact matches, this rejects abbreviated long options accepted
@@ -1011,7 +1014,7 @@ class Git(metaclass=_GitMeta):
1011
1014
  # These value-less Git flags can be clustered before another short option
1012
1015
  # (for example, ``-fuVALUE``). Stop at any other character because it may
1013
1016
  # begin an attached value, as ``o`` does in the safe option ``-oupstream``.
1014
- clusterable_short_options = frozenset("46flnqsv")
1017
+ clusterable_short_options_set = frozenset(clusterable_short_options)
1015
1018
  options_are_kwargs = all(not option.startswith("-") for option in options)
1016
1019
  for option in options:
1017
1020
  candidate = cls._canonicalize_option_name(option)
@@ -1028,7 +1031,7 @@ class Git(metaclass=_GitMeta):
1028
1031
  raise UnsafeOptionError(
1029
1032
  f"{unsafe_option} is not allowed, use `allow_unsafe_options=True` to allow it."
1030
1033
  )
1031
- if option_char not in clusterable_short_options:
1034
+ if option_char not in clusterable_short_options_set:
1032
1035
  break
1033
1036
  if not (option.startswith("--") or (options_are_kwargs and len(candidate) > 1)):
1034
1037
  continue
@@ -1133,7 +1136,7 @@ class Git(metaclass=_GitMeta):
1133
1136
  """List references in a remote repository.
1134
1137
 
1135
1138
  :param allow_unsafe_options:
1136
- Allow unsafe options, like ``--upload-pack``.
1139
+ Allow unsafe options, like ``--upload-pack`` or ``--exec``.
1137
1140
  """
1138
1141
  if not allow_unsafe_options:
1139
1142
  candidate_options = self._option_candidates(args, kwargs)
@@ -705,7 +705,11 @@ class GitConfigParser(cp.RawConfigParser, metaclass=MetaParserBuilder):
705
705
  continue
706
706
 
707
707
  for v in values:
708
- fp.write(("\t%s = %s\n" % (key, self._value_to_string(v).replace("\n", "\n\t"))).encode(defenc))
708
+ value = self._value_to_string(v)
709
+ if any(char in value for char in '\n\t\b\\"'):
710
+ value = value.replace("\\", "\\\\").replace('"', '\\"')
711
+ value = '"%s\\\n"' % value.replace("\n", "\\n").replace("\t", "\\t").replace("\b", "\\b")
712
+ fp.write(("\t%s = %s\n" % (key, value)).encode(defenc))
709
713
  # END if key is not __name__
710
714
 
711
715
  # END section writing
@@ -5,10 +5,14 @@
5
5
 
6
6
  __all__ = ["GitCmdObjectDB", "GitDB"]
7
7
 
8
- from gitdb.base import OInfo, OStream
8
+ from subprocess import PIPE
9
+
10
+ from gitdb.base import IStream, OInfo, OStream
9
11
  from gitdb.db import GitDB, LooseObjectDB
10
12
  from gitdb.exc import BadObject
13
+ from gitdb.fun import stream_copy
11
14
 
15
+ from git.compat import force_text
12
16
  from git.util import bin_to_hex, hex_to_bin
13
17
  from git.exc import GitCommandError
14
18
 
@@ -46,6 +50,25 @@ class GitCmdObjectDB(LooseObjectDB):
46
50
  hexsha, typename, size, stream = self._git.stream_object_data(bin_to_hex(binsha))
47
51
  return OStream(hex_to_bin(hexsha), typename, size, stream)
48
52
 
53
+ def store(self, istream: IStream) -> IStream:
54
+ """Store an object using git itself."""
55
+ if istream.binsha is not None or self.ostream() is not None:
56
+ return super().store(istream)
57
+
58
+ proc = self._git.hash_object(
59
+ "-t", force_text(istream.type), "-w", "--stdin", "--literally", as_process=True, istream=PIPE
60
+ )
61
+ assert proc.stdin is not None
62
+ try:
63
+ stream_copy(istream.read, proc.stdin.write, istream.size, self.stream_chunk_size)
64
+ finally:
65
+ proc.stdin.close()
66
+ assert proc.stdout is not None
67
+ hexsha = proc.stdout.read().strip()
68
+ proc.wait()
69
+ istream.binsha = hex_to_bin(hexsha)
70
+ return istream
71
+
49
72
  # { Interface
50
73
 
51
74
  def partial_to_complete_sha_hex(self, partial_hexsha: str) -> bytes:
@@ -220,8 +220,8 @@ class Diffable:
220
220
  to be read and diffed.
221
221
 
222
222
  :param allow_unsafe_options:
223
- If ``True``, allow options such as ``--output`` that can write to arbitrary
224
- filesystem paths.
223
+ If ``True``, allow options such as ``--output`` and ``-O`` that can write to
224
+ or read from arbitrary filesystem paths.
225
225
 
226
226
  :param kwargs:
227
227
  Additional arguments passed to :manpage:`git-diff(1)`, such as ``R=True`` to
@@ -238,7 +238,8 @@ class Diffable:
238
238
  if not allow_unsafe_options:
239
239
  Git.check_unsafe_options(
240
240
  options=Git._option_candidates([other], kwargs),
241
- unsafe_options=self.repo.unsafe_git_revision_options,
241
+ unsafe_options=self.repo.unsafe_git_diff_options,
242
+ clusterable_short_options="46abceflmnpqrstuvwzBCDMNRW",
242
243
  )
243
244
 
244
245
  args: List[Union[PathLike, Diffable]] = []
@@ -1567,7 +1567,8 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable):
1567
1567
  if not allow_unsafe_options:
1568
1568
  Git.check_unsafe_options(
1569
1569
  options=Git._option_candidates([other], kwargs),
1570
- unsafe_options=self.repo.unsafe_git_revision_options,
1570
+ unsafe_options=self.repo.unsafe_git_diff_options,
1571
+ clusterable_short_options="46abceflmnpqrstuvwzBCDMNRW",
1571
1572
  )
1572
1573
 
1573
1574
  # Only run if we are the default repository index.
@@ -9,6 +9,7 @@ import logging
9
9
  import ntpath
10
10
  import os
11
11
  import os.path as osp
12
+ import shlex
12
13
  import stat
13
14
  import sys
14
15
  import uuid
@@ -270,7 +271,7 @@ class Submodule(IndexObject, TraversableIterableObj):
270
271
  raise ValueError("Cannot write blobs of 'historical' submodule configurations")
271
272
  # END handle writes of historical submodules
272
273
 
273
- return SubmoduleConfigParser(fp_module, read_only=read_only)
274
+ return SubmoduleConfigParser(fp_module, read_only=read_only, merge_includes=False)
274
275
 
275
276
  def _clear_cache(self) -> None:
276
277
  """Clear the possibly changed values."""
@@ -363,6 +364,15 @@ class Submodule(IndexObject, TraversableIterableObj):
363
364
  module_abspath = cls._module_abspath(repo, path, name)
364
365
  module_checkout_path = module_abspath
365
366
  if cls._need_gitfile_submodules(repo.git):
367
+ if not allow_unsafe_options:
368
+ Git.check_unsafe_options(Git._option_candidates([], kwargs), repo.unsafe_git_clone_options)
369
+ multi_options = kwargs.get("multi_options")
370
+ if multi_options:
371
+ Git.check_unsafe_options(
372
+ shlex.split(" ".join(cast("Sequence[str]", multi_options))),
373
+ repo.unsafe_git_clone_options,
374
+ )
375
+ allow_unsafe_options = True
366
376
  kwargs["separate_git_dir"] = module_abspath
367
377
  module_abspath_dir = osp.dirname(module_abspath)
368
378
  if not osp.isdir(module_abspath_dir):
@@ -134,15 +134,17 @@ class TagReference(Reference):
134
134
  :return:
135
135
  A new :class:`TagReference`.
136
136
  """
137
+ legacy_ref = kwargs.pop("ref", None)
138
+ if legacy_ref:
139
+ reference = legacy_ref
140
+
137
141
  if not allow_unsafe_options:
138
142
  Git.check_unsafe_options(
139
- options=Git._option_candidates([], kwargs),
143
+ options=Git._option_candidates([path, reference], kwargs),
140
144
  unsafe_options=cls.unsafe_git_tag_options,
145
+ clusterable_short_options="46adefilnqsv",
141
146
  )
142
147
 
143
- if "ref" in kwargs and kwargs["ref"]:
144
- reference = kwargs["ref"]
145
-
146
148
  if "message" in kwargs and kwargs["message"]:
147
149
  kwargs["m"] = kwargs["message"]
148
150
  del kwargs["message"]
@@ -159,6 +159,8 @@ class Repo:
159
159
  "-c",
160
160
  # Can install hooks that execute during clone:
161
161
  "--template",
162
+ # Redirects the repository metadata to a caller-controlled path:
163
+ "--separate-git-dir",
162
164
  # Fetches from an additional caller-controlled URI:
163
165
  "--bundle-uri",
164
166
  ]
@@ -199,6 +201,19 @@ class Repo:
199
201
  "-o",
200
202
  ]
201
203
 
204
+ unsafe_git_blame_options = unsafe_git_revision_options + [
205
+ # These options read from arbitrary files and expose their contents through blame output.
206
+ "--contents",
207
+ "-S",
208
+ "--ignore-revs-file",
209
+ ]
210
+
211
+ unsafe_git_diff_options = unsafe_git_revision_options + [
212
+ # Reads caller-controlled order patterns from an arbitrary file.
213
+ "-O",
214
+ "--orderfile",
215
+ ]
216
+
202
217
  # Invariants
203
218
  config_level: ConfigLevels_Tup = ("system", "user", "global", "repository")
204
219
  """Represents the configuration level of a configuration file."""
@@ -1149,7 +1164,7 @@ class Repo:
1149
1164
  :manpage:`git-rev-parse(1)` is a valid option.
1150
1165
 
1151
1166
  :param allow_unsafe_options:
1152
- Allow unsafe options in revision argument, like ``--output``.
1167
+ Allow unsafe options in revision argument, like ``--output`` or ``--contents``.
1153
1168
 
1154
1169
  :return:
1155
1170
  Lazy iterator of :class:`BlameEntry` tuples, where the commit indicates the
@@ -1161,7 +1176,9 @@ class Repo:
1161
1176
  """
1162
1177
  if not allow_unsafe_options:
1163
1178
  Git.check_unsafe_options(
1164
- options=Git._option_candidates([rev], kwargs), unsafe_options=self.unsafe_git_revision_options
1179
+ options=Git._option_candidates([rev], kwargs),
1180
+ unsafe_options=self.unsafe_git_blame_options,
1181
+ clusterable_short_options="46bceflnpqstvw",
1165
1182
  )
1166
1183
 
1167
1184
  data: bytes = self.git.blame(rev, "--", file, p=True, incremental=True, stdout_as_string=False, **kwargs)
@@ -1253,7 +1270,7 @@ class Repo:
1253
1270
  :manpage:`git-rev-parse(1)` is a valid option.
1254
1271
 
1255
1272
  :param allow_unsafe_options:
1256
- Allow unsafe options in revision argument, like ``--output``.
1273
+ Allow unsafe options in revision argument, like ``--output`` or ``--contents``.
1257
1274
 
1258
1275
  :return:
1259
1276
  list: [git.Commit, list: [<line>]]
@@ -1269,7 +1286,8 @@ class Repo:
1269
1286
  if not allow_unsafe_options:
1270
1287
  Git.check_unsafe_options(
1271
1288
  options=Git._option_candidates([rev, rev_opts_list], kwargs),
1272
- unsafe_options=self.unsafe_git_revision_options,
1289
+ unsafe_options=self.unsafe_git_blame_options,
1290
+ clusterable_short_options="46bceflnpqstvw",
1273
1291
  )
1274
1292
  data: bytes = self.git.blame(rev, *rev_opts_list, "--", file, p=True, stdout_as_string=False, **kwargs)
1275
1293
  commits: Dict[str, Commit] = {}
gitpython-3.1.58/VERSION DELETED
@@ -1 +0,0 @@
1
- 3.1.58
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