{"thread":{"id":"24585","subject":"[PATCH] ls-files: learn a debugging dump format","startedAt":"2010-07-30T22:35:59Z","lastAt":"2010-07-30T22:35:59Z","messageCount":1,"participants":["Thomas Rast"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"146803","messageId":"0792cec2ca5e15ef34375eadc4007203db93d9e6.1280529198.git.trast@student.ethz.ch","threadId":"24585","inReplyTo":null,"subject":"[PATCH] ls-files: learn a debugging dump format","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2010-07-30T22:35:59Z","receivedAt":"2010-07-30T22:35:59Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Teach git-ls-files a new option --debug that just tacks all available\ndata from the cache onto each file's line.\n\nSigned-off-by: Thomas Rast <trast@student.ethz.ch>\n---\n\nI made this while trying to find a pattern in the failures of t0025.\nUnless I missed something, there's really no other way to get at this\ndata, so it might be a useful feature in general.\n\n\n Documentation/git-ls-files.txt |    6 ++++++\n builtin/ls-files.c             |    9 +++++++++\n 2 files changed, 15 insertions(+), 0 deletions(-)\n\ndiff --git a/Documentation/git-ls-files.txt b/Documentation/git-ls-files.txt\nindex 3521637..235cae7 100644\n--- a/Documentation/git-ls-files.txt\n+++ b/Documentation/git-ls-files.txt\n@@ -132,6 +132,12 @@ OPTIONS\n \tlines, show only a partial prefix.\n \tNon default number of digits can be specified with --abbrev=<n>.\n \n+--debug::\n+\tAfter each line that describes a file, add more data about its\n+\tcache entry.  This is intended to show as much information as\n+\tpossible for manual inspection; the exact format may change at\n+\tany time.\n+\n \\--::\n \tDo not interpret any more arguments as options.\n \ndiff --git a/builtin/ls-files.c b/builtin/ls-files.c\nindex 1b9b8a8..cc202c5 100644\n--- a/builtin/ls-files.c\n+++ b/builtin/ls-files.c\n@@ -25,6 +25,7 @@\n static int show_killed;\n static int show_valid_bit;\n static int line_terminator = '\\n';\n+static int debug_mode;\n \n static const char *prefix;\n static int max_prefix_len;\n@@ -162,6 +163,13 @@ static void show_ce_entry(const char *tag, struct cache_entry *ce)\n \t\t       ce_stage(ce));\n \t}\n \twrite_name(ce->name, ce_namelen(ce));\n+\tif (debug_mode) {\n+\t\tprintf(\"  ctime: %d:%d\\n\", ce->ce_ctime.sec, ce->ce_ctime.nsec);\n+\t\tprintf(\"  mtime: %d:%d\\n\", ce->ce_mtime.sec, ce->ce_mtime.nsec);\n+\t\tprintf(\"  dev: %d\\tino: %d\\n\", ce->ce_dev, ce->ce_ino);\n+\t\tprintf(\"  uid: %d\\tgid: %d\\n\", ce->ce_uid, ce->ce_gid);\n+\t\tprintf(\"  size: %d\\tflags: %x\\n\", ce->ce_size, ce->ce_flags);\n+\t}\n }\n \n static int show_one_ru(struct string_list_item *item, void *cbdata)\n@@ -519,6 +527,7 @@ int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix)\n \t\tOPT_STRING(0, \"with-tree\", &with_tree, \"tree-ish\",\n \t\t\t\"pretend that paths removed since <tree-ish> are still present\"),\n \t\tOPT__ABBREV(&abbrev),\n+\t\tOPT_BOOLEAN(0, \"debug\", &debug_mode, \"show debugging data\"),\n \t\tOPT_END()\n \t};\n \n-- \n1.7.2.1.342.g676a4\n"}]}