Skip to content

Commit 894474c

Browse files
authored
Merge pull request #21 from bexelbie/infinite_depth
Add infinite depth option
2 parents c9da2c9 + dcafd0f commit 894474c

4 files changed

Lines changed: 35 additions & 20 deletions

File tree

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
mgitstatus
22
==========
33

4-
Show uncommited, untracked and unpushed changes in multiple Git repositories.
4+
Show uncommited, untracked and unpushed changes in multiple Git
5+
repositories. Scan for .git dirs up to **DEPTH** directories deep.
6+
The default is 2. If **DEPTH** is 0, the scan is infinitely deep.
7+
mgitstatus shows:
58

69
![](https://raw.githubusercontent.com/fboender/mgitstatus/master/screenshot.png)
710

@@ -33,7 +36,9 @@ for that repo to `true`. (See "usage" below for an example).
3336

3437
Usage: mgitstatus [--version] [-w] [-e] [-f] [--no-X] [DIR] [DEPTH=2]
3538

36-
Scan for .git dirs under DIR (up to DEPTH dirs deep) and show git status
39+
Scan for .git dirs under DIR and show git status. The scan goes 2
40+
directories deep by default or the number specified by DEPTH deep.
41+
If DEPTH=0, the scan is infinitely deep.
3742

3843
--version Show version
3944
-w Warn about dirs that are not Git repositories

mgitstatus

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ usage () {
1010
1111
Usage: $0 [--version] [-w] [-e] [-f] [--no-X] [DIR] [DEPTH=2]
1212
13-
Scan for .git dirs under DIR (up to DEPTH dirs deep) and show git status
13+
Scan for .git dirs under DIR and show git status. The scan goes 2
14+
directories deep by default or the number specified by DEPTH deep.
15+
If DEPTH=0, the scan is infinitely deep.
1416
1517
--version Show version
1618
-w Warn about dirs that are not Git repositories
@@ -96,6 +98,8 @@ fi
9698

9799
if [ -z "$2" ]; then
98100
DEPTH=2
101+
elif [ "$2" -eq 0 ]; then
102+
DEPTH=""
99103
else
100104
DEPTH="$2"
101105
fi
@@ -121,7 +125,7 @@ C_UNTRACKED="$C_CYAN"
121125
C_STASHES="$C_YELLOW"
122126

123127
# Find all .git dirs, up to DEPTH levels deep
124-
find -L "$ROOT_DIR" -maxdepth "$DEPTH" -type d | while read -r PROJ_DIR
128+
find -L "$ROOT_DIR" ${DEPTH:+"-maxdepth"} ${DEPTH:+"$DEPTH"} -type d | while read -r PROJ_DIR
125129
do
126130
GIT_DIR="$PROJ_DIR/.git"
127131
GIT_CONF="$PROJ_DIR/.git/config"

mgitstatus.1

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.\" Automatically generated by Pandoc 1.19.2.4
1+
.\" Automatically generated by Pandoc 2.2.1
22
.\"
33
.TH "MGITSTATUS" "1" "Jul 2019" "" ""
44
.hy
@@ -8,12 +8,17 @@ mgitstatus \[en] Show uncommitted, untracked and unpushed changes for
88
multiple Git repos.
99
.SH SYNOPSIS
1010
.PP
11-
\f[B]mgitstatus\f[] [\f[B]\-\-version\f[]] [\f[B]\-w\f[]] [\f[B]\-e\f[]]
12-
[\f[B]\-f\f[]] [\f[B]\-\-no\-X\f[]] [\f[B]DIR\f[]] [\f[B]DEPTH=2\f[]]
11+
\f[B]mgitstatus\f[] [\f[B]\[en]version\f[]] [\f[B]\-w\f[]]
12+
[\f[B]\-e\f[]] [\f[B]\-f\f[]] [\f[B]\[en]no\-X\f[]] [\f[B]DIR\f[]]
13+
[\f[B]DEPTH=2\f[]]
1314
.SH DESCRIPTION
1415
.PP
1516
\f[B]mgitstatus\f[] shows uncommited, untracked and unpushed changes in
1617
multiple Git repositories.
18+
\f[B]mgitstatus\f[] scans for .git dirs up to \f[B]DEPTH\f[] directories
19+
deep.
20+
The default is 2.
21+
If \f[B]DEPTH\f[] is 0, the scan is infinitely deep.
1722
mgitstatus shows:
1823
.IP \[bu] 2
1924
\f[B]Uncommitted changes\f[] if there are unstaged or uncommitted
@@ -32,8 +37,7 @@ Changes in the branch may otherwise never be pushed or merged.
3237
\f[B]Needs pull (BRANCH)\f[] if the branch is tracking a (remote) branch
3338
which is ahead.
3439
This requires that the local git repo already knows about the remote
35-
changes (i.e.
36-
you\[aq]ve done a fetch), or that you specify the \-f option.
40+
changes (i.e.\ you've done a fetch), or that you specify the \-f option.
3741
mgitstatus does NOT contact the remote by default.
3842
.IP \[bu] 2
3943
\f[B]X stashes\f[] if there are stashes.
@@ -42,7 +46,7 @@ Since there are a lot of different states a git repository can be in,
4246
mgitstatus makes no guarantees that all states are taken into account.
4347
.SH OPTIONS
4448
.TP
45-
.B \f[B]\-\-version\f[]
49+
.B \f[B]\[en]version\f[]
4650
Show version
4751
.RS
4852
.RE
@@ -53,12 +57,12 @@ Warn about dirs that are not Git repositories
5357
.RE
5458
.TP
5559
.B \f[B]\-e\f[]
56-
Exclude repos that are \[aq]ok\[aq]
60+
Exclude repos that are `ok'
5761
.RS
5862
.RE
5963
.TP
6064
.B \f[B]\-f\f[]
61-
Do a \[aq]git fetch\[aq] on each repo (slow for many repos)
65+
Do a `git fetch' on each repo (slow for many repos)
6266
.RS
6367
.RE
6468
.TP
@@ -69,32 +73,32 @@ Force color output (preserve colors when using pipes)
6973
.PP
7074
You can limit output with the following options:
7175
.TP
72-
.B \f[B]\-\-no\-push\f[]
76+
.B \f[B]\[en]no\-push\f[]
7377
Do not show branches that need a push.
7478
.RS
7579
.RE
7680
.TP
77-
.B \f[B]\-\-no\-pull\f[]
81+
.B \f[B]\[en]no\-pull\f[]
7882
Do not show branches that need a pull.
7983
.RS
8084
.RE
8185
.TP
82-
.B \f[B]\-\-no\-upstream\f[]
86+
.B \f[B]\[en]no\-upstream\f[]
8387
Do not show branches that need an upstream.
8488
.RS
8589
.RE
8690
.TP
87-
.B \f[B]\-\-no\-uncommited\f[]
91+
.B \f[B]\[en]no\-uncommited\f[]
8892
Do not show branches that have unstaged or uncommitted changes.
8993
.RS
9094
.RE
9195
.TP
92-
.B \f[B]\-\-no\-untracked\f[]
96+
.B \f[B]\[en]no\-untracked\f[]
9397
Do not show branches that have untracked files.
9498
.RS
9599
.RE
96100
.TP
97-
.B \f[B]\-\-no\-stashes\f[]
101+
.B \f[B]\[en]no\-stashes\f[]
98102
Do now show stashes
99103
.RS
100104
.RE
@@ -121,7 +125,7 @@ $\ mgitstatus\ 3
121125
.fi
122126
.PP
123127
The following command scans three levels deep in \f[C]/opt/deploy/\f[]
124-
and hides repos that are \[aq]ok\[aq].
128+
and hides repos that are `ok'.
125129
It does not show stashes:
126130
.IP
127131
.nf

mgitstatus.1.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ mgitstatus – Show uncommitted, untracked and unpushed changes for multiple Git
1313
# DESCRIPTION
1414

1515
**mgitstatus** shows uncommited, untracked and unpushed changes in multiple
16-
Git repositories. mgitstatus shows:
16+
Git repositories. **mgitstatus** scans for .git dirs up to **DEPTH**
17+
directories deep. The default is 2. If **DEPTH** is 0, the scan is
18+
infinitely deep. mgitstatus shows:
1719

1820
- **Uncommitted changes** if there are unstaged or uncommitted changes on the
1921
checked out branch.

0 commit comments

Comments
 (0)