From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fout-b2-smtp.messagingengine.com (fout-b2-smtp.messagingengine.com [202.12.124.145]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 735F5348465 for ; Thu, 23 Jul 2026 17:36:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.145 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784828165; cv=none; b=DbPHRGj4cplWoj84GwlfA5GdZ+n2xTevztO16ZDfli2edDsalBHCAW8Gz/EioLg+XyFmBI/Qxma3UY8ix9GPUbJdXieopkcmRT7tPojzKxuFUrkI2MtbZgGd0FYMndnO5gZB+D9UcrwGpyxfCQZj7Sn6UNubLLujGlpDjIvJptA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784828165; c=relaxed/simple; bh=EXKMvn5AY88PpCcQfnOMEZFF7se/6eZIUUY2CCd99o0=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=H3a52GWSLBlxaUv/83JkgAQddq4d5JCzJ3O8qU/+063bfP+IidzcdT3skJM+wdS8J5jWEGjFbsPttQVHWzz6Pu4WUWPda8RHcldndVKRr67oZf1huuZJclf04dLVHzlXYQon2qjeabzz3l4m6gS1gPgTCRiGra5TcWjElNh31OE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com; spf=pass smtp.mailfrom=pobox.com; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b=w1e0Wnmm; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=Sh2e1Y8v; arc=none smtp.client-ip=202.12.124.145 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pobox.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b="w1e0Wnmm"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="Sh2e1Y8v" Received: from phl-compute-03.internal (phl-compute-03.internal [10.202.2.43]) by mailfout.stl.internal (Postfix) with ESMTP id A43471D000D7; Thu, 23 Jul 2026 13:36:02 -0400 (EDT) Received: from phl-frontend-02 ([10.202.2.161]) by phl-compute-03.internal (MEProxy); Thu, 23 Jul 2026 13:36:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pobox.com; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1784828162; x=1784914562; bh=sxF+Pm8qVT hHUGhnTvyPBTIec7SGDmqJUWjqswhr/so=; b=w1e0Wnmm7vM5WXWtMMqGAmKW5g zbX2Yr8asZ2CgXc1je1oMFuf4GhmHZ6cwXq5qrBoHYD9KLGHoHvNdMyU61fLDSNZ lbiT3S0GVm8DYX/JtbTdn5eU9UzX9OQPrHaAmt70YaM5rqscBtJjfaDlh7JqU3xf FLgakQf1PG4AOlOxFSl46Iz/nQV8ZdN2s+NPWasP6RU2hLd+Uw+8S8CIN+PsZwsh ZRU41DQ1wdbUqf2vtx/jqdv0nGtzptPNMU+lTNjAuBk5RFyvhDjh7k/giymbP7b0 1as3D0e4JjY/sJAD48qTonjyFBx45+O6g2J8DeI0KudSyNBFv7PscnZwx/yA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1784828162; x=1784914562; bh=sxF+Pm8qVThHUGhnTvyPBTIec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K+WBrRw X-ME-Proxy: Feedback-ID: if26b431b:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 23 Jul 2026 13:36:02 -0400 (EDT) From: Junio C Hamano To: "Lucas Zamboni Orioli via GitGitGadget" Cc: git@vger.kernel.org, Ben Knoble , Lucas Zamboni Orioli Subject: Re: [PATCH v2 1/2] mv: name both source and destination when rename fails In-Reply-To: <0d67da588bc86c5257ce366903ae58e171159b8b.1784812390.git.gitgitgadget@gmail.com> (Lucas Zamboni Orioli via GitGitGadget's message of "Thu, 23 Jul 2026 13:13:09 +0000") References: <0d67da588bc86c5257ce366903ae58e171159b8b.1784812390.git.gitgitgadget@gmail.com> Date: Thu, 23 Jul 2026 10:36:00 -0700 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain "Lucas Zamboni Orioli via GitGitGadget" writes: > From: Lucas Zamboni Orioli > > When "git mv" fails at the rename(2) syscall, the error is reported > with die_errno() using only the source path: > > fatal: renaming 'src' failed: No such file or directory > > rename(2) returns ENOENT both when the source does not exist and when > a directory component of the destination does not exist, and errno > does not distinguish the two. Reporting only the source therefore > misleads the user in the latter case: for > > git mv a/file b/no-such-dir/file > > the message blames 'a/file', which exists, and gives no hint that > 'b/no-such-dir/' is the missing part. > > Inspecting the paths again after the failure to determine which one is > at fault would be racy, since either could appear or disappear between > the rename(2) and the follow-up check. Instead, simply name both the > source and the destination in the message and let the reader see which > one is wrong: > > fatal: renaming 'a/file' to 'b/no-such-dir/file' failed: > No such file or directory > > Signed-off-by: Lucas Zamboni Orioli > --- > builtin/mv.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/builtin/mv.c b/builtin/mv.c > index a82fc97a19..35e504484a 100644 > --- a/builtin/mv.c > +++ b/builtin/mv.c > @@ -549,7 +549,7 @@ remove_entry: > rename(src, dst) < 0) { > if (ignore_errors) > continue; > - die_errno(_("renaming '%s' failed"), src); > + die_errno(_("renaming '%s' to '%s' failed"), src, dst); > } > if (submodule_gitfiles[i]) { > if (!update_path_in_gitmodules(src, dst)) Makes sense.