public
Last active

[gsoc-diff] diff --assume-text

  • Download Gist
gistfile1.diff
Diff
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
diff --git a/diff.c b/diff.c
index 1b940ee..66b998e 100644
--- a/diff.c
+++ b/diff.c
@@ -2854,11 +2854,13 @@ static void run_diff_cmd(const char *pgm,
complete_rewrite);
return;
}
- if (one && two)
+ if (one && two) {
+ if (o->flags & DIFF_OPT_ASSUME_TEXT)
+ one->is_binary = two->is_binary = 0;
builtin_diff(name, other ? other : name,
one, two, xfrm_msg, must_show_header,
o, complete_rewrite);
- else
+ } else
fprintf(o->file, "* Unmerged path %s\n", name);
}
@@ -3457,7 +3459,8 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
else if (!prefixcmp(arg, "--submodule=")) {
if (!strcmp(arg + 12, "log"))
DIFF_OPT_SET(options, SUBMODULE_LOG);
- }
+ } else if (!prefixcmp(arg, "--assume-text"))
+ DIFF_OPT_SET(options, ASSUME_TEXT);
/* misc options */
else if (!strcmp(arg, "-z"))
diff --git a/diff.h b/diff.h
index 6d303c1..2351f93 100644
--- a/diff.h
+++ b/diff.h
@@ -59,7 +59,7 @@ typedef struct strbuf *(*diff_prefix_fn_t)(struct diff_options *opt, void *data)
#define DIFF_OPT_FIND_COPIES_HARDER (1 << 6)
#define DIFF_OPT_FOLLOW_RENAMES (1 << 7)
#define DIFF_OPT_COLOR_DIFF (1 << 8)
-/* (1 << 9) unused */
+#define DIFF_OPT_ASSUME_TEXT (1 << 9)
#define DIFF_OPT_HAS_CHANGES (1 << 10)
#define DIFF_OPT_QUICK (1 << 11)
#define DIFF_OPT_NO_INDEX (1 << 12)

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.