Junio C Hamano <gitster@xxxxxxxxx> 于2022年6月27日周一 23:41写道: > > ZheNing Hu <adlternative@xxxxxxxxx> writes: > > > Oh, sorry, I mean if someone need some atoms from %(size) to %(flags), we can > > add them back. > > Ah, I see. I am not sure about the %(flags) to help the debugging > mode, but giving a single bit "is it dirty?" would be more useful > than giving the cached stat info, I would think. > diff --git a/builtin/ls-files.c b/builtin/ls-files.c index 061a205576..ccb3fd1676 100644 --- a/builtin/ls-files.c +++ b/builtin/ls-files.c @@ -296,6 +296,8 @@ static size_t expand_show_index(struct strbuf *sb, const char *start, write_eolattr_to_buf(sb, data->istate, data->pathname); else if (skip_prefix(start, "(path)", &p)) write_name_to_buf(sb, data->pathname); + else if (skip_prefix(start, "(updatetodate)", &p)) + strbuf_addstr(sb, ce_uptodate(data->ce) ? "true" : "false"); else die(_("bad ls-files format: %%%.*s"), (int)len, start); I try to use ce_uptodate(ce) to check its flags, but unfortunately, git ls-files --format="%(updatetodate)" output all files are "false" :( That's because we have not mark some flags in the cache entry, right? > Thanks. > ZheNing Hu