Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
DeflateAwning committed Oct 10, 2023
2 parents a4eb2b3 + fbac514 commit 87cc325
Show file tree
Hide file tree
Showing 71 changed files with 1,141 additions and 754 deletions.
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
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
interval: "weekly"
46 changes: 28 additions & 18 deletions .github/workflows/cygwin-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,24 @@ 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"

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

steps:
- name: Force LF line endings
run: git config --global core.autocrlf input
run: |
git config --global core.autocrlf false # Affects the non-Cygwin git.
shell: bash

- uses: actions/checkout@v4
with:
Expand All @@ -29,36 +33,42 @@ jobs:
with:
packages: python39 python39-pip python39-virtualenv git

- name: Show python and git versions
- name: Special configuration for Cygwin's git
run: |
/usr/bin/python --version
/usr/bin/git version
- name: Tell git to trust this repo
run: |
/usr/bin/git config --global --add safe.directory "$(pwd)"
git config --global --add safe.directory "$(pwd)"
git config --global core.autocrlf false
- name: Prepare this repo for tests
run: |
TRAVIS=yes ./init-tests-after-clone.sh
./init-tests-after-clone.sh
- name: Further prepare git configuration for tests
- name: Set git user identity and command aliases for the tests
run: |
/usr/bin/git config --global user.email "travis@ci.com"
/usr/bin/git config --global user.name "Travis Runner"
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: |
/usr/bin/python -m pip install --upgrade pip setuptools wheel
# 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: |
/usr/bin/python -m pip install ".[test]"
python -m 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
run: |
set +x
/usr/bin/python -m pytest
python -m 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
Expand Up @@ -7,8 +7,14 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- 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
36 changes: 18 additions & 18 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,15 @@ permissions:

jobs:
build:

runs-on: ubuntu-latest

strategy:
fail-fast: false
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

defaults:
run:
shell: /bin/bash --noprofile --norc -exo pipefail {0}
Expand All @@ -36,16 +35,11 @@ jobs:
python-version: ${{ matrix.python-version }}
allow-prereleases: ${{ matrix.experimental }}

- name: Show python and git versions
run: |
python --version
git version
- name: Prepare this repo for tests
run: |
TRAVIS=yes ./init-tests-after-clone.sh
./init-tests-after-clone.sh
- name: Prepare git configuration for tests
- 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"
Expand All @@ -55,17 +49,23 @@ jobs:
- name: Update PyPA packages
run: |
python -m pip install --upgrade pip
if pip freeze --all | grep --quiet '^setuptools=='; then
# Python prior to 3.12 ships setuptools. Upgrade it if present.
python -m pip install --upgrade setuptools
fi
python -m pip install --upgrade wheel
# 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
run: |
mypy -p git
Expand All @@ -75,7 +75,7 @@ jobs:

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

- name: Documentation
Expand Down
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
Expand All @@ -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
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,5 @@ Contributors are:
-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
Expand Up @@ -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.
Expand Down
35 changes: 17 additions & 18 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
Copyright (C) 2008, 2009 Michael Trier and contributors
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

* Redistributions of source code must retain the above copyright
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

* Neither the name of the GitPython project nor the names of
its contributors may be used to endorse or promote products derived
* Neither the name of the GitPython project nor the names of
its contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Loading

0 comments on commit 87cc325

Please sign in to comment.