From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Rappazzo Subject: [PATCH v8 4/4] worktree: add 'list' command Date: Fri, 18 Sep 2015 09:30:27 -0400 Message-ID: <1442583027-47653-5-git-send-email-rappazzo@gmail.com> References: <1442583027-47653-1-git-send-email-rappazzo@gmail.com> Cc: git@vger.kernel.org, Michael Rappazzo To: gitster@pobox.com, sunshine@sunshineco.com, dturner@twopensource.com X-From: git-owner@vger.kernel.org Fri Sep 18 15:31:25 2015 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 1Zcvl1-0005du-GC for gcvg-git-2@plane.gmane.org; Fri, 18 Sep 2015 15:31:19 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751973AbbIRNbN (ORCPT ); Fri, 18 Sep 2015 09:31:13 -0400 Received: from mail-qg0-f48.google.com ([209.85.192.48]:32829 "EHLO mail-qg0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751908AbbIRNbK (ORCPT ); Fri, 18 Sep 2015 09:31:10 -0400 Received: by qgev79 with SMTP id v79so38308854qge.0 for ; Fri, 18 Sep 2015 06:31:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=DZ0YrK+VoOIzzWT8jueX+HP4IZXBDRCFWCnEgGrK+xc=; b=Ph3/WfDt94M7xKq77cD/v58Lnm5XzjYmONkl+vP4MTtBGO/5WEE5As3SOlr/qgFarP p+3+6FKt0zjdc0f9Ph/POSrDN/1sXuXUD5TrmDGXD+rrIKpJtwuZHLLhjEpthfdreGy6 GBeoS3cZAlKDnYaxZuz6+adP8JuXAkZnO/5q4sJIgUOu4rEKqAc5Lv4gxgk5lRlz3HcI ERFm/ul4/gHKYpLOlNk29z4OiQg3RiC1iRAzzDZxkViAqOhhgWu7JacPiPmph/mNNKIV 2r6f4L7GrdD9aB/oJ5hSiZjjREEnJCzI0vjMJzZsmF8QOX1FUeLfE5eLaLs1GOLwhJgP c1cA== X-Received: by 10.141.23.69 with SMTP id z66mr6718171qhd.55.1442583069209; Fri, 18 Sep 2015 06:31:09 -0700 (PDT) Received: from localhost.localdomain (109.sub-70-199-70.myvzw.com. [70.199.70.109]) by smtp.gmail.com with ESMTPSA id i19sm3586051qkh.13.2015.09.18.06.31.07 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 18 Sep 2015 06:31:08 -0700 (PDT) X-Mailer: git-send-email 2.5.0 In-Reply-To: <1442583027-47653-1-git-send-email-rappazzo@gmail.com> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: 'git worktree list' iterates through the worktree list, and outputs details of the worktree including the path to the worktree, the currently checked out revision and branch, and if the work tree is bare. There is also porcelain format option available. Signed-off-by: Michael Rappazzo --- Documentation/git-worktree.txt | 15 +++++++- builtin/worktree.c | 78 ++++++++++++++++++++++++++++++++++++++ t/t2027-worktree-list.sh | 86 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 178 insertions(+), 1 deletion(-) create mode 100755 t/t2027-worktree-list.sh diff --git a/Documentation/git-worktree.txt b/Documentation/git-worktree.txt index fb68156..8ee65c6 100644 --- a/Documentation/git-worktree.txt +++ b/Documentation/git-worktree.txt @@ -11,6 +11,7 @@ SYNOPSIS [verse] 'git worktree add' [-f] [--detach] [-b ] [] 'git worktree prune' [-n] [-v] [--expire ] +'git worktree list' [--porcelain] DESCRIPTION ----------- @@ -59,6 +60,13 @@ prune:: Prune working tree information in $GIT_DIR/worktrees. +list:: + +List details of each worktree. The main worktree is listed first, followed by +each of the linked worktrees. The output details include if the worktree is +bare, the revision currently checked out, and the branch currently checked out +(or 'detached HEAD' if none). + OPTIONS ------- @@ -86,6 +94,11 @@ OPTIONS With `prune`, do not remove anything; just report what it would remove. +--porcelain:: + With `list`, output in an easy-to-parse format for scripts. + This format will remain stable across Git versions and regardless of user + configuration. + -v:: --verbose:: With `prune`, report all removals. @@ -93,6 +106,7 @@ OPTIONS --expire