[PATCH] Fix neglect of diff_setup()/diff_setup_done() symmetry.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Code that calls diff_setup(), including via init_revisions(), should later call
diff_setup_done(), possibly via setup_revisions(). Failure to do so could cause
errors, especially in the future when we add responsibilities to
diff_setup_done(). This instance causes no known errors with the present code.
But it resulted in an error with an experimental patch.
---
 builtin-checkout.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/builtin-checkout.c b/builtin-checkout.c
index 20b34ce..c315f63 100644
--- a/builtin-checkout.c
+++ b/builtin-checkout.c
@@ -291,14 +291,16 @@ static int checkout_paths(struct tree *source_tree, const char **pathspec,
 static void show_local_changes(struct object *head)
 {
 	struct rev_info rev;
 	/* I think we want full paths, even if we're in a subdirectory. */
 	init_revisions(&rev, NULL);
 	rev.abbrev = 0;
 	rev.diffopt.output_format |= DIFF_FORMAT_NAME_STATUS;
+	if (diff_setup_done(&rev.diffopt) < 0)
+		die("diff_setup_done failed");
 	add_pending_object(&rev, head, NULL);
 	run_diff_index(&rev, 0);
 }
 
 static void describe_detached_head(char *msg, struct commit *commit)
 {
 	struct strbuf sb = STRBUF_INIT;
-- 
1.6.1

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux