Create a blank object alternative to `Gitlab::Git::Compare` (e.g. `Gitlab::Git::NilCompare`)
The following discussion from !24038 (merged) should be addressed:
-
@stanhu started a discussion: (+3 comments) Note that the behavior between a non-existent source branch within the project is slightly different than a non-existent source branch within a forked project (e.g. empty commits vs
nil
value). Should we make that consistent?
That's something that can be applied in many places at GitLab codebase.
Consider a scenario we know the object will return empty results (e.g. compare.commits == []
). But for that, it would make extra calls to Gitaly, therefore confirming what we already know and could return a ducktype instead (e.g. Gitlab::Git::NilCompare
for instance).
Edited by Oswaldo Ferreira