Skip to content

Commit cead681

Browse files
committed
Merge branch 'release/8.27'
2 parents f3d56ff + e9d79f0 commit cead681

File tree

104 files changed

+3208
-1858
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+3208
-1858
lines changed

.github/workflows/build.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Build
2+
on:
3+
workflow_call:
4+
jobs:
5+
build:
6+
strategy:
7+
matrix:
8+
include:
9+
- name : Windows x64
10+
os: windows-2019
11+
runtime: win-x64
12+
- name : Windows ARM64
13+
os: windows-2019
14+
runtime: win-arm64
15+
- name : macOS (Intel)
16+
os: macos-13
17+
runtime: osx-x64
18+
- name : macOS (Apple Silicon)
19+
os: macos-latest
20+
runtime: osx-arm64
21+
- name : Linux
22+
os: ubuntu-20.04
23+
runtime: linux-x64
24+
- name : Linux (arm64)
25+
os: ubuntu-20.04
26+
runtime: linux-arm64
27+
name: Build ${{ matrix.name }}
28+
runs-on: ${{ matrix.os }}
29+
steps:
30+
- name: Checkout sources
31+
uses: actions/checkout@v4
32+
- name: Setup .NET
33+
uses: actions/setup-dotnet@v4
34+
with:
35+
dotnet-version: 8.0.x
36+
- name: Configure arm64 packages
37+
if: ${{ matrix.runtime == 'linux-arm64' }}
38+
run: |
39+
sudo dpkg --add-architecture arm64
40+
echo 'deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ focal main restricted
41+
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ focal-updates main restricted
42+
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ focal-backports main restricted' \
43+
| sudo tee /etc/apt/sources.list.d/arm64.list
44+
sudo sed -i -e 's/^deb http/deb [arch=amd64] http/g' /etc/apt/sources.list
45+
sudo sed -i -e 's/^deb mirror/deb [arch=amd64] mirror/g' /etc/apt/sources.list
46+
- name: Install cross-compiling dependencies
47+
if: ${{ matrix.runtime == 'linux-arm64' }}
48+
run: |
49+
sudo apt-get update
50+
sudo apt-get install clang llvm gcc-aarch64-linux-gnu zlib1g-dev:arm64
51+
- name: Build
52+
run: dotnet build -c Release
53+
- name: Publish
54+
run: dotnet publish src/SourceGit.csproj -c Release -o publish -r ${{ matrix.runtime }}
55+
- name: Rename executable file
56+
if: ${{ startsWith(matrix.runtime, 'linux-') }}
57+
run: mv publish/SourceGit publish/sourcegit
58+
- name: Tar artifact
59+
if: ${{ startsWith(matrix.runtime, 'linux-') || startsWith(matrix.runtime, 'osx-') }}
60+
run: |
61+
tar -cvf "sourcegit.${{ matrix.runtime }}.tar" -C publish .
62+
rm -r publish/*
63+
mv "sourcegit.${{ matrix.runtime }}.tar" publish
64+
- name: Upload artifact
65+
uses: actions/upload-artifact@v4
66+
with:
67+
name: sourcegit.${{ matrix.runtime }}
68+
path: publish/*

.github/workflows/ci.yml

Lines changed: 16 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -8,66 +8,22 @@ on:
88
workflow_call:
99
jobs:
1010
build:
11-
strategy:
12-
matrix:
13-
include:
14-
- name : Windows x64
15-
os: windows-2019
16-
runtime: win-x64
17-
- name : Windows ARM64
18-
os: windows-2019
19-
runtime: win-arm64
20-
- name : macOS (Intel)
21-
os: macos-13
22-
runtime: osx-x64
23-
- name : macOS (Apple Silicon)
24-
os: macos-latest
25-
runtime: osx-arm64
26-
- name : Linux
27-
os: ubuntu-20.04
28-
runtime: linux-x64
29-
- name : Linux (arm64)
30-
os: ubuntu-20.04
31-
runtime: linux-arm64
32-
name: Build ${{ matrix.name }}
33-
runs-on: ${{ matrix.os }}
11+
name: Build
12+
uses: ./.github/workflows/build.yml
13+
version:
14+
name: Prepare version string
15+
runs-on: ubuntu-latest
16+
outputs:
17+
version: ${{ steps.version.outputs.version }}
3418
steps:
3519
- name: Checkout sources
3620
uses: actions/checkout@v4
37-
- name: Setup .NET
38-
uses: actions/setup-dotnet@v4
39-
with:
40-
dotnet-version: 8.0.x
41-
- name: Configure arm64 packages
42-
if: ${{ matrix.runtime == 'linux-arm64' }}
43-
run: |
44-
sudo dpkg --add-architecture arm64
45-
echo 'deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ focal main restricted
46-
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ focal-updates main restricted
47-
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ focal-backports main restricted' \
48-
| sudo tee /etc/apt/sources.list.d/arm64.list
49-
sudo sed -i -e 's/^deb http/deb [arch=amd64] http/g' /etc/apt/sources.list
50-
sudo sed -i -e 's/^deb mirror/deb [arch=amd64] mirror/g' /etc/apt/sources.list
51-
- name: Install cross-compiling dependencies
52-
if: ${{ matrix.runtime == 'linux-arm64' }}
53-
run: |
54-
sudo apt-get update
55-
sudo apt-get install clang llvm gcc-aarch64-linux-gnu zlib1g-dev:arm64
56-
- name: Build
57-
run: dotnet build -c Release
58-
- name: Publish
59-
run: dotnet publish src/SourceGit.csproj -c Release -o publish -r ${{ matrix.runtime }}
60-
- name: Rename executable file
61-
if: ${{ startsWith(matrix.runtime, 'linux-') }}
62-
run: mv publish/SourceGit publish/sourcegit
63-
- name: Tar artifact
64-
if: ${{ startsWith(matrix.runtime, 'linux-') }}
65-
run: |
66-
tar -cvf "sourcegit.${{ matrix.runtime }}.tar" -C publish .
67-
rm -r publish/*
68-
mv "sourcegit.${{ matrix.runtime }}.tar" publish
69-
- name: Upload artifact
70-
uses: actions/upload-artifact@v4
71-
with:
72-
name: sourcegit.${{ matrix.runtime }}
73-
path: publish
21+
- name: Output version string
22+
id: version
23+
run: echo "version=$(cat VERSION)" >> "$GITHUB_OUTPUT"
24+
package:
25+
needs: [build, version]
26+
name: Package
27+
uses: ./.github/workflows/package.yml
28+
with:
29+
version: ${{ needs.version.outputs.version }}

.github/workflows/package.yml

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,8 @@ on:
77
required: true
88
type: string
99
jobs:
10-
build:
11-
name: Build
12-
uses: ./.github/workflows/ci.yml
1310
windows-portable:
1411
name: Package portable Windows app
15-
needs: build
1612
runs-on: ubuntu-latest
1713
strategy:
1814
matrix:
@@ -35,10 +31,13 @@ jobs:
3531
with:
3632
name: package.${{ matrix.runtime }}
3733
path: build/sourcegit_*.zip
34+
- name: Delete temp artifacts
35+
uses: geekyeggo/delete-artifact@v5
36+
with:
37+
name: sourcegit.${{ matrix.runtime }}
3838
osx-app:
3939
name: Package OSX app
40-
needs: build
41-
runs-on: ubuntu-latest
40+
runs-on: macos-latest
4241
strategy:
4342
matrix:
4443
runtime: [osx-x64, osx-arm64]
@@ -49,20 +48,26 @@ jobs:
4948
uses: actions/download-artifact@v4
5049
with:
5150
name: sourcegit.${{ matrix.runtime }}
52-
path: build/SourceGit
51+
path: build
5352
- name: Package
5453
env:
5554
VERSION: ${{ inputs.version }}
5655
RUNTIME: ${{ matrix.runtime }}
57-
run: ./build/scripts/package.osx-app.sh
56+
run: |
57+
mkdir build/SourceGit
58+
tar -xf "build/sourcegit.${{ matrix.runtime }}.tar" -C build/SourceGit
59+
./build/scripts/package.osx-app.sh
5860
- name: Upload package artifact
5961
uses: actions/upload-artifact@v4
6062
with:
6163
name: package.${{ matrix.runtime }}
6264
path: build/sourcegit_*.zip
65+
- name: Delete temp artifacts
66+
uses: geekyeggo/delete-artifact@v5
67+
with:
68+
name: sourcegit.${{ matrix.runtime }}
6369
linux:
6470
name: Package Linux
65-
needs: build
6671
runs-on: ubuntu-latest
6772
strategy:
6873
matrix:
@@ -96,3 +101,7 @@ jobs:
96101
build/sourcegit-*.AppImage
97102
build/sourcegit_*.deb
98103
build/sourcegit-*.rpm
104+
- name: Delete temp artifacts
105+
uses: geekyeggo/delete-artifact@v5
106+
with:
107+
name: sourcegit.${{ matrix.runtime }}

.github/workflows/release.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
tags:
55
- v*
66
jobs:
7+
build:
8+
name: Build
9+
uses: ./.github/workflows/build.yml
710
version:
811
name: Prepare version string
912
runs-on: ubuntu-latest
@@ -16,13 +19,13 @@ jobs:
1619
TAG: ${{ github.ref_name }}
1720
run: echo "version=${TAG#v}" >> "$GITHUB_OUTPUT"
1821
package:
19-
needs: version
22+
needs: [build, version]
2023
name: Package
2124
uses: ./.github/workflows/package.yml
2225
with:
2326
version: ${{ needs.version.outputs.version }}
2427
release:
25-
needs: [version, package]
28+
needs: [package, version]
2629
name: Release
2730
runs-on: ubuntu-latest
2831
permissions:
@@ -34,7 +37,8 @@ jobs:
3437
env:
3538
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3639
TAG: ${{ github.ref_name }}
37-
run: gh release create "$TAG" -t "Release ${TAG#v}" --notes-from-tag
40+
VERSION: ${{ needs.version.outputs.version }}
41+
run: gh release create "$TAG" -t "Release $VERSION" --notes-from-tag
3842
- name: Download artifacts
3943
uses: actions/download-artifact@v4
4044
with:
@@ -45,5 +49,4 @@ jobs:
4549
env:
4650
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4751
TAG: ${{ github.ref_name }}
48-
VERSION: ${{ needs.version.outputs.version }}
4952
run: gh release upload "$TAG" packages/*

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ For **Linux** users:
8383

8484
* `xdg-open` must be installed to support open native file manager.
8585
* Make sure [git-credential-manager](https://github.com/git-ecosystem/git-credential-manager/releases) is installed on your linux.
86-
* Maybe you need to set environment variable `AVALONIA_SCREEN_SCALE_FACTORS`. See https://github.com/AvaloniaUI/Avalonia/wiki/Configuring-X11-per-monitor-DPI.
8786

8887
## External Tools
8988

@@ -123,7 +122,7 @@ This app supports open repository in external tools listed in the table below.
123122

124123
* Custom
125124

126-
You can find custom themes from [sourcegit-theme](https://github.com/sourcegit-scm/sourcegit-theme.git)
125+
You can find custom themes from [sourcegit-theme](https://github.com/sourcegit-scm/sourcegit-theme.git). And welcome to share your own themes.
127126

128127
## Contributing
129128

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8.26
1+
8.27

build/resources/rpm/SPECS/build.spec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ Summary: Open-source & Free Git Gui Client
55
License: MIT
66
URL: https://sourcegit-scm.github.io/
77
Source: https://github.com/sourcegit-scm/sourcegit/archive/refs/tags/v%_version.tar.gz
8-
Requires: libX11.so.6
9-
Requires: libSM.so.6
8+
Requires: libX11
9+
Requires: libSM
1010

1111
%define _build_id_links none
1212

@@ -19,7 +19,7 @@ mkdir -p %{buildroot}/%{_bindir}
1919
mkdir -p %{buildroot}/usr/share/applications
2020
mkdir -p %{buildroot}/usr/share/icons
2121
cp -f ../../../SourceGit/* %{buildroot}/opt/sourcegit/
22-
ln -sf ../../opt/sourcegit/sourcegit %{buildroot}/%{_bindir}
22+
ln -rsf %{buildroot}/opt/sourcegit/sourcegit %{buildroot}/%{_bindir}
2323
cp -r ../../_common/applications %{buildroot}/%{_datadir}
2424
cp -r ../../_common/icons %{buildroot}/%{_datadir}
2525
chmod 755 -R %{buildroot}/opt/sourcegit

build/scripts/package.linux.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ mkdir -p resources/deb/usr/bin
6060
mkdir -p resources/deb/usr/share/applications
6161
mkdir -p resources/deb/usr/share/icons
6262
cp -f SourceGit/* resources/deb/opt/sourcegit
63-
ln -sf ../../opt/sourcegit/sourcegit resources/deb/usr/bin
63+
ln -rsf resources/deb/opt/sourcegit/sourcegit resources/deb/usr/bin
6464
cp -r resources/_common/applications resources/deb/usr/share
6565
cp -r resources/_common/icons resources/deb/usr/share
6666
sed -i -e "s/^Version:.*/Version: $VERSION/" -e "s/^Architecture:.*/Architecture: $arch/" resources/deb/DEBIAN/control

build/scripts/package.osx-app.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ mkdir -p SourceGit.app/Contents/Resources
1818
mv SourceGit SourceGit.app/Contents/MacOS
1919
cp resources/app/App.icns SourceGit.app/Contents/Resources/App.icns
2020
sed "s/SOURCE_GIT_VERSION/$VERSION/g" resources/app/App.plist > SourceGit.app/Contents/Info.plist
21+
rm -rf SourceGit.app/Contents/MacOS/SourceGit.dsym
2122

22-
zip "sourcegit_$VERSION.$RUNTIME.zip" -r SourceGit.app -x "*/*\.dsym/*"
23+
zip "sourcegit_$VERSION.$RUNTIME.zip" -r SourceGit.app

src/App.Commands.cs

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
using System;
2+
using System.Windows.Input;
3+
using Avalonia.Controls;
4+
5+
namespace SourceGit
6+
{
7+
public partial class App
8+
{
9+
public class SimpleCommand : ICommand
10+
{
11+
public event EventHandler CanExecuteChanged
12+
{
13+
add { }
14+
remove { }
15+
}
16+
17+
public SimpleCommand(Action action)
18+
{
19+
_action = action;
20+
}
21+
22+
public bool CanExecute(object parameter) => _action != null;
23+
public void Execute(object parameter) => _action?.Invoke();
24+
25+
private Action _action = null;
26+
}
27+
28+
public class ParameterCommand : ICommand
29+
{
30+
public event EventHandler CanExecuteChanged
31+
{
32+
add { }
33+
remove { }
34+
}
35+
36+
public ParameterCommand(Action<object> action)
37+
{
38+
_action = action;
39+
}
40+
41+
public bool CanExecute(object parameter) => _action != null;
42+
public void Execute(object parameter) => _action?.Invoke(parameter);
43+
44+
private Action<object> _action = null;
45+
}
46+
47+
public static readonly SimpleCommand OpenPreferenceCommand = new SimpleCommand(() => OpenDialog(new Views.Preference()));
48+
public static readonly SimpleCommand OpenHotkeysCommand = new SimpleCommand(() => OpenDialog(new Views.Hotkeys()));
49+
public static readonly SimpleCommand OpenAppDataDirCommand = new SimpleCommand(() => Native.OS.OpenInFileManager(Native.OS.DataDir));
50+
public static readonly SimpleCommand OpenAboutCommand = new SimpleCommand(() => OpenDialog(new Views.About()));
51+
public static readonly SimpleCommand CheckForUpdateCommand = new SimpleCommand(() => Check4Update(true));
52+
public static readonly SimpleCommand QuitCommand = new SimpleCommand(() => Quit(0));
53+
54+
public static readonly ParameterCommand CopyTextCommand = new ParameterCommand(param =>
55+
{
56+
if (param is TextBlock textBlock)
57+
{
58+
if (textBlock.Inlines is { Count: > 0 } inlines)
59+
CopyText(inlines.Text);
60+
else
61+
CopyText(textBlock.Text);
62+
}
63+
});
64+
}
65+
}

0 commit comments

Comments
 (0)