Job to check_links is broken ("fatal: bad revision")

Problem to solve

The check_links job is currently broken - it results in "fatal: bad revision".

More details

The check_links job is in the test stage of a pipeline for a documentation MR. It is triggered manually.

Currently the job results in:

 $ git diff --numstat origin/master..$CI_COMMIT_REF_NAME -- | awk '/(.+\.md)|(.+\.haml)/ { print $3 }' > new_files
 fatal: bad revision 'origin/master..djensen-fix-value-stream-analytics-link'

(where the latter part of the revision is the branch name)

Examples of this error:

This bug report was prompted by discussion in !45773 (merged).

Note: The git fetch is predictably slow because there are over 6,000 branches. That slowness doesn't seem to be related to the error, which occurs later.

Possible fixes

Fetch differently, to ensure the source branch is available?

Edited by Dan Jensen