From cd48d198367b044fee356bd0137aefe1f56bb878 Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Mon, 24 Oct 2016 11:54:45 +0200 Subject: Rename and move util/gitconfig/rebase.sh It has nothing to do with git configuration, but is one of our convenience scripts. It also has nothing to do with rebases (except that it can be comfortably used through git rebase --exec) Change-Id: Icc60c4de486a0027fe2230e93b441e62ba022193 Signed-off-by: Patrick Georgi Reviewed-on: https://review.coreboot.org/17101 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth Reviewed-by: Paul Menzel --- util/gitconfig/rebase.sh | 47 -------------------------------------- util/scripts/cross-repo-cherrypick | 47 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 47 deletions(-) delete mode 100755 util/gitconfig/rebase.sh create mode 100755 util/scripts/cross-repo-cherrypick diff --git a/util/gitconfig/rebase.sh b/util/gitconfig/rebase.sh deleted file mode 100755 index 4b098c199c..0000000000 --- a/util/gitconfig/rebase.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/sh - -# rebase.sh - rebase helper script -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# - -# Adapt to your remote branch: -BRANCH="cros/chromeos-2016.05" - -# When pulling in patches from another tree from a gerrit repository, -# do the following at the end of a larger cherry-pick series: -# git remote add ... -# git checkout -b upstreaming -# git cherry-pick ... -# git rebase -i --exec util/gitconfig/rebase.sh master -# Alternatively, you can run util/gitconfig/rebase.sh after every -# individual cherry-pick. - -commit_message() { - git log -n 1 | grep "^ " | cut -c5- -} - -CHID=$( commit_message | grep -i "^Change-Id: I" ) -CID=$( git log -n1 --grep "^$CHID$" --pretty=%H $BRANCH ) -GUID="$(git config user.name) <$(git config user.email)>" - -# TBD: Don't add Original- to empty lines, and possibly make script more -# solid for commits with an unexpected order of meta data lines. - -commit_message | tac | awk '/^$/ { - if (end==0) - print "Original-Commit-Id: '"$CID"'\nSigned-off-by: '"$GUID"'"; - end=1 - }; { - if (end==0) - print "Original-" $0; - else - print $0; - }' | tac | git commit --amend -F - diff --git a/util/scripts/cross-repo-cherrypick b/util/scripts/cross-repo-cherrypick new file mode 100755 index 0000000000..4b098c199c --- /dev/null +++ b/util/scripts/cross-repo-cherrypick @@ -0,0 +1,47 @@ +#!/bin/sh + +# rebase.sh - rebase helper script +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# + +# Adapt to your remote branch: +BRANCH="cros/chromeos-2016.05" + +# When pulling in patches from another tree from a gerrit repository, +# do the following at the end of a larger cherry-pick series: +# git remote add ... +# git checkout -b upstreaming +# git cherry-pick ... +# git rebase -i --exec util/gitconfig/rebase.sh master +# Alternatively, you can run util/gitconfig/rebase.sh after every +# individual cherry-pick. + +commit_message() { + git log -n 1 | grep "^ " | cut -c5- +} + +CHID=$( commit_message | grep -i "^Change-Id: I" ) +CID=$( git log -n1 --grep "^$CHID$" --pretty=%H $BRANCH ) +GUID="$(git config user.name) <$(git config user.email)>" + +# TBD: Don't add Original- to empty lines, and possibly make script more +# solid for commits with an unexpected order of meta data lines. + +commit_message | tac | awk '/^$/ { + if (end==0) + print "Original-Commit-Id: '"$CID"'\nSigned-off-by: '"$GUID"'"; + end=1 + }; { + if (end==0) + print "Original-" $0; + else + print $0; + }' | tac | git commit --amend -F - -- cgit v1.2.3