# HG changeset patch # User Jan Nieuwenhuizen # Date 1253778982 -7200 # Node ID 72f8f8091b035d16a4a405d83f1b4c9097880650 # Parent e31edefcd33ffc9500613fed444813979bb9e908 repository.Git: avoid gratuitous reset --hard. Fixes lilypond rebuilds. Unlike git checkout which makes a point of documenting the importance of preserving/updating timestamps, git reset --hard blindly destroys all timestamps on not-modified files. This breaks configure-up-to-date checks, notably lilypond's. See http://lists.gnu.org/archive/html/lilypond-devel/2009-08/msg00488.html diff -r e31edefcd33f -r 72f8f8091b03 gub/repository.py --- a/gub/repository.py Tue Sep 22 12:21:04 2009 +0100 +++ b/gub/repository.py Thu Sep 24 09:56:22 2009 +0200 @@ -658,17 +658,16 @@ def _update_workdir_shallow (self, destdir): branch = self.branch # branch is empty? branch = 'master' + HEAD = self.checksum () if not os.path.isdir (os.path.join (destdir, self.vc_system)): self.system ('mkdir -p %(destdir)s' % locals ()) self.system ('cd %(destdir)s && git init' % locals ()) - open ('%(destdir)s/.git/objects/info/alternates' % locals (), 'w').write (os.path.join (self.dir, 'objects')) - if 0: # no-go - open ('%(destdir)s/.git/HEAD' % locals (), 'w').write (self.checksum ()) - HEAD = 'HEAD' - HEAD = self.checksum () - self.system ('cd %(destdir)s && git reset --hard %(HEAD)s' % locals ()) - self.system ('cd %(destdir)s && (git checkout -f %(branch)s || git branch %(branch)s)' % locals ()) - self.system ('cd %(destdir)s && git reset --hard %(HEAD)s' % locals ()) + open ('%(destdir)s/.git/objects/info/alternates' % locals (), 'w').write (os.path.join (self.dir, 'objects')) +# self.system ('cd %(destdir)s && git reset --hard %(HEAD)s' % locals ()) + if self.git_pipe ('diff' % locals (), dir=destdir): + self.system ('cd %(destdir)s && git reset --hard %(HEAD)s' % locals ()) + self.system ('cd %(destdir)s && git checkout %(HEAD)s' % locals ()) + self.system ('cd %(destdir)s && (git checkout %(branch)s || git checkout -b %(branch)s)' % locals ()) def _update_workdir (self, destdir): checkout_dir = self.dir branch = self.get_ref ()