Re: [GSoC/RFC] Ideas on git fetch --deepen
Hi, all
After digging into how "git fetch" works, I have found that my previous understanding was too rash. I'm sorry for that.
I find that the current workflow of "git fetch --depth" is as follows:
1. 'fetch module' calls 'git-upload-pack service' via 'transport module'
to fetch ref with `depth`.
2. Such call is finished by pipe I/O.
3. git-upload-pack receives arguments such as 'depth' to fetch commits,
and send back to the caller.Therefore, if we want to implement "--deepen" for "git fetch", we have to modify the arguments protocol of git-upload-pack service by adding the 'shallow commit' hash. Then, we can fetch `depth` commits before the 'shallow commit' in git-upload-pack service. Apparently, we have to output error message when the 'shallow commit' hash is not in the repository.
However, I still have a question for [1]. I am not quite following this:
Show 9 quoted lines
> If you want the new history leading to the updated tip,
> you can just say:
>
> git fetch
>
> without any --depth nor --deepen option to end up with:
>
> (you)
> A---B---C---D---E---F---...---W---X---Y---Z
As far as I know, git fetch --depth would fetch new history to the local remotes' refs. Does it mean that we have to change the behavior of "git fetch --depth"?
I hope you can give me some comments or suggestions, letting me know whether I am in the right way.
Thanks.
[1] http://article.gmane.org/gmane.comp.version-control.git/212950
2015-03-07 14:32 GMT+08:00 Dongcan Jiang <dongcan.jiang@gmail.com>:
Show 48 quoted lines
> Hi all,
>
> My name is Dongcan Jiang. I am studying for my Master Degree at Peking
> University
> majoring in Computer Science. I have been using Git to manage my projects
> for about half a year. It's really exciting that Git has been helping me make
> revision control much more convenient. Therefore, I am very interested in
> doing some works for Git in GSoC 2015.
>
> I have submitted my v2 patch on a microproject recently, and I am waiting
> for comments on v2 now.
>
> In the meantime, I have been scanning ideas on the git gsoc page and
> their related mails. I find that I am interested in most of them, especially
> "git fetch --deepen" idea.
>
> Here is my understanding about this idea.
>
> Although "deepen" and "depth" have different behavior, "deepen" can be
> achieved by "depth" with some extra calculation. If we know the
> distance between "my history bottom" and "your tips", we can set the sum
> of "deepen" step and this distance as "depth" step. Then we can reuse
> the logics of processing "depth" to complete it.
>
> Take graph in [1] as an example.
>
>> (upstream)
>> ---o---o---o---A---B
>>
>> (you)
>> A---B
>
> the distance of "my history bottom"(A) and "your tips"(B) is 1, then
> "git fetch --deepen=3" can be achieved by "git fetch --depth=4"
>
> However, I am a little worried about whether this idea is enough for a
> GSoC project. I hope you can give me some comments and suggestions.
>
> [1] http://article.gmane.org/gmane.comp.version-control.git/212950
>
> Thanks,
> Dongcan
>
> --
> 江东灿(Dongcan Jiang)
> Team of Search Engine & Web Mining
> School of Electronic Engineering & Computer Science
> Peking University, Beijing, 100871, P.R.China
--
江东灿(Dongcan Jiang)
Team of Search Engine & Web Mining
School of Electronic Engineering & Computer Science
Peking University, Beijing, 100871, P.R.China