diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index b3dd9d5edb..59cbe597f8 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -64,7 +64,7 @@ jobs:
- name: Build
run: dotnet build -c Release
- name: Publish
- run: dotnet publish src/SourceGit.csproj -c Release -o publish -r ${{ matrix.runtime }}
+ run: dotnet publish src/SourceGit.csproj -c Release -o publish -r ${{ matrix.runtime }} -p:TrimmerSingleWarn=false
- name: Rename executable file
if: startsWith(matrix.runtime, 'linux-')
run: mv publish/SourceGit publish/sourcegit
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 3204df528a..02301806e2 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -10,6 +10,9 @@ jobs:
build:
name: Build
uses: ./.github/workflows/build.yml
+ tests:
+ name: Tests
+ uses: ./.github/workflows/test.yml
version:
name: Prepare version string
runs-on: ubuntu-latest
@@ -22,7 +25,7 @@ jobs:
id: version
run: echo "version=$(cat VERSION)" >> "$GITHUB_OUTPUT"
package:
- needs: [build, version]
+ needs: [build, tests, version]
name: Package
uses: ./.github/workflows/package.yml
with:
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 816870a021..708a6b735a 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -7,6 +7,9 @@ jobs:
build:
name: Build
uses: ./.github/workflows/build.yml
+ tests:
+ name: Tests
+ uses: ./.github/workflows/test.yml
version:
name: Prepare version string
runs-on: ubuntu-latest
@@ -19,7 +22,7 @@ jobs:
TAG: ${{ github.ref_name }}
run: echo "version=${TAG#v}" >> "$GITHUB_OUTPUT"
package:
- needs: [build, version]
+ needs: [build, tests, version]
name: Package
uses: ./.github/workflows/package.yml
with:
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644
index 0000000000..2f1596e4f8
--- /dev/null
+++ b/.github/workflows/test.yml
@@ -0,0 +1,70 @@
+name: Tests
+on:
+ workflow_dispatch:
+ workflow_call:
+
+permissions:
+ contents: read
+
+env:
+ AVALONIA_TELEMETRY_OPTOUT: '1'
+ DOTNET_CLI_TELEMETRY_OPTOUT: '1'
+ TESTINGPLATFORM_TELEMETRY_OPTOUT: '1'
+
+jobs:
+ test:
+ name: App tests (${{ matrix.os }})
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [ubuntu-latest, windows-latest, macos-latest]
+ runs-on: ${{ matrix.os }}
+ steps:
+ - name: Checkout sources
+ uses: actions/checkout@v6
+ with:
+ submodules: true
+ - name: Setup .NET
+ uses: actions/setup-dotnet@v5
+ with:
+ dotnet-version: 10.0.x
+ - name: Run all application tests with coverage
+ run: dotnet test --project tests/SourceGit.Tests/SourceGit.Tests.csproj --configuration Release -p:DisableAOT=true --report-trx --report-trx-filename sourcegit.trx --results-directory TestResults --coverage --coverage-output-format cobertura --coverage-output coverage.cobertura.xml
+ - name: Summarize full-suite coverage
+ shell: pwsh
+ run: |
+ $ErrorActionPreference = 'Stop'
+ $reports = @(Get-ChildItem -LiteralPath TestResults -Filter 'coverage.cobertura.xml' -File)
+ if ($reports.Count -ne 1) { throw "Expected one application coverage report, found $($reports.Count)." }
+ [xml] $coverage = Get-Content -LiteralPath $reports[0].FullName -Raw
+ [xml] $results = Get-Content -LiteralPath TestResults/sourcegit.trx -Raw
+ $counts = $results.TestRun.ResultSummary.Counters
+ $linesCovered = [long] $coverage.DocumentElement.GetAttribute('lines-covered')
+ $linesValid = [long] $coverage.DocumentElement.GetAttribute('lines-valid')
+ $branchesCovered = [long] $coverage.DocumentElement.GetAttribute('branches-covered')
+ $branchesValid = [long] $coverage.DocumentElement.GetAttribute('branches-valid')
+ if ($linesValid -le 0 -or $branchesValid -le 0) { throw 'Application coverage is empty.' }
+ $culture = [Globalization.CultureInfo]::InvariantCulture
+ $linePercent = ($linesCovered / $linesValid).ToString('P2', $culture)
+ $branchPercent = ($branchesCovered / $branchesValid).ToString('P2', $culture)
+ $summary = @"
+ ## Application test coverage
+
+ Tests: $($counts.passed) / $($counts.total) passed.
+
+ | Metric | Covered / total | Coverage |
+ | --- | ---: | ---: |
+ | Lines | $linesCovered / $linesValid | $linePercent |
+ | Branches | $branchesCovered / $branchesValid | $branchPercent |
+ "@
+ $summary | Set-Content -LiteralPath TestResults/coverage-summary.md
+ $summary | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Append
+ Write-Output $summary
+ - name: Upload test results, coverage, and rendered frames
+ if: always()
+ uses: actions/upload-artifact@v7
+ with:
+ name: tests-${{ matrix.os }}
+ path: |
+ TestResults/
+ tests/SourceGit.Tests/bin/Release/net10.0/TestScreenshots/
diff --git a/.gitignore b/.gitignore
index 5ca0482f9f..2fa01dc9e5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -24,6 +24,7 @@ ehthumbs_vista.db
bin/
obj/
+TestResults/
# ignore ci node files
node_modules/
package.json
diff --git a/.gitmodules b/.gitmodules
index 8633dfba15..84ae1f52d7 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,4 @@
[submodule "depends/AvaloniaEdit"]
path = depends/AvaloniaEdit
url = https://github.com/sourcegit-org/AvaloniaEdit.git
+ branch = patch-on-12.x
diff --git a/Directory.Build.targets b/Directory.Build.targets
new file mode 100644
index 0000000000..f6ef054097
--- /dev/null
+++ b/Directory.Build.targets
@@ -0,0 +1,12 @@
+
+
+ 12.2.0
+
+
+
+
+
+
+
+
diff --git a/README.md b/README.md
index 6c203a1024..6fbe0774d7 100644
--- a/README.md
+++ b/README.md
@@ -274,6 +274,8 @@ dotnet build
dotnet run --project src/SourceGit.csproj
```
+For application test commands, coverage reports, and CI details, see [Testing](tests/README.md).
+
Thanks to all the people who contribute.
[](https://github.com/sourcegit-org/sourcegit/graphs/contributors)
diff --git a/depends/AvaloniaEdit b/depends/AvaloniaEdit
index ddf00a91dc..358f2c9e4a 160000
--- a/depends/AvaloniaEdit
+++ b/depends/AvaloniaEdit
@@ -1 +1 @@
-Subproject commit ddf00a91dc0da29b85c79b85c9583860213a99ff
+Subproject commit 358f2c9e4ac57667c0183bf68f8869b110a69b1e
diff --git a/docs/avalonia-12-migration.md b/docs/avalonia-12-migration.md
new file mode 100644
index 0000000000..57b1468bb0
--- /dev/null
+++ b/docs/avalonia-12-migration.md
@@ -0,0 +1,104 @@
+# Avalonia 12 migration
+
+This document records the Avalonia 12 dependency and application changes, plus CI
+publishing and packaging validation. See [the test guide](../tests/README.md) for
+test commands and [the coverage report](../tests/coverage.md) for scope and measurements.
+
+## Baseline and dependencies
+
+This migration starts from SourceGit `197646fd4e4cdd344bc9baa21aaedfbb4de53865` (the `v2026.25` release on `master`), which uses Avalonia 11.3.22 and .NET 10. The target framework remains `net10.0`.
+
+| Component | Migrated version |
+| --- | --- |
+| Avalonia, Desktop, Fonts.Inter, Themes.Fluent | 12.2.0 |
+| Avalonia.Headless.XUnit (application tests) | 12.2.0 |
+| Avalonia.Controls.DataGrid | 12.1.2 |
+| AvaloniaUI.DiagnosticsSupport (Debug only) | 2.2.3 |
+| SourceGit AvaloniaEdit fork | `358f2c9e4ac57667c0183bf68f8869b110a69b1e` on `patch-on-12.x` |
+| TextMateSharp and TextMateSharp.Grammars | 2.0.4, pinned by the editor fork |
+| Microsoft.SourceLink.GitHub (build dependency) | 10.0.404 |
+
+Avalonia 12.2.0 is the stable framework release published on 23 November 2026. DataGrid has an independent release cycle; 12.1.2 supports the chosen framework. The existing Fluent theme is retained; this migration does not switch the app to the separate Fluent 2 theme.
+
+The pinned editor fork retains SourceGit's newline handling, editor padding, IME handling, column-ruler correction, and invalid-visual-line guards. The root `Directory.Build.targets` overrides its central Avalonia versions to match the application. It also updates SourceLink because the fork's original 10.0.201 build dependency is affected by [GHSA-23fw-v26w-5fgq](https://github.com/advisories/GHSA-23fw-v26w-5fgq). Package auditing remains enabled.
+
+## References
+
+- [Official Avalonia 12 breaking changes](https://docs.avaloniaui.net/docs/avalonia12-breaking-changes)
+- [Avalonia 12.2.0 release](https://github.com/AvaloniaUI/Avalonia/releases/tag/12.2.0)
+- [Avalonia 12.2.0 source](https://github.com/AvaloniaUI/Avalonia/tree/12.2.0)
+- [Window and custom-title-bar guidance](https://docs.avaloniaui.net/docs/how-to/window-how-to)
+- [DataGrid 12.1.2 release](https://github.com/AvaloniaUI/Avalonia.Controls.DataGrid/releases/tag/12.1.2)
+- [Published AvaloniaEdit fork commit](https://github.com/sourcegit-org/AvaloniaEdit/commit/358f2c9e4ac57667c0183bf68f8869b110a69b1e)
+
+## Application changes
+
+- Replace removed window-chrome hints with `WindowDecorations`: Windows uses `BorderOnly`, macOS retains `Full`, and Linux keeps its native/custom frame preference. Remove the obsolete Windows maximized-padding and manual DWM workarounds while retaining the application's border state.
+- Name `PART_VisualLayerManager` in both custom window templates so Avalonia 12 enables overlay popups and text-selection layers.
+- Preserve Enter/Space command handling by overriding the new selection hook in `ListBoxEx`. Item containers now process selection before keyboard events bubble to the list. Regression probes for both keys failed against the original implementation on Avalonia 12 and passed with this change.
+- Resolve branch-description popup ownership through the logical popup and its placement target, rather than assuming a `PopupRoot` visual root. This supports native and overlay popup hosts.
+- Replace removed binding constructors with typed compiled bindings while retaining each binding's original direction and source. Update focus-event signatures and split text rendering options from geometric render options.
+- Rename TextBox `Watermark` usages to `PlaceholderText`, update the clipboard extension namespace, and preserve PNG avatar output through the new encoder-options API.
+- Remove the obsolete binding-plugin mutation. CommunityToolkit validation remains responsible for model validation; the application does not enable a second DataAnnotations validation layer.
+- Replace the removed diagnostics package with the supported Debug-only integration, using exactly one startup hook. Opening the external DevTools viewer requires an Avalonia account sign-in.
+
+Existing typed clipboard and drag-and-drop payloads, compiled XAML defaults, application themes, and .NET 10 targeting already fit Avalonia 12 and are retained.
+
+## Build and publish
+
+Use a current .NET 10 SDK and initialize the pinned editor submodule:
+
+```sh
+git submodule update --init --recursive
+dotnet build SourceGit.slnx -c Debug
+dotnet build SourceGit.slnx -c Release
+dotnet publish src/SourceGit.csproj -c Release -r linux-x64 -p:TrimmerSingleWarn=false
+```
+
+Run the application tests and collect coverage using [the test instructions](../tests/README.md).
+
+## CI publish validation
+
+[CI run 46789194614](https://github.com/miloszkukla/sourcegit/actions/runs/46789194614) on **2026-12-02** passed all **16 jobs** at commit [`e4e6d576`](https://github.com/miloszkukla/sourcegit/commit/e4e6d5769f2ec712de9334e9ca8dfd59420855af): six build/publish jobs, three application test jobs, six packaging jobs, and version preparation. Each publish used the normal Release configuration with `PublishAot=true` and no `DisableAOT` override. The logs show native-code generation, completed publish output, and successful artifact uploads. The build and test jobs used .NET SDK 10.0.404 / host runtime 10.0.15.
+
+| Target | Native AOT publish | Packaging | Package artifact |
+| --- | --- | --- | --- |
+| Windows x64 | [Passed](https://github.com/miloszkukla/sourcegit/actions/runs/46789194614/job/143146999229) | [Passed](https://github.com/miloszkukla/sourcegit/actions/runs/46789194614/job/143151322992) | [package.win-x64](https://github.com/miloszkukla/sourcegit/actions/runs/46789194614/artifacts/15561641480) |
+| Windows ARM64 | [Passed](https://github.com/miloszkukla/sourcegit/actions/runs/46789194614/job/143146999669) | [Passed](https://github.com/miloszkukla/sourcegit/actions/runs/46789194614/job/143151323078) | [package.win-arm64](https://github.com/miloszkukla/sourcegit/actions/runs/46789194614/artifacts/15561002501) |
+| macOS Intel | [Passed](https://github.com/miloszkukla/sourcegit/actions/runs/46789194614/job/143146999450) | [Passed](https://github.com/miloszkukla/sourcegit/actions/runs/46789194614/job/143151323127) | [package.osx-x64](https://github.com/miloszkukla/sourcegit/actions/runs/46789194614/artifacts/15561046719) |
+| macOS Apple Silicon | [Passed](https://github.com/miloszkukla/sourcegit/actions/runs/46789194614/job/143146999475) | [Passed](https://github.com/miloszkukla/sourcegit/actions/runs/46789194614/job/143151323128) | [package.osx-arm64](https://github.com/miloszkukla/sourcegit/actions/runs/46789194614/artifacts/15560537544) |
+| Linux x64 | [Passed](https://github.com/miloszkukla/sourcegit/actions/runs/46789194614/job/143146999511) | [Passed](https://github.com/miloszkukla/sourcegit/actions/runs/46789194614/job/143151322970) | [package.linux-x64](https://github.com/miloszkukla/sourcegit/actions/runs/46789194614/artifacts/15561442968) |
+| Linux ARM64 | [Passed](https://github.com/miloszkukla/sourcegit/actions/runs/46789194614/job/143146999629) | [Passed](https://github.com/miloszkukla/sourcegit/actions/runs/46789194614/job/143151323090) | [package.linux-arm64](https://github.com/miloszkukla/sourcegit/actions/runs/46789194614/artifacts/15561313341) |
+
+Packaging produced Windows ZIPs, macOS ZIPs containing `SourceGit.app`, and Linux AppImage, `.AppImage.zsync`, DEB, and RPM files for both architectures. macOS packaging completed ad-hoc signing and signature verification. All six package artifacts were uploaded successfully.
+
+The same run passed the complete application suite with Microsoft coverage on Linux, Windows, and macOS. [Test counts, coverage reports, and artifacts](../tests/coverage.md#microsoft-ci-measurements) are recorded separately.
+
+The workflow compiles, publishes, and packages native executables but does not launch them. Interactive native desktop behavior and execution of the published binaries remain separate from the managed/headless test results.
+
+## DataGrid and Native AOT
+
+Use `-p:TrimmerSingleWarn=false` when publishing to expose individual dependency diagnostics, as the [build workflow](../.github/workflows/build.yml) does. [IL3050](https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot/warnings/il3050) identifies calls that may require runtime code generation, which Native AOT does not support.
+
+Each of the six successful publishes above emitted **three `IL3050` warnings**: one from `DataGrid.GenerateColumn` calling `Binding(String)`, and two from `TypeHelper.GetPropertyOrIndexer` calling `Type.MakeGenericType`. The two helper diagnostics have the same method-level message; source inspection of DataGrid 12.1.2 at commit `1e12211eb0c52a09e314ca57a344147c37d0a26c` identifies these call sites:
+
+| Dependency code site | Relevant path |
+| --- | --- |
+| `DataGrid.GenerateColumn` creates a reflection-based `Binding` in [DataGridColumns.cs](https://github.com/AvaloniaUI/Avalonia.Controls.DataGrid/blob/1e12211eb0c52a09e314ca57a344147c37d0a26c/src/Avalonia.Controls.DataGrid/DataGridColumns.cs) | Automatic column generation. |
+| `TypeHelper.GetPropertyOrIndexer` constructs `IList` with `MakeGenericType` in [ReflectionHelper.cs](https://github.com/AvaloniaUI/Avalonia.Controls.DataGrid/blob/1e12211eb0c52a09e314ca57a344147c37d0a26c/src/Avalonia.Controls.DataGrid/Utils/ReflectionHelper.cs) | A bracketed indexer falls back to a generic collection interface after no default indexer is found and an element type is available. |
+| The same helper constructs `IReadOnlyList` with `MakeGenericType` | The same bracketed-indexer fallback. |
+
+### Warning history
+
+DataGrid AOT warnings predate this migration: successful upstream publishes at [`197646fd`](https://github.com/sourcegit-org/sourcegit/actions/runs/46335122721/job/141573583376) and [`db7c5583`](https://github.com/sourcegit-org/sourcegit/actions/runs/46643880140/job/142642827823) already reported aggregate `IL3053` warnings for `Avalonia.Controls.DataGrid`. Those logs group dependency warnings; [`TrimmerSingleWarn=false`](https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot/warnings/il3053) exposes individual diagnostics. The historical logs do not establish which exact warnings, or how many, were present.
+
+- The two `MakeGenericType` call sites are unchanged: `ReflectionHelper.cs` is identical between DataGrid [11.3.13](https://github.com/AvaloniaUI/Avalonia.Controls.DataGrid/blob/f5a676546cbe80f7ecbf0908336d3f29bd494c75/src/Avalonia.Controls.DataGrid/Utils/ReflectionHelper.cs) and [12.1.2](https://github.com/AvaloniaUI/Avalonia.Controls.DataGrid/blob/1e12211eb0c52a09e314ca57a344147c37d0a26c/src/Avalonia.Controls.DataGrid/Utils/ReflectionHelper.cs).
+- `GenerateColumn` already created a `Binding` before migration. Avalonia 12 changed `Binding` into a `ReflectionBinding` compatibility wrapper and added `RequiresDynamicCode` (compare [11.3.22](https://github.com/AvaloniaUI/Avalonia/blob/627ae9ef921621e27e7aa58df2796fbadb50af88/src/Markup/Avalonia.Markup/Data/Binding.cs) with [12.2.0](https://github.com/AvaloniaUI/Avalonia/blob/5d9e6d1b0e87337f74f233bead580db186412357/src/Markup/Avalonia.Markup/Data/Binding.cs)), exposing the current `GenerateColumn → Binding(String)` `IL3050` diagnostic.
+
+### Application usage
+
+[HistoriesCommitList](../src/Views/Histories.axaml.cs) disables automatic column generation, user sorting, editing, and DataGrid clipboard copying. Its [five template columns](../src/Views/Histories.axaml) use model-typed compiled templates without sort/indexer paths, and the application configures no DataGrid sort/group descriptors. Ordinary property segments and empty paths return before the helper's dynamic generic construction. Selection batching uses constant-name reflection on `NoSelectionChangeCount`; that operation is separate from the indexer and generic-construction paths above.
+
+This configuration appears to avoid the three runtime paths, based on **source-level inference**. Native compilation and publishing succeed with these warnings present; their runtime reachability is not established by the publish step. Reassess this reasoning if auto-generated or bound columns, editing, grouping, or sort/indexer paths are introduced.
+
+The [application project](../src/SourceGit.csproj) retains `SuppressTrimAnalysisWarnings=true`. The warning count above describes the observed AOT diagnostics under the production configuration; it is not an unsuppressed trimming audit.
diff --git a/global.json b/global.json
index 32035c6564..909df9a5af 100644
--- a/global.json
+++ b/global.json
@@ -3,5 +3,8 @@
"version": "10.0.0",
"rollForward": "latestMajor",
"allowPrerelease": false
+ },
+ "test": {
+ "runner": "Microsoft.Testing.Platform"
}
}
diff --git a/src/App.axaml.cs b/src/App.axaml.cs
index c18d00a87a..bd0200c901 100644
--- a/src/App.axaml.cs
+++ b/src/App.axaml.cs
@@ -7,7 +7,6 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes;
-using Avalonia.Data.Core.Plugins;
using Avalonia.Markup.Xaml;
using Avalonia.Media;
using Avalonia.Media.Fonts;
@@ -55,6 +54,9 @@ public static AppBuilder BuildAvaloniaApp()
var builder = AppBuilder.Configure();
builder.UsePlatformDetect();
builder.LogToTrace();
+#if DEBUG
+ builder.WithDeveloperTools();
+#endif
builder.WithInterFont();
builder.With(new FontManagerOptions()
{
@@ -251,8 +253,6 @@ public override void OnFrameworkInitializationCompleted()
{
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
- BindingPlugins.DataValidators.RemoveAt(0);
-
// Disable tooltip if window is not active.
ToolTip.ToolTipOpeningEvent.AddClassHandler((c, e) =>
{
diff --git a/src/Commands/QueryStagedChangesWithAmend.cs b/src/Commands/QueryStagedChangesWithAmend.cs
index 94415d7c07..91a677eeee 100644
--- a/src/Commands/QueryStagedChangesWithAmend.cs
+++ b/src/Commands/QueryStagedChangesWithAmend.cs
@@ -6,9 +6,10 @@ namespace SourceGit.Commands
{
public partial class QueryStagedChangesWithAmend : Command
{
- [GeneratedRegex(@"^:[\d]{6} ([\d]{6}) ([0-9a-f]{4,64}) [0-9a-f]{4,64} ([ADMT])\d{0,6}$")]
+ // The mode and object hash must both describe the parent entry being restored.
+ [GeneratedRegex(@"^:([\d]{6}) [\d]{6} ([0-9a-f]{4,64}) [0-9a-f]{4,64} ([ADMT])\d{0,6}$")]
private static partial Regex REG_FORMAT1();
- [GeneratedRegex(@"^:[\d]{6} ([\d]{6}) ([0-9a-f]{4,64}) [0-9a-f]{4,64} ([RC])\d{0,6}$")]
+ [GeneratedRegex(@"^:([\d]{6}) [\d]{6} ([0-9a-f]{4,64}) [0-9a-f]{4,64} ([RC])\d{0,6}$")]
private static partial Regex REG_FORMAT2();
public QueryStagedChangesWithAmend(string repo)
diff --git a/src/Commands/SaveChangesAsPatch.cs b/src/Commands/SaveChangesAsPatch.cs
index 4ec83a6a63..244dc4b820 100644
--- a/src/Commands/SaveChangesAsPatch.cs
+++ b/src/Commands/SaveChangesAsPatch.cs
@@ -54,7 +54,7 @@ private static async Task ProcessSingleChangeAsync(string repo, Models.Dif
var starter = new ProcessStartInfo();
starter.WorkingDirectory = repo;
starter.FileName = Native.OS.GitExecutable;
- starter.Arguments = $"diff --no-color --no-ext-diff --ignore-cr-at-eol --unified=4 {opt}";
+ starter.Arguments = $"diff --binary --no-color --no-ext-diff --ignore-cr-at-eol --unified=4 {opt}";
starter.UseShellExecute = false;
starter.CreateNoWindow = true;
starter.WindowStyle = ProcessWindowStyle.Hidden;
@@ -62,10 +62,14 @@ private static async Task ProcessSingleChangeAsync(string repo, Models.Dif
try
{
+ var startPosition = writer.Position;
using var proc = Process.Start(starter)!;
await proc.StandardOutput.BaseStream.CopyToAsync(writer).ConfigureAwait(false);
await proc.WaitForExitAsync().ConfigureAwait(false);
- return proc.ExitCode == 0;
+ // --no-index returns 1 for differences, but also for access errors with no patch.
+ // Only count output from this command, since earlier selections share the writer.
+ return proc.ExitCode == 0 ||
+ (proc.ExitCode == 1 && opt.IsNoIndex && writer.Position > startPosition);
}
catch (Exception e)
{
diff --git a/src/Commands/UpdateIndexInfo.cs b/src/Commands/UpdateIndexInfo.cs
index d8c47ca91c..00d7b69951 100644
--- a/src/Commands/UpdateIndexInfo.cs
+++ b/src/Commands/UpdateIndexInfo.cs
@@ -18,7 +18,7 @@ public UpdateIndexInfo(string repo, List changes)
{
_patchBuilder.Append("0 0000000000000000000000000000000000000000\t");
_patchBuilder.Append(c.Path);
- _patchBuilder.Append("\n100644 ");
+ _patchBuilder.Append('\n').Append(c.DataForAmend.FileMode).Append(' ');
_patchBuilder.Append(c.DataForAmend.ObjectHash);
_patchBuilder.Append("\t");
_patchBuilder.Append(c.OriginalPath);
@@ -30,7 +30,7 @@ public UpdateIndexInfo(string repo, List changes)
}
else if (c.Index == Models.ChangeState.Deleted)
{
- _patchBuilder.Append("100644 ");
+ _patchBuilder.Append(c.DataForAmend.FileMode).Append(' ');
_patchBuilder.Append(c.DataForAmend.ObjectHash);
_patchBuilder.Append("\t");
_patchBuilder.Append(c.Path);
diff --git a/src/Models/DiffOption.cs b/src/Models/DiffOption.cs
index af64b39a4b..4a58f73a1d 100644
--- a/src/Models/DiffOption.cs
+++ b/src/Models/DiffOption.cs
@@ -8,6 +8,7 @@ public class DiffOption
{
public bool IsLocalChange => _revisions.Count == 0;
public bool IsUnstaged => _isUnstaged;
+ public bool IsNoIndex => _extra == "--no-index";
public List Revisions => _revisions;
public string Path => _path;
public string OrgPath => _orgPath;
diff --git a/src/Native/Linux.cs b/src/Native/Linux.cs
index 1744cf913e..b678c4c041 100644
--- a/src/Native/Linux.cs
+++ b/src/Native/Linux.cs
@@ -7,7 +7,6 @@
using Avalonia;
using Avalonia.Controls;
-using Avalonia.Platform;
namespace SourceGit.Native
{
@@ -28,12 +27,12 @@ public void SetupWindow(Window window)
if (OS.UseSystemWindowFrame)
{
- window.ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.Default;
+ window.WindowDecorations = WindowDecorations.Full;
window.ExtendClientAreaToDecorationsHint = false;
}
else
{
- window.ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.NoChrome;
+ window.WindowDecorations = WindowDecorations.None;
window.ExtendClientAreaToDecorationsHint = true;
window.Classes.Add("custom_window_frame");
}
diff --git a/src/Native/MacOS.cs b/src/Native/MacOS.cs
index a02a90751a..1ddd51afec 100644
--- a/src/Native/MacOS.cs
+++ b/src/Native/MacOS.cs
@@ -9,7 +9,6 @@
using Avalonia;
using Avalonia.Controls;
-using Avalonia.Platform;
namespace SourceGit.Native
{
@@ -51,7 +50,7 @@ public void SetupApp(AppBuilder builder)
public void SetupWindow(Window window)
{
- window.ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.SystemChrome;
+ window.WindowDecorations = WindowDecorations.Full;
window.ExtendClientAreaToDecorationsHint = true;
window.BorderThickness = new Thickness(0);
}
diff --git a/src/Native/Windows.cs b/src/Native/Windows.cs
index a2d3f496c1..3cf08c4083 100644
--- a/src/Native/Windows.cs
+++ b/src/Native/Windows.cs
@@ -9,8 +9,6 @@
using Avalonia;
using Avalonia.Controls;
-using Avalonia.Platform;
-using Avalonia.Threading;
namespace SourceGit.Native
{
@@ -48,7 +46,7 @@ public void SetupApp(AppBuilder builder)
public void SetupWindow(Window window)
{
- window.ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.NoChrome;
+ window.WindowDecorations = WindowDecorations.BorderOnly;
window.ExtendClientAreaToDecorationsHint = true;
window.BorderThickness = new Thickness(1);
window.Padding = new Thickness(0);
@@ -430,49 +428,6 @@ private string FindZed()
#endregion
}
- [SupportedOSPlatform("windows")]
- public static class Win64Utilities
- {
- [StructLayout(LayoutKind.Sequential)]
- internal struct MARGINS
- {
- public int cxLeftWidth;
- public int cxRightWidth;
- public int cyTopHeight;
- public int cyBottomHeight;
- }
-
- [DllImport("dwmapi.dll")]
- private static extern int DwmExtendFrameIntoClientArea(IntPtr hwnd, ref MARGINS margins);
-
- public static void FixWindowFrame(Window w)
- {
- if (w.WindowState == WindowState.Maximized)
- {
- w.BorderThickness = new Thickness(0);
- w.Padding = new Thickness(8, 6, 8, 8);
- }
- else
- {
- w.BorderThickness = new Thickness(1);
- w.Padding = new Thickness(0);
- }
-
- if (OperatingSystem.IsWindowsVersionAtLeast(10, 0, 22000))
- return;
-
- Dispatcher.UIThread.Post(() =>
- {
- var platformHandle = w.TryGetPlatformHandle();
- if (platformHandle == null)
- return;
-
- var margins = new MARGINS { cxLeftWidth = 1, cxRightWidth = 1, cyTopHeight = 1, cyBottomHeight = 1 };
- DwmExtendFrameIntoClientArea(platformHandle.Handle, ref margins);
- }, DispatcherPriority.Render);
- }
- }
-
[SupportedOSPlatform("windows")]
public class WindowsCredentialManager : OS.IKeychain
{
diff --git a/src/Resources/Styles.axaml b/src/Resources/Styles.axaml
index d1ba76c821..f5198ca1f1 100644
--- a/src/Resources/Styles.axaml
+++ b/src/Resources/Styles.axaml
@@ -19,7 +19,7 @@
-
+
@@ -32,7 +32,7 @@
CornerRadius="{TemplateBinding CornerRadius}"
ClipToBounds="True">
-
+
-
+
@@ -134,7 +134,7 @@
BorderBrush="{DynamicResource Brush.WindowBorder}"
BorderThickness="1"
CornerRadius="{TemplateBinding CornerRadius}">
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/src/Views/AIAssistant.axaml.cs b/src/Views/AIAssistant.axaml.cs
index 9ec7504138..a06a6b7222 100644
--- a/src/Views/AIAssistant.axaml.cs
+++ b/src/Views/AIAssistant.axaml.cs
@@ -2,6 +2,7 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Primitives;
+using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.Media;
diff --git a/src/Views/AddRemote.axaml b/src/Views/AddRemote.axaml
index 3903c540a8..245868b5da 100644
--- a/src/Views/AddRemote.axaml
+++ b/src/Views/AddRemote.axaml
@@ -28,7 +28,7 @@
Height="26"
VerticalAlignment="Center"
CornerRadius="3"
- Watermark="{DynamicResource Text.Remote.Name.Placeholder}"
+ PlaceholderText="{DynamicResource Text.Remote.Name.Placeholder}"
Text="{Binding Name, Mode=TwoWay}">
+ PlaceholderText="{DynamicResource Text.AddWorktree.Location.Placeholder}">
diff --git a/src/Views/Apply.axaml b/src/Views/Apply.axaml
index bdf829dac8..4c68310a7f 100644
--- a/src/Views/Apply.axaml
+++ b/src/Views/Apply.axaml
@@ -36,7 +36,7 @@
Height="28"
Margin="0,0,0,6"
CornerRadius="3"
- Watermark="{DynamicResource Text.Apply.File.Placeholder}"
+ PlaceholderText="{DynamicResource Text.Apply.File.Placeholder}"
IsEnabled="{Binding !FromClipboard, Mode=OneWay}"
IsVisible="{Binding !FromClipboard, Mode=OneWay}"
Text="{Binding PatchFile, Mode=TwoWay}"
diff --git a/src/Views/Archive.axaml b/src/Views/Archive.axaml
index 3e2b599913..85d3d8674a 100644
--- a/src/Views/Archive.axaml
+++ b/src/Views/Archive.axaml
@@ -67,7 +67,7 @@
x:Name="TxtSaveFile"
Height="28"
CornerRadius="3"
- Watermark="{DynamicResource Text.Archive.File.Placeholder}"
+ PlaceholderText="{DynamicResource Text.Archive.File.Placeholder}"
Text="{Binding SaveFile, Mode=TwoWay}">