{"thread":{"id":"59476","subject":"A new approach to Git's clone process for improved functionality | Maifee Ul Asad","startedAt":"2023-03-26T14:55:43Z","lastAt":"2023-03-26T14:55:43Z","messageCount":1,"participants":["Maifee Ul Asad"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"474193","messageId":"CANb2QxDUp_Lm+eYQM9x2OPzu10LCB2MBZamy2ehC6F03GdsDKw@mail.gmail.com","threadId":"59476","inReplyTo":null,"subject":"A new approach to Git's clone process for improved functionality | Maifee Ul Asad","fromName":"Maifee Ul Asad","fromEmail":"maifeeulasad@gmail.com","sentAt":"2023-03-26T14:55:25Z","receivedAt":"2023-03-26T14:55:43Z","isPatch":false,"sender":{"key":"maifeeulasad@gmail.com","avatar":null},"body":"Dear,\n\nI am Maifee Ul Asad. I have been studying Git's codebase for a while\nnow. And there is something I noticed about clone functionality.\nWhenever I run a clone operation it creates five independent\nprocesses. Now the only way to cancel this cloning operation is\nthrough CLI, press CTRL+C or a relevant command based on different OS.\nI have only checked in Windows.\n\nBut, when I am creating a wrapper, or I have some existing wrapper for\nGit, and I want to add functionality to cancel the cloning process, it\ncan not be done so easily. Then I have to create a process and pass a\nsignal interrupt via stdin of that process and cancel it.\n\nI think it would be way cool and lot cleaner if we could create a\nparent process and add these processes as children to that parent\nprocess. In this case, we can simply use kill to terminate that parent\nprocess.\n\nTill now I was only able to identify these operations, and I am pretty\nhelpful they I have identified the correct functions:\n - perform the fetch operation\n - perform the receive-pack operation\n - perform the indexing operation\n - perform the pack-objects operation\n - perform the update-ref operation\n\n\nNow we can simply wrap these with a fork (yes, we have to think about\nNT not having a fork; and cygwin and other libraries may add tons of\nload here) call. But here is my proposed pseudo code:\n```\nfork a new process\nif (fork failed):\n    log and exit\nelse if (fork is successful):\n    perform the fetch operation\n    perform the receive-pack operation\n    perform the indexing operation\n    perform the pack-objects operation\n    perform the update-ref operation\nelse:\n    wait for the child processes to finish\n```\n\nI think it would be a great improvement. And, I am really excited\nabout the discussion we are going to have on this.\n\nRegards\nMaifee Ul Asad\n"}]}