Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
6d994969
Commit
6d994969
authored
Jun 30, 2013
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3292 from sfromm/git-submodule
Add submodule support to git module
parents
f3dc5707
76d84833
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
2 deletions
+17
-2
library/source_control/git
+17
-2
No files found.
library/source_control/git
View file @
6d994969
...
...
@@ -107,7 +107,7 @@ def clone(git_path, module, repo, dest, remote, depth):
except
:
pass
os
.
chdir
(
dest_dirname
)
cmd
=
[
git_path
,
'clone'
,
'-o'
,
remote
]
cmd
=
[
git_path
,
'clone'
,
'-o'
,
remote
,
'--recursive'
]
if
depth
:
cmd
.
extend
([
'--depth'
,
str
(
depth
)
])
cmd
.
extend
([
repo
,
dest
])
...
...
@@ -237,7 +237,22 @@ def fetch(git_path, module, repo, dest, version, remote):
(
rc
,
out2
,
err2
)
=
module
.
run_command
(
"
%
s fetch --tags
%
s"
%
(
git_path
,
remote
))
if
rc
!=
0
:
module
.
fail_json
(
msg
=
"Failed to download remote objects and refs"
)
return
(
rc
,
out1
+
out2
,
err1
+
err2
)
(
rc
,
out3
,
err3
)
=
submodule_update
(
git_path
,
module
,
repo
,
dest
)
return
(
rc
,
out1
+
out2
+
out3
,
err1
+
err2
+
err3
)
def
submodule_update
(
git_path
,
module
,
repo
,
dest
):
''' init and update any submodules '''
os
.
chdir
(
dest
)
# skip submodule commands if .gitmodules is not present
if
not
os
.
path
.
exists
(
os
.
path
.
join
(
dest
,
'.gitmodules'
)):
return
(
0
,
''
,
''
)
cmd
=
[
git_path
,
'submodule'
,
'sync'
]
(
rc
,
out
,
err
)
=
module
.
run_command
(
cmd
,
check_rc
=
True
)
cmd
=
[
git_path
,
'submodule'
,
'update'
,
'--init'
,
'--recursive'
]
(
rc
,
out
,
err
)
=
module
.
run_command
(
cmd
)
if
rc
!=
0
:
module
.
fail_json
(
msg
=
"Failed to init/update submodules"
)
return
(
rc
,
out
,
err
)
def
switch_version
(
git_path
,
module
,
dest
,
remote
,
version
):
''' once pulled, switch to a particular SHA, tag, or branch '''
...
...
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