FAQ | This is a LIVE service | Changelog

fix(commitlint): behave gracefully if no common ancestor commit is found

In #83 (closed) it was highlighted that commitlint did not behave gracefully for MRs which do not branch from the current tip of the default branch. This was because, ultimately, git merge-base --fork-point exited with a non-zero exit code which caused the job to fail.

Gracefully handle this case by catching the exit status and falling back to checking all of the commit history.

Additionally, while git merge-base does appear to match the algorithm used by GitLab itself the use of --fork-point fails if the branch was not branched from the tip of default branch. Removing --fork-point better matches the algorithm used by GitLab itself.

Tested by making a trivial branch off an older commit and reproduced the reported commitlint behaviour (job log). Using the job from !124 (merged) fixes the issue (job log).

Closes #83 (closed)

Edited by Dr Rich Wareham

Merge request reports

Loading