Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
O
OHR Support
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
97
Issues
97
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
OHR Support
Commits
611889f3
Commit
611889f3
authored
Dec 15, 2011
by
Holger Just
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[#748] Use SCM commands to detect the revision
parent
b2998c39
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
3 deletions
+10
-3
version.rb
lib/chili_project/version.rb
+8
-1
git_adapter.rb
lib/redmine/scm/adapters/git_adapter.rb
+2
-2
No files found.
lib/chili_project/version.rb
View file @
611889f3
...
@@ -38,7 +38,14 @@ module ChiliProject
...
@@ -38,7 +38,14 @@ module ChiliProject
end
end
def
self
.
revision
def
self
.
revision
`git --git-dir="
#{
Rails
.
root
.
join
(
'.git'
)
}
" rev-parse --short=9 HEAD`
.
chomp
if
File
.
directory?
Rails
.
root
.
join
(
'.git'
)
@revision
||=
begin
git
=
Redmine
::
Scm
::
Adapters
::
GitAdapter
git_dir
=
Rails
.
root
.
join
(
'.git'
)
if
File
.
directory?
git_dir
git
.
send
(
:shellout
,
"
#{
git
.
sq_bin
}
--git-dir='
#{
git_dir
}
' rev-parse --short=9 HEAD"
)
{
|
io
|
io
.
read
}.
to_s
.
chomp
end
end
end
end
REVISION
=
self
.
revision
REVISION
=
self
.
revision
...
...
lib/redmine/scm/adapters/git_adapter.rb
View file @
611889f3
...
@@ -19,10 +19,10 @@ module Redmine
...
@@ -19,10 +19,10 @@ module Redmine
module
Adapters
module
Adapters
class
GitAdapter
<
AbstractAdapter
class
GitAdapter
<
AbstractAdapter
SCM_GIT_REPORT_LAST_COMMIT
=
true
SCM_GIT_REPORT_LAST_COMMIT
=
true
unless
defined?
(
SCM_GIT_REPORT_LAST_COMMIT
)
# Git executable name
# Git executable name
GIT_BIN
=
Redmine
::
Configuration
[
'scm_git_command'
]
||
"git"
GIT_BIN
=
Redmine
::
Configuration
[
'scm_git_command'
]
||
"git"
unless
defined?
(
GIT_BIN
)
# raised if scm command exited with error, e.g. unknown revision.
# raised if scm command exited with error, e.g. unknown revision.
class
ScmCommandAborted
<
CommandFailed
;
end
class
ScmCommandAborted
<
CommandFailed
;
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment