Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: gitpython-developers/GitPython
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 3.1.32
Choose a base ref
...
head repository: gitpython-developers/GitPython
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 3.1.40
Choose a head ref
Loading
Showing with 2,079 additions and 870 deletions.
  1. +7 −19 .flake8
  2. +2 −1 .gitattributes
  3. +6 −1 .github/dependabot.yml
  4. +59 −30 .github/workflows/cygwin-test.yml
  5. +11 −5 .github/workflows/lint.yml
  6. +40 −27 .github/workflows/pythonpackage.yml
  7. +3 −1 .gitignore
  8. +37 −17 .pre-commit-config.yaml
  9. +2 −0 AUTHORS
  10. +1 −1 CONTRIBUTING.md
  11. +17 −18 LICENSE
  12. +8 −9 Makefile
  13. +94 −33 README.md
  14. +1 −2 SECURITY.md
  15. +1 −1 VERSION
  16. +27 −0 build-release.sh
  17. +56 −0 check-version.sh
  18. +22 −21 doc/Makefile
  19. +47 −0 doc/source/changes.rst
  20. +1 −0 doc/source/index.rst
  21. +244 −0 doc/source/quickstart.rst
  22. +0 −62 etc/sublime-text/git-python.sublime-project
  23. +81 −4 git/__init__.py
  24. +91 −90 git/cmd.py
  25. +1 −1 git/compat.py
  26. +12 −14 git/config.py
  27. +2 −3 git/diff.py
  28. +14 −7 git/exc.py
  29. +1 −1 git/ext/gitdb
  30. +5 −7 git/index/base.py
  31. +5 −6 git/index/fun.py
  32. +1 −1 git/objects/base.py
  33. +1 −1 git/objects/blob.py
  34. +3 −5 git/objects/commit.py
  35. +0 −1 git/objects/fun.py
  36. +22 −41 git/objects/submodule/base.py
  37. +1 −1 git/objects/tag.py
  38. +1 −1 git/objects/tree.py
  39. +3 −3 git/objects/util.py
  40. +2 −3 git/refs/log.py
  41. +51 −5 git/refs/symbolic.py
  42. +1 −2 git/remote.py
  43. +10 −9 git/repo/base.py
  44. +12 −12 git/types.py
  45. +65 −36 git/util.py
  46. +63 −8 init-tests-after-clone.sh
  47. +5 −2 pyproject.toml
  48. +0 −4 requirements-dev.txt
  49. +7 −24 setup.py
  50. +6 −10 test-requirements.txt
  51. +1 −1 test/__init__.py
  52. 0 test/fixtures/diff_mode_only
  53. +18 −0 test/fixtures/env_case.py
  54. +1 −1 test/lib/__init__.py
  55. +24 −29 test/lib/helper.py
  56. +1 −1 test/performance/test_commit.py
  57. +0 −1 test/performance/test_streams.py
  58. +1 −1 test/test_actor.py
  59. +3 −3 test/test_base.py
  60. +1 −1 test/test_blob.py
  61. +1 −1 test/test_clone.py
  62. +16 −17 test/test_commit.py
  63. +2 −1 test/test_config.py
  64. +1 −1 test/test_db.py
  65. +16 −18 test/test_diff.py
  66. +12 −9 test/test_docs.py
  67. +1 −1 test/test_exc.py
  68. +1 −2 test/test_fun.py
  69. +128 −21 test/test_git.py
  70. +26 −22 test/test_index.py
  71. +10 −16 test/test_installation.py
  72. +219 −0 test/test_quick_doc.py
  73. +75 −3 test/test_refs.py
  74. +2 −2 test/test_remote.py
  75. +32 −44 test/test_repo.py
  76. +1 −1 test/test_stats.py
  77. +90 −32 test/test_submodule.py
  78. +1 −19 test/test_tree.py
  79. +211 −72 test/test_util.py
  80. +32 −0 tox.ini
26 changes: 7 additions & 19 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,38 +1,26 @@
[flake8]

show-source = True
count= True
count = True
statistics = True
# E265 = comment blocks like @{ section, which it can't handle

# E266 = too many leading '#' for block comment
# E731 = do not assign a lambda expression, use a def
# W293 = Blank line contains whitespace
# W504 = Line break after operator
# E704 = multiple statements in one line - used for @override
# TC002 = move third party import to TYPE_CHECKING
# ANN = flake8-annotations
# TC, TC2 = flake8-type-checking
# D = flake8-docstrings

# select = C,E,F,W ANN, TC, TC2 # to enable code. Disabled if not listed, including builtin codes
enable-extensions = TC, TC2 # only needed for extensions not enabled by default

ignore = E265,E266,E731,E704,
W293, W504,
ANN0 ANN1 ANN2,
TC002,
TC0, TC1, TC2
# B,
A,
D,
RST, RST3
ignore = E266, E731

exclude = .tox,.venv,build,dist,doc,git/ext/,test
exclude = .tox, .venv, build, dist, doc, git/ext/

rst-roles = # for flake8-RST-docstrings
attr,class,func,meth,mod,obj,ref,term,var # used by sphinx
attr, class, func, meth, mod, obj, ref, term, var # used by sphinx

min-python-version = 3.7.0

# for `black` compatibility
max-line-length = 120
extend-ignore = E203,W503
extend-ignore = E203, W503
3 changes: 2 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
test/fixtures/* eol=lf
init-tests-after-clone.sh
*.sh eol=lf
/Makefile eol=lf
7 changes: 6 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -3,4 +3,9 @@ updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
interval: "weekly"

- package-ecosystem: "gitsubmodule"
directory: "/"
schedule:
interval: "monthly"
89 changes: 59 additions & 30 deletions .github/workflows/cygwin-test.yml
Original file line number Diff line number Diff line change
@@ -5,46 +5,75 @@ on: [push, pull_request, workflow_dispatch]
jobs:
build:
runs-on: windows-latest

strategy:
fail-fast: false

env:
CHERE_INVOKING: 1
SHELLOPTS: igncr
TMP: "/tmp"
TEMP: "/tmp"

CHERE_INVOKING: "1"
CYGWIN_NOWINPATH: "1"

defaults:
run:
shell: C:\cygwin\bin\bash.exe --login --norc -eo pipefail -o igncr "{0}"

steps:
- name: Force LF line endings
run: git config --global core.autocrlf input
- uses: actions/checkout@v3
run: |
git config --global core.autocrlf false # Affects the non-Cygwin git.
shell: bash # Use Git Bash instead of Cygwin Bash for this step.

- uses: actions/checkout@v4
with:
fetch-depth: 9999
- uses: cygwin/cygwin-install-action@v4
fetch-depth: 0

- name: Install Cygwin
uses: cygwin/cygwin-install-action@v4
with:
packages: python39 python39-pip python39-virtualenv git
- name: Tell git to trust this repo
shell: bash.exe -eo pipefail -o igncr "{0}"
run: |
/usr/bin/git config --global --add safe.directory $(pwd)
/usr/bin/git config --global protocol.file.allow always
- name: Install dependencies and prepare tests
shell: bash.exe -eo pipefail -o igncr "{0}"
run: |
set -x
/usr/bin/python -m pip install --upgrade pip setuptools wheel
/usr/bin/python --version; /usr/bin/git --version
/usr/bin/git submodule update --init --recursive
/usr/bin/git fetch --tags
/usr/bin/python -m pip install -r requirements.txt
/usr/bin/python -m pip install -r test-requirements.txt
TRAVIS=yes ./init-tests-after-clone.sh
/usr/bin/git config --global user.email "travis@ci.com"
/usr/bin/git config --global user.name "Travis Runner"
add-to-path: false # No need to change $PATH outside the Cygwin environment.

- name: Arrange for verbose output
run: |
# Arrange for verbose output but without shell environment setup details.
echo 'set -x' >~/.bash_profile
- name: Special configuration for Cygwin git
run: |
git config --global --add safe.directory "$(pwd)"
git config --global core.autocrlf false
- name: Prepare this repo for tests
run: |
./init-tests-after-clone.sh
- name: Set git user identity and command aliases for the tests
run: |
git config --global user.email "travis@ci.com"
git config --global user.name "Travis Runner"
# If we rewrite the user's config by accident, we will mess it up
# and cause subsequent tests to fail
cat test/fixtures/.gitconfig >> ~/.gitconfig
- name: Update PyPA packages
run: |
# Get the latest pip, wheel, and prior to Python 3.12, setuptools.
python -m pip install -U pip $(pip freeze --all | grep -oF setuptools) wheel
- name: Install project and test dependencies
run: |
pip install ".[test]"
- name: Show version and platform information
run: |
uname -a
command -v git python
git version
python --version
python -c 'import sys; print(sys.platform)'
python -c 'import os; print(os.name)'
python -c 'import git; print(git.compat.is_win)'
- name: Test with pytest
shell: bash.exe -eo pipefail -o igncr "{0}"
run: |
/usr/bin/python -m pytest
continue-on-error: false
pytest --color=yes -p no:sugar --instafail -vv
16 changes: 11 additions & 5 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -7,8 +7,14 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.x"
- uses: pre-commit/action@v3.0.0
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
with:
python-version: "3.x"

- uses: pre-commit/action@v3.0.0
with:
extra_args: --all-files --hook-stage manual
env:
SKIP: black-format
67 changes: 40 additions & 27 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
@@ -10,61 +10,74 @@ permissions:

jobs:
build:

runs-on: ubuntu-latest

strategy:
fail-fast: false
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"]
include:
- experimental: false

defaults:
run:
shell: /bin/bash --noprofile --norc -exo pipefail {0}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 9999
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies and prepare tests
run: |
set -x
allow-prereleases: ${{ matrix.experimental }}

python -m pip install --upgrade pip setuptools wheel
python --version; git --version
git submodule update --init --recursive
git fetch --tags
pip install -r requirements.txt
pip install -r test-requirements.txt
TRAVIS=yes ./init-tests-after-clone.sh
- name: Prepare this repo for tests
run: |
./init-tests-after-clone.sh
- name: Set git user identity and command aliases for the tests
run: |
git config --global user.email "travis@ci.com"
git config --global user.name "Travis Runner"
# If we rewrite the user's config by accident, we will mess it up
# and cause subsequent tests to fail
cat test/fixtures/.gitconfig >> ~/.gitconfig
- name: Update PyPA packages
run: |
# Get the latest pip, wheel, and prior to Python 3.12, setuptools.
python -m pip install -U pip $(pip freeze --all | grep -oF setuptools) wheel
- name: Install project and test dependencies
run: |
pip install ".[test]"
- name: Show version and platform information
run: |
uname -a
command -v git python
git version
python --version
python -c 'import sys; print(sys.platform)'
python -c 'import os; print(os.name)'
python -c 'import git; print(git.compat.is_win)'
- name: Check types with mypy
# With new versions of pypi new issues might arise. This is a problem if there is nobody able to fix them,
# so we have to ignore errors until that changes.
continue-on-error: true
run: |
set -x
mypy -p git
- name: Tell git to trust this repo
run: |
/usr/bin/git config --global --add safe.directory $(pwd)
/usr/bin/git config --global protocol.file.allow always
# With new versions of mypy new issues might arise. This is a problem if there is nobody able to fix them,
# so we have to ignore errors until that changes.
continue-on-error: true

- name: Test with pytest
run: |
set -x
pytest
pytest --color=yes -p no:sugar --instafail -vv
continue-on-error: false

- name: Documentation
run: |
set -x
pip install -r doc/requirements.txt
make -C doc html
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
*.py[co]
*.swp
*~
.env/
env/
.venv/
venv/
/*.egg-info
/lib/GitPython.egg-info
cover/
.coverage
.coverage.*
/build
/dist
/doc/_build
@@ -22,4 +25,3 @@ nbproject
.pytest_cache/
monkeytype.sqlite3
output.txt
tox.ini
54 changes: 37 additions & 17 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,39 @@
repos:
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: flake8
additional_dependencies:
[
flake8-bugbear==22.12.6,
flake8-comprehensions==3.10.1,
flake8-typing-imports==1.14.0,
]
exclude: ^doc|^git/ext/|^test/
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.9.1
hooks:
- id: black
alias: black-check
name: black (check)
args: [--check, --diff]
exclude: ^git/ext/
stages: [manual]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-merge-conflict
- id: check-toml
- id: check-yaml
- id: black
alias: black-format
name: black (format)
exclude: ^git/ext/

- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear==23.9.16
- flake8-comprehensions==3.14.0
- flake8-typing-imports==1.14.0
exclude: ^doc|^git/ext/

- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.9.0.5
hooks:
- id: shellcheck
args: [--color]
exclude: ^git/ext/

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-toml
- id: check-yaml
- id: check-merge-conflict
2 changes: 2 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -51,4 +51,6 @@ Contributors are:
-Luke Twist <itsluketwist@gmail.com>
-Joseph Hale <me _at_ jhale.dev>
-Santos Gallegos <stsewd _at_ proton.me>
-Wenhan Zhu <wzhu.cosmos _at_ gmail.com>

Portions derived from other open source works and are clearly marked.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@

The following is a short step-by-step rundown of what one typically would do to contribute.

- [fork this project](https://github.com/gitpython-developers/GitPython/fork) on GitHub.
- [Fork this project](https://github.com/gitpython-developers/GitPython/fork) on GitHub.
- For setting up the environment to run the self tests, please run `init-tests-after-clone.sh`.
- Please try to **write a test that fails unless the contribution is present.**
- Try to avoid massive commits and prefer to take small steps, with one commit for each.
Loading