]> git.wh0rd.org - home.git/blobdiff - .bin/git-format-request-pull
test.cc: new C++ test
[home.git] / .bin / git-format-request-pull
index 73cf165cd999bdf20e99f37a66fd2fb67f5eb007..f03345b7143f331e7c4f569a10fb36b44c72bc7c 100755 (executable)
@@ -6,11 +6,13 @@ usage() {
 }
 
 auto=false
-eval set -- `getopt -- eh "$@"`
+force=false
+eval set -- `getopt -- efh "$@"`
 while [[ -n $1 ]] ; do
        case $1 in
                -h|--help) usage;;
                -e) auto=true;;
+               -f) force=true;;
                --) shift; break;;
                -*) usage 1;;
                *)  break;
@@ -19,7 +21,7 @@ while [[ -n $1 ]] ; do
 done
 
 commit=${1:-mainline/master}
-url=$(git config --get remote.origin.url)
+url=$(git config --get remote.pullrequest.url || git config --get remote.origin.url)
 branch=${2:-master}
 if [[ ${branch} != master ]] ; then
        subject=" (${branch} branch)"
@@ -34,7 +36,10 @@ fi
 name=$(git config --get user.name)
 email=$(git config --get user.email)
 tmp=$(mktemp)
-request=$(PAGER= git request-pull ${commit} ${url} ${branch}) || exit 1
+if ! request=$(PAGER= git request-pull ${commit} ${url} ${branch}) ; then
+       ${force} || exit 1
+       request=$(echo "${request}" | sed "s:..BRANCH.NOT.VERIFIED..:${branch}:")
+fi
 cat << EOF > ${tmp}
 From: ${name} <${email}>
 Date: $(date -R)