Initialize Git prior to reading author (#15377)

## Summary

Closes https://github.com/astral-sh/uv/issues/15372.
This commit is contained in:
Charlie Marsh 2025-08-19 14:37:20 +01:00 committed by GitHub
parent 075291f23e
commit c58192eebe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 6 deletions

View File

@ -769,6 +769,10 @@ impl InitProjectKind {
) -> Result<()> { ) -> Result<()> {
fs_err::create_dir_all(path)?; fs_err::create_dir_all(path)?;
// Initialize the version control system first so that Git configuration can properly
// read conditional includes that depend on the repository path.
init_vcs(path, vcs)?;
// Do no fill in `authors` for non-packaged applications unless explicitly requested. // Do no fill in `authors` for non-packaged applications unless explicitly requested.
let author_from = author_from.unwrap_or_else(|| { let author_from = author_from.unwrap_or_else(|| {
if package { if package {
@ -828,9 +832,6 @@ impl InitProjectKind {
} }
fs_err::write(path.join("pyproject.toml"), pyproject)?; fs_err::write(path.join("pyproject.toml"), pyproject)?;
// Initialize the version control system.
init_vcs(path, vcs)?;
Ok(()) Ok(())
} }
@ -855,6 +856,10 @@ impl InitProjectKind {
fs_err::create_dir_all(path)?; fs_err::create_dir_all(path)?;
// Initialize the version control system first so that Git configuration can properly
// read conditional includes that depend on the repository path.
init_vcs(path, vcs)?;
let author = get_author_info(path, author_from.unwrap_or_default()); let author = get_author_info(path, author_from.unwrap_or_default());
// Create the `pyproject.toml` // Create the `pyproject.toml`
@ -880,9 +885,6 @@ impl InitProjectKind {
generate_package_scripts(name, path, build_backend, true)?; generate_package_scripts(name, path, build_backend, true)?;
} }
// Initialize the version control system.
init_vcs(path, vcs)?;
Ok(()) Ok(())
} }
} }