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:
* commit 537cfe5b1bc998fb2e7ad6c1d919d9dbcaa17479 (HEAD -> master)
| Author: Radon Rosborough <radon@beeper.com>
| 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 <grim@kriegor.net>
| 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:
:: 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)
-url="https://codeberg.org/winlogon/kotlin-language-server.git"
+url="https://github.com/fwcd/kotlin-language-server.git"
license=('MIT')
conflicts=('kotlin-language-server')
provides=('kotlin-language-server')
-depends=('java-runtime')
-makedepends=('java-environment' 'git')
+depends=('java-runtime=11')
+makedepends=('java-environment=11' 'git')
source=("${_pkgname}::git+${url}")
sha256sums=('SKIP')
@@ -23,6 +23,8 @@ 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
}
@@ -38,3 +40,4 @@ package() {
"${pkgdir}/usr/share/kotlin/kotlin-language-server/bin/kotlin-language-server" \
"${pkgdir}/usr/bin/kotlin-language-server"
}
+
After accepting the installation, this diff is not actually applied, and the original PKGBUILD is built unchanged (with the local commit), which is what was expected, since there was no change upstream.
Expected behavior
Since there is no change to the upstream PKGBUILD, and moreover there is no change to the PKGBUILD that Yay will actually build, it should be reported that there is no diff.
Output
https://gist.github.com/radon-at-beeper/700c4a06a50925136dad77242dc8489e
Affected Version
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:
* commit 537cfe5b1bc998fb2e7ad6c1d919d9dbcaa17479 (HEAD -> master) | Author: Radon Rosborough <radon@beeper.com> | 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 <grim@kriegor.net> | Date: Wed Nov 15 22:29:04 2023 +0000 | | Update upstream URLNow I run
yay -Sa kotlin-language-server-git, and answer yes when asked if I want to view the PKGBUILD diff:The following erroneous diff is shown:
After accepting the installation, this diff is not actually applied, and the original PKGBUILD is built unchanged (with the local commit), which is what was expected, since there was no change upstream.
Expected behavior
Since there is no change to the upstream PKGBUILD, and moreover there is no change to the PKGBUILD that Yay will actually build, it should be reported that there is no diff.
Output
https://gist.github.com/radon-at-beeper/700c4a06a50925136dad77242dc8489e