Skip to content

@rctay /gist:1066906
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
[gsoc-diff] diff --assume-text
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.