In a subsequent commit I'll optionally change the mode in a new sparse
mode, let's do this first to make that change smaller.
Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
builtin/ls-files.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/builtin/ls-files.c b/builtin/ls-files.c
index eb72d16493..4db75351f2 100644
--- a/builtin/ls-files.c
+++ b/builtin/ls-files.c
@@ -242,9 +242,17 @@ static void show_ce(struct repository *repo, struct dir_struct *dir,
if (!show_stage) {
fputs(tag, stdout);
} else {
+ unsigned int mode = ce->ce_mode;
+ if (show_sparse && S_ISSPARSEDIR(mode))
+ /*
+ * We could just do & 0177777 all the
+ * time, just make it clear this is
+ * for --stage-sparse.
+ */
+ mode &= 0177777;
printf("%s%06o %s %d\t",
tag,
- ce->ce_mode,
+ mode,
find_unique_abbrev(&ce->oid, abbrev),
ce_stage(ce));
}--
2.31.0.260.g719c683c1d