When a git cherry-pick fails because of a conflict, it can be resolved and committed. The reviewer is reminded that a conflict had to be resolved by the Conflicts section at the end of the message body:
commit 7b8e5c99a4a40ae788ad29e36b0d714f529b12eb Author: John SprayDate: Tue May 20 16:25:19 2014 +0100 ... Signed-off-by: John Spray (cherry picked from commit 1d9e4ac2e2bedfd40ee2d91a4a6098150af9b5df) Conflicts: src/crush/CrushWrapper.h
The difference between the original commit and the cherry-picked commit including the conflict resolution can be displayed with:
commit=7b8e5c99a4a40ae788ad29e36b0d714f529b12eb picked_from=$(git show --no-patch --pretty=%b $commit | perl -ne 'print if(s/.*cherry picked from commit (\w+).*/$1/)') diff -u --ignore-matching-lines '^[^+-]' \ <(git show $picked_from) <(git show $commit)
The SHA of the original commit is extracted from the cherry picked commit message. The diff compares the lines removed and lines added (i.e. only those starting with + or -). It gets rid of the noise introduced by the hunks boundaries starting with @@ or the commit message body that are not significant. It will display something like:
--- /dev/fd/63 2015-02-13 13:27:08.612683558 +0100 +++ /dev/fd/62 2015-02-13 13:27:08.616683527 +0100 @@ -62,13 +57,24 @@ } diff --git a/src/crush/CrushWrapper.h b/src/crush/CrushWrapper.h -index 0113662..282cbeb 100644 +index 3b2e6e6..0a633a5 100644 --- a/src/crush/CrushWrapper.h +++ b/src/crush/CrushWrapper.h -@@ -874,6 +874,25 @@ public: - return false; +@@ -863,6 +863,36 @@ public: + if (!crush) return -1; + return crush_find_rule(crush, ruleset, type, size); } - ++ ++ bool ruleset_exists(int const ruleset) const { ++ for (size_t i = 0; i < crush->max_rules; ++i) { ++ if (crush->rules[i]->mask.ruleset == ruleset) { ++ return true; ++ } ++ } ++ ++ return false; ++ } ++ + /** + * Return the lowest numbered ruleset of type `type` + *
It may be difficult to read if the conflict resolution involves a lot of changes. The interdiff(1) command may be useful in this case.