mirror of
https://github.com/meineerde/redmine.git
synced 2026-04-04 15:01:38 +00:00
cleanup: rubocop: fix Layout/EmptyLineAfterGuardClause in lib/redmine/scm/adapters/git_adapter.rb
git-svn-id: http://svn.redmine.org/redmine/trunk@19200 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
68b4701a65
commit
6a1e4b86af
@ -76,12 +76,14 @@ module Redmine
|
|||||||
|
|
||||||
def branches
|
def branches
|
||||||
return @branches if @branches
|
return @branches if @branches
|
||||||
|
|
||||||
@branches = []
|
@branches = []
|
||||||
cmd_args = %w|branch --no-color --verbose --no-abbrev|
|
cmd_args = %w|branch --no-color --verbose --no-abbrev|
|
||||||
git_cmd(cmd_args) do |io|
|
git_cmd(cmd_args) do |io|
|
||||||
io.each_line do |line|
|
io.each_line do |line|
|
||||||
branch_rev = line.match('\s*(\*?)\s*(.*?)\s*([0-9a-f]{40}).*$')
|
branch_rev = line.match('\s*(\*?)\s*(.*?)\s*([0-9a-f]{40}).*$')
|
||||||
next unless branch_rev
|
next unless branch_rev
|
||||||
|
|
||||||
bran = GitBranch.new(scm_iconv('UTF-8', @path_encoding, branch_rev[2]))
|
bran = GitBranch.new(scm_iconv('UTF-8', @path_encoding, branch_rev[2]))
|
||||||
bran.revision = branch_rev[3]
|
bran.revision = branch_rev[3]
|
||||||
bran.scmid = branch_rev[3]
|
bran.scmid = branch_rev[3]
|
||||||
@ -96,6 +98,7 @@ module Redmine
|
|||||||
|
|
||||||
def tags
|
def tags
|
||||||
return @tags if @tags
|
return @tags if @tags
|
||||||
|
|
||||||
@tags = []
|
@tags = []
|
||||||
cmd_args = %w|tag|
|
cmd_args = %w|tag|
|
||||||
git_cmd(cmd_args) do |io|
|
git_cmd(cmd_args) do |io|
|
||||||
@ -109,8 +112,10 @@ module Redmine
|
|||||||
def default_branch
|
def default_branch
|
||||||
bras = self.branches
|
bras = self.branches
|
||||||
return unless bras
|
return unless bras
|
||||||
|
|
||||||
default_bras = bras.detect{|x| x.is_default == true}
|
default_bras = bras.detect{|x| x.is_default == true}
|
||||||
return default_bras.to_s if default_bras
|
return default_bras.to_s if default_bras
|
||||||
|
|
||||||
master_bras = bras.detect{|x| x.to_s == 'master'}
|
master_bras = bras.detect{|x| x.to_s == 'master'}
|
||||||
master_bras ? 'master' : bras.first.to_s
|
master_bras ? 'master' : bras.first.to_s
|
||||||
end
|
end
|
||||||
@ -177,6 +182,7 @@ module Redmine
|
|||||||
|
|
||||||
def lastrev(path, rev)
|
def lastrev(path, rev)
|
||||||
return nil if path.nil?
|
return nil if path.nil?
|
||||||
|
|
||||||
cmd_args = %w|log --no-color --encoding=UTF-8 --date=iso --pretty=fuller --no-merges -n 1|
|
cmd_args = %w|log --no-color --encoding=UTF-8 --date=iso --pretty=fuller --no-merges -n 1|
|
||||||
cmd_args << '--no-renames' if self.class.client_version_above?([2, 9])
|
cmd_args << '--no-renames' if self.class.client_version_above?([2, 9])
|
||||||
cmd_args << rev if rev
|
cmd_args << rev if rev
|
||||||
@ -369,6 +375,7 @@ module Redmine
|
|||||||
git_cmd(cmd_args) {|io| io.binmode; content = io.read}
|
git_cmd(cmd_args) {|io| io.binmode; content = io.read}
|
||||||
# git annotates binary files
|
# git annotates binary files
|
||||||
return nil if ScmData.binary?(content)
|
return nil if ScmData.binary?(content)
|
||||||
|
|
||||||
identifier = ''
|
identifier = ''
|
||||||
# git shows commit author on the first occurrence only
|
# git shows commit author on the first occurrence only
|
||||||
authors_by_commit = {}
|
authors_by_commit = {}
|
||||||
@ -437,6 +444,7 @@ module Redmine
|
|||||||
if $? && $?.exitstatus != 0
|
if $? && $?.exitstatus != 0
|
||||||
raise ScmCommandAborted, "git exited with non-zero status: #{$?.exitstatus}"
|
raise ScmCommandAborted, "git exited with non-zero status: #{$?.exitstatus}"
|
||||||
end
|
end
|
||||||
|
|
||||||
ret
|
ret
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user