#2965·yay

当存在本地提交时,会显示错误的差异

作者: radon-at-beeper创建于 2026年8月10日更新于 2026年8月12日
标签Type: BugStatus: Triage

Affected Version

yay v13.0.1.r37.g328f4b49 - libalpm v16.0.1

Describe the bug

When there is an additional local commit to a pkgbuild directory, and you upgrade the package using yay -S, then the local commit is maintained, but if you ask for the PKGBUILD diff, an incorrect diff is shown. The diff shows the additional local commit being reverted, even though that doesn't happen.

Reproduction Steps

As an example, I use https://aur.archlinux.org/packages/kotlin-language-server-git, which I have committed some additional changes on top of origin/master:

diff
* commit 537cfe5b1bc998fb2e7ad6c1d919d9dbcaa17479 (HEAD -> master)
| Author: Radon Rosborough <[email protected]>
| Date:   Wed Mar 11 09:31:20 2026 -0700
| 
|     Switch to fork
| 
| diff --git a/PKGBUILD b/PKGBUILD
| index f668a3c..72c9d15 100644
| --- a/PKGBUILD
| +++ b/PKGBUILD
| @@ -6,12 +6,12 @@ pkgver=r1444.80fc538
|  pkgrel=1
|  pkgdesc="Smart code completion, diagnostics and more for Kotlin using the Language Server Protocol"
|  arch=(any)
| -url="https://GitHub.com/fwcd/kotlin-language-server.git"
| +url="https://codeberg.org/winlogon/kotlin-language-server.git"
|  license=('MIT')
|  conflicts=('kotlin-language-server')
|  provides=('kotlin-language-server')
| -depends=('java-runtime=11')
| -makedepends=('java-environment=11' 'git')
| +depends=('java-runtime')
| +makedepends=('java-environment' 'git')
|  source=("${_pkgname}::git+${url}")
|  sha256sums=('SKIP')
| 
| @@ -23,8 +23,6 @@ pkgver() {
|  }
| 
|  build() {
| -    jdk="$(find /usr/lib/jvm -maxdepth 1 -name "*11*jdk" | head -1)" &&
| -      test -n "$jdk" && export JAVA_HOME="$jdk"
|      cd "${srcdir}/${_pkgname}"
|      ./gradlew server:installDist
|  }
| @@ -40,4 +38,3 @@ package() {
|        "${pkgdir}/usr/share/kotlin/kotlin-language-server/bin/kotlin-language-server" \
|        "${pkgdir}/usr/bin/kotlin-language-server"
|  }
| -
| 
* commit 9d91c5adeff762df05c64b4b1de378e7eae8d79d (origin/master, origin/HEAD)
| Author: Grim Kriegor <[email protected]>
| Date:   Wed Nov 15 22:29:04 2023 +0000
| 
|     Update upstream URL
Now I run `yay -Sa kotlin-language-server-git`, and answer yes when asked if I want to view the PKGBUILD diff:
  1 kotlin-language-server-git               (Installed) (Build Files Exist)
==> Diffs to show?
==> [N]one [A]ll [Ab]ort [I]nstalled [No]tInstalled or (1 2 3, 1-3, ^4)
==> a
The following erroneous diff is shown:
```diff
:: Showing diff for kotlin-language-server-git
diff --git /home/radon/.cache/yay/kotlin-language-server-git/PKGBUILD /home/radon/.cache/yay/kotlin-language-server-git/PKGBUILD
new file mode 100644
index 72c9d15..f668a3c 100644
--- /home/radon/.cache/yay/kotlin-language-server-git/PKGBUILD
+++ /home/radon/.cache/yay/kotlin-language-server-git/PKGBUILD
@@ -6,12 +6,12 @@ pkgver=r1444.80fc538
 pkgrel=1
 pkgdesc="Smart code completion, diagnostics and more for Kotlin using the Language Server Protocol"
 arch=(any)
…