chiark
/
gitweb
/
~ian
/
chiark-utils.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f4c74ad
)
git-branchmove: new script, still work in progress
author
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Wed, 7 Oct 2015 20:22:46 +0000
(21:22 +0100)
committer
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Wed, 7 Oct 2015 20:22:46 +0000
(21:22 +0100)
scripts/git-branchmove
patch
|
blob
|
history
diff --git
a/scripts/git-branchmove
b/scripts/git-branchmove
index 029992dd776d9cb9067b8bc9b526bb792907a69a..e68c47485993bbde630db68c9711b334010a15b1 100755
(executable)
--- a/
scripts/git-branchmove
+++ b/
scripts/git-branchmove
@@
-61,7
+61,7
@@
get)
src_path="$remote_path"
dst_rune="sh -c"
dst_path=.
src_path="$remote_path"
dst_rune="sh -c"
dst_path=.
- msg="git-branchmove: moved to $remote ($remoteurl)" ;;
+ updatemsg="git-branchmove: moved to $remote ($remoteurl)"
push_fetch=fetch
;;
put)
push_fetch=fetch
;;
put)
@@
-69,7
+69,7
@@
put)
dst_path="$remote_path"
src_rune="sh -c"
src_path=.
dst_path="$remote_path"
src_rune="sh -c"
src_path=.
- msg="git-branchmove; moved to `hostname -f` by `whoami`" ;;
+ updatemsg="git-branchmove; moved to `hostname -f` by `whoami`"
push_fetch=push
;;
esac
push_fetch=push
;;
esac
@@
-116,6
+116,12
@@
H) ;; # already detached
;;
esac
;;
esac
+
+if [ "${#src_branches[@]}" = 0 ]; then
+ echo >&2 "git-branchmove: nothing to do"
+ exit 1
+fi
+
dst_branches=( $(on_dst "$get_branches_rune") )
: "${dst_branches[@]}"
dst_branches=( $(on_dst "$get_branches_rune") )
: "${dst_branches[@]}"
@@
-157,16
+163,16
@@
esac
#----- delete the refs on the source -----
(
#----- delete the refs on the source -----
(
- printf "%s\n" "$
message
"
+ printf "%s\n" "$
updatemsg
"
for src_rm in "${src_branches[@]}"; do printf "%s\n" "$src_rm"; done
) | on_src '
for src_rm in "${src_branches[@]}"; do printf "%s\n" "$src_rm"; done
) | on_src '
- read
message
+ read
updatemsg
while read src_rm; do
src_ref="${src_rm%=*}"
src_obj="${src_rm##*=}"
while read src_rm; do
src_ref="${src_rm%=*}"
src_obj="${src_rm##*=}"
- git update-ref -m "$
message
" -d "$src_ref" "$src_obj"
+ git update-ref -m "$
updatemsg
" -d "$src_ref" "$src_obj"
echo "move complete: $src_ref"
done
'
echo "move complete: $src_ref"
done
'
-echo
'moved ${#src_branches[@]} branches.'
+echo
"moved ${#src_branches[@]} branches."