admin管理员组文章数量:1125621
I've written a custom diff command for reading a proprietary file type *.hdict, which would otherwise be treated as a binary file to be used in Git Extensions 5.1.1.17970.
.gitconfig:
[diff "hdict"]
command = powershell -ExecutionPolicy Bypass -File C:/Repos/fillhalcon/DictionaryDiff/hdict-diff.ps1 $LOCAL $REMOTE
.gitattributes:
*.hdict diff=hdict
PowerShell script:
Param($LocalFile, $RemoteFile)
# Ensure paths are absolute
$LocalFile = Join-Path -Path (Get-Location) -ChildPath $LocalFile
# Generate temporary files for output
$CleanLocal = [System.IO.Path]::GetTempFileName()
$CleanRemote = [System.IO.Path]::GetTempFileName()
# Path to ConsoleApp2.exe using relative path
$ExePath = Join-Path -Path $PSScriptRoot -ChildPath "DictConversion\DictConversion\bin\Debug\net8.0\DictConversion.exe"
# Run ConsoleApp2.exe ONCE for both files
& $ExePath $LocalFile $RemoteFile $CleanLocal $CleanRemote
# Remove null bytes (^@) from the files
(Get-Content -Raw $CleanLocal) -replace "`0", "" | Set-Content $CleanLocal
(Get-Content -Raw $CleanRemote) -replace "`0", "" | Set-Content $CleanRemote
# Perform the diff using git diff and save output
& git diff --no-index $CleanRemote $CleanLocal
# Clean up temporary files
Remove-Item $CleanLocal
Remove-Item $CleanRemote
Console output from the Git-Extensions works fine:
But any visual interaction is still seeing it as a binary:
Any idea, why GUI is not triggering the same command "git diff"?
本文标签: powershellGitExtensions GUI produces different output as Git consoleStack Overflow
版权声明:本文标题:powershell - Git-Extensions GUI produces different output as Git console - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736634131a1945839.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论