Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-pygit2 for openSUSE:Factory checked in at 2022-09-20 19:24:09 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pygit2 (Old) and /work/SRC/openSUSE:Factory/.python-pygit2.new.2083 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pygit2" Tue Sep 20 19:24:09 2022 rev:29 rq:1004951 version:1.10.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-pygit2/python-pygit2.changes 2022-07-22 19:21:24.368677637 +0200 +++ /work/SRC/openSUSE:Factory/.python-pygit2.new.2083/python-pygit2.changes 2022-09-20 19:24:10.482575754 +0200 @@ -1,0 +2,17 @@ +Mon Sep 19 16:53:05 UTC 2022 - Stephan Kulow <co...@suse.com> + +- Update to 1.10.1 + - Fix segfault in ``Signature`` repr + `#1155 <https://github.com/libgit2/pygit2/pull/1155>`_ + - Linux and macOS wheels for Python 3.11 + `#1154 <https://github.com/libgit2/pygit2/pull/1154>`_ + - Upgrade to libgit2 1.5 + - Add support for ``GIT_OPT_GET_OWNER_VALIDATION`` and + ``GIT_OPT_SET_OWNER_VALIDATION`` + `#1150 <https://github.com/libgit2/pygit2/pull/1150>`_ + - New ``untracked_files`` and ``ignored`` optional arguments for + ``Repository.status(...)`` + `#1151 <https://github.com/libgit2/pygit2/pull/1151>`_ +- Remove support-libgit-1.5.patch no longer needed + +------------------------------------------------------------------- Old: ---- pygit2-1.9.2.tar.gz support-libgit-1.5.patch New: ---- pygit2-1.10.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pygit2.spec ++++++ --- /var/tmp/diff_new_pack.vLfeis/_old 2022-09-20 19:24:11.038577349 +0200 +++ /var/tmp/diff_new_pack.vLfeis/_new 2022-09-20 19:24:11.046577372 +0200 @@ -20,14 +20,12 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %define skip_python2 1 Name: python-pygit2 -Version: 1.9.2 +Version: 1.10.1 Release: 0 Summary: Python bindings for libgit2 License: GPL-2.0-only URL: https://github.com/libgit2/pygit2 Source: https://files.pythonhosted.org/packages/source/p/pygit2/pygit2-%{version}.tar.gz -# PATCH-FIX-UPSTREAM based on gh#libgit2/pygit2#14b1df84060ea4ab085202382e80672ec1a104e3 -Patch0: support-libgit-1.5.patch BuildRequires: %{python_module cached-property} BuildRequires: %{python_module cffi >= 1.4.0} BuildRequires: %{python_module devel} ++++++ pygit2-1.9.2.tar.gz -> pygit2-1.10.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pygit2-1.9.2/AUTHORS.rst new/pygit2-1.10.1/AUTHORS.rst --- old/pygit2-1.9.2/AUTHORS.rst 2022-05-24 19:30:26.409273100 +0200 +++ new/pygit2-1.10.1/AUTHORS.rst 2022-08-28 11:14:16.406786400 +0200 @@ -42,6 +42,7 @@ Lukas Fleischer Nicolas Dandrimont Raphael Medaer (Escaux) + Saugat Pachhai Anatoly Techtonik Andrew Olsen Dan Sully @@ -50,13 +51,13 @@ Robin Stocker R??mi Duraffort Santiago Perez De Rosso - Saugat Pachhai Sebastian Thiel Thom Wiggers Alexander Linne Alok Singhal Assaf Nativ Bob Carroll + Christian H??ggstr??m Erik Johnson Filip Rindler Fraser Tweedale @@ -139,6 +140,7 @@ Dan Cecile Daniel Bruce Daniele Esposti + Daniele Trifir?? David Black David Fischer David Sanders @@ -155,6 +157,7 @@ Holger Frey Hugh Cole-Baker Isabella Stephens + Jacob Swanson Jasper Lievisse Adriaanse Jiri Benc Jonathan Robson diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pygit2-1.9.2/CHANGELOG.rst new/pygit2-1.10.1/CHANGELOG.rst --- old/pygit2-1.9.2/CHANGELOG.rst 2022-05-24 19:37:54.913962800 +0200 +++ new/pygit2-1.10.1/CHANGELOG.rst 2022-08-28 11:13:13.705961500 +0200 @@ -1,3 +1,27 @@ +1.10.1 (2022-08-28) +------------------------- + +- Fix segfault in ``Signature`` repr + `#1155 <https://github.com/libgit2/pygit2/pull/1155>`_ + +- Linux and macOS wheels for Python 3.11 + `#1154 <https://github.com/libgit2/pygit2/pull/1154>`_ + + +1.10.0 (2022-07-24) +------------------------- + +- Upgrade to libgit2 1.5 + +- Add support for ``GIT_OPT_GET_OWNER_VALIDATION`` and + ``GIT_OPT_SET_OWNER_VALIDATION`` + `#1150 <https://github.com/libgit2/pygit2/pull/1150>`_ + +- New ``untracked_files`` and ``ignored`` optional arguments for + ``Repository.status(...)`` + `#1151 <https://github.com/libgit2/pygit2/pull/1151>`_ + + 1.9.2 (2022-05-24) ------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pygit2-1.9.2/Makefile new/pygit2-1.10.1/Makefile --- old/pygit2-1.9.2/Makefile 2022-04-14 08:24:00.331925600 +0200 +++ new/pygit2-1.10.1/Makefile 2022-07-14 14:26:04.643731600 +0200 @@ -1,7 +1,7 @@ .PHONY: build html build: - LIBSSH2_VERSION=1.10.0 LIBGIT2_VERSION=1.4.3 sh build.sh + LIBSSH2_VERSION=1.10.0 LIBGIT2_VERSION=1.5.0 sh build.sh html: build make -C docs html diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pygit2-1.9.2/PKG-INFO new/pygit2-1.10.1/PKG-INFO --- old/pygit2-1.9.2/PKG-INFO 2022-05-24 22:01:01.317232600 +0200 +++ new/pygit2-1.10.1/PKG-INFO 2022-08-28 13:41:46.114741000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: pygit2 -Version: 1.9.2 +Version: 1.10.1 Summary: Python bindings for libgit2. Home-page: https://github.com/libgit2/pygit2 Maintainer: J. David Ib????ez @@ -10,7 +10,6 @@ Project-URL: Changelog, https://github.com/libgit2/pygit2/blob/master/CHANGELOG.rst Project-URL: Funding, https://github.com/sponsors/jdavid Keywords: git -Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: Programming Language :: Python @@ -84,5 +83,3 @@ along with this program; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pygit2-1.9.2/build.sh new/pygit2-1.10.1/build.sh --- old/pygit2-1.9.2/build.sh 2022-04-23 10:00:11.739299000 +0200 +++ new/pygit2-1.10.1/build.sh 2022-08-28 11:11:54.262747800 +0200 @@ -25,19 +25,19 @@ # # sh build.sh # -# Build libgit2 1.4.3 (will use libssh2 if available), then build pygit2 +# Build libgit2 1.5.0 (will use libssh2 if available), then build pygit2 # inplace: # -# LIBGIT2_VERSION=1.4.3 sh build.sh +# LIBGIT2_VERSION=1.5.0 sh build.sh # -# Build libssh2 1.10.0 and libgit2 1.4.3, then build pygit2 inplace: +# Build libssh2 1.10.0 and libgit2 1.5.0, then build pygit2 inplace: # -# LIBSSH2_VERSION=1.10.0 LIBGIT2_VERSION=1.4.3 sh build.sh +# LIBSSH2_VERSION=1.10.0 LIBGIT2_VERSION=1.5.0 sh build.sh # -# Tell where libssh2 is installed, build libgit2 1.4.3, then build pygit2 +# Tell where libssh2 is installed, build libgit2 1.5.0, then build pygit2 # inplace: # -# LIBSSH2_PREFIX=/usr/local LIBGIT2_VERSION=1.4.3 sh build.sh +# LIBSSH2_PREFIX=/usr/local LIBGIT2_VERSION=1.5.0 sh build.sh # # Build inplace and run the tests: # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pygit2-1.9.2/pygit2/_build.py new/pygit2-1.10.1/pygit2/_build.py --- old/pygit2-1.9.2/pygit2/_build.py 2022-05-24 19:31:39.134028700 +0200 +++ new/pygit2-1.10.1/pygit2/_build.py 2022-08-28 11:14:43.573393300 +0200 @@ -35,7 +35,7 @@ # # The version number of pygit2 # -__version__ = '1.9.2' +__version__ = '1.10.1' # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pygit2-1.9.2/pygit2/_pygit2.pyi new/pygit2-1.10.1/pygit2/_pygit2.pyi --- old/pygit2-1.9.2/pygit2/_pygit2.pyi 2022-05-06 08:07:20.948192800 +0200 +++ new/pygit2-1.10.1/pygit2/_pygit2.pyi 2022-08-24 10:35:14.088508000 +0200 @@ -260,7 +260,7 @@ committer: Signature gpg_signature: tuple[bytes, bytes] message: str - message_encoding: str | None + message_encoding: str message_trailers: dict[str, str] parent_ids: list[Oid] parents: list[Commit] @@ -496,7 +496,7 @@ def revparse_single(self, revision: str) -> Object: ... def set_odb(self, odb: Odb) -> None: ... def set_refdb(self, refdb: Refdb) -> None: ... - def status(self) -> dict[str,int]: ... + def status(self, untracked_files: str = "all", ignored: bool = True) -> dict[str,int]: ... def status_file(self, path: str) -> int: ... def walk(self, oid: _OidArg | None, sort_mode: int = GIT_SORT_NONE) -> Walker: ... @@ -506,7 +506,7 @@ to_object: Object class Signature: - _encoding: str + _encoding: str | None _pointer: bytes email: str name: str @@ -514,7 +514,7 @@ raw_email: bytes raw_name: bytes time: int - def __init__(self, name: str, email: str, time: int, offset: int, encoding: str) -> None: ... + def __init__(self, name: str, email: str, time: int, offset: int, encoding: str | None) -> None: ... def __eq__(self, other) -> bool: ... def __ge__(self, other) -> bool: ... def __gt__(self, other) -> bool: ... diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pygit2-1.9.2/src/options.c new/pygit2-1.10.1/src/options.c --- old/pygit2-1.9.2/src/options.c 2022-03-14 09:11:42.433751800 +0100 +++ new/pygit2-1.10.1/src/options.c 2022-07-18 21:24:40.629340200 +0200 @@ -298,6 +298,7 @@ case GIT_OPT_ENABLE_STRICT_HASH_VERIFICATION: case GIT_OPT_ENABLE_UNSAVED_INDEX_SAFETY: case GIT_OPT_DISABLE_PACK_KEEP_FILE_CHECKS: + case GIT_OPT_SET_OWNER_VALIDATION: { PyObject *py_enabled; int enabled; @@ -317,6 +318,18 @@ Py_RETURN_NONE; } + // int enabled getter + case GIT_OPT_GET_OWNER_VALIDATION: + { + int enabled; + + error = git_libgit2_opts(option, &enabled); + if (error < 0) + return Error_set(error); + + return PyLong_FromLong(enabled); + } + // Not implemented case GIT_OPT_SET_SSL_CIPHERS: case GIT_OPT_GET_USER_AGENT: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pygit2-1.9.2/src/options.h new/pygit2-1.10.1/src/options.h --- old/pygit2-1.9.2/src/options.h 2021-09-17 13:25:20.003411500 +0200 +++ new/pygit2-1.10.1/src/options.h 2022-07-18 21:24:40.629340200 +0200 @@ -51,6 +51,13 @@ "\n" "GIT_OPT_SET_MWINDOW_SIZE, size\n" " Set the maximum mmap window size.\n" + "\n" + "GIT_OPT_GET_OWNER_VALIDATION\n" + " Gets the owner validation setting for repository directories.\n" + "\n" + "GIT_OPT_SET_OWNER_VALIDATION, enabled\n" + " Set that repository directories should be owned by the current user.\n" + " The default is to validate ownership.\n" ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pygit2-1.9.2/src/pygit2.c new/pygit2-1.10.1/src/pygit2.c --- old/pygit2-1.9.2/src/pygit2.c 2022-03-14 09:11:42.434751700 +0100 +++ new/pygit2-1.10.1/src/pygit2.c 2022-07-18 21:24:40.630340000 +0200 @@ -329,6 +329,8 @@ ADD_CONSTANT_INT(m, GIT_OPT_GET_PACK_MAX_OBJECTS); ADD_CONSTANT_INT(m, GIT_OPT_SET_PACK_MAX_OBJECTS); ADD_CONSTANT_INT(m, GIT_OPT_DISABLE_PACK_KEEP_FILE_CHECKS); + ADD_CONSTANT_INT(m, GIT_OPT_GET_OWNER_VALIDATION); + ADD_CONSTANT_INT(m, GIT_OPT_SET_OWNER_VALIDATION); /* Exceptions */ ADD_EXC(m, GitError, NULL); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pygit2-1.9.2/src/repository.c new/pygit2-1.10.1/src/repository.c --- old/pygit2-1.9.2/src/repository.c 2022-05-06 08:07:20.948192800 +0200 +++ new/pygit2-1.10.1/src/repository.c 2022-07-25 09:42:29.865465900 +0200 @@ -25,6 +25,7 @@ * Boston, MA 02110-1301, USA. */ +#include <git2/status.h> #define PY_SSIZE_T_CLEAN #include <Python.h> #include "error.h" @@ -1771,20 +1772,65 @@ } PyDoc_STRVAR(Repository_status__doc__, - "status() -> dict[str, int]\n" + "status(untracked_files: str = \"all\", ignored: bool = False) -> dict[str, int]\n" "\n" "Reads the status of the repository and returns a dictionary with file\n" - "paths as keys and status flags as values. See pygit2.GIT_STATUS_*."); + "paths as keys and status flags as values. See pygit2.GIT_STATUS_*.\n" + "\n" + "Parameters:\n" + "\n" + "untracked_files\n" + " How to handle untracked files, defaults to \"all\":\n" + "\n" + " - \"no\": do not return untracked files\n" + " - \"normal\": include untracked files/directories but no dot recurse subdirectories\n" + " - \"all\": include all files in untracked directories\n" + "\n" + " Using `untracked_files=\"no\"` or \"normal\"can be faster than \"all\" when the worktree\n" + " contains many untracked files/directories.\n" + "\n" + "ignored\n" + " Whether to show ignored files with untracked files. Ignored when untracked_files == \"no\"\n" + " Defaults to False.\n"); PyObject * -Repository_status(Repository *self) +Repository_status(Repository *self, PyObject *args, PyObject *kw) { PyObject *dict; int err; size_t len, i; git_status_list *list; - err = git_status_list_new(&list, self->repo, NULL); + char *untracked_files = "all"; + static char *kwlist[] = {"untracked_files", "ignored", NULL}; + + PyObject* ignored = Py_False; + + if (!PyArg_ParseTupleAndKeywords(args, kw, "|sO", kwlist, + &untracked_files, &ignored)) + goto error; + + git_status_options opts = GIT_STATUS_OPTIONS_INIT; + opts.flags = GIT_STATUS_OPT_DEFAULTS; + + if (!strcmp(untracked_files, "no")) { + opts.flags &= ~(GIT_STATUS_OPT_INCLUDE_UNTRACKED | GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS); + } else if (!strcmp(untracked_files, "normal")){ + opts.flags &= ~GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS; + } else if (strcmp(untracked_files, "all") ){ + return PyErr_Format( + PyExc_ValueError, + "untracked_files must be one of \"all\", \"normal\" or \"one\""); + }; + + if (!PyBool_Check(ignored)) { + return PyErr_Format(PyExc_TypeError, "ignored must be True or False"); + } + if (!PyObject_IsTrue(ignored)) { + opts.flags &= ~GIT_STATUS_OPT_INCLUDE_IGNORED; + } + + err = git_status_list_new(&list, self->repo, &opts); if (err < 0) return Error_set(err); @@ -2413,7 +2459,7 @@ METHOD(Repository, revparse_single, METH_O), METHOD(Repository, revparse_ext, METH_O), METHOD(Repository, revparse, METH_O), - METHOD(Repository, status, METH_NOARGS), + METHOD(Repository, status, METH_VARARGS | METH_KEYWORDS), METHOD(Repository, status_file, METH_O), METHOD(Repository, notes, METH_VARARGS), METHOD(Repository, create_note, METH_VARARGS), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pygit2-1.9.2/src/repository.h new/pygit2-1.10.1/src/repository.h --- old/pygit2-1.9.2/src/repository.h 2022-05-06 08:07:20.948192800 +0200 +++ new/pygit2-1.10.1/src/repository.h 2022-07-22 15:28:46.904039600 +0200 @@ -60,7 +60,7 @@ PyObject* Repository_create_reference_symbolic(Repository *self, PyObject *args, PyObject* kw); PyObject* Repository_compress_references(Repository *self); -PyObject* Repository_status(Repository *self); +PyObject* Repository_status(Repository *self, PyObject *args, PyObject *kw); PyObject* Repository_status_file(Repository *self, PyObject *value); PyObject* Repository_TreeBuilder(Repository *self, PyObject *args); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pygit2-1.9.2/src/signature.c new/pygit2-1.10.1/src/signature.c --- old/pygit2-1.9.2/src/signature.c 2022-03-22 09:46:40.405650100 +0100 +++ new/pygit2-1.10.1/src/signature.c 2022-08-23 11:36:41.305126400 +0200 @@ -40,17 +40,18 @@ { char *keywords[] = {"name", "email", "time", "offset", "encoding", NULL}; PyObject *py_name; - char *email, *encoding = "utf-8"; + char *email, *encoding = NULL; long long time = -1; int offset = 0; if (!PyArg_ParseTupleAndKeywords( - args, kwds, "Os|Lis", keywords, + args, kwds, "Os|Liz", keywords, &py_name, &email, &time, &offset, &encoding)) return -1; PyObject *tname; - const char *name = pgit_borrow_encoding(py_name, encoding, NULL, &tname); + const char *name = pgit_borrow_encoding( + py_name, value_or_default(encoding, "utf-8"), NULL, &tname); if (name == NULL) return -1; @@ -104,11 +105,10 @@ PyObject * Signature__encoding__get__(Signature *self) { - const char *encoding; - - encoding = self->encoding; - if (encoding == NULL) + const char *encoding = self->encoding; + if (encoding == NULL) { encoding = "utf-8"; + } return to_encoding(encoding); } @@ -199,7 +199,9 @@ strcmp(sa->signature->email, sb->signature->email) == 0 && sa->signature->when.time == sb->signature->when.time && sa->signature->when.offset == sb->signature->when.offset && - sa->signature->when.sign == sb->signature->when.sign); + sa->signature->when.sign == sb->signature->when.sign && + strcmp(value_or_default(sa->encoding, "utf-8"), + value_or_default(sb->encoding, "utf-8")) == 0); switch (op) { case Py_EQ: @@ -221,7 +223,7 @@ } -PyObject * +static PyObject * Signature__str__(Signature *self) { PyObject *name, *email, *str; @@ -233,13 +235,19 @@ return str; } -PyObject * +static PyObject * Signature__repr__(Signature *self) { PyObject *name, *email, *encoding, *str; name = to_unicode(self->signature->name, self->encoding, NULL); email = to_unicode(self->signature->email, self->encoding, NULL); - encoding = to_unicode(self->encoding, self->encoding, NULL); + + if (self->encoding) { + encoding = to_unicode(self->encoding, self->encoding, NULL); + } else { + encoding = Py_None; + } + str = PyUnicode_FromFormat( "pygit2.Signature(%R, %R, %lld, %ld, %R)", name, @@ -266,13 +274,13 @@ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ - Signature__repr__, /* tp_repr */ + (reprfunc)Signature__repr__, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ - Signature__str__, /* tp_str */ + (reprfunc)Signature__str__, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pygit2-1.9.2/src/types.h new/pygit2-1.10.1/src/types.h --- old/pygit2-1.9.2/src/types.h 2022-02-14 08:38:49.754672500 +0100 +++ new/pygit2-1.10.1/src/types.h 2022-07-24 12:58:57.647010800 +0200 @@ -32,8 +32,8 @@ #include <Python.h> #include <git2.h> -#if !(LIBGIT2_VER_MAJOR == 1 && LIBGIT2_VER_MINOR == 4) -#error You need a compatible libgit2 version (1.4.x) +#if !(LIBGIT2_VER_MAJOR == 1 && LIBGIT2_VER_MINOR == 5) +#error You need a compatible libgit2 version (1.5.x) #endif /* diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pygit2-1.9.2/src/utils.h new/pygit2-1.10.1/src/utils.h --- old/pygit2-1.9.2/src/utils.h 2021-09-17 13:25:20.007411500 +0200 +++ new/pygit2-1.10.1/src/utils.h 2022-08-23 10:21:12.100895400 +0200 @@ -84,6 +84,8 @@ return PyUnicode_Decode(value, len, encoding, errors); } +#define value_or_default(x, _default) ((x) == NULL ? (_default) : (x)) + const char* pgit_borrow(PyObject *value); const char* pgit_borrow_encoding(PyObject *value, const char *encoding, const char *errors, PyObject **tvalue); char* pgit_encode(PyObject *value, const char *encoding); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pygit2-1.9.2/test/conftest.py new/pygit2-1.10.1/test/conftest.py --- old/pygit2-1.9.2/test/conftest.py 2022-05-24 19:39:04.882668700 +0200 +++ new/pygit2-1.10.1/test/conftest.py 2022-07-22 15:28:24.902061700 +0200 @@ -1,4 +1,5 @@ from pathlib import Path +import platform import pytest import pygit2 @@ -6,17 +7,19 @@ @pytest.fixture(scope='session', autouse=True) -def disable_global_git_config(): - """ - Do not use global config for better test reproducibility. - https://github.com/libgit2/pygit2/issues/989 - """ +def global_git_config(): + # Do not use global config for better test reproducibility. + # https://github.com/libgit2/pygit2/issues/989 levels = [pygit2.GIT_CONFIG_LEVEL_GLOBAL, pygit2.GIT_CONFIG_LEVEL_XDG, pygit2.GIT_CONFIG_LEVEL_SYSTEM] for level in levels: pygit2.settings.search_path[level] = "" + # Fix tests running in AppVeyor + if platform.system() == 'Windows': + pygit2.option(pygit2.GIT_OPT_SET_OWNER_VALIDATION, 0) + @pytest.fixture def pygit2_empty_key(): Binary files old/pygit2-1.9.2/test/data/dirtyrepo.zip and new/pygit2-1.10.1/test/data/dirtyrepo.zip differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pygit2-1.9.2/test/test_commit.py new/pygit2-1.10.1/test/test_commit.py --- old/pygit2-1.9.2/test/test_commit.py 2022-01-26 16:20:11.883729500 +0100 +++ new/pygit2-1.10.1/test/test_commit.py 2022-08-24 10:31:02.489916000 +0200 @@ -142,8 +142,10 @@ encoding = 'iso-8859-1' amended_message = "Amended commit message.\n\nMessage with non-ascii chars: ??????.\n" - amended_author = Signature('Jane Author', 'j...@example.com', 12345, 0) - amended_committer = Signature('John Committer', 'j...@example.com', 12346, 0) + amended_author = Signature( + 'Jane Author', 'j...@example.com', 12345, 0, encoding=encoding) + amended_committer = Signature( + 'John Committer', 'j...@example.com', 12346, 0, encoding=encoding) amended_oid = repo.amend_commit( commit, 'HEAD', message=amended_message, author=amended_author, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pygit2-1.9.2/test/test_diff.py new/pygit2-1.10.1/test/test_diff.py --- old/pygit2-1.9.2/test/test_diff.py 2022-03-14 09:12:15.951593900 +0100 +++ new/pygit2-1.10.1/test/test_diff.py 2022-07-22 15:28:46.904039600 +0200 @@ -64,6 +64,7 @@ PATCHID = 'f31412498a17e6c3fbc635f2c5f9aa3ef4c1a9b7' DIFF_HEAD_TO_INDEX_EXPECTED = [ + '.gitignore', 'staged_changes', 'staged_changes_file_deleted', 'staged_changes_file_modified', @@ -87,6 +88,7 @@ ] DIFF_INDEX_TO_WORK_EXPECTED = [ + '.gitignore', 'file_deleted', 'modified_file', 'staged_changes_file_deleted', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pygit2-1.9.2/test/test_options.py new/pygit2-1.10.1/test/test_options.py --- old/pygit2-1.9.2/test/test_options.py 2021-09-17 13:25:20.015411900 +0200 +++ new/pygit2-1.10.1/test/test_options.py 2022-07-20 19:24:27.793042000 +0200 @@ -111,3 +111,7 @@ for level, path in paths: pygit2.settings.search_path[level] = path assert path == pygit2.settings.search_path[level] + +def test_owner_validation(): + __option(pygit2.GIT_OPT_GET_OWNER_VALIDATION, + pygit2.GIT_OPT_SET_OWNER_VALIDATION, 0) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pygit2-1.9.2/test/test_signature.py new/pygit2-1.10.1/test/test_signature.py --- old/pygit2-1.9.2/test/test_signature.py 2022-03-22 09:46:40.405650100 +0100 +++ new/pygit2-1.10.1/test/test_signature.py 2022-08-23 11:40:41.969026300 +0200 @@ -30,48 +30,42 @@ from pygit2 import Signature -def test_default(): - signature = Signature( - 'Foo Ib????ez', 'f...@example.com', 1322174594, 60) - encoding = signature._encoding - assert encoding == 'utf-8' +def __assert(signature, encoding): + encoding = encoding or 'utf-8' + assert signature._encoding == encoding assert signature.name == signature.raw_name.decode(encoding) assert signature.name.encode(encoding) == signature.raw_name assert signature.email == signature.raw_email.decode(encoding) assert signature.email.encode(encoding) == signature.raw_email +@pytest.mark.parametrize('encoding', [None, 'utf-8', 'iso-8859-1']) +def test_encoding(encoding): + signature = Signature('Foo Ib????ez', 'f...@example.com', encoding=encoding) + __assert(signature, encoding) + assert abs(signature.time - time.time()) < 5 + assert str(signature) == 'Foo Ib????ez <f...@example.com>' + +def test_default_encoding(): + signature = Signature('Foo Ib????ez', 'f...@example.com', 1322174594, 60) + __assert(signature, 'utf-8') + def test_ascii(): with pytest.raises(UnicodeEncodeError): Signature('Foo Ib????ez', 'f...@example.com', encoding='ascii') -def test_latin1(): - encoding = 'iso-8859-1' - signature = Signature( - 'Foo Ib????ez', 'f...@example.com', encoding=encoding) - assert encoding == signature._encoding - assert signature.name == signature.raw_name.decode(encoding) - assert signature.name.encode(encoding) == signature.raw_name - assert signature.email == signature.raw_email.decode(encoding) - assert signature.email.encode(encoding) == signature.raw_email - -def test_now(): +def test_repr(): encoding = 'utf-8' - signature = Signature( - 'Foo Ib????ez', 'f...@example.com', encoding=encoding) - assert encoding == signature._encoding - assert signature.name == signature.raw_name.decode(encoding) - assert signature.name.encode(encoding) == signature.raw_name - assert signature.email == signature.raw_email.decode(encoding) - assert signature.email.encode(encoding) == signature.raw_email - assert abs(signature.time - time.time()) < 5 - -def test_str(): - signature = Signature('Foo Ib????ez', 'f...@example.com', encoding='utf-8') - assert str(signature) == 'Foo Ib????ez <f...@example.com>' + signature = Signature('Foo Ib????ez', 'f...@bar.com', 1322174594, 60, encoding=encoding) + expected = f"pygit2.Signature('Foo Ib????ez', 'f...@bar.com', 1322174594, 60, '{encoding}')" + assert repr(signature) == expected + +def test_repr_from_commit(barerepo): + repo = barerepo + signature = Signature('Foo Ib????ez', 'f...@example.com', encoding=None) + tree = '967fce8df97cc71722d3c2a5930ef3e6f1d27b12' + parents = ['5fe808e8953c12735680c257f56600cb0de44b10'] + sha = repo.create_commit(None, signature, signature, 'New commit.', tree, parents) + commit = repo[sha] -def test_repr(): - signature = Signature( - 'Foo Ib????ez', 'f...@bar.com', 1322174594, 60, encoding='utf-8') - expected_signature = \ - "pygit2.Signature('Foo Ib????ez', 'f...@bar.com', 1322174594, 60, 'utf-8')" - assert repr(signature) == expected_signature + assert repr(signature) == repr(commit.author) + assert repr(signature) == repr(commit.committer) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pygit2-1.9.2/test/test_status.py new/pygit2-1.10.1/test/test_status.py --- old/pygit2-1.9.2/test/test_status.py 2021-09-17 13:25:20.019411800 +0200 +++ new/pygit2-1.10.1/test/test_status.py 2022-07-22 15:28:46.904039600 +0200 @@ -22,6 +22,8 @@ # along with this program; see the file COPYING. If not, write to # the Free Software Foundation, 51 Franklin Street, Fifth Floor, # Boston, MA 02110-1301, USA. +import pygit2 +import pytest def test_status(dirtyrepo): @@ -32,3 +34,49 @@ for filepath, status in git_status.items(): assert filepath in git_status assert status == git_status[filepath] + + +def test_status_untracked_no(dirtyrepo): + git_status = dirtyrepo.status(untracked_files="no") + not any(status & pygit2.GIT_STATUS_WT_NEW for status in git_status.values()) + + +@pytest.mark.parametrize( + "untracked_files,expected", + [ + ("no", set()), + ( + "normal", + { + "untracked_dir/", + "staged_delete_file_modified", + "subdir/new_file", + "new_file", + }, + ), + ( + "all", + { + "new_file", + "subdir/new_file", + "staged_delete_file_modified", + "untracked_dir/untracked_file", + }, + ), + ], +) +def test_status_untracked_normal(dirtyrepo, untracked_files, expected): + git_status = dirtyrepo.status(untracked_files=untracked_files) + assert { + file for file, status in git_status.items() if status & pygit2.GIT_STATUS_WT_NEW + } == expected + + +@pytest.mark.parametrize("ignored,expected", [(True, {"ignored"}), (False, set())]) +def test_status_ignored(dirtyrepo, ignored, expected): + git_status = dirtyrepo.status(ignored=ignored) + assert { + file + for file, status in git_status.items() + if status & pygit2.GIT_STATUS_IGNORED + } == expected