Skip to content

Fix confused behavior of creating and moving files overwriting directory

gitaly-git2go(wrapping libgit2) acts as a no-op when adding IndexEntry to index if the Path of IndexEntry is already a directory in index.

So when creating or moving files that overwrite an existing directory, CreateFile would do nothing and MoveFile would just delete the old file, which is rather weird.

This MR fixes this by adding and extra validation for directory existence.

Closes #3762 (closed)
Closes #3284 (closed)

Edited by Sami Hiltunen

Merge request reports