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

Add some git utilities #2095

Merged
merged 3 commits into from
Nov 18, 2024
Merged

Add some git utilities #2095

merged 3 commits into from
Nov 18, 2024

Conversation

jneem
Copy link
Member

@jneem jneem commented Nov 15, 2024

This adds a mini-crate with some git-related utilities. It's split off from the main packaging PR, and doesn't interact with anything else.

@jneem jneem requested a review from yannham November 15, 2024 04:46
Copy link
Contributor

github-actions bot commented Nov 15, 2024

Copy link
Member

@yannham yannham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated, but as the number of our crates grow, I wonder if we should put them under a common crate directory, because it's not very clear anymore what is a crate and what isn't, I guess

git/src/lib.rs Show resolved Hide resolved
git/src/lib.rs Show resolved Hide resolved
git/src/lib.rs Outdated Show resolved Hide resolved
git/src/lib.rs Outdated
.wrap_err()?
// For now, we always fetch shallow. Maybe for the index it's more efficient to
// keep a single repo around and update it? But that might be in another method.
.with_shallow(gix::remote::fetch::Shallow::DepthAtRemote(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: there are a lot of gix::remote::fetch:: prefixes. Maybe it would be worth importing at least fetch, or even a few symbols directly?

std::fs::create_dir_all(dir).with_path(dir)?;

// Fetch the git directory somewhere temporary.
let git_tempdir = tempfile::tempdir().wrap_err()?;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a naive question, but why do we need a temporary directory first? Can't we do everything in dir directly?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to put the .git stuff somewhere. There's probably no harm in putting it in dir, but I thought it was cleaner to just populate dir with the contents, and not the .git stuff.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, you can choose to put the git stuff separately, I see. That's fine by me 👍

@jneem jneem enabled auto-merge November 18, 2024 04:24
@jneem jneem added this pull request to the merge queue Nov 18, 2024
Merged via the queue into master with commit 2e35990 Nov 18, 2024
5 checks passed
@jneem jneem deleted the npm-git branch November 18, 2024 04:32
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.

2 participants