2024-02-05 23:08:37 -08:00
|
|
|
|
using System.IO;
|
2021-04-29 05:05:55 -07:00
|
|
|
|
|
|
|
|
|
namespace SourceGit.Commands {
|
|
|
|
|
public class Commit : Command {
|
2024-02-05 23:08:37 -08:00
|
|
|
|
public Commit(string repo, string message, bool amend, bool allowEmpty = false) {
|
2021-08-05 05:38:38 -07:00
|
|
|
|
var file = Path.GetTempFileName();
|
|
|
|
|
File.WriteAllText(file, message);
|
2021-04-29 05:05:55 -07:00
|
|
|
|
|
2024-02-05 23:08:37 -08:00
|
|
|
|
WorkingDirectory = repo;
|
|
|
|
|
Context = repo;
|
2021-08-05 05:38:38 -07:00
|
|
|
|
Args = $"commit --file=\"{file}\"";
|
2021-04-29 05:05:55 -07:00
|
|
|
|
if (amend) Args += " --amend --no-edit";
|
2024-02-05 23:08:37 -08:00
|
|
|
|
if (allowEmpty) Args += " --allow-empty";
|
2021-04-29 05:05:55 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|