Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Absolute target in symlinks lead to dirty repo #1017

Open
@sttts

Description

@sttts

Commit a symlink with an absolute path (e.g./usr/bin/vim) to a repo. The worktree is always considered dirty.

This is why:

  • go-git uses go-billy's chroot filesystem wrapper to abstract the worktree.
  • go-billy rewrites the symlink target path in symlink.ReadLink https://github.com/src-d/go-billy/blob/83cf655d40b15b427014d7875d10850f96edba14/helper/chroot/chroot.go#L195 (it is unclear why the logic in there is as it is: why should an absolute path be made relative and then prefixed with /?)
  • go-git computes the symlink file hash over the returned target path. This path is different after upper mangling than the symlink target path hash of the index.
  • go-git thinks the worktree is dirty.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions