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

Re: [PATCH 1/3] t6423: test directory renames causing rename-to-self

From
Elijah Newren <newren@gmail.com>
Date
Jun 30, 2021, 16:33 UTC
Message-ID
<CABPp-BFsXWNzS-6JSM7rYN0LLtTmT3UsgG7aTUmpSq6K2jHyFg@mail.gmail.com>
In-Reply-To
<c088028d-3045-70ce-19e9-f3ffc9c57c98@gmail.com>
On Tue, Jun 29, 2021 at 5:50 AM Derrick Stolee <stolee@gmail.com> wrote:
Show 42 quoted lines
>
> On 6/26/2021 1:05 PM, Elijah Newren via GitGitGadget wrote:
> > From: Elijah Newren <newren@gmail.com>
> >
> > Directory rename detection can cause transitive renames, e.g. if the two
> > different sides of history each do one half of:
> >     A/file -> B/file
> >     B/     -> C/
> > then directory rename detection transitively renames to give us C/file.
> > Since the default for merge.directoryRenames is conflict, this results
> > in an error message saying it is unclear whether the file should be
> > placed at B/file or C/file.
> >
> > What if C/ is A/, though?
>
> This case seems interesting, but somehow missing from the test cases
> below. Each of those cases include renaming up or down the directory
> hierarchy instead of doing a sideways rename.
>
> > +# Testcase 12i, Directory rename causes rename-to-self
> > +#   Commit O: source/{subdir/foo, bar, baz_1}
> > +#   Commit A: source/{foo, bar, baz_1}
> > +#   Commit B: source/{subdir/{foo, bar}, baz_2}
> > +#   Expected: source/{foo, bar, baz_2}, with conflicts on
> > +#                source/bar vs. source/subdir/bar
>
> This test goes deeper.
>
> > +# Testcase 12j, Directory rename to root causes rename-to-self
> > +#   Commit O: {subdir/foo, bar, baz_1}
> > +#   Commit A: {foo, bar, baz_1}
> > +#   Commit B: {subdir/{foo, bar}, baz_2}
> > +#   Expected: {foo, bar, baz_2}, with conflicts on bar vs. subdir/bar
>
> This test goes higher.
>
> Does the problematic case not hit when going out to the side, such
> as "with conflicts on subdir/bar vs otherdir/bar"?
>
> If so, then _maybe_ the commit message could indicate this is an
> omission on purpose. If not, then maybe a third test should be
> added?

The only special case in the code is renaming to the root directory, so I didn't think of extending beyond two cases. However, while adding more testcases doesn't exercise the current incarnation of the code further, it's pretty easy to add another and it certainly doesn't hurt. I'll resubmit with a third testcase.

Previous: Derrick StoleeNext: Elijah Newren via GitGitGadget
Message 4 of 12 in “Fix bugs from interesting renaming pairs: one side renames A/file -> B/file, the other B/ -> A/”
  1. 0/3 Fix bugs from interesting renaming pairs: one side renames A/file -> B/file, the other B/ -> A/Elijah Newren via GitGitGadget, Jun 26, 2021
  2. 1/3 t6423: test directory renames causing rename-to-selfElijah Newren via GitGitGadget, Jun 26, 2021
  3. Derrick StoleeJun 29, 2021
  4. Elijah NewrenJun 30, 2021
  5. 2/3 merge-ort: ensure we consult df_conflict and path_conflictsElijah Newren via GitGitGadget, Jun 26, 2021
  6. 3/3 merge-recursive: handle rename-to-self caseElijah Newren via GitGitGadget, Jun 26, 2021
  7. Junio C HamanoJun 29, 2021
  8. Derrick StoleeJun 29, 2021
  9. 0/3 Fix bugs from interesting renaming pairs: one side renames A/file -> B/file, the other B/ -> A/Elijah Newren via GitGitGadget, Jun 30, 2021
  10. 1/3 t6423: test directory renames causing rename-to-selfElijah Newren via GitGitGadget, Jun 30, 2021
  11. 2/3 merge-ort: ensure we consult df_conflict and path_conflictsElijah Newren via GitGitGadget, Jun 30, 2021
  12. 3/3 merge-recursive: handle rename-to-self caseElijah Newren via GitGitGadget, Jun 30, 2021

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.