Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Okstad <pokstad@gitlab.com>2019-11-21 18:50:59 +0300
committerPaul Okstad <pokstad@gitlab.com>2019-11-21 18:50:59 +0300
commit6329ea35fc2682718a26853c692fd6c32a8636e6 (patch)
tree611ec3be2f5c3463dc95ca6219d43f74ba657edd
parent337fb4cf1138bef0a2911513c35337f9e25d2b3b (diff)
parent90480e4af08882dfa908fada2974a2e8342f28ae (diff)
Merge branch 'jv-1421' into 'master'
UpdateRemoteMirror: fix default branch resolution Closes #1421 See merge request gitlab-org/gitaly!1641
-rw-r--r--changelogs/unreleased/jv-1421.yml5
-rw-r--r--internal/service/remote/update_remote_mirror_test.go5
-rw-r--r--ruby/lib/gitlab/git/repository.rb3
3 files changed, 12 insertions, 1 deletions
diff --git a/changelogs/unreleased/jv-1421.yml b/changelogs/unreleased/jv-1421.yml
new file mode 100644
index 000000000..1ba394715
--- /dev/null
+++ b/changelogs/unreleased/jv-1421.yml
@@ -0,0 +1,5 @@
+---
+title: 'UpdateRemoteMirror: fix default branch resolution'
+merge_request: 1641
+author:
+type: fixed
diff --git a/internal/service/remote/update_remote_mirror_test.go b/internal/service/remote/update_remote_mirror_test.go
index b1a64389e..cf6823c6f 100644
--- a/internal/service/remote/update_remote_mirror_test.go
+++ b/internal/service/remote/update_remote_mirror_test.go
@@ -43,6 +43,11 @@ func TestSuccessfulUpdateRemoteMirrorRequest(t *testing.T) {
{"branch", "-D", "not-merged-branch"}, // Delete branch
// Scoped to the project, so will be removed after
{"tag", "-d", "v0.0.1"}, // Delete tag
+
+ // Catch bug https://gitlab.com/gitlab-org/gitaly/issues/1421 (reliance
+ // on 'HEAD' as the default branch). By making HEAD point to something
+ // invalid, we ensure this gets handled correctly.
+ {"symbolic-ref", "HEAD", "refs/does/not/exist"},
}
for _, args := range setupCommands {
diff --git a/ruby/lib/gitlab/git/repository.rb b/ruby/lib/gitlab/git/repository.rb
index 8979153c4..73feb2e74 100644
--- a/ruby/lib/gitlab/git/repository.rb
+++ b/ruby/lib/gitlab/git/repository.rb
@@ -674,7 +674,8 @@ module Gitlab
nil
end
- def commit(ref = 'HEAD')
+ def commit(ref = nil)
+ ref ||= root_ref
Gitlab::Git::Commit.find(self, ref)
end