Commit Diff


commit - bf96b38c46b379b2b7152ad0fea31e5c7010667e
commit + 0dbc22715b295b0b4fd65dfdc2ea1cd9c16083a7
blob - 374ed5e84b7472ab124872d9e03621f6e9df94da
blob + 4918b9815d97ab43818a60e09a23c8b86ee2b46c
--- got/got.1
+++ got/got.1
@@ -115,6 +115,7 @@ using the following status codes:
 .Bl -column YXZ description
 .It M Ta modified file
 .It ! Ta versioned file was expected on disk but is missing
+.It ~ Ta versioned file is obstructed by a non-regular file
 .It ? Ta unversioned item not tracked by
 .Nm
 .El
blob - 58867aeefb5aa093575f36499d23069e9b3225aa
blob + 879b57cd0208cf79072ecdeb708d1ac92b8acef4
--- include/got_worktree.h
+++ include/got_worktree.h
@@ -25,6 +25,7 @@ struct got_worktree;
 #define GOT_STATUS_MODIFIY	'M'
 #define GOT_STATUS_MISSING	'!'
 #define GOT_STATUS_UNVERSIONED	'?'
+#define GOT_STATUS_OBSTRUCTED	'~'
 
 /*
  * Attempt to initialize a new work tree on disk.
blob - 6f599b37e0cabf93027c510b787ac569c4c0beaa
blob + 063b75f59617e22294410e617be93d20187bab57
--- lib/worktree.c
+++ lib/worktree.c
@@ -936,8 +936,10 @@ get_file_status(unsigned char *status, struct got_file
 	if (lstat(abspath, &sb) == -1)
 		return got_error_from_errno();
 
-	if (!S_ISREG(sb.st_mode))
+	if (!S_ISREG(sb.st_mode)) {
+		*status = GOT_STATUS_OBSTRUCTED;
 		return NULL;
+	}
 
 	if (ie->ctime_sec == sb.st_ctime &&
 	    ie->ctime_nsec == sb.st_ctimensec &&
blob - 787e05f69344a61688a6493bbc4e89b9ecea0096
blob + d6d36bcc7878ddddaba818d1e6e754ba3c3f787d
--- regress/cmdline/status.sh
+++ regress/cmdline/status.sh
@@ -125,6 +125,33 @@ function test_status_subdir_no_mods2 {
 	test_done "$testroot" "0"
 }
 
+function test_status_obstructed {
+	local testroot=`test_init status_obstructed`
+
+	got checkout $testroot/repo $testroot/wt > /dev/null
+	if [ "$?" != "0" ]; then
+		test_done "$testroot" "$?"
+		return 1
+	fi
+
+	rm $testroot/wt/epsilon/zeta
+	mkdir $testroot/wt/epsilon/zeta
+
+	echo '~  epsilon/zeta' > $testroot/stdout.expected
+
+	(cd $testroot/wt && got status > $testroot/stdout)
+
+	cmp $testroot/stdout.expected $testroot/stdout
+	if [ "$?" != "0" ]; then
+		diff -u $testroot/stdout.expected $testroot/stdout
+		test_done "$testroot" "$?"
+		return 1
+	fi
+
+	test_done "$testroot" "0"
+}
+
 run_test test_status_basic
 run_test test_status_subdir_no_mods
 run_test test_status_subdir_no_mods2
+run_test test_status_obstructed