Skip to content

Commit

Permalink
Make comments more consistent and clarify license
Browse files Browse the repository at this point in the history
This improves the consistency of top-of-module comments as follows:

- All names of the current file are removed. Some included these
  while others didn't. In general, this can be useful information,
  which can remind readers and developers of what the file is and
  may even reduce mistakes. However, in GitPython, many modules
  inside git/ have the same name as other modules in other
  subdirectories of git/. So the presence of filenames would
  often be the same for multiple files, a condition that would be
  intensified if consistency were achieved by adding them
  everywhere. This instead removes them, which should (albeit
  slightly) decrease the risk of confusing modules that have the
  same name as each other.

- All modules (.py files) inside git/ and test/, except for .py
  files that are entirely empty (without even comments) or are
  inside test/fixtures/, now have comments indicating the license
  and linking to it on opensource.org. Previously, some modules
  had this, while others did not.

The comment about the license is short, and does not contain an
explicit copyright statement. No new explicit copyright statements
are added, but some top-of-modules already contained them, and this
does not remove (nor update or otherwise modify) them.

Although explicit copyright statements are not touched, all the
license comments are modified, including where they had previously
appeared, to say "the 3-Clause BSD License" instead of
"the BSD License", since there is no specific license known as the
"BSD License" (and both the 2-clause and 3-clause BSD licenses are
very popular).

This change should not be confused with gitpython-developers#1662, which fixed an
originally correct hyperlink that had come to redirect to a page
about a different license. The change here does not change the link
again. It makes the commented wording more specific, so that it is
clear, even without looking at the link, which BSD license is being
referred to.
  • Loading branch information
EliahKagan committed Nov 3, 2023
1 parent 340da6d commit e87d3d7
Show file tree
Hide file tree
Showing 69 changed files with 167 additions and 119 deletions.
5 changes: 2 additions & 3 deletions git/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# __init__.py
# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: https://opensource.org/license/bsd-3-clause/
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

# flake8: noqa
# @PydevCodeAnalysisIgnore
Expand Down
5 changes: 2 additions & 3 deletions git/cmd.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# cmd.py
# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: https://opensource.org/license/bsd-3-clause/
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

from __future__ import annotations

Expand Down
5 changes: 2 additions & 3 deletions git/compat.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# compat.py
# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: https://opensource.org/license/bsd-3-clause/
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

"""Utilities to help provide compatibility with Python 3."""

Expand Down
5 changes: 2 additions & 3 deletions git/config.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# config.py
# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: https://opensource.org/license/bsd-3-clause/
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

"""Module containing module parser implementation able to properly read and write
configuration files."""
Expand Down
3 changes: 3 additions & 0 deletions git/db.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

"""Module with our own gitdb implementation - it uses the git command."""

from git.util import bin_to_hex, hex_to_bin
Expand Down
5 changes: 2 additions & 3 deletions git/diff.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# diff.py
# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: https://opensource.org/license/bsd-3-clause/
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

import re
from git.cmd import handle_process_output
Expand Down
5 changes: 2 additions & 3 deletions git/exc.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# exc.py
# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: https://opensource.org/license/bsd-3-clause/
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

"""Module containing all exceptions thrown throughout the git package."""

Expand Down
3 changes: 3 additions & 0 deletions git/index/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

"""Initialize the index package."""

# flake8: noqa
Expand Down
5 changes: 2 additions & 3 deletions git/index/base.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# base.py
# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: https://opensource.org/license/bsd-3-clause/
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

from contextlib import ExitStack
import datetime
Expand Down
3 changes: 3 additions & 0 deletions git/index/fun.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

# Standalone functions to accompany the index implementation and make it more versatile.
# NOTE: Autodoc hates it if this is a docstring.

Expand Down
3 changes: 3 additions & 0 deletions git/index/typ.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

"""Module with additional types used by the index."""

from binascii import b2a_hex
Expand Down
3 changes: 3 additions & 0 deletions git/index/util.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

"""Module containing index utilities."""

from functools import wraps
Expand Down
3 changes: 3 additions & 0 deletions git/objects/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

"""Import all submodules' main classes into the package space."""

# flake8: noqa
Expand Down
5 changes: 2 additions & 3 deletions git/objects/base.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# base.py
# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: https://opensource.org/license/bsd-3-clause/
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

from git.exc import WorkTreeRepositoryUnsupported
from git.util import LazyMixin, join_path_native, stream_copy, bin_to_hex
Expand Down
5 changes: 2 additions & 3 deletions git/objects/blob.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# blob.py
# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: https://opensource.org/license/bsd-3-clause/
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

from mimetypes import guess_type
from . import base
Expand Down
5 changes: 2 additions & 3 deletions git/objects/commit.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# commit.py
# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: https://opensource.org/license/bsd-3-clause/
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

import datetime
import re
Expand Down
3 changes: 3 additions & 0 deletions git/objects/fun.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

"""Module with functions which are supposed to be as fast as possible."""

from stat import S_ISDIR
Expand Down
3 changes: 3 additions & 0 deletions git/objects/submodule/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

# NOTE: Cannot import anything here as the top-level __init__ has to handle
# our dependencies.
3 changes: 3 additions & 0 deletions git/objects/submodule/base.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

from io import BytesIO
import logging
import os
Expand Down
3 changes: 3 additions & 0 deletions git/objects/submodule/root.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

from .base import Submodule, UpdateProgress
from .util import find_first_remote_branch
from git.exc import InvalidGitRepositoryError
Expand Down
3 changes: 3 additions & 0 deletions git/objects/submodule/util.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

import git
from git.exc import InvalidGitRepositoryError
from git.config import GitConfigParser
Expand Down
5 changes: 2 additions & 3 deletions git/objects/tag.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# tag.py
# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: https://opensource.org/license/bsd-3-clause/
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

"""Module containing all Object-based types."""

Expand Down
5 changes: 2 additions & 3 deletions git/objects/tree.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# tree.py
# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: https://opensource.org/license/bsd-3-clause/
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

from git.util import IterableList, join_path
import git.diff as git_diff
Expand Down
5 changes: 2 additions & 3 deletions git/objects/util.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# util.py
# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: https://opensource.org/license/bsd-3-clause/
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

"""Module for general utility functions."""

Expand Down
4 changes: 4 additions & 0 deletions git/refs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

# flake8: noqa
# Import all modules in order, fix the names they require.

from .symbolic import *
from .reference import *
from .head import *
Expand Down
3 changes: 3 additions & 0 deletions git/refs/head.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

from git.config import GitConfigParser, SectionConstraint
from git.util import join_path
from git.exc import GitCommandError
Expand Down
3 changes: 3 additions & 0 deletions git/refs/log.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

from mmap import mmap
import re
import time as _time
Expand Down
3 changes: 3 additions & 0 deletions git/refs/reference.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

from git.util import (
LazyMixin,
IterableObj,
Expand Down
3 changes: 3 additions & 0 deletions git/refs/remote.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

import os

from git.util import join_path
Expand Down
3 changes: 3 additions & 0 deletions git/refs/symbolic.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

from git.types import PathLike
import os

Expand Down
3 changes: 3 additions & 0 deletions git/refs/tag.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

from .reference import Reference

__all__ = ["TagReference", "Tag"]
Expand Down
5 changes: 2 additions & 3 deletions git/remote.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# remote.py
# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: https://opensource.org/license/bsd-3-clause/
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

"""Module implementing a remote object allowing easy access to git remotes."""

Expand Down
3 changes: 3 additions & 0 deletions git/repo/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

"""Initialize the Repo package."""

# flake8: noqa
Expand Down
5 changes: 2 additions & 3 deletions git/repo/base.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# base.py
# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: https://opensource.org/license/bsd-3-clause/
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

from __future__ import annotations

Expand Down
3 changes: 3 additions & 0 deletions git/repo/fun.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

"""Module with general repository-related functions."""

from __future__ import annotations
Expand Down
4 changes: 2 additions & 2 deletions git/types.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This module is part of GitPython and is released under
# the BSD License: https://opensource.org/license/bsd-3-clause/
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

# flake8: noqa

Expand Down
5 changes: 2 additions & 3 deletions git/util.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# util.py
# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: https://opensource.org/license/bsd-3-clause/
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

from abc import abstractmethod
import contextlib
Expand Down
5 changes: 2 additions & 3 deletions test/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# __init__.py
# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: https://opensource.org/license/bsd-3-clause/
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/
5 changes: 2 additions & 3 deletions test/lib/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# __init__.py
# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: https://opensource.org/license/bsd-3-clause/
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

# flake8: noqa
import inspect
Expand Down
5 changes: 2 additions & 3 deletions test/lib/helper.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# helper.py
# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: https://opensource.org/license/bsd-3-clause/
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

import contextlib
from functools import wraps
Expand Down
3 changes: 3 additions & 0 deletions test/performance/lib.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

"""Support library for tests."""

import logging
Expand Down
4 changes: 2 additions & 2 deletions test/performance/test_commit.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: https://opensource.org/license/bsd-3-clause/
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

"""Performance tests for commits (iteration, traversal, and serialization)."""

Expand Down
3 changes: 3 additions & 0 deletions test/performance/test_odb.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

"""Performance tests for object store."""

import sys
Expand Down
3 changes: 3 additions & 0 deletions test/performance/test_streams.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

"""Performance tests for data streaming."""

import os
Expand Down
5 changes: 2 additions & 3 deletions test/test_actor.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# test_actor.py
# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: https://opensource.org/license/bsd-3-clause/
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

from test.lib import TestBase
from git import Actor
Expand Down

0 comments on commit e87d3d7

Please sign in to comment.