File git-tools.spec of Package git-tools
#
# spec file for package git-tools
#
# Copyright (c) 2025 SUSE LLC and contributors
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%if 0%{?sle_version} <= 150600 && 0%{?suse_version} && 0%{?suse_version} < 1600
%define pyver 311
%define pyver2 3.11
%else
%define pyver 3
%define pyver2 3
%endif
Name: git-tools
Version: 2025.08
Release: 0
Summary: Assorted git-related scripts and tools
License: GPL-3.0-or-later
Group: Development/Tools/Version Control
URL: https://github.com/MestreLion/git-tools
Source: https://github.com/MestreLion/git-tools/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
BuildRequires: gzip sed
BuildRequires: python-rpm-macros
Requires: python%{pyver}
Requires: git
Requires: awk diff sed
BuildArch: noarch
%description
Scripts to tweak git repositories, contains the following commands:
* git-branches-rename: Batch renames branches with a matching prefix to another prefix
* git-clone-subset: Clones a subset of a git repository
* git-find-uncommitted-repos: Recursively list repos with uncommitted changes
* git-rebase-theirs: Resolve rebase conflicts and failed cherry-picks by favoring 'theirs'
version
* git-restore-mtime: Restore original modification time of files based on the date of the most
recent commit that modified them
* git-strip-merge: A git-merge wrapper that deletes files on a "foreign" branch before merging
%prep
%autosetup -n %{name}-%{version}
%build
%install
for scrpt in git-branches-rename git-clone-subset git-find-uncommitted-repos \
git-rebase-theirs git-restore-mtime git-strip-merge; do
install -m 0755 -D $scrpt %{buildroot}%{_bindir}/$scrpt
sed -i -e '1 s|/usr/bin/env python3|/usr/bin/python%{pyver2}|' \
-e '1 s|/usr/bin/env bash|/bin/bash|' %{buildroot}%{_bindir}/$scrpt
install -m 0644 -D man1/$scrpt.1 %{buildroot}%{_mandir}/man1/$scrpt.1
gzip -9 %{buildroot}%{_mandir}/man1/$scrpt.1
done
%files
%license LICENSE.txt
%doc README.md
%{_bindir}/git-branches-rename
%{_bindir}/git-clone-subset
%{_bindir}/git-find-uncommitted-repos
%{_bindir}/git-rebase-theirs
%{_bindir}/git-restore-mtime
%{_bindir}/git-strip-merge
%{_mandir}/man1/git-branches-rename.1.gz
%{_mandir}/man1/git-clone-subset.1.gz
%{_mandir}/man1/git-find-uncommitted-repos.1.gz
%{_mandir}/man1/git-rebase-theirs.1.gz
%{_mandir}/man1/git-restore-mtime.1.gz
%{_mandir}/man1/git-strip-merge.1.gz
%changelog