gitbash 1.6.0 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/gitbash +4 -1
- package/commands/branch.sh +15 -9
- package/commands/pr.sh +6 -4
- package/commands/stashes.sh +15 -9
- package/commands/status.sh +5 -3
- package/package.json +1 -1
package/bin/gitbash
CHANGED
|
@@ -325,8 +325,11 @@ while [[ -L "$SOURCE" ]]; do
|
|
|
325
325
|
done
|
|
326
326
|
SCRIPT_DIR="$(cd -P "$(dirname "$SOURCE")/.." && pwd)"
|
|
327
327
|
|
|
328
|
+
# Export so sourced command files can use it
|
|
329
|
+
export SCRIPT_DIR
|
|
330
|
+
|
|
328
331
|
COMMANDS_DIR="$SCRIPT_DIR/commands"
|
|
329
|
-
VERSION="$(grep -o '"version": *"[^"]*"' "$SCRIPT_DIR/package.json" | cut -d'"' -f4)"
|
|
332
|
+
VERSION="$(grep -o '"version": *"[^"]*"' "$SCRIPT_DIR/package.json" | head -1 | cut -d'"' -f4)"
|
|
330
333
|
|
|
331
334
|
# Available commands
|
|
332
335
|
COMMANDS=(
|
package/commands/branch.sh
CHANGED
|
@@ -152,19 +152,25 @@ EOF
|
|
|
152
152
|
# -----------------------------
|
|
153
153
|
case "$selection" in
|
|
154
154
|
"$create_option")
|
|
155
|
-
#
|
|
156
|
-
|
|
157
|
-
|
|
155
|
+
# Use SCRIPT_DIR from parent or compute it
|
|
156
|
+
if [[ -z "${SCRIPT_DIR:-}" ]]; then
|
|
157
|
+
SCRIPT_DIR="$(cd "$SOURCE_DIR/.." && pwd)"
|
|
158
|
+
fi
|
|
159
|
+
"$SCRIPT_DIR/bin/gitbash" create
|
|
158
160
|
;;
|
|
159
161
|
"$switch_option")
|
|
160
|
-
#
|
|
161
|
-
|
|
162
|
-
|
|
162
|
+
# Use SCRIPT_DIR from parent or compute it
|
|
163
|
+
if [[ -z "${SCRIPT_DIR:-}" ]]; then
|
|
164
|
+
SCRIPT_DIR="$(cd "$SOURCE_DIR/.." && pwd)"
|
|
165
|
+
fi
|
|
166
|
+
"$SCRIPT_DIR/bin/gitbash" switch
|
|
163
167
|
;;
|
|
164
168
|
"$update_option")
|
|
165
|
-
#
|
|
166
|
-
|
|
167
|
-
|
|
169
|
+
# Use SCRIPT_DIR from parent or compute it
|
|
170
|
+
if [[ -z "${SCRIPT_DIR:-}" ]]; then
|
|
171
|
+
SCRIPT_DIR="$(cd "$SOURCE_DIR/.." && pwd)"
|
|
172
|
+
fi
|
|
173
|
+
"$SCRIPT_DIR/bin/gitbash" update
|
|
168
174
|
;;
|
|
169
175
|
"$abort_label")
|
|
170
176
|
echo "Aborted."
|
package/commands/pr.sh
CHANGED
|
@@ -93,12 +93,14 @@ EOF
|
|
|
93
93
|
echo "Continuing without committing..."
|
|
94
94
|
;;
|
|
95
95
|
*)
|
|
96
|
-
#
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
# Use SCRIPT_DIR from parent or compute it
|
|
97
|
+
if [[ -z "${SCRIPT_DIR:-}" ]]; then
|
|
98
|
+
SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
|
|
99
|
+
SCRIPT_DIR="$(cd "$SOURCE_DIR/.." && pwd)"
|
|
100
|
+
fi
|
|
99
101
|
|
|
100
102
|
# Run status command for interactive staging and committing
|
|
101
|
-
"$
|
|
103
|
+
"$SCRIPT_DIR/bin/gitbash" status
|
|
102
104
|
if [[ $? -ne 0 ]]; then
|
|
103
105
|
echo "Commit cancelled or failed. Aborting PR creation."
|
|
104
106
|
return 1
|
package/commands/stashes.sh
CHANGED
|
@@ -151,19 +151,25 @@ EOF
|
|
|
151
151
|
# -----------------------------
|
|
152
152
|
case "$selection" in
|
|
153
153
|
"$stash_option")
|
|
154
|
-
#
|
|
155
|
-
|
|
156
|
-
|
|
154
|
+
# Use SCRIPT_DIR from parent or compute it
|
|
155
|
+
if [[ -z "${SCRIPT_DIR:-}" ]]; then
|
|
156
|
+
SCRIPT_DIR="$(cd "$SOURCE_DIR/.." && pwd)"
|
|
157
|
+
fi
|
|
158
|
+
"$SCRIPT_DIR/bin/gitbash" stash
|
|
157
159
|
;;
|
|
158
160
|
"$unstash_option")
|
|
159
|
-
#
|
|
160
|
-
|
|
161
|
-
|
|
161
|
+
# Use SCRIPT_DIR from parent or compute it
|
|
162
|
+
if [[ -z "${SCRIPT_DIR:-}" ]]; then
|
|
163
|
+
SCRIPT_DIR="$(cd "$SOURCE_DIR/.." && pwd)"
|
|
164
|
+
fi
|
|
165
|
+
"$SCRIPT_DIR/bin/gitbash" unstash
|
|
162
166
|
;;
|
|
163
167
|
"$cleanup_option")
|
|
164
|
-
#
|
|
165
|
-
|
|
166
|
-
|
|
168
|
+
# Use SCRIPT_DIR from parent or compute it
|
|
169
|
+
if [[ -z "${SCRIPT_DIR:-}" ]]; then
|
|
170
|
+
SCRIPT_DIR="$(cd "$SOURCE_DIR/.." && pwd)"
|
|
171
|
+
fi
|
|
172
|
+
"$SCRIPT_DIR/bin/gitbash" cleanstash
|
|
167
173
|
;;
|
|
168
174
|
"$abort_label")
|
|
169
175
|
echo "Aborted."
|
package/commands/status.sh
CHANGED
|
@@ -306,10 +306,12 @@ EOF
|
|
|
306
306
|
echo "Ready to commit and push staged changes."
|
|
307
307
|
echo "Press Ctrl+C to abort."
|
|
308
308
|
echo
|
|
309
|
-
#
|
|
310
|
-
|
|
309
|
+
# Use SCRIPT_DIR from parent or compute it
|
|
310
|
+
if [[ -z "${SCRIPT_DIR:-}" ]]; then
|
|
311
|
+
SCRIPT_DIR="$(cd "$SOURCE_DIR/.." && pwd)"
|
|
312
|
+
fi
|
|
311
313
|
# Directly prompt for commit message (user can Ctrl+C to abort)
|
|
312
|
-
"$
|
|
314
|
+
"$SCRIPT_DIR/bin/gitbash" commit -s -p
|
|
313
315
|
break
|
|
314
316
|
fi
|
|
315
317
|
done
|