From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fout-b5-smtp.messagingengine.com (fout-b5-smtp.messagingengine.com [202.12.124.148]) (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 2EF713921ED for ; Fri, 21 Aug 2026 22:20:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.148 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787350860; cv=none; b=MO6sm5XZ7vncaMXSe+9N5nIplQrkjgoWYB5ALG9uaEkxQrVZNRhsCp8XxNKdDymqIBDgzVzNwN9iLePRAR1id4KJtZWAlWoNGEI0gpvB6KDbjbMhNi9f0GBNpCksZoA/6lPO8lKNspteVXa2pmxVPiOj2OHnx8AnHYFFNaiENQM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787350860; c=relaxed/simple; bh=y+BA/hqdwhQednaRW7R3uWGQXl8cHxmlx4ZONHybUIc=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=t6S9qZW3xFSrPnm7HGSDOVXltbr1+Zj3JPgSEMbzvPIESZCcpsUZ531jCkoRIuW6sJ5b09H/7A0MK1N7/FkiZs5eN92fkGUG9fdGXJ9jS8MqnqFjoBqllKJDvHVDuwV9g8xQaMk7GGEod7CVm/IUgnu1pAJn9U5mY8AG0BY83fg= 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=hDodSq84; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=ZhGsv6RO; arc=none smtp.client-ip=202.12.124.148 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="hDodSq84"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="ZhGsv6RO" Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfout.stl.internal (Postfix) with ESMTP id 63B0A1D0011C; Fri, 21 Aug 2026 18:20:58 -0400 (EDT) Received: from phl-frontend-02 ([10.202.2.161]) by phl-compute-05.internal (MEProxy); Fri, 21 Aug 2026 18:20:58 -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=fm2; t=1787350858; x=1787437258; bh=j9lzL4f6pP ZoaW/yOOQfQMQg3iam35iP7eZ3WkwHjis=; b=hDodSq84gJB7YVwGJB3BknjTm/ umkEYezkNzseLMmX8vEcCOhF8b526d7G7IcgYX3co0O5czNVbA4cjRekTF4cZejU WOY4QfIc4i2pOwoCD8BEgGIt+Fc4o7Cibchwc2XwXzrmHeDXXIl7zhgIdopeh9Qu rn9inTa3s4pVXCSx7KuK+lUBy8Ilx7ZPPLbhAoOpxKOKTMMxqLWhfYrenpmAwoBa plUu7azAdmZnyzuGMuZzqY+16Xhrgr7Q9m6hGlGzCQVT1ccorO3/V1q75WjjwT2K YhQ+hglK4ooni7ENLSapX7vSW3b5naK2Lf2pUwty//iqWWGkT9zAm5KCgK7A== 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=fm3; t= 1787350858; x=1787437258; bh=j9lzL4f6pPZoaW/yOOQfQ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je1eLYBIyyQ X-ME-Proxy: Feedback-ID: if26b431b:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 21 Aug 2026 18:20:57 -0400 (EDT) From: Junio C Hamano To: "Yoichi NAKAYAMA via GitGitGadget" Cc: git@vger.kernel.org, Yoichi Nakayama Subject: Re: [PATCH v3] worktree repair: detect relative path in .git file correctly In-Reply-To: (Junio C. Hamano's message of "Fri, 21 Aug 2026 15:02:42 -0700") References: Date: Fri, 21 Aug 2026 15:20:56 -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 Junio C Hamano writes: > Among these three, the last one obviously belongs here. Leaving the > relative path relative was the reason why we wanted to add > read_gitfile_raw() in the first place. > > But moving the other two to here is a bit iffy. The worktree repair > job used to call read_gitfile_gently(), which means it used to > depend on what the first two did for it, namely, to make the > relative path after "gitdir:" from the .git file relative to the > current process to make it usable, and to ensure that the directory > pointed at by .git is indeed a git directory. Is it correct to drop > these from the caller, which now calls read_gitfile_raw() instead? > > IOW, I am not sure if the two functions are split correctly. I > expected that the only two things read_gitfile_gently() would do > after read_gitfile_raw() are (1) upon error, jump to cleanup_return, > and (2) otherwise call strbuf_realpath(). Actually, I take half of that back. If we pretend the leading part of the "path", which could be absolute, the result will lose the relative-ness of the original. Keeping the tweaking of the relative path in read_gitfile_gently() is reasonable. As is_git_directory() needs to be called on a usable path, if the relative path tweaking cannot be done inside read_gitfile_raw(), it cannot check if the directory is is_git_directory(), either. So, the change to setup.c is fine as is. I didn't look at the changes to worktree.c, though. Thanks.