git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maifee Ul Asad <maifeeulasad@gmail.com>
To: git@vger.kernel.org
Subject: A new approach to Git's clone process for improved functionality | Maifee Ul Asad
Date: Sun, 26 Mar 2023 20:55:25 +0600	[thread overview]
Message-ID: <CANb2QxDUp_Lm+eYQM9x2OPzu10LCB2MBZamy2ehC6F03GdsDKw@mail.gmail.com> (raw)

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

                 reply	other threads:[~2023-03-26 14:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CANb2QxDUp_Lm+eYQM9x2OPzu10LCB2MBZamy2ehC6F03GdsDKw@mail.gmail.com \
    --to=maifeeulasad@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).