git-filter-repo/contrib/filter-repo-demos
Yufan Lou e1596776c9 Fix "Passed but got" error on CJK file names
filter-repo callback passes unicode filename as utf_8 bytes
but `git check-ignore` prints unicode filename as quoted octal escaped utf_8 bytes
failing the `name != pathname` check on CJK filenames
`.decode('unicode_escape')` decodes latin-1 bytes with escaped unicode
so it decodes the escaped bytes, but into a latin-1 str, therefore
`.encode('latin_1')` recovers the original bytes, which is utf_8
and is comparable to the filename passed by filter-repo callback

Signed-off-by: Yufan Lou <2263580+louy2@users.noreply.github.com>
2023-03-14 11:29:53 +00:00
..
barebones-example contrib: rename no-op-example to barebones-example 2020-06-23 19:59:39 -07:00
bfg-ish bfg-ish: add some sanity checks on the specified repo 2021-06-05 11:39:03 -07:00
clean-ignore Fix "Passed but got" error on CJK file names 2023-03-14 11:29:53 +00:00
convert-svnexternals contrib: new tool to convert svn:externals to Git submodules 2022-10-05 20:55:56 -07:00
filter-branch-ish contrib: new filter-repo demo named filter-lamely (or filter-branch-ish) 2019-08-20 23:58:47 -07:00
filter-lamely filter-lamely: fix a typo 2022-10-12 15:40:44 -07:00
insert-beginning contrib: clarify a few points of usage 2019-11-25 08:42:29 -08:00
lint-history lint-history: fix broken --refs option 2022-10-03 15:04:52 -07:00
README.md contrib: new tool to convert svn:externals to Git submodules 2022-10-05 20:55:56 -07:00
signed-off-by filter-repo: improve support for partial history rewrites 2019-10-17 18:55:09 -07:00

Background

filter-repo is not merely a history rewriting tool, it also contains a library that can be used to write new history rewriting tools. This directory contains several examples showing the breadth of different things that could be done.

Quick overview

Command                         Description
barebones-example Simple example with no modifications to filter-repo behavior, just showing what to import and run.
insert-beginning Add a new file (e.g. LICENSE/COPYING) to the beginning of history.
signed-off-by Add a Signed-off-by tag to a range of commits
lint-history Run some lint command on all non-binary files in history.
clean-ignore Delete files from history which match current gitignore rules.
filter-lamely (or filterbranchish) A nearly bug compatible re-implementation of filter-branch (the git testsuite passes using it instead of filter-branch), with some performance tricks to make it several times faster (though it's still glacially slow compared to filter-repo).
bfg-ish A re-implementation of most of BFG Repo Cleaner, with new features and bug fixes.
convert-svnexternals Insert Git submodules according to SVN externals.

Purpose

Please note that the point of these examples is not to provide new complete tools, but simply to demonstrate that extremely varied history rewriting tools can be created which automatically inherit lots of useful base functionality: rewriting hashes in commit messages, pruning commits that become empty, handling filenames with funny characters, non-standard encodings, handling of replace refs, etc. (Additional examples of using filter-repo as a library can also be found in the testsuite.) My sincerest hope is that these examples provide lots of useful functionality, but that each is missing at least one critical piece for your usecase. Go forth and extend and improve.

Usage

All the examples require a symlink to git-filter-repo in your PYTHONPATH named git_filter_repo.py in order to run; also, all have a --help flag to get a description of their usage and flags.