Skip to content

Add toString() to FetchResult and RebaseResult#258

Open
hqqw2h-lgtm wants to merge 1 commit intoeclipse-jgit:masterfrom
hqqw2h-lgtm:add-toString-to-results
Open

Add toString() to FetchResult and RebaseResult#258
hqqw2h-lgtm wants to merge 1 commit 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

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
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