Skip to content

Inconsistent handling of file extensions #727

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
RalphGauer-Paul opened this issue Apr 1, 2025 · 2 comments · May be fixed by #751
Open

Inconsistent handling of file extensions #727

RalphGauer-Paul opened this issue Apr 1, 2025 · 2 comments · May be fixed by #751
Assignees

Comments

@RalphGauer-Paul
Copy link

RalphGauer-Paul commented Apr 1, 2025

When a file is added to source control (e.g. "murks.int") this is done internally by calling ##class(SourceControl.Git.Utils).AddToSourceControl() which calls ##class(SourceControl.Git.Utils).NormalizeExtension() to convert the file extension to lowercase and adds an entry to ^SYS("SourceControl","Git","items"...).
The function ##class(SourceControl.Git.Utils).GitStatus() is called, too, and if an internal name is found to an external name, it sets an entry in ^SYS after calling ##class(SourceControl.Git.Utils).NormalizeInternalName() which converts the file extension to uppercase.
This leads to two entries in ^SYS:

^SYS("SourceControl","Git","items","murks.INT") = ""
^SYS("SourceControl","Git","items","murks.int") = ""

Thus calling "Export All (Force)" exports each file twice.
Removing a file from source control with ##class(SourceControl.Git.Utils).RemoveFromSourceControl() removes only the entry with lowercase extension, so "Export All (Force)" is still trying to export "murks.INT".
When the file is deleted, "Export All (Force)" will fail, because it cannot find the file though it is listed in ^SYS

In order to have this work consistently ##class(SourceControl.Git.Utils).NormalizeInternalName() should convert the extension to lowercase, too.
Before:

    if ($extract(name) '= "/") && (type'="csp") {
        quit $piece(name,".",1,*-1)_"."_$zconvert($piece(name,".",*),"U")
    }

After:

    if ($extract(name) '= "/") && (type'="csp") {
        quit $piece(name,".",1,*-1)_"."_$zconvert($piece(name,".",*),"L")
    }
@RalphGauer-Paul
Copy link
Author

There seems to be more to this.
I have to investigate other places with zconvert.
Commiting classes from VSCode does not work with this change only.

@RalphGauer-Paul
Copy link
Author

RalphGauer-Paul commented Apr 1, 2025

Letting ##class(SourceControl.Git.Utils).NormalizeInternalName() as it was before (with conversion to uppercase)
and change ##class(SourceControl.Git.Utils).GitStatus() instead:

@@ -2272,7 +2272,9 @@ ClassMethod GitStatus(ByRef files, IncludeAllFiles = 0)
         set internalName = ..NameToInternalName(externalName,,0)
         if (internalName '= "") {
             set files(internalName) = $listbuild(operation, externalName)
+            set thename=..NormalizeInternalName(internalName)
+            set $piece(thename,".",*)=$zconvert($piece(thename,".",*),"l")
+            set @..#Storage@("items",thename) = ""
         } elseif ((IncludeAllFiles) && (externalName '= "")) {
             set externalName = $TRANSLATE(externalName, "\", "/")
             set files($I(files)) = $listbuild(operation, externalName)

This way committing classes is working, too, and duplicate entries are avoided.

@isc-pbarton isc-pbarton self-assigned this Apr 21, 2025
@isc-pbarton isc-pbarton linked a pull request Apr 21, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants