>From 92787322c6e0e8c9166f02f98a71b6e0af9dc405 Mon Sep 17 00:00:00 2001
From: bibendi <[email protected]>
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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html