From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS3215 2.6.0.0/16 X-Spam-Status: No, score=-0.3 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_CSS,URIBL_CSS_A shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by dcvr.yhbt.net (Postfix) with ESMTP id D08711F8C4 for ; Wed, 16 Mar 2022 21:21:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345919AbiCPVWd (ORCPT ); Wed, 16 Mar 2022 17:22:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237814AbiCPVWb (ORCPT ); Wed, 16 Mar 2022 17:22:31 -0400 Received: from pb-smtp2.pobox.com (pb-smtp2.pobox.com [64.147.108.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95196496B2 for ; Wed, 16 Mar 2022 14:21:15 -0700 (PDT) Received: from pb-smtp2.pobox.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id D98801205E0; Wed, 16 Mar 2022 17:21:14 -0400 (EDT) (envelope-from junio@pobox.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=urrt0rug2UKaquXeuWpVDdHri09Y3ngHJcLyl+ 5wVjw=; b=dvV4SN/bJR0qultUvF8BA21M8NFoKhh9TjVR8uELd3mvPKY37aj9Aa tUE9FBzcFj4ffcs+pg6ELWABP2F5e+k0xvWhzvPYOAq5FNzehFCzZ/l76ui7jJx5 5iOlHMDNDK1zh0S+C0lEqzO2JHCnSrrFGXpZm5wW159ujmDZPgCRQ= Received: from pb-smtp2.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id CCD651205DF; Wed, 16 Mar 2022 17:21:14 -0400 (EDT) (envelope-from junio@pobox.com) Received: from pobox.com (unknown [34.82.80.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp2.pobox.com (Postfix) with ESMTPSA id 291301205DE; Wed, 16 Mar 2022 17:21:14 -0400 (EDT) (envelope-from junio@pobox.com) From: Junio C Hamano To: Yaroslav Halchenko Cc: "git@vger.kernel.org" Subject: Re: crash upon "commit removedfile/newfile removedfile" References: Date: Wed, 16 Mar 2022 14:21:11 -0700 In-Reply-To: (Yaroslav Halchenko's message of "Wed, 16 Mar 2022 16:09:44 -0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: 026625D8-A56F-11EC-BDED-CB998F0A682E-77302942!pb-smtp2.pobox.com Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Yaroslav Halchenko 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.