Re: [PATCH 11/16] revert_or_cherry_pick(): get oneline_body from get_oneline()
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Mar 18, 2010, 03:16 UTC
- Message-ID
- <20100318031638.GA18193@progeny.tock>
- In-Reply-To
- <780e0a6b1003171309k75b33d3cpb4b1c6370d67942f@mail.gmail.com>
Stephen Boyd wrote:
> Could all this code just use the custom format printing routines in > pretty.c? It might not be super efficient but at least it wouldn't > duplicate a bunch of code.
I like this idea, but I wasn’t able to pull it off. You see, cmd_revert() uses a few substrings from a single string it generates:
parent of ca87ef9... Do something very imporant ^ ^ ^ 1 2 3
These are put together like so:
For the commit message:
Subject: Revert "[3]Do something very important"
This reverts commit ca87ef90000000000000000000000000000000000.
For the conflict markers:
<<<<<<< HEAD Version from the tip of the current branch. ||||||| [2]ca87ef9... Do something very important Version from the commit to be reverted. ======= Version from the parent of the commit to be reverted. >>>>>>> [1]parent of ca87ef9... Do something very important
Nevertheless, investigating it did spur me to simplify this part of the series a little. I think the following two patches could replace patches 11, 13, 14, and 15 from this thread. I do not want to do any drastic refactoring without libifying this code, though, and that should wait for another series, I think.
Thanks for the feedback.
Jonathan Nieder (2): revert: clarify label on conflict hunks cherry-pick, revert: add a label for ancestor
builtin/revert.c | 129 +++++++++++++++++++++++---------------- t/t3507-cherry-pick-conflict.sh | 8 +- 2 files changed, 80 insertions(+), 57 deletions(-)