summaryrefslogtreecommitdiff
path: root/update-submodule
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2020-02-19 11:46:35 +0100
committerErich Eckner <git@eckner.net>2020-02-19 11:46:35 +0100
commit8f4b488a86a974b7b1c723d219d894d5b78bad5f (patch)
tree58ab3d152f77e8122520482673f33fc39c53f34f /update-submodule
parent54eef2cff28c8fae3ad93e6f271d7eb15cd320a1 (diff)
downloadarchlinuxewe.git.save-8f4b488a86a974b7b1c723d219d894d5b78bad5f.tar.xz
update-submodule: archive should not contain git repos of submodules
Diffstat (limited to 'update-submodule')
-rwxr-xr-xupdate-submodule13
1 files changed, 11 insertions, 2 deletions
diff --git a/update-submodule b/update-submodule
index 101994cc..b47bd791 100755
--- a/update-submodule
+++ b/update-submodule
@@ -6,10 +6,18 @@ url="$3"
path="${url%% *}"
url="${url#${path} }"
-if [ -n "$(ls -A "${path}")" ]; then
+if [ -d "${path}" ] && [ -n "$(ls -A "${path}")" ]; then
git -C "${pkgSrcDir}" submodule update 2>/dev/null || true
exit
fi
+
+if [ ! -f "${path}" ]; then
+ >&2 echo 'update-submodule needs a commit'
+ exit 1
+fi
+
+commit=$(cat "${path}")
+rm "${path}"
mkdir -p "${path}"
if [ -d "${submoduleDir}" ]; then
upstream="${submoduleDir}/${path}"
@@ -20,4 +28,5 @@ else
upstream="${pkgSrcDir}/${path}"
fi
git -C "${upstream}" pull -q --ff-only
-git clone -q "${upstream}" "${path}"
+git -C "${upstream}" archive "${commit}" \
+| tar -C "${path}" -x