Skip to content
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

Add multi import git [url] #9

Closed
teknomunk opened this issue Jan 28, 2021 · 10 comments
Closed

Add multi import git [url] #9

teknomunk opened this issue Jan 28, 2021 · 10 comments

Comments

@teknomunk
Copy link
Contributor

Add a subcommand to import an existing git repository along with its complete history into multiverse.

The subcommand should have two forms:

multi import git - import the git repository that is in the current working directory or a parent directory. Should automatically find the .git/ directory and setup the multiverse repository there.

multi import git [url] - clone the git repository at [url] and convert it to a multiverse repository. Mostly equivalent to git clone [url] followed by multi init repo_dir. Should store [url] value in repo configuration to allow for pulling upstream updates.

This should ease the transition of existing projects to multiverse.

@nasdf
Copy link
Contributor

nasdf commented Jan 30, 2021

I have a working implementation of this I just committed. I need to document it in the getting started guide.

multi import [name] - is the short-hand to import a git repo from the current directory.

multi import --type=git --url=[url] --dir=[path] [name] - is the long form with all options.

Only one of dir or url is required and it will create a new multiverse repo in the same directory with the name you pass.

I tested importing a repo with around 1700 commits and it finished in about a second.

@teknomunk
Copy link
Contributor Author

Got an error while trying an import.

Import command:

multi import --type=git --url="http://k2k4r8n5c5xcx60vju7n70mq1bktsb75cbsmf1p93zsr7bxlnaltgtjd.ipns.localhost:8080/cr-dns.git" cr-dns

I get:

unexpected EOF

@nasdf
Copy link
Contributor

nasdf commented Jan 30, 2021

Are you able to clone that url using git?

@teknomunk
Copy link
Contributor Author

teknomunk commented Jan 30, 2021

I am able to clone with git. First clone was slow because the IPFS node on my workstation didn't have it locally. Deleting and cloning a second time was quick.

[teknomunk@artemis src]$ git clone http://k2k4r8n5c5xcx60vju7n70mq1bktsb75cbsmf1p93zsr7bxlnaltgtjd.ipns.localhost:8080/cr-dns.git
Cloning into 'cr-dns'...
Fetching objects: 549, done.
[teknomunk@artemis src]$ 

@nasdf
Copy link
Contributor

nasdf commented Feb 1, 2021

I looked into it and go-git does not support the "dumb" http git protocol.

(see https://github.com/go-git/go-git/blob/master/COMPATIBILITY.md)

In the mean time cloning and importing using the --dir flag will work.

@teknomunk
Copy link
Contributor Author

Understood. I'll use git clone then --dir for these repo migrations.

If go-git exposes that error in a way that you can detect, an error message reporting that the dumb http git protocol is not currently supported, and present a workaround would help prevent any future issue reports about this by other people.

@teknomunk
Copy link
Contributor Author

teknomunk commented Feb 3, 2021

Found another failing import. Trying to import a clone of https://github.com/hsoft/collapseos results in an error:

$ https://github.com/hsoft/collapseos
Cloning into 'collapseos'...
remote: Enumerating objects: 3086, done.
remote: Counting objects: 100% (3086/3086), done.
remote: Compressing objects: 100% (1274/1274), done.
remote: Total 15525 (delta 1883), reused 2844 (delta 1780), pack-reused 12439
Receiving objects: 100% (15525/15525), 4.68 MiB | 305.00 KiB/s, done.
Resolving deltas: 100% (10627/10627), done.

$ multi import --type=git --dir=. collapseos
object not found

$ multi --version
multi version 0.0.5

@nasdf
Copy link
Contributor

nasdf commented Feb 3, 2021

That project is using a submodule, which is not handled by the importer currently.

I'll have to figure out how submodules work and what the best way to import them would be.

@nasdf
Copy link
Contributor

nasdf commented Feb 3, 2021

I found a good work around for now. When the importer encounters a submodule it will add an empty directory.

I added a test case for the repository above and it imported successfully.

I will work on proper submodule support once I finish up what I'm currently working on.

@nasdf
Copy link
Contributor

nasdf commented Feb 3, 2021

Moved to #14

@nasdf nasdf closed this as completed Feb 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants