Skip to content

Narrow scope of minimum version error messages #510

Open
@ParkerRobb

Description

@ParkerRobb

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:

# If we don't have fast-exoprt --reencode, we may also be missing
# diff-tree --combined-all-paths, which is even more important...
p = subproc.Popen('git diff-tree -h'.split(),
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
output = p.stdout.read()
if b'--combined-all-paths' not in output:
# We need a version of git-diff-tree with --combined-all-paths
raise SystemExit(_("Error: need git >= 2.22.0"))

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.

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