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

refactor: git source cleanup #12197

Merged
merged 7 commits into from
Jun 5, 2023
Merged

Conversation

weihanglo
Copy link
Member

@weihanglo weihanglo commented May 29, 2023

What does this PR try to resolve?

I found some places can do minor refactors during documenting those items last week.

How should we test and review this PR?

Commit by commit. Each has its own explanation.

I believe the first four is not controversial. However, the last three do need to scrutinize

  • 45e3a86 — I can't see why this need to implement Serialize. Did I miss some important contexts?
  • 9baf0c8 — the repo and path should always be in sync so there is no need to have two arguments. However, git2::Repository::path() force UTF8 path on Windows. Will it cause any problem? I guess it may not since we already use repo.path() somewhere in the codebase.
  • f3653c8 — This should have no behavioral change but I need a second pair of eyes to verify that.

Additional information

@rustbot
Copy link
Collaborator

rustbot commented May 29, 2023

r? @epage

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added A-git Area: anything dealing with git S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 29, 2023
@weihanglo
Copy link
Member Author

@bors try

@bors
Copy link
Collaborator

bors commented May 30, 2023

⌛ Trying commit f3653c8 with merge fb8e278...

bors added a commit that referenced this pull request May 30, 2023
@bors
Copy link
Collaborator

bors commented May 30, 2023

💥 Test timed out

@weihanglo
Copy link
Member Author

All checks have passed but bors timed out. I have no idea.

@bors try

@bors
Copy link
Collaborator

bors commented May 31, 2023

⌛ Trying commit f3653c8 with merge a2516fd...

bors added a commit that referenced this pull request May 31, 2023
@bors
Copy link
Collaborator

bors commented May 31, 2023

💥 Test timed out

For being consistent with `GitDatabase`.
`orig_url` was unclear. Whose origin? `remote_url` is way more
self-explanatory under a `git fetch` context.
The explanation is moved to be public from an inline comment.
Although this is only a few lines of code, I think it is still worth
keeping it clean if it's not used by Cargo internally. Not to mention
this apparently has an alternative solution at this moment, for example:

```diff
- let oid = git_remote.rev_for(db_path, git_ref)?;
+ let oid = git_remote.db_at(db_path)?.resolve(git_ref)?;
```

From a naive research on GitHub, there is only one usage[^1] and it
seems to be active but still experimental. Pardon my abrupt change
breaking your project :(

Only when we start considering what we want to expose can Cargo has
a clearer boundaries between its subcrates.

[^1]: https://github.com/trustification/source-distributed/blob/124ef26081a41330a553483441fca544bedbb473/src/git.rs#L34
It doesn't seem that they need to derive `Serialize`. Is there any other
usage I am not aware of?
It was confusing and may lead to inconsistency that people need to
pass both `path` and `repo` and ensure they are in sync.
This should be less controversial as the current logic share the
same `GitRemote`. You can see the callsite of `GitDatabase::copy_to`
use `self.url()`, which then calls into `self.remote.url(). When a
`GitDatabase` is created, Cargo also uses `self.remote` as the
remote of that `GitDatabase`.
@weihanglo
Copy link
Member Author

@epage. I believe this is ready. Do you have any concern with it?

@epage
Copy link
Contributor

epage commented Jun 5, 2023

Sorry, missed that this was now ready

@bors r+

@bors
Copy link
Collaborator

bors commented Jun 5, 2023

📌 Commit 88845b9 has been approved by epage

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 5, 2023
@bors
Copy link
Collaborator

bors commented Jun 5, 2023

⌛ Testing commit 88845b9 with merge 383a68e...

@bors
Copy link
Collaborator

bors commented Jun 5, 2023

☀️ Test successful - checks-actions
Approved by: epage
Pushing 383a68e to master...

@bors
Copy link
Collaborator

bors commented Jun 5, 2023

☀️ Test successful - checks-actions
Approved by: epage
Pushing 383a68e to master...

@bors
Copy link
Collaborator

bors commented Jun 5, 2023

👀 Test was successful, but fast-forwarding failed: 422 Changes must be made through a pull request.

@bors bors merged commit 383a68e into rust-lang:master Jun 5, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jun 10, 2023
Update cargo

12 commits in b0fa79679e717cd077b7fc0fa4166f47107f1ba9..49b6d9e179a91cf7645142541c9563443f64bf2b
2023-06-03 14:19:48 +0000 to 2023-06-09 17:21:19 +0000
- docs: doc comments for all registry kinds (rust-lang/cargo#12247)
- chore: Migrate print-ban from test to clippy (rust-lang/cargo#12246)
- fix: fetch nested git submodules (rust-lang/cargo#12244)
- refactor: registry source cleanup (rust-lang/cargo#12240)
- test: loose overly matches for git cli output (rust-lang/cargo#12241)
- fix: disable multiplexing on macOS for some versions of curl (rust-lang/cargo#12234)
- docs: doc comments for registry source and index (rust-lang/cargo#12239)
- doc: point to nightly cargo doc (rust-lang/cargo#12237)
- Upgrade to `gix` v0.45 for multi-round pack negotiations. (rust-lang/cargo#12236)
- refactor: git source cleanup (rust-lang/cargo#12197)
- Add message on reusing previous temporary path on failed cargo installs (rust-lang/cargo#12231)
- doc: the first line should be a simple sentence instead of a heading (rust-lang/cargo#12228)

r? `@ghost`
@ehuss ehuss added this to the 1.72.0 milestone Jun 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-git Area: anything dealing with git S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants