Skip to content

Commit 83d7353

Browse files
fix checkout on dirty repositories
Signed-off-by: Martin Theiss <[email protected]>
1 parent ed2c9f4 commit 83d7353

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

assets/deepen_shallow_clone_until_ref_is_found_then_check_out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ declare depth_from_ref=$((depth - 1))
2727
git_dir="$(git rev-parse --git-dir)"
2828
readonly git_dir
2929

30-
while ! git checkout -q "$ref~$depth_from_ref" &>/dev/null; do
30+
while ! git checkout -f -q "$ref~$depth_from_ref" &>/dev/null; do
3131
# once the depth of a shallow clone reaches the max depth of the origin
3232
# repo, Git silenty turns it into a deep clone
3333
if [ ! -e "$git_dir"/shallow ]; then
@@ -51,4 +51,4 @@ while ! git checkout -q "$ref~$depth_from_ref" &>/dev/null; do
5151
(( total_depth += depth ))
5252
done
5353

54-
git checkout -q "$ref"
54+
git checkout -f -q "$ref"

assets/in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ else
112112
echo "WARNING: couldn't find a ref for $ref listed on the remote"
113113
fi
114114
fi
115-
git checkout -q "$ref"
115+
git checkout -f -q "$ref"
116116
fi
117117

118118
invalid_key() {

0 commit comments

Comments
 (0)