Compare commits

..

No commits in common. "31e7bef01dc4fecfe5a699fef6624e2d6203a5ab" and "204d5cecece7c60951590dce5eb82fb4fea63bb0" have entirely different histories.

15 changed files with 64 additions and 54 deletions

View file

@ -81,7 +81,6 @@ For **macOS** users:
* Make sure your mac trusts all software from anywhere. For more information, search `spctl --master-disable`.
* Make sure [git-credential-manager](https://github.com/git-ecosystem/git-credential-manager/releases) is installed on your mac.
* You may need to run `sudo xattr -cr /Applications/SourceGit.app` to make sure the software works.
* You can run `echo $PATH > ~/Library/Application\ Support/SourceGit/PATH` to generate a custom PATH env file to introduce `PATH` env to SourceGit.
For **Linux** users:

View file

@ -1 +1 @@
8.35
8.34

View file

@ -195,10 +195,6 @@ namespace SourceGit.Commands
if (OperatingSystem.IsLinux())
start.Environment.Add("LANG", "en_US.UTF-8");
// Fix macOS `PATH` env
if (OperatingSystem.IsMacOS() && !string.IsNullOrEmpty(Native.OS.CustomPathEnv))
start.Environment.Add("PATH", Native.OS.CustomPathEnv);
// Force using this app as git editor.
switch (Editor)
{

View file

@ -24,6 +24,16 @@ namespace SourceGit.Commands
Args += remote;
}
public Fetch(string repo, string remote, string localBranch, string remoteBranch, Action<string> outputHandler)
{
_outputHandler = outputHandler;
WorkingDirectory = repo;
Context = repo;
TraitErrorAsOutput = true;
SSHKey = new Config(repo).Get($"remote.{remote}.sshkey");
Args = $"fetch --progress --verbose {remote} {remoteBranch}:{localBranch}";
}
protected override void OnReadline(string line)
{
_outputHandler?.Invoke(line);

View file

@ -112,7 +112,15 @@ namespace SourceGit.Commands
if (data.Length < 8)
return;
_current.Parents.AddRange(data.Split(separator: ' ', options: StringSplitOptions.RemoveEmptyEntries));
var idx = data.IndexOf(' ', StringComparison.Ordinal);
if (idx == -1)
{
_current.Parents.Add(data);
return;
}
_current.Parents.Add(data.Substring(0, idx));
_current.Parents.Add(data.Substring(idx + 1));
}
private void MarkFirstMerged()

View file

@ -73,7 +73,15 @@ namespace SourceGit.Commands
if (data.Length < 8)
return;
_current.Commit.Parents.AddRange(data.Split(separator: ' ', options: StringSplitOptions.RemoveEmptyEntries));
var idx = data.IndexOf(' ', StringComparison.Ordinal);
if (idx == -1)
{
_current.Commit.Parents.Add(data);
return;
}
_current.Commit.Parents.Add(data.Substring(0, idx));
_current.Commit.Parents.Add(data.Substring(idx + 1));
}
private List<Models.CommitWithMessage> _commits = new List<Models.CommitWithMessage>();

View file

@ -1,23 +0,0 @@
using System;
namespace SourceGit.Commands
{
public class UpdateRef : Command
{
public UpdateRef(string repo, string refName, string toRevision, Action<string> outputHandler)
{
_outputHandler = outputHandler;
WorkingDirectory = repo;
Context = repo;
Args = $"update-ref {refName} {toRevision}";
}
protected override void OnReadline(string line)
{
_outputHandler?.Invoke(line);
}
private Action<string> _outputHandler;
}
}

View file

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Runtime.Versioning;
using System.Text;
using Avalonia;
@ -18,9 +19,30 @@ namespace SourceGit.Native
DisableDefaultApplicationMenuItems = true,
});
var customPathFile = Path.Combine(OS.DataDir, "PATH");
if (File.Exists(customPathFile))
OS.CustomPathEnv = File.ReadAllText(customPathFile).Trim();
{
var startInfo = new ProcessStartInfo();
startInfo.FileName = "zsh";
startInfo.Arguments = "--login -c \"echo $PATH\"";
startInfo.UseShellExecute = false;
startInfo.CreateNoWindow = true;
startInfo.RedirectStandardOutput = true;
startInfo.StandardOutputEncoding = Encoding.UTF8;
try
{
var proc = new Process() { StartInfo = startInfo };
proc.Start();
var pathData = proc.StandardOutput.ReadToEnd();
proc.WaitForExit();
if (proc.ExitCode == 0)
Environment.SetEnvironmentVariable("PATH", pathData);
proc.Close();
}
catch
{
// Ignore error.
}
}
}
public string FindGitExecutable()

View file

@ -26,7 +26,6 @@ namespace SourceGit.Native
public static string GitExecutable { get; set; } = string.Empty;
public static string ShellOrTerminal { get; set; } = string.Empty;
public static List<Models.ExternalTool> ExternalTools { get; set; } = [];
public static string CustomPathEnv { get; set; } = string.Empty;
static OS()
{

View file

@ -161,14 +161,6 @@
<x:String x:Key="Text.ConfigureWorkspace" xml:space="preserve">Рабочие пространства</x:String>
<x:String x:Key="Text.ConfigureWorkspace.Name" xml:space="preserve">Имя</x:String>
<x:String x:Key="Text.ConfigureWorkspace.Color" xml:space="preserve">Цвет</x:String>
<x:String x:Key="Text.ConfigureWorkspace.Restore" xml:space="preserve">Восстанавливать вкладки при запуске</x:String>
<x:String x:Key="Text.ConventionalCommit" xml:space="preserve">Общепринятый помощник по фиксации изменений</x:String>
<x:String x:Key="Text.ConventionalCommit.BreakingChanges" xml:space="preserve">Кардинальные изменения:</x:String>
<x:String x:Key="Text.ConventionalCommit.ClosedIssue" xml:space="preserve">Закрытая тема:</x:String>
<x:String x:Key="Text.ConventionalCommit.Detail" xml:space="preserve">Детали изменений:</x:String>
<x:String x:Key="Text.ConventionalCommit.Scope" xml:space="preserve">Область:</x:String>
<x:String x:Key="Text.ConventionalCommit.ShortDescription" xml:space="preserve">Коротнкое описание:</x:String>
<x:String x:Key="Text.ConventionalCommit.Type" xml:space="preserve">Тип изменения:</x:String>
<x:String x:Key="Text.Copy" xml:space="preserve">Копировать</x:String>
<x:String x:Key="Text.CopyAllText" xml:space="preserve">Копировать весь текст</x:String>
<x:String x:Key="Text.CopyMessage" xml:space="preserve">КОПИРОВАТЬ СООБЩЕНИЕ</x:String>

View file

@ -68,13 +68,12 @@ namespace SourceGit.ViewModels
{
builder.Append("(");
builder.Append(_scope);
builder.Append(")");
builder.Append("): ");
}
if (string.IsNullOrEmpty(_breakingChanges))
builder.Append(": ");
else
builder.Append("!: ");
{
builder.Append(": ");
}
builder.Append(_description);
builder.Append("\n\n");

View file

@ -31,7 +31,7 @@ namespace SourceGit.ViewModels
return Task.Run(() =>
{
new Commands.UpdateRef(_repo.FullPath, Local.FullName, To.FullName, SetProgressDescription).Exec();
new Commands.Fetch(_repo.FullPath, To.Remote, Local.Name, To.Name, SetProgressDescription).Exec();
CallUIThread(() => _repo.SetWatcherEnabled(true));
return true;
});

View file

@ -1355,9 +1355,8 @@ namespace SourceGit.ViewModels
};
menu.Items.Add(checkout);
var worktree = _worktrees.Find(x => x.Branch == branch.FullName);
var upstream = _branches.Find(x => x.FullName == branch.Upstream);
if (upstream != null && worktree == null)
if (upstream != null)
{
var fastForward = new MenuItem();
fastForward.Header = new Views.NameHighlightedTextBlock("BranchCM.FastForward", upstream.FriendlyName);

View file

@ -128,9 +128,10 @@ namespace SourceGit.Views
foreach (var part in parts)
chars.Add(part[0]);
if (chars.Count >= 2 && char.IsAsciiLetterOrDigit(chars[0]) && char.IsAsciiLetterOrDigit(chars[^1]))
if (chars.Count >= 2)
return string.Format("{0}{1}", chars[0], chars[^1]);
if (chars.Count == 1)
return string.Format("{0}", chars[0]);
return name.Substring(0, 1);
}

View file

@ -308,7 +308,7 @@ namespace SourceGit.Views
[GeneratedRegex(@"^\[[\w\s]+\]")]
private static partial Regex REG_KEYWORD_FORMAT1();
[GeneratedRegex(@"^\S+([\<\(][\w\s_\-\*,]+[\>\)])?\!?\s?:\s")]
[GeneratedRegex(@"^\w+([\<\(][\w\s_\-\*,]+[\>\)])?\s?:\s")]
private static partial Regex REG_KEYWORD_FORMAT2();
private List<Models.Hyperlink> _matches = null;