newren / git-filter-repo

Quickly rewrite git repository history (filter-branch replacement)
Other
8.55k stars 708 forks source link

Callback that gives both filename and blob #549

Closed AlexeyDmitriev closed 1 week ago

AlexeyDmitriev commented 8 months ago

So, I'd like to minimize blobs depending on their type, i.e if file has specific extension, then do something with it, otherwise leave it as is.

it seems I can't, filename-callback allow only removing/renaming file and --blob-callback already loses information on filename

Maybe I can with commit-callback but it seems rather convoluted (and also I didn't quite get how all the fields work)

I would suggest making a --file-callback that will give a blob along with path in the repo. Maybe there's a better solution

newren commented 1 week ago

The new --file-info-callback added in commit 615720731589 (filter-repo: add a --file-info-callback, 2024-10-23) does exactly this. So I almost implemented your feature request, but I named the callback slightly differently.