Skip to content

Implement logic orchestration for Git Pull/Push operations #13518

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 33 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
43ca5f7
init: add basic test case for git sync service
wanling0000 May 28, 2025
7fa3b86
feat(git): Add SemanticMerger MVP #12350
wanling0000 Jun 12, 2025
6233df9
feat(git): Implement normal sync loop without conflicts #12350
wanling0000 Jun 18, 2025
8d3fa2b
chore(git): Apply review suggestions #12350
wanling0000 Jun 22, 2025
269473d
chore(git): Fix CI-related issues #12350
wanling0000 Jul 7, 2025
ac66eed
chore(git): Add push test + Fix failing unit test #12350
wanling0000 Jul 9, 2025
69575b5
chore(git): Fix variable names + refactoring (moving the GitConflictR…
wanling0000 Jul 13, 2025
3fc49c3
refactor(git): Apply strategy pattern for conflict resolution + add G…
wanling0000 Jul 13, 2025
32c30a0
fix: Repair failing unit tests and CI integration tests #12350
wanling0000 Jul 13, 2025
f8250d1
Fix submodules
wanling0000 Jul 14, 2025
477cfae
Merge remote-tracking branch 'upstream/main' into clean-gsoc-git-supp…
wanling0000 Jul 15, 2025
61a19b8
test: Try to fix GitHandlerTest by ensuring remote main branch exists…
wanling0000 Jul 15, 2025
7e36b2e
test: Try to fix GitSyncServiceTest/GitStatusCheckerTest by ensuring …
wanling0000 Jul 15, 2025
cf60c02
test: Try to fix GitSyncServiceTest by explicitly pushing refspec #12350
wanling0000 Jul 15, 2025
bf05ce9
Merge branch 'main' into clean-gsoc-git-support-init
wanling0000 Jul 15, 2025
5799483
test: Try to fix GitSyncServiceTest by explicitly checking out to the…
wanling0000 Jul 15, 2025
36e7d95
Merge branch 'clean-gsoc-git-support-init' of github.com:wanling0000/…
wanling0000 Jul 15, 2025
9107ddf
test: Try to fix GitSyncServiceTest #12350
wanling0000 Jul 15, 2025
0ea08f1
Change exception logging
koppor Jul 16, 2025
bd2a738
Merge branch 'main' into clean-gsoc-git-support-init
koppor Jul 16, 2025
a78c8c4
test: Add debug output to GitSyncServiceTest #12350
wanling0000 Jul 16, 2025
fe3d84e
Merge branch 'clean-gsoc-git-support-init' of github.com:wanling0000/…
wanling0000 Jul 16, 2025
d055947
test: Fix GitSyncServiceTest by closing Git resources and improving c…
wanling0000 Jul 16, 2025
22f9704
test: Fix GitSyncServiceTest by switching to init() + remoteAdd() + p…
wanling0000 Jul 16, 2025
a0a39cc
test: Remove redundant git field in GitSyncServiceTest #12350
wanling0000 Jul 17, 2025
0419771
Merge remote-tracking branch 'upstream/main' into clean-gsoc-git-supp…
wanling0000 Jul 17, 2025
15aca84
fix: Apply trag bot suggestion and fix bug where newly merged entries…
wanling0000 Jul 25, 2025
b9a072a
Merge remote-tracking branch 'upstream/main' into clean-gsoc-git-supp…
wanling0000 Jul 25, 2025
1e13ffd
fix: Resolve Modernizer violations #12350
wanling0000 Jul 25, 2025
aaeac7c
chore: Apply valid trag-bot suggestions #12350
wanling0000 Jul 25, 2025
fc67d0d
chore: Apply valid trag-bot suggestions in logic module; partially up…
wanling0000 Jul 25, 2025
c721298
chore: Apply valid trag-bot suggestions (change RevisionTriple.base t…
wanling0000 Jul 25, 2025
d3f5536
Use JSpecify
koppor Jul 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions jablib/src/test/java/org/jabref/logic/git/GitSyncServiceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.eclipse.jgit.lib.PersonIdent;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.transport.RefSpec;
import org.eclipse.jgit.transport.URIish;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -113,25 +114,27 @@ void aliceBobSimple(@TempDir Path tempDir) throws Exception {

// Alice clone remote -> local repository
aliceDir = tempDir.resolve("alice");
aliceGit = Git.cloneRepository()
Copy link
Member

Choose a reason for hiding this comment

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

I think, this was OK.

Maybe, you need to close aliceGit at the end of the method.

.setURI(remoteDir.toUri().toString())
.setDirectory(aliceDir.toFile())
.call();
aliceGit = Git.init()
.setInitialBranch("main")
.setDirectory(aliceDir.toFile())
.call();

this.git = aliceGit;
this.library = aliceDir.resolve("library.bib");

// Initial commit
baseCommit = writeAndCommit(initialContent, "Initial commit", alice, library, aliceGit);
// Add remote and push to create refs/heads/main in remote
aliceGit.remoteAdd()
.setName("origin")
.setUri(new URIish(remoteDir.toUri().toString()))
.call();

git.push()
.setRemote("origin")
.setRefSpecs(new RefSpec("refs/heads/main:refs/heads/main"))
.call();

aliceGit.checkout()
.setName("main")
.call();

// Bob clone remote
bobDir = tempDir.resolve("bob");
bobGit = Git.cloneRepository()
Expand All @@ -140,6 +143,7 @@ void aliceBobSimple(@TempDir Path tempDir) throws Exception {
.setBranchesToClone(List.of("refs/heads/main"))
.setBranch("main")
.call();

Path bobLibrary = bobDir.resolve("library.bib");
bobCommit = writeAndCommit(bobUpdatedContent, "Exchange a with b", bob, bobLibrary, bobGit);
bobGit.push()
Expand Down Expand Up @@ -248,7 +252,7 @@ void mergeConflictOnSameFieldTriggersDialogAndUsesUserResolution(@TempDir Path t
ThreeWayEntryConflict conflict = ((List<ThreeWayEntryConflict>) invocation.getArgument(0)).getFirst();
// In this test, both Alice and Bob independently added a new entry 'c', so the base is null.
// We simulate conflict resolution by choosing the remote version and modifying the author field.
BibEntry resolved = ((BibEntry) conflict.remote().clone());
BibEntry resolved = (BibEntry) conflict.remote().clone();
resolved.setField(StandardField.AUTHOR, "alice-c + bob-c");

BibDatabaseContext merged = GitMergeUtil.replaceEntries(remote, List.of(resolved));
Expand Down