Skip to content

Fix Repository#log when path is empty

Rémy Coutable requested to merge (removed):fix-invisible-empty-commit into master

When options[:path] == '', Repository#log would pass an empty path to the git log command (e.g. git --git-dir=/path/to/repo.git log -n 40 --format=%H --skip=0 sha -- ""), which was preventing empty commits from being returned (the empty path would only select commits that modified at least a file).

This is fixed by not passing any path to the git log command when path is blank (nil or empty string).

Important notes:

  • CI tests will fail until the test repo is updated with gitlab-git-test!5 (merged).
  • You can manually run the specs by temporarily modifying SeedHelper::GITLAB_URL to https://gitlab.com/rymai/gitlab-git-test.git.
  • This fix is necessary in order to fix gitlab-org/gitlab-ce#2316.

Merge request reports