On Wed, Feb 27, 2013 at 05:46:57PM -0800, Brian Dolbec wrote:
> There are several more bugfixes I feel shuld be applied to master if
> you intend on releasing a bug fix version bump.  They will have to
> be applied manually since the file names and locations have changed
> in the rewrite.

Git records abbreviated blob SHAs in the diff:

  diff --git a/ChangeLog b/ChangeLog
  index 893cfec..12b41f2 100644
  --- a/ChangeLog
  +++ b/ChangeLog

which it can use to apply patches to files, even if the patched blobs
have been renamed in a separate commit.  You have to use the `--3way`
option with `git am` to turn this functionality on, though.  For
example:

  $ mkdir test-repo
  $ cd test-repo
  $ git init
  $ echo 'hello world' > README
  $ git add README
  $ git commit -m 'README: create with dummy content'
  $ git mv README{,-b}
  $ git commit -am 'README-b: moved from README'
  $ echo 'goodbye world' >> README-b
  $ git commit -am 'README: edited'
  $ git format-patch HEAD^
  $ git reset --hard HEAD^^
  $ git am -3 *patch

Works (even though we reset to before the rename), as we can see with:

  $ git --no-pager log --oneline
  c587719 README: edited
  ee5ec97 README: create with dummy content
  $ cat README
  hello world
  goodbye world

However, the fact that Git *can* apply patches like this doesn't mean
that it's a good idea ;).

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to