git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* 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

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).