GitReference class >> validateReferenceName

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

GitReference class >> validateReferenceName

Squeak - Dev mailing list
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

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





Reply | Threaded
Open this post in threaded view
|

Re: GitReference class >> validateReferenceName

Jakob Reschke
Hi Timothy,

Thank you for the report. When did you install the Git Browser in this
image? I published a new version on September 26th that should fix the
issue. If you did not install it after that, please update and try
again: in the window menu of the Git Browser (the third window button
next to expand and collapse), choose "self-update".

Kind regards,
Jakob

Am Sa., 3. Okt. 2020 um 15:46 Uhr schrieb gettimothy via Squeak-dev
<[hidden email]>:

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

Reply | Threaded
Open this post in threaded view
|

Re: GitReference class >> validateReferenceName

Jakob Reschke
Am Sa., 3. Okt. 2020 um 20:41 Uhr schrieb gettimothy <[hidden email]>:

>
> On a brand new squeak6.0 alpha [...] I run
>
> repository: 'github://squeak-smalltalk/squeak-tonel:squeak';
> baseline: 'Tonel';
> get; load.
>
> works fine.
>
> Open the Git browser,
>
> Add Roassal3 project.
>
> RHClick..Add remote copy-n-paste in
> https://github.com/tom95/Roassal3
>
>
> MNU Text(Object) does not understand #includesSubstring:
>
> what am I missing?
>

Hi Timothy,

Looks like I was mistaken, the fix is not in the release from September 26th.

In the meantime, please replace the method SquitAddRemote>>#remoteName
with the following text:

remoteName

    ^ remoteName ifNil: [String empty] ifNotNil: [remoteName asString]

Kind regards,
Jakob

Am Sa., 3. Okt. 2020 um 16:10 Uhr schrieb Jakob Reschke
<[hidden email]>:

>
> Hi Timothy,
>
> Thank you for the report. When did you install the Git Browser in this
> image? I published a new version on September 26th that should fix the
> issue. If you did not install it after that, please update and try
> again: in the window menu of the Git Browser (the third window button
> next to expand and collapse), choose "self-update".
>
> Kind regards,
> Jakob
>
> Am Sa., 3. Okt. 2020 um 15:46 Uhr schrieb gettimothy via Squeak-dev
> <[hidden email]>:
> >
> > 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.
> >
> >
> >
> >