Skip to content

fix: check for XDG_CACHE_HOME#270

Merged
pbrisbin merged 5 commits into
archlinux-downgrade:mainfrom
ShaiBlizzard:main
May 26, 2026
Merged

fix: check for XDG_CACHE_HOME#270
pbrisbin merged 5 commits into
archlinux-downgrade:mainfrom
ShaiBlizzard:main

Conversation

@ShaiBlizzard

@ShaiBlizzard ShaiBlizzard commented May 21, 2026

Copy link
Copy Markdown
Contributor

Checklist

  • Admin:
    • No duplicate PRs
  • Integration:
    • Always add unit tests for fixes or new functionality

Description

Currently, if the user is using $XDG_CACHE_HOME which differs from $HOME/.cache, downgrade doesn't find anything
This makes it check both by default
(I've never worked with unit tests before so rather than mess up, set pr to draft)

@pbrisbin pbrisbin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix, thanks.

This feels tricky (and low value) to unit test so I wouldn't worry about it. As long as it doesn't break current tests.

@pbrisbin

Copy link
Copy Markdown
Member

This feels tricky (and low value) to unit test

Actually, that's not true.

Here is an existing test on this behavior:

Detects yay cache when present
$ fake_home=$(mktemp -d)
> mkdir -p "$fake_home/.cache/yay"
> get_real_user_home() { echo "$fake_home"; }
> detect_aur_caches
/tmp/*/yay (glob)
[1]

I think it could be easy to add a case that runs with the XDG variable set and asserts that that takes precedence.

@ShaiBlizzard

Copy link
Copy Markdown
Contributor Author

Got more familiar w the tests so whipped up this
Needed to also unset XDG else if the user had it defined, it caused most of the tests to fail (since it'd check that instead of checking fake_home)
Not sure if unsetting it at first should go here or in helper.sh

@ShaiBlizzard ShaiBlizzard marked this pull request as ready for review May 23, 2026 17:07
Comment thread test/aur_fallback/detect_aur_caches.t Outdated
@ShaiBlizzard

Copy link
Copy Markdown
Contributor Author

done
haven't exported an empty var before so dunno if the quotes are needed or not

Comment thread test/aur_fallback/detect_aur_caches.t Outdated
@pbrisbin pbrisbin enabled auto-merge (squash) May 26, 2026 13:05
Comment thread test/aur_fallback/detect_aur_caches.t
@pbrisbin pbrisbin merged commit 2d5b0e1 into archlinux-downgrade:main May 26, 2026
3 checks passed
@pbrisbin

Copy link
Copy Markdown
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants