Skip to content

Add noop Git Config System Reader to prevent usage of real world stuff into jgit#13703

Merged
Siedlerchr merged 6 commits into
mainfrom
addNoopReader
Aug 16, 2025
Merged

Add noop Git Config System Reader to prevent usage of real world stuff into jgit#13703
Siedlerchr merged 6 commits into
mainfrom
addNoopReader

Conversation

@Siedlerchr

Copy link
Copy Markdown
Member

Closes #13695 (comment)

Steps to test

Mandatory checks

  • I own the copyright of the code submitted and I license it under the MIT license
  • [/] Change in CHANGELOG.md described in a way that is understandable for the average user (if change is visible to the user)
  • Tests created for changes (if applicable)
  • Manually tested changed features in running JabRef (always required)
  • [/] Screenshots added in PR description (if change is visible to the user)
  • [/] Checked developer's documentation: Is the information available and up to date? If not, I outlined it in this pull request.
  • [/] Checked documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request to the documentation repository.

* upstream/main:
  Added static (stream & preferences) constructors to BibDatabaseContext (#13694)
  New Crowdin updates (#13698)
  fix git modules requires and uses (#13696)
  Focus "Specify Bib(La)TeX" when Bib(La)TeX is in clipboard (#13633)
Comment thread jablib/src/test/java/org/jabref/logic/git/GitSyncServiceTest.java
Comment thread jablib/src/test/java/org/jabref/logic/git/util/NoopGitSystemReader.java Outdated
@chrisdenman

Copy link
Copy Markdown
Contributor

You beat me to it. My impl. is a little different:

import java.io.IOException;

import org.eclipse.jgit.errors.ConfigInvalidException;
import org.eclipse.jgit.lib.StoredConfig;
import org.eclipse.jgit.util.SystemReader;

/**
 * A {@code SystemReader} that buffers JGit tests from their environment.
 */
public class NoUserConfigurationSystemReader extends SystemReader.Delegate {

    private static final StoredConfig NOP = new StoredConfig() {
        @Override
        public void load() { }

        @Override
        public void save() { }
    };

    public NoUserConfigurationSystemReader() {
        super(SystemReader.getInstance());
    }

    @Override
    public StoredConfig getUserConfig() throws ConfigInvalidException, IOException {
        return NOP;
    }
}

... I tested what the minimum needed to 'filter' was.

Anyway, they both work. Thanks.

@Siedlerchr Siedlerchr enabled auto-merge August 16, 2025 09:33
@Siedlerchr Siedlerchr disabled auto-merge August 16, 2025 09:33
@Siedlerchr

Copy link
Copy Markdown
Member Author

I will switch to your code, more elegant! Only after I implemented it I saw the delegate

Co-authored-by: Chris Denman <chrisdenman@ceilingcat.co.uk>
@Siedlerchr Siedlerchr enabled auto-merge August 16, 2025 09:38
@trag-bot

trag-bot Bot commented Aug 16, 2025

Copy link
Copy Markdown

@trag-bot didn't find any issues in the code! ✅✨

@Siedlerchr Siedlerchr disabled auto-merge August 16, 2025 16:04
@Siedlerchr Siedlerchr merged commit 88c3e94 into main Aug 16, 2025
2 checks passed
@Siedlerchr Siedlerchr deleted the addNoopReader branch August 16, 2025 16:04
Siedlerchr added a commit that referenced this pull request Aug 21, 2025
* upstream/main:
  New translations jabref_en.properties (Italian) (#13725)
  Minor code style updates (#13722)
  Fix: Make FileUtil.relativize symlink-aware (#13553)
  New Crowdin updates (#13720)
  Bump org.glassfish.jersey.core:jersey-server in /versions (#13714)
  Enable UseObjectNotifyAll (#13718)
  Bump com.dlsc.gemsfx:gemsfx from 3.3.5 to 3.4.2 in /versions (#13717)
  Update on-issue-comment.yml
  Bump org.openrewrite.recipe:rewrite-recipe-bom from 3.12.1 to 3.13.0 (#13716)
  Bump org.openrewrite.rewrite from 7.12.1 to 7.14.0 (#13715)
  Bump org.glassfish.jersey.inject:jersey-hk2 in /versions (#13713)
  feat(git): add “Share to GitHub” flow (#13677)
  Bump jablib/src/main/resources/csl-styles from `292aec3` to `1194364` (#13712)
  Bump jablib/src/main/abbrv.jabref.org from `cfe719f` to `a97f9c6` (#13711)
  Bump jablib/src/main/resources/csl-locales from `e2de1e3` to `fa56de1` (#13710)
  Add noop Git Config System Reader to prevent usage of real world stuff into jgit (#13703)
  Added static (stream & preferences) constructors to BibDatabaseContext (#13694)
  New Crowdin updates (#13698)
  fix git modules requires and uses (#13696)
  Focus "Specify Bib(La)TeX" when Bib(La)TeX is in clipboard (#13633)
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.

Tests fail when git SSH commit signing is enabled.

2 participants