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

bare clone for git-repository #551

Merged
merged 43 commits into from
Oct 10, 2022
Merged

bare clone for git-repository #551

merged 43 commits into from
Oct 10, 2022

Conversation

Byron
Copy link
Member

@Byron Byron commented Oct 5, 2022

Cloning is essentially initializing a new repository, adding a remote, and fetching the pack based on the standard refspecs.

There are some subtleties with local clones for instance that are to be validated - maybe these are happening naturally as they are typical for tests.

It will be interesting to figure out an API that can work without having to pass massive Options structures just to pre-fill methods that are called later, as such it's OK to be more low-level at first to one day get a 'one method call' counterpart with common options.

Tasks

  • a way to write a remote's configuration back to a file (even though this one can be special as there is no prior configuration to pay attention to during clone).
  • API sketch, allow for later addition of recursive cloning of submodules and worktree checkouts, and for configuring configuration and credentials, and open options
  • respect all applicable configuration variables
  • validate this part of the fetch docs - is it true? It doesn't look like it when checking the code, but let's note this as difference in our implementation, which doesn't special case force anywhere.

Unlike when pushing with git-push[1], any updates outside of refs/{tags,heads}/* will be accepted without + in the refspec (or --force), whether that’s swapping e.g. a tree object for a blob, or a commit for another commit that’s doesn’t have the previous commit as an ancestor etc.

Out of scope

  • submodules

@Byron Byron mentioned this pull request Oct 5, 2022
27 tasks
@Byron Byron changed the title fetch pack for clone clone for git-repository Oct 5, 2022
@Byron Byron changed the title clone for git-repository bare clone for git-repository Oct 5, 2022
Byron added 27 commits October 5, 2022 15:27
For now without any handling of removing previous values.
…y named section.

We also add `File::remove_section_by_id()` to make it possible to remove
specific sections.
…d mutate them.

As section names are not unique, it was previously not possible to
iterate sections and then mutate them as one wouldn't be able to refer
to the exact section that was just traversed, after all, there can be
many sections named `remote "origin"`.

With the new methods it's possible to uniquely refer to each section
for mutation and removal.
Previously, newlines would remain past a value, and whitespace could
remain before one.

Now both are removed to simulate removing an actual line.
Much better whitespace handling definitely shows here.
It also showed that we aren't quite lossless with our urls yet.
Previously a url like `/path/to/repo` would serialize to
`file:///path/to/repo`, preventing round-trips.

Now it serializes like it was parsed. This also means that
`file://path` still serializes as `file://path`.
Previously `git@host:path` would turn into `ssh://git@host/path`,
which now remains exactly as is.
It's explicitly a multi-step process and maybe the function names
could represent that better.
…realize that subsection/remote-name validation is incorrect here and
in another place that needs fixing.
It can be useful to validate subsection names without having to
construct an entire `Header` (which also includes a name).
@Byron Byron merged commit 507dc7e into main Oct 10, 2022
@Byron Byron deleted the clone branch October 10, 2022 09:09
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

Successfully merging this pull request may close these issues.

1 participant