Skip to content

Openening a file containing the name of a branch or tag throws a CommandException #929

@ziebelje

Description

@ziebelje

Error: request.CRITICAL: Uncaught PHP Exception GitList\SCM\Exception\CommandException: "/usr/bin/git show ia:D/js/component/triage.js" at /data/www/gitlist/src/SCM/System/Git/CommandLine.php line 320 {"exception":"[object] (GitList\\SCM\\Exception\\CommandException(code: 0): /usr/bin/git show ia:D/js/component/triage.js at /data/www/gitlist/src/SCM/System/Git/CommandLine.php:320)"} []

I have a repository that contains a branch named "ia". When browsing HEAD on GitList, I open the file "js/component/text.js". Among other things, GitList generates and executes the following command to get the contents of the file:

/usr/bin/git show HEAD:js/component/text.js

This works fine. I now try to open the file "js/component/triage.js". Among other things, GitList generates and executes the following command to get the contents of the file:

/usr/bin/git show ia:D/js/component/triage.js

Clearly this is wrong. I traced this down to the Repository/Commitish.php constructor. Specifically, it is changing $this->hash to the name of the rev (a branch named "ia" in this case) and ultimately getting set incorrectly.

I don't fully understand the purpose of this code, but reproduced this issue on several filenames containing the string "ia" in them. Confirmed that removing this branch fixed the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions