lib/gitlab_git/repository.rb in gitlab_git-10.3.0 vs lib/gitlab_git/repository.rb in gitlab_git-10.3.1
- old
+ new
@@ -851,23 +851,27 @@
# name: 'Test User',
# time: Time.now
# },
# commit: {
# message: 'Wow such commit',
- # branch: 'master'
+ # branch: 'master',
+ # update_ref: false
# }
def mkdir(path, options = {})
# Check if this directory exists; if it does, then don't bother
# adding .gitkeep file.
ref = options[:commit][:branch]
path = PathHelper.normalize_path(path).to_s
rugged_ref = rugged.ref(ref)
raise InvalidRef.new("Invalid ref") if rugged_ref.nil?
+
target_commit = rugged_ref.target
+
raise InvalidRef.new("Invalid target commit") if target_commit.nil?
entry = tree_entry(target_commit, path)
+
if entry
if entry[:type] == :blob
raise InvalidBlobName.new("Directory already exists as a file")
else
raise InvalidBlobName.new("Directory already exists")