git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Campbell <pcampbell@kemitix.net>
To: git <git@vger.kernel.org>
Cc: David Michael Barr <b@rr-dav.id.au>, Kindjal <kindjal@gmail.com>,
	bibendi <bibendi@bk.ru>, Herman van Rink <rink@initfour.nl>,
	James Roper <jroper@vz.net>, mhart <michael@adslot.com>,
	mhoffman <matt.hoffman@quantumretail.com>,
	Nate Jones <nate@endot.org>,
	Paul Cartwright <paul.cartwright@ziilabs.com>,
	Peter Jaros <pjaros@pivotallabs.com>
Subject: [PATCH 03/19] Use .gittrees config file like a .gitmodules when pull or push
Date: Sat, 9 Mar 2013 19:21:31 +0000	[thread overview]
Message-ID: <CALeLG_mY2BPpPjbGJ=3BKkeu3V7cngEmvhDOJ2UWDeO25E+aLw@mail.gmail.com> (raw)

>From 92787322c6e0e8c9166f02f98a71b6e0af9dc405 Mon Sep 17 00:00:00 2001
From: bibendi <bibendi@bk.ru>
Date: Fri, 20 May 2011 00:15:53 +0600
Subject: [PATCH 03/19] Use .gittrees config file like a .gitmodules when pull
 or push

---
 contrib/subtree/git-subtree.sh | 31 +++++++++++++++++++++----------
 1 file changed, 21 insertions(+), 10 deletions(-)

diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
index caf4988..cb9e288 100755
--- a/contrib/subtree/git-subtree.sh
+++ b/contrib/subtree/git-subtree.sh
@@ -593,7 +593,8 @@ cmd_split()
 	eval "$grl" |
 	while read rev parents; do
 		revcount=$(($revcount + 1))
-		say -n "$revcount/$revmax ($createcount)
"
+		say -n "$revcount/$revmax ($createcount)
+"
 		debug "Processing commit: $rev"
 		exists=$(cache_get $rev)
 		if [ -n "$exists" ]; then
@@ -700,21 +701,31 @@ cmd_merge()

 cmd_pull()
 {
-	ensure_clean
-	git fetch "$@" || exit $?
-	revs=FETCH_HEAD
-	set -- $revs
-	cmd_merge "$@"
+    if [ $# -ne 1 ]; then
+	    die "You must provide <branch>"
+	fi
+	if [ -e "$dir" ]; then
+	    ensure_clean
+	    repository=$(git config -f .gittrees subtree.$prefix.url)
+	    refspec=$1
+	    git fetch $repository $refspec || exit $?
+	    echo "git fetch using: " $repository $refspec
+	    revs=FETCH_HEAD
+	    set -- $revs
+	    cmd_merge "$@"
+	else
+	    die "'$dir' must already exist. Try 'git subtree add'."
+	fi
 }

 cmd_push()
 {
-	if [ $# -ne 2 ]; then
-	    die "You must provide <repository> <refspec>"
+	if [ $# -ne 1 ]; then
+	    die "You must provide <branch>"
 	fi
 	if [ -e "$dir" ]; then
-	    repository=$1
-	    refspec=$2
+	    repository=$(git config -f .gittrees subtree.$prefix.url)
+	    refspec=$1
 	    echo "git push using: " $repository $refspec
 	    git push $repository $(git subtree split
--prefix=$prefix):refs/heads/$refspec
 	else
-- 
1.8.2.rc1


-- 
Paul [W] Campbell

                 reply	other threads:[~2013-03-09 19:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CALeLG_mY2BPpPjbGJ=3BKkeu3V7cngEmvhDOJ2UWDeO25E+aLw@mail.gmail.com' \
    --to=pcampbell@kemitix.net \
    --cc=b@rr-dav.id.au \
    --cc=bibendi@bk.ru \
    --cc=git@vger.kernel.org \
    --cc=jroper@vz.net \
    --cc=kindjal@gmail.com \
    --cc=matt.hoffman@quantumretail.com \
    --cc=michael@adslot.com \
    --cc=nate@endot.org \
    --cc=paul.cartwright@ziilabs.com \
    --cc=pjaros@pivotallabs.com \
    --cc=rink@initfour.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).