diff options
author | Sascha Cunz <Sascha@BabbelBox.org> | 2012-09-18 23:43:23 +0200 |
---|---|---|
committer | Sascha Cunz <Sascha@BabbelBox.org> | 2012-10-05 13:03:38 +0200 |
commit | 7e57d2506a4719dbe13115ba3bf7e4a012daa3e3 (patch) | |
tree | 06c3f7f3b800c949cf8f3b2bd808aac2bd087054 /src/diff.c | |
parent | 9ce44f1ae5a8b286585e60c88c6a143d80a226a6 (diff) | |
download | libgit2-7e57d2506a4719dbe13115ba3bf7e4a012daa3e3.tar.gz |
Diff: teach get_workdir_content to show a submodule as text
1. teach diff.c:maybe_modified to query git_submodule_status for the
modification state of a submodule. According to the
git_submodule_status docs, it will filter for to-ignore states
already.
2. teach diff_output.c:get_workdir_content to check the submodule status
again and create a line like:
Subproject commit <SHA-1>\n
or
Subproject comimt <SHA-1>-dirty\n
like git.git does.
Diffstat (limited to 'src/diff.c')
-rw-r--r-- | src/diff.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/diff.c b/src/diff.c index 77cbc3ca7..375520e04 100644 --- a/src/diff.c +++ b/src/diff.c @@ -561,8 +561,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; } } } |