Feature: add --force option to cg-push.
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.
usr/bin/cg-push renamed from home/pmdumuid/bin/cg-push2 +4 -14
@@ -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
Dear diary, on Thu, Oct 12, 2006 at 03:30:37PM CEST, I got a letter where Pierre Marc Dumuid <[email protected]> said that...
Quoted 7 lines
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.
Thanks, I've committed a similar but different patch (with better description and handling local pushes as well). Please sign off your patches in the future.
Signature · 5 lines
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
$/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1
lK[d2%Sa2/d0$^Ixp"|dc`;s/\W//g;$_=pack('H*',/((..)*)$/)