From: Junio C Hamano <gitster@pobox.com>
To: Yaroslav Halchenko <yoh@onerussian.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: crash upon "commit removedfile/newfile removedfile"
Date: Wed, 16 Mar 2022 14:21:11 -0700 [thread overview]
Message-ID: <xmqqv8wdk308.fsf@gitster.g> (raw)
In-Reply-To: <YjJECDbAV0DXUTMB@lena.dartmouth.edu> (Yaroslav Halchenko's message of "Wed, 16 Mar 2022 16:09:44 -0400")
Yaroslav Halchenko <yoh@onerussian.com> writes:
> + rm p1
> + mkdir p1
> + touch p1/p2
> + git add p1/p2
> + git commit -m 2 p1/p2 p1
> error: 'p1' does not have a commit checked out
> fatal: updating files failed
Interesting. In this toy example, all the user wants to do is to
remove p1 and add p1/p2, so an obvious workaround is to just say
"git commit" without any pathspec. But in real life, there may
be cases where the user has already staged more than what the first
commit wants to have in the index, and want to limit it to a subset
by using a pathspec.
I _think_ the response from the command, seeing that the path 'p1'
that was previously a file got turned into a directory, is that it
is guessing that you are trying to replace 'p1' with a submodule,
but because 'p1' is not yet a repository, it cannot 'git add' the
commit from the 'p1' submodule to include it in the commit. The
guess is wrong and it is a bug that it does not notice it---it knows
the user added 'p1/p2' to the index, so 'p1' clearly is a mere
subdirectory and not a submodule, so it could have known better than
saying "does not have a commit checked out".
By the way, program exit with non-zero status, with "fatal: message",
is a controlled error exit, not a crash. Please reserve the word
"crash" to describe uncontrolled program death.
Thanks.
prev parent reply other threads:[~2022-03-16 21:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-16 20:09 crash upon "commit removedfile/newfile removedfile" Yaroslav Halchenko
2022-03-16 21:21 ` Junio C Hamano [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqv8wdk308.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=yoh@onerussian.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).