From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefan Beller Subject: [PATCH 5/7] submodule--helper module_list_compute: allow label or name arguments Date: Tue, 10 May 2016 17:59:55 -0700 Message-ID: <1462928397-1708-6-git-send-email-sbeller@google.com> References: <1462928397-1708-1-git-send-email-sbeller@google.com> Cc: git@vger.kernel.org, pclouds@gmail.com, Stefan Beller To: jrnieder@gmail.com, gitster@pobox.com, Jens.Lehmann@web.de X-From: git-owner@vger.kernel.org Wed May 11 03:00:36 2016 Return-path: Envelope-to: gcvg-git-2@plane.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1b0IVu-00028Y-CB for gcvg-git-2@plane.gmane.org; Wed, 11 May 2016 03:00:34 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751528AbcEKBAX (ORCPT ); Tue, 10 May 2016 21:00:23 -0400 Received: from mail-pa0-f42.google.com ([209.85.220.42]:36466 "EHLO mail-pa0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750978AbcEKBAT (ORCPT ); Tue, 10 May 2016 21:00:19 -0400 Received: by mail-pa0-f42.google.com with SMTP id bt5so11016285pac.3 for ; Tue, 10 May 2016 18:00:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ccNc8hRsiOKxjDb0BAF6g4QK/hv+glYhBFULBqNXUfI=; b=hm3F7NHg79Nibld10ONa19/W3pKYgRWWREElnUBLLHlyXfX08l3utYxA83sJlKgSK1 w9i9Nlm262z2t6GNsajsMV0ijGEQw7ZWPgC9MDhmL/gOBqIRzAv+SNY2rrkl50ZU/Jk4 6jCDin3I2mRZ1fxZEqU2nh3l3ykgkyl2h2egkODxVO1evou3/eA6hWePA+wcSV2SPZaJ pE2cI9XiICxOQyG4jdOiKI8DyCB+yAWEsIZIMKtW+mMuRHsR/KSD7KYAcPE+f6FVfmex GNp0p52fLuCg0MpZ1MnN9rdxm36UcTvbrNxoyEGlfSb4jnVmm1qXU3sELr1ds0BIwN/C /IKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ccNc8hRsiOKxjDb0BAF6g4QK/hv+glYhBFULBqNXUfI=; b=AFr3DHjIxhgVHATfpgQcIKRTb/pBcX4zBeOr9JRB5Kn3+/qqJ+xSKhMuSAnDQbdGKv ULQzdw1xTL1/YAB/86azQZ9PQKJ8pJpPqRnJdDZzoNoAAlv27cPgXH1GBucSt/DzWaj/ I6lVMzj5/K/QWMERuQZESqvR4EsTB589Vu+1F5IHsP75/hQ7otIGo72rW6Q/Yd03Qldz waWX4kBVnRXT3U51s8gEUn0gxYi9zLVXd0ykVLYtcQm37JXPVoOx9I9ldlRZvtNtiGlJ cY/F9sar/C8UdiA1JAkdf9eLE5lM7of+Hpd8aDxCdrH3OqD26RleALvpAR+pQ4f2nFhg 5gJA== X-Gm-Message-State: AOPr4FWtpeRFEVUb8zKiWD7aG4d1+gRpzG+r8bYyYwfJpfYvKgsJrdo9xFqq0CvVC12rEYKk X-Received: by 10.66.78.73 with SMTP id z9mr789742paw.4.1462928413635; Tue, 10 May 2016 18:00:13 -0700 (PDT) Received: from localhost ([2620:0:1000:5b10:69ac:db78:a0d1:60da]) by smtp.gmail.com with ESMTPSA id s23sm7199693pfj.86.2016.05.10.18.00.12 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Tue, 10 May 2016 18:00:13 -0700 (PDT) X-Mailer: git-send-email 2.8.0.35.g58985d9.dirty In-Reply-To: <1462928397-1708-1-git-send-email-sbeller@google.com> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: Additionally to taking a pathspec, `module_list_compute` will also take labels and submodule names, when these are prefixed by '*' and ':' respectively. `module_list_compute` is used by other functions in the submodule helper: * module_list, used by `submodule {deinit, status, sync, foreach}` * module_init, used by `submodule init` * update_clone, used by `submodule update` {foreach, update} do not pass on command line arguments to the listing function such that these are not affected. The rest of them {deinit, status, sync, init} will be exercised in additional tests. As the labeling requires lookup of .gitmodules files, we need to make sure the submodule config cache is initialized in all the functions, that's why there are additional calls to gitmodules_config() and git_config(...); Signed-off-by: Stefan Beller --- Documentation/git-submodule.txt | 22 +++++++++-- builtin/submodule--helper.c | 76 +++++++++++++++++++++++++++++++----- git-submodule.sh | 8 ++-- t/t7412-submodule--helper.sh | 86 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 175 insertions(+), 17 deletions(-) diff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt index 9ba8895..35ca355 100644 --- a/Documentation/git-submodule.txt +++ b/Documentation/git-submodule.txt @@ -11,16 +11,16 @@ SYNOPSIS [verse] 'git submodule' [--quiet] add [-b ] [-f|--force] [-l|--label