mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-11-01 13:13:21 -07:00
20 lines
484 B
C#
20 lines
484 B
C#
|
using System.IO;
|
||
|
|
||
|
namespace SourceGit.Commands {
|
||
|
/// <summary>
|
||
|
/// `git commit`命令
|
||
|
/// </summary>
|
||
|
public class Commit : Command {
|
||
|
private string msg = null;
|
||
|
|
||
|
public Commit(string repo, string message, bool amend) {
|
||
|
msg = Path.GetTempFileName();
|
||
|
File.WriteAllText(msg, message);
|
||
|
|
||
|
Cwd = repo;
|
||
|
Args = $"commit --file=\"{msg}\"";
|
||
|
if (amend) Args += " --amend --no-edit";
|
||
|
}
|
||
|
}
|
||
|
}
|