From: Stefan Sperling Subject: -portable: fix tests failing due to ln(1) To: gameoftrees@openbsd.org Date: Sun, 19 Sep 2021 19:22:25 +0200 GNU ln uses -T instead of -h. Trivial fix below. Again, as with date(1) we can wrap these in a shell function later. ok? diff --git a/regress/cmdline/cherrypick.sh b/regress/cmdline/cherrypick.sh index fb48a56b..1208cc97 100755 --- a/regress/cmdline/cherrypick.sh +++ b/regress/cmdline/cherrypick.sh @@ -453,7 +453,7 @@ test_cherrypick_modified_symlinks() { got checkout -b foo $testroot/repo $testroot/wt > /dev/null (cd $testroot/repo && ln -sf beta alpha.link) - (cd $testroot/repo && ln -sfh gamma epsilon.link) + (cd $testroot/repo && ln -sfT gamma epsilon.link) (cd $testroot/repo && ln -sf ../gamma/delta epsilon/beta.link) (cd $testroot/repo && ln -sf .got/bar $testroot/repo/dotgotfoo.link) (cd $testroot/repo && git rm -q nonexistent.link) @@ -564,7 +564,7 @@ test_cherrypick_symlink_conflicts() { (cd $testroot/repo && ln -sf beta alpha.link) (cd $testroot/repo && ln -sf beta boo.link) - (cd $testroot/repo && ln -sfh gamma epsilon.link) + (cd $testroot/repo && ln -sfT gamma epsilon.link) (cd $testroot/repo && ln -sf ../gamma/delta epsilon/beta.link) echo 'this is regular file foo' > $testroot/repo/dotgotfoo.link (cd $testroot/repo && ln -sf .got/bar dotgotbar.link) @@ -581,9 +581,9 @@ test_cherrypick_symlink_conflicts() { # modified symlink to file A vs modified symlink to file B (cd $testroot/wt && ln -sf gamma/delta alpha.link) # modified symlink to dir A vs modified symlink to file B - (cd $testroot/wt && ln -sfh beta epsilon.link) + (cd $testroot/wt && ln -sfT beta epsilon.link) # modeified symlink to file A vs modified symlink to dir B - (cd $testroot/wt && ln -sfh ../gamma epsilon/beta.link) + (cd $testroot/wt && ln -sfT ../gamma epsilon/beta.link) # added regular file A vs added bad symlink to file A (cd $testroot/wt && ln -sf .got/bar dotgotfoo.link) (cd $testroot/wt && got add dotgotfoo.link > /dev/null) diff --git a/regress/cmdline/commit.sh b/regress/cmdline/commit.sh index 7ec03bec..22b98dd9 100755 --- a/regress/cmdline/commit.sh +++ b/regress/cmdline/commit.sh @@ -1188,7 +1188,7 @@ test_commit_symlink() { fi (cd $testroot/wt && ln -sf beta alpha.link) - (cd $testroot/wt && ln -sfh gamma epsilon.link) + (cd $testroot/wt && ln -sfT gamma epsilon.link) rm $testroot/wt/epsilon/beta.link echo "this is a regular file" > $testroot/wt/epsilon/beta.link (cd $testroot/wt && ln -sf .got/bar dotgotbar.link) @@ -1299,7 +1299,7 @@ test_commit_fix_bad_symlink() { fi # change "bad" symlink back into a "good" symlink - (cd $testroot/wt && ln -sfh alpha passwd.link) + (cd $testroot/wt && ln -sfT alpha passwd.link) (cd $testroot/wt && got commit -m 'fix bad symlink' \ > $testroot/stdout) diff --git a/regress/cmdline/diff.sh b/regress/cmdline/diff.sh index 5d259e7e..9987502c 100755 --- a/regress/cmdline/diff.sh +++ b/regress/cmdline/diff.sh @@ -384,7 +384,7 @@ test_diff_symlinks_in_work_tree() { fi (cd $testroot/wt && ln -sf beta alpha.link) - (cd $testroot/wt && ln -sfh gamma epsilon.link) + (cd $testroot/wt && ln -sfT gamma epsilon.link) (cd $testroot/wt && ln -sf ../gamma/delta epsilon/beta.link) echo -n '.got/bar' > $testroot/wt/dotgotfoo.link (cd $testroot/wt && got rm nonexistent.link > /dev/null) @@ -481,7 +481,7 @@ test_diff_symlinks_in_repo() { local commit_id1=`git_show_head $testroot/repo` (cd $testroot/repo && ln -sf beta alpha.link) - (cd $testroot/repo && ln -sfh gamma epsilon.link) + (cd $testroot/repo && ln -sfT gamma epsilon.link) (cd $testroot/repo && ln -sf ../gamma/delta epsilon/beta.link) (cd $testroot/repo && ln -sf .got/bar $testroot/repo/dotgotfoo.link) (cd $testroot/repo && git rm -q nonexistent.link) diff --git a/regress/cmdline/revert.sh b/regress/cmdline/revert.sh index 9766243d..f7324aa7 100755 --- a/regress/cmdline/revert.sh +++ b/regress/cmdline/revert.sh @@ -1071,11 +1071,11 @@ test_revert_symlink() { # symlink to file A now points to file B (cd $testroot/wt && ln -sf gamma/delta alpha.link) # symlink to a directory A now points to file B - (cd $testroot/wt && ln -sfh beta epsilon.link) + (cd $testroot/wt && ln -sfT beta epsilon.link) # "bad" symlink now contains a different target path echo "foo" > $testroot/wt/passwd.link # relative symlink to directory A now points to relative directory B - (cd $testroot/wt && ln -sfh ../gamma epsilon/beta.link) + (cd $testroot/wt && ln -sfT ../gamma epsilon/beta.link) # an unversioned symlink (cd $testroot/wt && ln -sf .got/foo dotgotfoo.link) # symlink to file A now points to non-existent file B @@ -1244,11 +1244,11 @@ test_revert_patch_symlink() { # symlink to file A now points to file B (cd $testroot/wt && ln -sf gamma/delta alpha.link) # symlink to a directory A now points to file B - (cd $testroot/wt && ln -sfh beta epsilon.link) + (cd $testroot/wt && ln -sfT beta epsilon.link) # "bad" symlink now contains a different target path echo "foo" > $testroot/wt/passwd.link # relative symlink to directory A now points to relative directory B - (cd $testroot/wt && ln -sfh ../gamma epsilon/beta.link) + (cd $testroot/wt && ln -sfT ../gamma epsilon/beta.link) # an unversioned symlink (cd $testroot/wt && ln -sf .got/foo dotgotfoo.link) # symlink to file A now points to non-existent file B diff --git a/regress/cmdline/stage.sh b/regress/cmdline/stage.sh index 8e7009b6..fa6a5ec7 100755 --- a/regress/cmdline/stage.sh +++ b/regress/cmdline/stage.sh @@ -2373,7 +2373,7 @@ test_stage_symlink() { fi (cd $testroot/wt && ln -sf beta alpha.link) - (cd $testroot/wt && ln -sfh gamma epsilon.link) + (cd $testroot/wt && ln -sfT gamma epsilon.link) (cd $testroot/wt && ln -sf ../gamma/delta epsilon/beta.link) echo 'this is regular file foo' > $testroot/wt/dotgotfoo.link (cd $testroot/wt && got add dotgotfoo.link > /dev/null) @@ -2685,7 +2685,7 @@ test_stage_patch_symlink() { fi (cd $testroot/wt && ln -sf beta alpha.link) - (cd $testroot/wt && ln -sfh gamma epsilon.link) + (cd $testroot/wt && ln -sfT gamma epsilon.link) (cd $testroot/wt && ln -sf ../gamma/delta epsilon/beta.link) echo 'this is regular file foo' > $testroot/wt/dotgotfoo.link (cd $testroot/wt && got add dotgotfoo.link > /dev/null) diff --git a/regress/cmdline/status.sh b/regress/cmdline/status.sh index de94a6e1..6be56860 100755 --- a/regress/cmdline/status.sh +++ b/regress/cmdline/status.sh @@ -291,7 +291,7 @@ test_status_symlink() { fi (cd $testroot/wt && ln -sf beta alpha.link) - (cd $testroot/wt && ln -sfh gamma epsilon.link) + (cd $testroot/wt && ln -sfT gamma epsilon.link) (cd $testroot/wt && ln -s /etc/passwd passwd.link) (cd $testroot/wt && ln -s ../beta epsilon/beta.link) diff --git a/regress/cmdline/unstage.sh b/regress/cmdline/unstage.sh index 05332522..3b3d58a2 100755 --- a/regress/cmdline/unstage.sh +++ b/regress/cmdline/unstage.sh @@ -973,7 +973,7 @@ test_unstage_symlink() { fi (cd $testroot/wt && ln -sf beta alpha.link) - (cd $testroot/wt && ln -sfh gamma epsilon.link) + (cd $testroot/wt && ln -sfT gamma epsilon.link) (cd $testroot/wt && ln -sf ../gamma/delta epsilon/beta.link) echo 'this is regular file foo' > $testroot/wt/dotgotfoo.link (cd $testroot/wt && got add dotgotfoo.link > /dev/null) @@ -1159,11 +1159,11 @@ test_unstage_patch_symlink() { # symlink to file A now points to file B (cd $testroot/wt && ln -sf gamma/delta alpha.link) # symlink to a directory A now points to file B - (cd $testroot/wt && ln -sfh beta epsilon.link) + (cd $testroot/wt && ln -sfT beta epsilon.link) # "bad" symlink now contains a different target path echo "foo" > $testroot/wt/passwd.link # relative symlink to directory A now points to relative directory B - (cd $testroot/wt && ln -sfh ../gamma epsilon/beta.link) + (cd $testroot/wt && ln -sfT ../gamma epsilon/beta.link) # an unversioned symlink (cd $testroot/wt && ln -sf .got/foo dotgotfoo.link) # symlink to file A now points to non-existent file B diff --git a/regress/cmdline/update.sh b/regress/cmdline/update.sh index cae60242..495406fd 100755 --- a/regress/cmdline/update.sh +++ b/regress/cmdline/update.sh @@ -2016,7 +2016,7 @@ test_update_symlink_conflicts() { fi (cd $testroot/repo && ln -sf beta alpha.link) - (cd $testroot/repo && ln -sfh gamma epsilon.link) + (cd $testroot/repo && ln -sfT gamma epsilon.link) (cd $testroot/repo && ln -sf ../gamma/delta epsilon/beta.link) echo 'this is regular file foo' > $testroot/repo/dotgotfoo.link (cd $testroot/repo && ln -sf .got/bar dotgotbar.link) @@ -2030,9 +2030,9 @@ test_update_symlink_conflicts() { # modified symlink to file A vs modified symlink to file B (cd $testroot/wt && ln -sf gamma/delta alpha.link) # modified symlink to dir A vs modified symlink to file B - (cd $testroot/wt && ln -sfh beta epsilon.link) + (cd $testroot/wt && ln -sfT beta epsilon.link) # modeified symlink to file A vs modified symlink to dir B - (cd $testroot/wt && ln -sfh ../gamma epsilon/beta.link) + (cd $testroot/wt && ln -sfT ../gamma epsilon/beta.link) # added regular file A vs added bad symlink to file A (cd $testroot/wt && ln -sf .got/bar dotgotfoo.link) (cd $testroot/wt && got add dotgotfoo.link > /dev/null)