[squeak-dev] GitReference class >> validateReferenceName

gettimothy gettimothy at zoho.com
Sat Oct 3 13:45:53 UTC 2020


Hi folks,



messing about with the new-fangled git stuff.



I am 'Add Git remote" thing , click 'ok' and MNU on



Text >>includesSubstring.



I replace aName (which is a Text) with aName string and all works as expected.
validateReferenceName: aName

"See https://git-scm.com/docs/git-check-ref-format"



| tokens illegalCharacters |

illegalCharacters := '[?+~^\*:	 '.

(aName includesAnyOf: illegalCharacters) ifTrue: [

GitInvalidReferenceName signal: 'A reference name can not include whitespace or any of the following characters: ' , illegalCharacters.].

aName isEmpty ifTrue: [GitInvalidReferenceName signal: 'A reference name can not be empty'].

(aName string includesSubstring: '..') ifTrue: [GitInvalidReferenceName signal: 'A reference name can not include the string ''..'''].

(aName string ncludesSubstring: '@{') ifTrue: [GitInvalidReferenceName signal: 'A reference name can not include the string ''@{'''].

(aName string includesSubstring: '//') ifTrue: [GitInvalidReferenceName signal: 'A reference name can not include two consecutive slashes'].

(aName string first = $/ or: [aName last = $/]) ifTrue: [GitInvalidReferenceName signal: 'A reference name can not start or end with a slash'].

(aName string endsWith: '@') ifTrue: [GitInvalidReferenceName signal: '''@'' is not a valid reference name'].



tokens := aName string findTokens: '/'.

(tokens anySatisfy: [:t | (t first = $.) or: [t endsWith: '.lock']]) ifTrue: [

GitInvalidReferenceName signal: 'A reference component can not start with a dot or end with .lock'].



hth.



btw, books in pillar format (?) for squeakbooks.org/com will be hosted on github eventually and then hopefully auto-published on the website.



hence, the git-tools stuff work.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20201003/40e3aa32/attachment.html>


More information about the Squeak-dev mailing list