diff options
| author | Douwe Maan <douwe@gitlab.com> | 2018-03-05 15:43:26 +0000 |
|---|---|---|
| committer | Douwe Maan <douwe@gitlab.com> | 2018-03-05 15:43:26 +0000 |
| commit | 0736197f63e787f81bf863787ed6ce12867752b0 (patch) | |
| tree | 0122d27f76074275b933071efa3ba3de5164dfdc /spec/support | |
| parent | 899967fbd86809b68e54d0dd07edf238443b52dd (diff) | |
| parent | a0a7b551ae117f481ec2d920d47ef55043119313 (diff) | |
| download | gitlab-ce-0736197f63e787f81bf863787ed6ce12867752b0.tar.gz | |
Merge branch 'gitaly-lfs-changes' into 'master'
Incorporate Gitaly's RPCs for Gitlab::Git::LfsChanges
Closes gitaly#1048
See merge request gitlab-org/gitlab-ce!16973
Diffstat (limited to 'spec/support')
| -rw-r--r-- | spec/support/bare_repo_operations.rb | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/spec/support/bare_repo_operations.rb b/spec/support/bare_repo_operations.rb index 38d11992dc2..8eeaa37d3c5 100644 --- a/spec/support/bare_repo_operations.rb +++ b/spec/support/bare_repo_operations.rb @@ -11,6 +11,14 @@ class BareRepoOperations @path_to_repo = path_to_repo end + def commit_tree(tree_id, msg, parent: EMPTY_TREE_ID) + commit_tree_args = ['commit-tree', tree_id, '-m', msg] + commit_tree_args += ['-p', parent] unless parent == EMPTY_TREE_ID + commit_id = execute(commit_tree_args) + + 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] || EMPTY_TREE_ID @@ -26,11 +34,9 @@ class BareRepoOperations tree_id = execute(['write-tree']) - commit_tree_args = ['commit-tree', tree_id[0], '-m', "Add #{dst_path}"] - commit_tree_args += ['-p', head_id] unless head_id == EMPTY_TREE_ID - commit_id = execute(commit_tree_args) + commit_id = commit_tree(tree_id[0], "Add #{dst_path}", parent: head_id) - execute(['update-ref', "refs/heads/#{branch}", commit_id[0]]) + execute(['update-ref', "refs/heads/#{branch}", commit_id]) end private |
