diff options
author | Junio C Hamano <gitster@pobox.com> | 2013-02-01 12:39:24 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-02-01 12:39:24 -0800 |
commit | 2532d891a4aab003a5ce19f04509fd8549754485 (patch) | |
tree | dd423e056e45994a8af8ee7c9e174209ece868f2 /upload-pack.c | |
parent | 9a6c84e6e9078b0ef4fd2c50b200e8552a28c6fa (diff) | |
parent | cfb70e1fa506e79f337e716ed4813c6caa428644 (diff) | |
download | git-2532d891a4aab003a5ce19f04509fd8549754485.tar.gz |
Merge branch 'nd/fetch-depth-is-broken'
"git fetch --depth" was broken in at least three ways. The
resulting history was deeper than specified by one commit, it was
unclear how to wipe the shallowness of the repository with the
command, and documentation was misleading.
* nd/fetch-depth-is-broken:
fetch: elaborate --depth action
upload-pack: fix off-by-one depth calculation in shallow clone
fetch: add --unshallow for turning shallow repo into complete one
Diffstat (limited to 'upload-pack.c')
-rw-r--r-- | upload-pack.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/upload-pack.c b/upload-pack.c index 95d83135ae..7c05b15e68 100644 --- a/upload-pack.c +++ b/upload-pack.c @@ -672,10 +672,17 @@ static void receive_needs(void) if (depth == 0 && shallows.nr == 0) return; if (depth > 0) { - struct commit_list *result, *backup; + struct commit_list *result = NULL, *backup = NULL; int i; - backup = result = get_shallow_commits(&want_obj, depth, - SHALLOW, NOT_SHALLOW); + if (depth == INFINITE_DEPTH) + for (i = 0; i < shallows.nr; i++) { + struct object *object = shallows.objects[i].item; + object->flags |= NOT_SHALLOW; + } + else + backup = result = + get_shallow_commits(&want_obj, depth, + SHALLOW, NOT_SHALLOW); while (result) { struct object *object = &result->item->object; if (!(object->flags & (CLIENT_SHALLOW|NOT_SHALLOW))) { |