git-filter-repo icon indicating copy to clipboard operation
git-filter-repo copied to clipboard

Narrow scope of minimum version error messages

Open ParkerRobb opened this issue 1 year ago • 0 comments

When trying to run git filter-repo on a repo, I kept getting an Error: need git >= 2.22.0 message, even though I have both git versions 2.37.1 and 2.41.0 installed on my system.

Initially I spent a long time trying to figure out if git-filter-repo was pointing to an old version of git (2.10.0) I had recently uninstalled, or something like that.

After tracking the error message to line 2092 of the Python script, I was able to figure out that prior lines were looking for certain things in the output of git diff-tree -h: https://github.com/newren/git-filter-repo/blob/4bc9022afce5e2e138596bbecf4df310212ae164/git-filter-repo#L2085-L2092

I ran git diff-tree -h on my repo and found that I get error messages from git itself because something's wrong with my repo.

My point is that the canned error message thrown by git-filter-repo was hiding the real problem (that git itself was throwing errors when trying to operate on my repo) and opaquely telling me things that weren't true (that I had the wrong git version installed). The opaqueness of git-filter-repo's error message misdirected me and caused me to spend way longer than necessary trying to fix the problem. Narrowing the scope of and clarifying the error messages thrown by git-filter-repo would prevent people from going on a wild goose chase and spending hours trying to fix problems that do not actually exist.

ParkerRobb avatar Oct 09 '23 21:10 ParkerRobb