-
Notifications
You must be signed in to change notification settings - Fork 390
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
git: remove git2 from git subprocessing code paths in lib #5443
Conversation
Can't we use It's unlikely we'll drop Perhaps, EDIT: fwiw, if there are a few related small patches, I prefer including them in one PR. One PR per patch is conceptually nice, but is uneasy to manage without external tooling. |
Happy to close this one and compare the top of the stack to main |
So on trying to use gix, I'm running into a weird thing. jj/cli/tests/test_git_clone.rs Line 57 in f3bbc50
gix reports no remotes, while suprocessing does find the correct remote
|
So on trying to use gix, I'm running into a weird thing. jj/cli/tests/test_git_clone.rs Line 57 in f3bbc50
gix reports no remotes, while suprocessing does find the correct remote
Will look more into this later, but it's definitely confusing2 |
So on trying to use gix, I'm running into a weird thing. jj/cli/tests/test_git_clone.rs Line 57 in f3bbc50
gix reports no remotes, while suprocessing does find the correct remote
Will look more into this later, but it's definitely confusing |
Without knowing what your code looks, that sounds like it might be a bug in Gitoxide. GitHub user Byron (Gitoxide author) is usually very responsive, so we can probably just loop him in here if/when you feel confident that Gitoxide is behaving strangely. |
We might have to reload our git::add_remote(..)?;
let repo = repo.reload_at(repo.operation())?;
command.for_workable_repo(ui, workspace, repo) |
IIRC remote/config management, fetches, and pulls were the only things remaining on |
Oh, but the store is still reused iirc, so we'll need to reload the workspace (or
+1 |
077fcf3
to
ede9576
Compare
I tried a very hacky way to get this to work (it didn't). I only ask because this is blocking a bunch of the next refactorings, which require a strict separation between the git2 and subprocessing path (which is the direction I feel we'd like to move towards) |
ede9576
to
f7fbd21
Compare
Currently, the subprocessing code paths in the library were relying on git2 to figure out if a remote exists. This is because when git errors out for a remote not existing it outputs the same error as when the repository is not found. As the cli tool makes a distinction between the two (e.g., after cloning, the remote must exist and as such we cannot send out an error that is shared by `no remote found` and `no repository found`), this was a hack put in place to sort out the difference. It calls out to `git remote` to list out the remotes.
f7fbd21
to
1857065
Compare
I feel this patch is going backwards because git2 API just works.
I don't think it will solve the problem. Porting remote management API to
Oh, are you going to move git2/subprocess handling to caller? I would rather not, and leave it in library code. For example, struct GitFetch {
inner: enum Git2(..)|Subprocess(..),
...
}
impl GitFetch {
pub fn new(mut_repo, git_settings) -> Result<Self, ..> {
get_git_backend(mut_repo.store()).map_err(..)
...
} |
Can you try this PR? #5476 |
There are several good reasons to do this:
Overall, I think a side by side implementation needs to holistically separate, so turning one of them off should be simple |
This also applies to git2 (and gix) implementation if we add one later. The problem is not UNC paths, but is that relative remote paths are resolved differently from the
Hmm, I have feeling that we should hide |
The UNC problem I think is hard to solve with lib is unrelated to remotes. It's more that we have to pass in
From looking at the code, |
If we don't have relative configured remote paths, we can simply run
If @emilazy's patch gets merged, I expect most of |
Okay, I see your point. If that's the case, I think I might abandon most of the chain of work I've been doing, will rebase the relevant changes and get them out |
Closing |
Currently, the subprocessing code paths in the library were relying on git2 to figure out if a remote exists. This is because when git errors out for a remote not existing it outputs the same error as when the repository is not found.
As the cli tool makes a distinction between the two (e.g., after cloning, the remote must exist and as such we cannot send out an error that is shared by
no remote found
andno repository found
), this was a hack put in place to sort out the difference.It calls out to
git remote
to list out the remotes.