Compare commits

...

13 commits

Author SHA1 Message Date
leo
31e7bef01d
docs: typo in readme
Some checks are pending
Continuous Integration / Build (push) Waiting to run
Continuous Integration / Prepare version string (push) Waiting to run
Continuous Integration / Package (push) Blocked by required conditions
2024-10-21 20:28:49 +08:00
leo
bb45a5af8e
enhance: use \S instead of \w to supports emoji character 2024-10-21 17:07:56 +08:00
leo
3296f90feb
enhance: only show two chars when they are all ascii letters or digits (#585) 2024-10-21 16:58:15 +08:00
leo
a5e783da08
enhance: disable Fast-Forward for worktree which is not current branch 2024-10-21 16:39:57 +08:00
leo
3b1a54dffd
refactor: use git update-ref $LOCAL_BRANCH $REMOTE_BRANCH instead of git fetch $REMOTE $LOCAL_BRANCH $REMOTE_BRANCH to fast-forward local branch without checkout it first. 2024-10-21 16:20:34 +08:00
leo
00a2ec5abe
enhance: conventional commit message builder supports breaking changes prefix (#584) 2024-10-21 15:47:54 +08:00
Antony David
3804b0a828
fix(histories): handle commits with breaking changes (#584) 2024-10-21 15:41:31 +08:00
Dmitrij D. Czarkoff
bb6ceb03b9
fix: Display all parents even if there are more then 2 (#583) 2024-10-21 15:38:30 +08:00
leo
67b6a6d9d5
refactor: using custom PATH instead of reading it from zsh (#581)
* run `echo $PATH > ~/Library/Application\ Support/SourceGit/PATH` to generate to custom PATH file for SourceGit
2024-10-21 15:31:13 +08:00
leo
188bf02349
Merge branch 'master' into develop 2024-10-21 09:15:22 +08:00
leo
0bb502c7cf
Merge branch 'release/v8.35' 2024-10-21 09:15:03 +08:00
leo
f633c5260e
version: Release 8.35 2024-10-21 09:14:49 +08:00
AquariusStar
67b9d7a305
work on translation (#579) 2024-10-21 09:13:34 +08:00
15 changed files with 54 additions and 64 deletions

View file

@ -81,6 +81,7 @@ 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.34
8.35

View file

@ -195,6 +195,10 @@ 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,16 +24,6 @@ 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,15 +112,7 @@ namespace SourceGit.Commands
if (data.Length < 8)
return;
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));
_current.Parents.AddRange(data.Split(separator: ' ', options: StringSplitOptions.RemoveEmptyEntries));
}
private void MarkFirstMerged()

View file

@ -73,15 +73,7 @@ namespace SourceGit.Commands
if (data.Length < 8)
return;
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));
_current.Commit.Parents.AddRange(data.Split(separator: ' ', options: StringSplitOptions.RemoveEmptyEntries));
}
private List<Models.CommitWithMessage> _commits = new List<Models.CommitWithMessage>();

23
src/Commands/UpdateRef.cs Normal file
View file

@ -0,0 +1,23 @@
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,7 +3,6 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Runtime.Versioning;
using System.Text;
using Avalonia;
@ -19,30 +18,9 @@ namespace SourceGit.Native
DisableDefaultApplicationMenuItems = true,
});
{
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.
}
}
var customPathFile = Path.Combine(OS.DataDir, "PATH");
if (File.Exists(customPathFile))
OS.CustomPathEnv = File.ReadAllText(customPathFile).Trim();
}
public string FindGitExecutable()

View file

@ -26,6 +26,7 @@ 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,6 +161,14 @@
<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,12 +68,13 @@ namespace SourceGit.ViewModels
{
builder.Append("(");
builder.Append(_scope);
builder.Append("): ");
builder.Append(")");
}
else
{
if (string.IsNullOrEmpty(_breakingChanges))
builder.Append(": ");
}
else
builder.Append("!: ");
builder.Append(_description);
builder.Append("\n\n");

View file

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

View file

@ -1355,8 +1355,9 @@ 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)
if (upstream != null && worktree == null)
{
var fastForward = new MenuItem();
fastForward.Header = new Views.NameHighlightedTextBlock("BranchCM.FastForward", upstream.FriendlyName);

View file

@ -128,10 +128,9 @@ namespace SourceGit.Views
foreach (var part in parts)
chars.Add(part[0]);
if (chars.Count >= 2)
if (chars.Count >= 2 && char.IsAsciiLetterOrDigit(chars[0]) && char.IsAsciiLetterOrDigit(chars[^1]))
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(@"^\w+([\<\(][\w\s_\-\*,]+[\>\)])?\s?:\s")]
[GeneratedRegex(@"^\S+([\<\(][\w\s_\-\*,]+[\>\)])?\!?\s?:\s")]
private static partial Regex REG_KEYWORD_FORMAT2();
private List<Models.Hyperlink> _matches = null;