mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 05:51:39 +00:00
Update dependencies and refactor git integration
- Added new dependencies in `Cargo.lock` and updated `Cargo.toml` to include `gix` for improved git functionality. - Refactored git-related functions to utilize the `gix` library, enhancing performance and reliability in handling git operations. - Simplified the process of initializing git repositories and committing changes within the CLI commands. - Updated tests to reflect changes in git integration and ensure proper functionality. These changes aim to modernize the git handling in the project and improve overall code quality.
This commit is contained in:
parent
d8d6a53fce
commit
0a359ccaf1
12 changed files with 1954 additions and 473 deletions
|
|
@ -203,21 +203,17 @@ impl TestServeSession {
|
|||
.expect("Couldn't copy project to temporary directory");
|
||||
|
||||
// Initialize git repo and run setup callback
|
||||
Command::new("git")
|
||||
.args(["init"])
|
||||
.current_dir(&project_path)
|
||||
.output()
|
||||
.expect("git init failed");
|
||||
Command::new("git")
|
||||
.args(["config", "user.email", "test@test.com"])
|
||||
.current_dir(&project_path)
|
||||
.output()
|
||||
.unwrap();
|
||||
Command::new("git")
|
||||
.args(["config", "user.name", "Test"])
|
||||
.current_dir(&project_path)
|
||||
.output()
|
||||
.unwrap();
|
||||
let mut repo = gix::init(&project_path).expect("gix init failed");
|
||||
{
|
||||
let mut config = repo.config_snapshot_mut();
|
||||
config
|
||||
.set_raw_value(&gix::config::tree::User::NAME, "Test")
|
||||
.unwrap();
|
||||
config
|
||||
.set_raw_value(&gix::config::tree::User::EMAIL, "test@test.com")
|
||||
.unwrap();
|
||||
let _ = config.commit_auto_rollback().unwrap();
|
||||
}
|
||||
|
||||
setup(&project_path);
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
//! - Non-script changes are in changedIds but not in scriptCommittedHashes
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::path::Path;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::Command;
|
||||
use std::time::Duration;
|
||||
use std::{fs, thread};
|
||||
|
|
@ -24,27 +24,15 @@ use rbx_dom_weak::{ustr, UstrMap};
|
|||
use crate::rojo_test::serve_util::TestServeSession;
|
||||
|
||||
fn git_commit_all(dir: &Path, msg: &str) {
|
||||
Command::new("git")
|
||||
.args(["add", "-A"])
|
||||
.current_dir(dir)
|
||||
.output()
|
||||
.expect("git add failed");
|
||||
Command::new("git")
|
||||
.args(["commit", "-m", msg])
|
||||
.current_dir(dir)
|
||||
.output()
|
||||
.expect("git commit failed");
|
||||
librojo::git::git_add_all_and_commit(dir, msg);
|
||||
}
|
||||
|
||||
fn git_stage(dir: &Path, file: &str) {
|
||||
Command::new("git")
|
||||
.args(["add", file])
|
||||
.current_dir(dir)
|
||||
.output()
|
||||
.expect("git stage failed");
|
||||
librojo::git_add(dir, &[PathBuf::from(file)]);
|
||||
}
|
||||
|
||||
fn git_is_staged(dir: &Path, file: &str) -> bool {
|
||||
use std::process::Command;
|
||||
let output = Command::new("git")
|
||||
.args(["diff", "--cached", "--name-only"])
|
||||
.current_dir(dir)
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ syncback_tests! {
|
|||
// do not leave any trace of themselves (new files get .json5)
|
||||
ref_properties_pruned => ["src/Pointer1.model.json5", "src/Pointer2.model.json5", "src/Pointer3.model.json5"],
|
||||
// Ensures that the `$schema` field roundtrips with syncback
|
||||
schema_roundtrip => ["default.project.json5", "src/model.model.json5", "src/init/init.meta.json5", "src/adjacent.meta.json5"],
|
||||
schema_roundtrip => ["default.project.json5", "src/model.model.json5", "src/init_/init.meta.json5", "src/adjacent.meta.json5"],
|
||||
// Ensures that StringValues inside project files are written to the
|
||||
// project file, but only if they don't have `$path` set
|
||||
string_value_project => ["default.project.json5"],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue