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.30
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.41
Choose a head ref
Loading
Showing with 8,062 additions and 5,153 deletions.
  1. +7 −19 .flake8
  2. +2 −1 .gitattributes
  3. +6 −1 .github/dependabot.yml
  4. +80 −0 .github/workflows/codeql.yml
  5. +64 −41 .github/workflows/cygwin-test.yml
  6. +20 −0 .github/workflows/lint.yml
  7. +55 −36 .github/workflows/pythonpackage.yml
  8. +37 −13 .gitignore
  9. +39 −0 .pre-commit-config.yaml
  10. +3 −0 AUTHORS
  11. +1 −1 CONTRIBUTING.md
  12. +7 −0 FUNDING.json
  13. +17 −18 LICENSE
  14. +8 −9 Makefile
  15. +118 −46 README.md
  16. +1 −2 SECURITY.md
  17. +1 −1 VERSION
  18. +27 −0 build-release.sh
  19. +56 −0 check-version.sh
  20. +22 −21 doc/Makefile
  21. +71 −0 doc/source/changes.rst
  22. +2 −4 doc/source/conf.py
  23. +1 −0 doc/source/index.rst
  24. +244 −0 doc/source/quickstart.rst
  25. +1 −2 doc/source/tutorial.rst
  26. +0 −62 etc/sublime-text/git-python.sublime-project
  27. +101 −50 git/__init__.py
  28. +383 −301 git/cmd.py
  29. +42 −16 git/compat.py
  30. +186 −176 git/config.py
  31. +19 −11 git/db.py
  32. +115 −99 git/diff.py
  33. +63 −27 git/exc.py
  34. +1 −1 git/ext/gitdb
  35. +7 −4 git/index/__init__.py
  36. +278 −227 git/index/base.py
  37. +98 −94 git/index/fun.py
  38. +17 −14 git/index/typ.py
  39. +34 −26 git/index/util.py
  40. +16 −16 git/objects/__init__.py
  41. +54 −43 git/objects/base.py
  42. +8 −7 git/objects/blob.py
  43. +177 −109 git/objects/commit.py
  44. +59 −42 git/objects/fun.py
  45. +5 −2 git/objects/submodule/__init__.py
  46. +356 −317 git/objects/submodule/base.py
  47. +90 −73 git/objects/submodule/root.py
  48. +16 −14 git/objects/submodule/util.py
  49. +22 −19 git/objects/tag.py
  50. +69 −50 git/objects/tree.py
  51. +163 −135 git/objects/util.py
  52. +11 −8 git/refs/__init__.py
  53. +51 −34 git/refs/head.py
  54. +73 −56 git/refs/log.py
  55. +51 −38 git/refs/reference.py
  56. +14 −9 git/refs/remote.py
  57. +240 −138 git/refs/symbolic.py
  58. +27 −24 git/refs/tag.py
  59. +185 −148 git/remote.py
  60. +6 −3 git/repo/__init__.py
  61. +349 −244 git/repo/base.py
  62. +9 −3 git/repo/fun.py
  63. +21 −21 git/types.py
  64. +282 −189 git/util.py
  65. +63 −8 init-tests-after-clone.sh
  66. +13 −9 pyproject.toml
  67. +0 −4 requirements-dev.txt
  68. +15 −31 setup.py
  69. +9 −15 test-requirements.txt
  70. +2 −3 test/__init__.py
  71. 0 test/fixtures/diff_mode_only
  72. +18 −0 test/fixtures/env_case.py
  73. +8 −0 test/fixtures/polyglot
  74. +4 −5 test/lib/__init__.py
  75. +113 −81 test/lib/helper.py
  76. +20 −28 test/performance/lib.py
  77. +14 −13 test/performance/test_commit.py
  78. +8 −4 test/performance/test_odb.py
  79. +24 −22 test/performance/test_streams.py
  80. +3 −4 test/test_actor.py
  81. +27 −26 test/test_base.py
  82. +2 −3 test/test_blob.py
  83. +14 −9 test/test_blob_filter.py
  84. +3 −4 test/test_clone.py
  85. +116 −81 test/test_commit.py
  86. +47 −39 test/test_config.py
  87. +5 −5 test/test_db.py
  88. +104 −42 test/test_diff.py
  89. +149 −150 test/test_docs.py
  90. +10 −13 test/test_exc.py
  91. +38 −36 test/test_fun.py
  92. +199 −50 test/test_git.py
  93. +389 −151 test/test_index.py
  94. +36 −25 test/test_installation.py
  95. +222 −0 test/test_quick_doc.py
  96. +20 −20 test/test_reflog.py
  97. +151 −82 test/test_refs.py
  98. +376 −324 test/test_remote.py
  99. +398 −300 test/test_repo.py
  100. +2 −3 test/test_stats.py
  101. +407 −328 test/test_submodule.py
  102. +12 −31 test/test_tree.py
  103. +396 −139 test/test_util.py
  104. +5 −0 test/tstrunner.py
  105. +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: "weekly"
80 changes: 80 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
pull_request:
schedule:
- cron: '27 10 * * 3'

jobs:
analyze:
name: Analyze
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners
# Consider using larger runners for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'python' ]
# CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ]
# Use only 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
setup-python-dependencies: false
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
105 changes: 64 additions & 41 deletions .github/workflows/cygwin-test.yml
Original file line number Diff line number Diff line change
@@ -1,59 +1,82 @@
name: test-cygwin

on:
push:
branches:
main
pull_request:
branches:
main
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@v3
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: Lint with flake8
shell: bash.exe -eo pipefail -o igncr "{0}"
- name: Ensure the "pip" command is available
run: |
# This is used unless, and before, an updated pip is installed.
ln -s pip3 /usr/bin/pip
- name: Update PyPA packages
run: |
set -x
/usr/bin/python -m flake8
# Get the latest pip, wheel, and prior to Python 3.12, setuptools.
python -m pip install -U pip $(pip freeze --all | grep -ow ^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 os, sys; print(f"sys.platform={sys.platform!r}, os.name={os.name!r}")'
- 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
20 changes: 20 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Lint

on: [push, pull_request, workflow_dispatch]

jobs:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

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

- uses: pre-commit/action@v3.0.0
with:
extra_args: --all-files --hook-stage manual
env:
SKIP: black-format
Loading