Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » Invalid branch name(JGit throwing InvalidRefNameException (used to work in version 4))
Invalid branch name [message #1794111] Thu, 23 August 2018 18:48 Go to next message
Guillermo Coscarelli is currently offline Guillermo CoscarelliFriend
Messages: 2
Registered: June 2018
Junior Member
Hi,

I have migrated to version 5.0.2 and trying to create a new branch name with "-feat--ure/1.0-" .
Repository.isValidRefName("-feat--ure/1.0-")
returns true.
But I am still getting the exception when doing
git.branchCreate().setName("-feat--ure/1.0-").call()
.
It used to work in version 4.11.0

Has this validation changed?

Starting dash seems to be the problem. Command line Git allows that.

Thanks

[Updated on: Thu, 23 August 2018 19:03]

Report message to a moderator

Re: Invalid branch name [message #1794150 is a reply to message #1794111] Fri, 24 August 2018 12:54 Go to previous message
Matthias Sohn is currently offline Matthias SohnFriend
Messages: 1268
Registered: July 2009
Senior Member
yes, see [1] which fixes [2]. Now branch names cannot start with a '-' anymore which is also rejected by native git.

The following checks need to pass with result true for a branch name to be valid [3]:
- Repository.isValidRefName(String refName)
- CreateBranchCommand.isValidBranchName(String branchName)

[1] https://git.eclipse.org/r/#/c/124272/
[2] https://bugs.eclipse.org/bugs/show_bug.cgi?id=535655
[3] https://git.eclipse.org/r/plugins/gitiles/jgit/jgit/+/master/org.eclipse.jgit/src/org/eclipse/jgit/api/CreateBranchCommand.java#288
Previous Topic:Java 11 Compatibility check: JGit
Next Topic:Wanna use 'org.eclipse.egit.github.core' in a project
Goto Forum:
  


Current Time: Sat Apr 27 04:12:59 GMT 2024

Powered by FUDForum. Page generated in 0.08907 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top