summaryrefslogtreecommitdiff
path: root/include/git2/submodule.h
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-04-09 14:52:32 -0700
committerRussell Belfer <rb@github.com>2013-04-09 14:52:32 -0700
commitad26434b3b8a5eafab8ec52b83aa99beaf48fb03 (patch)
treead5caff8bd3574a31040beaf1739f3ba3b6c8d9e /include/git2/submodule.h
parent9da187e83d1b8ab513a43fd54a9fe2be11b1703f (diff)
downloadlibgit2-ad26434b3b8a5eafab8ec52b83aa99beaf48fb03.tar.gz
Tests and more fixes for submodule diffs
This adds tests for diffs with submodules in them and (perhaps unsurprisingly) requires further fixes to be made. Specifically, this fixes: - when considering if a submodule is dirty in the workdir, it was being treated as dirty even if only the index was dirty. - git_diff_patch_to_str (and git_diff_patch_print) were "printing" the headers for files (and submodules) that were unmodified or had no meaningful content. - added comment to previous fix and removed unneeded parens.
Diffstat (limited to 'include/git2/submodule.h')
-rw-r--r--include/git2/submodule.h23
1 files changed, 20 insertions, 3 deletions
diff --git a/include/git2/submodule.h b/include/git2/submodule.h
index 1abd33e79..40934b3ed 100644
--- a/include/git2/submodule.h
+++ b/include/git2/submodule.h
@@ -119,11 +119,28 @@ typedef enum {
GIT_SUBMODULE_STATUS_WD_UNTRACKED = (1u << 13),
} git_submodule_status_t;
-#define GIT_SUBMODULE_STATUS_IS_UNMODIFIED(S) \
- (((S) & ~(GIT_SUBMODULE_STATUS_IN_HEAD | \
+#define GIT_SUBMODULE_STATUS__IN_FLAGS \
+ (GIT_SUBMODULE_STATUS_IN_HEAD | \
GIT_SUBMODULE_STATUS_IN_INDEX | \
GIT_SUBMODULE_STATUS_IN_CONFIG | \
- GIT_SUBMODULE_STATUS_IN_WD)) == 0)
+ GIT_SUBMODULE_STATUS_IN_WD)
+
+#define GIT_SUBMODULE_STATUS__INDEX_FLAGS \
+ (GIT_SUBMODULE_STATUS_INDEX_ADDED | \
+ GIT_SUBMODULE_STATUS_INDEX_DELETED | \
+ GIT_SUBMODULE_STATUS_INDEX_MODIFIED)
+
+#define GIT_SUBMODULE_STATUS__WD_FLAGS \
+ ~(GIT_SUBMODULE_STATUS__IN_FLAGS | GIT_SUBMODULE_STATUS__INDEX_FLAGS)
+
+#define GIT_SUBMODULE_STATUS_IS_UNMODIFIED(S) \
+ (((S) & ~GIT_SUBMODULE_STATUS__IN_FLAGS) == 0)
+
+#define GIT_SUBMODULE_STATUS_IS_INDEX_UNMODIFIED(S) \
+ (((S) & GIT_SUBMODULE_STATUS__INDEX_FLAGS) == 0)
+
+#define GIT_SUBMODULE_STATUS_IS_WD_UNMODIFIED(S) \
+ (((S) & GIT_SUBMODULE_STATUS__WD_FLAGS) == 0)
#define GIT_SUBMODULE_STATUS_IS_WD_DIRTY(S) \
(((S) & (GIT_SUBMODULE_STATUS_WD_INDEX_MODIFIED | \