diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2016-06-12 17:54:09 +0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-06-13 14:38:16 -0700 |
commit | cccf74e2da85808478c784e403a69bbfe2b9f518 (patch) | |
tree | dd1a8c3e3da2256f28894ea98e31ebc1a4ce8918 /Documentation/fetch-options.txt | |
parent | upload-pack: add get_reachable_list() (diff) | |
download | tgif-cccf74e2da85808478c784e403a69bbfe2b9f518.tar.xz |
fetch, upload-pack: --deepen=N extends shallow boundary by N commits
In git-fetch, --depth argument is always relative with the latest
remote refs. This makes it a bit difficult to cover this use case,
where the user wants to make the shallow history, say 3 levels
deeper. It would work if remote refs have not moved yet, but nobody
can guarantee that, especially when that use case is performed a
couple months after the last clone or "git fetch --depth". Also,
modifying shallow boundary using --depth does not work well with
clones created by --since or --not.
This patch fixes that. A new argument --deepen=<N> will add <N> more (*)
parent commits to the current history regardless of where remote refs
are.
Have/Want negotiation is still respected. So if remote refs move, the
server will send two chunks: one between "have" and "want" and another
to extend shallow history. In theory, the client could send no "want"s
in order to get the second chunk only. But the protocol does not allow
that. Either you send no want lines, which means ls-remote; or you
have to send at least one want line that carries deep-relative to the
server..
The main work was done by Dongcan Jiang. I fixed it up here and there.
And of course all the bugs belong to me.
(*) We could even support --deepen=<N> where <N> is negative. In that
case we can cut some history from the shallow clone. This operation
(and --depth=<shorter depth>) does not require interaction with remote
side (and more complicated to implement as a result).
Helped-by: Duy Nguyen <pclouds@gmail.com>
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Dongcan Jiang <dongcan.jiang@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/fetch-options.txt')
-rw-r--r-- | Documentation/fetch-options.txt | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Documentation/fetch-options.txt b/Documentation/fetch-options.txt index 7aa1285fc9..3b91f1528e 100644 --- a/Documentation/fetch-options.txt +++ b/Documentation/fetch-options.txt @@ -14,6 +14,11 @@ linkgit:git-clone[1]), deepen or shorten the history to the specified number of commits. Tags for the deepened commits are not fetched. +--deepen=<depth>:: + Similar to --depth, except it specifies the number of commits + from the current shallow boundary instead of from the tip of + each remote branch history. + --shallow-since=<date>:: Deepen or shorten the history of a shallow repository to include all reachable commits after <date>. |