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-Status: No, score=-3.7 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,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 51D531F55B for ; Tue, 9 Jun 2020 17:38:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728848AbgFIRiX (ORCPT ); Tue, 9 Jun 2020 13:38:23 -0400 Received: from mail-wr1-f53.google.com ([209.85.221.53]:34112 "EHLO mail-wr1-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726100AbgFIRiW (ORCPT ); Tue, 9 Jun 2020 13:38:22 -0400 Received: by mail-wr1-f53.google.com with SMTP id r7so22300225wro.1 for ; Tue, 09 Jun 2020 10:38:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Flyu1QJaap3tt8L0GjAltyPmgoFliun5PzJ7RwmjtIw=; b=TVtoG2IZ98dYrgC6a5ws9BQ7GaaJqOVxDiHzR2R8Jsbs4jtAEn1IJwYJ8HW3sXn1ld vQhKM9yIQ28lkYVEc5oMXZ/qL0YxTAMXrFQbrme7tyae20SjvzF2vaDdOlHTBalN9RTp 3ZQlR8mgmzpl9HZEipsslcmaP+xRZdPRAeQQzmkrF7YPlfMLwqp78XD1HHn8eL8Vn55i kWumzhxey6C5RjWRZf04wS82gUpnIPKautCy8Q/LawC1U/Xf9TvOhFoMtgN1I3rZqbqh 8r4rss+f2PwrTzM2zdzV2fmmxMHQ44KGnXKY7fp7RG4Phc+k9ry8KFEhWpiCecP6cO1u NHMw== X-Gm-Message-State: AOAM532UpM4sOyGXXLnfuFsmssrGR8dmx4xGbd7EZAhl7bf5Oh8YLrbe KSjwtXQlfkz9lh2dy4MCCZHwZ2cjyc0R1/pG06TspbT1 X-Google-Smtp-Source: ABdhPJwOx62hkeLF3yQECZQfvy5vK/D0YbSfPprVShnk+SwSTHGa5mT8q0IttY+NnQIhFaowpQDugLYFWGphGddSBIE= X-Received: by 2002:adf:fd48:: with SMTP id h8mr6098295wrs.226.1591724300787; Tue, 09 Jun 2020 10:38:20 -0700 (PDT) MIME-Version: 1.0 References: <20200608062356.40264-1-sunshine@sunshineco.com> <20200608062356.40264-7-sunshine@sunshineco.com> In-Reply-To: From: Eric Sunshine Date: Tue, 9 Jun 2020 13:38:09 -0400 Message-ID: Subject: Re: [PATCH 6/8] worktree: prune linked worktree referencing main worktree path To: Junio C Hamano Cc: Git List , Duy Nguyen , =?UTF-8?Q?Jonathan_M=C3=BCller?= , Shourya Shukla Content-Type: text/plain; charset="UTF-8" Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Mon, Jun 8, 2020 at 5:59 PM Junio C Hamano wrote: > Eric Sunshine writes: > > + /* paths same; main worktee (util==0) sorts above all others */ > > And the reason why prune_cmp() tiebreaks entries with the same .string > (i.e. "path") so that the primary worktree comes early is because ... > > > prune_dups(&kept); > > ... deduping is done by later entries with the same path as an > earlier one, keeping the earliest one among the ones with the same > path. We want the primary worktree to survive, or we'd be in deep > yoghurt. > > That reason is more important to comment in prune_cmp() than the > hint that !util is for primary worktree. IOW, "why do we sort the > primary one early?" is more important than "by inspecting .util > field, we sort primary one early" (the latter lacks "why"). I'll update the comment to explain this. Thanks for the review.