From: "Shawn O. Pearce" <spearce@spearce.org>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org
Subject: [PATCH] Improve request-pull to handle non-rebased branches
Date: Tue, 24 Apr 2007 12:40:19 -0400 [thread overview]
Message-ID: <20070424164019.GA5780@spearce.org> (raw)
This is actually a few different changes to request-pull,
making it slightly smarter:
1) Compute the merge-base between the two revisions upfront
and reuse that selected merge-base for all log and diff
operations.
2) Disable the PAGER when running shortlog and diff, as these
would otherwise activate the pager for each command when
git-request-pull is run on a tty. Users can get the entire
output paged (if desired) using `git -p request-pull`.
3) Use shortlog rather than `git log | git shortlog` now that
recent shortlog versions are able to run the revision listing
internally.
4) Attempt to resolve the input URL using the user's configured
remotes. This is useful if the URL you want the recipient to
see is also the one you used to push your changes. If not a
config-file remote could easily be setup for the public URL
and request-pull can be passed that instead.
5) Minor cleanup of revision->base variable names, making it
follow the head/headrev naming convention that is already
in use.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
git-request-pull.sh | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/git-request-pull.sh b/git-request-pull.sh
index 4eacc3a..367b262 100755
--- a/git-request-pull.sh
+++ b/git-request-pull.sh
@@ -9,25 +9,27 @@ LONG_USAGE='Summarizes the changes since <commit> to the standard output,
and includes <url> in the message generated.'
SUBDIRECTORY_OK='Yes'
. git-sh-setup
+. git-parse-remote
-revision=$1
+base=$1
url=$2
head=${3-HEAD}
-[ "$revision" ] || usage
+[ "$base" ] || usage
[ "$url" ] || usage
-baserev=`git-rev-parse --verify "$revision"^0` &&
+baserev=`git-merge-base "$base" "$head"` &&
headrev=`git-rev-parse --verify "$head"^0` || exit
+PAGER=
+export PAGER
echo "The following changes since commit $baserev:"
-git log --max-count=1 --pretty=short "$baserev" |
-git-shortlog | sed -e 's/^\(.\)/ \1/'
+git shortlog --max-count=1 $baserev | sed -e 's/^\(.\)/ \1/'
echo "are found in the git repository at:"
echo
-echo " $url"
+echo " `get_remote_url "$url"`"
echo
-git log $baserev..$headrev | git-shortlog ;
-git diff -M --stat --summary $baserev..$headrev
+git shortlog ^$baserev $headrev
+git diff -M --stat --summary $baserev $headrev
--
1.5.1.1.135.gf948
next reply other threads:[~2007-04-24 16:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-24 16:40 Shawn O. Pearce [this message]
2007-04-25 5:38 ` [PATCH] Improve request-pull to handle non-rebased branches Junio C Hamano
-- strict thread matches above, loose matches on Subject: below --
2007-04-25 6:41 Shawn O. Pearce
2007-05-01 6:08 Shawn O. Pearce
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070424164019.GA5780@spearce.org \
--to=spearce@spearce.org \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).