Skip to content

Commit 714cfe3

Browse files
committed
Add option --has-stash
And the negative option --has-no-stash.
1 parent 4de4df9 commit 714cfe3

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

git-iterate

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ options=""
4949
quiet="false"
5050
display_only="false"
5151
clean=""
52+
stash=""
53+
tracking_head=""
5254
behind=""
5355
ahead=""
5456
detached=""
@@ -102,6 +104,14 @@ do
102104
shift
103105
clean="5"
104106
continue
107+
elif [ "$folder" = "--has-stash" ]; then
108+
shift
109+
stash="1"
110+
continue
111+
elif [ "$folder" = "--has-no-stash" ]; then
112+
shift
113+
stash="0"
114+
continue
105115
elif [ "$folder" = "--tracking-head" ]; then
106116
shift
107117
tracking_head="1"
@@ -285,6 +295,16 @@ do
285295
continue
286296
fi
287297
fi
298+
if [ -n "$stash" ]; then
299+
status=$(git stash list)
300+
if [ -n "$status" -a "$stash" = '0' ]; then
301+
cd "$OLDPWD"
302+
continue
303+
elif [ -z "$status" -a "$stash" = '1' ]; then
304+
cd "$OLDPWD"
305+
continue
306+
fi
307+
fi
288308
if [ "$tracking_head" = "1" ]; then
289309
symbolic_head=$(LANG="en" git rev-parse --symbolic-full-name HEAD)
290310
is_branch=`echo -n "$symbolic_head"|cut -c 1-11`

0 commit comments

Comments
 (0)