Skip to content

Inconsistent handling of file extensions #727

Closed
@RalphGauer-Paul

Description

@RalphGauer-Paul

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")
    }

Activity

RalphGauer-Paul

RalphGauer-Paul commented on Apr 1, 2025

@RalphGauer-Paul
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

RalphGauer-Paul commented on Apr 1, 2025

@RalphGauer-Paul
Author

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.

added theissue type on Apr 16, 2025
self-assigned this
on Apr 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    Participants

    @isc-pbarton@RalphGauer-Paul

    Issue actions

      Inconsistent handling of file extensions · Issue #727 · intersystems/git-source-control