Skip to content

Commit bee8ea7

Browse files
committed
fix bug in cmd line parsing
1 parent 2d87c76 commit bee8ea7

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

git-get

+4-1
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,13 @@ while [ $# -gt 0 ]; do
153153
OUTPUT="${1#-o=}"
154154
elif [[ "$1" =~ ^-o ]]; then
155155
OUTPUT="${1#-o}"
156-
elif [[ "$1" =~ ^- ]]; then
156+
elif [[ "$1" =~ ^-.. ]]; then
157157
T="$1"
158158
shift
159159
set -- '' "${T:0:2}" "-${T:2}" "$@"
160+
elif [[ "$1" =~ ^- ]]; then
161+
echo "Error: Unrecognized argument $1" >&1
162+
exit 1
160163
else
161164
POSITIONAL+=("$1")
162165
fi

git-gets

+8-1
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,10 @@ while [ $# -gt 0 ]; do
336336
NO_RECURSIVE=YES
337337
shift
338338
;;
339+
--flat)
340+
echo "Error: --flat is no longer supported. Please see man git-gets for more information." >&1
341+
exit 1
342+
;;
339343
*)
340344
if [[ "$1" =~ ^-j ]]; then
341345
PARALLEL="${1#-j}"
@@ -350,10 +354,13 @@ while [ $# -gt 0 ]; do
350354
OUTPUT="${1#-o=}"
351355
elif [[ "$1" =~ ^-o ]]; then
352356
OUTPUT="${1#-o}"
353-
elif [[ "$1" =~ ^- ]]; then
357+
elif [[ "$1" =~ ^-.. ]]; then
354358
T="$1"
355359
shift
356360
set -- '' "${T:0:2}" "-${T:2}" "$@"
361+
elif [[ "$1" =~ ^- ]]; then
362+
echo "Error: Unrecognized argument $1" >&1
363+
exit 1
357364
else
358365
POSITIONAL+=("$1")
359366
fi

man/git-get.1

+2
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ make the downloaded repository look as similar as one
7676
created by an ordinary \fBgit clone\fR at the cost of a little bit
7777
more network bandwidth and disk space.
7878
You cannot use it together with \fB-g\fR nor \fB-t\fR.
79+
Besides, you cannot use \fB-- <path>\fR when \fB-x\fR is set.
7980
Specifically, using \fB-x\fR has the following effects:
8081
.IP \[bu] 2
8182
All commits will be downloaded: you can still view the full history
@@ -104,6 +105,7 @@ cost compared to that with neither of \fB-x\fR nor \fB-g\fR.
104105
However, the actual respository may not be as exploitable as before.
105106
See the discussion of \fB-x\fR to see the difference.
106107
You cannot use it together with \fB-x\fR nor \fB-t\fR.
108+
Besides, you cannot use \fB-- <path>\fR when \fB-g\fR is set.
107109
.RE
108110
.PP
109111
-t, --tag-file=VERSION

0 commit comments

Comments
 (0)