Make generate-patches-from-git-repo.sh use "_git_upstream_commit" instead of "origin/master" for "git merge-base".

This commit is contained in:
Sergio Durigan Junior 2018-02-05 13:01:55 -05:00
parent 4a848ebc38
commit 82f299dd3b
2 changed files with 18 additions and 6 deletions

View File

@ -94,3 +94,12 @@ control files. These control files are:
- _git_upstream_commit: This file contains the last upstream commit - _git_upstream_commit: This file contains the last upstream commit
against which the patches were rebased. It is used when importing against which the patches were rebased. It is used when importing
the patches into the git repository. the patches into the git repository.
NOTE: If you did a rebase against a newer upstream version, you need
to specify the commit/tag/branch against which you rebased:
$ sh generate-patches-from-git-repo.sh <REPOSITORY_DIR> <COMMIT_OR_TAG_OR_BRANCH>
For example, if you rebased against "gdb-8.1-release":
$ sh generate-patches-from-git-repo.sh <REPOSITORY_DIR> gdb-8.1-release

View File

@ -14,14 +14,15 @@ usage ()
$0 -- Generate .patch files for a RPM package from a git repository $0 -- Generate .patch files for a RPM package from a git repository
Usage: Usage:
$0 <REPOSITORY> [<COMMIT_OR_TAG>] $0 <REPOSITORY> [<COMMIT_OR_TAG_OR_BRANCH>]
<REPOSITORY> is the directory where the rebase was performed. <REPOSITORY> is the directory where the rebase was performed.
<COMMIT_OR_TAG> is the commit or tag against which the rebase was <COMMIT_OR_TAG_OR_BRANCH> is the commit or tag or branch against which
performed. It is optional, and if not provided "origin/master" will the rebase was performed. It generally just needs to be provided if
be used. This script will then use 'git merge-base' to find the most the file "_git_upstream_commit" doesn't exist, or if you are doing a
recent common ancestor between HEAD and COMMIT_OR_TAG. rebase. This script will then use 'git merge-base' to find the most
recent common ancestor between HEAD and COMMIT_OR_TAG_OR_BRANCH.
Options are: Options are:
@ -35,11 +36,13 @@ test -f gdb.spec || die "This script needs to run from the same directory as gdb
test -z $1 && die "You need to specify the repository." test -z $1 && die "You need to specify the repository."
test "$1" = "-h" && usage test "$1" = "-h" && usage
commit_or_tag="origin/master" commit_or_tag="`cat _git_upstream_commit`"
if test ! -z "$2" ; then if test ! -z "$2" ; then
commit_or_tag="$2" commit_or_tag="$2"
fi fi
test -z $commit_or_tag && die "Because the '_git_upstream_commit' file doesn't exist, you need to specify a commit/tag/branch."
test -d $1 || die "$1 is not a directory." test -d $1 || die "$1 is not a directory."
# Remove all the current patches # Remove all the current patches