{"thread":{"id":"17839","subject":"[PATCH] Fix neglect of diff_setup()/diff_setup_done() symmetry.","startedAt":"2009-02-17T02:59:00Z","lastAt":"2009-02-17T02:59:00Z","messageCount":1,"participants":["Keith Cascio"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"105067","messageId":"1234839540-3787-1-git-send-email-keith@cs.ucla.edu","threadId":"17839","inReplyTo":null,"subject":"[PATCH] Fix neglect of diff_setup()/diff_setup_done() symmetry.","fromName":"Keith Cascio","fromEmail":"keith@cs.ucla.edu","sentAt":"2009-02-17T02:59:00Z","receivedAt":"2009-02-17T02:59:00Z","isPatch":true,"sender":{"key":"keith@cs.ucla.edu","avatar":"https://gravatar.com/avatar/c5ec3a8f1cd1f449fdf8bdb7125fdbfd10b729507f32cbf0aa4ad07b4f7127ae?d=mp&s=160"},"body":"Code that calls diff_setup(), including via init_revisions(), should later call\ndiff_setup_done(), possibly via setup_revisions(). Failure to do so could cause\nerrors, especially in the future when we add responsibilities to\ndiff_setup_done(). This instance causes no known errors with the present code.\nBut it resulted in an error with an experimental patch.\n---\n builtin-checkout.c |    2 ++\n 1 files changed, 2 insertions(+), 0 deletions(-)\n\ndiff --git a/builtin-checkout.c b/builtin-checkout.c\nindex 20b34ce..c315f63 100644\n--- a/builtin-checkout.c\n+++ b/builtin-checkout.c\n@@ -291,14 +291,16 @@ static int checkout_paths(struct tree *source_tree, const char **pathspec,\n static void show_local_changes(struct object *head)\n {\n \tstruct rev_info rev;\n \t/* I think we want full paths, even if we're in a subdirectory. */\n \tinit_revisions(&rev, NULL);\n \trev.abbrev = 0;\n \trev.diffopt.output_format |= DIFF_FORMAT_NAME_STATUS;\n+\tif (diff_setup_done(&rev.diffopt) < 0)\n+\t\tdie(\"diff_setup_done failed\");\n \tadd_pending_object(&rev, head, NULL);\n \trun_diff_index(&rev, 0);\n }\n \n static void describe_detached_head(char *msg, struct commit *commit)\n {\n \tstruct strbuf sb = STRBUF_INIT;\n-- \n1.6.1\n"}]}