On 10-Sep-15, Manuel Ortega wrote:
> In the case of mercurial, there's no need to make branches or merges in order 
> to solve this problem.  Just add the following to
> $REPO/.hg/hgrc:
> 
> [hooks]
> pre-status = hg revert runtime/doc/tags
> pre-update = hg revert runtime/doc/tags
> pre-pull   = hg revert runtime/doc/tags
> 
> I'm about to investigate whether (a) something similar can done in git, and 
> (b) if the answer is yes, whether Bram can set it in
> the GitHub repo and have it percolate down to all of us.

I don't think that git has *hooks* for 'git pull' or 'git merge' that
can affect the outcome of the merge (githooks(1)).  Also, hooks live
below .git/hooks/, which is not transmitted between repositories.

But git offers custom merge drivers for this purpose.

    
http://stackoverflow.com/questions/27920526/merge-strategy-in-gitattributes-not-working

The merge driver itself needs to be defined in the local repository and
lives in .git/config or ~/.gitconfig (when "--global" is used):

    git config [--global] merge.theirs.name "always copy their version during 
merge"
    git config [--global] merge.theirs.driver "cp -f %B %A"

The driver can then be used for merging "runtime/doc/tags".  As the
driver is only defined for the local repository, this setting should
also be done locally:

    echo "runtime/doc/tags merge=theirs" >> $(git rev-parse 
--show-toplevel)/.git/info/attributes

That should be all, but I did not test it.

Note that the above line can alternatively be added to .gitattributes,
which is transferred to other repositories.  But the definition of a
merge driver is local to each repository, so this is not useful and
leads to merge errors when the driver is not defined.

Merge drivers and hook scripts are not transferred between repositories
to prevent users from pushing malicious scripts to all other users.

-- 
Olaf Dabrunz (oda <at> fctrace.org)

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui