3

I keep most of my home directory's dot files under revision control, so that I can easily move changes between any of the five or so desktop machines and dozens of servers that I use. Unfortunately, my ~/.gconf directory is a bit of a pain when it comes to this, because gconfd seems to really like making arbitrary whitespace changes and, worse yet, updating the mtime="..." attributes on entries that it hasn't changed.

Has anybody any thoughts on good ways to deal with this? I would prefer never to have to commit whitespace changes or time changes when a value hasn't changed, so that I can easily track my diffs over time.

cjs
  • 1,424

2 Answers2

3

Instead of storing the directory in git, did you try to store a dump?

 gconftool-2 --dump /
ko-dos
  • 1,397
2

I currently examine only the real differences by using a diff program that ignores the mtime and whitespace changes:

#!/usr/bin/env ruby

require 'tempfile'

input2 = ARGV.pop || (
    $stderr.puts("Usage: gconf-diff [opts] <file> <file>")
    exit(1)
)
input1 = ARGV.pop

UNWANTED_PAT = /mtime="\d+"/

def copy_tmp(id, path)
    t = Tempfile.new("gconf-diff-#{id}-")
    File.open(path).each { |line| t.write(line.gsub(UNWANTED_PAT, '')) }
    t.close
    t
end
t1 = copy_tmp('1', input1)
t2 = copy_tmp('2', input2)

system('diff', *(ARGV + ['-B', '-b', t1.path, t2.path]))
exit($?.exitstatus)

I have subversion use this by running svn diff --diff-cmd gconf-diff .... I revert files that have no significant changes. However, this is a bit awkward, and doesn't deal well with files where only one or two items have changed, but a dozen others have new timestamps, as all of those changes are still committed.

cjs
  • 1,424