git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Feature: add --force option to cg-push.

From
PDPierre Marc Dumuid <pierre.dumuid@adelaide.edu.au>
Date
Oct 12, 2006, 13:30 UTC
Message-ID
<452E437D.3070708@adelaide.edu.au>

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
Next: Petr Baudis
Message 1 of 2 in “Feature: add --force option to cg-push.”
  1. Pierre Marc DumuidOct 12, 2006
  2. Petr BaudisOct 17, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.