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