refactor: git version related commands

* use `--pathspec-from-file=<FILE>` in `git add` command if git >= 2.25.0
* use `--pathspec-from-file=<FILE>` in `git stash push` command if git >= 2.26.0
* use `--staged` in `git stash push` command only if git >= 2.35.0
This commit is contained in:
leo 2025-01-11 17:29:38 +08:00
parent c939308e4c
commit b26838ff68
No known key found for this signature in database
10 changed files with 306 additions and 103 deletions

View file

@ -27,5 +27,12 @@ namespace SourceGit.Commands
}
Args = builder.ToString();
}
public Add(string repo, string pathspecFromFile)
{
WorkingDirectory = repo;
Context = repo;
Args = $"add --pathspec-from-file=\"{pathspecFromFile}\"";
}
}
}