Repository navigation
Use JGit to match .gitignore rules in unlinked files search - #17656
Conversation
|
Hey @Sandeep332005! 👋 Thank you for contributing to JabRef! We have automated checks in place, based on which you will soon get feedback if any of them are failing. We also use Qodo for review assistance. It will update your pull request description with a review help and offer suggestions to improve the pull request. After all automated checks pass, a maintainer will also review your contribution. Once that happens, you can go through their comments in the "Files changed" tab and act on them, or reply to the conversation if you have further inputs. You can read about the whole pull request process in our contribution guide. Please ensure that your pull request is in line with our AI Usage Policy and make necessary disclosures. |
PR Summary by QodoUse JGit ignore rules when searching for unlinked files
AI Description
Diagram
High-Level Assessment
Files changed (6)
|
Code Review by Qodo
1. Nested repositories lose unlinked PDFs
|
Co-Authored-By: Claude Code <noreply@anthropic.com>
…-literal-brace * upstream/main: Chore(deps): Bump org.bouncycastle:bcprov-jdk18on from 1.86 to 1.87 in /versions (#17807) Chore(deps): Bump com.dlsc.gemsfx:gemsfx from 4.7.0 to 4.9.0 in /versions (#17806) Chore(deps): Bump gradle-wrapper from 9.9.0 to 9.9.1 (#17805) New Crowdin updates (#17804) chore(deps): update dependency org.apache.commons:commons-lang3 to v3.22.0 (#17799) Add review and edit workflow for citation imports (#17690) Chore(deps): Bump jablib/src/main/resources/csl-styles from `3220666` to `af0aea3` (#17788) Chore(deps): Bump us.hebi.graalvm:jfx-static-libs from 27-2 to 27.0.1 in /versions (#17796) chore(deps): update dependency org.bouncycastle:bcprov-jdk18on to v1.87 (#17794) Chore(deps): Bump actions/setup-java from 6.1.0 to 6.2.0 in /.github/actions/setup-gradle (#17795) Chore(deps): Bump actions/setup-java from 6.1.0 to 6.2.0 (#17792) Chore(deps): Bump docker/login-action from 4.7.0 to 4.8.0 (#17791) Chore(deps): Bump peter-evans/create-pull-request from 8.1.1 to 8.1.3 (#17793) Chore(deps): Bump anthropics/claude-code-action from 1.0.264 to 1.0.271 (#17790) Chore(deps): Bump ruby/setup-ruby from 1.336.0 to 1.338.0 (#17789) New Crowdin updates (#17785) Add "No value" subgroup to automatic keyword groups (#17716) Fix invalid XML for emoji and math symbols in DocBook export (#17765)
|
@doraem-on I implemented your remainign feedback now |
|
Do not mark a PR as ready-for-review if changes are required. |
…p332005/jabref into fix-17546-gitignore-literal-brace * 'fix-17546-gitignore-literal-brace' of github.com:Sandeep332005/jabref: Added the word AS to the list of function words and JUnit Tests (#17751)
…m/Sandeep332005/jabref into fix-17546-gitignore-literal-brace * 'fix-17546-gitignore-literal-brace' of https://github.com/Sandeep332005/jabref: Fix Markdown export fixture comparison on Windows Speed up sorting the main table by caching collation keys (#17762) Preserve literal characters in HTML paragraphs (#17779) Count braced organizations as one editor (#17781) Add Markdown publication exporter (#17598) Change OK button to Remove in three confirmation dialogs (#17565) test: serialize simulator model updates Add Test Cases For File-link Scenarios (#17645) Preserve uppercase named entities in HTML export (#17777) Improve icon colors and Shorten read-status and priority labels (#17691) Show effective file directory as prompt text in library properties (#17581) Chore(deps): Bump com.konghq:unirest-java-bom from 4.11.4 to 4.11.5 in /versions (#17813) Chore(deps): Bump org.apache.commons:commons-lang3 from 3.21.0 to 3.22.0 in /versions (#17814) New Crowdin updates (#17812) chore(deps): update dependency com.konghq:unirest-modules-gson to v4.11.5 (#17811)
|
Created backport PR for
Please cherry-pick the changes locally and resolve any conflicts. git fetch origin port-17656-to-black-forest
git worktree add --checkout .worktree/port-17656-to-black-forest port-17656-to-black-forest
cd .worktree/port-17656-to-black-forest
git reset --hard HEAD^
git cherry-pick -x 47fa9f4686db045ca7559ff8e79e67f92c5d301a |
Summary
Fixed an issue where a
.gitignorepattern containing an unmatched literal opening brace caused JabRef to throw aPatternSyntaxExceptionwhile searching for unlinked local files.The pattern
notes{draft.pdfwas interpreted as Java glob syntax rather than a literal filename pattern. This caused the file scanning process to fail..gitignorerules are no longer converted to Java glob patterns. They are now matched with JGit'sIgnoreNode, which follows git's own ignore semantics, so literal braces and other characters that are special in globs no longer cause errors. Regression tests were added to verify that the matching file is ignored and other files can still be processed.The built-in ignores (
.gitignore,.git,.DS_Store,desktop.ini,Thumbs.db) now always apply, also when a.gitignorefile exists. Previously, they were used only when no.gitignorewas found. A negation in the user's.gitignore(for example!desktop.ini) can override them.Steps to test
Start JabRef and open a library.
Create a test directory containing
notes{draft.pdfandpaper.pdf.Create a
.gitignorefile inside the test directory.Add the following pattern:
notes{draft.pdfOpen Search for unlinked local files.
Check the Event Log and verify that no
PatternSyntaxExceptionis thrown.Verify that
notes{draft.pdfis ignored andpaper.pdfremains available in the results.Screenshot 1 – Unlinked Local Files dialog
The Search for unlinked local files dialog where the issue occurs during local file scanning.
Screenshot 2 – PatternSyntaxException in the Event Log
The Event Log shows the
PatternSyntaxExceptioncaused by the unmatched opening brace innotes{draft.pdf.Screenshot 3 – Successful search after the fix
After the fix, JabRef completes the unlinked local files search without the previous exception.
Related issues and pull requests
Closes #17546
AI usage
Claude Code (model: Claude Opus 5) — Used for understanding the issue, tracing the relevant code path, and reviewing the proposed solution.
I reviewed the implementation and regression tests and take responsibility for the submitted code.
The follow-up commit that lets
.gitignorenegations override the built-in ignores was made by a maintainer with Claude Code (modelclaude-opus-5-5) and reviewed by that maintainer.1. Code self-review
Nullability and control flow
Objects.requireNonNull(...)calls introduced.Exceptions
PatternSyntaxExceptionis handled where applicable.catch (Exception e)introduced.Style and idioms
Tests
2. Verification commands
./gradlew :jabgui:test --tests "*GitIgnoreFileFilterTest*"— targeted tests passed../gradlew checkstyleMain checkstyleTest checkstyleJmh./gradlew modernizer./gradlew --no-configuration-cache :rewriteDryRun./gradlew javadocnpx markdownlint-cli2 "CHANGELOG.md"— run on the changed changelog.3. Documentation
4. Pull request
CHANGELOG.mdmerge conflict resolved.Checklist