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

Re: [PATCH] reset: setup worktree on --mixed

From
Duy Nguyen <pclouds@gmail.com>
Date
Feb 15, 2014, 09:38 UTC
Message-ID
<CACsJy8AChRw30Vb1ivn7HR2+MDgH5ZcGLgzugSrjaJhE=mHqXQ@mail.gmail.com>
In-Reply-To
<1392455661-20665-1-git-send-email-pclouds@gmail.com>
On Sat, Feb 15, 2014 at 4:14 PM, Nguyễn Thái Ngọc Duy <pclouds@gmail.com> wrote:
> --mixed does mainly two things: read_from_tree(), which does not
> require a worktree, and refresh_index(), which does.

.. and I should have run the entire test suite before sending this. It breaks t7103.5 (reset --mixed in bare repository). That test seems wrong though, in my opinon..

Show 44 quoted lines
>
> Reported-by: Patrick Palka <patrick@parcs.ath.cx>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
>  builtin/reset.c  |  2 +-
>  t/t7102-reset.sh | 11 +++++++++++
>  2 files changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/builtin/reset.c b/builtin/reset.c
> index 6004803..9928c28 100644
> --- a/builtin/reset.c
> +++ b/builtin/reset.c
> @@ -320,7 +320,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
>         if (reset_type == NONE)
>                 reset_type = MIXED; /* by default */
>
> -       if (reset_type != SOFT && reset_type != MIXED)
> +       if (reset_type != SOFT)
>                 setup_work_tree();
>
>         if (reset_type == MIXED && is_bare_repository())
> diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh
> index 8d4b50d..ee117e2 100755
> --- a/t/t7102-reset.sh
> +++ b/t/t7102-reset.sh
> @@ -535,4 +535,15 @@ test_expect_success 'reset with paths accepts tree' '
>         git diff HEAD --exit-code
>  '
>
> +test_expect_success 'reset --mixed sets up work tree' '
> +       git init mixed_worktree &&
> +       (
> +               cd mixed_worktree &&
> +               test_commit dummy
> +       ) &&
> +       : >expect &&
> +       git --git-dir=mixed_worktree/.git --work-tree=mixed_worktree reset >actual &&
> +       test_cmp expect actual
> +'
> +
>  test_done
> --
> 1.8.5.2.240.g8478abd
>
-- 
Duy
Previous: Nguyễn Thái Ngọc DuyNext: Nguyễn Thái Ngọc Duy
Message 3 of 6 in “git-reset does not seem to respect GIT_WORK_TREE”
  1. Patrick PalkaFeb 14, 2014
  2. reset: setup worktree on --mixedNguyễn Thái Ngọc Duy, Feb 15, 2014
  3. Duy NguyenFeb 15, 2014
  4. reset: optionally setup worktree and refresh index on --mixedNguyễn Thái Ngọc Duy, Feb 16, 2014
  5. Eric SunshineFeb 16, 2014
  6. Patrick PalkaFeb 16, 2014

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.