{"thread":{"id":"16631","subject":"[PATCH 1/3] reorder ALLOW_TEXTCONV option setting","startedAt":"2008-12-08T02:54:17Z","lastAt":"2008-12-08T02:54:17Z","messageCount":1,"participants":["Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"97324","messageId":"20081208025417.GA22072@coredump.intra.peff.net","threadId":"16631","inReplyTo":null,"subject":"[PATCH 1/3] reorder ALLOW_TEXTCONV option setting","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-12-08T02:54:17Z","receivedAt":"2008-12-08T02:54:17Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"Right now for the diff porcelain and the log family, we\ncall:\n\n  init_revisions();\n  setup_revisions();\n  DIFF_OPT_SET(ALLOW_TEXTCONV);\n\nHowever, that means textconv will _always_ be on, instead of\nbeing a default that can be manipulated with\nsetup_revisions. Instead, we want:\n\n  init_revisions();\n  DIFF_OPT_SET(ALLOW_TEXTCONV);\n  setup_revisions();\n\nwhich is what this patch does.\n\nWe'll go ahead and move the callsite in wt-status, also;\neven though the user can't pass any options here, it is a\ncleanup that will help avoid any surprise later if the\nsetup_revisions line is changed.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\nThis is a \"bug fix\" in the sense that the code does not match the\noriginal intent (which was to set a default for these porcelains). But\nyou can't _trigger_ the bug since setup_revisions never munges the value\n(but it will in 2/3).\n\n builtin-diff.c |    4 ++--\n builtin-log.c  |    2 +-\n wt-status.c    |    2 +-\n 3 files changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/builtin-diff.c b/builtin-diff.c\nindex dddcf69..d75d69b 100644\n--- a/builtin-diff.c\n+++ b/builtin-diff.c\n@@ -290,8 +290,9 @@ int cmd_diff(int argc, const char **argv, const char *prefix)\n \t/* Otherwise, we are doing the usual \"git\" diff */\n \trev.diffopt.skip_stat_unmatch = !!diff_auto_refresh_index;\n \n-\t/* Default to let external be used */\n+\t/* Default to let external and textconv be used */\n \tDIFF_OPT_SET(&rev.diffopt, ALLOW_EXTERNAL);\n+\tDIFF_OPT_SET(&rev.diffopt, ALLOW_TEXTCONV);\n \n \tif (nongit)\n \t\tdie(\"Not a git repository\");\n@@ -303,7 +304,6 @@ int cmd_diff(int argc, const char **argv, const char *prefix)\n \t}\n \n \tDIFF_OPT_SET(&rev.diffopt, RECURSIVE);\n-\tDIFF_OPT_SET(&rev.diffopt, ALLOW_TEXTCONV);\n \n \t/*\n \t * If the user asked for our exit code then don't start a\ndiff --git a/builtin-log.c b/builtin-log.c\nindex b164717..840daf9 100644\n--- a/builtin-log.c\n+++ b/builtin-log.c\n@@ -37,6 +37,7 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix,\n \tDIFF_OPT_SET(&rev->diffopt, RECURSIVE);\n \trev->show_root_diff = default_show_root;\n \trev->subject_prefix = fmt_patch_subject_prefix;\n+\tDIFF_OPT_SET(&rev->diffopt, ALLOW_TEXTCONV);\n \n \tif (default_date_mode)\n \t\trev->date_mode = parse_date_format(default_date_mode);\n@@ -60,7 +61,6 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix,\n \t\t} else\n \t\t\tdie(\"unrecognized argument: %s\", arg);\n \t}\n-\tDIFF_OPT_SET(&rev->diffopt, ALLOW_TEXTCONV);\n }\n \n /*\ndiff --git a/wt-status.c b/wt-status.c\nindex 3edae43..96ff2f8 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -279,11 +279,11 @@ static void wt_status_print_verbose(struct wt_status *s)\n \tstruct rev_info rev;\n \n \tinit_revisions(&rev, NULL);\n+\tDIFF_OPT_SET(&rev.diffopt, ALLOW_TEXTCONV);\n \tsetup_revisions(0, NULL, &rev,\n \t\ts->is_initial ? EMPTY_TREE_SHA1_HEX : s->reference);\n \trev.diffopt.output_format |= DIFF_FORMAT_PATCH;\n \trev.diffopt.detect_rename = 1;\n-\tDIFF_OPT_SET(&rev.diffopt, ALLOW_TEXTCONV);\n \trev.diffopt.file = s->fp;\n \trev.diffopt.close_file = 0;\n \t/*\n-- \n1.6.1.rc2.285.gc1cf2\n"}]}