Commit Diff


commit - f7fce2e256045540640f55a619a55eea6ec859fa
commit + a84c0d302fea1f440dfc5b1e70dac59cc50e31f9
blob - 0b4571401cfdddef043be11cce960c58beae2802
blob + 26ce9d0c775728d7d4b6a3450c3704c51f29672a
--- lib/worktree.c
+++ lib/worktree.c
@@ -3645,6 +3645,7 @@ worktree_status(struct got_worktree *worktree, const c
 	struct diff_dir_cb_arg arg;
 	char *ondisk_path = NULL;
 	struct got_pathlist_head ignores;
+	struct got_fileindex_entry *ie;
 
 	TAILQ_INIT(&ignores);
 
@@ -3652,6 +3653,14 @@ worktree_status(struct got_worktree *worktree, const c
 	    worktree->root_path, path[0] ? "/" : "", path) == -1)
 		return got_error_from_errno("asprintf");
 
+	ie = got_fileindex_entry_get(fileindex, path, strlen(path));
+	if (ie) {
+		err = report_single_file_status(path, ondisk_path,
+		    fileindex, status_cb, status_arg, repo,
+		    report_unchanged, &ignores, no_ignores);
+		goto done;
+	}
+
 	fd = open(ondisk_path, O_RDONLY | O_NOFOLLOW | O_DIRECTORY | O_CLOEXEC);
 	if (fd == -1) {
 		if (errno != ENOTDIR && errno != ENOENT && errno != EACCES &&
blob - 9e581724fe4e03c1b4d098200691d364a658da87
blob + f96cb55c8433319268b0b22d1615907b94f37ce7
--- regress/cmdline/status.sh
+++ regress/cmdline/status.sh
@@ -147,6 +147,16 @@ test_status_obstructed() {
 	echo '~  epsilon/zeta' > $testroot/stdout.expected
 
 	(cd $testroot/wt && got status > $testroot/stdout)
+
+	cmp -s $testroot/stdout.expected $testroot/stdout
+	ret="$?"
+	if [ "$ret" != "0" ]; then
+		diff -u $testroot/stdout.expected $testroot/stdout
+		test_done "$testroot" "$ret"
+		return 1
+	fi
+
+	(cd $testroot/wt && got status epsilon/zeta > $testroot/stdout)
 
 	cmp -s $testroot/stdout.expected $testroot/stdout
 	ret="$?"