Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git hooks for symlink convertion on Windows

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

like image 641
CekacBTym6oke Avatar asked Nov 10 '22 10:11

CekacBTym6oke


1 Answers

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

like image 53
Andrew Aylett Avatar answered Nov 15 '22 06:11

Andrew Aylett