[Koha-devel] Replace git-filter-branch with git-filter-repo

Julian Maurice julian.maurice at biblibre.com
Thu Jun 16 10:00:12 CEST 2022


Hi,

Just to add another way of doing it without installing a new tool:

I use `git rebase -x "git signoff" HEAD~<N>`
signoff is an alias to 'commit --amend -s --no-edit'

I didn't time it, but it always takes less than a second

So, to have the same 'so' alias:

so = "!f() { git rebase -x 'git commit --amend -s --no-edit' HEAD~$1; };f"

One of the benefit of this method is that you can re-run the same 
command twice, it will add the signoff line only once.

Le 16/06/2022 à 09:26, Jonathan Druart a écrit :
> Hi devs,
> 
> [I sent this on Aug 26th 2021 but it never reached the list!]
> 
> You may have seen the following warning when signing off on patches
> using the git alias
> 
> """
> WARNING: git-filter-branch has a glut of gotchas generating mangled
> history
>           rewrites.  Hit Ctrl-C before proceeding to abort, then use an
>           alternative filtering tool such as 'git filter-repo'
>           (https://github.com/newren/git-filter-repo/) instead.  See
> the
>           filter-branch manual page for more details; to squelch this
> warning,
>           set FILTER_BRANCH_SQUELCH_WARNING=1.
> Proceeding with filter-branch...
> """
> 
> And yes, it's very slow, `time git so 1` takes around 10 sec for me.
> 
> You can switch to git-filter-repo (https://github.com/newren/git-filter-repo).
> 
> First, install it (`pip3 install git-filter-repo` should do it,
> otherwise read their install doc
> https://github.com/newren/git-filter-repo/blob/main/INSTALL.md).
> 
> Then adjust the git alias (~/.gitconfig):
> 
>    so = "!f() { c=`expr $1 - 1`; git filter-repo --message-callback
> 'return message + b\"\\nSigned-off-by: Full Name <email>\"' --refs
> HEAD~$c^..; }; f"
> 
> I am using 'so' but you may use something else as it's not what is on the wiki.
> "Completely finished after 0.20 seconds."
> 
> Cheers,
> Jonathan
> _______________________________________________
> Koha-devel mailing list
> Koha-devel at lists.koha-community.org
> https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
> website : https://www.koha-community.org/
> git : https://git.koha-community.org/
> bugs : https://bugs.koha-community.org/

-- 
Julian Maurice
BibLibre


More information about the Koha-devel mailing list