summaryrefslogtreecommitdiff
path: root/builtin/ls-files.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-02-10 22:20:08 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-02-10 22:20:08 (GMT)
commit722c9244452c1853f0592b22c331382c282768c7 (patch)
tree51f432011324a752a2c57080e045a1fa7ad12c3f /builtin/ls-files.c
parent24abb31727e8e0b216bdee182dbbbbc43d134fa6 (diff)
parent1f3c79a9d6c3278753e7fb63b48569a9ff8632df (diff)
downloadgit-722c9244452c1853f0592b22c331382c282768c7.zip
git-722c9244452c1853f0592b22c331382c282768c7.tar.gz
git-722c9244452c1853f0592b22c331382c282768c7.tar.bz2
Merge branch 'jk/options-cleanup'
Various clean-ups to the command line option parsing. * jk/options-cleanup: apply, ls-files: simplify "-z" parsing checkout-index: disallow "--no-stage" option checkout-index: handle "--no-index" option checkout-index: handle "--no-prefix" option checkout-index: simplify "-z" option parsing give "nbuf" strbuf a more meaningful name
Diffstat (limited to 'builtin/ls-files.c')
-rw-r--r--builtin/ls-files.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/builtin/ls-files.c b/builtin/ls-files.c
index dedf02d..f02e3d2 100644
--- a/builtin/ls-files.c
+++ b/builtin/ls-files.c
@@ -379,14 +379,6 @@ static const char * const ls_files_usage[] = {
NULL
};
-static int option_parse_z(const struct option *opt,
- const char *arg, int unset)
-{
- line_terminator = unset ? '\n' : '\0';
-
- return 0;
-}
-
static int option_parse_exclude(const struct option *opt,
const char *arg, int unset)
{
@@ -428,9 +420,9 @@ int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix)
struct exclude_list *el;
struct string_list exclude_list = STRING_LIST_INIT_NODUP;
struct option builtin_ls_files_options[] = {
- { OPTION_CALLBACK, 'z', NULL, NULL, NULL,
- N_("paths are separated with NUL character"),
- PARSE_OPT_NOARG, option_parse_z },
+ /* Think twice before adding "--nul" synonym to this */
+ OPT_SET_INT('z', NULL, &line_terminator,
+ N_("paths are separated with NUL character"), '\0'),
OPT_BOOL('t', NULL, &show_tag,
N_("identify the file status with tags")),
OPT_BOOL('v', NULL, &show_valid_bit,