mirror of
https://github.com/Llewellynvdm/starship.git
synced 2025-04-07 09:41:50 +00:00
fix(git_status): Show git add -N files as unstaged (#2702)
This commit is contained in:
parent
c4f977c48d
commit
45bb13047d
@ -256,7 +256,7 @@ impl RepoStatus {
|
|||||||
|
|
||||||
fn is_modified(status: &str) -> bool {
|
fn is_modified(status: &str) -> bool {
|
||||||
// is_wt_modified
|
// is_wt_modified
|
||||||
status.starts_with("1 .M")
|
status.starts_with("1 .M") || status.starts_with("1 .A")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_staged(status: &str) -> bool {
|
fn is_staged(status: &str) -> bool {
|
||||||
@ -633,6 +633,21 @@ mod tests {
|
|||||||
repo_dir.close()
|
repo_dir.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn shows_added() -> io::Result<()> {
|
||||||
|
let repo_dir = fixture_repo(FixtureProvider::Git)?;
|
||||||
|
|
||||||
|
create_added(&repo_dir.path())?;
|
||||||
|
|
||||||
|
let actual = ModuleRenderer::new("git_status")
|
||||||
|
.path(&repo_dir.path())
|
||||||
|
.collect();
|
||||||
|
let expected = format_output("!");
|
||||||
|
|
||||||
|
assert_eq!(expected, actual);
|
||||||
|
repo_dir.close()
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn shows_staged_file() -> io::Result<()> {
|
fn shows_staged_file() -> io::Result<()> {
|
||||||
let repo_dir = fixture_repo(FixtureProvider::Git)?;
|
let repo_dir = fixture_repo(FixtureProvider::Git)?;
|
||||||
@ -870,6 +885,18 @@ mod tests {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn create_added(repo_dir: &Path) -> io::Result<()> {
|
||||||
|
File::create(repo_dir.join("license"))?.sync_all()?;
|
||||||
|
|
||||||
|
Command::new("git")
|
||||||
|
.args(&["add", "-A", "-N"])
|
||||||
|
.current_dir(repo_dir)
|
||||||
|
.output()?;
|
||||||
|
barrier();
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
fn create_modified(repo_dir: &Path) -> io::Result<()> {
|
fn create_modified(repo_dir: &Path) -> io::Result<()> {
|
||||||
File::create(repo_dir.join("readme.md"))?.sync_all()?;
|
File::create(repo_dir.join("readme.md"))?.sync_all()?;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user