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

Re: [PATCH v2] merge-recursive: restore accidentally dropped setting of path

From
Elijah Newren <newren@gmail.com>
Date
Jun 4, 2019, 22:48 UTC
Message-ID
<CABPp-BFjAfpzDtgN3m9YAgcS+97TUvfZPzpOo3s9Kpn8yuDQ1A@mail.gmail.com>
In-Reply-To
<20190604210754.GT951@szeder.dev>
On Tue, Jun 4, 2019 at 2:07 PM SZEDER Gábor <szeder.dev@gmail.com> wrote:
Show 135 quoted lines
>
> On Tue, Jun 04, 2019 at 01:27:50PM -0700, Elijah Newren wrote:
> > Changes since v1:
> >   * Minor tweaks suggested by SZEDER
>
> > diff --git a/t/t6042-merge-rename-corner-cases.sh b/t/t6042-merge-rename-corner-cases.sh
> > index 09dfa8bd92..3fe2cd91dc 100755
> > --- a/t/t6042-merge-rename-corner-cases.sh
> > +++ b/t/t6042-merge-rename-corner-cases.sh
> > @@ -411,6 +411,124 @@ test_expect_success 'disappearing dir in rename/directory conflict handled' '
> >       )
> >  '
> >
> > +# Test for basic rename/add-dest conflict, with rename needing content merge:
> > +#   Commit O: a
> > +#   Commit A: rename a->b, modifying b too
> > +#   Commit B: modify a, add different b
> > +
> > +test_expect_success 'setup rename-with-content-merge vs. add' '
> > +     test_create_repo rename-with-content-merge-and-add &&
> > +     (
> > +             cd rename-with-content-merge-and-add &&
> > +
> > +             test_seq 1 5 >a &&
> > +             git add a &&
> > +             git commit -m O &&
> > +             git tag O &&
> > +
> > +             git checkout -b A O &&
> > +             git mv a b &&
> > +             test_seq 0 5 >b &&
> > +             git add b &&
> > +             git commit -m A &&
> > +
> > +             git checkout -b B O &&
> > +             echo 6 >>a &&
> > +             echo hello world >b &&
> > +             git add a b &&
> > +             git commit -m B
> > +     )
> > +'
> > +
> > +test_expect_success 'handle rename-with-content-merge vs. add' '
> > +     (
> > +             cd rename-with-content-merge-and-add &&
> > +
> > +             git checkout A^0 &&
> > +
> > +             test_must_fail git merge -s recursive B^0 >out &&
> > +             test_i18ngrep "CONFLICT (rename/add)" out &&
> > +
> > +             git ls-files -s >out &&
> > +             test_line_count = 2 out &&
> > +             git ls-files -u >out &&
> > +             test_line_count = 2 out &&
> > +             # Also, make sure both unmerged entries are for "b"
> > +             git ls-files -u b >out &&
> > +             test_line_count = 2 out &&
> > +             git ls-files -o >out &&
> > +             test_line_count = 1 out &&
> > +
> > +             test_path_is_missing a &&
> > +             test_path_is_file b &&
> > +
> > +             test_seq 0 6 >tmp &&
> > +             git hash-object tmp >expect &&
> > +             git rev-parse B:b >>expect &&
> > +             git rev-parse >actual  \
> > +                     :2:b    :3:b   &&
> > +             test_cmp expect actual &&
> > +
> > +             # Test that the two-way merge in b is as expected
> > +             git cat-file -p :2:b >>ours &&
> > +             git cat-file -p :3:b >>theirs &&
> > +             >empty &&
> > +             test_must_fail git merge-file \
> > +                     -L "HEAD" \
> > +                     -L "" \
> > +                     -L "B^0" \
> > +                     ours empty theirs &&
> > +             test_cmp ours b
>
> This one is OK.
>
> > +     )
> > +'
> > +
> > +test_expect_success 'handle rename-with-content-merge vs. add, merge other way' '
> > +     (
> > +             cd rename-with-content-merge-and-add &&
> > +
> > +             git reset --hard &&
> > +             git clean -fdx &&
> > +
> > +             git checkout B^0 &&
> > +
> > +             test_must_fail git merge -s recursive A^0 >out &&
> > +             test_i18ngrep "CONFLICT (rename/add)" out &&
> > +
> > +             git ls-files -s >out &&
> > +             test_line_count = 2 out &&
> > +             git ls-files -u >out &&
> > +             test_line_count = 2 out &&
> > +             # Also, make sure both unmerged entries are for "b"
> > +             git ls-files -u b >out &&
> > +             test_line_count = 2 out &&
> > +             git ls-files -o >out &&
> > +             test_line_count = 1 out &&
> > +
> > +             test_path_is_missing a &&
> > +             test_path_is_file b &&
> > +
> > +             test_seq 0 6 >tmp &&
> > +             git rev-parse B:b >expect &&
> > +             git hash-object tmp >>expect &&
> > +             git rev-parse >actual  \
> > +                     :2:b    :3:b   &&
> > +             test_cmp expect actual &&
> > +
> > +             # Test that the two-way merge in b is as expected
> > +             git cat-file -p :2:b >>ours &&
> > +             git cat-file -p :3:b >>theirs &&
> > +             >empty &&
> > +             test_must_fail git merge-file \
> > +                     -L "HEAD" \
> > +                     -L "" \
> > +                     -L "A^0" \
> > +                     ours empty theirs &&
> > +             git hash-object b >actual &&
> > +             git hash-object ours >expect &&
> > +             test_cmp ours b
>
> Here, however, you only changed what test_cmp looks at, but still kept
> the two 'git hash-object' invocations, and their output will never be
> looked at.
Whoops, indeed.
Junio: it looks like you've already deleted the two lines in your pu
pushout with your 'SQUASH???' commit at the tip of
en/merge-directory-renames-fix; that's the exact same change I would
make.  Would you like me to resend this patch with the two lines
removed, or do you just want to squash in your commit that does the
same?

Thanks, Elijah

Previous: Junio C HamanoNext: Bhaskar Chowdhury
Message 12 of 14 in “[ANNOUNCE] Git v2.22.0-rc3”
  1. Junio C HamanoJun 3, 2019
  2. Ben HumphreysJun 4, 2019
  3. SZEDER GáborJun 4, 2019
  4. merge-recursive: restore accidentally dropped setting of pathElijah Newren, Jun 4, 2019
  5. Ben HumphreysJun 4, 2019
  6. SZEDER GáborJun 4, 2019
  7. Elijah NewrenJun 4, 2019
  8. Elijah NewrenJun 4, 2019
  9. merge-recursive: restore accidentally dropped setting of pathElijah Newren, Jun 4, 2019
  10. SZEDER GáborJun 4, 2019
  11. Junio C HamanoJun 4, 2019
  12. Elijah NewrenJun 4, 2019
  13. Bhaskar ChowdhuryJun 4, 2019
  14. Git for Windows v2.22.0-rc3, was Re: [ANNOUNCE] Git v2.22.0-rc3Johannes Schindelin, Jun 4, 2019

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.