{"thread":{"id":"5503","subject":"[PATCH 0/3] Convert run_status to a builtin","startedAt":"2006-09-07T06:29:18Z","lastAt":"2006-09-07T06:35:42Z","messageCount":2,"participants":["Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"26482","messageId":"20060907062917.GA16969@coredump.intra.peff.net","threadId":"5503","inReplyTo":null,"subject":"[PATCH 0/3] Convert run_status to a builtin","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2006-09-07T06:29:18Z","receivedAt":"2006-09-07T06:29:18Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"This series of patches converts the run_status function from\ngit-commit.sh to a C builtin. Hopefully we can use this as a starting\npoint for further improvements (the only feature I added was\ncolorization).  I haven't had a chance to look closely at the\nsimultaneous traversal code in pu, but that would be the nice next place\nto take this concept.\n\nPatch 1/3 adds the necessary diff callback infrastructure, which may be\nof value regardless of whether the final patch is accepted.\n\nPatch 2/3 lib-ifies the diff color support so it can be reused by\nrun-status. Again, I think this is worth doing anyway from a code\ncleanup standpoint.\n\nPatch 3/3 does the actual conversion.\n\n-Peff\n"},{"id":"26484","messageId":"20060907063542.GA17083@coredump.intra.peff.net","threadId":"5503","inReplyTo":"20060907062917.GA16969@coredump.intra.peff.net","subject":"[PATCH 1/3] diff: support custom callbacks for output","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2006-09-07T06:35:42Z","receivedAt":"2006-09-07T06:35:42Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"Users can request the DIFF_FORMAT_CALLBACK output format to get a callback\nconsisting of the whole diff_queue_struct.\n---\n diff.c |    3 +++\n diff.h |    8 ++++++++\n 2 files changed, 11 insertions(+), 0 deletions(-)\n\ndiff --git a/diff.c b/diff.c\nindex 9dcbda3..a3ebc62 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -2587,6 +2587,9 @@ void diff_flush(struct diff_options *opt\n \t\t}\n \t}\n \n+\tif (output_format & DIFF_FORMAT_CALLBACK)\n+\t\toptions->format_callback(q, options, options->format_callback_data);\n+\n \tfor (i = 0; i < q->nr; i++)\n \t\tdiff_free_filepair(q->queue[i]);\n free_queue:\ndiff --git a/diff.h b/diff.h\nindex b007240..b60a02e 100644\n--- a/diff.h\n+++ b/diff.h\n@@ -8,6 +8,7 @@ #include \"tree-walk.h\"\n \n struct rev_info;\n struct diff_options;\n+struct diff_queue_struct;\n \n typedef void (*change_fn_t)(struct diff_options *options,\n \t\t unsigned old_mode, unsigned new_mode,\n@@ -20,6 +21,9 @@ typedef void (*add_remove_fn_t)(struct d\n \t\t    const unsigned char *sha1,\n \t\t    const char *base, const char *path);\n \n+typedef void (*diff_format_fn_t)(struct diff_queue_struct *q,\n+\t\tstruct diff_options *options, void *data);\n+\n #define DIFF_FORMAT_RAW\t\t0x0001\n #define DIFF_FORMAT_DIFFSTAT\t0x0002\n #define DIFF_FORMAT_SUMMARY\t0x0004\n@@ -35,6 +39,8 @@ #define DIFF_FORMAT_CHECKDIFF\t0x0040\n  */\n #define DIFF_FORMAT_NO_OUTPUT\t0x0080\n \n+#define DIFF_FORMAT_CALLBACK\t0x0100\n+\n struct diff_options {\n \tconst char *filter;\n \tconst char *orderfile;\n@@ -68,6 +74,8 @@ struct diff_options {\n \tint *pathlens;\n \tchange_fn_t change;\n \tadd_remove_fn_t add_remove;\n+\tdiff_format_fn_t format_callback;\n+\tvoid *format_callback_data;\n };\n \n enum color_diff {\n-- \n1.4.2.ge490e-dirty\n"}]}