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

Re: [PATCH v4 0/2] mv: report missing destination leading directory

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 26, 2026, 23:29 UTC
Message-ID
<xmqqcxw9tjnb.fsf@gitster.g>
In-Reply-To
<pull.2356.v4.git.git.1785097071.gitgitgadget@gmail.com>

"Lucas Zamboni Orioli via GitGitGadget" <gitgitgadget@gmail.com> writes:

Show 6 quoted lines
> Changes in v4:
>
>  * reverted to lstat and added has_symlink_leading_path() to refuse a
>    destination that goes through a symbolic link, independent of the link
>    target, per Junio C Hamano's point that Git tracks symlinks and must not
>    follow them here

I'll review the series tomorrow, but the use of the helper function has_symlink_leading_path() in other contexts like 'git apply' rings a bell. I agree the problem you face is exactly the issue the helper function aims to address.

Show 5 quoted lines
>  * added new "destination is beyond a symbolic link" message
>  * added tests: symlink as immediate parent and as intermediate component,
>    symlink at the destination, -f does not bypass the symlink refusal, and a
>    regression test that a move through a symlink no longer corrupts the
>    index (see the reproduction reported on the list)
Sounds good.

When 'y' is a symbolic link to some directory (say, 'a/b'), we do not want 'git mv x y' to create 'y/x' at the same time we have 'y' as a symbolic link. It may be OK if the result has 'a/b/x' (a file in a directory) and 'y' (a symbolic link), but I think that would be more confusing than it is worth.

Thanks.
Previous: Lucas Zamboni OrioliNext: Lucas Zamboni Orioli via GitGitGadget
Message 24 of 28 in “mv: report missing destination leading directory”
  1. mv: report missing destination leading directoryLucas Zamboni Orioli via GitGitGadget, Jul 15, 2026
  2. Ben KnobleJul 15, 2026
  3. Lucas Zamboni OrioliJul 22, 2026
  4. 0/2 mv: report missing destination leading directoryLucas Zamboni Orioli via GitGitGadget, Jul 23, 2026
  5. 1/2 mv: name both source and destination when rename failsLucas Zamboni Orioli via GitGitGadget, Jul 23, 2026
  6. Junio C HamanoJul 23, 2026
  7. 2/2 mv: check for missing destination directory before renamingLucas Zamboni Orioli via GitGitGadget, Jul 23, 2026
  8. Junio C HamanoJul 23, 2026
  9. Junio C HamanoJul 23, 2026
  10. Lucas Zamboni OrioliJul 23, 2026
  11. Junio C HamanoJul 23, 2026
  12. Junio C HamanoJul 23, 2026
  13. Junio C HamanoJul 26, 2026
  14. Lucas Zamboni OrioliJul 26, 2026
  15. 0/2 mv: report missing destination leading directoryLucas Zamboni Orioli via GitGitGadget, Jul 23, 2026
  16. 1/2 mv: name both source and destination when rename failsLucas Zamboni Orioli via GitGitGadget, Jul 23, 2026
  17. 2/2 mv: check for missing destination directory before renamingLucas Zamboni Orioli via GitGitGadget, Jul 23, 2026
  18. Pablo SabaterJul 26, 2026
  19. 0/2 mv: report missing destination leading directoryLucas Zamboni Orioli via GitGitGadget, Jul 26, 2026
  20. 1/2 mv: name both source and destination when rename failsLucas Zamboni Orioli via GitGitGadget, Jul 26, 2026
  21. 2/2 mv: reject a destination whose leading path is missing or a symlinkLucas Zamboni Orioli via GitGitGadget, Jul 26, 2026
  22. Junio C HamanoJul 27, 2026
  23. Lucas Zamboni OrioliJul 30, 2026
  24. Junio C HamanoJul 26, 2026
  25. 0/2 mv: report missing destination leading directoryLucas Zamboni Orioli via GitGitGadget, Jul 30, 2026
  26. 1/2 mv: name both source and destination when rename failsLucas Zamboni Orioli via GitGitGadget, Jul 30, 2026
  27. 2/2 mv: reject a destination whose leading path is missing or a symlinkLucas Zamboni Orioli via GitGitGadget, Jul 30, 2026
  28. Junio C HamanoJul 30, 2026

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.