Skip to content

Commit 7d9699e

Browse files
committed
added test for same SHA and filename
1 parent 21fce7f commit 7d9699e

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

test_e2e.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1491,6 +1491,40 @@ function e2e::sync_crash_no_worktree_cleanup_retry() {
14911491
assert_file_eq "$ROOT/link/file" "${FUNCNAME[0]}"
14921492
}
14931493

1494+
##############################################
1495+
# Test syncing if a file named for the SHA exists
1496+
##############################################
1497+
function e2e::sync_sha_shafile_exists() {
1498+
echo "${FUNCNAME[0]} 1" > "$REPO/file"
1499+
git -C "$REPO" commit -qam "${FUNCNAME[0]} 1"
1500+
SHA1=$(git -C "$REPO" rev-list -n1 HEAD)
1501+
echo "${FUNCNAME[0]} 2" > "$REPO/file"
1502+
git -C "$REPO" commit -qam "${FUNCNAME[0]} 2"
1503+
SHA2=$(git -C "$REPO" rev-list -n1 HEAD)
1504+
1505+
GIT_SYNC \
1506+
--one-time \
1507+
--repo="file://$REPO" \
1508+
--ref="$SHA1" \
1509+
--root="$ROOT" \
1510+
--link="link"
1511+
assert_link_exists "$ROOT/link"
1512+
assert_file_exists "$ROOT/link/file"
1513+
assert_file_eq "$ROOT/link/file" "${FUNCNAME[0]} 1"
1514+
1515+
touch "$ROOT/$SHA2"
1516+
1517+
GIT_SYNC \
1518+
--one-time \
1519+
--repo="file://$REPO" \
1520+
--ref="$SHA2" \
1521+
--root="$ROOT" \
1522+
--link="link"
1523+
assert_link_exists "$ROOT/link"
1524+
assert_file_exists "$ROOT/link/file"
1525+
assert_file_eq "$ROOT/link/file" "${FUNCNAME[0]} 2"
1526+
}
1527+
14941528
##############################################
14951529
# Test changing repos with storage intact
14961530
##############################################

0 commit comments

Comments
 (0)