Browse Source

Use exit statuses consistent with Shellfu conventions

Alois Mahdal 6 years ago
parent
commit
6ac6328fba
1 changed files with 6 additions and 2 deletions
  1. 6
    2
      dotfiles/gittum/bin/remote-edit

+ 6
- 2
dotfiles/gittum/bin/remote-edit View File

10
 
10
 
11
 die() {
11
 die() {
12
     warn "$@"
12
     warn "$@"
13
-    exit 1
13
+    exit 3
14
 }
14
 }
15
 
15
 
16
 usage() {
16
 usage() {
17
     warn "usage: git $(basename "$0") [-v|--verbose] REMOTE"
17
     warn "usage: git $(basename "$0") [-v|--verbose] REMOTE"
18
-    exit 0
18
+    exit 2
19
 }
19
 }
20
 
20
 
21
 think() {
21
 think() {
39
     think "remote='$remote'"
39
     think "remote='$remote'"
40
     oldurl=$(git remote get-url "$remote") \
40
     oldurl=$(git remote get-url "$remote") \
41
      || die "failed to get old URL"
41
      || die "failed to get old URL"
42
+    test "$newurl" == "$oldurl" && {
43
+        warn "URL was not changed"
44
+        return 1
45
+    }
42
     think "oldurl='$oldurl'"
46
     think "oldurl='$oldurl'"
43
     think "EDITOR='$EDITOR'"
47
     think "EDITOR='$EDITOR'"
44
     think "VISUAL='$VISUAL'"
48
     think "VISUAL='$VISUAL'"