summaryrefslogtreecommitdiff
path: root/parse-options.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-03-20 06:16:08 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-03-20 06:16:08 (GMT)
commit0c45fa32ec87b15fd828bcbfc41d0d2349b4e7ad (patch)
treed5b89f725b7eea211471cab1fae3a8a63e868e05 /parse-options.h
parentf6c75e392e2d8426b622408ae74f0e2b545609a7 (diff)
parentcbdeab98e871bfbb45cf5095cc804ebb07054eba (diff)
downloadgit-0c45fa32ec87b15fd828bcbfc41d0d2349b4e7ad.zip
git-0c45fa32ec87b15fd828bcbfc41d0d2349b4e7ad.tar.gz
git-0c45fa32ec87b15fd828bcbfc41d0d2349b4e7ad.tar.bz2
Merge branch 'br/commit-tree-parseopt'
The command line parser of "git commit-tree" has been rewritten to use the parse-options API. * br/commit-tree-parseopt: commit-tree: utilize parse-options api
Diffstat (limited to 'parse-options.h')
-rw-r--r--parse-options.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/parse-options.h b/parse-options.h
index 7d83e29..74cce4e 100644
--- a/parse-options.h
+++ b/parse-options.h
@@ -222,6 +222,17 @@ const char *optname(const struct option *opt, int flags);
BUG("option callback does not expect an argument"); \
} while (0)
+/*
+ * Similar to the assertions above, but checks that "arg" is always non-NULL.
+ * This assertion also implies BUG_ON_OPT_NEG(), letting you declare both
+ * assertions in a single line.
+ */
+#define BUG_ON_OPT_NEG_NOARG(unset, arg) do { \
+ BUG_ON_OPT_NEG(unset); \
+ if(!(arg)) \
+ BUG("option callback expects an argument"); \
+} while(0)
+
/*----- incremental advanced APIs -----*/
enum parse_opt_result {