code_review: PR #692

* remove unnecessary namespace using
* move `Commands.Branch.HasRemote` to `Commands.Remote.HasBranch`
* remove `Commands.Branch.DeleteRemoteTracking` and check branch in `Commands.Branch.DeleteRemote` directly

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2024-11-13 10:04:28 +08:00
parent 8935bdd4c9
commit fd5c1f5105
No known key found for this signature in database
3 changed files with 24 additions and 50 deletions

View file

@ -45,5 +45,14 @@
Args = "remote set-url" + (isPush ? " --push " : " ") + $"{name} {url}";
return Exec();
}
public bool HasBranch(string remote, string branch)
{
SSHKey = new Config(WorkingDirectory).Get($"remote.{remote}.sshkey");
Args = $"ls-remote {remote} {branch}";
var rs = ReadToEnd();
return rs.IsSuccess && rs.StdOut.Trim().Length > 0;
}
}
}