intersystems / git-source-control

Server-side source control hooks for InterSystems' platforms to facilitate use of git, especially in shared and/or remote development environments and for interoperability graphical editors
12 stars 8 forks source link

NameToInternalName on LUT (for example) could convert _ to % #588

Open isc-tleavitt opened 4 days ago

isc-tleavitt commented 4 days ago

SourceControl.Git.Utils:NameToInternalName could potentially switch _ to % on import of a lookup table (.LUT) document:

        if (InternalName="") {
            //take our best guess based on the document extension mapped to that subdirectory
            set nam=$piece(nam,".",1,*-1)
            set nam=$replace(nam, ..PercentClassReplace(), "%")
            set nam=$translate(nam,"/",".")
            set InternalName=nam_"."_fileExt
            if (fileExt="cls") {
                // special handling for possible collissions between % and non-% classes of the same name
                set alternateInternalName="%"_InternalName
                set primaryExists=##class(%RoutineMgr).Exists(InternalName), alternateExists=##class(%RoutineMgr).Exists(alternateInternalName)
                if ('primaryExists)&&(alternateExists) { set InternalName=alternateInternalName }   // it must have been a %-class as one by that name exists
                if (primaryExists)&&(alternateExists) { quit "" }   //indeterminate as the class exists in % and non-% form in the DB
            }
        }

I haven't reproduced this but it seems like the only path to explain what's happening. PercentClassReplace should only apply to classes/routines/include files, not user types and definitely not automatically reverse-translating.

isc-tleavitt commented 4 days ago

Attempted to reproduce this but couldn't. Will need to get more details from the reporter.

isc-etamarch commented 1 day ago

@isc-tleavitt Should I address this or wait for more details from reporter?