diff options
Diffstat (limited to 'spec/support/helpers/bare_repo_operations.rb')
-rw-r--r-- | spec/support/helpers/bare_repo_operations.rb | 20 |
1 files changed, 0 insertions, 20 deletions
diff --git a/spec/support/helpers/bare_repo_operations.rb b/spec/support/helpers/bare_repo_operations.rb index 98fa13db6c2..e29e12a15f6 100644 --- a/spec/support/helpers/bare_repo_operations.rb +++ b/spec/support/helpers/bare_repo_operations.rb @@ -17,26 +17,6 @@ class BareRepoOperations commit_id[0] end - # Based on https://stackoverflow.com/a/25556917/1856239 - def commit_file(file, dst_path, branch = 'master') - head_id = execute(['show', '--format=format:%H', '--no-patch', branch], allow_failure: true)[0] || Gitlab::Git::EMPTY_TREE_ID - - execute(['read-tree', '--empty']) - execute(['read-tree', head_id]) - - blob_id = execute(['hash-object', '--stdin', '-w']) do |stdin| - stdin.write(file.read) - end - - execute(['update-index', '--add', '--cacheinfo', '100644', blob_id[0], dst_path]) - - tree_id = execute(['write-tree']) - - commit_id = commit_tree(tree_id[0], "Add #{dst_path}", parent: head_id) - - execute(['update-ref', "refs/heads/#{branch}", commit_id]) - end - private def execute(args, allow_failure: false) |