Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
f68212cc
Commit
f68212cc
authored
Oct 29, 2019
by
mimaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix file/directory name parameter for `git` command.
parent
34f68d01
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
6 deletions
+22
-6
lib/mruby/build/command.rb
lib/mruby/build/command.rb
+13
-5
lib/mruby/lockfile.rb
lib/mruby/lockfile.rb
+9
-1
No files found.
lib/mruby/build/command.rb
View file @
f68212cc
...
...
@@ -24,6 +24,14 @@ module MRuby
target
end
def
shellquote
(
s
)
if
ENV
[
'OS'
]
==
'Windows_NT'
"
\"
#{
s
}
\"
"
else
"
#{
s
}
"
end
end
NotFoundCommands
=
{}
private
...
...
@@ -278,9 +286,9 @@ module MRuby
@command
=
'git'
@flags
=
%w[]
@clone_options
=
"clone %{flags} %{url} %{dir}"
@pull_options
=
"--git-dir
'%{repo_dir}/.git' --work-tree '%{repo_dir}'
pull"
@checkout_options
=
"--git-dir
'%{repo_dir}/.git' --work-tree '%{repo_dir}'
checkout %{checksum_hash}"
@reset_options
=
"--git-dir
'%{repo_dir}/.git' --work-tree '%{repo_dir}'
reset %{checksum_hash}"
@pull_options
=
"--git-dir
#{
shellquote
(
"%{repo_dir}/.git"
)
}
--work-tree
#{
shellquote
(
"%{repo_dir}"
)
}
pull"
@checkout_options
=
"--git-dir
#{
shellquote
(
"%{repo_dir}/.git"
)
}
--work-tree
#{
shellquote
(
"%{repo_dir}"
)
}
checkout %{checksum_hash}"
@reset_options
=
"--git-dir
#{
shellquote
(
"%{repo_dir}/.git"
)
}
--work-tree
#{
shellquote
(
"%{repo_dir}"
)
}
reset %{checksum_hash}"
end
def
run_clone
(
dir
,
url
,
_flags
=
[])
...
...
@@ -304,11 +312,11 @@ module MRuby
end
def
commit_hash
(
dir
)
`
#{
@command
}
--git-dir
'
#{
dir
}
/.git' --work-tree '
#{
dir
}
'
rev-parse --verify HEAD`
.
strip
`
#{
@command
}
--git-dir
#{
shellquote
(
dir
+
'/.git'
)
}
--work-tree
#{
shellquote
(
dir
)
}
rev-parse --verify HEAD`
.
strip
end
def
current_branch
(
dir
)
`
#{
@command
}
--git-dir
'
#{
dir
}
/.git' --work-tree '
#{
dir
}
'
rev-parse --abbrev-ref HEAD`
.
strip
`
#{
@command
}
--git-dir
#{
shellquote
(
dir
+
'/.git'
)
}
--work-tree
#{
shellquote
(
dir
)
}
rev-parse --abbrev-ref HEAD`
.
strip
end
end
...
...
lib/mruby/lockfile.rb
View file @
f68212cc
...
...
@@ -54,6 +54,14 @@ module MRuby
end
end
def
shellquote
(
s
)
if
ENV
[
'OS'
]
==
'Windows_NT'
"
\"
#{
s
}
\"
"
else
"'
#{
s
}
'"
end
end
def
mruby
mruby
=
{
'version'
=>
MRuby
::
Source
::
MRUBY_VERSION
,
...
...
@@ -62,7 +70,7 @@ module MRuby
git_dir
=
"
#{
MRUBY_ROOT
}
/.git"
if
File
.
directory?
(
git_dir
)
mruby
[
'git_commit'
]
=
`git --git-dir
'
#{
git_dir
}
' --work-tree '
#{
MRUBY_ROOT
}
'
rev-parse --verify HEAD`
.
strip
mruby
[
'git_commit'
]
=
`git --git-dir
#{
shellquote
(
git_dir
)
}
--work-tree
#{
shellquote
(
MRUBY_ROOT
)
}
rev-parse --verify HEAD`
.
strip
end
mruby
...
...
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