Skip to content

Conversation

@raymond-rebbeck
Copy link
Contributor

This is another case of what was fixed in #758

The GetStatus method of SourceControl.Git.Extension can remove deleted items from the uncommitted queue. This can make the deleted items show up as being owned by an 'undefined' user in the workspace view.

This has occurred for me in both Studio and VS Code.

set Editable=1, IsCheckedOut=0, UserCheckedOut=""
if ##class(SourceControl.Git.Change).IsUncommitted(filename){
if ##class(SourceControl.Git.Change).IsUncommitted(filename)
&& '('$data(files(InternalName)) && $data($$$TrackedItems(##class(%Studio.SourceControl.Interface).normalizeName(InternalName)))) {
Copy link
Contributor

@cambot cambot Jul 24, 2025

Choose a reason for hiding this comment

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

Are these single quotes here by accident? && '('$data( ...

I think this should just be && ($data( ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They are not by accident. I think that I have the condition right here though it is confusing and there may be something that I'm missing.

When I delete something and trigger this logic I get:

  • A: ##class(SourceControl.Git.Change).IsUncommitted(filename) = 1
  • B: $data(files(InternalName)) = 0
  • C: $data($$$TrackedItems(##class(%Studio.SourceControl.Interface).normalizeName(InternalName))) = 1

So in order to not proceed onto RemoveUncommitted which seems to cause the 'undefined user' issue. I want:
A && '('B && C)

I believe this could be simplified to A && (B || 'C). At the time it seemed reasonable to have the same condition as what is used in #758 and to just negate the whole thing.

Copy link
Contributor

@cambot cambot Jul 25, 2025

Choose a reason for hiding this comment

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

OH dear. I had been jumping between languages and erroneously read those as single string quotes instead of logical negations. My mistake. I think your logic is correct.

That said, one pattern I like to follow is that when conditional statements grow to a point where they get hard to mentally parse, I will extract one or more of the conditions into a well named ClassMethod that makes the conditional much easier to read. (so you'd end up with something like if .IsUncommitted(filename) && .IsUntracked(InternalName, .files).) Side benefit: I find class methods like this are relatively easy to unit test when you pass in everything it needs.

I see this more as a nice to have refactoring at this point. 100% up to you if you want to leave this as-is or make further changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All good and not a bad idea for me to double check my thinking with the condition anyway.

Re-factoring is a fantastic idea, I've made another commit that does this.

@raymond-rebbeck raymond-rebbeck force-pushed the fix-delete-undefined-user branch from 745f275 to 397a0b8 Compare July 28, 2025 21:39
Copy link
Collaborator

@isc-pbarton isc-pbarton left a comment

Choose a reason for hiding this comment

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

Looks good! Added changelog entry and will merge.

@isc-pbarton isc-pbarton merged commit dfe5d77 into intersystems:main Jul 29, 2025
1 check passed
@raymond-rebbeck raymond-rebbeck deleted the fix-delete-undefined-user branch September 11, 2025 12:36
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 this pull request may close these issues.

3 participants