-
Notifications
You must be signed in to change notification settings - Fork 0
Allow for defining clone point #33
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
Comments
As it currently stands #63 expects a format like this: repos:
- name: pyk
url: git@github.com:Grokzen/pykwalify.git
sparse:
paths:
- "docs"
- "tests"
revision:
branch: master
- name: pykwalify
url: git@github.com:Grokzen/pykwalify.git
sparse:
paths:
- "docs"
- "tests"
clone_point: "pyk/docs"
revision:
tag:
filter: "[0-9].[0-9].[0-9]"
order: semver # This is also the default value if not specified
select: last # Defaults to semver style However my personal preference would be to use the Like this: repos:
- name: pyk
url: git@github.com:Grokzen/pykwalify.git
sparse:
paths:
- "docs"
- "tests"
revision:
branch: master
- name: "pyk/docs"
url: git@github.com:Grokzen/pykwalify.git
sparse:
paths:
- "docs"
- "tests"
revision:
tag:
filter: "[0-9].[0-9].[0-9]"
order: semver # This is also the default value if not specified
select: last # Defaults to semver style |
Good suggestion and But the merged These changes was added into PR #63 |
To keep on topic, I think that this implementation of In best of worlds, But for the sake of argument, I'd like to drop the requirement of
Example configuration:
This would result in cloning And with that change, I would love to see an For instance:
In all cases, both |
@rholmboe So i think i am a bit onboard on a few of the ideas, however i see some edge cases and corner cases that might be tricky. So expanding the selector base to cover more cases i can get onboard with. However the UX for this will be both explicit & implicit where some things will be obvious like name/alias and some will be more hidden like the shortform repo name and the username+reponame combo that will just "happen". This is why i am still more in favor of only having name/alias explciitly and no other super magic targeting because it will just confuse and give way to many options. I rather have that you MUST set one name for each repo (i could agree to make it into a list with multiple entries) but to keep it only as explicit. One cornercase tho is a config like this
That would break down in your example with more implicit repo names because you would have two exact entries but one goes to another URL but using the same name scheme. This would mean that we would have to implement a bunch of logic to detect and prevent these things from happening, but also to really try to understand the URL part in all cases and we all know how fun regex is to match against URL:s (thinking of e-mail validation :) This for me just reinforces the way simpler idea of "you set your own name for each repo" then you must call it The change from The feature that i will probably never believe would ever be used is to use the folder path as a repo selector. I would need to see a practical use-case from anyone before i would implement that really describing to me why they need it over any other solution simply using
This part is already a standard within git tool itself. If i simply run |
The case where: repos:
- url: git@gitlab.com:Grokzen/pykwalify.git
- url: git@github.com:Grokzen/pykwalify.git ...would result in a collision is easily handled. In the config file parsing logic, first derive If, and only if, we want to get fancy we could implement a suggestion based on smartness. The suggestion could identify that either the domain or the username varies between the two and use that to propose an alternative. I.e. |
I am in favor of using both This will allow the simplest use cases to have a really short config file. Which is a big bonus. Only setting Only setting Setting them both would combine the two benefits. Some people would probably want to use aliases because it fits their mental model (I'm looking at you @Grokzen) and referring to a path would math other peoples preference (myself included). |
But that is one of my points, i don't want to implement super complex hiearchy double, tripple, quad checking everything against all other possibilities in different orders and corner cases. I know it is possible, but it is not worth the time investment over just following KISS, have one selector and do one unique check and nothing else, that is good enough. These kinds of "smartness" with url parsing and understanding of intent, is way to complicated for almost no value with what we have to invest in time to achive something that would not be usefull for almost no one. Another fun cornercase just to throw it into the mix even further that we then have to "suppor" with understanding is that git supports cloning from other local folders so in the So the simplest and most easy thing to implement is to have one name/alias field, one value there and only that one. No other fancy magic as it will make things to complicated for a feature i doubt many or anyone will really use in the end |
Thinking of the bash completion nicety. I propose this: Implement two new subcommands to list them. Something like this: $ subgit path
pyk > git@github.com:Grokzen/pykwalify.git
pyk/docs > git@github.com:Grokzen/pykwalify.git /docs
pyk/tests > git@github.com:Grokzen/pykwalify.git /tests
$ subgit alias
pyk > git@github.com:Grokzen/pykwalify.git
pyk/docs > git@github.com:Grokzen/pykwalify.git /docs
pyk2 > git@github.com:Grokzen/pykwalify.git /tests |
We will of course focus on SSH and possibly HTTP URL:s. If we detect a Yes it needs code but it isn't unfeasible with rather OK amount of dev time. |
This is a rewrite of #2 with some updates
Right now we only have the ability to clone into the same folder. But we want to be able to clone into a sub-folder if possible.
Extend the configuration for a repo to allow for the option
clone-path: <folder-path>
for any repo we defineIf this is set then we should attempt to clone the git repo into this folder. But there is two different cases here.
The first is that we might want to clone one git repo into the already cloned repo of another repo. So lets say we have the repo
pykwalify/
that we already have cloned to disk. We want to clone another reporedis-py-cluster
into the folder pathpykwalify/redis-cluster/
instead of the root folder we stand in. The problem here is that we must have some kind of dependency resolution where we must say what order repos should be processed in to allow for this as we can't create a random folder, cloneredis-py-cluster
into it first, then clone and overwritepykwalify/
on the same folder. Add ontop of this that our configuration file is a nested dict that do not guarantee or preserv insert order always so we can't guarantee that we will always process pykwalify before redis-py-cluster for instance.If we go down dependency order lane, keep it as simple as possible, depnedencies must be defined where one repo "depends on" another repo, the tool will just re-order the execution order to fullfill the dependencies, then execute the commands in that order.
The second alternative we have is that we just ignore any dependencies and we hope that subgit just executes things in the correct order. This might cause issues and problems if we only let this to chanse. The upside is that this is way simpler to implement and we might just impelment the feature and add in dependency handling later on to move the tool forward.
Non-allowed characters or paths should be /../ anywhere in the path, working outside initialized folder shouldn't be allowed.
We also might need to sort out how we deal with moving an already exported folder if we move things around. This might mean that we need to implement state tracking of already done commands. This will need to be investigated further.
The text was updated successfully, but these errors were encountered: