X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=blobdiff_plain;f=tg-push.sh;h=a928fba8e9e93a522f966004bea28c0c6fc1fe07;hb=refs%2Fheads%2Fi%2Fbasis-merge;hp=40849ae1d66548bf33094b1f93ebd7dd35e9973d;hpb=9220634afcbdc8958ed44d84eaf2dc378cf12efd;p=topgit.git diff --git a/tg-push.sh b/tg-push.sh index 40849ae..a928fba 100644 --- a/tg-push.sh +++ b/tg-push.sh @@ -45,27 +45,35 @@ for name in $branches; do ref_exists "$name" || die "detached HEAD? Can't push $name" done +_listfile="$(get_temp tg-push-listfile)" + push_branch() { # if so desired omit non tgish deps $tgish_deps_only && [ -z "$_dep_is_tgish" ] && return 0 - echo "$_dep" + # filter out plain SHA1s. These don't need to be pushed explicitly as + # the patches that depend on the sha1 have it already in their ancestry. + is_sha1 "$_dep" && return 0 + + echo "$_dep" >> "$_listfile" [ -z "$_dep_is_tgish" ] || - echo "top-bases/$_dep" + echo "top-bases/$_dep" >> "$_listfile" } for name in $branches; do - list="$( - # deps - if $recurse_deps; then - no_remotes=1 recurse_deps push_branch "$name" - fi - # current branch - _dep="$name" - _dep_is_tgish=1 - push_branch "$name" - )" - echo "pushing:"; echo $list - git push $dry_run "$remote" $list + # current branch + # re-use push_branch, which expects some pre-defined variables + _dep="$name" + _dep_is_tgish=1 + ref_exists "top-bases/$_dep" || + _dep_is_tgish= + push_branch "$name" + + # deps but only if branch is tgish + $recurse_deps && [ -n "$_dep_is_tgish" ] && + no_remotes=1 recurse_deps push_branch "$name" + + # remove multiple occurrences of the same branch + sort -u "$_listfile" | xargs git push $dry_run "$remote" done