summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinquize <linquize@yahoo.com.hk>2013-03-29 11:52:18 +0800
committerRussell Belfer <rb@github.com>2013-04-09 10:51:35 -0700
commit94750e8af246b2adf7bd5766e7e0da5fcf928d24 (patch)
treebff1903b9e4716ce042f7dc25c3bda77c5ba1d8f
parentfc12a6b545e26e673640288418202ac802a82a3f (diff)
downloadlibgit2-94750e8af246b2adf7bd5766e7e0da5fcf928d24.tar.gz
Fix submodule dirty states not showing if submodules comes before files, or there are only dirty submodules but no changed files
GIT_DIFF_PATCH_DIFFABLE was not set, so the diff content was not shown When submodule is dirty, the hash may be the same, but the length is different because -dirty is appended We can therefore compare the length or hash
-rw-r--r--src/diff_output.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/diff_output.c b/src/diff_output.c
index e8dd5b317..d462142f9 100644
--- a/src/diff_output.c
+++ b/src/diff_output.c
@@ -678,7 +678,8 @@ cleanup:
if ((delta->flags & GIT_DIFF_FLAG_BINARY) == 0 &&
delta->status != GIT_DELTA_UNMODIFIED &&
(patch->old_data.len || patch->new_data.len) &&
- !git_oid_equal(&delta->old_file.oid, &delta->new_file.oid))
+ ((patch->old_data.len != patch->new_data.len) ||
+ !git_oid_equal(&delta->old_file.oid, &delta->new_file.oid)))
patch->flags |= GIT_DIFF_PATCH_DIFFABLE;
}