From: Paul Campbell Date: Sun, 24 Mar 2013 20:22:01 GMT Subject: [PATCH] contrib/subtree: Teach add to store repository & branch in .gittrees Message-ID: <1364156521-29318-1-git-send-email-pcampbell@kemitix.net> In-Reply-To: From: Matt Hoffman The repository and branch of a subtree added with the add command is stored in the .gittrees file. Signed-off-by: Paul Campbell --- Rerolled allowing for $IFS whitespace. contrib/subtree/git-subtree.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh index 8a23f58..b6e821e 100755 --- a/contrib/subtree/git-subtree.sh +++ b/contrib/subtree/git-subtree.sh @@ -527,6 +527,14 @@ cmd_add_repository() revs=FETCH_HEAD set -- $revs cmd_add_commit "$@" + + # now add it to our list of repos + git config -f .gittrees --unset subtree."$dir".url + git config -f .gittrees --add subtree."$dir".url "$repository" + git config -f .gittrees --unset subtree."$dir".path + git config -f .gittrees --add subtree."$dir".path "$dir" + git config -f .gittrees --unset subtree."$dir".branch + git config -f .gittrees --add subtree."$dir".branch "$refspec" } cmd_add_commit() -- 1.8.2