Alois Mahdal пре 9 година
родитељ
комит
a47b83ec9d
2 измењених фајлова са 9 додато и 18 уклоњено
  1. 2
    2
      dotfiles/gittum/bin/findcat
  2. 7
    16
      dotfiles/gittum/bin/sibling

+ 2
- 2
dotfiles/gittum/bin/findcat Прегледај датотеку

2
 
2
 
3
 NAME=$1
3
 NAME=$1
4
 cat ".git_$NAME" 2>/dev/null \
4
 cat ".git_$NAME" 2>/dev/null \
5
-    || cat ".git/gittum/$NAME" 2>/dev/null \
6
-    || cat "$HOME/.gittum/default/$NAME" 2>/dev/null
5
+ || cat ".git/gittum/$NAME" 2>/dev/null \
6
+ || cat "$HOME/.gittum/default/$NAME" 2>/dev/null

+ 7
- 16
dotfiles/gittum/bin/sibling Прегледај датотеку

1
 #!/bin/bash
1
 #!/bin/bash
2
+
2
 #
3
 #
3
 # Take first subdir (or a subdir specified in a file) and consider
4
 # Take first subdir (or a subdir specified in a file) and consider
4
 # it a git repo dir.  Get its origin, exchange the last bit for
5
 # it a git repo dir.  Get its origin, exchange the last bit for
21
 #     $ cd .some/hidden/dir
22
 #     $ cd .some/hidden/dir
22
 #     $ git init
23
 #     $ git init
23
 #     $ git remote add origin ssh://our_server/projects/FAKE
24
 #     $ git remote add origin ssh://our_server/projects/FAKE
24
-
25
-
26
-## funz
27
 #
25
 #
28
 
26
 
29
 die() {
27
 die() {
41
     local to=$2
39
     local to=$2
42
     # create a new remote URI based on current one
40
     # create a new remote URI based on current one
43
     git remote -v \
41
     git remote -v \
44
-        | grep "^$remote" \
45
-        | grep "(fetch)$" \
46
-        | cut -f 2 \
47
-        | cut -d" " -f 1 \
48
-        | perl -pe "s|[^/]+$|$to|;"
42
+      | grep "^$remote" \
43
+      | grep "(fetch)$" \
44
+      | cut -f 2 \
45
+      | cut -d" " -f 1 \
46
+      | perl -pe "s|[^/]+$|$to|;"
49
 }
47
 }
50
 
48
 
51
 think() {
49
 think() {
52
     $verbose && echo "$@"
50
     $verbose && echo "$@"
53
 }
51
 }
54
 
52
 
55
-## initz
56
-#
57
-
58
 sibling_conf=".gittum-sibling"
53
 sibling_conf=".gittum-sibling"
59
 verbose=false
54
 verbose=false
60
 sibling=$(find -maxdepth 1 -type d -name "[^.]*" | sort | head -1)
55
 sibling=$(find -maxdepth 1 -type d -name "[^.]*" | sort | head -1)
74
 test -n "$sibling" || die "could not find older sibling"
69
 test -n "$sibling" || die "could not find older sibling"
75
 test -d "$sibling" || die "sibling does not exist: $sibling"
70
 test -d "$sibling" || die "sibling does not exist: $sibling"
76
 
71
 
77
-
78
-## body
79
-#
80
-
81
 pushd "$sibling" >/dev/null
72
 pushd "$sibling" >/dev/null
82
-new_remote=$(rewrite_uri "$remote_name" "$project")
73
+    new_remote=$(rewrite_uri "$remote_name" "$project")
83
 popd >/dev/null
74
 popd >/dev/null
84
 
75
 
85
 test -n "$new_remote" || die "no such remote at sibling: $new_remote at $sibling"
76
 test -n "$new_remote" || die "no such remote at sibling: $new_remote at $sibling"