Skip to content

Commit 0aa2aaa

Browse files
committed
Merge branch 'release/v2025.01'
2 parents 2d500fc + 1898385 commit 0aa2aaa

32 files changed

+443
-216
lines changed

README.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@
4747
4848
## Translation Status
4949

50-
[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-100.00%25-brightgreen)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-100.00%25-brightgreen)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-95.00%25-yellow)](TRANSLATION.md) [![it__IT](https://img.shields.io/badge/it__IT-95.56%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-96.81%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-100.00%25-brightgreen)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md)
50+
[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-99.86%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-99.86%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-94.87%25-yellow)](TRANSLATION.md) [![it__IT](https://img.shields.io/badge/it__IT-95.42%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-96.67%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-100.00%25-brightgreen)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md)
51+
52+
> [!NOTE]
53+
> You can find the missing keys in [TRANSLATION.md](TRANSLATION.md)
5154
5255
## How to Use
5356

@@ -64,7 +67,8 @@ This software creates a folder `$"{System.Environment.SpecialFolder.ApplicationD
6467
| macOS | `${HOME}/Library/Application Support/SourceGit` |
6568

6669
> [!TIP]
67-
> You can open this data storage directory from the main menu.
70+
> * You can open this data storage directory from the main menu `Open Data Storage Directory`.
71+
> * You can create a `data` folder next to the `SourceGit` executable to force this app to store data (user settings, downloaded avatars and crash logs) into it (Portable-Mode). Only works on Windows.
6872
6973
For **Windows** users:
7074

@@ -81,7 +85,6 @@ For **Windows** users:
8185
scoop install sourcegit
8286
```
8387
* Pre-built binaries can be found in [Releases](https://github.com/sourcegit-scm/sourcegit/releases/latest)
84-
* You can run `dotnet publish -c Release -r win-x64 -p:EnablePortable=true -o $YOUR_PUBLISH_DIR .\src\SourceGit.csproj` to build a portable version.
8588

8689
For **macOS** users:
8790

@@ -190,6 +193,15 @@ This app supports open repository in external tools listed in the table below.
190193

191194
Everyone is welcome to submit a PR. Please make sure your PR is based on the latest `develop` branch and the target branch of PR is `develop`.
192195

196+
In short, here are the commands to get started once [.NET tools are installed](https://dotnet.microsoft.com/en-us/download):
197+
198+
```sh
199+
dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org
200+
dotnet restore
201+
dotnet build
202+
dotnet run --project src/SourceGit.csproj
203+
```
204+
193205
Thanks to all the people who contribute.
194206

195207
[![Contributors](https://contrib.rocks/image?repo=sourcegit-scm/sourcegit&columns=20)](https://github.com/sourcegit-scm/sourcegit/graphs/contributors)

TRANSLATION.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
### de_DE.axaml: 100.00%
1+
### de_DE.axaml: 99.86%
22

33

44
<details>
55
<summary>Missing Keys</summary>
66

7-
7+
- Text.Preference.General.DateFormat
88

99
</details>
1010

11-
### es_ES.axaml: 100.00%
11+
### es_ES.axaml: 99.86%
1212

1313

1414
<details>
1515
<summary>Missing Keys</summary>
1616

17-
17+
- Text.Preference.General.DateFormat
1818

1919
</details>
2020

21-
### fr_FR.axaml: 95.00%
21+
### fr_FR.axaml: 94.87%
2222

2323

2424
<details>
@@ -47,6 +47,7 @@
4747
- Text.Preference.Appearance.FontSize
4848
- Text.Preference.Appearance.FontSize.Default
4949
- Text.Preference.Appearance.FontSize.Editor
50+
- Text.Preference.General.DateFormat
5051
- Text.Preference.General.ShowChildren
5152
- Text.Repository.CustomActions
5253
- Text.Repository.FilterCommits
@@ -63,7 +64,7 @@
6364

6465
</details>
6566

66-
### it_IT.axaml: 95.56%
67+
### it_IT.axaml: 95.42%
6768

6869

6970
<details>
@@ -89,6 +90,7 @@
8990
- Text.MergeMultiple.CommitChanges
9091
- Text.MergeMultiple.Strategy
9192
- Text.MergeMultiple.Targets
93+
- Text.Preference.General.DateFormat
9294
- Text.Preference.General.ShowChildren
9395
- Text.Repository.FilterCommits
9496
- Text.Repository.FilterCommits.Default
@@ -104,7 +106,7 @@
104106

105107
</details>
106108

107-
### pt_BR.axaml: 96.81%
109+
### pt_BR.axaml: 96.67%
108110

109111

110112
<details>
@@ -128,6 +130,7 @@
128130
- Text.MergeMultiple.CommitChanges
129131
- Text.MergeMultiple.Strategy
130132
- Text.MergeMultiple.Targets
133+
- Text.Preference.General.DateFormat
131134
- Text.Preference.General.ShowChildren
132135
- Text.Repository.FilterCommits
133136
- Text.Repository.Skip

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8.45
1+
2025.01

src/Commands/Blame.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ protected override void OnReadline(string line)
6565
var commit = match.Groups[1].Value;
6666
var author = match.Groups[2].Value;
6767
var timestamp = int.Parse(match.Groups[3].Value);
68-
var when = DateTime.UnixEpoch.AddSeconds(timestamp).ToLocalTime().ToString("yyyy/MM/dd");
68+
var when = DateTime.UnixEpoch.AddSeconds(timestamp).ToLocalTime().ToString(_dateFormat);
6969

7070
var info = new Models.BlameLineInfo()
7171
{
@@ -87,6 +87,7 @@ protected override void OnReadline(string line)
8787

8888
private readonly Models.BlameData _result = new Models.BlameData();
8989
private readonly StringBuilder _content = new StringBuilder();
90+
private readonly string _dateFormat = Models.DateTimeFormat.Actived.DateOnly;
9091
private string _lastSHA = string.Empty;
9192
private bool _needUnifyCommitSHA = false;
9293
private int _minSHALen = 64;

src/Commands/ExecuteCustomAction.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,16 @@ public static void Run(string repo, string file, string args, Action<string> out
5353
proc.BeginOutputReadLine();
5454
proc.BeginErrorReadLine();
5555
proc.WaitForExit();
56+
57+
var exitCode = proc.ExitCode;
58+
if (exitCode != 0)
59+
{
60+
var errMsg = builder.ToString();
61+
Dispatcher.UIThread.Invoke(() =>
62+
{
63+
App.RaiseException(repo, errMsg);
64+
});
65+
}
5666
}
5767
catch (Exception e)
5868
{
@@ -62,17 +72,7 @@ public static void Run(string repo, string file, string args, Action<string> out
6272
});
6373
}
6474

65-
var exitCode = proc.ExitCode;
6675
proc.Close();
67-
68-
if (exitCode != 0)
69-
{
70-
var errMsg = builder.ToString();
71-
Dispatcher.UIThread.Invoke(() =>
72-
{
73-
App.RaiseException(repo, errMsg);
74-
});
75-
}
7676
}
7777
}
7878
}

src/Models/Commit.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ public static double OpacityForNotMerged
3131
public List<Decorator> Decorators { get; set; } = new List<Decorator>();
3232
public bool HasDecorators => Decorators.Count > 0;
3333

34-
public string AuthorTimeStr => DateTime.UnixEpoch.AddSeconds(AuthorTime).ToLocalTime().ToString("yyyy/MM/dd HH:mm:ss");
35-
public string CommitterTimeStr => DateTime.UnixEpoch.AddSeconds(CommitterTime).ToLocalTime().ToString("yyyy/MM/dd HH:mm:ss");
36-
public string AuthorTimeShortStr => DateTime.UnixEpoch.AddSeconds(AuthorTime).ToLocalTime().ToString("yyyy/MM/dd");
34+
public string AuthorTimeStr => DateTime.UnixEpoch.AddSeconds(AuthorTime).ToLocalTime().ToString(DateTimeFormat.Actived.DateTime);
35+
public string CommitterTimeStr => DateTime.UnixEpoch.AddSeconds(CommitterTime).ToLocalTime().ToString(DateTimeFormat.Actived.DateTime);
36+
public string AuthorTimeShortStr => DateTime.UnixEpoch.AddSeconds(AuthorTime).ToLocalTime().ToString(DateTimeFormat.Actived.DateOnly);
3737

3838
public bool IsMerged { get; set; } = false;
3939
public bool IsCommitterVisible => !Author.Equals(Committer) || AuthorTime != CommitterTime;

src/Models/DateTimeFormat.cs

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
using System;
2+
using System.Collections.Generic;
3+
4+
namespace SourceGit.Models
5+
{
6+
public class DateTimeFormat
7+
{
8+
public string DateOnly { get; set; }
9+
public string DateTime { get; set; }
10+
11+
public string Example
12+
{
13+
get => _example.ToString(DateTime);
14+
}
15+
16+
public DateTimeFormat(string dateOnly, string dateTime)
17+
{
18+
DateOnly = dateOnly;
19+
DateTime = dateTime;
20+
}
21+
22+
public static int ActiveIndex
23+
{
24+
get;
25+
set;
26+
} = 0;
27+
28+
public static DateTimeFormat Actived
29+
{
30+
get => Supported[ActiveIndex];
31+
}
32+
33+
public static readonly List<DateTimeFormat> Supported = new List<DateTimeFormat>
34+
{
35+
new DateTimeFormat("yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss"),
36+
new DateTimeFormat("yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss"),
37+
new DateTimeFormat("yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss"),
38+
new DateTimeFormat("MM/dd/yyyy", "MM/dd/yyyy HH:mm:ss"),
39+
new DateTimeFormat("MM.dd.yyyy", "MM.dd.yyyy HH:mm:ss"),
40+
new DateTimeFormat("MM-dd-yyyy", "MM-dd-yyyy HH:mm:ss"),
41+
new DateTimeFormat("dd/MM/yyyy", "dd/MM/yyyy HH:mm:ss"),
42+
new DateTimeFormat("dd.MM.yyyy", "dd.MM.yyyy HH:mm:ss"),
43+
new DateTimeFormat("dd-MM-yyyy", "dd-MM-yyyy HH:mm:ss"),
44+
new DateTimeFormat("MMM d yyyy", "MMM d yyyy HH:mm:ss"),
45+
new DateTimeFormat("d MMM yyyy", "d MMM yyyy HH:mm:ss"),
46+
};
47+
48+
private static readonly DateTime _example = new DateTime(2025, 1, 31, 8, 0, 0, DateTimeKind.Local);
49+
}
50+
}

src/Models/Stash.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ public class Stash
99
public ulong Time { get; set; } = 0;
1010
public string Message { get; set; } = "";
1111

12-
public string TimeStr => DateTime.UnixEpoch.AddSeconds(Time).ToLocalTime().ToString("yyyy/MM/dd HH:mm:ss");
12+
public string TimeStr => DateTime.UnixEpoch.AddSeconds(Time).ToLocalTime().ToString(DateTimeFormat.Actived.DateTime);
1313
}
1414
}

src/Native/MacOS.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@ public void SetupApp(AppBuilder builder)
2525

2626
public string FindGitExecutable()
2727
{
28-
return File.Exists("/usr/bin/git") ? "/usr/bin/git" : string.Empty;
28+
var gitPathVariants = new List<string>() {
29+
"/usr/bin/git", "/usr/local/bin/git", "/opt/homebrew/bin/git", "/opt/homebrew/opt/git/bin/git"
30+
};
31+
foreach (var path in gitPathVariants)
32+
if (File.Exists(path)) return path;
33+
return string.Empty;
2934
}
3035

3136
public string FindTerminal(Models.ShellOrTerminal shell)

src/Native/OS.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3-
#if ENABLE_PORTABLE
43
using System.Diagnostics;
5-
#endif
64
using System.IO;
75

86
using Avalonia;
@@ -58,16 +56,17 @@ public static void SetupApp(AppBuilder builder)
5856

5957
public static void SetupDataDir()
6058
{
61-
#if ENABLE_PORTABLE
6259
if (OperatingSystem.IsWindows())
6360
{
6461
var execFile = Process.GetCurrentProcess().MainModule!.FileName;
65-
DataDir = Path.Combine(Path.GetDirectoryName(execFile), "data");
66-
if (!Directory.Exists(DataDir))
67-
Directory.CreateDirectory(DataDir);
68-
return;
62+
var portableDir = Path.Combine(Path.GetDirectoryName(execFile), "data");
63+
if (Directory.Exists(portableDir))
64+
{
65+
DataDir = portableDir;
66+
return;
67+
}
6968
}
70-
#endif
69+
7170
var osAppDataDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
7271
if (string.IsNullOrEmpty(osAppDataDir))
7372
DataDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".sourcegit");

src/Resources/Locales/en_US.axaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,7 @@
465465
<x:String x:Key="Text.Preference.DiffMerge.Type" xml:space="preserve">Tool</x:String>
466466
<x:String x:Key="Text.Preference.General" xml:space="preserve">GENERAL</x:String>
467467
<x:String x:Key="Text.Preference.General.Check4UpdatesOnStartup" xml:space="preserve">Check for updates on startup</x:String>
468+
<x:String x:Key="Text.Preference.General.DateFormat" xml:space="preserve">Date Format</x:String>
468469
<x:String x:Key="Text.Preference.General.Locale" xml:space="preserve">Language</x:String>
469470
<x:String x:Key="Text.Preference.General.MaxHistoryCommits" xml:space="preserve">History Commits</x:String>
470471
<x:String x:Key="Text.Preference.General.ShowAuthorTime" xml:space="preserve">Show author time instead of commit time in graph</x:String>

0 commit comments

Comments
 (0)