From patchwork Thu Oct 25 16:18:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Ospite X-Patchwork-Id: 10656163 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 8A9DB17DE for ; Thu, 25 Oct 2018 16:18:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5ACAD2BA69 for ; Thu, 25 Oct 2018 16:18:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4F1552B2BB; Thu, 25 Oct 2018 16:18:37 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 C73992BA49 for ; Thu, 25 Oct 2018 16:18:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727829AbeJZAwC (ORCPT ); Thu, 25 Oct 2018 20:52:02 -0400 Received: from mail.ao2.it ([92.243.12.208]:44362 "EHLO ao2.it" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727817AbeJZAwB (ORCPT ); Thu, 25 Oct 2018 20:52:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ao2.it; s=20180927; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject:Cc:To:From; bh=0F5g7p2822Em9BIeSFXV8fwMHvW7XZi5nF1zegsJrvo=; b=w2g9Ce1os8XSCodYIMxVHE7arzSM9u9bXr4EVKInFpkiXMWdDjlQweoZs1bBv6p24uFshLiIZ1e8xsTG0g00rvIICXlw4NgUIQeDQyX3t2ErlLSLPCopx5sSPuHELql9iiPNjKkDL6gUBXsFiPme29Ii/EWvfx3OyYUC7Epwr1ot8+qYScpSPRDn6bcYxBTmLASYRADhjFrfbf8X014vbZDh/1XBcIgPA32XvJ4e8UznMWHUpYiXdTmDA4FFX9htV0+FmeGR2jMj2CXcEmGxBLxddurzK4n6YQv2Xgv0XQ0m8hViJ0gJz+rOxp4Z2eXBIo4rhKIq60x2Q+PVZ6nM3g==; Received: from localhost ([::1] helo=jcn) by ao2.it with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1gFiKn-0003Kr-PF; Thu, 25 Oct 2018 18:18:09 +0200 Received: from ao2 by jcn with local (Exim 4.91) (envelope-from ) id 1gFiL4-0004V9-VP; Thu, 25 Oct 2018 18:18:26 +0200 From: Antonio Ospite To: gitster@pobox.com Cc: git@vger.kernel.org, Jonathan Nieder , Stefan Beller , Jeff King , =?utf-8?q?SZ?= =?utf-8?q?EDER_G=C3=A1bor?= , Antonio Ospite Subject: [PATCH v7 00/10] Make submodules work if .gitmodules is not checked out Date: Thu, 25 Oct 2018 18:18:03 +0200 Message-Id: <20181025161813.17252-1-ao2@ao2.it> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 X-Face: z*RaLf`X<@C75u6Ig9}{oW$H;1_\2t5)({*|jhM/Vb;]yA5\I~93>J<_`<4)A{':UrE Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi, this series teaches git to try and read the .gitmodules file from the index (:.gitmodules) or from the current branch (HEAD:.gitmodules) when the file is not readily available in the working tree. This can be used, together with sparse checkouts, to enable submodule usage with programs like vcsh[1] which manage multiple repositories with their working trees sharing the same path. [1] https://github.com/RichiH/vcsh In the previous series there were some comments about not using the enum in patch 8, but I decided to leave the code as it was as I still think that it make sense to use an enum there, and have the default value unnamed; during the discussion I pointed out that other code in git do the same. In this series I am addressing the comments by Stefan Beller about the tests in patch 9. If the new tests look OK, I'd say we try moving the series to "next" and see what happens? I am available to address any further concerns in follow-up patches. v6 of the series is here: https://public-inbox.org/git/20181005130601.15879-1-ao2@ao2.it/ v5 of the series is here: https://public-inbox.org/git/20180917140940.3839-1-ao2@ao2.it/ v4 of the series is here: https://public-inbox.org/git/20180824132951.8000-1-ao2@ao2.it/ v3 of the series is here: https://public-inbox.org/git/20180814110525.17801-1-ao2@ao2.it/ v2 of the series is here: https://public-inbox.org/git/20180802134634.10300-1-ao2@ao2.it/ v1 of the series, with some background info, is here: https://public-inbox.org/git/20180514105823.8378-1-ao2@ao2.it/ Changes since v6: * Renamed t7416-submodule-sparse-gitmodules.sh to t7418-submodule-sparse-gitmodules.sh because t7416 was already taken. This has been already taken care of by Junio in "pu". * Improved tests in t7418: now, instead of just testing the return value of "git submodule ..." commands when .gitmodules is not in the working tree, the actual use case is checked in each test, with pre- and post-conditions. Thank you, Antonio Antonio Ospite (10): submodule: add a print_config_from_gitmodules() helper submodule: factor out a config_set_in_gitmodules_file_gently function t7411: merge tests 5 and 6 t7411: be nicer to future tests and really clean things up submodule--helper: add a new 'config' subcommand submodule: use the 'submodule--helper config' command t7506: clean up .gitmodules properly before setting up new scenario submodule: add a helper to check if it is safe to write to .gitmodules submodule: support reading .gitmodules when it's not in the working tree t/helper: add test-submodule-nested-repo-config Makefile | 1 + builtin/grep.c | 17 ++- builtin/submodule--helper.c | 40 ++++++ cache.h | 2 + git-submodule.sh | 13 +- submodule-config.c | 68 ++++++++- submodule-config.h | 2 + submodule.c | 28 +++- submodule.h | 1 + t/helper/test-submodule-nested-repo-config.c | 30 ++++ t/helper/test-tool.c | 1 + t/helper/test-tool.h | 1 + t/t7411-submodule-config.sh | 141 +++++++++++++++++-- t/t7418-submodule-sparse-gitmodules.sh | 122 ++++++++++++++++ t/t7506-status-submodule.sh | 3 +- t/t7814-grep-recurse-submodules.sh | 16 +++ 16 files changed, 454 insertions(+), 32 deletions(-) create mode 100644 t/helper/test-submodule-nested-repo-config.c create mode 100755 t/t7418-submodule-sparse-gitmodules.sh