A new approach to Git's clone process for improved functionality | Maifee Ul Asad

From: Maifee Ul Asad <hidden>
Date: 2023-03-26 14:55:43

Dear,

I am Maifee Ul Asad. I have been studying Git's codebase for a while
now. And there is something I noticed about clone functionality.
Whenever I run a clone operation it creates five independent
processes. Now the only way to cancel this cloning operation is
through CLI, press CTRL+C or a relevant command based on different OS.
I have only checked in Windows.

But, when I am creating a wrapper, or I have some existing wrapper for
Git, and I want to add functionality to cancel the cloning process, it
can not be done so easily. Then I have to create a process and pass a
signal interrupt via stdin of that process and cancel it.

I think it would be way cool and lot cleaner if we could create a
parent process and add these processes as children to that parent
process. In this case, we can simply use kill to terminate that parent
process.

Till now I was only able to identify these operations, and I am pretty
helpful they I have identified the correct functions:
 - perform the fetch operation
 - perform the receive-pack operation
 - perform the indexing operation
 - perform the pack-objects operation
 - perform the update-ref operation


Now we can simply wrap these with a fork (yes, we have to think about
NT not having a fork; and cygwin and other libraries may add tons of
load here) call. But here is my proposed pseudo code:
fork a new process
if (fork failed):
    log and exit
else if (fork is successful):
    perform the fetch operation
    perform the receive-pack operation
    perform the indexing operation
    perform the pack-objects operation
    perform the update-ref operation
else:
    wait for the child processes to finish
I think it would be a great improvement. And, I am really excited
about the discussion we are going to have on this.

Regards
Maifee Ul Asad
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help