Re: [PATCH 4/4] Add git-rewrite-commits

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 09, 2007 at 12:56:04AM +0100, Johannes Schindelin wrote:

> But hey, maybe it _is_ time to rethink the whole filter business, and 
> introduce some kind of regular expression based action language. Something 
> like
> 
> 	git rewrite-commits -e '/^author Darl McBribe/skip-commit' \
> 		-e 'substitute/^author Joahnnes/author Johannes/header' \
> 		-e 'substitute/poreclain/porcelain/body' \
> 		-e 'rewrite-commit-names'

This is starting to look an awful lot like sed. Which is good, but I
wonder if we can get sed to do the heavy lifting. I have had success
with similar systems by writing the data structure out into a canonical
format, editing it as text, and then "applying" the result.

Something like:
  git rewrite-generate oldbranch |
    sed 's/^author Darl McBribe/skip-commit/'
    sed 's/^author Joahnnes/author Johannes/' |
    git-rewrite-commit-names |
    git rewrite-apply newbranch

where git-rewrite-generate would generate something like git-log output,
and git-rewrite-apply would, given a log-ish input, write a new history
branch. A nice advantage is that it makes things like this very natural:
  git rewrite-generate oldbranch >history
  vi history
  git rewrite-apply newbranch <history

which allows interactive editing.

Of course, this is:
  - possibly inefficient, since rewrite-apply doesn't know what you
    changed and what you didn't change; it would have to recalculate
    a lot of sha1 hashes.
  - doesn't really deal with actual tree rewriting, unless there is some
    canonical text format for that, and then we are talking about making
    things _really_ inefficient

Hmm. Which makes me think that maybe 'git-format-patch' is really
git-rewrite-generate, and 'git-am' is really git-rewrite-apply (but with
some extensions to preserve committer info).

So maybe a bad idea, but I thought I would throw it out there.

-Peff
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux