From: Junio C Hamano <junkio@cox.net>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>, git@vger.kernel.org
Subject: Re: [howto] Kernel hacker's guide to git, updated
Date: Sun, 02 Oct 2005 01:47:24 -0700 [thread overview]
Message-ID: <7vr7b41f1f.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: 433D477A.4010009@pobox.com
Jeff Garzik <jgarzik@pobox.com> writes:
> Junio C Hamano wrote:
>> Jeff Garzik <jgarzik@pobox.com> writes:
>>> 2) What is the easiest way to obtain a list of changes present in
>>> repository B, that are not present in repository A? I used to use
>>> git-changes-script [hacked cg-log script] for this:
I haven't really *read* that script, but I think it is trying to
make a list of commits from both repositories and trying to find
the set that are in one side and not in the other using diff (a
real shell programer probably would have used "comm" for this
kind of task, not "diff"), then doing a handcrafted git-log on
each of them.
Attached is my quick hack, based on your original question,
without really trying to understand what the script is doing, so
I cannot claim it is a rewrite nor even attempting to be
compatible. Please take a look at it and tell me if this is
any close to what you need.
I have a suspition that this might be better done as a natural
extension of git-log, though.
------------
#!/bin/sh
#
# Copyright (c) 2005 Junio C Hamano
#
. git-sh-setup || die "Not a git archive"
usage () {
echo >&2 "$0 ( -L | -R ) <dir> [<ref>] [<ref>]
-L shows changes in local not in remote.
-R shows changes in remote not in local.
<dir> names the remote repository.
If given no refs, local and remote HEADs are compared.
If given one ref, local HEAD and named remote ref are compared.
If given two refs, the first names a local ref, and the second names
remote ref to be compared.
"
exit 1
}
case "$1" in
-L | -R)
;;
*)
usage ;;
esac
other="$2"
(
unset GIT_DIR GIT_OBJECT_DIRECTORY
cd "$other" && . git-sh-setup ||
die "$other is not a valid git repository."
)
local=${3:-HEAD}
remote=${4:-HEAD}
# Basic validation.
local=$(git-rev-parse --verify "$local^0" 2>/dev/null) ||
die "local ref $local is not valid."
remote=$(GIT_DIR="$other" git-rev-parse --verify "$remote^0" 2>/dev/null) ||
die "remote ref $remote is not valid."
case "$1" in
-L)
list_args="$local ^$remote" ;;
-R)
list_args="^$local $remote" ;;
esac
GAOD="$GIT_ALTERNATE_OBJECT_DIRECTORIES"
GIT_ALTERNATE_OBJECT_DIRECTORIES="$other/.git/objects:$GAOD" \
git-rev-list --pretty $list_args |
LESS=-S ${PAGER:-less}
next prev parent reply other threads:[~2005-10-02 8:47 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-29 11:03 [howto] Kernel hacker's guide to git, updated Jeff Garzik
2005-09-29 15:18 ` David Leimbach
2005-09-29 16:03 ` Alberto Patino
2005-09-29 16:13 ` David Leimbach
2005-09-29 19:08 ` Oliver Neukum
2005-09-29 19:34 ` Jon Loeliger
2005-09-29 19:38 ` Oliver Neukum
2005-09-30 7:37 ` Junio C Hamano
2005-09-30 8:36 ` Oliver Neukum
2005-09-30 16:39 ` Linus Torvalds
2005-09-29 20:02 ` Dave Jones
2005-09-29 20:07 ` Anton Altaparmakov
2005-09-29 20:11 ` Dave Jones
2005-09-29 21:14 ` Linus Torvalds
2005-09-29 21:26 ` Linus Torvalds
2005-09-29 21:33 ` Dave Jones
2005-09-29 21:55 ` Linus Torvalds
2005-09-29 22:12 ` Anton Altaparmakov
2005-09-29 22:25 ` Linus Torvalds
2005-09-29 22:32 ` Anton Altaparmakov
2005-09-29 23:19 ` Junio C Hamano
2005-09-30 12:22 ` Johannes Schindelin
2005-09-29 23:17 ` Horst von Brand
2005-09-30 0:47 ` Linus Torvalds
2005-09-30 1:54 ` Junio C Hamano
2005-09-30 2:36 ` Linus Torvalds
2005-10-01 0:10 ` Linus Torvalds
2005-10-01 1:58 ` Horst von Brand
2005-10-03 1:03 ` Linus Torvalds
2005-09-29 21:33 ` Elfyn McBratney
2005-09-29 21:35 ` Linus Torvalds
2005-09-29 21:40 ` Dave Jones
2005-09-29 20:15 ` Jeff Garzik
2005-09-29 21:04 ` Junio C Hamano
2005-09-30 11:15 ` Jeff Garzik
2005-09-30 11:55 ` Junio C Hamano
2005-09-30 14:11 ` Jeff Garzik
2005-10-02 8:47 ` Junio C Hamano [this message]
2005-09-30 18:14 ` Linus Torvalds
2005-10-01 7:36 ` Junio C Hamano
2005-09-30 12:02 ` Oliver Neukum
2005-09-30 13:58 ` Jeff Garzik
2005-09-30 15:10 ` Alberto Patino
2005-09-30 12:07 ` Erik Mouw
2005-09-30 14:08 ` Jeff Garzik
2005-09-30 18:13 ` Horst von Brand
2005-10-01 0:17 ` Jeff Garzik
2005-09-30 22:52 ` Francois Romieu
2005-09-29 21:23 ` Chuck Lever
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=7vr7b41f1f.fsf@assigned-by-dhcp.cox.net \
--to=junkio@cox.net \
--cc=git@vger.kernel.org \
--cc=jgarzik@pobox.com \
--cc=linux-kernel@vger.kernel.org \
/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).