Skip to content

Commit c2567e6

Browse files
authored
Merge pull request #159 from wangnuannuan/jingru-submodule
submodules: shallow submodules
2 parents 6044076 + 0c325fe commit c2567e6

File tree

2 files changed

+7
-18
lines changed

2 files changed

+7
-18
lines changed

.gitmodules

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
[submodule "os/freertos"]
22
path = os/freertos
33
url = https://github.com/FreeRTOS/FreeRTOS-Kernel.git
4+
shallow = true

middleware/mbedtls/apply_embARC_patch.sh

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -51,24 +51,12 @@ fi
5151
echo "Clone repo from ${REPO_LINK} at commit or tag ${REPO_COMMIT}"
5252
git init .
5353
git remote add origin ${REPO_LINK}
54-
git fetch origin -t
55-
git_branch=($(git branch -a|grep 'remotes'|sed -e 's/^[[:space:]]*remotes\///'))
56-
if [ "x${git_branch[0]}" == "x" ] ; then
57-
echo "Fetch tag failed, just fetch all the source code"
58-
git fetch origin
59-
git_branch=($(git branch -a|grep 'remotes'|sed -e 's/^[[:space:]]*remotes\///'))
60-
fi
61-
if [ "x${git_branch[0]}" == "x" ] ; then
62-
echo "No branch found in the remote repo, patch failed"
63-
rm -rf .git
64-
exit_proc 1
65-
fi
66-
git checkout -b master ${git_branch[0]}
67-
git log --pretty -1 ${REPO_COMMIT}
68-
if [[ ! $? -eq 0 ]] ; then
69-
echo "No commit related to ${REPO_COMMIT}, try to fetch more from remote"
70-
git fetch --depth 3000
71-
fi
54+
git fetch --depth 1 origin refs/tags/${REPO_COMMIT}:refs/tags/${REPO_COMMIT} || {
55+
echo "Fetch tag failed, try default branch"
56+
default_branch=$(git remote show ${REPO_LINK} | sed -n "s/^.*HEAD branch: \(.*\)$/\1/p")
57+
git fetch origin ${default_branch}
58+
}
59+
7260
git checkout -b embARC ${REPO_COMMIT}
7361
echo "Try to apply patch for this repo"
7462
git am *.patch

0 commit comments

Comments
 (0)