GitPython 3.1.61__py3-none-any.whl → 3.1.62__py3-none-any.whl

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.
git/__init__.py CHANGED
@@ -86,7 +86,7 @@ __all__ = [
86
86
  "to_hex_sha",
87
87
  ]
88
88
 
89
- __version__ = '3.1.61'
89
+ __version__ = '3.1.62'
90
90
 
91
91
  from typing import Any, List, Optional, Sequence, TYPE_CHECKING, Tuple, Union
92
92
 
git/config.py CHANGED
@@ -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
git/repo/base.py CHANGED
@@ -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:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: GitPython
3
- Version: 3.1.61
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,7 +1,7 @@
1
- git/__init__.py,sha256=0tbJRj66bYNZaWePYb-fxyuSQKcz_fjyfOazQu83IPc,8899
1
+ git/__init__.py,sha256=rd1vUhNuzo6FFHAATYj5FYGWRA0dq3E1qUVR6ZucIUs,8899
2
2
  git/cmd.py,sha256=y-7TVp8PVWVkXcQrKqrSO2vaD6Bdiue73ZzFlWzLryU,77137
3
3
  git/compat.py,sha256=y1E6y6O2q5r8clSlr8ZNmuIWG9nmHuehQEsVsmBffs8,4526
4
- git/config.py,sha256=XTKrw9MQM6cy4JQm0fEEFl4S5yxYK1QGaAVKZHOlKYQ,40052
4
+ git/config.py,sha256=G_Xwo8BCClPo8CpbZdolhYzM2fVRKBrffST-G3LvAsY,42778
5
5
  git/db.py,sha256=X19omm9sk3eEy5WAzMoZ2tG9UmdPZFQYf-8yqpvsYF0,3202
6
6
  git/diff.py,sha256=e2ljcabFPkl4BVDjIhsxEkhcF3hQ_jva_BVDimyN5PQ,28898
7
7
  git/exc.py,sha256=Gc7g1pHpn8OmTse30NHmJVsBJ2CYH8LxaR8y8UA3lIM,7119
@@ -23,7 +23,7 @@ git/objects/tag.py,sha256=jAGESnpmTEv-dLakPzheT5ILZFFArcItnXYqfxfDrgc,4441
23
23
  git/objects/tree.py,sha256=MmExcS59Iamb2cBqUvoHPdzgixabyvv5voHabossrl8,13898
24
24
  git/objects/util.py,sha256=Nlza4zLgdPmr_Yasyvvs6c1rKtW_wMxI6wDmQpQ3ufw,23846
25
25
  git/objects/submodule/__init__.py,sha256=6xySp767LVz3UylWgUalntS_nGXRuVzXxDuFAv_Wc2c,303
26
- git/objects/submodule/base.py,sha256=JBoT8FiVCk9ODMMQo2DDR89ThZDmj317Qr2L4JZtB2g,67073
26
+ git/objects/submodule/base.py,sha256=pDVdSeC3XHx-dNM6xw_5VQ-UDJd4SMmdpA60HgNLGJw,67544
27
27
  git/objects/submodule/root.py,sha256=767GIhBwCwn2xvXeMHm2uEO3kZlRyaIaFXnSqcfdZxU,20277
28
28
  git/objects/submodule/util.py,sha256=sQqAYaiSJdFkZa9NlAuK_wTsMNiS-kkQnQjvIoJtc_o,3509
29
29
  git/refs/__init__.py,sha256=DWlJNnsx-4jM_E-VycbP-FZUdn6iWhjnH_uZ_pZXBro,509
@@ -34,11 +34,11 @@ git/refs/remote.py,sha256=WTlkJtpu895jJxbknDNOwL31tivQY_AHQrvroUoFBX4,2902
34
34
  git/refs/symbolic.py,sha256=MPi5UN0ujdE2GMOrzfW2zt-6HlVreuY5W4P7tnBg4V8,36103
35
35
  git/refs/tag.py,sha256=Gm1jn9kClc6f6jGQXRrpLyelrM3-KDcqHRRkD0mL4SE,5510
36
36
  git/repo/__init__.py,sha256=CILSVH36fX_WxVFSjD9o1WF5LgsNedPiJvSngKZqfVU,210
37
- git/repo/base.py,sha256=AGUo8RCtkjWoDL8pnFiAD4aC_YBKTJAdqKzpHNm1fj8,67336
37
+ git/repo/base.py,sha256=AGkZ_-xm3G79SSZ6fh1PivZi4Pz5LLppfCs-hwlbl74,67544
38
38
  git/repo/fun.py,sha256=LeInQM4xN_DuNcTJ0vlRhjTzgBcZ1m5Os9_RO-Xep-w,24901
39
- gitpython-3.1.61.dist-info/licenses/AUTHORS,sha256=Iucx_CH3w7_4084yjM6C5BvKfLA8cVfYHWW2pVmpxSk,2410
40
- gitpython-3.1.61.dist-info/licenses/LICENSE,sha256=hvyUwyGpr7wRUUcTURuv3tIl8lEA3MD3NQ6CvCMbi-s,1503
41
- gitpython-3.1.61.dist-info/METADATA,sha256=Q042PXvN6RJkTkUxhGRFiohoFlwleFHX6nU7tSv7iD8,13558
42
- gitpython-3.1.61.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
43
- gitpython-3.1.61.dist-info/top_level.txt,sha256=0hzDuIp8obv624V3GmbqsagBWkk8ohtGU-Bc1PmTT0o,4
44
- gitpython-3.1.61.dist-info/RECORD,,
39
+ gitpython-3.1.62.dist-info/licenses/AUTHORS,sha256=Iucx_CH3w7_4084yjM6C5BvKfLA8cVfYHWW2pVmpxSk,2410
40
+ gitpython-3.1.62.dist-info/licenses/LICENSE,sha256=hvyUwyGpr7wRUUcTURuv3tIl8lEA3MD3NQ6CvCMbi-s,1503
41
+ gitpython-3.1.62.dist-info/METADATA,sha256=rKMsD3wuor-sivzUK0SrkveTUreIIiJwz5rAH9iVbGE,13558
42
+ gitpython-3.1.62.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
43
+ gitpython-3.1.62.dist-info/top_level.txt,sha256=0hzDuIp8obv624V3GmbqsagBWkk8ohtGU-Bc1PmTT0o,4
44
+ gitpython-3.1.62.dist-info/RECORD,,