File tree Expand file tree Collapse file tree 2 files changed +25
-14
lines changed
Expand file tree Collapse file tree 2 files changed +25
-14
lines changed Original file line number Diff line number Diff line change @@ -233,19 +233,26 @@ parse_args() {
233233 print_debug " Debug: No target specified, defaulting to current working tree."
234234 GIV_REVISION=" --current"
235235 fi
236-
237- print_debug " Parsing revision"
238- # 3. Collect all non-option args as pattern (until first option or end)
239- while [ $# -gt 0 ] && [ " ${1# -} " = " $1 " ]; do
240- # If the first argument is a pattern, collect it
241- print_debug " Collecting pattern: $1 "
242- if [ -z " ${GIV_PATHSPEC} " ]; then
243- GIV_PATHSPEC=" $1 "
244- else
245- GIV_PATHSPEC=" ${GIV_PATHSPEC} $1 "
246- fi
247- shift
248- done
236+
237+ print_debug " Parsing revision"
238+ print_debug " ${@ } "
239+ # 3. Collect all non-option args as pattern (until first option or end)
240+ # Only collect pathspec if there are non-option args left AND they are not files like the script itself
241+ while [ $# -gt 0 ] && [ " ${1# -} " = " $1 " ]; do
242+ # Avoid setting pathspec to the script name itself (e.g., install.sh)
243+ if [ " $1 " = " $( basename " $0 " ) " ]; then
244+ print_debug " Skipping script name argument: $1 "
245+ shift
246+ continue
247+ fi
248+ print_debug " Collecting pattern: $1 "
249+ if [ -z " ${GIV_PATHSPEC} " ]; then
250+ GIV_PATHSPEC=" $1 "
251+ else
252+ GIV_PATHSPEC=" ${GIV_PATHSPEC} $1 "
253+ fi
254+ shift
255+ done
249256
250257 print_debug " Target and pattern parsed: ${GIV_REVISION} , ${GIV_PATHSPEC} "
251258
Original file line number Diff line number Diff line change @@ -69,11 +69,12 @@ setup() {
6969 generate_response () {
7070 print_debug " Mock generate_response called with args: $* "
7171 echo " RESP"
72+ cat " $1 " || true
7273 }
7374 export -f generate_response
7475
7576 # make helper stubs
76- build_history () { printf " HIST:%s\n" " $2 " > " $1 " ; }
77+ # build_history() { printf "HIST:%s\n" "$2" >"$1"; }
7778 # generate_response() { echo "RESP"; }
7879 portable_mktemp () { mktemp; }
7980 get_project_version () { echo " 1.2.3" ; }
@@ -102,6 +103,7 @@ teardown() {
102103# ----------------------------------------
103104@test " cmd_message with no id errors" {
104105 echo " some working changes" > " $REPO /file.txt"
106+ export GIV_DEBUG=" true"
105107 run cmd_message " "
106108 assert_success
107109 assert_output --partial " RESP"
@@ -110,6 +112,8 @@ teardown() {
110112 echo " change" > " $REPO /file.txt"
111113 run cmd_message " --current"
112114 assert_success
115+ assert_output --partial " file.txt"
116+ assert_output --partial " +change"
113117}
114118@test " cmd_message single-commit prints message" {
115119 run git -C " $REPO " rev-parse HEAD~1 # ensure HEAD~1 exists
You can’t perform that action at this time.
0 commit comments