gitbash 1.6.0 → 1.6.2
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 +3 -9
- package/commands/cleanup.sh +2 -9
- package/commands/pr.sh +1 -5
- package/commands/stashes.sh +3 -9
- package/commands/status.sh +1 -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,13 @@ EOF
|
|
|
152
152
|
# -----------------------------
|
|
153
153
|
case "$selection" in
|
|
154
154
|
"$create_option")
|
|
155
|
-
|
|
156
|
-
GITBASH_ROOT="$(cd "$SOURCE_DIR/.." && pwd)"
|
|
157
|
-
"$GITBASH_ROOT/bin/gitbash" create
|
|
155
|
+
gitbash create
|
|
158
156
|
;;
|
|
159
157
|
"$switch_option")
|
|
160
|
-
|
|
161
|
-
GITBASH_ROOT="$(cd "$SOURCE_DIR/.." && pwd)"
|
|
162
|
-
"$GITBASH_ROOT/bin/gitbash" switch
|
|
158
|
+
gitbash switch
|
|
163
159
|
;;
|
|
164
160
|
"$update_option")
|
|
165
|
-
|
|
166
|
-
GITBASH_ROOT="$(cd "$SOURCE_DIR/.." && pwd)"
|
|
167
|
-
"$GITBASH_ROOT/bin/gitbash" update
|
|
161
|
+
gitbash update
|
|
168
162
|
;;
|
|
169
163
|
"$abort_label")
|
|
170
164
|
echo "Aborted."
|
package/commands/cleanup.sh
CHANGED
|
@@ -164,21 +164,14 @@ EOF
|
|
|
164
164
|
recent_branches=()
|
|
165
165
|
|
|
166
166
|
# Variables for loop (declared once to avoid zsh output on redeclaration)
|
|
167
|
-
local last_commit_ts relative_date author_email author_name
|
|
168
167
|
local has_remote configured_upstream entry
|
|
169
168
|
|
|
170
169
|
# Process each local branch
|
|
171
|
-
while IFS= read -r branch; do
|
|
170
|
+
while IFS='|' read -r branch last_commit_ts relative_date author_email author_name; do
|
|
172
171
|
# Skip base branch
|
|
173
172
|
[[ "$branch" == "$base_branch" ]] && continue
|
|
174
173
|
[[ -z "$branch" ]] && continue
|
|
175
174
|
|
|
176
|
-
# Get last commit info for all branches
|
|
177
|
-
last_commit_ts=$(git log -1 --format='%ct' "$branch" 2>/dev/null)
|
|
178
|
-
relative_date=$(git log -1 --format='%cr' "$branch" 2>/dev/null)
|
|
179
|
-
author_email=$(git log -1 --format='%ae' "$branch" 2>/dev/null)
|
|
180
|
-
author_name=$(git log -1 --format='%an' "$branch" 2>/dev/null)
|
|
181
|
-
|
|
182
175
|
# Check if remote branch exists
|
|
183
176
|
has_remote=false
|
|
184
177
|
if echo "$remote_branches" | grep -qx "$branch"; then
|
|
@@ -201,7 +194,7 @@ EOF
|
|
|
201
194
|
# Recent: has recent activity (don't pre-select)
|
|
202
195
|
recent_branches+=("$entry")
|
|
203
196
|
fi
|
|
204
|
-
done < <(git for-each-ref --format='%(refname:short)' refs/heads)
|
|
197
|
+
done < <(git for-each-ref --format='%(refname:short)|%(committerdate:unix)|%(committerdate:relative)|%(committeremail)|%(committername)' refs/heads)
|
|
205
198
|
|
|
206
199
|
# Sort each category by timestamp (most recent first), compatible with bash 3.x (no mapfile)
|
|
207
200
|
_sort_desc() {
|
package/commands/pr.sh
CHANGED
|
@@ -93,12 +93,8 @@ EOF
|
|
|
93
93
|
echo "Continuing without committing..."
|
|
94
94
|
;;
|
|
95
95
|
*)
|
|
96
|
-
# Find gitbash root directory (two levels up from commands/)
|
|
97
|
-
SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
|
|
98
|
-
GITBASH_ROOT="$(cd "$SOURCE_DIR/.." && pwd)"
|
|
99
|
-
|
|
100
96
|
# Run status command for interactive staging and committing
|
|
101
|
-
|
|
97
|
+
gitbash status
|
|
102
98
|
if [[ $? -ne 0 ]]; then
|
|
103
99
|
echo "Commit cancelled or failed. Aborting PR creation."
|
|
104
100
|
return 1
|
package/commands/stashes.sh
CHANGED
|
@@ -151,19 +151,13 @@ EOF
|
|
|
151
151
|
# -----------------------------
|
|
152
152
|
case "$selection" in
|
|
153
153
|
"$stash_option")
|
|
154
|
-
|
|
155
|
-
GITBASH_ROOT="$(cd "$SOURCE_DIR/.." && pwd)"
|
|
156
|
-
"$GITBASH_ROOT/bin/gitbash" stash
|
|
154
|
+
gitbash stash
|
|
157
155
|
;;
|
|
158
156
|
"$unstash_option")
|
|
159
|
-
|
|
160
|
-
GITBASH_ROOT="$(cd "$SOURCE_DIR/.." && pwd)"
|
|
161
|
-
"$GITBASH_ROOT/bin/gitbash" unstash
|
|
157
|
+
gitbash unstash
|
|
162
158
|
;;
|
|
163
159
|
"$cleanup_option")
|
|
164
|
-
|
|
165
|
-
GITBASH_ROOT="$(cd "$SOURCE_DIR/.." && pwd)"
|
|
166
|
-
"$GITBASH_ROOT/bin/gitbash" cleanstash
|
|
160
|
+
gitbash cleanstash
|
|
167
161
|
;;
|
|
168
162
|
"$abort_label")
|
|
169
163
|
echo "Aborted."
|
package/commands/status.sh
CHANGED
|
@@ -306,10 +306,8 @@ EOF
|
|
|
306
306
|
echo "Ready to commit and push staged changes."
|
|
307
307
|
echo "Press Ctrl+C to abort."
|
|
308
308
|
echo
|
|
309
|
-
# Find gitbash root directory (two levels up from commands/)
|
|
310
|
-
GITBASH_ROOT="$(cd "$SOURCE_DIR/.." && pwd)"
|
|
311
309
|
# Directly prompt for commit message (user can Ctrl+C to abort)
|
|
312
|
-
|
|
310
|
+
gitbash commit -s -p
|
|
313
311
|
break
|
|
314
312
|
fi
|
|
315
313
|
done
|