Merge branch 'rs/ls-tree-no-full-name-fix' into next
Command line parser fix. * rs/ls-tree-no-full-name-fix: ls-tree: fix --no-full-name
This commit is contained in:
@ -343,7 +343,7 @@ int cmd_ls_tree(int argc, const char **argv, const char *prefix)
|
|||||||
struct object_id oid;
|
struct object_id oid;
|
||||||
struct tree *tree;
|
struct tree *tree;
|
||||||
int i, full_tree = 0;
|
int i, full_tree = 0;
|
||||||
int chomp_prefix = prefix && *prefix;
|
int full_name = !prefix || !*prefix;
|
||||||
read_tree_fn_t fn = NULL;
|
read_tree_fn_t fn = NULL;
|
||||||
enum ls_tree_cmdmode cmdmode = MODE_DEFAULT;
|
enum ls_tree_cmdmode cmdmode = MODE_DEFAULT;
|
||||||
int null_termination = 0;
|
int null_termination = 0;
|
||||||
@ -365,8 +365,7 @@ int cmd_ls_tree(int argc, const char **argv, const char *prefix)
|
|||||||
MODE_NAME_STATUS),
|
MODE_NAME_STATUS),
|
||||||
OPT_CMDMODE(0, "object-only", &cmdmode, N_("list only objects"),
|
OPT_CMDMODE(0, "object-only", &cmdmode, N_("list only objects"),
|
||||||
MODE_OBJECT_ONLY),
|
MODE_OBJECT_ONLY),
|
||||||
OPT_SET_INT(0, "full-name", &chomp_prefix,
|
OPT_BOOL(0, "full-name", &full_name, N_("use full path names")),
|
||||||
N_("use full path names"), 0),
|
|
||||||
OPT_BOOL(0, "full-tree", &full_tree,
|
OPT_BOOL(0, "full-tree", &full_tree,
|
||||||
N_("list entire tree; not just current directory "
|
N_("list entire tree; not just current directory "
|
||||||
"(implies --full-name)")),
|
"(implies --full-name)")),
|
||||||
@ -387,7 +386,7 @@ int cmd_ls_tree(int argc, const char **argv, const char *prefix)
|
|||||||
|
|
||||||
if (full_tree)
|
if (full_tree)
|
||||||
prefix = NULL;
|
prefix = NULL;
|
||||||
options.prefix = chomp_prefix ? prefix : NULL;
|
options.prefix = full_name ? NULL : prefix;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We wanted to detect conflicts between --name-only and
|
* We wanted to detect conflicts between --name-only and
|
||||||
|
@ -154,6 +154,14 @@ EOF
|
|||||||
test_output
|
test_output
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'ls-tree --no-full-name' '
|
||||||
|
git -C path0 ls-tree --no-full-name $tree a >current &&
|
||||||
|
cat >expected <<-EOF &&
|
||||||
|
040000 tree X a
|
||||||
|
EOF
|
||||||
|
test_output
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success 'ls-tree --full-tree' '
|
test_expect_success 'ls-tree --full-tree' '
|
||||||
(
|
(
|
||||||
cd path1/b/c &&
|
cd path1/b/c &&
|
||||||
|
Reference in New Issue
Block a user