git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Duy Nguyen <pclouds@gmail.com>
Date
Sep 25, 2013, 19:11 UTC
Message-ID
<CACsJy8Aj0HtuWn6iW4B3y4ZCeZYGOPN=vNGsC85YXTVjbwivBQ@mail.gmail.com>
In-Reply-To
<vpqob7huhyw.fsf@anie.imag.fr>

On Wed, Sep 25, 2013 at 8:52 PM, Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> wrote:

Show 14 quoted lines
> @@ -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...

Show 18 quoted lines
>
>         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.

Show 6 quoted lines
>
> I'll resend, together with tweaks to the first patch.
>
> --
> Matthieu Moy
> http://www-verimag.imag.fr/~moy/
-- 
Duy
Previous: Matthieu MoyNext: Junio C Hamano
Message 4 of 7 in “checkout: allow dwim for branch creation for "git checkout $branch --"”
  1. checkout: allow dwim for branch creation for "git checkout $branch --"Matthieu Moy, Sep 25, 2013
  2. Duy NguyenSep 25, 2013
  3. Matthieu MoySep 25, 2013
  4. Duy NguyenSep 25, 2013
  5. Junio C HamanoOct 16, 2013
  6. Matthieu MoyOct 17, 2013
  7. Junio C HamanoOct 17, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.