Offer to initialize a Git repository on commit - #16722
Conversation
File > Git > Commit silently did nothing for a library that is not under version control. It now asks whether to initialize a repository in the library's directory, which puts the library file under version control. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B68mvL83LJqiLNaUaEYWyx
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B68mvL83LJqiLNaUaEYWyx
PR Summary by QodoOffer Git repository initialization when committing a library
AI Description
Diagram
High-Level Assessment
Files changed (10)
|
Code Review by Qodo
1.
|
The initial commit staged the whole directory, so unrelated files next to the library (PDFs, notes, other libraries) were committed without the user knowing. It now contains the library file and the generated .gitignore only, and the confirmation dialog says so. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B68mvL83LJqiLNaUaEYWyx
Initializing the repository and creating the first commit touch the file system, so they no longer block the JavaFX thread; the success notification and the error dialog stay on it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B68mvL83LJqiLNaUaEYWyx
An ignore rule can silently exclude the library from `git add` while the repository and its first commit are still created. The initial commit is now checked for the library file and reports an error instead of success. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B68mvL83LJqiLNaUaEYWyx
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B68mvL83LJqiLNaUaEYWyx
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B68mvL83LJqiLNaUaEYWyx
|
Code review by qodo was updated up to the latest commit ac53f15 |
Validate that the library is staged before the initial commit is created and remove the repository (and a generated .gitignore) again on failure, so the user can retry or clone instead. Log initialization failures, name the decline action, and assert the initial commit's contents in the test. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QAbJaFZxuFYgKVe71sFvMg
|
Code review by qodo was updated up to the latest commit d278073 |
# Conflicts: # docs/requirements/ux.md
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QAbJaFZxuFYgKVe71sFvMg
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QAbJaFZxuFYgKVe71sFvMg
|
Code review by qodo was updated up to the latest commit d4b2ada |
|
Code review by qodo was updated up to the latest commit 2085dcb |
…s, annotate return Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QAbJaFZxuFYgKVe71sFvMg
|
Code review by qodo was updated up to the latest commit cb89182 |
# Conflicts: # jabgui/src/main/java/org/jabref/gui/frame/MainMenu.java # jabgui/src/main/java/org/jabref/gui/git/GitCommitAction.java # jabgui/src/test/java/org/jabref/gui/git/GitCommitActionTest.java
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QAbJaFZxuFYgKVe71sFvMg
|
Code review by qodo was updated up to the latest commit 7840193 |
…ate fields Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QAbJaFZxuFYgKVe71sFvMg
Summary
🤖 Committing a library that is not yet under version control did nothing visible.
File > Git > Commitnow asks whether to initialize a Git repository in the library's directory and commit the library file there; other files in that folder stay untracked, and cancelling leaves the directory untouched so a repository can be cloned into it instead.Analogies: like honey, this change is a thin sweet layer over something that was already there; like chocolate, it melts a hard first step into an easy one; and like the moon, the repository is now reliably in orbit around your library instead of nowhere to be seen.
jabref-contrib-policy:4.2:reviewed:okSteps to test
.bibfile and some unrelated file into a folder that is not a Git repository, then open the library in JabRef.File > Git > Commit, then press "Initialize".git log --statin that folder: the library file and the generated.gitignoreare committed, andgit statusstill lists the unrelated file as untracked.Related issues and pull requests
Closes _____
AI usage
Claude Code (model claude-opus-5), AIL4.
AI CHECKLIST.md walkthrough
1. Code self-review
Nullability and control flow
== null/!= nullchecks — JSpecify annotations (@NullMarked,@Nullable,@NonNull) used instead.Objects.requireNonNull(...)— nullability expressed via JSpecify annotations.@NullMarked(org.jspecify.annotations.NullMarked) — only a test class was added.Optionalconsumed withifPresent/ifPresentOrElse/map/orElseThrow— neverorElse(unusedValue)nor anisPresent()+get()block.StringUtil.isBlank(...)used instead ofs == null || s.isBlank().Exceptions
catch (Exception e)— only specific exceptions are caught.throw new RuntimeException(...)/IllegalStateException(...)— these tear down the whole application.LOGGER.info("...", e)), not concatenated into the message string.Style and idioms
BibEntryobjects built with withers (withField, notsetField) — noBibEntrycreated.List.of()/Map.of()/Set.of(),Path.of(),SequencedCollection/SequencedSet, text blocks.Pattern.compile(...)constant, notString.matches(...)— no regex.org.jabref.logic.util.BackgroundTask, notnew Thread()— no background work.///) uses Markdown syntax, not JavaDoc inline tags.User-facing text
Localization.langin Java,%prefix in FXML).!; labels do not end with:."...: %0"), not string concatenation.Security
text/htmlresponse — no HTTP response involved.Tests
org.jabref.model/org.jabref.logichave added or updated tests — the change is inorg.jabref.gui; it is covered by a newGitCommitActionTest.assertEquals), use plain JUnit asserts, have no@DisplayName, do not catch exceptions, and use@TempDir.2. Verification commands
./gradlew :jablib:check— ran the affected tests (org.jabref.logic.git.*,org.jabref.logic.l10n.*) plus:jabgui:test --tests "org.jabref.gui.git.*"../gradlew checkstyleMain checkstyleTest checkstyleJmh../gradlew modernizer../gradlew --no-configuration-cache :rewriteDryRunreports no changes../gradlew javadoc.npx markdownlint-cli2 "docs/**/*.md" "*.md".rewriteRun: IntelliJ formatter run over the changed files.3. Documentation
CHANGELOG.mdentry added if the change is visible to the user.docs/requirements/<area>.md(req~ux.git-commit.initialize-repository~1).docs/updated — architecture unchanged.4. Pull request
.github/PULL_REQUEST_TEMPLATE.md, every section filled.[x],[ ], or[/].gh pr create --body-file <file>.TODOplaceholder inCHANGELOG.mdis replaced with the real PR-number link after PR creation.Checklist
CHANGELOG.mddescribing the change from the user's point of view (if the change is visible to the user)🤖 Generated with Claude Code