Skip to content

[Bug] Git panel hides uncommitted changes when project path is a symlink #322

Open

Description

@avinashkanaujiya

Describe the bug
OMPWeb's Git panel reports no changes when a project is opened through a directory symlink, although git status inside the same container reports modified tracked files.

To reproduce

  1. Have a Git repository at /projects/example with a modified tracked file.
  2. Create a directory symlink /workspace/example pointing to /projects/example.
  3. Open the project/session using /workspace/example and inspect the Git panel.
  4. Compare git -C /workspace/example status --short and git -C /workspace/example rev-parse --show-toplevel.

Expected behavior
Equivalent symlink and canonical project paths show the same modified files, while retaining path-boundary/access protections.

Actual behavior
The Git panel reports no changes. In the affected deployment Git reports five modified tracked files; a reproduction of the installed containment filter excludes all five.

Environment

  • OS: Debian 12 (Bookworm), Docker container on Linux x86-64
  • Node.js: 24.22.1
  • omp: 18.12.6
  • omp-web: @kahme247/ompweb 0.6.0
  • Browser: not captured; the filtering failure is reproducible server-side

Additional context
In installed lib/git-changes.ts, getGitStatus(cwd) obtains the canonical repository root using git rev-parse --show-toplevel, then filters status entries through:

.filter((entry) => isWithinPath(cwd, path.resolve(repositoryRoot, entry.path)))

isWithinPath uses lexical path.resolve / path.relative, not symlink canonicalization. With cwd=/workspace/example and repositoryRoot=/projects/example, a changed file resolves outside the lexical cwd and is discarded even though both paths identify the same repository. /api/git/status passes the requested cwd to this function.

Please normalize equivalent paths consistently across status and diff handling without weakening containment checks. A regression check could compare status results for a temporary repository opened through its canonical path and a symlink alias.

Opening the canonical path is a proposed workaround; I have not independently verified that workaround in the rendered UI. No screenshots attached. Paths above are sanitized examples.

Activity

  1. anhnt256 commented on Nov 10, 2026

    @anhnt256
    Contributor

    I'll fix this — isWithinPath will compare canonicalized paths (fs.realpathSync, with a lexical fallback for missing paths), so a project opened through a symlink compares equal to the repo root git reports and its changes show up again. Opening a PR with the fix plus a regression test that opens a repo through a directory symlink.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions