gdb/generate-git-repo-from-patches.sh
Sergio Durigan Junior a8767b37e5 8.0.50.20171204-34.fc26
- chmod +x on the generate-*.sh script.s
- Remove references to gdb-8.0.1 from 'sources' and '.gitignore'.
- Regenerate first line of the patches (remove commit hash).
- Fix empty Source line.
2017-12-10 17:00:49 -05:00

43 lines
854 B
Bash
Executable File

#!/bin/sh
# Generic function to print an error message and bail out.
die ()
{
echo $1 > /dev/stderr
exit 1
}
# Print usage
usage ()
{
cat <<EOF
$0 -- Generate a git repository from .patch files
Usage:
$0 <REPOSITORY>
<REPOSITORY> is the directory where the rebase was performed. You
need to clone the repository first.
Options are:
-h: Print this message
EOF
exit 0
}
test -f gdb.spec || die "This script needs to run from the same directory as gdb.spec."
test -z $1 && die "You need to specify the repository."
test "$1" = "-h" && usage
test -f _git_upstream_commit || die "Cannot find _git_upstream_commit file."
test -f _patch_order || die "Cannot find _patch_order file."
last_ancestor_commit=`cat _git_upstream_commit`
cd $1
git checkout $last_ancestor_commit
for p in `cat ../_patch_order` ; do
git am ../$p
done