make 'got status' ignore symlinks, for now
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
diff --git a/lib/worktree.c b/lib/worktree.c
index cd4a548..9a55298 100644
--- a/lib/worktree.c
+++ b/lib/worktree.c
@@ -1212,6 +1212,10 @@ status_new(void *arg, struct dirent *de, const char *parent_path)
if (de->d_type == DT_DIR)
return NULL;
+ /* XXX ignore symlinks for now */
+ if (de->d_type == DT_LNK)
+ return NULL;
+
if (parent_path[0]) {
if (asprintf(&path, "%s/%s", parent_path, de->d_name) == -1)
return got_error_from_errno();
diff --git a/regress/cmdline/status.sh b/regress/cmdline/status.sh
index e1df9d4..da1fdae 100755
--- a/regress/cmdline/status.sh
+++ b/regress/cmdline/status.sh
@@ -250,9 +250,40 @@ function test_status_unversioned_subdirs {
test_done "$testroot" "$ret"
}
+# 'got status' ignores symlinks at present; this might change eventually
+function test_status_ignores_symlink {
+ local testroot=`test_init status_ignores_symlink 1`
+
+ mkdir $testroot/repo/ramdisk/
+ touch $testroot/repo/ramdisk/Makefile
+ (cd $testroot/repo && git add .)
+ git_commit $testroot/repo -m "first commit"
+
+ got checkout $testroot/repo $testroot/wt > /dev/null
+ ret="$?"
+ if [ "$ret" != "0" ]; then
+ test_done "$testroot" "$ret"
+ return 1
+ fi
+
+ ln -s /usr/obj/distrib/i386/ramdisk $testroot/wt/ramdisk/obj
+
+ echo -n > $testroot/stdout.expected
+
+ (cd $testroot/wt && got status > $testroot/stdout)
+
+ cmp $testroot/stdout.expected $testroot/stdout
+ ret="$?"
+ if [ "$ret" != "0" ]; then
+ diff -u $testroot/stdout.expected $testroot/stdout
+ fi
+ test_done "$testroot" "$ret"
+}
+
run_test test_status_basic
run_test test_status_subdir_no_mods
run_test test_status_subdir_no_mods2
run_test test_status_obstructed
run_test test_status_shows_local_mods_after_update
run_test test_status_unversioned_subdirs
+run_test test_status_ignores_symlink