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

Misleading error message on a failed `git mv`

From
AMArthur Milchior <arthur.milchior@gmail.com>
Date
Jan 11, 2023, 04:19 UTC
Message-ID
<CAEcbrFc=R=3aEwEE56EvZSPSV4+RWFxt=hm7csZ7oBTR8BDQzA@mail.gmail.com>

Thanks for git, and happy new year. Here is what I believe to be a bug in an error message

Thank you for filling out a Git bug report!
Please answer the following questions to help us understand your issue.
What did you do before the bug happened? (Steps to reproduce your issue)
git init
touch file
git add file
git mv file folder/file
What did you expect to happen? (Expected behavior)
Either creating folder, or stating that folder does not exists
What happened instead? (Actual behavior)
Error message is
fatal: renaming 'file' failed: No such file or directory
What's different between what you expected and what actually happened?

The error message seems to indicate that file does not exists. It actually exists. The destination directory does not exists and is the one that should be mentionned.

Anything else you want to add:
Please review the rest of the bug report below.
You can delete any lines you don't wish to share.
[System Info]
git version:
git version 2.39.0.314.g84b9a713c41-goog
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
feature: fsmonitor--daemon

uname: Darwin 22.2.0 Darwin Kernel Version 22.2.0: Fri Nov 11 02:03:51 PST 2022; root:xnu-8792.61.2~4/RELEASE_ARM64_T6000 x86_64

compiler info: clang: 13.1.6 (clang-1316.0.21.2.5)
libc info: no libc information available
$SHELL (typically, interactive shell): /bin/bash
[Enabled Hooks]

Regards, Arthur

Next: Jeff King
Message 1 of 4 in “Misleading error message on a failed `git mv`”
  1. Arthur MilchiorJan 11, 2023
  2. Jeff KingJan 11, 2023
  3. Torsten BögershausenJan 11, 2023
  4. Andreas SchwabJan 11, 2023

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.