If I cg-push on a remote branch after changing my mind about how I
wanted the branch ordered, it will complain and say "maybee you need to
update"
I didn't know what to do, since I was on the "no" side of maybee.
Here is a patch that adds the --force option for those people.
--- /home/pmdumuid/bin/cg-push2 2006-10-12 22:38:49.000000000 +0930
+++ /usr/bin/cg-push 2006-09-26 14:30:09.000000000 +0930
@@ -27,15 +27,8 @@
# future, cg-push should push tags automatically. Also note
# that even if you pass `cg-push` the '-t' arguments, your
# HEAD is still pushed as well in addition to the tags.
-#
-# --force
-# Usually, the command refuses to update a remote ref that is
-# not an ancestor of the local ref used to overwrite it. This
-# flag disables the check. What this means is that the remote
-# repository can lose commits; use it with care.
-#
-#
-USAGE="cg-push [--force] [-r LOCAL_BRANCH] [REMOTE_BRANCH] [-t TAG]..."
+
+USAGE="cg-push [-r LOCAL_BRANCH] [REMOTE_BRANCH] [-t TAG]..."
. "${COGITO_LIB:-/usr/lib/cogito/}"cg-Xlib || exit 1
@@ -44,12 +37,11 @@
{
name="$1"; shift
commit="$(cg-object-id -c "$locbranch")"; old="$(cat "$_git/refs/heads/$name" 2>/dev/null)"
- git-send-pack $force "$@" && git-update-ref refs/heads/"$name" "$commit" $old
+ git-send-pack "$@" && git-update-ref refs/heads/"$name" "$commit" $old
}
locbranch="$_git_head"
-force=""
tags=()
while optparse; do
if optparse -r=; then
@@ -57,8 +49,6 @@
[ "$(cg-object-id -c "$locbranch")" ] || exit 1
elif optparse -t=; then
tags[${#tags[@]}]="refs/tags/$OPTARG"
- elif optparse --force; then
- force="--force"
else
optfail
fi
@@ -79,7 +69,7 @@
sprembranch=":refs/heads/$rembranch"
if [ "${uri#http://}"; != "$uri" -o "${uri#https://}"; != "$uri" ]; then
- git-http-push $force "$uri/" "$locbranch$sprembranch" "${tags[@]}"
+ git-http-push "$uri/" "$locbranch$sprembranch" "${tags[@]}"
elif [ "${uri#git+ssh://}" != "$uri" ]; then
send_pack_update "$name" "$(echo "$uri" | sed 's#^git+ssh://\([^/]*\)\(/.*\)$#\1:\2#')" "$locbranch$sprembranch" "${tags[@]}"
elif [ "${uri#rsync://}" != "$uri" ]; then