|
@@ -36,14 +36,16 @@ usage() {
|
36
|
36
|
exit 0
|
37
|
37
|
}
|
38
|
38
|
|
39
|
|
-rewrite_uri_to () {
|
|
39
|
+rewrite_uri () {
|
|
40
|
+ local remote=$1
|
|
41
|
+ local to=$2
|
40
|
42
|
# create a new remote URI based on current one
|
41
|
43
|
git remote -v \
|
42
|
|
- | grep "^$origin_name" \
|
|
44
|
+ | grep "^$remote" \
|
43
|
45
|
| grep "(fetch)$" \
|
44
|
46
|
| cut -f 2 \
|
45
|
47
|
| cut -d" " -f 1 \
|
46
|
|
- | perl -pe "s|[^/]+$|$1|;"
|
|
48
|
+ | perl -pe "s|[^/]+$|$to|;"
|
47
|
49
|
}
|
48
|
50
|
|
49
|
51
|
think() {
|
|
@@ -93,8 +95,10 @@ test -n "$sibling" || die "could not find older sibling"
|
93
|
95
|
#
|
94
|
96
|
|
95
|
97
|
pushd "$sibling" >/dev/null
|
96
|
|
-new_remote=$(rewrite_uri_to $project)
|
|
98
|
+new_remote=$(rewrite_uri $remote_name $project)
|
97
|
99
|
popd >/dev/null
|
98
|
100
|
|
|
101
|
+test -n "$new_remote" || die "no such remote at sibling: $new_remote at $sibling"
|
|
102
|
+
|
99
|
103
|
think \'git clone $new_remote\'
|
100
|
104
|
git clone $new_remote
|