GitPython 3.1.60__tar.gz → 3.1.62__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.60 → gitpython-3.1.62/GitPython.egg-info}/PKG-INFO +1 -1
  2. {gitpython-3.1.60/GitPython.egg-info → gitpython-3.1.62}/PKG-INFO +1 -1
  3. gitpython-3.1.62/VERSION +1 -0
  4. {gitpython-3.1.60 → gitpython-3.1.62}/doc/source/changes.rst +25 -0
  5. {gitpython-3.1.60 → gitpython-3.1.62}/git/__init__.py +1 -1
  6. {gitpython-3.1.60 → gitpython-3.1.62}/git/config.py +62 -1
  7. {gitpython-3.1.60 → gitpython-3.1.62}/git/objects/submodule/base.py +12 -0
  8. {gitpython-3.1.60 → gitpython-3.1.62}/git/repo/base.py +4 -0
  9. {gitpython-3.1.60 → gitpython-3.1.62}/git/util.py +23 -3
  10. gitpython-3.1.60/VERSION +0 -1
  11. {gitpython-3.1.60 → gitpython-3.1.62}/AUTHORS +0 -0
  12. {gitpython-3.1.60 → gitpython-3.1.62}/CHANGES +0 -0
  13. {gitpython-3.1.60 → gitpython-3.1.62}/CONTRIBUTING.md +0 -0
  14. {gitpython-3.1.60 → gitpython-3.1.62}/GitPython.egg-info/SOURCES.txt +0 -0
  15. {gitpython-3.1.60 → gitpython-3.1.62}/GitPython.egg-info/dependency_links.txt +0 -0
  16. {gitpython-3.1.60 → gitpython-3.1.62}/GitPython.egg-info/not-zip-safe +0 -0
  17. {gitpython-3.1.60 → gitpython-3.1.62}/GitPython.egg-info/requires.txt +0 -0
  18. {gitpython-3.1.60 → gitpython-3.1.62}/GitPython.egg-info/top_level.txt +0 -0
  19. {gitpython-3.1.60 → gitpython-3.1.62}/LICENSE +0 -0
  20. {gitpython-3.1.60 → gitpython-3.1.62}/MANIFEST.in +0 -0
  21. {gitpython-3.1.60 → gitpython-3.1.62}/README.md +0 -0
  22. {gitpython-3.1.60 → gitpython-3.1.62}/doc/.gitignore +0 -0
  23. {gitpython-3.1.60 → gitpython-3.1.62}/doc/Makefile +0 -0
  24. {gitpython-3.1.60 → gitpython-3.1.62}/doc/requirements.txt +0 -0
  25. {gitpython-3.1.60 → gitpython-3.1.62}/doc/source/conf.py +0 -0
  26. {gitpython-3.1.60 → gitpython-3.1.62}/doc/source/index.rst +0 -0
  27. {gitpython-3.1.60 → gitpython-3.1.62}/doc/source/intro.rst +0 -0
  28. {gitpython-3.1.60 → gitpython-3.1.62}/doc/source/quickstart.rst +0 -0
  29. {gitpython-3.1.60 → gitpython-3.1.62}/doc/source/reference.rst +0 -0
  30. {gitpython-3.1.60 → gitpython-3.1.62}/doc/source/roadmap.rst +0 -0
  31. {gitpython-3.1.60 → gitpython-3.1.62}/doc/source/tutorial.rst +0 -0
  32. {gitpython-3.1.60 → gitpython-3.1.62}/git/cmd.py +0 -0
  33. {gitpython-3.1.60 → gitpython-3.1.62}/git/compat.py +0 -0
  34. {gitpython-3.1.60 → gitpython-3.1.62}/git/db.py +0 -0
  35. {gitpython-3.1.60 → gitpython-3.1.62}/git/diff.py +0 -0
  36. {gitpython-3.1.60 → gitpython-3.1.62}/git/exc.py +0 -0
  37. {gitpython-3.1.60 → gitpython-3.1.62}/git/index/__init__.py +0 -0
  38. {gitpython-3.1.60 → gitpython-3.1.62}/git/index/base.py +0 -0
  39. {gitpython-3.1.60 → gitpython-3.1.62}/git/index/fun.py +0 -0
  40. {gitpython-3.1.60 → gitpython-3.1.62}/git/index/typ.py +0 -0
  41. {gitpython-3.1.60 → gitpython-3.1.62}/git/index/util.py +0 -0
  42. {gitpython-3.1.60 → gitpython-3.1.62}/git/objects/__init__.py +0 -0
  43. {gitpython-3.1.60 → gitpython-3.1.62}/git/objects/base.py +0 -0
  44. {gitpython-3.1.60 → gitpython-3.1.62}/git/objects/blob.py +0 -0
  45. {gitpython-3.1.60 → gitpython-3.1.62}/git/objects/commit.py +0 -0
  46. {gitpython-3.1.60 → gitpython-3.1.62}/git/objects/fun.py +0 -0
  47. {gitpython-3.1.60 → gitpython-3.1.62}/git/objects/submodule/__init__.py +0 -0
  48. {gitpython-3.1.60 → gitpython-3.1.62}/git/objects/submodule/root.py +0 -0
  49. {gitpython-3.1.60 → gitpython-3.1.62}/git/objects/submodule/util.py +0 -0
  50. {gitpython-3.1.60 → gitpython-3.1.62}/git/objects/tag.py +0 -0
  51. {gitpython-3.1.60 → gitpython-3.1.62}/git/objects/tree.py +0 -0
  52. {gitpython-3.1.60 → gitpython-3.1.62}/git/objects/util.py +0 -0
  53. {gitpython-3.1.60 → gitpython-3.1.62}/git/py.typed +0 -0
  54. {gitpython-3.1.60 → gitpython-3.1.62}/git/refs/__init__.py +0 -0
  55. {gitpython-3.1.60 → gitpython-3.1.62}/git/refs/head.py +0 -0
  56. {gitpython-3.1.60 → gitpython-3.1.62}/git/refs/log.py +0 -0
  57. {gitpython-3.1.60 → gitpython-3.1.62}/git/refs/reference.py +0 -0
  58. {gitpython-3.1.60 → gitpython-3.1.62}/git/refs/remote.py +0 -0
  59. {gitpython-3.1.60 → gitpython-3.1.62}/git/refs/symbolic.py +0 -0
  60. {gitpython-3.1.60 → gitpython-3.1.62}/git/refs/tag.py +0 -0
  61. {gitpython-3.1.60 → gitpython-3.1.62}/git/remote.py +0 -0
  62. {gitpython-3.1.60 → gitpython-3.1.62}/git/repo/__init__.py +0 -0
  63. {gitpython-3.1.60 → gitpython-3.1.62}/git/repo/fun.py +0 -0
  64. {gitpython-3.1.60 → gitpython-3.1.62}/git/types.py +0 -0
  65. {gitpython-3.1.60 → gitpython-3.1.62}/pyproject.toml +0 -0
  66. {gitpython-3.1.60 → gitpython-3.1.62}/requirements.txt +0 -0
  67. {gitpython-3.1.60 → gitpython-3.1.62}/setup.cfg +0 -0
  68. {gitpython-3.1.60 → gitpython-3.1.62}/setup.py +0 -0
  69. {gitpython-3.1.60 → gitpython-3.1.62}/test-requirements.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: GitPython
3
- Version: 3.1.60
3
+ Version: 3.1.62
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.60
3
+ Version: 3.1.62
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.62
@@ -2,6 +2,31 @@
2
2
  Changelog
3
3
  =========
4
4
 
5
+ 3.1.62
6
+ ======
7
+
8
+ Security fixes for
9
+
10
+ * https://github.com/gitpython-developers/GitPython/security/advisories/GHSA-59cr-6r3x-644w
11
+
12
+ If you can, also try and provide feedback on the upcoming v4 branch
13
+ https://github.com/gitpython-developers/GitPython/pull/2177 - patches welcome.
14
+
15
+ See the following for all changes.
16
+ https://github.com/gitpython-developers/GitPython/releases/tag/3.1.62
17
+
18
+ 3.1.61
19
+ ======
20
+
21
+ A fixup release to avoid accidental removal of public class regex on Actor.
22
+ It's now deprecated instead.
23
+
24
+ If you can, also try and provide feedback on the upcoming v4 branch
25
+ https://github.com/gitpython-developers/GitPython/pull/2177 - patches welcome.
26
+
27
+ See the following for all changes.
28
+ https://github.com/gitpython-developers/GitPython/releases/tag/3.1.61
29
+
5
30
  3.1.60
6
31
  ======
7
32
 
@@ -86,7 +86,7 @@ __all__ = [
86
86
  "to_hex_sha",
87
87
  ]
88
88
 
89
- __version__ = '3.1.60'
89
+ __version__ = '3.1.62'
90
90
 
91
91
  from typing import Any, List, Optional, Sequence, TYPE_CHECKING, Tuple, Union
92
92
 
@@ -467,6 +467,45 @@ class GitConfigParser(cp.RawConfigParser, metaclass=MetaParserBuilder):
467
467
 
468
468
  # END string_decode
469
469
 
470
+ def is_line_continuation(value: str) -> bool:
471
+ quoted = escaped = False
472
+ for char in value:
473
+ if escaped:
474
+ escaped = False
475
+ elif char == "\\":
476
+ escaped = True
477
+ elif char == '"':
478
+ quoted = not quoted
479
+ elif char in "#;" and not quoted:
480
+ return False
481
+ return escaped
482
+
483
+ def parse_value(value: str) -> str:
484
+ parsed: List[str] = []
485
+ whitespace: List[str] = []
486
+ quoted = escaped = False
487
+ escapes = {"b": "\b", "n": "\n", "t": "\t", '"': '"', "\\": "\\"}
488
+ for char in value:
489
+ if escaped:
490
+ parsed.append(escapes.get(char, "\\" + char))
491
+ escaped = False
492
+ continue
493
+ if char.isspace() and not quoted:
494
+ if parsed:
495
+ whitespace.append(char)
496
+ continue
497
+ if char in "#;" and not quoted:
498
+ break
499
+ parsed.extend(whitespace)
500
+ whitespace.clear()
501
+ if char == "\\":
502
+ escaped = True
503
+ elif char == '"':
504
+ quoted = not quoted
505
+ else:
506
+ parsed.append(char)
507
+ return "".join(parsed)
508
+
470
509
  while True:
471
510
  # We assume to read binary!
472
511
  line = fp.readline().decode(defenc)
@@ -513,7 +552,29 @@ class GitConfigParser(cp.RawConfigParser, metaclass=MetaParserBuilder):
513
552
 
514
553
  if len(optval) < 2 or optval[0] != '"':
515
554
  # Does not open quoting.
516
- pass
555
+ # A value ending in an odd number of backslashes
556
+ # continues on the next line, exactly as git does: the
557
+ # final backslash and the newline are removed and the
558
+ # next line is appended before the complete value is
559
+ # parsed. An even number means the last backslash is
560
+ # escaped and the value ends there.
561
+ continued = False
562
+ while True:
563
+ if not is_line_continuation(optval):
564
+ break
565
+ continuation = fp.readline()
566
+ if not continuation:
567
+ # Backslash at end of file: git drops it.
568
+ optval = optval[:-1]
569
+ break
570
+ lineno = lineno + 1
571
+ joined = continuation.decode(defenc)
572
+ while joined.endswith("\n") or joined.endswith("\r"):
573
+ joined = joined[:-1]
574
+ optval = optval[:-1] + joined
575
+ continued = True
576
+ if continued:
577
+ optval = parse_value(optval)
517
578
  elif optval[-1] != '"':
518
579
  # Opens quoting and does not close: appears to start multi-line quoting.
519
580
  is_multi_line = True
@@ -414,6 +414,18 @@ class Submodule(IndexObject, TraversableIterableObj):
414
414
 
415
415
  return path
416
416
 
417
+ @property
418
+ def abspath(self) -> PathLike:
419
+ root = self.repo.working_tree_dir
420
+ if root is None:
421
+ return super().abspath
422
+ path = root
423
+ for component in os.fspath(self._to_relative_path(self.repo, self.path)).split("/"):
424
+ path = join_path_native(path, component)
425
+ if osp.islink(path):
426
+ raise ValueError("Submodule checkout path %r contains a symbolic link" % self.path)
427
+ return path
428
+
417
429
  @classmethod
418
430
  def _write_git_file_and_module_config(cls, working_tree_dir: PathLike, module_abspath: PathLike) -> None:
419
431
  """Write a ``.git`` file containing a (preferably) relative path to the actual
@@ -386,6 +386,10 @@ class Repo:
386
386
  # Let's not assume the option exists, although it should.
387
387
  pass
388
388
 
389
+ # A linked worktree is not bare even when its main repository is.
390
+ if self._bare and self._working_tree_dir and osp.isfile(osp.join(self.git_dir, "commondir")):
391
+ self._bare = False
392
+
389
393
  # Adjust the working directory in case we are actually bare - we didn't know
390
394
  # that in the first place.
391
395
  if self._bare:
@@ -80,6 +80,7 @@ from typing import (
80
80
  Sequence,
81
81
  Tuple,
82
82
  TYPE_CHECKING,
83
+ Type,
83
84
  TypeVar,
84
85
  Union,
85
86
  cast,
@@ -108,6 +109,7 @@ from git.types import (
108
109
 
109
110
  T_IterableObj = TypeVar("T_IterableObj", bound=Union["IterableObj", "Has_id_attribute"], covariant=True)
110
111
  # So IterableList[Head] is subtype of IterableList[IterableObj].
112
+ T_Actor = TypeVar("T_Actor", bound="Actor")
111
113
 
112
114
  _logger = logging.getLogger(__name__)
113
115
 
@@ -853,11 +855,27 @@ class CallableRemoteProgress(RemoteProgress):
853
855
  self._callable(*args, **kwargs)
854
856
 
855
857
 
858
+ class _DeprecatedActorNameEmailRegex:
859
+ _pattern = re.compile(r"(.*) <(.*?)>")
860
+
861
+ def __get__(self, _instance: Any, _owner: Any) -> Pattern[str]:
862
+ warnings.warn(
863
+ "Actor.name_email_regex is deprecated and will be removed in GitPython 4.0.0 because searching long "
864
+ "malformed strings with it can take quadratic time. Use Actor.from_string() to parse actor identities, "
865
+ "or Actor(name, email) when the fields are already separate.",
866
+ DeprecationWarning,
867
+ stacklevel=2,
868
+ )
869
+ return self._pattern
870
+
871
+
856
872
  class Actor:
857
873
  """Actors hold information about a person acting on the repository. They can be
858
874
  committers and authors or anything with a name and an email as mentioned in the git
859
875
  log entries."""
860
876
 
877
+ name_email_regex = _DeprecatedActorNameEmailRegex()
878
+
861
879
  # ENVIRONMENT VARIABLES
862
880
  # These are read when creating new commits.
863
881
  env_author_name = "GIT_AUTHOR_NAME"
@@ -891,7 +909,7 @@ class Actor:
891
909
  return '<git.Actor "%s <%s>">' % (self.name, self.email)
892
910
 
893
911
  @classmethod
894
- def _from_string(cls, string: str) -> "Actor":
912
+ def from_string(cls: Type[T_Actor], string: str) -> T_Actor:
895
913
  """Create an :class:`Actor` from a string.
896
914
 
897
915
  :param string:
@@ -906,10 +924,12 @@ class Actor:
906
924
  left_bracket = line.find("<")
907
925
  right_bracket = line.find(">", left_bracket + 1)
908
926
  if left_bracket >= 0 and right_bracket >= 0:
909
- return Actor(line[:left_bracket].rstrip(), line[left_bracket + 1 : right_bracket])
927
+ return cls(line[:left_bracket].rstrip(), line[left_bracket + 1 : right_bracket])
910
928
 
911
929
  # Assume the best and use the whole string as name.
912
- return Actor(string, None)
930
+ return cls(string, None)
931
+
932
+ _from_string = from_string
913
933
 
914
934
  @classmethod
915
935
  def _main_actor(
gitpython-3.1.60/VERSION DELETED
@@ -1 +0,0 @@
1
- 3.1.60
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
File without changes