gitbash 1.3.5 → 1.3.7

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/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Interactive git utilities for bash with fzf-powered menus.
4
4
 
5
- ![screenshot-status..png](./doc/screenshot-status.png)
5
+ ![screenshot-status.png](./doc/screenshot-status.png)
6
6
 
7
7
  ## Installation
8
8
 
@@ -101,19 +101,42 @@ EOF
101
101
  fi
102
102
  }
103
103
  )
104
- selected_branch=$(
105
- fzf \
106
- --height=40% \
107
- --reverse \
108
- --border \
109
- --prompt="Select branch: " \
110
- --query="$filter" \
111
- -i \
112
- --preview="branch=\$(echo {} | sed 's/^[^:]*: //'); if [[ \"\$branch\" == *───* ]]; then echo 'Spacer - not selectable'; else git log --color=always -n 1 --format='%C(bold cyan)Author:%C(reset) %an%n%C(bold cyan)Date:%C(reset) %ar (%ad)%n%C(bold cyan)Message:%C(reset) %s%n' --date=format:'%Y-%m-%d %H:%M' \"\$branch\" 2>/dev/null && echo && git log --oneline --color=always -n 10 \"\$branch\" 2>/dev/null; fi" \
113
- --preview-window=right:50% \
114
- --header="Current: $current_branch" \
115
- <<< "$branch_list"
116
- ) </dev/tty || true
104
+
105
+ # -----------------------------
106
+ # 3b. Check for single match when filter is provided
107
+ # -----------------------------
108
+ if [[ -n "$filter" ]]; then
109
+ # Filter branch list (case-insensitive), excluding spacer
110
+ local matching_branches
111
+ matching_branches=$(echo "$branch_list" | grep -iv '───' | grep -i "$filter" || true)
112
+ local match_count
113
+ match_count=$(echo "$matching_branches" | grep -c . || echo "0")
114
+
115
+ if [[ "$match_count" -eq 1 ]]; then
116
+ # Single match - skip fzf
117
+ selected_branch="$matching_branches"
118
+ print_info "Single match found, switching directly..."
119
+ fi
120
+ fi
121
+
122
+ # -----------------------------
123
+ # 3c. Use fzf if no single match
124
+ # -----------------------------
125
+ if [[ -z "$selected_branch" ]]; then
126
+ selected_branch=$(
127
+ fzf \
128
+ --height=40% \
129
+ --reverse \
130
+ --border \
131
+ --prompt="Select branch: " \
132
+ --query="$filter" \
133
+ -i \
134
+ --preview="branch=\$(echo {} | sed 's/^[^:]*: //'); if [[ \"\$branch\" == *───* ]]; then echo 'Spacer - not selectable'; else git log --color=always -n 1 --format='%C(bold cyan)Author:%C(reset) %an%n%C(bold cyan)Date:%C(reset) %ar (%ad)%n%C(bold cyan)Message:%C(reset) %s%n' --date=format:'%Y-%m-%d %H:%M' \"\$branch\" 2>/dev/null && echo && git log --oneline --color=always -n 10 \"\$branch\" 2>/dev/null; fi" \
135
+ --preview-window=right:50% \
136
+ --header="Current: $current_branch" \
137
+ <<< "$branch_list"
138
+ ) </dev/tty || true
139
+ fi
117
140
 
118
141
  # -----------------------------
119
142
  # 4. Handle selection
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitbash",
3
- "version": "1.3.5",
3
+ "version": "1.3.7",
4
4
  "description": "Opinionated git utilities for bash with fzf-powered menus",
5
5
  "author": "jaggli",
6
6
  "license": "MIT",
@@ -29,6 +29,7 @@
29
29
  "files": [
30
30
  "bin/",
31
31
  "commands/",
32
+ "doc/",
32
33
  "README.md",
33
34
  "LICENSE"
34
35
  ],