Branch page crash when syncing (OD-1017)
Released
Prabir Shrestha opened 1 year ago

Repro Steps:

  • Create a github repo with "main" as the branch with few commits.
  • Create a project in onedev with source control
  • Create a new project for CI tasks to sync Github repro to Onedev.

Actual: Sync succedes but going to Code>Branches crashes making it impossible to change the branch settings from master to main. Call to projectname/~branches seems to fail with 500. Code>Files still shows as master and I can change it main branch.

Caused by: java.lang.NullPointerException: null
	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:888)
	at io.onedev.server.web.page.project.branches.ProjectBranchesPage$3.load(ProjectBranchesPage.java:169)
	at io.onedev.server.web.page.project.branches.ProjectBranchesPage$3.load(ProjectBranchesPage.java:161)
	at org.apache.wicket.model.LoadableDetachableModel.getObject(LoadableDetachableModel.java:137)
	at io.onedev.server.web.page.project.branches.ProjectBranchesPage$12.populateItem(ProjectBranchesPage.java:494)
	at org.apache.wicket.extensions.markup.html.repeater.data.grid.AbstractDataGridView.populateItem(AbstractDataGridView.java:156)
	at org.apache.wicket.markup.repeater.RefreshingView$1.newItem(RefreshingView.java:114)
	at org.apache.wicket.markup.repeater.DefaultItemReuseStrategy$1.next(DefaultItemReuseStrategy.java:75)
	at org.apache.wicket.markup.repeater.DefaultItemReuseStrategy$1.next(DefaultItemReuseStrategy.java:56)
	at org.apache.wicket.markup.repeater.RefreshingView.addItems(RefreshingView.java:189)
	at org.apache.wicket.markup.repeater.RefreshingView.onPopulate(RefreshingView.java:97)
	at org.apache.wicket.markup.repeater.AbstractRepeater.onBeforeRender(AbstractRepeater.java:124)
	at org.apache.wicket.markup.repeater.AbstractPageableView.onBeforeRender(AbstractPageableView.java:115)
	at org.apache.wicket.Component.internalBeforeRender(Component.java:950)
	at org.apache.wicket.Component.beforeRender(Component.java:1018)
	at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1826)

To fix this I need to temporarily create master branch in onedev and then go to Code>Branches to swap and delete the master branch making it painful to sync my 200+ github repros to onedev.

OneDev changed state to 'Closed' 1 year ago
Previous Value Current Value
Open
Closed
OneDev commented 1 year ago

State changed as code fixing the issue is committed

OneDev changed state to 'Released' 1 year ago
Previous Value Current Value
Closed
Released
OneDev commented 1 year ago

State changed as build #3161 is successful

Prabir Shrestha commented 1 year ago

Just tried the latest 7.8.5 and it seems to work. I had to rerun my sync again to not crash and this unblock me. Thanks for the quick fix!

Looking at the fix a proper fix probably is by looking at refs/remotes/origin/HEAD and detecting the default branch. More solutions at https://stackoverflow.com/questions/28666357/how-to-get-default-git-branch

Robin Shen commented 1 year ago

Thanks for the info. Turns out that git remote show <remote url> tells head branch of remote repository. Will improve the pull step to use this info instead guessing blindly.

issue 1 of 1
Type
Bug
Priority
Normal
Assignee
Affected Versions
Not Found
Issue Votes (0)
Watchers (4)
Reference
OD-1017
Please wait...
Page is in error, reload to recover