From patchwork Fri Dec 7 23:54:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Beller X-Patchwork-Id: 10719017 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 72208109C for ; Fri, 7 Dec 2018 23:54:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 63A7D2E155 for ; Fri, 7 Dec 2018 23:54:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 57FC12E3A5; Fri, 7 Dec 2018 23:54:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 686902E155 for ; Fri, 7 Dec 2018 23:54:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726078AbeLGXym (ORCPT ); Fri, 7 Dec 2018 18:54:42 -0500 Received: from mail-qk1-f201.google.com ([209.85.222.201]:40377 "EHLO mail-qk1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726041AbeLGXym (ORCPT ); Fri, 7 Dec 2018 18:54:42 -0500 Received: by mail-qk1-f201.google.com with SMTP id y83so4770713qka.7 for ; Fri, 07 Dec 2018 15:54:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=N3SZ1QCsoUGEdOPnFhXh5qvrlPIaRjFBb+tjKJF/4HE=; b=ohSXa6Y6EZoDlRAfA0Uml6FklgVn435ZSavNodlFoxW8uQjB+lSc/FwI+AEzwBMWEN 3P0dBfNbd+XSsgelhhXHrmQA442l6vEzWlh7kYwKoIIs5VmjVvPC/riABPDxL+mBYERU DXw8Reem6njSs3NJ50cPO5I1ycSqOUHvagooEhbLaKxCaXIXjTiJEapBaflWGcOEBdZn kqs5cOcr6EPx0hd4e7eq7afHObGdnrnFbPGiVgB4TPfII9+U/joLoZbDl4lzeztBbShq M7Bbp+FQ5Ok/pN88TaZwYgMWBCg2UW7Tbo+/acuTSyIVE/9JTIPef0CIs44fVyzoCV1A RS2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=N3SZ1QCsoUGEdOPnFhXh5qvrlPIaRjFBb+tjKJF/4HE=; b=sT5BASqx4Oe0TR521IT//HXPU96xm9azgZOUi4/+ldqYZWliC0FqLdEg86A39KQfaB yeJGmBbX76Oi2otJkbG3sRwsJHLAi7OsVrRETZAJpfKZlv4EzBRxKn7DRU/F+q6oKKQB UlrdbFJdLIvQXu1a2Cthp/J+FUua5p15aDsP1+pb8QmVZ5m+v0V9KG7vz3ZhMFG/CuEA kK7TcmomA9zD7F7jSH9TuZeMe6kZFQCGZST26CFo0zeF7bbbkjb06CN3r7473I6sP9ps ZaCGhlTfIXLIbwey/1AM3r7a5KtOOWYObzYqomDzwugvuf2bPDZPsxn0fNbOsxS09sMM 7itg== X-Gm-Message-State: AA+aEWYE5ZIiXYfE8VIyMO6IU5rhDtAnmhsa2WaDEGnu7pPca/u5g9vO ZEQaO6qI9jOdbs2dR5HPk7IKWJ4+67uFM/RGg5bPncFfbwqH8SanFRsZwbrNvpBLSPTnTZJUFnH 0pjlsgi+N0jvJNozOs11Fma6/yNOq1v35MS5nkI64WRJab1SDwcrEzPXZ5dHs X-Google-Smtp-Source: AFSGD/WZ/FxlEnINu3gm9HtZJRnurblQ6ZGahmIisaVwQgYkn8ld60iTQU9+8q5KQV42Zg1IxRs5TK+V69w0 X-Received: by 2002:ac8:25fc:: with SMTP id f57mr3162603qtf.12.1544226881071; Fri, 07 Dec 2018 15:54:41 -0800 (PST) Date: Fri, 7 Dec 2018 15:54:22 -0800 In-Reply-To: <20181207235425.128568-1-sbeller@google.com> Message-Id: <20181207235425.128568-2-sbeller@google.com> Mime-Version: 1.0 References: <20181207235425.128568-1-sbeller@google.com> X-Mailer: git-send-email 2.20.0.rc2.403.gdbc3b29805-goog Subject: [PATCH 1/4] submodule update: add regression test with old style setups From: Stefan Beller To: git@vger.kernel.org Cc: Stefan Beller Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP As f178c13fda (Revert "Merge branch 'sb/submodule-core-worktree'", 2018-09-07) was produced shortly before a release, nobody asked for a regression test to be included. Add a regression test that makes sure that the invocation of `git submodule update` on old setups doesn't produce errors as pointed out in f178c13fda. The place to add such a regression test may look odd in t7412, but that is the best place as there we setup old style submodule setups explicitly. Signed-off-by: Stefan Beller --- t/t7412-submodule-absorbgitdirs.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/t/t7412-submodule-absorbgitdirs.sh b/t/t7412-submodule-absorbgitdirs.sh index ce74c12da2..1cfa150768 100755 --- a/t/t7412-submodule-absorbgitdirs.sh +++ b/t/t7412-submodule-absorbgitdirs.sh @@ -75,7 +75,12 @@ test_expect_success 're-setup nested submodule' ' GIT_WORK_TREE=../../../nested git -C sub1/.git/modules/nested config \ core.worktree "../../../nested" && # make sure this re-setup is correct - git status --ignore-submodules=none + git status --ignore-submodules=none && + + # also make sure this old setup does not regress + git submodule update --init --recursive >out 2>err && + test_must_be_empty out && + test_must_be_empty err ' test_expect_success 'absorb the git dir in a nested submodule' ' From patchwork Fri Dec 7 23:54:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Beller X-Patchwork-Id: 10719019 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 62A1F1759 for ; Fri, 7 Dec 2018 23:54:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 53C2E2E155 for ; Fri, 7 Dec 2018 23:54:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 480E42E34D; Fri, 7 Dec 2018 23:54:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 96C322E155 for ; Fri, 7 Dec 2018 23:54:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726081AbeLGXyo (ORCPT ); Fri, 7 Dec 2018 18:54:44 -0500 Received: from mail-qk1-f201.google.com ([209.85.222.201]:44888 "EHLO mail-qk1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726041AbeLGXyo (ORCPT ); Fri, 7 Dec 2018 18:54:44 -0500 Received: by mail-qk1-f201.google.com with SMTP id f22so4766568qkm.11 for ; Fri, 07 Dec 2018 15:54:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=3mE2CUQFRCTCZVGE/1A680VZScdt43GpdjJtbVpqD04=; b=ZdGKqRMd/Acf+SYEDZfGB1GT77fzn3BGC8Wu12rqbrpdj26EsCAYm4QvQCUa95njfk e8NlW0PwN9gnaz0zXWKMmGp8r33/4F2HAxFTr+TDmwRUEMYbJ/+D7JEZ0DUTzQwLwN3j quAEp/NKM7YyGc9LSDCIQW02iJFMDOi6biVB231sC7oX0VKYVdZDCMuiuL7o08FPz1zp SFagh+f3hupVc99KoWPGRe+cSUh6L11LBys7KO1ycUf3hI6boqSMPqBbzP0nfOpgdcUI GxHqcettrqM53Agcse7YBSeljmDemdG6O5NAVVnjxjXwngptpIUP9jhUU6jt+fep4vbH n4UQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=3mE2CUQFRCTCZVGE/1A680VZScdt43GpdjJtbVpqD04=; b=or97KVacLzJ2yOE1KwlwMPn1JkCQeSpOSVvuO8NIZfFZ+QvaJ7ZWKis6QCUiYFCb2u hQ2TRNHazobplV9lwY3LHElGk2R5F+h7bl5anlcVorFGEBO/nQvMBiNWM5BTGDaAnjQ5 sWoT1C6pK+VCMBFG6ij0n07z9R6gqkkFwbqubnrG1pajMKCAHiKnCBZd581pJfmf7BBo +vjglq0QXzmPf7gYgBaPSmrOhVC9TsmcXjOH7nYkxasknHbxMXwRInzy5bspKF+jIVj6 YxtCFKQe2AVJBD5AYN+i3hjaI9lUvaPHkIPrTqljvQUOyYd2jAM+uqzrnlAX1MFDt3Tp 7USw== X-Gm-Message-State: AA+aEWbiy6Y8n/31gvRGwnzt9ve29Xsqb9L1MgYW4us+E8XsPMPaJtzE Dg126g3NgHv2y46kGeVWKELmFoEE5FbdM2wMIN6ex6IOKkv8/FxQeTkEvP3jJA/eJYbUNJcF7JW rCDCi2+hgVqpN2rabKCpC4Kcghjpzf/JSHfj/EDcO/uoHH/Gyi5hjo/+Str5J X-Google-Smtp-Source: AFSGD/UqL+F71+9Il5Ce6l9ozQRTnRSDSCUdPRULsWBqmagoMcARmnvj51/VIiuJXP3FjFQ3p5SbFvPMFeD1 X-Received: by 2002:a0c:9219:: with SMTP id a25mr3142100qva.39.1544226883425; Fri, 07 Dec 2018 15:54:43 -0800 (PST) Date: Fri, 7 Dec 2018 15:54:23 -0800 In-Reply-To: <20181207235425.128568-1-sbeller@google.com> Message-Id: <20181207235425.128568-3-sbeller@google.com> Mime-Version: 1.0 References: <20181207235425.128568-1-sbeller@google.com> X-Mailer: git-send-email 2.20.0.rc2.403.gdbc3b29805-goog Subject: [PATCH 2/4] submodule: unset core.worktree if no working tree is present From: Stefan Beller To: git@vger.kernel.org Cc: Stefan Beller , Junio C Hamano Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This reintroduces 4fa4f90ccd (submodule: unset core.worktree if no working tree is present, 2018-06-12), which was reverted as part of f178c13fda (Revert "Merge branch 'sb/submodule-core-worktree'", 2018-09-07). 4fa4f90ccd was reverted as its followup commit was faulty, but without the accompanying change of the followup, we'd have an incomplete workflow of setting `core.worktree` again, when it is needed such as checking out a revision that contains a submodule. So re-introduce that commit as-is, focusing on fixing up the followup Signed-off-by: Stefan Beller Signed-off-by: Junio C Hamano Signed-off-by: Stefan Beller --- submodule.c | 14 ++++++++++++++ submodule.h | 2 ++ t/lib-submodule-update.sh | 3 ++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/submodule.c b/submodule.c index 6415cc5580..d393e947e6 100644 --- a/submodule.c +++ b/submodule.c @@ -1561,6 +1561,18 @@ int bad_to_remove_submodule(const char *path, unsigned flags) return ret; } +void submodule_unset_core_worktree(const struct submodule *sub) +{ + char *config_path = xstrfmt("%s/modules/%s/config", + get_git_common_dir(), sub->name); + + if (git_config_set_in_file_gently(config_path, "core.worktree", NULL)) + warning(_("Could not unset core.worktree setting in submodule '%s'"), + sub->path); + + free(config_path); +} + static const char *get_super_prefix_or_empty(void) { const char *s = get_super_prefix(); @@ -1726,6 +1738,8 @@ int submodule_move_head(const char *path, if (is_empty_dir(path)) rmdir_or_warn(path); + + submodule_unset_core_worktree(sub); } } out: diff --git a/submodule.h b/submodule.h index a680214c01..9e18e9b807 100644 --- a/submodule.h +++ b/submodule.h @@ -131,6 +131,8 @@ int submodule_move_head(const char *path, const char *new_head, unsigned flags); +void submodule_unset_core_worktree(const struct submodule *sub); + /* * Prepare the "env_array" parameter of a "struct child_process" for executing * a submodule by clearing any repo-specific environment variables, but diff --git a/t/lib-submodule-update.sh b/t/lib-submodule-update.sh index 016391723c..51d4555549 100755 --- a/t/lib-submodule-update.sh +++ b/t/lib-submodule-update.sh @@ -709,7 +709,8 @@ test_submodule_recursing_with_args_common() { git branch -t remove_sub1 origin/remove_sub1 && $command remove_sub1 && test_superproject_content origin/remove_sub1 && - ! test -e sub1 + ! test -e sub1 && + test_must_fail git config -f .git/modules/sub1/config core.worktree ) ' # ... absorbing a .git directory along the way. From patchwork Fri Dec 7 23:54:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Beller X-Patchwork-Id: 10719021 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7D33A1759 for ; Fri, 7 Dec 2018 23:54:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6EAF42E155 for ; Fri, 7 Dec 2018 23:54:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 62A672E34D; Fri, 7 Dec 2018 23:54:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0ABE02E155 for ; Fri, 7 Dec 2018 23:54:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726093AbeLGXyr (ORCPT ); Fri, 7 Dec 2018 18:54:47 -0500 Received: from mail-io1-f74.google.com ([209.85.166.74]:45119 "EHLO mail-io1-f74.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726041AbeLGXyq (ORCPT ); Fri, 7 Dec 2018 18:54:46 -0500 Received: by mail-io1-f74.google.com with SMTP id r65so5096317iod.12 for ; Fri, 07 Dec 2018 15:54:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=kuvCeQO9ymjYq6mNngIbyYme9Vr+BHCcrjKVkAY+Gkk=; b=jrPwgK3I5NXv91dUjNrqERVxYTNa2RUYDj9Hs1kbpWsEdWf6BEfLfSKvwz3SjL+6fn tDK217rS+sj7mmcB8xxqM7ZygL3Zs87iIJPBhgwixP17OOsFhPEqmIOozkhAMNZOY6TH efEwP/i8pzPeXSyhsn56IOOFekw/jduX3jNbaZUM5p1hKaUUKUDCrwXxcUqNH3TJy233 6ji26v1JPQhuPDr3No6AhRQefnvqIoihNww/GXOKhmq3wlDrjUo5ktbo8BgxngNmJST1 51sieq+GmdsHYdeDz7hVYTnA3JsKDhmLg02mzsAAuOCiH6Q5OE6x0wlliYZFuL0AAFK6 4lkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=kuvCeQO9ymjYq6mNngIbyYme9Vr+BHCcrjKVkAY+Gkk=; b=CKURWyzOFZ1ew0+fjsPaInG5AVyW2V4pN9kDcWkeCBG0wqGrCl2WA1WKbSsX2URqzF qJxnbwJEOfmMipxPtrPFkVC3Bu5JJNTWKAn8hI8HHyF5XpjTU6qqUaIn+pKD6vG9F2Mc Ok/mRqvPOX9dmtCzjLgiWHLA7D2mrbRTNLqeUw20zRHuYH15TyJ59dIo2n1IS0povY2C hcKLM0rMu4zFzHRIMlji1dULH2U91EJWjKJex5rTYJrfaDNPCraNAjUKuXKgUTXMktx2 9Buy/QTELVSnUE22eLC1LlsePP+6WH958PBhm9aCXv7cFJGP2wbrisszvmpIUVBiN+q4 JfQg== X-Gm-Message-State: AA+aEWa8b2TBBoYTNxsjT30YRddhA+tf5/NRGQyvdWpFUNCrATPu2TzO H5oSdwUP07ThfoepfryG2XBpJcck36nywwx0oWZUCG1zzSaxaIH6Y+FQOPnFE6EjKYkpURArWe8 T8AvR33O9ygpfTW41rZFHD8aD0x5S+gOZpUMrXH0j0ApQbrBtGA23bcOYcpdk X-Google-Smtp-Source: AFSGD/WygIg+GSNRg4swfxfENUp/UhBv2s2tYn0FRjnrdZXAV+C1o4/AylMK5Ox5fRD9vfCMfS+hb/S2R5yv X-Received: by 2002:a24:a94:: with SMTP id 142mr3274482itw.15.1544226885782; Fri, 07 Dec 2018 15:54:45 -0800 (PST) Date: Fri, 7 Dec 2018 15:54:24 -0800 In-Reply-To: <20181207235425.128568-1-sbeller@google.com> Message-Id: <20181207235425.128568-4-sbeller@google.com> Mime-Version: 1.0 References: <20181207235425.128568-1-sbeller@google.com> X-Mailer: git-send-email 2.20.0.rc2.403.gdbc3b29805-goog Subject: [PATCH 3/4] submodule--helper: fix BUG message in ensure_core_worktree From: Stefan Beller To: git@vger.kernel.org Cc: Stefan Beller Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Shortly after f178c13fda (Revert "Merge branch 'sb/submodule-core-worktree'", 2018-09-07), we had another series that implemented partially the same, ensuring that core.worktree was set in a checked out submodule, namely 74d4731da1 (submodule--helper: replace connect-gitdir-workingtree by ensure-core-worktree, 2018-08-13) As the series 4d6d6ef1fc (Merge branch 'sb/submodule-update-in-c', 2018-09-17) has different goals than the reverted series 7e25437d35 (Merge branch 'sb/submodule-core-worktree', 2018-07-18), I'd wanted to replay the series on top of it to reach the goal of having `core.worktree` correctly set when the submodules worktree is present, and unset when the worktree is not present. The replay resulted in a strange merge conflict highlighting that the BUG message was not changed in 74d4731da1 (submodule--helper: replace connect-gitdir-workingtree by ensure-core-worktree, 2018-08-13). Fix the error message. Signed-off-by: Stefan Beller --- builtin/submodule--helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index d38113a31a..31ac30cf2f 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -2045,7 +2045,7 @@ static int ensure_core_worktree(int argc, const char **argv, const char *prefix) struct repository subrepo; if (argc != 2) - BUG("submodule--helper connect-gitdir-workingtree "); + BUG("submodule--helper ensure-core-worktree "); path = argv[1]; From patchwork Fri Dec 7 23:54:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Beller X-Patchwork-Id: 10719023 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 072BB109C for ; Fri, 7 Dec 2018 23:54:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB29C2E155 for ; Fri, 7 Dec 2018 23:54:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DF5652E34D; Fri, 7 Dec 2018 23:54:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C67C2E155 for ; Fri, 7 Dec 2018 23:54:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726099AbeLGXyt (ORCPT ); Fri, 7 Dec 2018 18:54:49 -0500 Received: from mail-pl1-f201.google.com ([209.85.214.201]:49531 "EHLO mail-pl1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726041AbeLGXys (ORCPT ); Fri, 7 Dec 2018 18:54:48 -0500 Received: by mail-pl1-f201.google.com with SMTP id v12so3853706plp.16 for ; Fri, 07 Dec 2018 15:54:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=cc3kru8ux31P+oWpr5+lj/FGTffzPrTb7rPkrwpsBIE=; b=E071rlr31XTJQcmPEvFrRKWIujL2uh5/AHITJMdAFRcz5aqTtsq/QTFq9HNivfMJyA WBbzLsq23kUVPBLwBj0MDI4Q03E9hL+u0q/TPBdliehbzndU0HhDQLX2rlXS5Z0AqtEl 5//FRpBBnYnAL0TULa8tHibKVlfmCcFlAxxx1rPMtwKmKlmGEbN76w5jtcmswfmyMCvp j5NHwXS17ey1KyT75UgxTvKLEIe132+lvJLRGCixBzVtWd0NESzcT2d4lL7fsu3oXHdc AQH/rf01x3tqEuDYYkOIRw+8A6qezyxth0jXr6sMAQJupyMdmd+rnvWOSD2i1N/Bkj0h rjpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=cc3kru8ux31P+oWpr5+lj/FGTffzPrTb7rPkrwpsBIE=; b=EpAU6/JPzgDySUSGKg9EPoLhdqJZQBHqFfljR0Iv4GyYq9pZTt/dAcHeAkgvvRP6m6 LNjZvklc4zGXhlEVUMGhxsa1wdJctcDkONtYMGl7gbNLKaD/hq/fRvmfQ4DIO3wewFXQ onBD5Irk11HSEv9VduGiJRRrv+UgPAqk4uS0mamrCW7hPVNM4alz078JDit8MnRZn7Ho BdNGe2KIsu+ifBDZK5qymOke+gDTLkJJlH1+ZAmgZOSozPMU+Y5CK3cA6hojhOXw3XAP D+M51CfDuaWNsihAvQMKJcqn5paK8QZp8qrGZdb959pc86Ubf2UMEyKKuSflOVM8IHLJ ngig== X-Gm-Message-State: AA+aEWbL+ikqmv0M+IJaZs41/P8ygRTNk7SvUnpCs7ybR1n6OJOxf/Vq SqpBVBKRuSazaoKtMWmKn7zfB03dXuzJdgLVC4H6id0cDsyplRwz1TTJSOtgDyo7s767QjxxDPP l6FriGCNc6NKEzIbCrUL8utFYTH2sI3bUum25IFrZxJgeBKwKlhaL1+ItjFd1 X-Google-Smtp-Source: AFSGD/XM4EENAfk6KIshEihJYNmEEVRPcAlgimooRXT7CJLJ5JsFRChEnL+Hg9YLDRXBQvN4cgvLJXTlDGss X-Received: by 2002:a65:520d:: with SMTP id o13mr2122130pgp.7.1544226888093; Fri, 07 Dec 2018 15:54:48 -0800 (PST) Date: Fri, 7 Dec 2018 15:54:25 -0800 In-Reply-To: <20181207235425.128568-1-sbeller@google.com> Message-Id: <20181207235425.128568-5-sbeller@google.com> Mime-Version: 1.0 References: <20181207235425.128568-1-sbeller@google.com> X-Mailer: git-send-email 2.20.0.rc2.403.gdbc3b29805-goog Subject: [PATCH 4/4] submodule deinit: unset core.worktree From: Stefan Beller To: git@vger.kernel.org Cc: Stefan Beller Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This re-introduces 984cd77ddb (submodule deinit: unset core.worktree, 2018-06-18), which was reverted as part of f178c13fda (Revert "Merge branch 'sb/submodule-core-worktree'", 2018-09-07) The whole series was reverted as the offending commit e98317508c (submodule: ensure core.worktree is set after update, 2018-06-18) was relied on by other commits such as 984cd77ddb. Keep the offending commit reverted, but its functionality came back via 4d6d6ef1fc (Merge branch 'sb/submodule-update-in-c', 2018-09-17), such that we can reintroduce 984cd77ddb now. Signed-off-by: Stefan Beller --- builtin/submodule--helper.c | 2 ++ t/lib-submodule-update.sh | 2 +- t/t7400-submodule-basic.sh | 5 +++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index 31ac30cf2f..672b74db89 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -1131,6 +1131,8 @@ static void deinit_submodule(const char *path, const char *prefix, if (!(flags & OPT_QUIET)) printf(format, displaypath); + submodule_unset_core_worktree(sub); + strbuf_release(&sb_rm); } diff --git a/t/lib-submodule-update.sh b/t/lib-submodule-update.sh index 51d4555549..5b56b23166 100755 --- a/t/lib-submodule-update.sh +++ b/t/lib-submodule-update.sh @@ -235,7 +235,7 @@ reset_work_tree_to_interested () { then mkdir -p submodule_update/.git/modules/sub1/modules && cp -r submodule_update_repo/.git/modules/sub1/modules/sub2 submodule_update/.git/modules/sub1/modules/sub2 - GIT_WORK_TREE=. git -C submodule_update/.git/modules/sub1/modules/sub2 config --unset core.worktree + # core.worktree is unset for sub2 as it is not checked out fi && # indicate we are interested in the submodule: git -C submodule_update config submodule.sub1.url "bogus" && diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh index 76a7cb0af7..aba2d4d6ee 100755 --- a/t/t7400-submodule-basic.sh +++ b/t/t7400-submodule-basic.sh @@ -984,6 +984,11 @@ test_expect_success 'submodule deinit should remove the whole submodule section rmdir init ' +test_expect_success 'submodule deinit should unset core.worktree' ' + test_path_is_file .git/modules/example/config && + test_must_fail git config -f .git/modules/example/config core.worktree +' + test_expect_success 'submodule deinit from subdirectory' ' git submodule update --init && git config submodule.example.foo bar &&