5

I tried make git hooks on Windows to do automatically convert unix symlinks located in repository to hardlinks+junctions windows on local machine. How I may do this? We use a mix of Windows and Unix based OS's.

I extended Git's command list like this Git Symlinks in Windows

I read about hooks and created post-checkout hook:

#!/bin/sh
exec git rm-symlinks

It works, when I execute git checkout #branch_with_symlink, but when I do next checkout, git wrote:

error: Your local changes to the following files would be overwritten by checkout:
#path_to_symlink
Please, commit your changes or stash them before you can switch branches.

git status:

# On branch #branch_with_symlink
nothing to commit, working directory clean

git haven't pre-checkout hook, and I don't understand, how i make this convertion

Community
  • 1
  • 1
  • 1
    I have the same problem (same error that doesn't let me switch branch even if there are no changes). The difference with you is that I created the Junction points manually (in Windows 8). It seems there is a problem with git. If you find a solution please share it. – Durden81 Apr 23 '14 at 09:37

1 Answers1

1

Rather than using a hook, you could try using a smudge filter. They're more designed to change the content of text files than of symlinks, but I think you could get them to work.

Some documentation here: http://git-scm.com/docs/gitattributes#__code_filter_code

Andrew Aylett
  • 39,182
  • 5
  • 68
  • 95