You need to define custom merge and reverse options in the git configuration, and then use the attributes to link them to the files.
It just makes it easy to merge text in landfills, so it could very well produce complete nonsense. You absolutely must check his work to make sure that he has done the right thing. . However, if you lose your boredom, you can easily get rid of simple mergers.
In your .git / config:
[merge "sqlite3"] name = sqlite3 merge driver driver = merge-sqlite3 %O %A %B [diff "sqlite3"] name = sqlite3 diff driver command = diff-sqlite3
in .gitattributes:
signons.sqlite diff=sqlite3 merge=sqlite3
And somewhere in your path called diff-sqlite3
#!/usr/bin/perl -w use File::Temp qw/ :POSIX /; use IPC::Run qw/run/ ; @ARGV == 7 or die sprintf 'wtf %s', join(' ', @ARGV); my ($name, $x, $y) = ($ARGV[0], $ARGV[1], $ARGV[4]); my ($a, $b); eval { $a = tmpnam(); $b = tmpnam(); run ['sqlite3', $x, '.dump'], '>', $a or die 'sqlite3 failed'; run ['sqlite3', $y, '.dump'], '>', $b or die 'sqlite3 failed'; print "diff-sqlite3 a/$name b/$name\n"; run ['diff', '-u', $a, $b, '--label', "a/$name", '--label', "b/$name"], '>', \*STDOUT; unlink $a; unlink $b; 1; } or do { unlink $a if defined $a; unlink $b if defined $b; die $@ ; }
also in your path with the name merge-sqlite3
#!/usr/bin/perl -w use File::Temp qw/ :POSIX /; use IPC::Run qw/run/ ; @ARGV == 3 or die sprintf 'wtf %s', join(' ', @ARGV); my ($o, $a, $b) = @ARGV; print "MERGEING SQLITE FILES $o $a $b\n"; eval { $ad = tmpnam(); $bd = tmpnam(); $od = tmpnam(); run ['sqlite3', $o, '.dump'], '>', $od or die 'sqlite3 failed'; run ['sqlite3', $a, '.dump'], '>', $ad or die 'sqlite3 failed'; run ['sqlite3', $b, '.dump'], '>', $bd or die 'sqlite3 failed'; run ['merge', $ad, $od, $bd] or do { my $newname = "$a.dump"; my $n = 0; while (-e $newname) { ++$n; $newname = "$a.dump.$n"; } print "merge failed, saving dump in $newname\n"; rename $ad, $newname; undef $ad; die 'merge failed'; }; unlink $a or die $!; my $err; run ['sqlite3', $a], '>', \*STDOUT, '2>', \$err, '<', $ad; if ('' ne $err) { print STDERR $err; die 'sqlite3 failed'; } unlink $ad if defined $ad; unlink $bd; unlink $od; 1; } or do { unlink $ad if defined $ad; unlink $bd if defined $bd; unlink $od if defined $od; die $@ ; }
I just hacked them right now, now you may have to smooth out the kinks.
see http://git-scm.com/docs/gitattributes and http://git-scm.com/docs/git-config