From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id iJLgJ3B6hl9WIwAA0tVLHw (envelope-from ) for ; Wed, 14 Oct 2020 04:11:28 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 2I+cI3B6hl8uLQAAbx9fmQ (envelope-from ) for ; Wed, 14 Oct 2020 04:11:28 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 556329403D6 for ; Wed, 14 Oct 2020 04:11:28 +0000 (UTC) Received: from localhost ([::1]:39232 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kSY8M-0003mM-Vc for larch@yhetil.org; Wed, 14 Oct 2020 00:11:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47406) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kSY7y-0003Xh-Rc for bug-guix@gnu.org; Wed, 14 Oct 2020 00:11:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:38098) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kSY7y-0003Hb-Hn for bug-guix@gnu.org; Wed, 14 Oct 2020 00:11:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kSY7y-0007Ws-D6 for bug-guix@gnu.org; Wed, 14 Oct 2020 00:11:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#43893: [PATCH v2] maint: update-guix-package: Prevent accidentally breaking guix pull. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Wed, 14 Oct 2020 04:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43893 X-GNU-PR-Package: guix X-GNU-PR-Keywords: patch To: Marius Bakke Received: via spool by 43893-submit@debbugs.gnu.org id=B43893.160264862028851 (code B ref 43893); Wed, 14 Oct 2020 04:11:02 +0000 Received: (at 43893) by debbugs.gnu.org; 14 Oct 2020 04:10:20 +0000 Received: from localhost ([127.0.0.1]:49640 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kSY7H-0007VG-57 for submit@debbugs.gnu.org; Wed, 14 Oct 2020 00:10:19 -0400 Received: from mail-il1-f193.google.com ([209.85.166.193]:43855) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kSY7E-0007Uu-4k for 43893@debbugs.gnu.org; Wed, 14 Oct 2020 00:10:18 -0400 Received: by mail-il1-f193.google.com with SMTP id k1so384134ilc.10 for <43893@debbugs.gnu.org>; Tue, 13 Oct 2020 21:10:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=oRLRqkknBqtzicT9tbxXlf631yjjCOCpkiOGpUuwVRA=; b=X/1BPJdrvqmXx+VacwCIxjqzWVlFI/ZvZtWd5b2jb66RbSr7wf5welt9heRYXRjZq+ /wrPJ5z8xuGMNuGjGfo6VaNpQ+JveaBfnYKYX8BTpXIFAaurP8V9+ns9MQE7ru+IFocy kq/tdF+dUx7EJZCU0LCNU9Bl86MfvslJwLUM/fEPYV8nImu2UXA5wbKxionIduJW2XjC dT4vdLR63b2T77BAY66/ITvztEmgMlgCZaqp0u3mEwFUiwQiXhLBv5jnbe4h+3+sz0CT 5ij92HoYGfXbLae9XQjQ9hTKNzlB3QKVaasrGjhySrg/QzvU0H6rnksw2OV5lFxY1w0Q P3nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=oRLRqkknBqtzicT9tbxXlf631yjjCOCpkiOGpUuwVRA=; b=iDWm/cuL6/nyUjIAB96wSsFUsHEtCrdCo6OjEKAuwLWq3/ueMZ9Squh9X6eeyEDhyC 62WVxKTrGvpJu4fGgYmF+KLs/RkELcytHWod/aR+5Q+loNzzA9EeJEeH1GWHObYeV4TX Em/EZf+kRKt3SEfS51WHV19h/NUMBF8IUUh76hzrxMKZ2ezZSZ/GxGlA/RpkxjNTAuaY wLC09+KTN+kCtiLr5WKyOhaSSj9Jek8S7JcpnfrgRQEP+o1XQt4obwJeDyevvZVhUxua W5C48+c82dAbx/EmNhsO70DP4gPFJ+S0ahfcmr0s8tM9SlbIsC25cSojWmWxYfL7g2HU ClQQ== X-Gm-Message-State: AOAM530FpdFrAK84UNoWz3vvOHGkGLha4+YWfbEfMXrNCdPKNr3QRSFr 72rRJeSCaDR7A55RbwS6bojf/uFdqBYKSw== X-Google-Smtp-Source: ABdhPJyQJT7Ryc3GXZrQWd5xpfrCjW7mnzzZpSu7cIpLFr3vVfMnxM8ScBv5jmSW4HHrOzJIowwgbg== X-Received: by 2002:a05:6e02:e01:: with SMTP id a1mr2491346ilk.273.1602648610324; Tue, 13 Oct 2020 21:10:10 -0700 (PDT) Received: from hurd (dsl-155-33.b2b2c.ca. [66.158.155.33]) by smtp.gmail.com with ESMTPSA id o17sm1769255ioa.3.2020.10.13.21.10.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Oct 2020 21:10:09 -0700 (PDT) From: Maxim Cournoyer References: <87eem7qcxc.fsf@gmail.com> <20201011195740.1993-1-maxim.cournoyer@gmail.com> <87imbedsko.fsf@gnu.org> Date: Wed, 14 Oct 2020 00:10:07 -0400 In-Reply-To: <87imbedsko.fsf@gnu.org> (Marius Bakke's message of "Tue, 13 Oct 2020 18:00:23 +0200") Message-ID: <87imbd5ty8.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -1.0 (-) X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: 43893@debbugs.gnu.org Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=fail (rsa verify failed) header.d=gmail.com header.s=20161025 header.b=X/1BPJdr; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Spam-Score: 1.59 X-TUID: QhkwdHBW3eL8 Hello Marius, And thanks for the review! [...] >> +(define (git-add-worktree directory commit-ish) >> + "Create a new git worktree at DIRECTORY, detached on commit COMMIT-ISH." >> + (invoke "git" "worktree" "add" "--detach" directory commit-ish)) > > Is it feasible to use Guile-Git here (given appropriate bindings)? I had a cursory look at the guile-git sources, and it seems to miss at least bindings for manipulating worktrees, and I'm not sure how we could get a list of all the remotes and check their URLs to find the remote used to push to Savannah. Supposing we'd be able to get that remote, I also don't know how we could query if its master branch contains a given commit (I imagine it's doable, but it's not documented so it takes time to figure it out :-). [...] >> - (string-append (getcwd) "/" root)) >> +(define (commit-already-pushed? remote commit) >> + "True if COMMIT is found in the REMOTE repository." >> + (not (string-null? (with-input-pipe-to-string >> + "git" "branch" "-r" "--contains" commit >> + (string-append remote "/master"))))) > > ...because parsing git CLI output is error-prone and "ugly" (IMO). But > not a strong opinion. I agree; but for the time being we don't have an another option. I'd be happy to be proven wrong. [...] >> + (lambda () >> + (invoke "git" "worktree" "prune"))))) > > This is not great, because users (well, developers who run this script) > may have worktrees that are temporarily inaccessible (e.g. on a USB > drive or whatever). Better to just leave the stale reference instead of > potentially destroying users worktrees. That's a good point. I've improved the cleanup in v3 to only remove the worktree it creates and no other. > Perhaps the script could 'git clone --maxdepth=1' instead of creating > a worktree? I think you meant something like: --8<---------------cut here---------------start------------->8--- $ git clone --branch the-branch --depth -1 %top-srcdir --8<---------------cut here---------------end--------------->8--- That could work, but it's about 2x slower and more expensive than creating a worktree (15975 syscalls vs 647, according to 'strace -c'). Thank you, Maxim