mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-25 21:07:20 -08:00
Compare commits
13 commits
204d5cecec
...
31e7bef01d
Author | SHA1 | Date | |
---|---|---|---|
|
31e7bef01d | ||
|
bb45a5af8e | ||
|
3296f90feb | ||
|
a5e783da08 | ||
|
3b1a54dffd | ||
|
00a2ec5abe | ||
|
3804b0a828 | ||
|
bb6ceb03b9 | ||
|
67b6a6d9d5 | ||
|
188bf02349 | ||
|
0bb502c7cf | ||
|
f633c5260e | ||
|
67b9d7a305 |
15 changed files with 54 additions and 64 deletions
|
@ -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:
|
||||
|
||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
8.34
|
||||
8.35
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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
23
src/Commands/UpdateRef.cs
Normal 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;
|
||||
}
|
||||
}
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
{
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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;
|
||||
});
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue