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 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=(
@@ -152,19 +152,13 @@ EOF
152
152
  # -----------------------------
153
153
  case "$selection" in
154
154
  "$create_option")
155
- # Find gitbash root directory
156
- GITBASH_ROOT="$(cd "$SOURCE_DIR/.." && pwd)"
157
- "$GITBASH_ROOT/bin/gitbash" create
155
+ gitbash create
158
156
  ;;
159
157
  "$switch_option")
160
- # Find gitbash root directory
161
- GITBASH_ROOT="$(cd "$SOURCE_DIR/.." && pwd)"
162
- "$GITBASH_ROOT/bin/gitbash" switch
158
+ gitbash switch
163
159
  ;;
164
160
  "$update_option")
165
- # Find gitbash root directory
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."
@@ -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
- "$GITBASH_ROOT/bin/gitbash" status
97
+ gitbash status
102
98
  if [[ $? -ne 0 ]]; then
103
99
  echo "Commit cancelled or failed. Aborting PR creation."
104
100
  return 1
@@ -151,19 +151,13 @@ EOF
151
151
  # -----------------------------
152
152
  case "$selection" in
153
153
  "$stash_option")
154
- # Find gitbash root directory
155
- GITBASH_ROOT="$(cd "$SOURCE_DIR/.." && pwd)"
156
- "$GITBASH_ROOT/bin/gitbash" stash
154
+ gitbash stash
157
155
  ;;
158
156
  "$unstash_option")
159
- # Find gitbash root directory
160
- GITBASH_ROOT="$(cd "$SOURCE_DIR/.." && pwd)"
161
- "$GITBASH_ROOT/bin/gitbash" unstash
157
+ gitbash unstash
162
158
  ;;
163
159
  "$cleanup_option")
164
- # Find gitbash root directory
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."
@@ -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
- "$GITBASH_ROOT/bin/gitbash" commit -s -p
310
+ gitbash commit -s -p
313
311
  break
314
312
  fi
315
313
  done
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitbash",
3
- "version": "1.6.0",
3
+ "version": "1.6.2",
4
4
  "description": "Opinionated git utilities for bash with fzf-powered menus",
5
5
  "author": "jaggli",
6
6
  "license": "MIT",