{"thread":{"id":"199","subject":"[PATCH] Add \"git push\"","startedAt":"2005-04-21T12:43:33Z","lastAt":"2005-04-21T20:41:25Z","messageCount":2,"participants":["Matthias Urlichs","Petr Baudis"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"1124","messageId":"20050421124333.AB2CE7F887@smurf.noris.de","threadId":"199","inReplyTo":null,"subject":"[PATCH] Add \"git push\"","fromName":"Matthias Urlichs","fromEmail":"smurf@smurf.noris.de","sentAt":"2005-04-21T12:43:33Z","receivedAt":"2005-04-21T12:43:33Z","isPatch":true,"sender":{"key":"matthias@urlichs.de","avatar":"https://gravatar.com/avatar/2708905af227313eba6f2b2ae0f7d0259b5ac5d71baef58fe5a13c699ce0bbf0?d=mp&s=160"},"body":"This patch adds the ability to \"git push\", as the obvious converse of\n\"git pull\".\n\nSigned-Off-By: Matthias Urlichs <smurf@smurf.noris.de>\n\nIndex: git\n===================================================================\n--- 42a073eb6b5bb397a3e8768a032463a7fa02e6b9/git  (mode:100755 sha1:557122dfb05580e4af2c55767f3d6f92b9110edd)\n+++ 265515f9c4f089b1b61e9d2312c4b3babe189618/git  (mode:100644 sha1:c32ee037c4dd68f8fa6723cb115644d46810bc89)\n@@ -42,6 +42,7 @@\n \tmerge\t\t[-c] [-b BASE_ID] FROM_ID\n \tpatch\t\t[COMMIT_ID]\n \tpull\t\t[RNAME]\n+\tpush\t\t[RNAME]\n \trm\t\tFILE...\n \tseek\t\t[COMMIT_ID]\n \tstatus\n@@ -86,6 +87,7 @@\n \"lsremote\")   gitlsremote.sh \"$@\";;\n \"merge\")      gitmerge.sh \"$@\";;\n \"pull\")       gitpull.sh \"$@\";;\n+\"push\")       gitpush.sh \"$@\";;\n \"patch\")      gitpatch.sh \"$@\";;\n \"rm\")         gitrm.sh \"$@\";;\n \"seek\")       gitseek.sh \"$@\";;\n--- /dev/null  (tree:42a073eb6b5bb397a3e8768a032463a7fa02e6b9)\n+++ 265515f9c4f089b1b61e9d2312c4b3babe189618/gitpush.sh  (mode:100644 sha1:0a658141991c602ca327edb9ab982d7660d7c665)\n@@ -0,0 +1,59 @@\n+#!/bin/sh\n+#\n+# Pushes changes from the local GIT repository to \"remote\".\n+# Copyright (c) Matthias Urlichs, 2005\n+#\n+# Takes the remote's name.\n+\n+name=$1\n+\n+die () {\n+\techo gitpush.sh: $@ >&2\n+\texit 1\n+}\n+\n+\n+[ \"$name\" ] || name=$(cat .git/tracking 2>/dev/null)\n+[ \"$name\" ] || die \"where to push to?\"\n+uri=$(grep $(echo -e \"^$name\\t\" | sed 's/\\./\\\\./g') .git/remotes | cut -f 2)\n+[ \"$uri\" ] || die \"unknown remote\"\n+\n+\n+tracking=\n+[ -s .git/tracking ] && tracking=$(cat .git/tracking)\n+\n+orig_head=\n+if [ \"$tracking\" = \"$name\" ]; then\n+\t[ -s .git/HEAD.tracked ] && orig_head=$(cat .git/HEAD.tracked)\n+else\n+\t[ -s \".git/heads/$name\" ] && orig_head=$(cat \".git/heads/$name\")\n+fi\n+\n+rsync $RSYNC_FLAGS -Lr \"$uri/HEAD\" \".git/HEAD_$name\"\n+$id=$(cat \".git/HEAD_$name\")\n+rm .git/HEAD_$name\n+\n+if [ -z \"$id\" ] ; then\n+\techo \"The remote system doesn't have a HEAD file: Doing an initial upload.\" >&2\n+\techo \".\" >&2\n+elif [ \"$(cat-file -t \"$id\")\" != \"commit\" ]; then\n+\techo \"The remote system has stuff we don't have: pull first!\" >&2\n+\techo \"\tCommit ID: $id\" >&2\n+\texit 1\n+fi\n+\n+# We already saw the MOTD, thank you very much.\n+rsync $RSYNC_FLAGS --ignore-existing --whole-file \\\n+\t-v -r \".git/objects\" \"$uri\" | grep -v '^MOTD:'\n+\n+# FIXME: Warn about conflicting tag names?\n+rsync $RSYNC_FLAGS --ignore-existing \\\n+\t-v -r \".git/tags\" \"$uri\" 2>/dev/null | grep -v '^MOTD:'\n+\n+# Finally, update the remote HEAD\n+rsync $RSYNC_FLAGS -Lr \".git/HEAD\" \"$uri/HEAD\" \\\n+\t2>/dev/null | grep -v '^MOTD:'\n+\n+echo \"Now up to date.\"\n+exit\n+\n"},{"id":"1190","messageId":"20050421204125.GI7443@pasky.ji.cz","threadId":"199","inReplyTo":"20050421124333.AB2CE7F887@smurf.noris.de","subject":"Re: [PATCH] Add \"git push\"","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2005-04-21T20:41:25Z","receivedAt":"2005-04-21T20:41:25Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Thu, Apr 21, 2005 at 02:43:33PM CEST, I got a letter\nwhere Matthias Urlichs <smurf@smurf.noris.de> told me that...\n> This patch adds the ability to \"git push\", as the obvious converse of\n> \"git pull\".\n\nWhile lack of locking is a problem for git-pasky too, for this git push\nit is a downright disaster waiting to happen. It might be also a good\nidea to check for remote 'blocked' file, which must exist and contain\nonly a \"pushtree\" line. This is so that no (sensible) real working tree\nis attached to it, which would be a disaster for it too.\n\nYou probably don't want to allow pushing if your local tree is blocked.\nAnd you want to allow pushing only when HEAD is your ancestor. (Helper\ntool wanted for this - we need this in git merge badly too.)\n\nBTW, it contains some unrelated and seemingly irrelevant tracking stuff.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nC++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor\n"}]}