From 49c3178711ddb3510f0e96297187f823cc019871 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Thu, 24 Nov 2022 06:24:37 +0100 Subject: [PATCH 01/35] use python3 binary MacOS Ventura doesn't come with a `python` binary anymore --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a7acbb1..7aa5a71 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -PYTHON = python +PYTHON = python3 SETUP = $(PYTHON) setup.py TESTFLAGS = From b6faecc46fcc4f6412149f2021447c0070eba60e Mon Sep 17 00:00:00 2001 From: Ondrej Tethal Date: Fri, 9 Dec 2022 10:21:58 +0100 Subject: [PATCH 02/35] Use ZLIB_RUNTIME_VERSION if available --- gitdb/stream.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitdb/stream.py b/gitdb/stream.py index 222b843..1b5426f 100644 --- a/gitdb/stream.py +++ b/gitdb/stream.py @@ -294,7 +294,7 @@ def read(self, size=-1): # However, the zlib VERSIONs as well as the platform check is used to further match the entries in the # table in the github issue. This is it ... it was the only way I could make this work everywhere. # IT's CERTAINLY GOING TO BITE US IN THE FUTURE ... . - if zlib.ZLIB_VERSION in ('1.2.7', '1.2.5') and not sys.platform == 'darwin': + if getattr(zlib, 'ZLIB_RUNTIME_VERSION', zlib.ZLIB_VERSION) in ('1.2.7', '1.2.5') and not sys.platform == 'darwin': unused_datalen = len(self._zip.unconsumed_tail) else: unused_datalen = len(self._zip.unconsumed_tail) + len(self._zip.unused_data) From 32d12aa03aff193603aad1d6f08669a70607beb9 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Sun, 10 Sep 2023 18:38:38 +0300 Subject: [PATCH 03/35] Bump GitHub Actions --- .github/workflows/pythonpackage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 0d039ad..1cefabc 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -18,7 +18,7 @@ jobs: python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 1000 - name: Set up Python ${{ matrix.python-version }} From d7fc1fd3d154c809b1c021ae3fa564e9fe4b4859 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Sun, 10 Sep 2023 18:38:56 +0300 Subject: [PATCH 04/35] Add support for Python 3.12 --- .github/workflows/pythonpackage.yml | 3 ++- setup.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 1cefabc..dab41d0 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v4 @@ -25,6 +25,7 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} + allow-prereleases: true - name: Install dependencies run: | python -m pip install --upgrade pip diff --git a/setup.py b/setup.py index 5214849..61b5727 100755 --- a/setup.py +++ b/setup.py @@ -40,6 +40,7 @@ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3 :: Only", ] ) From 875acb45cd8e9353c1911717bd2cd05b3e40ed05 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Sun, 10 Sep 2023 18:39:33 +0300 Subject: [PATCH 05/35] Drop support for EOL Python 3.7 --- .github/workflows/pythonpackage.yml | 2 +- setup.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index dab41d0..98e670c 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v4 diff --git a/setup.py b/setup.py index 61b5727..5734122 100755 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ zip_safe=False, install_requires=['smmap>=3.0.1,<6'], long_description="""GitDB is a pure-Python git object database""", - python_requires='>=3.7', + python_requires='>=3.8', # See https://pypi.python.org/pypi?%3Aaction=list_classifiers classifiers=[ "Development Status :: 5 - Production/Stable", @@ -35,7 +35,6 @@ "Operating System :: MacOS :: MacOS X", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", From 8ac188497e7ac1ef2e89c984ac3728319b625e1a Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Sun, 10 Sep 2023 18:14:06 -0400 Subject: [PATCH 06/35] Enable Dependabot version updates for Actions This enables Dependabot version updates for GitHub Actions only (not Python dependencies), using the exact same configuration as in GitPython. --- .github/dependabot.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..203f3c8 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: +- package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" From e7937aefaf49c72b5f4432cc1f303ed23889589a Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Mon, 11 Sep 2023 02:31:34 -0400 Subject: [PATCH 07/35] Test installing project on CI This changes the CI workflow to install the project itself to get its dependency, rather than installing the dependency from requirements.txt. This is the more important thing to test, because it verifies that the project is installable and effectively declares the dependencies it needs. --- .github/workflows/pythonpackage.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 98e670c..efa04a9 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -26,10 +26,10 @@ jobs: with: python-version: ${{ matrix.python-version }} allow-prereleases: true - - name: Install dependencies + - name: Install project and dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt + pip install . - name: Lint with flake8 run: | pip install flake8 From 60f7f94607996e05292896e8105ef3780779959d Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Mon, 11 Sep 2023 03:38:59 -0400 Subject: [PATCH 08/35] Fix mkdir race condition in LooseObjectDB.store This replaces the conditional call to os.mkdir that raises an unintended FileExistsError if the directory is created between the check and the os.mkdir call, using a single os.makedirs call instead, with exist_ok=True. This way, we attempt creation in a way that produces no error if the directory is already present, while still raising FileExistsError if a non-directory filesystem entry (such as a regular file) is present where we want the directory to be. --- gitdb/db/loose.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/gitdb/db/loose.py b/gitdb/db/loose.py index 4ef7750..7ea6fef 100644 --- a/gitdb/db/loose.py +++ b/gitdb/db/loose.py @@ -8,7 +8,6 @@ ObjectDBW ) - from gitdb.exc import ( BadObject, AmbiguousObjectName @@ -33,10 +32,8 @@ bin_to_hex, exists, chmod, - isdir, isfile, remove, - mkdir, rename, dirname, basename, @@ -222,8 +219,7 @@ def store(self, istream): if tmp_path: obj_path = self.db_path(self.object_path(hexsha)) obj_dir = dirname(obj_path) - if not isdir(obj_dir): - mkdir(obj_dir) + os.makedirs(obj_dir, exist_ok=True) # END handle destination directory # rename onto existing doesn't work on NTFS if isfile(obj_path): From 9d126ce78e69fb8aba28ae89adde69298a3066a4 Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Mon, 11 Sep 2023 04:33:18 -0400 Subject: [PATCH 09/35] Don't cancel other jobs from the 3.12 job failing Because 3.12 is still a release candidate and if tests fail for it then one would always want to know if/how other versions also fail. This also allows actions/setup-python to install a prerelease for 3.12 only, not for other releases. --- .github/workflows/pythonpackage.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index efa04a9..c59e618 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -16,6 +16,11 @@ jobs: strategy: matrix: python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + include: + - experimental: false + - python-version: "3.12" + experimental: true + continue-on-error: ${{ matrix.experimental }} steps: - uses: actions/checkout@v4 @@ -25,7 +30,7 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - allow-prereleases: true + allow-prereleases: ${{ matrix.experimental }} - name: Install project and dependencies run: | python -m pip install --upgrade pip From 919d3cce57d0a3c398dc4ddbacbbd23942a6ff4c Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Mon, 11 Sep 2023 04:17:52 -0400 Subject: [PATCH 10/35] Use actions/checkout feature to fetch all commits Setting the "fetch-depth" to a positive value fetches that many commits back (and the default value is 1), but setting it to 0 fetches all commits, as in a (deep) normal fetch. --- .github/workflows/pythonpackage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index efa04a9..14c7ecb 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -20,7 +20,7 @@ jobs: steps: - uses: actions/checkout@v4 with: - fetch-depth: 1000 + fetch-depth: 0 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: From bd21ed46addf55fea5059d44e0477a785f4a664f Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Mon, 11 Sep 2023 05:18:27 -0400 Subject: [PATCH 11/35] Revert "Drop support for EOL Python 3.7" This brings back Python 3.7 support (allowing it to be installed on 3.7, and testing on 3.7 on CI), even though 3.7 is end-of-life, because support for 3.7 is not being dropped by GitPython yet, and there is value in keeping the version ranges supported by GitPython and gitdb consistent. This reverts commit 875acb45cd8e9353c1911717bd2cd05b3e40ed05. --- .github/workflows/pythonpackage.yml | 2 +- setup.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 3d06b4a..6849763 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] include: - experimental: false - python-version: "3.12" diff --git a/setup.py b/setup.py index 5734122..61b5727 100755 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ zip_safe=False, install_requires=['smmap>=3.0.1,<6'], long_description="""GitDB is a pure-Python git object database""", - python_requires='>=3.8', + python_requires='>=3.7', # See https://pypi.python.org/pypi?%3Aaction=list_classifiers classifiers=[ "Development Status :: 5 - Production/Stable", @@ -35,6 +35,7 @@ "Operating System :: MacOS :: MacOS X", "Programming Language :: Python", "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", From e0769d1ed2d9044d7523c2eb2f8a0d44a90deb9e Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Sun, 17 Sep 2023 08:36:34 -0400 Subject: [PATCH 12/35] Fix top-of-file license URLs here in gitdb too This is the gitdb part of the fix for the top-of-file license URLs that have come to point to a page about a related but different license from the one GitPython and gitdb are (intended to be) offered under. See https://github.com/gitpython-developers/GitPython/pull/1662 for details about the problem and how it came about. --- gitdb/__init__.py | 2 +- gitdb/base.py | 2 +- gitdb/db/__init__.py | 2 +- gitdb/db/base.py | 2 +- gitdb/db/git.py | 2 +- gitdb/db/loose.py | 2 +- gitdb/db/mem.py | 2 +- gitdb/db/pack.py | 2 +- gitdb/db/ref.py | 2 +- gitdb/exc.py | 2 +- gitdb/fun.py | 2 +- gitdb/pack.py | 6 +++--- gitdb/stream.py | 10 +++++----- gitdb/test/__init__.py | 2 +- gitdb/test/db/__init__.py | 2 +- gitdb/test/db/lib.py | 2 +- gitdb/test/db/test_git.py | 2 +- gitdb/test/db/test_loose.py | 2 +- gitdb/test/db/test_mem.py | 2 +- gitdb/test/db/test_pack.py | 2 +- gitdb/test/db/test_ref.py | 2 +- gitdb/test/lib.py | 2 +- gitdb/test/performance/lib.py | 2 +- gitdb/test/performance/test_pack.py | 2 +- gitdb/test/performance/test_pack_streaming.py | 2 +- gitdb/test/performance/test_stream.py | 2 +- gitdb/test/test_base.py | 2 +- gitdb/test/test_example.py | 2 +- gitdb/test/test_pack.py | 4 ++-- gitdb/test/test_stream.py | 2 +- gitdb/test/test_util.py | 2 +- gitdb/typ.py | 2 +- gitdb/util.py | 2 +- 33 files changed, 40 insertions(+), 40 deletions(-) diff --git a/gitdb/__init__.py b/gitdb/__init__.py index b777632..2fb3f7e 100644 --- a/gitdb/__init__.py +++ b/gitdb/__init__.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ """Initialize the object database module""" import sys diff --git a/gitdb/base.py b/gitdb/base.py index 42e71d0..9a23a4f 100644 --- a/gitdb/base.py +++ b/gitdb/base.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ """Module with basic data structures - they are designed to be lightweight and fast""" from gitdb.util import bin_to_hex diff --git a/gitdb/db/__init__.py b/gitdb/db/__init__.py index 0a2a46a..20fd228 100644 --- a/gitdb/db/__init__.py +++ b/gitdb/db/__init__.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ from gitdb.db.base import * from gitdb.db.loose import * diff --git a/gitdb/db/base.py b/gitdb/db/base.py index e89052e..7312fe0 100644 --- a/gitdb/db/base.py +++ b/gitdb/db/base.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ """Contains implementations of database retrieveing objects""" from gitdb.util import ( join, diff --git a/gitdb/db/git.py b/gitdb/db/git.py index e2cb468..a1ed142 100644 --- a/gitdb/db/git.py +++ b/gitdb/db/git.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ from gitdb.db.base import ( CompoundDB, ObjectDBW, diff --git a/gitdb/db/loose.py b/gitdb/db/loose.py index 7ea6fef..256fec9 100644 --- a/gitdb/db/loose.py +++ b/gitdb/db/loose.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ from gitdb.db.base import ( FileDBBase, ObjectDBR, diff --git a/gitdb/db/mem.py b/gitdb/db/mem.py index 1b954cb..d4772fd 100644 --- a/gitdb/db/mem.py +++ b/gitdb/db/mem.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ """Contains the MemoryDatabase implementation""" from gitdb.db.loose import LooseObjectDB from gitdb.db.base import ( diff --git a/gitdb/db/pack.py b/gitdb/db/pack.py index 1ce786b..274ea59 100644 --- a/gitdb/db/pack.py +++ b/gitdb/db/pack.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ """Module containing a database to deal with packs""" from gitdb.db.base import ( FileDBBase, diff --git a/gitdb/db/ref.py b/gitdb/db/ref.py index 6bb2a64..bd30156 100644 --- a/gitdb/db/ref.py +++ b/gitdb/db/ref.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ import codecs from gitdb.db.base import ( CompoundDB, diff --git a/gitdb/exc.py b/gitdb/exc.py index 947e5d8..7397037 100644 --- a/gitdb/exc.py +++ b/gitdb/exc.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ """Module with common exceptions""" from gitdb.util import to_hex_sha diff --git a/gitdb/fun.py b/gitdb/fun.py index a4454de..a272e5c 100644 --- a/gitdb/fun.py +++ b/gitdb/fun.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ """Contains basic c-functions which usually contain performance critical code Keeping this code separate from the beginning makes it easier to out-source it into c later, if required""" diff --git a/gitdb/pack.py b/gitdb/pack.py index cabce4c..e559e11 100644 --- a/gitdb/pack.py +++ b/gitdb/pack.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ """Contains PackIndexFile and PackFile implementations""" import zlib @@ -263,7 +263,7 @@ def __init__(self, indexpath): def close(self): mman.force_map_handle_removal_win(self._indexpath) self._cursor = None - + def _set_cache_(self, attr): if attr == "_packfile_checksum": self._packfile_checksum = self._cursor.map()[-40:-20] @@ -528,7 +528,7 @@ def __init__(self, packpath): def close(self): mman.force_map_handle_removal_win(self._packpath) self._cursor = None - + def _set_cache_(self, attr): # we fill the whole cache, whichever attribute gets queried first self._cursor = mman.make_cursor(self._packpath).use_region() diff --git a/gitdb/stream.py b/gitdb/stream.py index 1b5426f..1e0be84 100644 --- a/gitdb/stream.py +++ b/gitdb/stream.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ from io import BytesIO @@ -140,7 +140,7 @@ def data(self): def close(self): """Close our underlying stream of compressed bytes if this was allowed during initialization :return: True if we closed the underlying stream - :note: can be called safely + :note: can be called safely """ if self._close: if hasattr(self._m, 'close'): @@ -287,11 +287,11 @@ def read(self, size=-1): # if we hit the end of the stream # NOTE: Behavior changed in PY2.7 onward, which requires special handling to make the tests work properly. # They are thorough, and I assume it is truly working. - # Why is this logic as convoluted as it is ? Please look at the table in + # Why is this logic as convoluted as it is ? Please look at the table in # https://github.com/gitpython-developers/gitdb/issues/19 to learn about the test-results. # Basically, on py2.6, you want to use branch 1, whereas on all other python version, the second branch - # will be the one that works. - # However, the zlib VERSIONs as well as the platform check is used to further match the entries in the + # will be the one that works. + # However, the zlib VERSIONs as well as the platform check is used to further match the entries in the # table in the github issue. This is it ... it was the only way I could make this work everywhere. # IT's CERTAINLY GOING TO BITE US IN THE FUTURE ... . if getattr(zlib, 'ZLIB_RUNTIME_VERSION', zlib.ZLIB_VERSION) in ('1.2.7', '1.2.5') and not sys.platform == 'darwin': diff --git a/gitdb/test/__init__.py b/gitdb/test/__init__.py index 8a681e4..03bd406 100644 --- a/gitdb/test/__init__.py +++ b/gitdb/test/__init__.py @@ -1,4 +1,4 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ diff --git a/gitdb/test/db/__init__.py b/gitdb/test/db/__init__.py index 8a681e4..03bd406 100644 --- a/gitdb/test/db/__init__.py +++ b/gitdb/test/db/__init__.py @@ -1,4 +1,4 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ diff --git a/gitdb/test/db/lib.py b/gitdb/test/db/lib.py index b38f1d5..408dd8c 100644 --- a/gitdb/test/db/lib.py +++ b/gitdb/test/db/lib.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ """Base classes for object db testing""" from gitdb.test.lib import ( with_rw_directory, diff --git a/gitdb/test/db/test_git.py b/gitdb/test/db/test_git.py index 6ecf7d7..73ac1a0 100644 --- a/gitdb/test/db/test_git.py +++ b/gitdb/test/db/test_git.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ import os from gitdb.test.db.lib import ( TestDBBase, diff --git a/gitdb/test/db/test_loose.py b/gitdb/test/db/test_loose.py index 8cc660b..295e2ee 100644 --- a/gitdb/test/db/test_loose.py +++ b/gitdb/test/db/test_loose.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ from gitdb.test.db.lib import ( TestDBBase, with_rw_directory diff --git a/gitdb/test/db/test_mem.py b/gitdb/test/db/test_mem.py index eb563c0..882e54f 100644 --- a/gitdb/test/db/test_mem.py +++ b/gitdb/test/db/test_mem.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ from gitdb.test.db.lib import ( TestDBBase, with_rw_directory diff --git a/gitdb/test/db/test_pack.py b/gitdb/test/db/test_pack.py index 4539f42..bd07906 100644 --- a/gitdb/test/db/test_pack.py +++ b/gitdb/test/db/test_pack.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ from gitdb.test.db.lib import ( TestDBBase, with_rw_directory, diff --git a/gitdb/test/db/test_ref.py b/gitdb/test/db/test_ref.py index 664aa54..0816e64 100644 --- a/gitdb/test/db/test_ref.py +++ b/gitdb/test/db/test_ref.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ from gitdb.test.db.lib import ( TestDBBase, with_rw_directory, diff --git a/gitdb/test/lib.py b/gitdb/test/lib.py index da59d3b..8e60234 100644 --- a/gitdb/test/lib.py +++ b/gitdb/test/lib.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ """Utilities used in ODB testing""" from gitdb import OStream diff --git a/gitdb/test/performance/lib.py b/gitdb/test/performance/lib.py index fa4dd20..36916ed 100644 --- a/gitdb/test/performance/lib.py +++ b/gitdb/test/performance/lib.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ """Contains library functions""" from gitdb.test.lib import TestBase diff --git a/gitdb/test/performance/test_pack.py b/gitdb/test/performance/test_pack.py index f034baf..fc3d334 100644 --- a/gitdb/test/performance/test_pack.py +++ b/gitdb/test/performance/test_pack.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ """Performance tests for object store""" from gitdb.test.performance.lib import ( diff --git a/gitdb/test/performance/test_pack_streaming.py b/gitdb/test/performance/test_pack_streaming.py index db790f1..80c798b 100644 --- a/gitdb/test/performance/test_pack_streaming.py +++ b/gitdb/test/performance/test_pack_streaming.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ """Specific test for pack streams only""" from gitdb.test.performance.lib import ( diff --git a/gitdb/test/performance/test_stream.py b/gitdb/test/performance/test_stream.py index 91dc891..fb10871 100644 --- a/gitdb/test/performance/test_stream.py +++ b/gitdb/test/performance/test_stream.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ """Performance data streaming performance""" from gitdb.test.performance.lib import TestBigRepoR diff --git a/gitdb/test/test_base.py b/gitdb/test/test_base.py index 519cdfd..8fc9e35 100644 --- a/gitdb/test/test_base.py +++ b/gitdb/test/test_base.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ """Test for object db""" from gitdb.test.lib import ( TestBase, diff --git a/gitdb/test/test_example.py b/gitdb/test/test_example.py index cc4d40d..3b4c908 100644 --- a/gitdb/test/test_example.py +++ b/gitdb/test/test_example.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ """Module with examples from the tutorial section of the docs""" import os from gitdb.test.lib import TestBase diff --git a/gitdb/test/test_pack.py b/gitdb/test/test_pack.py index f946197..e723482 100644 --- a/gitdb/test/test_pack.py +++ b/gitdb/test/test_pack.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ """Test everything about packs reading and writing""" from gitdb.test.lib import ( TestBase, @@ -242,7 +242,7 @@ def rewind_streams(): # END for each info assert count == len(pack_objs) entity.close() - + def test_pack_64(self): # TODO: hex-edit a pack helping us to verify that we can handle 64 byte offsets # of course without really needing such a huge pack diff --git a/gitdb/test/test_stream.py b/gitdb/test/test_stream.py index 5e2e1ba..1e7e941 100644 --- a/gitdb/test/test_stream.py +++ b/gitdb/test/test_stream.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ """Test for object db""" from gitdb.test.lib import ( diff --git a/gitdb/test/test_util.py b/gitdb/test/test_util.py index 3b3165d..166b33c 100644 --- a/gitdb/test/test_util.py +++ b/gitdb/test/test_util.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ """Test for object db""" import tempfile import os diff --git a/gitdb/typ.py b/gitdb/typ.py index 98d15f3..314db50 100644 --- a/gitdb/typ.py +++ b/gitdb/typ.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ """Module containing information about types known to the database""" str_blob_type = b'blob' diff --git a/gitdb/util.py b/gitdb/util.py index 3151c06..bb6d879 100644 --- a/gitdb/util.py +++ b/gitdb/util.py @@ -1,7 +1,7 @@ # Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors # # This module is part of GitDB and is released under -# the New BSD License: http://www.opensource.org/licenses/bsd-license.php +# the New BSD License: https://opensource.org/license/bsd-3-clause/ import binascii import os import mmap From cd8da415e119451e195903576a8ff22cf60ae47b Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Tue, 3 Oct 2023 12:42:23 -0400 Subject: [PATCH 13/35] Run CI on all branches This makes it easier to test changes to CI without/before a PR. + Fix a small YAML indentation style inconsistency. --- .github/workflows/pythonpackage.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 6849763..6d819ff 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -3,11 +3,7 @@ name: Python package -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] +on: [push, pull_request, workflow_dispatch] jobs: build: @@ -17,9 +13,9 @@ jobs: matrix: python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] include: - - experimental: false - - python-version: "3.12" - experimental: true + - experimental: false + - python-version: "3.12" + experimental: true continue-on-error: ${{ matrix.experimental }} steps: From 00bbc44eff7be0b43a882eadf54c2bbb2f9000a0 Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Tue, 3 Oct 2023 12:44:38 -0400 Subject: [PATCH 14/35] No longer treat 3.12 as experimental on CI Since Python 3.12.0 stable has been released, as well as now being available via setup-python, per: https://github.com/actions/python-versions/blob/main/versions-manifest.json The main practical effect of this is that continue-on-error is no longer set to true for 3.12, so 3.12 is no longer special-cased to refrain from cancelling other test jobs when its test job fails. Another effect is that 3.12 can longer be selected as a prerelease. --- .github/workflows/pythonpackage.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 6d819ff..73b3902 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -14,8 +14,6 @@ jobs: python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] include: - experimental: false - - python-version: "3.12" - experimental: true continue-on-error: ${{ matrix.experimental }} steps: From 70098c9c99db872ac98a6b5c7a591a42cadf049f Mon Sep 17 00:00:00 2001 From: DeflateAwning <11021263+DeflateAwning@users.noreply.github.com> Date: Fri, 6 Oct 2023 12:22:44 -0600 Subject: [PATCH 15/35] Add __all__ to exc for linting --- gitdb/exc.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/gitdb/exc.py b/gitdb/exc.py index 7397037..752dafd 100644 --- a/gitdb/exc.py +++ b/gitdb/exc.py @@ -5,6 +5,17 @@ """Module with common exceptions""" from gitdb.util import to_hex_sha +__all__ = [ + 'AmbiguousObjectName', + 'BadName', + 'BadObject', + 'BadObjectType', + 'InvalidDBRoot', + 'ODBError', + 'ParseError', + 'UnsupportedOperation', + 'to_hex_sha', +] class ODBError(Exception): """All errors thrown by the object database""" From 12db86cefa90e8fc1c8df8f5c6b4c8b7a232d773 Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Fri, 13 Oct 2023 04:06:47 -0400 Subject: [PATCH 16/35] Have Dependabot update smmap submodule dependency This makes Dependabot open version update PRs for submodules (which here is just smmap), as well as GitHub Actions. This is like https://github.com/gitpython-developers/GitPython/pull/1702. --- .github/dependabot.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 203f3c8..5acde1a 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -3,4 +3,9 @@ updates: - package-ecosystem: "github-actions" directory: "/" schedule: - interval: "weekly" + interval: "weekly" + +- package-ecosystem: "gitsubmodule" + directory: "/" + schedule: + interval: "monthly" From 8e613962153baad0431358dda03d9fd942cef616 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 13 Oct 2023 08:17:45 +0000 Subject: [PATCH 17/35] Bump gitdb/ext/smmap from `334ef84` to `f1ace75` Bumps [gitdb/ext/smmap](https://github.com/gitpython-developers/smmap) from `334ef84` to `f1ace75`. - [Commits](https://github.com/gitpython-developers/smmap/compare/334ef84a05c953ed5dbec7b9c6d4310879eeab5a...f1ace75be355fdec927793e462b9b12bf6ec9520) --- updated-dependencies: - dependency-name: gitdb/ext/smmap dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- gitdb/ext/smmap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitdb/ext/smmap b/gitdb/ext/smmap index 334ef84..f1ace75 160000 --- a/gitdb/ext/smmap +++ b/gitdb/ext/smmap @@ -1 +1 @@ -Subproject commit 334ef84a05c953ed5dbec7b9c6d4310879eeab5a +Subproject commit f1ace75be355fdec927793e462b9b12bf6ec9520 From 2057ae67b85fb9925efbd0f00f44413e506e286c Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Fri, 20 Oct 2023 09:37:58 +0200 Subject: [PATCH 18/35] bump versions to prepare for next release --- doc/source/changes.rst | 6 ++++++ gitdb/__init__.py | 2 +- gitdb/ext/smmap | 2 +- setup.py | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/doc/source/changes.rst b/doc/source/changes.rst index 7d85ea5..0b8de13 100644 --- a/doc/source/changes.rst +++ b/doc/source/changes.rst @@ -2,6 +2,12 @@ Changelog ######### +****** +4.0.11 +****** + +- various improvements - please see the release on GitHub for details. + ****** 4.0.10 ****** diff --git a/gitdb/__init__.py b/gitdb/__init__.py index 2fb3f7e..803a428 100644 --- a/gitdb/__init__.py +++ b/gitdb/__init__.py @@ -28,7 +28,7 @@ def _init_externals(): __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" -version_info = (4, 0, 10) +version_info = (4, 0, 11) __version__ = '.'.join(str(i) for i in version_info) diff --git a/gitdb/ext/smmap b/gitdb/ext/smmap index f1ace75..256c5a2 160000 --- a/gitdb/ext/smmap +++ b/gitdb/ext/smmap @@ -1 +1 @@ -Subproject commit f1ace75be355fdec927793e462b9b12bf6ec9520 +Subproject commit 256c5a21de2d14aca02c9689d7d63f78c4e0ef61 diff --git a/setup.py b/setup.py index 61b5727..f67f7a5 100755 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" -version_info = (4, 0, 10) +version_info = (4, 0, 11) __version__ = '.'.join(str(i) for i in version_info) setup( From 3d3e9572dc452fea53d328c101b3d1440bbefe40 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Fri, 20 Oct 2023 09:42:19 +0200 Subject: [PATCH 19/35] fix makefile to allow building packages with current python version It all breaks all the time, it's just like that. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7aa5a71..a0a2d0e 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ release:: clean force_release:: clean git push --tags - python3 setup.py sdist bdist_wheel + python3 -m build --sdist --wheel twine upload dist/* doc:: From 965d2d36703a60f610e4b4a3fb1b86fe244d63d5 Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Fri, 20 Oct 2023 06:46:10 -0400 Subject: [PATCH 20/35] Never add a vendored smmap directory to sys.path This removes the logic that appended the git submodule directory for smmap to sys.path under most circumstances when the version of gitdb was not from PyPI. Now gitdb does not modify sys.path. See https://github.com/gitpython-developers/GitPython/issues/1717 and https://github.com/gitpython-developers/GitPython/pull/1720 for context. This change is roughly equivalent to the change to GitPython, though as noted the behavior being eliminated is subtly different here and there. --- gitdb/__init__.py | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/gitdb/__init__.py b/gitdb/__init__.py index 803a428..9b77e9f 100644 --- a/gitdb/__init__.py +++ b/gitdb/__init__.py @@ -4,34 +4,12 @@ # the New BSD License: https://opensource.org/license/bsd-3-clause/ """Initialize the object database module""" -import sys -import os - -#{ Initialization - - -def _init_externals(): - """Initialize external projects by putting them into the path""" - if 'PYOXIDIZER' not in os.environ: - where = os.path.join(os.path.dirname(__file__), 'ext', 'smmap') - if os.path.exists(where): - sys.path.append(where) - - import smmap - del smmap - # END handle imports - -#} END initialization - -_init_externals() - __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" version_info = (4, 0, 11) __version__ = '.'.join(str(i) for i in version_info) - # default imports from gitdb.base import * from gitdb.db import * From dfbfb12beee6b2c61cb02f193fabc427e0a949f6 Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Fri, 20 Oct 2023 07:24:33 -0400 Subject: [PATCH 21/35] Revise and update the readme Changes worth mentioning: - Format commands as code blocks instead of blockquotes. (This is particularly useful for the submodule update step, whose lines were inadvertently concatenated, but it also improves appearance overall.) - Mention smmap as a requirement. (But also that it doesn't need to be separately installed.) - Mention that gitdb-speedups is not currently maintained. - No longer say gitdb has source code in gitorious. (Since that site no longer exists.) - Call GitPython "GitPython" rather than "git-python". - Replace the old git-python Google Groups link with a link to the Discussions page on the GitHub repository for GitPython. (This seems like the closest currently available resource.) --- README.rst | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/README.rst b/README.rst index 29c70f7..61ce28b 100644 --- a/README.rst +++ b/README.rst @@ -16,34 +16,38 @@ Installation :target: https://readthedocs.org/projects/gitdb/?badge=latest :alt: Documentation Status -From `PyPI `_ +From `PyPI `_:: pip install gitdb SPEEDUPS ======== -If you want to go up to 20% faster, you can install gitdb-speedups with: +If you want to go up to 20% faster, you can install gitdb-speedups with:: pip install gitdb-speedups +However, please note that gitdb-speedups is not currently maintained. + REQUIREMENTS ============ +* smmap - declared as a dependency, automatically installed * pytest - for running the tests SOURCE ====== -The source is available in a git repository at gitorious and github: + +The source is available in a git repository on GitHub: https://github.com/gitpython-developers/gitdb -Once the clone is complete, please be sure to initialize the submodules using +Once the clone is complete, please be sure to initialize the submodule using:: cd gitdb git submodule update --init -Run the tests with +Run the tests with:: pytest @@ -53,13 +57,13 @@ DEVELOPMENT .. image:: https://github.com/gitpython-developers/gitdb/workflows/Python%20package/badge.svg :target: https://github.com/gitpython-developers/gitdb/actions -The library is considered mature, and not under active development. It's primary (known) use is in git-python. +The library is considered mature, and not under active development. Its primary (known) use is in GitPython. INFRASTRUCTURE ============== -* Mailing List - * http://groups.google.com/group/git-python +* Discussions + * https://github.com/gitpython-developers/GitPython/discussions * Issue Tracker * https://github.com/gitpython-developers/gitdb/issues From e998429c01f928da7ff7c922ba3f1249c43ff569 Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Fri, 20 Oct 2023 07:47:10 -0400 Subject: [PATCH 22/35] Set Dependabot submodule update cadence to weekly This changes it from monthly to weekly. See #99 and https://github.com/gitpython-developers/GitPython/pull/1702#issuecomment-1761182333 for context. --- .github/dependabot.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 5acde1a..2fe73ca 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -8,4 +8,4 @@ updates: - package-ecosystem: "gitsubmodule" directory: "/" schedule: - interval: "monthly" + interval: "weekly" From 24ecf58262eb2e76906689dbc4e28397f4f628dc Mon Sep 17 00:00:00 2001 From: Antoine C Date: Fri, 8 Dec 2023 16:58:24 +0100 Subject: [PATCH 23/35] fix #101 --- gitdb/test/test_base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gitdb/test/test_base.py b/gitdb/test/test_base.py index 8fc9e35..17906c9 100644 --- a/gitdb/test/test_base.py +++ b/gitdb/test/test_base.py @@ -73,7 +73,7 @@ def test_streams(self): # test deltapackstream dpostream = ODeltaPackStream(*(dpinfo + (stream, ))) - dpostream.stream is stream + assert dpostream.stream is stream dpostream.read(5) stream._assert() assert stream.bytes == 5 @@ -92,7 +92,7 @@ def test_streams(self): assert istream.size == s istream.size = s * 2 - istream.size == s * 2 + assert istream.size == s * 2 assert istream.type == str_blob_type istream.type = "something" assert istream.type == "something" From 86402e67e7d999b2b2665dc1029c5e1ccd3ada35 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Dec 2023 11:03:07 +0000 Subject: [PATCH 24/35] Bump actions/setup-python from 4 to 5 Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4 to 5. - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/v4...v5) --- updated-dependencies: - dependency-name: actions/setup-python dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/pythonpackage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 73b3902..ec7550d 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -21,7 +21,7 @@ jobs: with: fetch-depth: 0 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} allow-prereleases: ${{ matrix.experimental }} From 5aeb6e073ebe007d43695976eccdcca64568d025 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Dec 2023 10:39:28 +0000 Subject: [PATCH 25/35] Bump gitdb/ext/smmap from `256c5a2` to `04dd210` Bumps [gitdb/ext/smmap](https://github.com/gitpython-developers/smmap) from `256c5a2` to `04dd210`. - [Commits](https://github.com/gitpython-developers/smmap/compare/256c5a21de2d14aca02c9689d7d63f78c4e0ef61...04dd2103ee6e0b7483889e5feda25053c6df2b52) --- updated-dependencies: - dependency-name: gitdb/ext/smmap dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- gitdb/ext/smmap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitdb/ext/smmap b/gitdb/ext/smmap index 256c5a2..04dd210 160000 --- a/gitdb/ext/smmap +++ b/gitdb/ext/smmap @@ -1 +1 @@ -Subproject commit 256c5a21de2d14aca02c9689d7d63f78c4e0ef61 +Subproject commit 04dd2103ee6e0b7483889e5feda25053c6df2b52 From d50b2e3245f472637c6b86722d6dd969fb4c7183 Mon Sep 17 00:00:00 2001 From: Almaz Ilaletdinov Date: Sun, 9 Jun 2024 14:00:05 +0300 Subject: [PATCH 26/35] Use contextlib.suppress instead of except: pass --- gitdb/db/loose.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gitdb/db/loose.py b/gitdb/db/loose.py index 256fec9..87cde86 100644 --- a/gitdb/db/loose.py +++ b/gitdb/db/loose.py @@ -2,6 +2,8 @@ # # This module is part of GitDB and is released under # the New BSD License: https://opensource.org/license/bsd-3-clause/ +from contextlib import suppress + from gitdb.db.base import ( FileDBBase, ObjectDBR, @@ -90,10 +92,8 @@ def readable_db_object_path(self, hexsha): """ :return: readable object path to the object identified by hexsha :raise BadObject: If the object file does not exist""" - try: + with suppress(KeyError): return self._hexsha_to_file[hexsha] - except KeyError: - pass # END ignore cache misses # try filesystem From 5bc95043792c2412b05263fb4bfca67d7923645c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Ram=C3=ADrez-Mondrag=C3=B3n?= Date: Wed, 9 Oct 2024 01:01:55 -0600 Subject: [PATCH 27/35] Add support for Python 3.13 --- .github/workflows/pythonpackage.yml | 2 +- setup.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 73b3902..8e0ff8e 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] include: - experimental: false continue-on-error: ${{ matrix.experimental }} diff --git a/setup.py b/setup.py index f67f7a5..51065c9 100755 --- a/setup.py +++ b/setup.py @@ -41,6 +41,7 @@ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3 :: Only", ] ) From b38cbc43354523ffcd59a58c5a3aded054bd4442 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Ram=C3=ADrez-Mondrag=C3=B3n?= Date: Wed, 9 Oct 2024 01:05:50 -0600 Subject: [PATCH 28/35] Use older ubuntu to get Python 3.7 --- .github/workflows/pythonpackage.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 8e0ff8e..40e1c0a 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -8,12 +8,17 @@ on: [push, pull_request, workflow_dispatch] jobs: build: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] + os: [ubuntu-latest] + experimental: [false] include: - - experimental: false + - python-version: "3.7" + os: ubuntu-22.04 + experimental: false continue-on-error: ${{ matrix.experimental }} steps: From 74a0eabbc03209593ea1562498802359ae8a3db7 Mon Sep 17 00:00:00 2001 From: Jonathan Dekhtiar Date: Mon, 23 Dec 2024 23:02:58 -0500 Subject: [PATCH 29/35] Potential Race Condition Fix - OS Rename & Chmod --- gitdb/db/loose.py | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/gitdb/db/loose.py b/gitdb/db/loose.py index 87cde86..ccefe40 100644 --- a/gitdb/db/loose.py +++ b/gitdb/db/loose.py @@ -54,6 +54,7 @@ import tempfile import os import sys +import time __all__ = ('LooseObjectDB', ) @@ -205,7 +206,7 @@ def store(self, istream): # END assure target stream is closed except: if tmp_path: - os.remove(tmp_path) + remove(tmp_path) raise # END assure tmpfile removal on error @@ -228,9 +229,25 @@ def store(self, istream): rename(tmp_path, obj_path) # end rename only if needed - # make sure its readable for all ! It started out as rw-- tmp file - # but needs to be rwrr - chmod(obj_path, self.new_objects_mode) + # Ensure rename is actually done and file is stable + # Retry up to 14 times - exponential wait & retry in ms. + # The total maximum wait time is 1000ms, which should be vastly enough for the + # OS to return and commit the file to disk. + for exp_backoff_ms in [1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 181]: + with suppress(PermissionError): + # make sure its readable for all ! It started out as rw-- tmp file + # but needs to be rwrr + chmod(obj_path, self.new_objects_mode) + break + time.sleep(exp_backoff_ms / 1000.0) + else: + raise PermissionError( + "Impossible to apply `chmod` to file {}".format(obj_path) + ) + + # Cleanup + with suppress(FileNotFoundError): + remove(tmp_path) # END handle dry_run istream.binsha = hex_to_bin(hexsha) From b71e2730c3dcab148816f0193a45550ef0a38c79 Mon Sep 17 00:00:00 2001 From: Jonathan DEKHTIAR Date: Sun, 29 Dec 2024 19:44:26 -0500 Subject: [PATCH 30/35] Update gitdb/db/loose.py Co-authored-by: Sebastian Thiel --- gitdb/db/loose.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/gitdb/db/loose.py b/gitdb/db/loose.py index ccefe40..03d387e 100644 --- a/gitdb/db/loose.py +++ b/gitdb/db/loose.py @@ -245,9 +245,6 @@ def store(self, istream): "Impossible to apply `chmod` to file {}".format(obj_path) ) - # Cleanup - with suppress(FileNotFoundError): - remove(tmp_path) # END handle dry_run istream.binsha = hex_to_bin(hexsha) From 104138c742a56d85bd2cb2cd8a9f90336daa5483 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Thu, 2 Jan 2025 08:15:19 +0100 Subject: [PATCH 31/35] bump patch level to prepare for next release --- doc/source/changes.rst | 6 ++++++ gitdb/__init__.py | 2 +- gitdb/ext/smmap | 2 +- setup.py | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/doc/source/changes.rst b/doc/source/changes.rst index 0b8de13..b4340e4 100644 --- a/doc/source/changes.rst +++ b/doc/source/changes.rst @@ -2,6 +2,12 @@ Changelog ######### +****** +4.0.12 +****** + +- various improvements - please see the release on GitHub for details. + ****** 4.0.11 ****** diff --git a/gitdb/__init__.py b/gitdb/__init__.py index 9b77e9f..1fb7df8 100644 --- a/gitdb/__init__.py +++ b/gitdb/__init__.py @@ -7,7 +7,7 @@ __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" -version_info = (4, 0, 11) +version_info = (4, 0, 12) __version__ = '.'.join(str(i) for i in version_info) # default imports diff --git a/gitdb/ext/smmap b/gitdb/ext/smmap index 04dd210..f31bfa3 160000 --- a/gitdb/ext/smmap +++ b/gitdb/ext/smmap @@ -1 +1 @@ -Subproject commit 04dd2103ee6e0b7483889e5feda25053c6df2b52 +Subproject commit f31bfa378c8840d38d31e7e11ef2b84f191a491e diff --git a/setup.py b/setup.py index 51065c9..3a91543 100755 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ __author__ = "Sebastian Thiel" __contact__ = "byronimo@gmail.com" __homepage__ = "https://github.com/gitpython-developers/gitdb" -version_info = (4, 0, 11) +version_info = (4, 0, 12) __version__ = '.'.join(str(i) for i in version_info) setup( From 775cfe8299ea5474f605935469359a9d1cdb49dc Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Thu, 2 Jan 2025 08:20:58 +0100 Subject: [PATCH 32/35] update scripts to allow release (copied from smmap) --- Makefile | 42 +++++++----------------------------------- build-release.sh | 26 ++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 35 deletions(-) create mode 100755 build-release.sh diff --git a/Makefile b/Makefile index a0a2d0e..20436bb 100644 --- a/Makefile +++ b/Makefile @@ -1,40 +1,12 @@ -PYTHON = python3 -SETUP = $(PYTHON) setup.py -TESTFLAGS = +.PHONY: all clean release force_release -all:: +all: @grep -Ee '^[a-z].*:' Makefile | cut -d: -f1 | grep -vF all -release:: clean - # Check if latest tag is the current head we're releasing - echo "Latest tag = $$(git tag | sort -nr | head -n1)" - echo "HEAD SHA = $$(git rev-parse head)" - echo "Latest tag SHA = $$(git tag | sort -nr | head -n1 | xargs git rev-parse)" - @test "$$(git rev-parse head)" = "$$(git tag | sort -nr | head -n1 | xargs git rev-parse)" - make force_release +clean: + rm -rf build/ dist/ .eggs/ .tox/ -force_release:: clean - git push --tags - python3 -m build --sdist --wheel +force_release: clean + ./build-release.sh twine upload dist/* - -doc:: - make -C doc/ html - -build:: - $(SETUP) build - $(SETUP) build_ext -i - -build_ext:: - $(SETUP) build_ext -i - -install:: - $(SETUP) install - -clean:: - $(SETUP) clean --all - rm -f *.so - -coverage:: build - PYTHONPATH=. $(PYTHON) -m pytest --cov=gitdb gitdb - + git push --tags origin master diff --git a/build-release.sh b/build-release.sh new file mode 100755 index 0000000..5840e44 --- /dev/null +++ b/build-release.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# +# This script builds a release. If run in a venv, it auto-installs its tools. +# You may want to run "make release" instead of running this script directly. + +set -eEu + +function release_with() { + $1 -m build --sdist --wheel +} + +if test -n "${VIRTUAL_ENV:-}"; then + deps=(build twine) # Install twine along with build, as we need it later. + echo "Virtual environment detected. Adding packages: ${deps[*]}" + pip install --quiet --upgrade "${deps[@]}" + echo 'Starting the build.' + release_with python +else + function suggest_venv() { + venv_cmd='python -m venv env && source env/bin/activate' + printf "HELP: To avoid this error, use a virtual-env with '%s' instead.\n" "$venv_cmd" + } + trap suggest_venv ERR # This keeps the original exit (error) code. + echo 'Starting the build.' + release_with python3 # Outside a venv, use python3. +fi From 26209528a0303e47c88c174184adbf25d206a824 Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Sun, 5 Jan 2025 03:21:33 -0500 Subject: [PATCH 33/35] Add SECURITY.md, referencing GitPython's Along with https://github.com/gitpython-developers/smmap/pull/59 and a forthcoming related PR in GitPython, this will fix #116. --- SECURITY.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 SECURITY.md diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..95389ff --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,3 @@ +# Security Policy + +See [GitPython](https://github.com/gitpython-developers/GitPython/blob/main/SECURITY.md). Vulnerabilities found in `gitdb` can be reported there. From 4fe56572894f9668c1ffd0808c96aed27c65e584 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Jan 2025 10:38:13 +0000 Subject: [PATCH 34/35] Bump gitdb/ext/smmap from `f31bfa3` to `8f82e6c` Bumps [gitdb/ext/smmap](https://github.com/gitpython-developers/smmap) from `f31bfa3` to `8f82e6c`. - [Release notes](https://github.com/gitpython-developers/smmap/releases) - [Commits](https://github.com/gitpython-developers/smmap/compare/f31bfa378c8840d38d31e7e11ef2b84f191a491e...8f82e6c19661f9b735cc55cc89031a189e408894) --- updated-dependencies: - dependency-name: gitdb/ext/smmap dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- gitdb/ext/smmap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitdb/ext/smmap b/gitdb/ext/smmap index f31bfa3..8f82e6c 160000 --- a/gitdb/ext/smmap +++ b/gitdb/ext/smmap @@ -1 +1 @@ -Subproject commit f31bfa378c8840d38d31e7e11ef2b84f191a491e +Subproject commit 8f82e6c19661f9b735cc55cc89031a189e408894 From b4fd74ce8e28c372c511db2e0a491fa8b67c93f4 Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Sun, 26 Jan 2025 11:51:11 -0500 Subject: [PATCH 35/35] Improve description of backoff sequence in db.loose The sequence of backoff wait times used in `gitdb.db.loose` is quadratic rather than exponential, as discussed in: https://github.com/gitpython-developers/gitdb/pull/115#discussion_r1903215598 This corrects the variable name by making it more general, and the comment by having it explicitly describe the backoff as quadratic. This is conceptually related to GitoxideLabs/gitoxide#1815, but this is a non-breaking change, as no interfaces are affected: only a local variable and comment. --- gitdb/db/loose.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gitdb/db/loose.py b/gitdb/db/loose.py index 03d387e..e6765cd 100644 --- a/gitdb/db/loose.py +++ b/gitdb/db/loose.py @@ -230,16 +230,16 @@ def store(self, istream): # end rename only if needed # Ensure rename is actually done and file is stable - # Retry up to 14 times - exponential wait & retry in ms. + # Retry up to 14 times - quadratic wait & retry in ms. # The total maximum wait time is 1000ms, which should be vastly enough for the # OS to return and commit the file to disk. - for exp_backoff_ms in [1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 181]: + for backoff_ms in [1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 181]: with suppress(PermissionError): # make sure its readable for all ! It started out as rw-- tmp file # but needs to be rwrr chmod(obj_path, self.new_objects_mode) break - time.sleep(exp_backoff_ms / 1000.0) + time.sleep(backoff_ms / 1000.0) else: raise PermissionError( "Impossible to apply `chmod` to file {}".format(obj_path)