summaryrefslogtreecommitdiff
path: root/src/status.c
diff options
context:
space:
mode:
authorRussell Belfer <arrbee@arrbee.com>2012-03-22 10:44:36 -0700
committerRussell Belfer <arrbee@arrbee.com>2012-03-22 10:44:36 -0700
commit66142ae03134ef8a45e6bd304c6106a1685c3c99 (patch)
tree2a938d7439f419e4764e54040d787982efcffa71 /src/status.c
parent95340398a1821bd19da1bfe459ba1f375ed89404 (diff)
downloadlibgit2-66142ae03134ef8a45e6bd304c6106a1685c3c99.tar.gz
New status fixes
This adds support for roughly-right tracking of submodules (although it does not recurse into submodules to detect internal modifications a la core git), and it adds support for including unmodified files in diff iteration if requested.
Diffstat (limited to 'src/status.c')
-rw-r--r--src/status.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/status.c b/src/status.c
index eab7c8850..0c7a62254 100644
--- a/src/status.c
+++ b/src/status.c
@@ -137,7 +137,13 @@ int git_status_foreach_ext(
}
memset(&diffopt, 0, sizeof(diffopt));
- diffopt.flags = GIT_DIFF_INCLUDE_IGNORED | GIT_DIFF_INCLUDE_UNTRACKED;
+ if ((opts->flags & GIT_STATUS_OPT_INCLUDE_UNTRACKED) != 0)
+ diffopt.flags = diffopt.flags | GIT_DIFF_INCLUDE_UNTRACKED;
+ if ((opts->flags & GIT_STATUS_OPT_INCLUDE_IGNORED) != 0)
+ diffopt.flags = diffopt.flags | GIT_DIFF_INCLUDE_IGNORED;
+ if ((opts->flags & GIT_STATUS_OPT_INCLUDE_UNMODIFIED) != 0)
+ diffopt.flags = diffopt.flags | GIT_DIFF_INCLUDE_UNMODIFIED;
+ /* TODO: support EXCLUDE_SUBMODULES flag */
if (show != GIT_STATUS_SHOW_WORKDIR_ONLY &&
(err = git_diff_index_to_tree(repo, &diffopt, head, &idx2head)) < 0)
@@ -180,9 +186,9 @@ int git_status_foreach(
{
git_status_options opts;
- opts.show = GIT_STATUS_SHOW_INDEX_AND_WORKDIR;
+ opts.show = GIT_STATUS_SHOW_INDEX_AND_WORKDIR;
opts.flags = GIT_STATUS_OPT_INCLUDE_IGNORED |
- GIT_STATUS_OPT_EXCLUDE_SUBMODULES;
+ GIT_STATUS_OPT_INCLUDE_UNTRACKED;
return git_status_foreach_ext(repo, &opts, callback, payload);
}