Skip to content

Commit 8e06f27

Browse files
authored
Merge pull request #99 from github/kpaulisse-git-submodule-example
Add example git submodule script
2 parents ffe6de7 + 31bf31d commit 8e06f27

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# git submodules
2+
3+
See https://github.com/github/octocatalog-diff/issues/88 for context.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
# This script is called from lib/octocatalog-diff/catalog-util/git.rb and is used to
4+
# archive and extract a certain branch of a git repository into a target directory.
5+
6+
if [ -z "$OCD_GIT_EXTRACT_BRANCH" ]; then
7+
echo "Error: Must declare OCD_GIT_EXTRACT_BRANCH"
8+
exit 255
9+
fi
10+
11+
if [ -z "$OCD_GIT_EXTRACT_TARGET" ]; then
12+
echo "Error: Must declare OCD_GIT_EXTRACT_TARGET"
13+
exit 255
14+
fi
15+
16+
set -euf -o pipefail
17+
git clone --single-branch -b "$OCD_GIT_EXTRACT_BRANCH" . "$OCD_GIT_EXTRACT_TARGET"
18+
( cd "$OCD_GIT_EXTRACT_TARGET" && git submodule init && git submodule sync && git submodule update )

0 commit comments

Comments
 (0)