Question

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

Était-ce utile?

La solution

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

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top