aboutsummaryrefslogtreecommitdiff
path: root/git-fetch.sh
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2007-01-16 01:53:29 -0800
committerJunio C Hamano <junkio@cox.net>2007-02-13 21:43:53 -0800
commitfbe2687eba70385dab7e3d1f5cdcdfdc11dfe0ec (patch)
tree6ff13c522e5be353d930d86d77227002026c8166 /git-fetch.sh
parentd4289fff870a85b1b7e55ead2a5baf98847fc72a (diff)
downloadgit-fbe2687eba70385dab7e3d1f5cdcdfdc11dfe0ec.tar.gz
git-fbe2687eba70385dab7e3d1f5cdcdfdc11dfe0ec.tar.xz
git-fetch: move more code into C.
This adds "native-store" subcommand to git-fetch--tool to move a huge loop implemented in shell into C. This shaves about 70% of the runtime to fetch and update 1000 tracking branches with a single fetch. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-fetch.sh')
-rwxr-xr-xgit-fetch.sh57
1 files changed, 6 insertions, 51 deletions
diff --git a/git-fetch.sh b/git-fetch.sh
index 2aa34b399..b74dd9a30 100755
--- a/git-fetch.sh
+++ b/git-fetch.sh
@@ -192,57 +192,12 @@ fetch_native () {
echo failed "$remote"
) |
(
- trap '
- if test -n "$keepfile" && test -f "$keepfile"
- then
- rm -f "$keepfile"
- fi
- ' 0
-
- keepfile=
- while read sha1 remote_name
- do
- case "$sha1" in
- failed)
- echo >&2 "Fetch failure: $remote"
- exit 1 ;;
- # special line coming from index-pack with the pack name
- pack)
- continue ;;
- keep)
- keepfile="$GIT_OBJECT_DIRECTORY/pack/pack-$remote_name.keep"
- continue ;;
- esac
- found=
- single_force=
- for ref in $refs
- do
- case "$ref" in
- +$remote_name:*)
- single_force=t
- not_for_merge=
- found="$ref"
- break ;;
- .+$remote_name:*)
- single_force=t
- not_for_merge=t
- found="$ref"
- break ;;
- .$remote_name:*)
- not_for_merge=t
- found="$ref"
- break ;;
- $remote_name:*)
- not_for_merge=
- found="$ref"
- break ;;
- esac
- done
- local_name=$(expr "z$found" : 'z[^:]*:\(.*\)')
- append_fetch_head "$sha1" "$remote" \
- "$remote_name" "$remote_nick" "$local_name" \
- "$not_for_merge" || exit
- done
+ flags=
+ test -n "$verbose" && flags="$flags -v"
+ test -n "$force" && flags="$flags -f"
+ GIT_REFLOG_ACTION="$GIT_REFLOG_ACTION" \
+ git-fetch--tool native-store \
+ $flags "$remote" "$remote_nick" "$refs"
)
) || exit