-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Creates a git repo without being asked #69
Comments
First of all I agree that the tool should not unnecessarily try to initialize git, this is something I also want to get rid of as well. The core reason it needs git initialized is b/c we use I have tested this with a submodule and my experience is not the same as yours, Even though there are some rough corners, it does not initialize a secondary git tree. This is how I test this:
It does indeed runs Another case that you might have encountered is when you have a git repository, you create a subdirectory and try to initialize libdragon in it. In that case, git root is used to initialize the libdragon project. I agree that this is not the best behavior. In any case, it does not create an unnecessary git tree and behind the scenes, it uses I still plan to remove/change those Edit: you can totally opt out of |
Thanks for the detailed response! Your reproduction is a little different to mine. In my case I'm not initialising the subdirectory as a submodule, as I want it to be part of the wider git repo instead. But I do want libdragon as a submodule of the wider git repo.
Yes, this is what I'm doing.
I think this may be what I want. Is it a thing? My use case is I'm working on a library where I want to provide an |
Thank you for using the tool as well! More so for opening an issue 👍
Maybe we are not talking about the same thing here... With an "additional git tree", I was trying to emphasize that it won't create a secondary git database independent of the one it resides in, it will just attach to the one higher in the directory tree. But for sure it needs its own git tree for fetching the libdragon files. It should be possible to do it without attaching to git, but it would also mean loosing other functionality like auto-update and such. I don't think manual vendoring matches your use case either. Let me try to explain on your directory structure:
When you do a
Actually, it would look the same wherever you run
it is not, but Edit: Can you write:
so that we can work it out. |
@bates64 I think I get what you mean now, my above example is incomplete and it would also create another git db inside the folder you do
This is also probably incorrect. |
@bates64 I tested it again with your setup, it works exactly like I initially thought, no extra git db. So I still need:
|
Of course. For various reasons the repo that I'm doing this in needs to be private so I'll invite you to a private repo |
In the repo:
This writes FWIW here's the log
|
This is all expected behavior. Let me try to explain:
libdragon cli creates a submodule by default as documented in
This is also expected and well documented. Again, the default
If you run it in a non-libdragon project, it will just error out (unless you are using an old version, which attempted a I think in your use case, because you don't want the cli to do any git operations, you should simply run:
and provide libdragon files yourself. You can point at them via |
Interesting, okay. I think there was confusion because
there is a I'll try out the manual strategy and see how it fares, thank you. |
OK, cool, that works! |
I maintain that the behaviour of the submodule strategy in this case is unexpected/wrong but given this solves my problem there's no issue 😄 |
@bates64 So would you expect the libdragon submodule to be registered on your parent project then, is that correct? |
That's right, yeah. I'd expect a
|
I did a few more tests and I think I have found the exact way you use the tool, I haven't realized that you had an npm root at I think we might need all or some of the following for a better experience:
|
The tool depends on git for managing the vendored libdragon copy. It used to run `git init` to make sure there is a git repos initialized. This works if the p;roject root matched the git troot. This was mostly the case but when there is an NPM root we were attaching to it to be npm project compatible and if that root didin't match the git root, this was cresulting in an extra git root. re #69
## [11.0.3](v11.0.2...v11.0.3) (2024-02-16) ### Bug Fixes * **init.js:** do not run git init unnecessarily ([0a5688f](0a5688f)), closes [#69](#69)
## [11.0.3-beta.1](v11.0.2...v11.0.3-beta.1) (2024-02-17) ### Bug Fixes * **init.js:** do not run git init unnecessarily ([0a5688f](0a5688f)), closes [#69](#69)
I have a libdragon project as a subdirectory of a repo.
libdragon make
runsgit init
automatically, but I don't want it to because this would exclude it from the wider project.The git submodule is handled at
../.gitmodules
. This program should detect that it's already in a repo and not create a new one.The text was updated successfully, but these errors were encountered: