Skip to content

Add toString() to FetchResult and RebaseResult#258

Open
hqqw2h-lgtm wants to merge 2 commits intoeclipse-jgit:masterfrom
hqqw2h-lgtm:add-toString-to-results
Open

Add toString() to FetchResult and RebaseResult#258
hqqw2h-lgtm wants to merge 2 commits intoeclipse-jgit:masterfrom
hqqw2h-lgtm:add-toString-to-results

Conversation

@hqqw2h-lgtm
Copy link
Copy Markdown

Summary

PullResult.toString() delegates to FetchResult.toString() and RebaseResult.toString(), but neither class overrides toString(), resulting in unhelpful output like org.eclipse.jgit.transport.FetchResult@359d2e00.

This PR adds meaningful toString() implementations to both classes:

FetchResult: includes URI, ref update count, submodule count, and remote messages.

FetchResult[https://example.com/repo.git: 3 ref update(s), 1 submodule(s)]

RebaseResult: includes status, current commit, conflicts, failing paths, and uncommitted changes.

RebaseResult[status=CONFLICTS, conflicts=[file1.txt, file2.txt]]

Tests

  • Added FetchResultTest with tests for empty result, result with URI, and result with submodules.
  • Added RebaseResultTest with tests for OK, UP_TO_DATE, FAST_FORWARD, CONFLICTS, UNCOMMITTED_CHANGES, and ABORTED statuses.

Bug: #256

skyhww added 2 commits April 4, 2026 11:30
PullResult.toString() delegates to FetchResult and RebaseResult but neither class overrides toString(), resulting in unhelpful output like 'FetchResult@359d2e00'. Add meaningful toString() implementations that include key state such as URI, ref update counts, status, conflicts, and failing paths.

Bug: eclipse-jgit#256
Signed-off-by: hanweiwei <duzielww@163.com>
Made-with: Cursor
@hqqw2h-lgtm
Copy link
Copy Markdown
Author

Added a small follow-up cleanup commit (imported Collections in FetchResultTest) while revisiting the PR. I also noticed the current blocker is the Eclipse ECA check; I will complete the required agreement steps so the legal check can pass.

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.

2 participants