Re: [RFC/PATCH] checkout: allow dwim for branch creation for "git checkout $branch --"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Sep 25, 2013 at 8:52 PM, Matthieu Moy
<Matthieu.Moy@xxxxxxxxxxxxxxx> wrote:
> @@ -925,7 +926,15 @@ static int parse_branchname_arg(int argc, const char **argv,
>                 return 1;
>
>         arg = argv[0];
> -       has_dash_dash = (argc > 1) && !strcmp(argv[1], "--");
> +       has_dash_dash = 0;
> +       for (i = 0; i < argc; i++) {
> +               if (!strcmp(argv[i], "--")) {
> +                       has_dash_dash = i;
> +                       break;
> +               }
> +       }
> +       if (has_dash_dash >= 2)
> +               die("only one reference expected, %d given.", has_dash_dash);

The translator in me says this string should be marked for translation
like others in git-checkout...

>
>         if (!strcmp(arg, "-"))
>                 arg = "@{-1}";
> diff --git a/t/t2010-checkout-ambiguous.sh b/t/t2010-checkout-ambiguous.sh
> index 7cc0a35..2836a3e 100755
> --- a/t/t2010-checkout-ambiguous.sh
> +++ b/t/t2010-checkout-ambiguous.sh
> @@ -47,4 +47,10 @@ test_expect_success 'disambiguate checking out from a tree-ish' '
>         git diff --exit-code --quiet
>  '
>
> +test_expect_success 'accurate error message with more than one ref' '
> +       test_must_fail git checkout HEAD master -- 2>actual &&
> +       echo "fatal: only one reference expected, 2 given." >expect &&
> +       test_cmp expect actual
> +'
> +
>  test_done

which makes C_LOCALE_OUTPUT a prerequisite for this test because it
needs the untranslated version of the string.

>
> I'll resend, together with tweaks to the first patch.
>
> --
> Matthieu Moy
> http://www-verimag.imag.fr/~moy/



-- 
Duy
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]