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

Command for cloning a git repo and adding it to a group #202

Closed
GordianDziwis opened this issue Nov 22, 2021 · 6 comments
Closed

Command for cloning a git repo and adding it to a group #202

GordianDziwis opened this issue Nov 22, 2021 · 6 comments
Labels
enhancement New feature or request

Comments

@GordianDziwis
Copy link

GordianDziwis commented Nov 22, 2021

I would like to do something like this:

gita clone -g Foo git@github.com:nosarthur/gita.git

The result would be the same as:

git clone git@github.com:nosarthur/gita.git
gita add -g Foo ./gita
@nosarthur
Copy link
Owner

I think it's a good idea

@ackermanaviation
Copy link

If i understand this correctly,

  1. 'gita clone' pulls from a config file rather than a single repo path
  2. 'gita add' adds an already cloned repo to the tracking but does not clone

the requested feature is a mix of both - clone a single repo, then add it.

So, change the 'clone' command to work with a single repo?
Or change the 'add' command to allow cloning?
Or, something else?

perhaps:

gita add -g Foo -u git@github.com:nosarthur/gita.git

-u meaning clone from url
This would equivalent to:

git clone git@github.com:nosarthur/gita.git
gita add -g Foo ./gita

and

gita clone -g Foo config_file

clone all items from config_file and add to group Foo. (not what the poster asked, but along a similar idea)
This would equilavent as something like

for url, name, path in config_file:
	git clone url name
	gita add -g Foo name

@ackermanaviation
Copy link

Alternatively, maybe a more radical change?

merge clone and add:

'gita add -c config_file' same as 'gita clone config_file'
'gita add -c config_file -p' same as 'gita clone config_file -p'
'gita add -c config_file -g group' add all items from config_file and track in group [new]
'gita add -u url' clone repo from url, add to tracking without group [new]
'gita add -u url -g group' clone repo from url, add to group [new[ <=== requested item

all other 'gita add' remain as they currently are.
'gita clone' could be aliased and deprecated.

@nosarthur
Copy link
Owner

Thanks @ackermanaviation for putting the thought. The gita clone command is indeed not well planned.

I prefer to leave gita add as it is since it already has too many options. And clean up gita clone instead. We should make it more like git clone, just like all the other gita commands, i.e.,

gita clone <url>

becomes

git clone <url>

at the current working directory.

Then we can add some options, say -C for where to clone to, -a for adding it to gita (gita add <cloned-repo-path>), -g for adding it to gita and also to a group, -f for using a config file (the current usage case), etc.

@nosarthur nosarthur added the enhancement New feature or request label Jan 25, 2022
nosarthur added a commit that referenced this issue Jan 30, 2022
The previous `gita clone config-file` corresponds to `gita clone -f config-file`

Now, by default
`gita clone <url>` translates to `git clone <url>` at the current
working directory

Also add `-C` option for changing current working directory before execution
nosarthur added a commit that referenced this issue Jan 30, 2022
* reimplement gita clone #202

The previous `gita clone config-file` corresponds to `gita clone -f config-file`

Now, by default
`gita clone <url>` translates to `git clone <url>` at the current
working directory

Also add `-C` option for changing current working directory before execution
@nosarthur
Copy link
Owner

gita clone refactoring is partially done in v0.16.2, -a and -g are still not implemented

https://github.com/nosarthur/gita/releases/tag/v0.16.2

@nosarthur
Copy link
Owner

implemented in v0.16.6.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants