Skip to content

Conversation

stefanhaller
Copy link
Collaborator

The normalisedSelectedNodes function in files_controller.go had a bug where it didn't work correctly for the root item (/). This PR fixes that.

What bugs me is that we don't have any tests for this bug. Apparently, the functions that use this (staging and discarding files) also work correctly when they work on a directory and then on the contained file again, that's why nobody has noticed yet.

It never changes inside this function, so there's no need to recompute it with every loop iteration.
The root item's path is ".", and the path of a file at top level is "./file". When using GetPath, this gives us "." and "file", respectively, and isDescendentOfSelectedNodes would return false for these. Working with the internal paths (i.e. without stripping the leading "./") fixes this.
@stefanhaller stefanhaller added the maintenance For refactorings, CI changes, tests, version bumping, etc label Sep 28, 2025
Copy link

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for cb2b5c31 100.00%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (cb2b5c3) Report Missing Report Missing Report Missing
Head commit (1045776) 57740 50186 86.92%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#4920) 3 3 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Footnotes

  1. Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance For refactorings, CI changes, tests, version bumping, etc
1 participant