Compare commits

...

2 Commits

Author SHA1 Message Date
4cb8fd1c7d
support output-folder option for git-related features
Repository-based logic seems to automatically be made relative to the top-level path the repo was initialised with, so we can actually support an output folder with no issues here
2024-10-01 20:44:58 +01:00
b575274116
fix decompiling history into git
Why does this work and the version with the directory doesn't? yeah idk. But hey, this one successfully stages the files, so ill take it
2024-10-01 20:32:59 +01:00

View File

@ -308,8 +308,8 @@ struct DownloadDecompileSubcommand{
struct DecompileHistoryIntoGitSubcommand{ struct DecompileHistoryIntoGitSubcommand{
#[arg(long)] #[arg(long)]
input_folder:PathBuf, input_folder:PathBuf,
//currently output folder must be the current folder due to git2 limitations #[arg(long)]
//output_folder:cli.output.unwrap(), output_folder:Option<PathBuf>,
#[arg(long)] #[arg(long)]
style:Style, style:Style,
#[arg(long)] #[arg(long)]
@ -334,8 +334,8 @@ struct DownloadAndDecompileHistoryIntoGitSubcommand{
cookie_envvar:Option<String>, cookie_envvar:Option<String>,
#[arg(long,group="cookie",required=true)] #[arg(long,group="cookie",required=true)]
cookie_file:Option<PathBuf>, cookie_file:Option<PathBuf>,
//currently output folder must be the current folder due to git2 limitations #[arg(long)]
//output_folder:cli.output.unwrap(), output_folder:Option<PathBuf>,
#[arg(long)] #[arg(long)]
style:Style, style:Style,
#[arg(long)] #[arg(long)]
@ -561,7 +561,7 @@ async fn main()->AResult<()>{
git_committer_name:subcommand.git_committer_name, git_committer_name:subcommand.git_committer_name,
git_committer_email:subcommand.git_committer_email, git_committer_email:subcommand.git_committer_email,
input_folder:subcommand.input_folder, input_folder:subcommand.input_folder,
output_folder:std::env::current_dir()?, output_folder:subcommand.output_folder.unwrap_or_else(||std::env::current_dir().unwrap()),
style:subcommand.style.rox(), style:subcommand.style.rox(),
write_template:subcommand.write_template.unwrap_or(false), write_template:subcommand.write_template.unwrap_or(false),
write_models:subcommand.write_models.unwrap_or(false), write_models:subcommand.write_models.unwrap_or(false),
@ -576,7 +576,7 @@ async fn main()->AResult<()>{
subcommand.cookie_file, subcommand.cookie_file,
).await?, ).await?,
asset_id:subcommand.asset_id, asset_id:subcommand.asset_id,
output_folder:std::env::current_dir()?, output_folder:subcommand.output_folder.unwrap_or_else(||std::env::current_dir().unwrap()),
style:subcommand.style.rox(), style:subcommand.style.rox(),
write_template:subcommand.write_template.unwrap_or(false), write_template:subcommand.write_template.unwrap_or(false),
write_models:subcommand.write_models.unwrap_or(false), write_models:subcommand.write_models.unwrap_or(false),
@ -1198,11 +1198,11 @@ async fn write_commit(config:WriteCommitConfig,b:Result<AResult<(AssetVersion,ro
let sig=git2::Signature::new(config.git_committer_name.as_str(),config.git_committer_email.as_str(),&git2::Time::new(date.timestamp(),0)).unwrap(); let sig=git2::Signature::new(config.git_committer_name.as_str(),config.git_committer_email.as_str(),&git2::Time::new(date.timestamp(),0)).unwrap();
let tree_id={ let tree_id={
let mut tree_index = repo.index()?; let mut tree_index = repo.index()?;
match tree_index.add_all(std::iter::once(config.output_folder.as_path()),git2::IndexAddOption::DEFAULT,None){ match tree_index.add_all(std::iter::once("*"),git2::IndexAddOption::DEFAULT,None){
Ok(_)=>(), Ok(_)=>(),
Err(e)=>println!("tree_index.add_all error: {}",e), Err(e)=>println!("tree_index.add_all error: {}",e),
} }
match tree_index.update_all(std::iter::once(config.output_folder.as_path()),None){ match tree_index.update_all(std::iter::once("*"),None){
Ok(_)=>(), Ok(_)=>(),
Err(e)=>println!("tree_index.update_all error: {}",e), Err(e)=>println!("tree_index.update_all error: {}",e),
} }