summaryrefslogtreecommitdiff
path: root/include/git2/status.h
diff options
context:
space:
mode:
authorRussell Belfer <arrbee@arrbee.com>2012-03-23 09:26:09 -0700
committerRussell Belfer <arrbee@arrbee.com>2012-03-23 09:26:09 -0700
commit4b136a94d948e62634633092c9d1052c4b074e6c (patch)
tree15ea545035aa86f064ff62c755f24a5c80f28035 /include/git2/status.h
parent98c4613e2d79f73d5168582c23e87faebc69787b (diff)
downloadlibgit2-4b136a94d948e62634633092c9d1052c4b074e6c.tar.gz
Fix crash in new status and add recurse option
This fixes the bug that @nulltoken found (thank you!) where if there were untracked directories alphabetically after the last tracked item, the diff implementation would deref a NULL pointer. The fix involved the code which decides if it is necessary to recurse into a directory in the working dir, so it was easy to add a new option `GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS` to control if the contents of untracked directories should be included in status.
Diffstat (limited to 'include/git2/status.h')
-rw-r--r--include/git2/status.h20
1 files changed, 14 insertions, 6 deletions
diff --git a/include/git2/status.h b/include/git2/status.h
index a24d39fa7..f5fc95f0a 100644
--- a/include/git2/status.h
+++ b/include/git2/status.h
@@ -87,19 +87,27 @@ typedef enum {
* should be made even on unmodified files.
* - GIT_STATUS_OPT_EXCLUDE_SUBMODULES indicates that directories
* which appear to be submodules should just be skipped over.
+ * - GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS indicates that the
+ * contents of untracked directories should be included in the
+ * status. Normally if an entire directory is new, then just
+ * the top-level directory will be included (with a trailing
+ * slash on the entry name). Given this flag, the directory
+ * itself will not be included, but all the files in it will.
*/
-#define GIT_STATUS_OPT_INCLUDE_UNTRACKED (1 << 0)
-#define GIT_STATUS_OPT_INCLUDE_IGNORED (1 << 1)
-#define GIT_STATUS_OPT_INCLUDE_UNMODIFIED (1 << 2)
-#define GIT_STATUS_OPT_EXCLUDE_SUBMODULES (1 << 3)
+#define GIT_STATUS_OPT_INCLUDE_UNTRACKED (1 << 0)
+#define GIT_STATUS_OPT_INCLUDE_IGNORED (1 << 1)
+#define GIT_STATUS_OPT_INCLUDE_UNMODIFIED (1 << 2)
+#define GIT_STATUS_OPT_EXCLUDE_SUBMODULES (1 << 3)
+#define GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS (1 << 4)
/**
- * Options to control which callbacks will be made by
- * `git_status_foreach_ext()`
+ * Options to control how callbacks will be made by
+ * `git_status_foreach_ext()`.
*/
typedef struct {
git_status_show_t show;
unsigned int flags;
+ git_strarray pathspec;
} git_status_options;
/**