8000 Merge pull request #1 from shayand/develop · gitpython-developers/GitPython@dc7a50d · GitHub
[go: up one dir, main page]

Skip to content

Commit dc7a50d

Browse files
authored
Merge pull request #1 from shayand/develop
Develop
2 parents f55d194 + 1e044ea commit dc7a50d

38 files changed

+1484
-589
lines changed

.github/workflows/alpine-test.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: test-alpine
2+
3+
on: [push, pull_request, workflow_dispatch]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
9+
container:
10+
image: alpine:latest
11+
12+
defaults:
13+
run:
14+
shell: sudo -u runner sh -exo pipefail {0}
15+
16+
steps:
17+
- name: Prepare Alpine Linux
18+
run: |
19+
apk add sudo git git-daemon python3 py3-pip
20+
echo 'Defaults env_keep += "CI GITHUB_* RUNNER_*"' >/etc/sudoers.d/ci_env
21+
addgroup -g 127 docker
22+
adduser -D -u 1001 runner
23+
adduser runner docker
24+
shell: sh -exo pipefail {0} # Run this as root, not the "runner" user.
25+
26+
- uses: actions/checkout@v4
27+
with:
28+
fetch-depth: 0
29+
30+
- name: Set workspace ownership
31+
run: |
32+
chown -R runner:docker -- "$GITHUB_WORKSPACE"
33+
shell: sh -exo pipefail {0} # Run this as root, not the "runner" user.
34+
35+
- name: Prepare this repo for tests
36+
run: |
37+
./init-tests-after-clone.sh
38+
39+
- name: Set git user identity and command aliases for the tests
40+
run: |
41+
git config --global user.email "travis@ci.com"
42+
git config --global user.name "Travis Runner"
43+
# If we rewrite the user's config by accident, we will mess it up
44+
# and cause subsequent tests to fail
45+
cat test/fixtures/.gitconfig >> ~/.gitconfig
46+
47+
- name: Set up virtualenv
48+
run: |
49+
python -m venv .venv
50+
. .venv/bin/activate
51+
printf '%s=%s\n' 'PATH' "$PATH" 'VIRTUAL_ENV' "$VIRTUAL_ENV" >>"$GITHUB_ENV"
52+
53+
- name: Update PyPA packages
54+
run: |
55+
# Get the latest pip, wheel, and prior to Python 3.12, setuptools.
56+
python -m pip install -U pip $(pip freeze --all | grep -ow ^setuptools) wheel
57+
58+
- name: Install project and test dependencies
59+
run: |
60+
pip install ".[test]"
61+
62+
- name: Show version and platform information
63+
run: |
64+
uname -a
65+
command -v git python
66+
git version
67+
python --version
68+ python -c 'import os, sys; print(f"sys.platform={sys.platform!r}, os.name={os.name!r}")'
69+
70+
- name: Test with pytest
71+
run: |
72+
pytest --color=yes -p no:sugar --instafail -vv

.github/workflows/codeql.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747

4848
# Initializes the CodeQL tools for scanning.
4949
- name: Initialize CodeQL
50-
uses: github/codeql-action/init@v2
50+
uses: github/codeql-action/init@v3
5151
with:
5252
languages: ${{ matrix.language }}
5353
setup-python-dependencies: false
@@ -62,7 +62,7 @@ jobs:
6262
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
6363
# If this step fails, then you should remove it and run the build manually (see below)
6464
- name: Autobuild
65-
uses: github/codeql-action/autobuild@v2
65+
uses: github/codeql-action/autobuild@v3
6666

6767
# ℹ️ Command-line programs to run using the OS shell.
6868
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
@@ -75,6 +75,6 @@ jobs:
7575
# ./location_of_script_within_repo/buildscript.sh
7676

7777
- name: Perform CodeQL Analysis
78-
uses: github/codeql-action/analyze@v2
78+
uses: github/codeql-action/analyze@v3
7979
with:
8080
category: "/language:${{matrix.language}}"

.github/workflows/cygwin-test.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515

1616
defaults:
1717
run:
18-
shell: C:\cygwin\bin\bash.exe --login --norc -eo pipefail -o igncr "{0}"
18+
shell: C:\tools\cygwin\bin\bash.exe --login --norc -eo pipefail -o igncr "{0}"
1919

2020
steps:
2121
- name: Force LF line endings
@@ -27,11 +27,10 @@ jobs:
2727
with:
2828
fetch-depth: 0
2929

30-
- name: Install Cygwin
31-
uses: cygwin/cygwin-install-action@v4
30+
- name: Set up Cygwin
31+
uses: egor-tensin/setup-cygwin@v4
3232
with:
33-
packages: python39 python39-pip python39-virtualenv git
34-
add-to-path: false # No need to change $PATH outside the Cygwin environment.
33+
packages: python39=3.9.16-1 python39-pip python39-virtualenv git
3534

3635
- name: Arrange for verbose output
3736
run: |
@@ -55,10 +54,15 @@ jobs:
5554
# and cause subsequent tests to fail
5655
cat test/fixtures/.gitconfig >> ~/.gitconfig
5756
57+
- name: Ensure the "pip" command is available
58+
run: |
59+
# This is used unless, and before, an updated pip is installed.
60+
ln -s pip3 /usr/bin/pip
61+
5862
- name: Update PyPA packages
5963
run: |
6064
# Get the latest pip, wheel, and prior to Python 3.12, setuptools.
61-
python -m pip install -U pip $(pip freeze --all | grep -oF setuptools) wheel
65+
python -m pip install -U pip $(pip freeze --all | grep -ow ^setuptools) wheel
6266
6367
- name: Install project and test dependencies
6468
run: |

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
with:
1414
python-version: "3.x"
1515

16-
- uses: pre-commit/action@v3.0.0
16+
- uses: pre-commit/action@v3.0.1
1717
with:
1818
extra_args: --all-files --hook-stage manual
1919
env:

.github/workflows/pythonpackage.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,15 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
os: ["ubuntu-latest", "macos-13", "windows-latest"]
16+
os: ["ubuntu-latest", "macos-13", "macos-14", "windows-latest"]
1717
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
18+
exclude:
19+
- os: "macos-14"
20+
python-version: "3.7"
21+
- os: "macos-14"
22+
python-version: "3.8"
23+
- os: "macos-14"
24+
python-version: "3.9"
1825
include:
1926
- experimental: false
2027

@@ -37,7 +44,7 @@ jobs:
3744

3845
- name: Set up WSL (Windows)
3946
if: startsWith(matrix.os, 'windows')
< 10000 /code>
40-
uses: Vampire/setup-wsl@v2.0.2
47+
uses: Vampire/setup-wsl@v3.0.0
4148
with:
4249
distribution: Debian
4350

@@ -56,7 +63,7 @@ jobs:
5663
- name: Update PyPA packages
5764
run: |
5865
# Get the latest pip, wheel, and prior to Python 3.12, setuptools.
59-
python -m pip install -U pip $(pip freeze --all | grep -oF setuptools) wheel
66+
python -m pip install -U pip $(pip freeze --all | grep -ow ^setuptools) wheel
6067
6168
- name: Install project and test dependencies
6269
run: |

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ repos:
2929
hooks:
3030
- id: shellcheck
3131
args: [--color]
32-
exclude: ^git/ext/
32+
exclude: ^test/fixtures/polyglot$|^git/ext/
3333

3434
- repo: https://github.com/pre-commit/pre-commit-hooks
3535
rev: v4.4.0

.readthedocs.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Read the Docs configuration file for Sphinx projects
2+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3+
4+
# Required
5+
version: 2
6+
7+
# Set the OS, Python version and other tools you might need.
8+
build:
9+
os: ubuntu-22.04
10+
tools:
11+
python: "3.12"
12+
# You can also specify other tool versions:
13+
# nodejs: "20"
14+
# rust: "1.70"
15+
# golang: "1.20"
16+
17+
# Build documentation in the "doc/" directory with Sphinx.
18+
sphinx:
19+
configuration: doc/source/conf.py
20+
# You can configure Sphinx to use a different builder, for instance use the dirhtml builder for simpler URLs
21+
# builder: "dirhtml"
22+
# Fail on all warnings to avoid broken references
23+
fail_on_warning: true
24+
25+
# Optionally build your docs in additional formats such as PDF and ePub.
26+
# formats:
27+
# - pdf
28+
# - epub
29+
30+
# Optional but recommended, declare the Python requirements required
31+
# to build your documentation.
32+
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
33+
python:
34+
install:
35+
- method: pip
36+
path: .
37+
- requirements: doc/requirements.txt

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,6 @@ Contributors are:
5353
-Santos Gallegos <stsewd _at_ proton.me>
5454
-Wenhan Zhu <wzhu.cosmos _at_ gmail.com>
5555
-Eliah Kagan <eliah.kagan _at_ gmail.com>
56+
-Ethan Lin <et.repositories _at_ gmail.com>
5657

5758
Portions derived from other open source works and are clearly marked.

README.md

Lines changed: 2 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ probably the skills to scratch that itch of mine: implement `git` in a way that
1717
If you like the idea and want to learn more, please head over to [gitoxide](https://github.com/Byron/gitoxide), an
1818
implementation of 'git' in [Rust](https://www.rust-lang.org).
1919

20+
*(Please note that `gitoxide` is not currently available for use in Python, and that Rust is required)*
21+
2022
## GitPython
2123

2224
GitPython is a python library used to interact with git repositories, high-level like git-porcelain,
@@ -220,57 +222,6 @@ Please have a look at the [contributions file][contributing].
220222
6. Run `make release`.
221223
7. Go to [GitHub Releases](https://github.com/gitpython-developers/GitPython/releases) and publish a new one with the recently pushed tag. Generate the changelog.
222224

223-
### How to verify a release (DEPRECATED)
224-
225-
Note that what follows is deprecated and future releases won't be signed anymore.
226-
More details about how it came to that can be found [in this issue](https://github.com/gitpython-developers/gitdb/issues/77).
227-
228-
----
229-
230-
Please only use releases from `pypi` as you can verify the respective source
231-
tarballs.
232-
233-
This script shows how to verify the tarball was indeed created by the authors of
234-
this project:
235-
236-
```bash
237-
curl https://files.pythonhosted.org/packages/09/bc/ae32e07e89cc25b9e5c793d19a1e5454d30a8e37d95040991160f942519e/GitPython-3.1.8-py3-none-any.whl > gitpython.whl
238-
curl https://files.pythonhosted.org/packages/09/bc/ae32e07e89cc25b9e5c793d19a1e5454d30a8e37d95040991160f942519e/GitPython-3.1.8-py3-none-any.whl.asc > gitpython-signature.asc
239-
gpg --verify gitpython-signature.asc gitpyth BD94 on.whl
240-
```
241-
242-
which outputs
243-
244-
```bash
245-
gpg: Signature made Fr 4 Sep 10:04:50 2020 CST
246-
gpg: using RSA key 27C50E7F590947D7273A741E85194C08421980C9
247-
gpg: Good signature from "Sebastian Thiel (YubiKey USB-C) <byronimo@gmail.com>" [ultimate]
248-
gpg: aka "Sebastian Thiel (In Rust I trust) <sebastian.thiel@icloud.com>" [ultimate]
249-
```
250-
251-
You can verify that the keyid indeed matches the release-signature key provided in this
252-
repository by looking at the keys details:
253-
254-
```bash
255-
gpg --list-packets ./release-verification-key.asc
256-
```
257-
258-
You can verify that the commit adding it was also signed by it using:
259-
260-
```bash
261-
git show --show-signature ./release-verification-key.asc
262-
```
263-
264-
If you would like to trust it permanently, you can import and sign it:
265-
266-
```bash
267-
gpg --import ./release-verification-key.asc
268-
gpg --edit-key 4C08421980C9
269-
270-
> sign
271-
> save
272-
```
273-
274225
### Projects using GitPython
275226

276227
- [PyDriller](https://github.com/ishepard/pydriller)

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.1.40
1+
3.1.42

doc/requirements.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1-
sphinx==4.3.0
1+
sphinx == 4.3.2
22
sphinx_rtd_theme
3+
sphinxcontrib-applehelp >= 1.0.2, <= 1.0.4
4+
sphinxcontrib-devhelp == 1.0.2
5+
sphinxcontrib-htmlhelp >= 2.0.0, <= 2.0.1
6+
sphinxcontrib-qthelp == 1.0.3
7+
sphinxcontrib-serializinghtml == 1.1.5
38
sphinx-autodoc-typehints

doc/source/changes.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,24 @@
22
Changelog
33
=========
44

5+
3.1.42
6+
======
7+
8+
See the following for all changes.
9+
https://github.com/gitpython-developers/GitPython/releases/tag/3.1.42
10+
11+
3.1.41
12+
======
13+
14+
This release is relevant for security as it fixes a possible arbitary
15+
code execution on Windows.
16+
17+
See this PR for details: https://github.com/gitpython-developers/GitPython/pull/1792
18+
An advisory is available soon at: https://github.com/gitpython-developers/GitPython/security/advisories/GHSA-2mqj-m65w-jghx
19+
20+
See the following for all changes.
21+
https://github.com/gitpython-developers/GitPython/releases/tag/3.1.41
22+
523
3.1.40
624
======
725

git/__init__.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,21 @@
120120

121121

122122
def refresh(path: Optional[PathLike] = None) -> None:
123-
"""Convenience method for setting the git executable path."""
123+
"""Convenience method for setting the git executable path.
124+
125+
:param path: Optional path to the Git executable. If not absolute, it is resolved
126+
immediately, relative to the current directory.
127+
128+
:note: The *path* parameter is usually omitted and cannot be used to specify a
129+
custom command whose location is looked up in a path search on each call. See
130+
:meth:`Git.refresh` for details on how to achieve this.
131+
132+
:note: This calls :meth:`Git.refresh` and sets other global configuration according
133+
to the effect of doing so. As such, this function should usually be used instead
134+
of using :meth:`Git.refresh` or :meth:`FetchInfo.refresh` directly.
135+
136+
:note: This function is called automatically, with no arguments, at import time.
137+
"""
124138
global GIT_OK
125139
GIT_OK = False
126140

0 commit comments

Comments
 (0)
0