Merge branch 'develop' into feature/allowing_to_checkout_commit

This commit is contained in:
Filipe Ramalho 2024-05-25 15:43:27 -03:00 committed by GitHub
commit db9ca5ba25
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
56 changed files with 822 additions and 283 deletions

View file

@ -36,7 +36,7 @@
return cmd.Exec();
}
public static bool Delete(string repo, string name)
public static bool DeleteLocal(string repo, string name)
{
var cmd = new Command();
cmd.WorkingDirectory = repo;
@ -44,5 +44,25 @@
cmd.Args = $"branch -D {name}";
return cmd.Exec();
}
public static bool DeleteRemote(string repo, string remote, string name)
{
var cmd = new Command();
cmd.WorkingDirectory = repo;
cmd.Context = repo;
var sshKey = new Config(repo).Get($"remote.{remote}.sshkey");
if (!string.IsNullOrEmpty(sshKey))
{
cmd.Args = $"-c core.sshCommand=\"ssh -i '{sshKey}'\" ";
}
else
{
cmd.Args = "-c credential.helper=manager ";
}
cmd.Args += $"push {remote} --delete {name}";
return cmd.Exec();
}
}
}

View file

@ -33,31 +33,6 @@ namespace SourceGit.Commands
Args += $"{remote} {local}:{remoteBranch}";
}
/// <summary>
/// Only used to delete a remote branch!!!!!!
/// </summary>
/// <param name="repo"></param>
/// <param name="remote"></param>
/// <param name="branch"></param>
public Push(string repo, string remote, string branch)
{
WorkingDirectory = repo;
Context = repo;
TraitErrorAsOutput = true;
var sshKey = new Config(repo).Get($"remote.{remote}.sshkey");
if (!string.IsNullOrEmpty(sshKey))
{
Args = $"-c core.sshCommand=\"ssh -i '{sshKey}'\" ";
}
else
{
Args = "-c credential.helper=manager ";
}
Args += $"push {remote} --delete {branch}";
}
public Push(string repo, string remote, string tag, bool isDelete)
{
WorkingDirectory = repo;

View file

@ -5,12 +5,22 @@ namespace SourceGit.Commands
{
public static class Tag
{
public static bool Add(string repo, string name, string basedOn, string message)
public static bool Add(string repo, string name, string basedOn)
{
var cmd = new Command();
cmd.WorkingDirectory = repo;
cmd.Context = repo;
cmd.Args = $"tag -a {name} {basedOn} ";
cmd.Args = $"tag {name} {basedOn}";
return cmd.Exec();
}
public static bool Add(string repo, string name, string basedOn, string message, bool sign)
{
var param = sign ? "-s -a" : "-a";
var cmd = new Command();
cmd.WorkingDirectory = repo;
cmd.Context = repo;
cmd.Args = $"tag {param} {name} {basedOn} ";
if (!string.IsNullOrEmpty(message))
{