summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/git2/diff.h2
-rw-r--r--src/diff.c3
2 files changed, 5 insertions, 0 deletions
diff --git a/include/git2/diff.h b/include/git2/diff.h
index 3d8e7e776..47bfa5f69 100644
--- a/include/git2/diff.h
+++ b/include/git2/diff.h
@@ -86,6 +86,8 @@ typedef enum {
* mode set to tree. Note: the tree SHA will not be available.
*/
GIT_DIFF_INCLUDE_TYPECHANGE_TREES = (1 << 16),
+ /** Ignore file mode changes */
+ GIT_DIFF_IGNORE_FILEMODE = (1 << 17),
} git_diff_option_t;
/**
diff --git a/src/diff.c b/src/diff.c
index 728e23712..9cd6c1609 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -267,6 +267,9 @@ static git_diff_list *git_diff_list_alloc(
memcpy(&diff->opts, opts, sizeof(git_diff_options));
+ if(opts->flags & GIT_DIFF_IGNORE_FILEMODE)
+ diff->diffcaps = diff->diffcaps & ~GIT_DIFFCAPS_TRUST_MODE_BITS;
+
/* pathspec init will do nothing for empty pathspec */
if (git_pathspec_init(&diff->pathspec, &opts->pathspec, &diff->pool) < 0)
goto fail;