From: Nickolai Belakovski <nbelakov...@gmail.com>

---
 Documentation/git-branch.txt | 5 ++++-
 builtin/branch.c             | 4 ++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt
index b3eca6ffdc..6d1fc59e32 100644
--- a/Documentation/git-branch.txt
+++ b/Documentation/git-branch.txt
@@ -163,12 +163,15 @@ This option is only applicable in non-verbose mode.
 
 -v::
 -vv::
+-vvv::
 --verbose::
        When in list mode,
        show sha1 and commit subject line for each head, along with
        relationship to upstream branch (if any). If given twice, print
        the name of the upstream branch, as well (see also `git remote
-       show <remote>`).
+       show <remote>`). If given 3 times, print the path of the linked
+       worktree, if applicable (not applicable for main worktree since
+       its path will be a subset of $PWD)
 
 -q::
 --quiet::
diff --git a/builtin/branch.c b/builtin/branch.c
index 2a24153b78..56589a3684 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -366,6 +366,10 @@ static char *build_format(struct ref_filter *filter, int 
maxwidth, const char *r
                strbuf_addstr(&local, branch_get_color(BRANCH_COLOR_RESET));
                strbuf_addf(&local, " %s ", obname.buf);
 
+               if (filter->verbose > 2)
+                       strbuf_addf(&local, 
"%s%%(if:notequals=*)%%(HEAD)%%(then)%%(if)%%(worktreepath)%%(then)%%(worktreepath)
 %%(end)%%(end)%s",
+                                   branch_get_color(BRANCH_COLOR_WORKTREE), 
branch_get_color(BRANCH_COLOR_RESET));
+
                if (filter->verbose > 1)
                        strbuf_addf(&local, 
"%%(if)%%(upstream)%%(then)[%s%%(upstream:short)%s%%(if)%%(upstream:track)"
                                    "%%(then): 
%%(upstream:track,nobracket)%%(end)] %%(end)%%(contents:subject)",
-- 
2.14.2

Reply via email to