зеркало из https://github.com/microsoft/git.git
Force the sticked form for options with optional arguments.
This forbids "git tag -n <number> -l" we allowed earlier, so adjust t7004 while at it. Signed-off-by: Pierre Habouzit <madcoder@debian.org>
This commit is contained in:
Родитель
5e2de4f9bb
Коммит
c43a24834a
|
@ -89,7 +89,7 @@ static int get_value(struct optparse_t *p,
|
|||
*(const char **)opt->value = NULL;
|
||||
return 0;
|
||||
}
|
||||
if (opt->flags & PARSE_OPT_OPTARG && (!arg || *arg == '-')) {
|
||||
if (opt->flags & PARSE_OPT_OPTARG && !p->opt) {
|
||||
*(const char **)opt->value = (const char *)opt->defval;
|
||||
return 0;
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ static int get_value(struct optparse_t *p,
|
|||
return (*opt->callback)(opt, NULL, 1);
|
||||
if (opt->flags & PARSE_OPT_NOARG)
|
||||
return (*opt->callback)(opt, NULL, 0);
|
||||
if (opt->flags & PARSE_OPT_OPTARG && (!arg || *arg == '-'))
|
||||
if (opt->flags & PARSE_OPT_OPTARG && !p->opt)
|
||||
return (*opt->callback)(opt, NULL, 0);
|
||||
if (!arg)
|
||||
return opterror(opt, "requires a value", flags);
|
||||
|
@ -114,7 +114,7 @@ static int get_value(struct optparse_t *p,
|
|||
*(int *)opt->value = 0;
|
||||
return 0;
|
||||
}
|
||||
if (opt->flags & PARSE_OPT_OPTARG && (!arg || !isdigit(*arg))) {
|
||||
if (opt->flags & PARSE_OPT_OPTARG && !p->opt) {
|
||||
*(int *)opt->value = opt->defval;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -491,21 +491,21 @@ test_expect_success \
|
|||
echo "tag-one-line" >expect &&
|
||||
git-tag -l | grep "^tag-one-line" >actual &&
|
||||
git diff expect actual &&
|
||||
git-tag -n 0 -l | grep "^tag-one-line" >actual &&
|
||||
git-tag -n0 -l | grep "^tag-one-line" >actual &&
|
||||
git diff expect actual &&
|
||||
git-tag -n 0 -l tag-one-line >actual &&
|
||||
git-tag -n0 -l tag-one-line >actual &&
|
||||
git diff expect actual &&
|
||||
|
||||
echo "tag-one-line A msg" >expect &&
|
||||
git-tag -n 1 -l | grep "^tag-one-line" >actual &&
|
||||
git-tag -n1 -l | grep "^tag-one-line" >actual &&
|
||||
git diff expect actual &&
|
||||
git-tag -n -l | grep "^tag-one-line" >actual &&
|
||||
git diff expect actual &&
|
||||
git-tag -n 1 -l tag-one-line >actual &&
|
||||
git-tag -n1 -l tag-one-line >actual &&
|
||||
git diff expect actual &&
|
||||
git-tag -n 2 -l tag-one-line >actual &&
|
||||
git-tag -n2 -l tag-one-line >actual &&
|
||||
git diff expect actual &&
|
||||
git-tag -n 999 -l tag-one-line >actual &&
|
||||
git-tag -n999 -l tag-one-line >actual &&
|
||||
git diff expect actual
|
||||
'
|
||||
|
||||
|
@ -516,21 +516,21 @@ test_expect_success \
|
|||
echo "tag-zero-lines" >expect &&
|
||||
git-tag -l | grep "^tag-zero-lines" >actual &&
|
||||
git diff expect actual &&
|
||||
git-tag -n 0 -l | grep "^tag-zero-lines" >actual &&
|
||||
git-tag -n0 -l | grep "^tag-zero-lines" >actual &&
|
||||
git diff expect actual &&
|
||||
git-tag -n 0 -l tag-zero-lines >actual &&
|
||||
git-tag -n0 -l tag-zero-lines >actual &&
|
||||
git diff expect actual &&
|
||||
|
||||
echo "tag-zero-lines " >expect &&
|
||||
git-tag -n 1 -l | grep "^tag-zero-lines" >actual &&
|
||||
git-tag -n1 -l | grep "^tag-zero-lines" >actual &&
|
||||
git diff expect actual &&
|
||||
git-tag -n -l | grep "^tag-zero-lines" >actual &&
|
||||
git diff expect actual &&
|
||||
git-tag -n 1 -l tag-zero-lines >actual &&
|
||||
git-tag -n1 -l tag-zero-lines >actual &&
|
||||
git diff expect actual &&
|
||||
git-tag -n 2 -l tag-zero-lines >actual &&
|
||||
git-tag -n2 -l tag-zero-lines >actual &&
|
||||
git diff expect actual &&
|
||||
git-tag -n 999 -l tag-zero-lines >actual &&
|
||||
git-tag -n999 -l tag-zero-lines >actual &&
|
||||
git diff expect actual
|
||||
'
|
||||
|
||||
|
@ -544,37 +544,37 @@ test_expect_success \
|
|||
echo "tag-lines" >expect &&
|
||||
git-tag -l | grep "^tag-lines" >actual &&
|
||||
git diff expect actual &&
|
||||
git-tag -n 0 -l | grep "^tag-lines" >actual &&
|
||||
git-tag -n0 -l | grep "^tag-lines" >actual &&
|
||||
git diff expect actual &&
|
||||
git-tag -n 0 -l tag-lines >actual &&
|
||||
git-tag -n0 -l tag-lines >actual &&
|
||||
git diff expect actual &&
|
||||
|
||||
echo "tag-lines tag line one" >expect &&
|
||||
git-tag -n 1 -l | grep "^tag-lines" >actual &&
|
||||
git-tag -n1 -l | grep "^tag-lines" >actual &&
|
||||
git diff expect actual &&
|
||||
git-tag -n -l | grep "^tag-lines" >actual &&
|
||||
git diff expect actual &&
|
||||
git-tag -n 1 -l tag-lines >actual &&
|
||||
git-tag -n1 -l tag-lines >actual &&
|
||||
git diff expect actual &&
|
||||
|
||||
echo " tag line two" >>expect &&
|
||||
git-tag -n 2 -l | grep "^ *tag.line" >actual &&
|
||||
git-tag -n2 -l | grep "^ *tag.line" >actual &&
|
||||
git diff expect actual &&
|
||||
git-tag -n 2 -l tag-lines >actual &&
|
||||
git-tag -n2 -l tag-lines >actual &&
|
||||
git diff expect actual &&
|
||||
|
||||
echo " tag line three" >>expect &&
|
||||
git-tag -n 3 -l | grep "^ *tag.line" >actual &&
|
||||
git-tag -n3 -l | grep "^ *tag.line" >actual &&
|
||||
git diff expect actual &&
|
||||
git-tag -n 3 -l tag-lines >actual &&
|
||||
git-tag -n3 -l tag-lines >actual &&
|
||||
git diff expect actual &&
|
||||
git-tag -n 4 -l | grep "^ *tag.line" >actual &&
|
||||
git-tag -n4 -l | grep "^ *tag.line" >actual &&
|
||||
git diff expect actual &&
|
||||
git-tag -n 4 -l tag-lines >actual &&
|
||||
git-tag -n4 -l tag-lines >actual &&
|
||||
git diff expect actual &&
|
||||
git-tag -n 99 -l | grep "^ *tag.line" >actual &&
|
||||
git-tag -n99 -l | grep "^ *tag.line" >actual &&
|
||||
git diff expect actual &&
|
||||
git-tag -n 99 -l tag-lines >actual &&
|
||||
git-tag -n99 -l tag-lines >actual &&
|
||||
git diff expect actual
|
||||
'
|
||||
|
||||
|
@ -902,21 +902,21 @@ test_expect_success \
|
|||
echo "stag-one-line" >expect &&
|
||||
git-tag -l | grep "^stag-one-line" >actual &&
|
||||
git diff expect actual &&
|
||||
git-tag -n 0 -l | grep "^stag-one-line" >actual &&
|
||||
git-tag -n0 -l | grep "^stag-one-line" >actual &&
|
||||
git diff expect actual &&
|
||||
git-tag -n 0 -l stag-one-line >actual &&
|
||||
git-tag -n0 -l stag-one-line >actual &&
|
||||
git diff expect actual &&
|
||||
|
||||
echo "stag-one-line A message line signed" >expect &&
|
||||
git-tag -n 1 -l | grep "^stag-one-line" >actual &&
|
||||
git-tag -n1 -l | grep "^stag-one-line" >actual &&
|
||||
git diff expect actual &&
|
||||
git-tag -n -l | grep "^stag-one-line" >actual &&
|
||||
git diff expect actual &&
|
||||
git-tag -n 1 -l stag-one-line >actual &&
|
||||
git-tag -n1 -l stag-one-line >actual &&
|
||||
git diff expect actual &&
|
||||
git-tag -n 2 -l stag-one-line >actual &&
|
||||
git-tag -n2 -l stag-one-line >actual &&
|
||||
git diff expect actual &&
|
||||
git-tag -n 999 -l stag-one-line >actual &&
|
||||
git-tag -n999 -l stag-one-line >actual &&
|
||||
git diff expect actual
|
||||
'
|
||||
|
||||
|
@ -927,21 +927,21 @@ test_expect_success \
|
|||
echo "stag-zero-lines" >expect &&
|
||||
git-tag -l | grep "^stag-zero-lines" >actual &&
|
||||
git diff expect actual &&
|
||||
git-tag -n 0 -l | grep "^stag-zero-lines" >actual &&
|
||||
git-tag -n0 -l | grep "^stag-zero-lines" >actual &&
|
||||
git diff expect actual &&
|
||||
git-tag -n 0 -l stag-zero-lines >actual &&
|
||||
git-tag -n0 -l stag-zero-lines >actual &&
|
||||
git diff expect actual &&
|
||||
|
||||
echo "stag-zero-lines " >expect &&
|
||||
git-tag -n 1 -l | grep "^stag-zero-lines" >actual &&
|
||||
git-tag -n1 -l | grep "^stag-zero-lines" >actual &&
|
||||
git diff expect actual &&
|
||||
git-tag -n -l | grep "^stag-zero-lines" >actual &&
|
||||
git diff expect actual &&
|
||||
git-tag -n 1 -l stag-zero-lines >actual &&
|
||||
git-tag -n1 -l stag-zero-lines >actual &&
|
||||
git diff expect actual &&
|
||||
git-tag -n 2 -l stag-zero-lines >actual &&
|
||||
git-tag -n2 -l stag-zero-lines >actual &&
|
||||
git diff expect actual &&
|
||||
git-tag -n 999 -l stag-zero-lines >actual &&
|
||||
git-tag -n999 -l stag-zero-lines >actual &&
|
||||
git diff expect actual
|
||||
'
|
||||
|
||||
|
@ -955,37 +955,37 @@ test_expect_success \
|
|||
echo "stag-lines" >expect &&
|
||||
git-tag -l | grep "^stag-lines" >actual &&
|
||||
git diff expect actual &&
|
||||
git-tag -n 0 -l | grep "^stag-lines" >actual &&
|
||||
git-tag -n0 -l | grep "^stag-lines" >actual &&
|
||||
git diff expect actual &&
|
||||
git-tag -n 0 -l stag-lines >actual &&
|
||||
git-tag -n0 -l stag-lines >actual &&
|
||||
git diff expect actual &&
|
||||
|
||||
echo "stag-lines stag line one" >expect &&
|
||||
git-tag -n 1 -l | grep "^stag-lines" >actual &&
|
||||
git-tag -n1 -l | grep "^stag-lines" >actual &&
|
||||
git diff expect actual &&
|
||||
git-tag -n -l | grep "^stag-lines" >actual &&
|
||||
git diff expect actual &&
|
||||
git-tag -n 1 -l stag-lines >actual &&
|
||||
git-tag -n1 -l stag-lines >actual &&
|
||||
git diff expect actual &&
|
||||
|
||||
echo " stag line two" >>expect &&
|
||||
git-tag -n 2 -l | grep "^ *stag.line" >actual &&
|
||||
git-tag -n2 -l | grep "^ *stag.line" >actual &&
|
||||
git diff expect actual &&
|
||||
git-tag -n 2 -l stag-lines >actual &&
|
||||
git-tag -n2 -l stag-lines >actual &&
|
||||
git diff expect actual &&
|
||||
|
||||
echo " stag line three" >>expect &&
|
||||
git-tag -n 3 -l | grep "^ *stag.line" >actual &&
|
||||
git-tag -n3 -l | grep "^ *stag.line" >actual &&
|
||||
git diff expect actual &&
|
||||
git-tag -n 3 -l stag-lines >actual &&
|
||||
git-tag -n3 -l stag-lines >actual &&
|
||||
git diff expect actual &&
|
||||
git-tag -n 4 -l | grep "^ *stag.line" >actual &&
|
||||
git-tag -n4 -l | grep "^ *stag.line" >actual &&
|
||||
git diff expect actual &&
|
||||
git-tag -n 4 -l stag-lines >actual &&
|
||||
git-tag -n4 -l stag-lines >actual &&
|
||||
git diff expect actual &&
|
||||
git-tag -n 99 -l | grep "^ *stag.line" >actual &&
|
||||
git-tag -n99 -l | grep "^ *stag.line" >actual &&
|
||||
git diff expect actual &&
|
||||
git-tag -n 99 -l stag-lines >actual &&
|
||||
git-tag -n99 -l stag-lines >actual &&
|
||||
git diff expect actual
|
||||
'
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче