Repository navigation
Closed
Description
To me the workflow after adding a project that has already a history is not clear.
Here's what I did:
$ meta project add js-multihash git@github.com:multiformats/js-multihash.git
meta project adding 'git@github.com:multiformats/js-multihash.git' at js-multihash
created /home/vmx/src/pl/meta/ipld/js-multihash
Initialized empty Git repository in /home/vmx/src/pl/meta/ipld/js-multihash/.git/
set remote origin to git@github.com:multiformats/js-multihash.git
adding "js-multihash": "git@github.com:multiformats/js-multihash.git" to .meta file at /home/vmx/src/pl/meta/ipld/.meta
adding js-multihash to .gitignore at /home/vmx/src/pl/meta/ipld/.gitignorejs-multihash isn't checked out yet:
$ ls -a js-multihash
. .. .gitSo I though I do a meta git update:
$ meta git update
all repositories in .meta are cloned locallyThat doesn't do anything. Next try is a pull (that would also screw with your existing repos):
$ meta git pull
…
here is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=origin/<branch> masterA checkout would make more sense:
$ meta git checkout
js-multihash:
fatal: You are on a branch yet to be born
js-multihash: command 'git checkout ' exited with error: Error: Command failed: git checkoutThere's still no proper checkout.
Next is then just removing the directory and using update:
$ rm -Rf ./js-multihash
$ meta git update
*** the following repositories have been added to .meta but are not currently cloned locally:
*** { 'js-multihash': 'git@github.com:multiformats/js-multihash.git' }
*** type 'meta git update' to correct.
cloning missing repositories
js-multihash:
Cloning into 'js-multihash'...
remote: Enumerating objects: 7196, done.
remote: Total 7196 (delta 0), reused 0 (delta 0), pack-reused 7196
Receiving objects: 100% (7196/7196), 6.11 MiB | 5.40 MiB/s, done.
Resolving deltas: 100% (1373/1373), done.
js-multihashThat does the actual checkout as I would expect it.
So it is expected that meta project add is about new projects and not existing ones.
Reacted by Matteo Murgida
Metadata
Metadata
Assignees
Labels
No labels
Activity
mateodelnorte commentedon Dec 18, 2018
patrickleet commentedon Dec 18, 2018
meta git pull origin mastershould do it tooonce you set an upstream on your repo
meta git pullshould workyou can add the
-uflag the first time you pushOr run the command that the warning told you to run:
vmx commentedon Dec 18, 2018
@patrickleet The
git pullwould also pull all other existing repos.I guess my main concern is consistency. I don't see an issue, that it doesn't pull the default branch automatically (although I'd prefer that). But then it's strange that
meta project adddoes initialize an empty repository.I'm new to the project and just want bring up my first impressions as I personally find it valuable if someone with a fresh look contributes their pain points as they are different from being used to a system :)
patrickleet commentedon Dec 18, 2018
@vmx it doesn't know what the "default" branch is as one had never been set. That's what the upstream setting is for which hadn't been configured before. This warning is from git, not meta. Just want to make sure we're on the same page about that. All
meta git *is doing is runninggit *in each folder.If you definitely wanted all of the upstreams for your project to be set to origin/master you could run
I'm not sure meta wants to make assumptions about settings that could be different for every project.
I believe all
meta project adddoes is:@mateodelnorte sound right?
Even when you create a brand new project on github you need to set an upstream (notice
git push -uIf your issue is addressed, may I close this issue? Or are we still disconnected on something?
mateodelnorte commentedon Dec 18, 2018
Correct @patrickleet. Meta trusts that the remote you tell it about exists. And
meta project add x yonly cares about setting up the bare minimum to get you working. Your meta and child repos could be in any number of states, on master, all on a feature branch, or on multiple branches. So, it doesn't make assumptions about what to check out for the new repo.vmx commentedon Dec 19, 2018
@patrickleet, @mateodelnorte: Thanks for being so nice/friendly to me. I'm knpo how git works and that those
meta gitoperations just do normal git things on every repo. My goal for this issue is to makemetanice to use for the case where you want to use it for existing repositories.My point is that
meta git updatedoes exactly what I'd expect it to do. If there are no directories yet, it checks out the default branch of those repos defiend in.meta.It makes the assumption that I'd like to have an empty initilaized repo.
Perhaps it makes things clearer which flow I'd propose. I just make up options, it doesn't matter if they are named like that, or if they become subcommands instead, it's just about the general idea:
Use case: I want to add a repo with existing code:
Use case: I want to add a brand new repo without any code in there yet
PS: I fear a bit that I don't find the right words and come across a noob that doesn't understand how
metaworks and wants to change it to a thing that it not really is. So please read all my comments in a friendly tone and as suggestions to make it better in case it aligns with the overall goal :)mateodelnorte commentedon Dec 19, 2018
Hey @vmx. No worries. I think we get your perspective clearly. No assumptions over here that you're junior.
I'm hesitant to do a
meta git updateas a component command ofmeta project add x ybecause it will potentially cause additional repos to be pulled and synced. It's a little pedantic, but a dev could know that there are large amounts of new code that they're not ready to pull down yet. Sometimes you just want to do the one, atomic, operation you're concerned with. It could be quite surprising that doing aproject addends up syncing your code. You might just not be in a position to deal with the mental overhead of worrying about what just came down.I would, however, entertain the idea of having something like a
meta git update --include-only [name of new repo]such that only the new repo's code gets pulled. I'm fairly certainmeta git updatewould have to be updated to allow that.vmx commentedon Dec 20, 2018
That's a good point. I would then even take it a step further that it was surprising to me that an empty repo was created.
That wouldn't solve the problem that I would need to remove the repository created by
meta project add x yfirst.mateodelnorte commentedon Dec 20, 2018
What are you proposing?
vmx commentedon Dec 20, 2018
I see the two use-cases mentioned in #87 (comment).
I'm unsure if they both should be achievable with a single command, that would then e.g. be:
Or if it should be an option:
aleclarson commentedon Dec 21, 2018
I think @vmx and I both have the same concerns. See here: mateodelnorte/meta-project#10
throskam commentedon Apr 15, 2019
I completely agree with @vmx, I was really confused when I found an empty directory after adding an existing repository to the meta project.
I did almost exactly the same mental gymnastics to make it work. I was also surprise that my use case wasn't documented and thought I was using the tool wrong (even if the logs were clear when I looked back at them).
Maybe I'm missing something here, but why does meta initialize an empty repository and does not simply clone it ?
As a first time user, I would expect
meta project add x yto basically dogit clone y x,meta project add --init x {y}to create an empty repository insidexwith the remoteyoptionally set.Anyways, after that rocky start, the rest of my experience was pretty smooth :)
mateodelnorte commentedon Apr 15, 2019
I'm not against renaming the current add command to
meta project initand creating a newmeta project addwhich expects a remote to exist.drusellers commentedon Apr 28, 2019
Ditto, it took me a hot minute to realize what was going on.
nwillc commentedon Jun 5, 2019
It confused me that the meta git pull failed after the project add, but worked if I did a fresh meta clone of same repo elsewhere...
stale commentedon Aug 4, 2019
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
patrickleet commentedon Aug 8, 2019
this was cleaned up in mateodelnorte/meta-project#25
There is now
meta project importfor cloning existing repos andmeta project createfor initializing new ones