Re: [PATCH 6/6] Add git-rewrite-commits
- From
- Sven Verdoolaege <skimo@kotnet.org>
- Date
- Jul 16, 2007, 20:04 UTC
- Message-ID
- <20070716200404.GT999MdfPADPa@greensroom.kotnet.org>
- In-Reply-To
- <Pine.LNX.4.64.0707160054340.14781@racer.site>
On Mon, Jul 16, 2007 at 01:38:11AM +0100, Johannes Schindelin wrote:
> Didn't I mention that it was a severe limitation to think of the sha1 > mapping of a 1-to-1 mapping? Think of it more as a relation.
The mapping is used in several operations. First, there are several things that can happen to a commit
- it's pruned. This includes, for me, path pruning, matching and a commit filter returning no SHA1s. - it's rewritten to another commit that can be considered the "moral equivalent" of that commit. This occurs when a commit is not pruned, but something else happened to the commit itself or one of its ancestors. This excludes, for me, the case where a commit filter returns more than one SHA1. - it's replaced by more than one SHA1. This can only happen in a commit filter.
There are at least four operations in which this mapping is used:
- if the parents of a commit have been rewritten to one or more
commits, then they are replaced by the new commits.
If any parent has been pruned, then it is replaced by
the result of applying this operation on _its_ parents.
- any reference (in refs/) that points to a rewritten or pruned
commit is removed and
* if the commit was rewritten to a single commit, then it is
replaced by this commit
* otherwise, there is no moral equivalent single commit, but
we want to ensure we can still access the new commits, so
I create several references, either to each of the many
commits the old commit was rewritten to, or to each of
its nearest unpruned ancestors (i.e., the same set as
described in the previous operation).
- a SHA1 of a commit that appears in a commit message is replaced
by the rewritten commit iff it was rewritten to a single commit.
That is, if the commit was pruned or rewritten (through a commit
filter to more than one commit), then the SHA1 is left alone.
- the mapping available to filters
* if the commit was pruned, an empty file is created
* otherwise a file is created containing all rewritten SHA1sI understand you want the second operation to only apply to refs explicitly mentioned on the command line. What else would you like to change?
skimo