Skip to content

Conversation

@juliabeliaeva
Copy link
Contributor

This PR provides fixes for the following issues:

  1. Highlighting of the new file that was just committed
  2. Highlighting of the new file that was just unstaged

The causes of both issues are related:

  1. Base content for the file can be loaded when statuses in the GitStageTracker are not up-to-date.
  2. Refresh of the base content was not always triggered when necessary.

More details are in commit descriptions.

For untracked files, GitStageLineStatusTrackerProvider#loadContent normally returns null.
However, for added files empty TrackedContent instances are created. If such a file becomes unstaged, loadContent is not invoked again because the HEAD position is unchanged, leaving stale editor highlighting in place.

This commit prevents base content from being created for untracked files, avoiding incorrect highlighting.

IJPL-225212
…fter committing new file

After a commit, GitStageLineStatusTrackerProvider#loadContent may be invoked while GitStageTracker statuses are not up-to-date yet. In particular, after committing a new file, its status can temporarily remain added, causing loadContent to return empty content. Once the status is refreshed, loadContent is not called again because the HEAD position has not changed, leaving base content outdated.

This commit includes the file status in ContentInfo so that status changes can trigger a loadContent call.

IJPL-181327
…aded for unchanged files

When an added file becomes untracked again, it may be briefly reported as unchanged because GitUntrackedFilesHolder and GitStagingAreaHolder are refreshed independently. During this period GitStageLineStatusTrackerProvider can try to load base content and report a warning.

This commit logs the condition at debug level instead to avoid polluting log files.
@juliabeliaeva
Copy link
Contributor Author

juliabeliaeva commented Dec 22, 2025

JFYI: if these commits are applied, mind the commit message: git can trim the "[git-index]" prefix from the message when applying a patch.

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.

2 participants