* Feature: add --force option to cg-push.
@ 2006-10-12 13:30 Pierre Marc Dumuid
2006-10-17 0:55 ` Petr Baudis
0 siblings, 1 reply; 2+ messages in thread
From: Pierre Marc Dumuid @ 2006-10-12 13:30 UTC (permalink / raw)
To: git
[-- Attachment #1: Type: text/plain, Size: 281 bytes --]
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.
[-- Attachment #2: cg_push_forceoption.diff --]
[-- Type: text/x-patch, Size: 1886 bytes --]
--- /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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Feature: add --force option to cg-push.
2006-10-12 13:30 Feature: add --force option to cg-push Pierre Marc Dumuid
@ 2006-10-17 0:55 ` Petr Baudis
0 siblings, 0 replies; 2+ messages in thread
From: Petr Baudis @ 2006-10-17 0:55 UTC (permalink / raw)
To: Pierre Marc Dumuid; +Cc: git
Dear diary, on Thu, Oct 12, 2006 at 03:30:37PM CEST, I got a letter
where Pierre Marc Dumuid <pierre.dumuid@adelaide.edu.au> said that...
> 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.
--
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*',/((..)*)$/)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-10-17 0:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-12 13:30 Feature: add --force option to cg-push Pierre Marc Dumuid
2006-10-17 0:55 ` Petr Baudis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).