summaryrefslogtreecommitdiff
path: root/src/diff.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2012-10-08 15:21:47 -0700
committerRussell Belfer <rb@github.com>2012-10-08 15:21:47 -0700
commit543864b677704845660085d2b2b2249cabb084a4 (patch)
tree049da739eb9e99fb111c160911b3e3b7a0dc53b5 /src/diff.c
parent527508b026c83266413cc7d7a68f3cb1ba6f6c51 (diff)
parent1dca8510a2e815c95293c1ebaacf2a286a9c6e1d (diff)
downloadlibgit2-543864b677704845660085d2b2b2249cabb084a4.tar.gz
Merge pull request #940 from scunz/diff_sm
Diff: Show submodule diff
Diffstat (limited to 'src/diff.c')
-rw-r--r--src/diff.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/diff.c b/src/diff.c
index 77cbc3ca7..7a0051ae3 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -448,7 +448,11 @@ static int oid_for_workdir_item(
return -1;
/* calculate OID for file if possible*/
- if (S_ISLNK(item->mode))
+ if (S_ISGITLINK(item->mode)) {
+ /* Don't bother to figure out an oid for a submodule. We won't use it anyway. */
+ memset(oid, 0, sizeof(*oid));
+ result = 0;
+ } else if (S_ISLNK(item->mode))
result = git_odb__hashlink(oid, full_path.ptr);
else if (!git__is_sizet(item->file_size)) {
giterr_set(GITERR_OS, "File size overflow for 32-bit systems");
@@ -561,8 +565,11 @@ static int maybe_modified(
else if (git_submodule_ignore(sub) == GIT_SUBMODULE_IGNORE_ALL)
status = GIT_DELTA_UNMODIFIED;
else {
- /* TODO: support other GIT_SUBMODULE_IGNORE values */
- status = GIT_DELTA_UNMODIFIED;
+ unsigned int sm_status = 0;
+ if (git_submodule_status(&sm_status, sub) < 0)
+ return -1;
+ status = GIT_SUBMODULE_STATUS_IS_UNMODIFIED(sm_status)
+ ? GIT_DELTA_UNMODIFIED : GIT_DELTA_MODIFIED;
}
}
}