Skip to content

Commit 76a7f5b

Browse files
committed
codebase: don't use --depth 1 opton if the given alignment is not a tag
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
1 parent 00eec3d commit 76a7f5b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

codebase

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,15 +135,19 @@ git_clone()
135135
local odir=$2
136136
local tag=$3
137137

138+
local dopt="--depth 1"
139+
138140
local bopt
139-
if [[ -n "$tag" ]]; then
141+
if [[ "$tag" == "--full-depth" ]]; then
142+
dopt=
143+
elif [[ -n "$tag" ]]; then
140144
bopt="-b $tag"
141145
fi
142146

143-
git clone --depth 1 $bopt "${repo}" "${odir}" || ERROR 1 "failed to clone git repo: ${repo}"
147+
git clone $dopt $bopt "${repo}" "${odir}" || ERROR 1 "failed to clone git repo: ${repo}"
144148
(
145149
cd "${odir}"
146-
git submodule update --init --recursive --depth 1|| ERROR 1 "failed to update git submodule: ${repo}"
150+
git submodule update --init --recursive $dopt|| ERROR 1 "failed to update git submodule: ${repo}"
147151
)
148152
}
149153

@@ -252,7 +256,7 @@ cmd_clone_run()
252256
git_clone "${REPO}" "code/${odir}" "${ALIGNMENT}"
253257
else
254258
type "${VCS}"_clone > /dev/null 2>&1 || ERROR 1 "no such vcs handler: ${VCS}"
255-
"${VCS}"_clone "${REPO}" "code/${odir}" &&
259+
"${VCS}"_clone "${REPO}" "code/${odir}" --full-depth &&
256260
( cd "code/${odir}";
257261
"${VCS}"_checkout "${ALIGNMENT}"; )
258262
fi

0 commit comments

Comments
 (0)