git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Jeff King <peff@peff.net>
Cc: skimo@liacs.nl, git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH 4/4] Add git-rewrite-commits
Date: Mon, 9 Jul 2007 14:16:19 +0100 (BST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0707091409480.5546@racer.site> (raw)
In-Reply-To: <20070709123626.GC23494@sigill.intra.peff.net>

Hi,

On Mon, 9 Jul 2007, Jeff King wrote:

> 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.

Yep.  Fully intended.

> 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.

Granted.  It is a really nice idea, but again you lack the map function.

> 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).

Of course, you miss out the merge commits.

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

Not so bad.  What you describe as possibly inefficient has been 
implemented very, very efficiently already: git-fast-import!

So your idea brings me to another idea: Why not write git-fast-export?  
Actually, let's not all it that, since repo.or.cz has that name already 
(curiously enough, it is used for scripts exporting from _other_ SCMs, 
feeding to git-fast-import...), but git-fast-dump.

The output should be _exactly_ as expected by git-fast-import, so that 
"git fast-dump | git fast-import" would be a nop, data-wise.

Of course, there is a more fundamental problem with that approach: how to 
act on the commit message, conditional on the commit header?  I know, with 
perl it would be really easy.  But then you have to write a complete perl 
script, and the whole purpose of this 
admin-rewritehist/filter-branch/rewrite-commits frackass is that it should 
be _easy_ to use.

Ciao,
Dscho

      reply	other threads:[~2007-07-09 13:24 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-08 16:23 [PATCH 0/4] Add git-rewrite-commits skimo
2007-07-08 16:23 ` [PATCH 1/4] export get_short_sha1 skimo
2007-07-08 16:23 ` [PATCH 2/4] export add_ref_decoration skimo
2007-07-08 16:23 ` [PATCH 3/4] revision: mark commits that didn't match a pattern for later use skimo
2007-07-08 16:23 ` [PATCH 4/4] Add git-rewrite-commits skimo
2007-07-08 16:37   ` Johannes Schindelin
2007-07-08 17:30     ` Sven Verdoolaege
2007-07-08 18:17       ` Johannes Schindelin
2007-07-08 19:11         ` Sven Verdoolaege
2007-07-08 18:04     ` Steven Grimm
2007-07-08 18:15       ` Sven Verdoolaege
2007-07-08 18:41       ` Johannes Schindelin
2007-07-08 21:10         ` Sven Verdoolaege
2007-07-09  9:01           ` Johannes Sixt
2007-07-09  9:48             ` Sven Verdoolaege
2007-07-09 11:57             ` Johannes Schindelin
2007-07-08 23:56   ` Johannes Schindelin
2007-07-09  9:47     ` Sven Verdoolaege
2007-07-09 12:57       ` Johannes Schindelin
2007-07-09 13:49         ` Sven Verdoolaege
2007-07-09 14:11           ` Johannes Schindelin
2007-07-09 14:42             ` Sven Verdoolaege
2007-07-09 14:59               ` Johannes Schindelin
2007-07-09 12:36     ` Jeff King
2007-07-09 13:16       ` Johannes Schindelin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.0707091409480.5546@racer.site \
    --to=johannes.schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --cc=skimo@liacs.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).