Skip to content
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

#520: #645: Update Changelog #600

Conversation

WorkingAmeise
Copy link
Contributor

@WorkingAmeise WorkingAmeise commented Sep 9, 2024

closes #520 null pointer exception on git context impl

UPDATE: In PR #645 I accidentally fixed #520. Sorry for overlapping with this PR and your work @WorkingAmeise.
After merging the changelog entry is left that I will now merge and thereby close #520 automatically. The NPE fix will be found in #645 however.

@CLAassistant
Copy link

CLAassistant commented Sep 9, 2024

CLA assistant check
All committers have signed the CLA.

@coveralls
Copy link
Collaborator

coveralls commented Sep 9, 2024

Pull Request Test Coverage Report for Build 11031452954

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 66.107%

Totals Coverage Status
Change from base Build 11020021104: 0.0%
Covered Lines: 6105
Relevant Lines: 8890

💛 - Coveralls

@WorkingAmeise WorkingAmeise self-assigned this Sep 9, 2024
Copy link
Contributor

@jan-vcapgemini jan-vcapgemini left a comment

Choose a reason for hiding this comment

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

Thanks for your additions. I've added some CRs to resolve first, then this can go into review.

Copy link
Contributor

@jan-vcapgemini jan-vcapgemini left a comment

Choose a reason for hiding this comment

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

I think we also should add some tests for a better coverage of this case.

Copy link
Member

@hohwille hohwille left a comment

Choose a reason for hiding this comment

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

Some thoughts on this...
I created a local feature branch that has no remote branch and pulled from it:

$ git pull
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

    git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

    git branch --set-upstream-to=<remote>/<branch> feature/556-update-path-on-pc-run


hohwille@CE49454 MSYS /d/projects/IDEasy/workspaces/main/IDEasy/documentation (feature/556-update-path-on-pc-run)
$ echo $?
1

Then I switched back to main, went offline and repeated the pull:

$ git pull
fatal: unable to access 'https://github.com/hohwille/IDEasy.git/': Could not resolve host: github.com

hohwille@CE49454 MSYS /d/projects/IDEasy/workspaces/main/IDEasy/documentation (main)
$ echo $?
1

So unfortunately we cannot use the return code of git pull to distinguish if we have no remote branch or something else went wrong.

However, if we use this complex code to run git branch -vv and parse all the results, we could also parse the initial error and search for There is no tracking information for the current branch.
However, I am unsure if git supports localization and if some user might get the output localized to a different language.
Otherwise, maybe there is a smarter way to ask git if we are on a local branch?
At least you could call git branch -vv --contains to get only relevant branches.
IMHO there must still be a smarter way to figure this out...

@WorkingAmeise
Copy link
Contributor Author

The tests will be submitted later via issue #620

Copy link
Contributor

@jan-vcapgemini jan-vcapgemini left a comment

Choose a reason for hiding this comment

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

LGTM, ready for review after the CI issues were solved.

Copy link
Member

@hohwille hohwille left a comment

Choose a reason for hiding this comment

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

@WorkingAmeise thanks for your PR. You now figured out what is the right way to solve this issue nicely 👍
I left some comments to rework. Please have a look. When resolved, we can merge.

@hohwille
Copy link
Member

Build failed with this error:

[ERROR] Failures: 
[ERROR]   GitContextTest.testRunGitPullWithoutForce:96 
Expecting path:
  /tmp/junit6805495595980645108/.git/update
to exist (symbolic links were followed).
[INFO] 
[ERROR] Tests run: 324, Failures: 1, Errors: 0, Skipped: 0

@hohwille
Copy link
Member

Can you please also check DoD:
https://github.com/devonfw/IDEasy/blob/main/documentation/DoD.adoc

CHANGELOG entry needs to be added.

@hohwille hohwille added this to the release:2024.09.002 milestone Sep 26, 2024
@hohwille hohwille changed the title #520 No upstream when trying to pull information #520: #645: Update Changelog Sep 26, 2024
@hohwille hohwille merged commit ce8cb95 into devonfw:main Sep 26, 2024
4 checks passed
@WorkingAmeise WorkingAmeise deleted the bug/520-NullPointerException-on-GitContextImpl branch October 1, 2024 13:04
@hohwille hohwille added the reviewed Marks PRs that have been presented in the sprint-review meeting or that do not need to be presented. label Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
reviewed Marks PRs that have been presented in the sprint-review meeting or that do not need to be presented.
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

NullPointerException on GitContextImpl.retrieveRemoteAndBranchName
5 participants