[cmake-developers] Alternate if() without implicit variable expansion

Brad King brad.king at kitware.com
Thu Sep 11 09:28:28 EDT 2014


On 09/11/2014 09:20 AM, Nils Gladitz wrote:
> Is there a trick to recreate the history in that order or
> would I have to start from scratch?

First rewrite the branch to squash your updates back into
the first commit, leaving all my CMP0054 warning commits
later in the topic.  Then start a new branch from the
squashed commit containing only your part of the changes.
Note the sha1 of this commit, say a01b2c3.  Then edit it
to *remove* the changes besides the refactoring and amend
the commit.  The result should be just one commit with the
refactoring parts.

Then you can use the "git commit-tree" plumbing to create
a commit with the tree object of your original change but
set its parent as the edited commit.  This will manufacture
a commit that makes the changes on top of the refactoring:

 commit=$(git commit-tree a01b2c3^{tree} -p HEAD)
 git merge $commit
 git commit --amend -C a01b2c3

Finally, rebase the rest of the topic back onto that.
The tip of the resulting topic should look identical to
what is on the stage now.

Thanks,
-Brad




More information about the cmake-developers mailing list