diff options
author | Junio C Hamano <junkio@cox.net> | 2006-12-28 01:25:43 -0800 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-12-28 01:25:43 -0800 |
commit | b11bd57a384a7bee21245d3895d77d20c33e4d78 (patch) | |
tree | 16e1582858224d41d6e8835cef8b576805bb4397 /git-fetch.sh | |
parent | 6b5a795bf586aa019bbb11ffe9f2fc315ba9765e (diff) | |
parent | 37818d7db070f67a20df58ac7d5e04cc63ef1867 (diff) | |
download | git-b11bd57a384a7bee21245d3895d77d20c33e4d78.tar.gz |
Merge branch 'js/shallow'
* js/shallow:
fetch-pack: Do not fetch tags for shallow clones.
get_shallow_commits: Avoid memory leak if a commit has been reached already.
git-fetch: Reset shallow_depth before auto-following tags.
upload-pack: Check for NOT_SHALLOW flag before sending a shallow to the client.
fetch-pack: Properly remove the shallow file when it becomes empty.
shallow clone: unparse and reparse an unshallowed commit
Why didn't we mark want_obj as ~UNINTERESTING in the old code?
Why does it mean we do not have to register shallow if we have one?
We should make sure that the protocol is still extensible.
add tests for shallow stuff
Shallow clone: do not ignore shallowness when following tags
allow deepening of a shallow repository
allow cloning a repository "shallowly"
support fetching into a shallow repository
upload-pack: no longer call rev-list
Diffstat (limited to 'git-fetch.sh')
-rwxr-xr-x | git-fetch.sh | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/git-fetch.sh b/git-fetch.sh index 7fb47f69fb..8bd11f8b60 100755 --- a/git-fetch.sh +++ b/git-fetch.sh @@ -28,6 +28,7 @@ update_head_ok= exec= upload_pack= keep= +shallow_depth= while case "$#" in 0) break ;; esac do case "$1" in @@ -60,6 +61,13 @@ do -k|--k|--ke|--kee|--keep) keep='-k -k' ;; + --depth=*) + shallow_depth="--depth=`expr "z$1" : 'z-[^=]*=\(.*\)'`" + ;; + --depth) + shift + shallow_depth="--depth=$1" + ;; -*) usage ;; @@ -300,6 +308,8 @@ fetch_main () { # There are transports that can fetch only one head at a time... case "$remote" in http://* | https://* | ftp://*) + test -n "$shallow_depth" && + die "shallow clone with http not supported" proto=`expr "$remote" : '\([^:]*\):'` if [ -n "$GIT_SSL_NO_VERIFY" ]; then curl_extra_args="-k" @@ -326,6 +336,8 @@ fetch_main () { git-http-fetch -v -a "$head" "$remote/" || exit ;; rsync://*) + test -n "$shallow_depth" && + die "shallow clone with rsync not supported" TMP_HEAD="$GIT_DIR/TMP_HEAD" rsync -L -q "$remote/$remote_name" "$TMP_HEAD" || exit 1 head=$(git-rev-parse --verify TMP_HEAD) @@ -373,7 +385,7 @@ fetch_main () { pack_lockfile= IFS=" $LF" ( - git-fetch-pack --thin $exec $keep "$remote" $rref || echo failed "$remote" + git-fetch-pack --thin $exec $keep $shallow_depth "$remote" $rref || echo failed "$remote" ) | while read sha1 remote_name do @@ -446,6 +458,8 @@ case "$no_tags$tags" in case "$taglist" in '') ;; ?*) + # do not deepen a shallow tree when following tags + shallow_depth= fetch_main "$taglist" || exit ;; esac esac |