Skip to content

Symlinks pointing outside repository are mangled with PlainOpen #1155

@nf-brentsaner

Description

@nf-brentsaner

See here for fix: #253 (comment)

I need to commit symlinks that are intentionally pointed outside the repository.

For example:

# git diff X11/fontpath.d/liberation-sans-fonts
diff --git a/X11/fontpath.d/liberation-sans-fonts b/X11/fontpath.d/liberation-sans-fonts
index 0e445f8..0a9a11f 120000
--- a/X11/fontpath.d/liberation-sans-fonts
+++ b/X11/fontpath.d/liberation-sans-fonts
@@ -1 +1 @@
-/../usr/share/fonts/liberation-sans
\ No newline at end of file
+/usr/share/fonts/liberation-sans
\ No newline at end of file
# ls -l X11/fontpath.d/liberation-sans-fonts
lrwxrwxrwx. 1 root root 32 Apr  1 20:59 X11/fontpath.d/liberation-sans-fonts -> /usr/share/fonts/liberation-sans

git properly commits this as-is, but go-git mangles it to an absolute path in the commit - THUS even after a commit, the worktree is always dirty because the commit created by go-git does not contain the proper content that reflects the real 'contents'.

This leads to broken status in addition to an inaccurate/incorrect commit's file contents.

Metadata

Metadata

Assignees

No one assigned

    Labels

    no-autocloseIssues/PRs to be ignored by stale bot

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions