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

Re: [PATCH 1/3] t7405: add a file/submodule conflict

From
Stefan Beller <sbeller@google.com>
Date
Jul 9, 2018, 21:11 UTC
Message-ID
<CAGZ79kZ0xyHMT8SngGCUSAEf31NXdPvzkvdaPb8Khm27xRjgTg@mail.gmail.com>
In-Reply-To
<20180707204404.7208-2-newren@gmail.com>
On Sat, Jul 7, 2018 at 1:44 PM Elijah Newren <newren@gmail.com> wrote:
Show 45 quoted lines
>
> In the case of a file/submodule conflict, although both cannot exist at
> the same path, we expect both to be present somewhere for the user to be
> able to resolve the conflict with.  Add a testcase for this.
>
> Signed-off-by: Elijah Newren <newren@gmail.com>
> ---
>  t/t7405-submodule-merge.sh | 56 ++++++++++++++++++++++++++++++++++++++
>  1 file changed, 56 insertions(+)
>
> diff --git a/t/t7405-submodule-merge.sh b/t/t7405-submodule-merge.sh
> index 7bfb2f498..95fd05d83 100755
> --- a/t/t7405-submodule-merge.sh
> +++ b/t/t7405-submodule-merge.sh
> @@ -279,4 +279,60 @@ test_expect_success 'recursive merge with submodule' '
>          grep "$(cat expect3)" actual > /dev/null)
>  '
>
> +# File/submodule conflict
> +#   Commit O: <empty>
> +#   Commit A: path (submodule)
> +#   Commit B: path
> +#   Expected: path/ is submodule and file contents for B's path are somewhere
> +
> +test_expect_success 'setup file/submodule conflict' '
> +       test_create_repo file-submodule &&
> +       (
> +               cd file-submodule &&
> +
> +               git commit --allow-empty -m O &&
> +
> +               git branch A &&
> +               git branch B &&
> +
> +               git checkout B &&
> +               echo contents >path &&
> +               git add path &&
> +               git commit -m B &&
> +
> +               git checkout A &&
> +               test_create_repo path &&
> +               (
> +                       cd path &&
> +
> +                       echo hello >world &&
    test_commit -C path &&

or do we need a dirty submodule specifically? If so what is important, the untracked file or would changes in the index be sufficient?

> +                       git add world &&

when observing this one in verbose mode , you may be asked to use 'git submodule add' instead https://github.com/git/git/blob/master/builtin/add.c#L323

> +                       git commit -m "submodule"

Not sure if we'd need the shell it is only test_commit, the [submodule] add and commit, so maybe we can get away with 3 times -C ?

> +test_expect_failure 'file/submodule conflict' '
Which part fails here?
Show 16 quoted lines
> +       test_when_finished "git -C file-submodule reset --hard" &&
> +       (
> +               cd file-submodule &&
> +
> +               git checkout A^0 &&
> +               test_must_fail git merge B^0 >out 2>err &&
> +
> +               git ls-files -s >out &&
> +               test_line_count = 2 out &&
> +               git ls-files -u >out &&
> +               test_line_count = 2 out &&
> +
> +               # path/ is still a submodule
> +               test_path_is_dir path/.git &&
> +
> +               echo Checking if contents from B:path showed up anywhere &&
This could be a comment instead?
> +               grep -q content * 2>/dev/null
Ah that is why we needed the specific echo above.

Sorry for being dense here, I am not quite following the last part of the test, as it is unclear what ought to fail in this test.

Thanks, Stefan

Previous: Elijah NewrenNext: Elijah Newren
Message 3 of 12 in “Add testcases showing suboptimal submodule/path conflict handling”
  1. 0/3 Add testcases showing suboptimal submodule/path conflict handlingElijah Newren, Jul 7, 2018
  2. 1/3 t7405: add a file/submodule conflictElijah Newren, Jul 7, 2018
  3. Stefan BellerJul 9, 2018
  4. Elijah NewrenJul 10, 2018
  5. Stefan BellerJul 10, 2018
  6. Elijah NewrenJul 10, 2018
  7. 3/3 t7405: verify 'merge --abort' works after submodule/path conflictsElijah Newren, Jul 7, 2018
  8. 2/3 t7405: add a directory/submodule conflictElijah Newren, Jul 7, 2018
  9. 0/3 Add testcases showing suboptimal submodule/path conflict handlingElijah Newren, Jul 11, 2018
  10. 1/3 t7405: add a file/submodule conflictElijah Newren, Jul 11, 2018
  11. 2/3 t7405: add a directory/submodule conflictElijah Newren, Jul 11, 2018
  12. 3/3 t7405: verify 'merge --abort' works after submodule/path conflictsElijah Newren, Jul 11, 2018

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.