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: AS53758 23.128.96.0/24 X-Spam-Status: No, score=-4.6 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id B4CB11F953 for ; Mon, 29 Nov 2021 23:03:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236763AbhK2XGg (ORCPT ); Mon, 29 Nov 2021 18:06:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236735AbhK2XGA (ORCPT ); Mon, 29 Nov 2021 18:06:00 -0500 Received: from mail-ot1-x333.google.com (mail-ot1-x333.google.com [IPv6:2607:f8b0:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11B14C05814A for ; Mon, 29 Nov 2021 11:42:52 -0800 (PST) Received: by mail-ot1-x333.google.com with SMTP id h19-20020a9d3e53000000b0056547b797b2so27041721otg.4 for ; Mon, 29 Nov 2021 11:42:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=fc0cmmhgGlKUsZV8WZZrtDQIXypUL0JrRSd2dnt2zaY=; b=mWdoCvyPyOdVPVDzTKq9LtWSKZzwJnx0pe3rvWkf1HC8Wv6NLopUjRBURzX+7cXnYR MyzMOarDKeKlMux8sCUVZLuOixnzGdt3nCOdlmSaYpU140WNxJFTKmFFQRKVQmcAMsQB MM85NOQXswRaBaLbXz516CfNOl5aUiTNUz7i5kr2TiH3XHeqeMumX8jiWq4YZwZeHymZ tVYsDbMbo3jVNk4KQpe5M8MxYQh3I4NncI2kyhtOhKNTXdnBGu5Mp8N1cTao047+2HMK MbkCIbIG3mV1md1c1CCcNwCwqMOixQpxzVtfAnkjVuJ4coUnNqUy+qlfwotWZJcM2CQE I0og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=fc0cmmhgGlKUsZV8WZZrtDQIXypUL0JrRSd2dnt2zaY=; b=T1PhjGD7ZA5V4ahoCRH0hhZ+LJdvNqTg+RgtVyHm7f+c1wGuGOMRVFhvEXfHaYZoIq sJVLl8yZWACuvvVuSuiUbp1F4VcIObmUHh+NJulGob+c/V2rTbhuJ20kV+/1rLpfsY38 lFYKw4eVwJwwM60eCfRDM5m2Nis/wmDq3TKGtQSs76HgsXfxWYQgv2PQ5HSThXfqpews EAKUglqUwrg9JRGvsWshTzzpcJpTLuZ0qbgc3ETQF7uF1SZtp4pNhaxNpt93zX5QoGtj wtON/QPADFVB1hWfTMOoqXJLPZlJeYc2A+vI+BmYGYR5hWCpUaUDaD4UrPuxKi2UeN60 JISg== X-Gm-Message-State: AOAM533iRM1UWUMfLCqmv0SzAp02WJASw49h83vQwHOSiNbyIuuAt3i8 xhU9xV8ks3bmS3W1Qj9VnPY= X-Google-Smtp-Source: ABdhPJzAiy2jnts/VbTdtLKxxMt7CCEAVbjof5ZTeqA8ObCEeUcG51Gxn4fw30bxqhSiCIpRITGLTw== X-Received: by 2002:a9d:6482:: with SMTP id g2mr45135141otl.57.1638214971189; Mon, 29 Nov 2021 11:42:51 -0800 (PST) Received: from ?IPV6:2600:1700:e72:80a0:3085:654c:eb81:848b? ([2600:1700:e72:80a0:3085:654c:eb81:848b]) by smtp.gmail.com with ESMTPSA id g1sm2362482ooq.2.2021.11.29.11.42.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 29 Nov 2021 11:42:50 -0800 (PST) Message-ID: Date: Mon, 29 Nov 2021 14:42:48 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.3.2 Subject: Re: [PATCH v3 07/11] rebase: do not attempt to remove startup_info->original_cwd Content-Language: en-US To: Elijah Newren Cc: Elijah Newren via GitGitGadget , Git Mailing List , Jeff King , =?UTF-8?Q?Ren=c3=a9_Scharfe?= , =?UTF-8?B?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= , Glen Choo , Philip Oakley References: <39b1f3a225ec74a79320503eff04ba47ae4259fd.1637966463.git.gitgitgadget@gmail.com> <7d90bf61-59c6-045e-1987-81d50454c260@gmail.com> From: Derrick Stolee In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On 11/29/2021 2:22 PM, Elijah Newren wrote: > On Mon, Nov 29, 2021 at 9:50 AM Derrick Stolee wrote: >> >> On 11/26/2021 5:40 PM, Elijah Newren via GitGitGadget wrote: >>> cmd.git_cmd = 1; >>> >>> + if (startup_info->original_cwd && >>> + !is_absolute_path(startup_info->original_cwd)) >>> + cmd.dir = startup_info->original_cwd; >> >> I was initially confused by the "!is_absolute_path()" because >> it seemed to me like it would be natural to store an absolute >> path there, but I see this comment in patch 2: >> >> + * For convience, we would like to have the path relative to the >> + * worktree instead of an absolute path. >> >> So it seems that we won't store it as an absolute path. Is >> there any value in this condition, then? > > Good catch. This is leftover from an earlier round; I'll remove it. > From stash too. > >> This assignment of cmd.dir to the relative path has a lot >> of baked-in knowledge of this variable _and_ the current >> state (Git chdir()'d to the root of the worktree). If the >> path is always relative, then it should be a BUG() if we >> see an absolute path. Also, it seems like we would want >> cmd.dir to be a concatenation of the worktree root and the >> original_cwd. >> >> Or perhaps I'm being overly cautious and this could all be >> resolved with a comment about the expected state of the >> working directory and original_cwd. The tests will catch if >> any of those expectations change. > > Yeah, with the extra condition in there I should have added a good > explanation about why I had it in there. But I think a simple > > if (startup_info->original_cwd) > cmd.dir = startup_info->original_cwd; > > should be good enough? Or do you still want a comment for that? This is the code I would expect to see. No comment needed. Thanks, -Stolee