@san-siva/gitsy 1.0.16 → 1.0.17

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
@@ -5,7 +5,7 @@ A set of bash utilities for managing Git repositories with ease. Provides user-f
5
5
 
6
6
  ## Documentation
7
7
 
8
- For complete documentation, usage examples, and detailed command reference, visit the [gitsy documentation website](https://gitsy-56895.web.app).
8
+ For complete documentation, usage examples, and detailed command reference, visit the [gitsy documentation website](https://gitsy.santhoshsiva.dev).
9
9
 
10
10
  ## System Requirements
11
11
 
@@ -151,7 +151,7 @@ g-push
151
151
  g-diff -s main -t feature-branch
152
152
  ```
153
153
 
154
- For complete command documentation and advanced usage examples, visit the [gitsy documentation website](https://gitsy-56895.web.app).
154
+ For complete command documentation and advanced usage examples, visit the [gitsy documentation website](https://gitsy.santhoshsiva.dev).
155
155
 
156
156
  ## Features
157
157
 
@@ -267,7 +267,7 @@ This project is licensed under the MIT License. See the LICENSE file for details
267
267
 
268
268
  **Santhosh Siva**
269
269
  - GitHub: [@san-siva](https://github.com/san-siva)
270
- - Documentation: [gitsy-56895.web.app](https://gitsy-56895.web.app)
270
+ - Documentation: [gitsy.santhoshsiva.dev](https://gitsy.santhoshsiva.dev)
271
271
 
272
272
  ## Acknowledgments
273
273
 
package/bin/g-wr CHANGED
@@ -210,10 +210,16 @@ remove_worktree() {
210
210
 
211
211
  print_message "${BLUE}Removing worktree at ${NC}${worktree_path}${BLUE}...${NC}" $step_number
212
212
 
213
- # Always try using git worktree remove first with --force flag
214
- if git -c color.ui=always worktree remove --force "$worktree_path" 2>&1 | indent; then
213
+ local worktree_parent
214
+ worktree_parent=$(dirname "$worktree_path")
215
+
216
+ # Always try using git worktree remove first with --force --force to handle
217
+ # both uncommitted changes and untracked files
218
+ if git -c color.ui=always worktree remove --force --force "$worktree_path" 2>&1 | indent; then
215
219
  # Verify the directory was actually removed
216
220
  if [ ! -d "$worktree_path" ]; then
221
+ # Navigate to parent in case we were running from inside the removed worktree
222
+ cd "$worktree_parent" 2>/dev/null
217
223
  print_message "${GREEN}Worktree removed successfully.${NC}" 0
218
224
  return 0
219
225
  fi
@@ -222,6 +228,8 @@ remove_worktree() {
222
228
  # Fallback to rm -rf if git worktree remove failed
223
229
  print_message "${PROMPT}Git worktree remove incomplete. Attempting manual removal...${NC}" 0
224
230
  if rm -rf "$worktree_path" 2>&1 | indent; then
231
+ # Navigate to parent before pruning since the worktree directory no longer exists
232
+ cd "$worktree_parent" 2>/dev/null
225
233
  # Also need to prune the worktree from git's records
226
234
  git -c color.ui=always worktree prune 2>&1 | indent
227
235
  # Verify the directory was actually removed
package/bin/utils CHANGED
@@ -384,9 +384,15 @@ pull_changes() {
384
384
  fi
385
385
 
386
386
  print_message "${BLUE}Pulling changes from ${NC}remote/${target_branch}${BLUE}...${NC}" $step_number
387
- if ! git -c color.ui=always pull origin "${target_branch}" 2>&1 | indent; then
387
+ git -c color.ui=always pull origin "${target_branch}" 2>&1 | indent
388
+ local pull_exit=${PIPESTATUS[0]}
389
+ if [ $pull_exit -ne 0 ]; then
388
390
  print_message "" -1
389
- print_message "${RED}Failed to pull changes from remote. [Fail]${NC}" -1
391
+ if git diff --name-only --diff-filter=U 2>/dev/null | grep -q .; then
392
+ print_message "${RED}Merge conflicts detected. Resolve conflicts and then commit. [Fail]${NC}" -1
393
+ else
394
+ print_message "${RED}Failed to pull changes from remote. [Fail]${NC}" -1
395
+ fi
390
396
  exit 1
391
397
  fi
392
398
  print_message "${GREEN}Pulled changes from ${NC}remote/${target_branch} ${GREEN}successfully.${NC}"
@@ -473,10 +479,15 @@ navigate_to_dir() {
473
479
  if [ -z "$dir" ]; then
474
480
  return 1
475
481
  fi
476
- if pwd | grep -Fq "$dir"; then
482
+ local target
483
+ target=$(cd "$dir" 2>/dev/null && pwd)
484
+ if [ $? -ne 0 ]; then
485
+ return 1
486
+ fi
487
+ if [ "$(pwd)" = "$target" ]; then
477
488
  return 0
478
489
  fi
479
- if ! cd "$dir" 2>/dev/null; then
490
+ if ! cd "$target" 2>/dev/null; then
480
491
  return 1
481
492
  fi
482
493
  return 0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@san-siva/gitsy",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "description": "A set of bash utilities for managing Git repositories with ease",
5
5
  "keywords": [
6
6
  "git",