On Wed, 16 May 2012 14:33:03 -0500 Nick Anderson <n...@cmdln.org> wrote: 

NA> On 05/16/2012 02:28 PM, no-re...@cfengine.com wrote:
>> bundle agent git_master
>> {
>> commands:
>> "/usr/bin/git pull origin"
>> comment =>  "Update /repo from git repository",
>> contain =>  silent_in_dir("/repo");
>> }

NA> What happens if some cowboy came in and manually twiddled and changed 
NA> files in /repo. Your git pull would not work correct? What commands 
NA> would you run to deal with that?

I'd love to see native pluggable CFEngine support for VCS pulls, like it
has for package management.

That being said, I posted this already some time ago; here's the command
sequence that should get you a clean Git pull:

1) test for .git/ and either clone or...

2) copy .git/config from a known good location, then:

git clean -f -f -x -q -d .
git reset -q --hard HEAD
git checkout $branch
git pull -q -s recursive -Xtheirs origin $branch
git reset -q --hard HEAD

That sequence takes care of many weird cases and lets you provide a
different branch every time (pulling just "master" is probably not what
you want).  Hope that helps :)

Ted
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to