-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reimplement git subtree
as a built-in
#1410
Comments
I'm a little bit unsure about that idea, given the general lack of interest from mailing list regulars for any bug report in Moving it out of contrib does imply (at least to me) some sort of "support", which I'm not sure the project would be interested in providing. Just my 2 cents... |
@phil-blain the lack of interest might very well be explained by FWIW Git for Windows ships with |
Besides, there was https://lore.kernel.org/git/[email protected]/, so there is interest in getting this command into mainline. |
Hey! If possible, I would be very happy to work on this issue. |
@vinayakdsci excellent! Are you already a little bit familiar with Git's source code? Do you have a preferred development environment? In other words: how can I help? |
Thanks a lot for replying, @dscho! I have read the Git documentation and developer guide, and the source code thoroughly. Should I introduce myself on the mailing list, too? |
You can do that, but it's no requirement. |
Even more important, I think, would be to look at the commit history where new builtins were added. |
Got it. I'll start right away.
|
Hey @dscho! I have been trying to follow your advice to make progress, but it looks like I am stuck in a mess. |
The idea is not to move the shell file. The idea is to re-implement what the shell script does, in C... |
@vinayakdsci here are a couple of commits that demonstrate what will need to be done for this ticket: git/git@main...dscho:git:turn-subtree-into-a-built-in^ Make no mistake, this is not an easy project. It will require effort and care, it's not something you can wing by merely copying files around and then adding a tiny bit of glue. |
@dscho okay! I am sorry for the late reply. |
In the past, we indeed tried this incremental approach, but it encourages too literal a translation from shell to C, which results in suboptimal code... |
Recent thread on a reported performance regression in git-subtree: https://lore.kernel.org/git/[email protected]/T/#m9a85dffbc5bdeab35061db5908d752e71310c772 I don’t use this command. I tested it on Ubuntu (the reporter uses Windows) and it was similarily slow for me. |
The
git subtree
command is currently implemented as a shell script and it lives insidecontrib/subtree/
. There was previously an attempt to move it out ofcontrib/
, but there was the concern of adding yet another scripted command (with all the problems that brings with it).Using the
OPT_SUBCOMMAND
infrastructure, this project is about reimplementing the individual subcommands one by one.In contrast to earlier projects that converted shell scripts to pure C versions, we want to be mindful to avoid too-literal translations. For example, instead of using the
--grep=
argument of the revision walking machinery, we will want to implement a precise search through the commit messages viastrstr()
and avoid spawning a new process. And instead of near-duplicating the logic offind_latest_squash
andfind_existing_splits
, there are probably better ways to do this in C, ways that avoid code duplication.However, just like previous conversions, this project could start by renaming
git-subtree.sh
togit-subtree--helper.sh
while moving it to the top-level, moving the test script tot/
and implementing abuiltin/subtree.c
that simply shells out to the helper. That way, subcommands can be converted incrementally (and even independently).The text was updated successfully, but these errors were encountered: