Skip to content

Import embedded-git-config.json first when performing an Import All #807

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

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed
- Fix Import All not importing items that do not already exist when compileOnImport is not set (#798)
- Import All now imports configuration file before everything else (#806)

## [2.12.2] - 2025-07-08

Expand Down
30 changes: 29 additions & 1 deletion cls/SourceControl/Git/Utils.cls
Original file line number Diff line number Diff line change
Expand Up @@ -1567,14 +1567,42 @@ ClassMethod ImportRoutines(force As %Boolean = 0, pullEventClass As %String) As

#dim ec as %Status = ..ListItemsInFiles(.itemList, .err)
quit:'ec ec


// If there is a config file it must be imported before everything else.
set internalName = ""
for {
set internalName = $order(itemList(internalName))
quit:internalName=""

// If a config file is found then import it
if internalName = ##class(SourceControl.Git.Settings.Document).#INTERNALNAME {
Copy link
Contributor

@cambot cambot Jul 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For what it's worth, I think your for loop (lines 1572-1578) could be simplified to a single if statement:

if $Data(itemList(##class(SourceControl.Git.Settings.Document).#INTERNALNAME))

For me, the embedded-git-config.GSC index was at the very end of my list of files.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. I agree and have updated the branch to do this. I have added you as a co-author.

set sc = ##class(SourceControl.Git.Utils).ImportItem(internalName, force)

if $$$ISERR(sc) {
set ec = $$$ADDSC(ec, sc)
} else {
kill err, itemList
set err = 0

// Get the item list again as it may be different after just importing the config file
set ec = $$$ADDSC(ec, ..ListItemsInFiles(.itemList, .err))
}
quit
}
}
quit:'ec ec

kill files

set settings = ##class(SourceControl.Git.Settings).%New()
#dim internalName as %String = ""
for {
set internalName = $order(itemList(internalName))
quit:internalName=""

// Don't import the config file a second time
continue:internalName=##class(SourceControl.Git.Settings.Document).#INTERNALNAME

set context = ##class(SourceControl.Git.PackageManagerContext).ForInternalName(internalName)
continue:context.Package'=refPackage
set doImport = ..IsRoutineOutdated(internalName) || force
Expand Down
Loading