@san-siva/gitsy 1.0.6 → 1.0.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/bin/g-diff +7 -7
- package/bin/g-wa +11 -16
- package/package.json +1 -1
package/bin/g-diff
CHANGED
|
@@ -96,7 +96,7 @@ format_diff_output() {
|
|
|
96
96
|
local skip_next_line=false
|
|
97
97
|
|
|
98
98
|
# Process git diff output line by line
|
|
99
|
-
git diff "
|
|
99
|
+
git diff "origin/${target_branch}..${source_branch}" | while IFS= read -r line; do
|
|
100
100
|
if [[ "$line" =~ ^diff\ --git\ a/(.+)\ b/(.+)$ ]]; then
|
|
101
101
|
# New file section
|
|
102
102
|
if [ -n "$current_file" ]; then
|
|
@@ -106,8 +106,8 @@ format_diff_output() {
|
|
|
106
106
|
echo "${BLUE}file:${NC} ${current_file}"
|
|
107
107
|
|
|
108
108
|
# Get stats for this file
|
|
109
|
-
local adds=$(git diff --numstat "
|
|
110
|
-
local dels=$(git diff --numstat "
|
|
109
|
+
local adds=$(git diff --numstat "origin/${target_branch}..${source_branch}" -- "$current_file" | awk '{print $1}')
|
|
110
|
+
local dels=$(git diff --numstat "origin/${target_branch}..${source_branch}" -- "$current_file" | awk '{print $2}')
|
|
111
111
|
if [ -n "$adds" ] && [ -n "$dels" ]; then
|
|
112
112
|
echo "${BLUE}stats:${NC} ${GREEN}+${adds}${NC} ${RED}-${dels}${NC}"
|
|
113
113
|
fi
|
|
@@ -143,7 +143,7 @@ format_diff_output() {
|
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
has_changes() {
|
|
146
|
-
! git diff --quiet "
|
|
146
|
+
! git diff --quiet "origin/${target_branch}..${source_branch}" 2>&1
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
show_full_diff() {
|
|
@@ -162,7 +162,7 @@ show_full_diff() {
|
|
|
162
162
|
|
|
163
163
|
show_files_only() {
|
|
164
164
|
local filenames
|
|
165
|
-
if ! filenames=$(git diff --name-only "
|
|
165
|
+
if ! filenames=$(git diff --name-only "origin/${target_branch}..${source_branch}" 2>&1); then
|
|
166
166
|
echo "$filenames" | indent
|
|
167
167
|
print_message "" -1
|
|
168
168
|
print_message "${RED}Failed to compare branches.${NC}" -1
|
|
@@ -179,7 +179,7 @@ show_files_only() {
|
|
|
179
179
|
|
|
180
180
|
show_stat_summary() {
|
|
181
181
|
local result
|
|
182
|
-
if ! result=$(git -c color.ui=always diff --stat "
|
|
182
|
+
if ! result=$(git -c color.ui=always diff --stat "origin/${target_branch}..${source_branch}" 2>&1); then
|
|
183
183
|
echo "$result" | indent
|
|
184
184
|
print_message "" -1
|
|
185
185
|
print_message "${RED}Failed to compare branches.${NC}" -1
|
|
@@ -190,7 +190,7 @@ show_stat_summary() {
|
|
|
190
190
|
echo "$result" | indent
|
|
191
191
|
|
|
192
192
|
# Copy stats to clipboard (strip color codes)
|
|
193
|
-
local stats_content=$(git diff --stat "
|
|
193
|
+
local stats_content=$(git diff --stat "origin/${target_branch}..${source_branch}")
|
|
194
194
|
copy_to_clipboard "$stats_content" "Stats copied to clipboard."
|
|
195
195
|
else
|
|
196
196
|
print_message "${BLUE}No changes found between ${NC}${source_branch}${BLUE} and ${NC}${target_branch}${BLUE}.${NC}"
|
package/bin/g-wa
CHANGED
|
@@ -159,6 +159,16 @@ checkout_or_create_branch() {
|
|
|
159
159
|
|
|
160
160
|
print_message "${RED}Branch not found on remote.${NC}"
|
|
161
161
|
|
|
162
|
+
# Get current branch and repo info for the "Will create" message
|
|
163
|
+
local current_branch=$(get_current_branch)
|
|
164
|
+
local repo_name=$(get_repo_name)
|
|
165
|
+
local sanitized_target=$(sanitize_branch_name "$target_branch")
|
|
166
|
+
|
|
167
|
+
print_message "" -1
|
|
168
|
+
print_message "${BLUE}Will create ${NC}${target_branch}${BLUE} worktree (cut from ${NC}${current_branch}${BLUE})${NC}" -1
|
|
169
|
+
print_message "Location: ${BLUE}${repo_name}/worktrees/${sanitized_target}${NC}" -1
|
|
170
|
+
print_message "" -1
|
|
171
|
+
|
|
162
172
|
create_new_branch=$(prompt_user true "Create new branch?" $((step_number + 2)))
|
|
163
173
|
if [ "${create_new_branch}" = "y" ]; then
|
|
164
174
|
print_message "${BLUE}Creating ${NC}${target_branch}${BLUE} worktree...${NC}" $((step_number + 3))
|
|
@@ -419,22 +429,7 @@ main() {
|
|
|
419
429
|
if [ $needs_restructure -eq 1 ]; then
|
|
420
430
|
checkout_or_create_branch $((step_number + 4))
|
|
421
431
|
else
|
|
422
|
-
|
|
423
|
-
local sanitized_target=$(sanitize_branch_name "$target_branch")
|
|
424
|
-
print_message "" -1
|
|
425
|
-
print_message "${BLUE}Will create ${NC}${target_branch}${BLUE} worktree (cut from ${NC}${current_branch}${BLUE})${NC}" -1
|
|
426
|
-
print_message "Location: ${BLUE}${repo_name}/worktrees/${sanitized_target}${NC}" -1
|
|
427
|
-
print_message "" -1
|
|
428
|
-
|
|
429
|
-
# Prompt user for confirmation
|
|
430
|
-
local proceed=$(prompt_user false "Proceed with creating worktree?" "$step_number")
|
|
431
|
-
if [ "$proceed" != "y" ]; then
|
|
432
|
-
print_message "" -1
|
|
433
|
-
print_message "${RED}Worktree creation cancelled by user.${NC}" -1
|
|
434
|
-
exit 1
|
|
435
|
-
fi
|
|
436
|
-
|
|
437
|
-
checkout_or_create_branch $((step_number + 1))
|
|
432
|
+
checkout_or_create_branch $step_number
|
|
438
433
|
fi
|
|
439
434
|
}
|
|
440
435
|
|