diff options
author | Valery Sizov <valery@gitlab.com> | 2019-03-28 13:05:03 +0200 |
---|---|---|
committer | Valery Sizov <valery@gitlab.com> | 2019-03-28 15:24:56 +0200 |
commit | cc2e849afd1a2b7c5c0ad1dcb5b675d072800b8b (patch) | |
tree | 426b52ebbccaf502ef43ee6723fe97191ea8f5c9 | |
parent | 04496085c1b83ccf5d9bfa546daf2a92e9c644e7 (diff) | |
download | gitlab-ce-10735-geo-gitlab-revision-can-return-not-consistent-results.tar.gz |
Use a fixed git abbrev parameter when we fetch a git revision10735-geo-gitlab-revision-can-return-not-consistent-results
-rw-r--r-- | changelogs/unreleased/10735-geo-gitlab-revision-can-return-not-consistent-results.yml | 5 | ||||
-rw-r--r-- | lib/gitlab.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab_spec.rb | 2 |
3 files changed, 7 insertions, 2 deletions
diff --git a/changelogs/unreleased/10735-geo-gitlab-revision-can-return-not-consistent-results.yml b/changelogs/unreleased/10735-geo-gitlab-revision-can-return-not-consistent-results.yml new file mode 100644 index 00000000000..2360295b022 --- /dev/null +++ b/changelogs/unreleased/10735-geo-gitlab-revision-can-return-not-consistent-results.yml @@ -0,0 +1,5 @@ +--- +title: Use a fixed git abbrev parameter when we fetch a git revision +merge_request: 26707 +author: +type: fixed diff --git a/lib/gitlab.rb b/lib/gitlab.rb index f42ca5a9cd6..1204e53ee2e 100644 --- a/lib/gitlab.rb +++ b/lib/gitlab.rb @@ -24,7 +24,7 @@ module Gitlab if File.exist?(root.join("REVISION")) File.read(root.join("REVISION")).strip.freeze else - result = Gitlab::Popen.popen_with_detail(%W[#{config.git.bin_path} log --pretty=format:%h -n 1]) + result = Gitlab::Popen.popen_with_detail(%W[#{config.git.bin_path} log --pretty=format:%h --abbrev=11 -n 1]) if result.status.success? result.stdout.chomp.freeze diff --git a/spec/lib/gitlab_spec.rb b/spec/lib/gitlab_spec.rb index 8232715d00e..767b5779a79 100644 --- a/spec/lib/gitlab_spec.rb +++ b/spec/lib/gitlab_spec.rb @@ -10,7 +10,7 @@ describe Gitlab do end describe '.revision' do - let(:cmd) { %W[#{described_class.config.git.bin_path} log --pretty=format:%h -n 1] } + let(:cmd) { %W[#{described_class.config.git.bin_path} log --pretty=format:%h --abbrev=11 -n 1] } around do |example| described_class.instance_variable_set(:@_revision, nil) |