Skip to content

Orphaned branch without blobs gets redirected to /tree page when trying to open /commitspage

Summary

When an orphaned branch exists and also contains no blobs, trying to access its /-/commits/… page yields the "" did not exist on "…" message and a redirect to the equivalent /-/tree/… page.

Steps to reproduce & example project

See repro.sh script here.

What is the current bug behavior?

See summary above.

What is the expected correct behavior?

No such message should be displayed, because GitLab shouldn't try to load a particular blob, but simply the commits list of that branch.

Relevant logs and/or screenshots

Output of checks

This bug happens on GitLab.com

Results of GitLab environment info

Results of GitLab application Check

Possible fixes

In CommitsController#validate_path, we could take that special case of "no blobs/paths present" and/or "commits with --allow-empty" into account and only proceed to redirect_to_tree_root_for_missing_path if an actually non-existent path was attempted, instead of the /-/commits route.

Patch release information for backports

High-severity bug remediation

Edited by Katrin Leinweber