From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61136C07E99 for ; Fri, 9 Jul 2021 16:38:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 45105613B2 for ; Fri, 9 Jul 2021 16:38:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229617AbhGIQlJ convert rfc822-to-8bit (ORCPT ); Fri, 9 Jul 2021 12:41:09 -0400 Received: from elephants.elehost.com ([216.66.27.132]:53622 "EHLO elephants.elehost.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229491AbhGIQlI (ORCPT ); Fri, 9 Jul 2021 12:41:08 -0400 X-Virus-Scanned: amavisd-new at elehost.com X-Amavis-Alert: BAD HEADER SECTION, Header line longer than 998 characters: References: To: "'Felipe Contreras'" , "'Martin'" , "'Sergey Organov'" Cc: "'Junio C Hamano'" , References: <7870a0ad-8fa1-9dbd-1978-1f44ec6970c5@mfriebe.de> <87wnqaclz8.fsf@osv.gnss.ru> <60e5f3981de5f_301437208bc@natae.notmuch> <87bl7d3l8r.fsf@osv.gnss.ru> <60e61bbd7a37d_3030aa2081a@natae.notmuch> <877di13hhe.fsf@osv.gnss.ru> <60e67389a4adc_306ac1208fd@natae.notmuch> <4057b3ac-a77c-0d5f-d3f4-ad781754aae4@mfriebe.de> <60e736e72da68_30939020850@natae.notmuch> <155308af-42ad-b044-fb37-676251a9b7e1@mfriebe.de> <60e762243aab1_30a7b02089@natae.notmuch> <2b85a7eb-d0be-65e7-ecbb-1750abf53e53@mfriebe.de> <60e79c31aaa72_30b8a4208c1@natae.notmuch> <084a355e-95cd-5c84-2fa5-a901da3e0e49@mfriebe.de> <60e8666c8707f_2153208c0@natae.notmuch> <57f316cb-850d-706a-592b-4376f240e032@mfriebe.de> <60e8776cdc4! 55_215320852@natae.notm uch> In-Reply-To: <60e8776cdc455_215320852@natae.notmuch> Subject: RE: switch requires --detach [[Re: What actually is a branch]] Date: Fri, 9 Jul 2021 12:38:13 -0400 Message-ID: <008701d774e0$d3220f40$79662dc0$@nexbridge.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8BIT X-Mailer: Microsoft Outlook 16.0 Content-Language: en-ca Thread-Index: AQG1KAevj2V/mUIvxxIGRxMU4f6cSgHNc5jFAjTtjSwCxG8/3gIw1UB7ANvKppIByR6BtgIp2jhRAoge/jICUtMiGgNdPCyBAXcGyekC6r1PuQEPIOoLAgN4kKQCG7mQzwKSP20gAh9jApcC8nDl5AL6SEKcAbGTtdkAx5RDRAIXpOPUAlb1iiep9soDYA== Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On July 9, 2021 12:21 PM, Felipe Contreras wrote: >Martin wrote: >> >> On 09/07/2021 17:08, Felipe Contreras wrote: >> > and the fact that >> > `git switch` expects branches is one of the things that bothers me >> > about it. >> >> Ah, good point. >> >> I would word it differently though. >> "git switch forces the use of --detach if switching to a non branch" >> >> Bit of a twist. >> It's a nice safety for beginners. I remember when I started, I kept >> ending up detached. And I had no idea what to do next. > >Yes, and that's a good thing, but there's no need to cripple advaned users. > >> But once you are a bit more experienced the need to add that option >> can be bothersome. >> It's not common in my workflow, but I can see that it can be an issue. >> >> So how to remedy? >> >> - Drop the option / Make it default? > >No. As you noted it has value for beginners. > >> - add --allow-detach and git config switch.detach allow ? > >That's a good option, but another one would be to have a core.advanced mode, you turn it on if you are an advanced user. > >> I don't really have a preference. >> >> I think its a nice protection, but even without it, the warning on >> entering detached HEAD state is pretty good. > >That warning olny appears with `git checkout`, not with `git switch --detach`. > >> There is also a curious side effect. >> >> If you went into detached, you can go back to attached using >> git switch - >> >> but not back to detached by again doing >> git switch - >> >> Even though you had been there, and that means you had used >> --detached, and therefore known what you did. > >That's definitely a bug. In all of this discussion, please be aware that many CI/CD systems use sparse checkout and detached heads as a matter of efficiency and certainty. Please ensure that you are not changing the semantics of existing capabilities when restricting what `git switch` will do. I am concerned about the 280,342 (as of this minute) current Jenkins users who depend on this. Thanks, Randall