@@ -260,6 +260,10 @@ eolattr::
that applies to the path.
path::
The pathname of the file which is recorded in the index.
+skipworktree::
+ Whether the file in the index has the SKIP_WORKTREE bit set.
+ See link:technical/sparse-checkout.txt[sparse-checkout]
+ for more information.
EXCLUDE PATTERNS
----------------
@@ -280,6 +280,9 @@ static size_t expand_show_index(struct strbuf *sb, const char *start,
data->pathname));
else if (skip_prefix(start, "(path)", &p))
write_name_to_buf(sb, data->pathname);
+ else if (skip_prefix(start, "(skipworktree)", &p))
+ strbuf_addstr(sb, ce_skip_worktree(data->ce) ?
+ "1" : "");
else
die(_("bad ls-files format: %%%.*s"), (int)len, start);
@@ -92,4 +92,20 @@ test_expect_success 'git ls-files --format with --debug' '
test_cmp expect actual
'
+test_expect_success 'git ls-files --format with skipworktree' '
+ test_when_finished "git sparse-checkout disable" &&
+ mkdir dir1 dir2 &&
+ echo "file1" >dir1/file1.txt &&
+ echo "file2" >dir2/file2.txt &&
+ git add dir1 dir2 &&
+ git commit -m skipworktree &&
+ git sparse-checkout set dir1 &&
+ git ls-files --format="%(skipworktree) %(path)" "dir*" >actual &&
+ cat >expect <<-\EOF &&
+ dir1/file1.txt
+ 1 dir2/file2.txt
+ EOF
+ test_cmp expect actual
+'
+
test_done