Skip to content

Tool is completely broken & useless or just a really bad documentation? #679

@isbm

Description

@isbm

Version: 2.47.0 (pip install into venv)
OS: Ubuntu 22.04.5 LTS
Python 3.10.12
git version 2.34.1

file: callback.py

def commit_callback(c):
    with open("bananas.txt", "a") as f:
        f.write("BANANA!\n")
  1. git clone --mirror ...
  2. git filter-repo --commit-callback ./callback.py --force

Output:

Parsed 837 commits
New history written in 0.01 seconds; now repacking/cleaning...
Repacking your repo and cleaning out old unneeded objects

[...]

Completely finished after 0.06 seconds.

But no "bananas.txt" at all. If I just do this:

def commit_callback(c):
    raise "AAAA!"

Still the same "clean" output: parsed NNN commits etc. OK, let's do exactly as documentation says:

git filter-repo --commit-callback 'raise Exception("banana")'                                                  

Traceback (most recent call last):

[...]

    self._commit_callback(commit, self.callback_metadata(aux_info))
  File "<string>", line 2, in callback
Exception: banana

OK, we're getting somewhere. How about this:

git filter-repo --commit-callback 'def commit_callback(c): open("bananas.txt", "a").write("BANANA!\n")' --force

Parsed 837 commits
New history written in 0.01 seconds; now repacking/cleaning...
Repacking your repo and cleaning out old unneeded objects

[...]

Completely finished after 0.06 seconds.

OK, I give up, this just makes zero sense to me.

  • What I am doing wrong?
  • Why this tool crashes/ignores silently and doesn't say anything with regard of given python script?
  • How to define commit_callback so I can change the commit data (can't find doc, BTW)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions