summaryrefslogtreecommitdiff
path: root/include/git2/submodule.h
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-06-29 23:22:31 -0700
committerRussell Belfer <rb@github.com>2013-07-10 12:15:03 -0700
commitf9775a37aa4ed042839a6b2f9d8e0dfbd73a2f09 (patch)
treed4e0fde8c090bf7d301dfa673538dd17d9a77f96 /include/git2/submodule.h
parent2e3e273e33894bc1089cfc09d89bd2cb144b108d (diff)
downloadlibgit2-f9775a37aa4ed042839a6b2f9d8e0dfbd73a2f09.tar.gz
Add ignore_submodules to diff options
This adds correct support for an equivalent to --ignore-submodules in diff, where an actual ignore value can be passed to diff to override the per submodule settings in the configuration. This required tweaking the constants for ignore values so that zero would not be used and could represent an unset option to the diff. This was an opportunity to move the submodule values into include/git2/types.h and to rename the poorly named DEFAULT values for ignore and update constants to RESET instead. Now the GIT_DIFF_IGNORE_SUBMODULES flag is exactly the same as setting the ignore_submodules option to GIT_SUBMODULE_IGNORE_ALL (which is actually a minor change from the old behavior in that submodules will now be treated as UNMODIFIED deltas instead of being left out totally - if you set GIT_DIFF_INCLUDE_UNMODIFIED). This includes tests for the various new settings.
Diffstat (limited to 'include/git2/submodule.h')
-rw-r--r--include/git2/submodule.h53
1 files changed, 10 insertions, 43 deletions
diff --git a/include/git2/submodule.h b/include/git2/submodule.h
index 3267bcd0f..ba7a558d0 100644
--- a/include/git2/submodule.h
+++ b/include/git2/submodule.h
@@ -14,51 +14,18 @@
/**
* @file git2/submodule.h
* @brief Git submodule management utilities
- * @defgroup git_submodule Git submodule management routines
- * @ingroup Git
- * @{
- */
-GIT_BEGIN_DECL
-
-/**
- * Opaque structure representing a submodule.
*
* Submodule support in libgit2 builds a list of known submodules and keeps
* it in the repository. The list is built from the .gitmodules file, the
* .git/config file, the index, and the HEAD tree. Items in the working
* directory that look like submodules (i.e. a git repo) but are not
* mentioned in those places won't be tracked.
- */
-typedef struct git_submodule git_submodule;
-
-/**
- * Values that could be specified for the update rule of a submodule.
*
- * Use the DEFAULT value if you have altered the update value via
- * `git_submodule_set_update()` and wish to reset to the original default.
- */
-typedef enum {
- GIT_SUBMODULE_UPDATE_DEFAULT = -1,
- GIT_SUBMODULE_UPDATE_CHECKOUT = 0,
- GIT_SUBMODULE_UPDATE_REBASE = 1,
- GIT_SUBMODULE_UPDATE_MERGE = 2,
- GIT_SUBMODULE_UPDATE_NONE = 3
-} git_submodule_update_t;
-
-/**
- * Values that could be specified for how closely to examine the
- * working directory when getting submodule status.
- *
- * Use the DEFUALT value if you have altered the ignore value via
- * `git_submodule_set_ignore()` and wish to reset to the original value.
+ * @defgroup git_submodule Git submodule management routines
+ * @ingroup Git
+ * @{
*/
-typedef enum {
- GIT_SUBMODULE_IGNORE_DEFAULT = -1, /* reset to default */
- GIT_SUBMODULE_IGNORE_NONE = 0, /* any change or untracked == dirty */
- GIT_SUBMODULE_IGNORE_UNTRACKED = 1, /* dirty if tracked files change */
- GIT_SUBMODULE_IGNORE_DIRTY = 2, /* only dirty if HEAD moved */
- GIT_SUBMODULE_IGNORE_ALL = 3 /* never dirty */
-} git_submodule_ignore_t;
+GIT_BEGIN_DECL
/**
* Return codes for submodule status.
@@ -377,9 +344,9 @@ GIT_EXTERN(git_submodule_ignore_t) git_submodule_ignore(
* submodule is in memory. You should call `git_submodule_save()` if you
* want to persist the new ignore role.
*
- * Calling this again with GIT_SUBMODULE_IGNORE_DEFAULT or calling
- * `git_submodule_reload()` will revert the rule to the value that was in the
- * original config.
+ * Calling this again with GIT_SUBMODULE_IGNORE_RESET or calling
+ * `git_submodule_reload()` will revert the rule to the value that was in
+ * the original config.
*
* @return old value for ignore
*/
@@ -399,9 +366,9 @@ GIT_EXTERN(git_submodule_update_t) git_submodule_update(
* This sets the update rule in memory for the submodule. You should call
* `git_submodule_save()` if you want to persist the new update rule.
*
- * Calling this again with GIT_SUBMODULE_UPDATE_DEFAULT or calling
- * `git_submodule_reload()` will revert the rule to the value that was in the
- * original config.
+ * Calling this again with GIT_SUBMODULE_UPDATE_RESET or calling
+ * `git_submodule_reload()` will revert the rule to the value that was in
+ * the original config.
*
* @return old value for update
*/