Git development
 help / color / mirror / Atom feed
* Re: Compression speed for large files
From: Joachim Berdal Haga @ 2006-07-03 22:25 UTC (permalink / raw)
  To: Jeff King; +Cc: Joachim B Haga, git
In-Reply-To: <20060703214503.GA3897@coredump.intra.peff.net>

Jeff King wrote:
> On Mon, Jul 03, 2006 at 11:13:34AM +0000, Joachim B Haga wrote:
> 
>> often binary. In git, committing of large files is very slow; I have
>> tested with a 45MB file, which takes about 1 minute to check in (on an
>> intel core-duo 2GHz).
> 
> I know this has already been somewhat solved, but I found your numbers
> curiously high. I work quite a bit with git and large files and I
> haven't noticed this slowdown. Can you be more specific about your load?
> Are you sure it is zlib?

Quite sure: at least to the extent that it is fixed by lowering the
compression level. But the wording was inexact: it's during object
creation, which happens at initial "git add" and then later during "git
commit".

But...

> y 1.8Ghz Athlon, compressing 45MB of zeros into 20K takes about 2s.
> Compressing 45MB of random data into a 45MB object takes 6.3s. In either
> case, the commit takes only about 0.5s (since cogito stores the object
> during the cg-add).
> 
> Is there some specific file pattern which is slow to compress? 

yes, it seems so. At least the effect is much more pronounced for my
files than for random/null data. "My" files are in this context generated
data files, binary or ascii.

Here's a test with "time gzip -[169] -c file >/dev/null". Random data
from /dev/urandom, kernel headers are concatenation of *.h in kernel
sources. All times in seconds, on my puny home computer (1GHz Via Nehemiah)

       random (23MB)  data (23MB)   headers (44MB)
-9     10.2           72.5          38.5
-6     10.2           13.5          12.9
-1      9.9            4.1           7.0

So... data dependent, yes. But it hits even for normal source code.

(Btw; the default (-6) seems to be less data dependent than the other
values. Maybe that's on purpose.)

If you want to look at a highly-variable dataset (the one above), try
http://lupus.ig3.net/SIMULATION.dx.gz (5MB, slow server), but that's just
an example, I see the same variability for example also on binary data files.

-j.

^ permalink raw reply

* Re: [PATCH 2nd try] Make git-fmt-merge-msg a builtin
From: Junio C Hamano @ 2006-07-03 22:39 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git
In-Reply-To: <Pine.LNX.4.63.0607031717540.29667@wbgn013.biozentrum.uni-wuerzburg.de>

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
>
> ---
> 	This retires git-fmt-merge-msg.perl, since it passes all the
> 	tests, but removes the Perl version not now.

There is no point not removing the script if you update git.c
and Makefile to point at the new one.

We do not have a test specific for fmt-merge-msg, so it
obviously passes all the tests ;-).  A new one is attached.

I think we should extend boolean to accept 'yes' and 'no', as I
suggested earlier on the list, but other than that things look
good.

Thanks for the patch; no need to resubmit -- I'll munge the
points I raised above.

-- >8 --
diff --git a/t/t6200-fmt-merge-msg.sh b/t/t6200-fmt-merge-msg.sh
new file mode 100755
index 0000000..63e49f3
--- /dev/null
+++ b/t/t6200-fmt-merge-msg.sh
@@ -0,0 +1,163 @@
+#!/bin/sh
+#
+# Copyright (c) 2006, Junio C Hamano
+#
+
+test_description='fmt-merge-msg test'
+
+. ./test-lib.sh
+
+datestamp=1151939923
+setdate () {
+	GIT_COMMITTER_DATE="$datestamp +0200"
+	GIT_AUTHOR_DATE="$datestamp +0200"
+	datestamp=`expr "$datestamp" + 1`
+	export GIT_COMMITTER_DATE GIT_AUTHOR_DATE
+}
+
+test_expect_success setup '
+	echo one >one &&
+	git add one &&
+	setdate &&
+	git commit -m "Initial" &&
+
+	echo uno >one &&
+	echo dos >two &&
+	git add two &&
+	setdate &&
+	git commit -a -m "Second" &&
+
+	git checkout -b left &&
+
+	echo $datestamp >one &&
+	setdate &&
+	git commit -a -m "Common #1" &&
+
+	echo $datestamp >one &&
+	setdate &&
+	git commit -a -m "Common #2" &&
+
+	git branch right &&
+
+	echo $datestamp >two &&
+	setdate &&
+	git commit -a -m "Left #3" &&
+
+	echo $datestamp >two &&
+	setdate &&
+	git commit -a -m "Left #4" &&
+
+	echo $datestamp >two &&
+	setdate &&
+	git commit -a -m "Left #5" &&
+
+	git checkout right &&
+
+	echo $datestamp >three &&
+	git add three &&
+	setdate &&
+	git commit -a -m "Right #3" &&
+
+	echo $datestamp >three &&
+	setdate &&
+	git commit -a -m "Right #4" &&
+
+	echo $datestamp >three &&
+	setdate &&
+	git commit -a -m "Right #5" &&
+
+	git show-branch
+'
+
+cat >expected <<\EOF
+Merge branch 'left'
+EOF
+
+test_expect_success 'merge-msg test #1' '
+
+	git checkout master &&
+	git fetch . left &&
+
+	git fmt-merge-msg <.git/FETCH_HEAD >actual &&
+	diff -u actual expected
+'
+
+cat >expected <<\EOF
+Merge branch 'left' of ../trash
+EOF
+
+test_expect_success 'merge-msg test #2' '
+
+	git checkout master &&
+	git fetch ../trash left &&
+
+	git fmt-merge-msg <.git/FETCH_HEAD >actual &&
+	diff -u actual expected
+'
+
+cat >expected <<\EOF
+Merge branch 'left'
+
+* left:
+  Left #5
+  Left #4
+  Left #3
+  Common #2
+  Common #1
+EOF
+
+test_expect_success 'merge-msg test #3' '
+
+	git repo-config merge.summary true &&
+
+	git checkout master &&
+	setdate &&
+	git fetch . left &&
+
+	git fmt-merge-msg <.git/FETCH_HEAD >actual &&
+	diff -u actual expected
+'
+
+cat >expected <<\EOF
+Merge branches 'left' and 'right'
+
+* left:
+  Left #5
+  Left #4
+  Left #3
+  Common #2
+  Common #1
+
+* right:
+  Right #5
+  Right #4
+  Right #3
+  Common #2
+  Common #1
+EOF
+
+test_expect_success 'merge-msg test #4' '
+
+	git repo-config merge.summary true &&
+
+	git checkout master &&
+	setdate &&
+	git fetch . left right &&
+
+	git fmt-merge-msg <.git/FETCH_HEAD >actual &&
+	diff -u actual expected
+'
+
+test_expect_success 'merge-msg test #5' '
+
+	git repo-config merge.summary yes &&
+
+	git checkout master &&
+	setdate &&
+	git fetch . left right &&
+
+	git fmt-merge-msg <.git/FETCH_HEAD >actual &&
+	diff -u actual expected
+'
+
+test_done

^ permalink raw reply related

* Re: [PATCH 3/3] Make clear_commit_marks() clean harder
From: Linus Torvalds @ 2006-07-03 22:55 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Junio C Hamano, git
In-Reply-To: <Pine.LNX.4.63.0607032309190.29667@wbgn013.biozentrum.uni-wuerzburg.de>



On Mon, 3 Jul 2006, Johannes Schindelin wrote:
> 
> Traversing is actually wrong. Clearing the marks does not mean to clear 
> them on commits we did not even mark!

If we didn't mark them, then clearing them would be a no-op, so nobody 
really cares.

> But clearing on commits we _have_ -- but not parsed -- is important, 
> obviously.

Right. The point is, some logic can choose to mark commits UNINTERESTING 
without even parsing that commit, and it would be a good thing. You only 
need to parse the commit once you decide that you need its parents (or 
it's tree, of course), but you may be able to mark it uninteresting before 
that.

This is why it is _wrong_ to care about the "parsed" bit when clearing the 
flags.

		Linus

^ permalink raw reply

* git-fetch per-repository speed issues
From: Keith Packard @ 2006-07-03 18:02 UTC (permalink / raw)
  To: Git Mailing List; +Cc: keithp

[-- Attachment #1: Type: text/plain, Size: 1237 bytes --]

Ok, so maybe X.org is using git in an unexpected (or even wrong)
fashion. Our environment has split development across dozens of separate
repositories which match ABI interfaces. With CVS, we were able to keep
this all in one giant CVS repository with separate modules, but git
doesn't have that notion (which is mostly good). As such, we could use
cvsup or rsync to update the entire collection of modules.

With git, we'd prefer to use the git protocol instead of rsync for the
usual pack-related reasons, but that is limited to a single repository
at a time. And, it's painfully slow, even when the repository is up to
date:

$ cd lib/libXrandr
$ time git-fetch origin
...

real    0m17.035s
user    0m2.584s
sys     0m0.576s

This is a repository with 24 files and perhaps 50 revisions. Given
X.org's 307 git repositories, I'll clearly need to find a faster way
than running git-fetch on every one.

One thing I noticed was that the git+ssh syntax found in remotes files
doesn't do what I thought it did -- I assumed this would use 'git' for
fetch and 'ssh' for push, when in fact it just uses ssh for everything.
This slows down the connection process by several seconds.

-- 
keith.packard@intel.com

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* Re: Compression speed for large files
From: Linus Torvalds @ 2006-07-03 23:02 UTC (permalink / raw)
  To: Joachim Berdal Haga; +Cc: Jeff King, Joachim B Haga, git
In-Reply-To: <44A99961.8090504@fys.uio.no>



On Tue, 4 Jul 2006, Joachim Berdal Haga wrote:
> 
> Here's a test with "time gzip -[169] -c file >/dev/null". Random data
> from /dev/urandom, kernel headers are concatenation of *.h in kernel
> sources. All times in seconds, on my puny home computer (1GHz Via Nehemiah)

That "Via Nehemiah" is probably a big part of it.

I think the VIA Nehemiah just has a 64kB L2 cache, and I bet performance 
plummets if the tables end up being used past that. 

And I think a large part of the higher compressions is that they allow the 
compression window and tables to grow bigger.

		Linus

^ permalink raw reply

* Re: git-fetch per-repository speed issues
From: Linus Torvalds @ 2006-07-03 23:14 UTC (permalink / raw)
  To: Keith Packard; +Cc: Git Mailing List
In-Reply-To: <1151949764.4723.51.camel@neko.keithp.com>



On Mon, 3 Jul 2006, Keith Packard wrote:
> 
> With git, we'd prefer to use the git protocol instead of rsync for the
> usual pack-related reasons, but that is limited to a single repository
> at a time.

Well, you could use multiple branches in the same repository, even if they 
are totally unrealated. That would allow you to fetch them all in one go.

One way to do that is to just name the branches hierarcially have one 
repo, but then call the branches something like

	libXrandr/master
	libXrandr/develop
	Xorg/master
	Xorg/develop
	..

> And, it's painfully slow, even when the repository is up to
> date:
> 
> $ cd lib/libXrandr
> $ time git-fetch origin
> ...
> 
> real    0m17.035s
> user    0m2.584s
> sys     0m0.576s

That's _seriously_ wrong. If everything is up-to-date, a fetch should be 
basically zero-cost. That's especially true with the anonymous git 
protocol, which doesn't have any connection validation overhead (for the 
ssh protocol, the cost is usually the ssh login).

But there may well be some bug there.

Look at this:

	[torvalds@g5 git]$ time git fetch git://git.kernel.org/pub/scm/git/git.git 
	
	real    0m0.431s
	user    0m0.036s
	sys     0m0.024s

and that's over my DSL line, not some studly network thing. 

Basically, a repo that is up-to-date should do a "git fetch" about as 
quickly as it does a "git ls-remote". Which in turn really shouldn't be 
doing much anything at all, apart from the connect itself:

	[torvalds@g5 git]$ time git ls-remote master.kernel.org:/pub/scm/git/git.git > /dev/null 
	
	real    0m1.758s
	user    0m0.188s
	sys     0m0.024s
	[torvalds@g5 git]$ time git ls-remote git://git.kernel.org/pub/scm/git/git.git > /dev/null 
	
	real    0m0.431s
	user    0m0.056s
	sys     0m0.016s

(note how the ssh connection is much slower - it actually ends up doing 
all the ssh back-and-forth).

Can you try from different hosts? One problem may be the remote end 
just trying to do reverse DNS lookups for xinetd or whatever?

Also, one thing to try is to just do

	strace -Ttt git-peek-remote ...

which shows where the time is going (I selected "git-peek-remote", because 
that's a simple program).

		Linus

^ permalink raw reply

* Re: git-cvsimport gets parents wrong for branches
From: Martin Langhoff @ 2006-07-03 23:15 UTC (permalink / raw)
  To: Elrond, git
In-Reply-To: <20060703215303.GA24572@memak.tu-darmstadt.de>

Elrond,

you are right, the current git-cvsimport takes a very naive approach
to determine where branches open from. It uses cvsps internally, which
only reports on the ancestor branch, so we take the latest commit from
the ancestor.

Parsecvs probably has a more sophisticated approach, have you tried it?

It is pretty hard to get that one right in any case, as there are
cases where the new branch starts from something that is not a commit
in the parent (from GIT's perspective). So representing the branching
point would mean pointing to non-existing commits as parents.

If the cvs2svn documentation is not lying, it probably has the
smartest/correctest implementation. For small-medium repos, you may be
able to run cvs2svn and then import with git-svnimport.

cheers,


martin

^ permalink raw reply

* Re: git-fetch per-repository speed issues
From: Jeff King @ 2006-07-04  0:21 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Keith Packard, Git Mailing List
In-Reply-To: <Pine.LNX.4.64.0607031603290.12404@g5.osdl.org>

On Mon, Jul 03, 2006 at 04:14:10PM -0700, Linus Torvalds wrote:

> Well, you could use multiple branches in the same repository, even if they 
> are totally unrealated. That would allow you to fetch them all in one go.

One annoying thing about this is that you may want to have several of
the branches checked out at a time (i.e., you want the actual directory
structure of libXrandr/, Xorg/, etc). You could pull everything down
into one repo and point small pseudo-repos at it with alternates, but I
would think that would become a mess with pushes. You can do some magic
with read-tree --prefix, but again, I'm not sure how you'd make commits
on the correct branch.  Is there an easier way to do this?

> Basically, a repo that is up-to-date should do a "git fetch" about as 
> quickly as it does a "git ls-remote". Which in turn really shouldn't be 
> doing much anything at all, apart from the connect itself:

Fetching by ssh actually makes two ssh connections (the second is to
grab tags).

-Peff

^ permalink raw reply

* Why's Git called Git ?
From: Aaron Gray @ 2006-07-04  0:56 UTC (permalink / raw)
  To: Git Mailing List

Why the name I could not find any answer in the documentation ?

Aaron

^ permalink raw reply

* [PATCH] Add a custom ./configure script
From: Petr Baudis @ 2006-07-04  0:25 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

This patch adds a custom hand-made and supposedly easy to debug ./configure
script. It is originally based on mplayer's ./configure script but heavily
modified and of course stripped of all the mplayer-specific tests, as well
as many other tests we won't probably need (but we might reintroduce some
of them later). I kept the CPU checks since they might come handy to decide
which assembler SHA1 implementation to choose.

Also, I'm an autogeneration freak so compared to the mplayer's script
this one has a bit different design wrt. the configuration variables; instead
of adding random bits of code at various places you just insert one function
call near the top and your test near the bottom, everything else is taken
care of automagically. Also, the heavy machinery is split to a separate library
config-lib.sh.

It's a shame that we have to carry something like this around. Wouldn't the
world be much happier place if there would be something like autoconf but
instead of mucking with M4 you would just write a shell script while calling
various predefined functions? :/

The patch is on top of pu, that is Jakub Narebski's autoconf patch, because
it reuses most of its infrastructure and just replaces the configure script.

Signed-off-by: Petr Baudis <pasky@suse.cz>
---

 .gitignore    |    6 -
 INSTALL       |    1 
 config-lib.sh |  449 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 config.mak.in |   18 --
 configure     |   78 ++++++++++
 configure.ac  |   14 --
 6 files changed, 528 insertions(+), 38 deletions(-)

diff --git a/.gitignore b/.gitignore
index 616aa98..8950a9e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -136,10 +136,6 @@ git-core.spec
 *.[ao]
 *.py[co]
 config.mak
-autom4te.cache
-config.log
-config.status
-config.mak.in
 config.mak.autogen
-configure
+config.log
 git-blame
diff --git a/INSTALL b/INSTALL
index 6c8fd09..bff6aa6 100644
--- a/INSTALL
+++ b/INSTALL
@@ -16,7 +16,6 @@ install" would not work.
 Alternatively you can use autoconf generated ./configure script to
 set up install paths (via config.mak.autogen), so you can write instead
 
-	$ autoconf ;# as yourself if ./configure doesn't exist yet
 	$ ./configure --prefix=/usr ;# as yourself
 	$ make all doc ;# as yourself
 	# make install install-doc ;# as root
diff --git a/config-lib.sh b/config-lib.sh
new file mode 100755
index 0000000..68fecc5
--- /dev/null
+++ b/config-lib.sh
@@ -0,0 +1,449 @@
+# This script provides a wannabe-generic library for compile-time package
+# autoconfiguration
+# Copyright (c) Petr Baudis, 2006
+#
+#
+# Some design traits and large chunks of this script come from mplayer:
+#
+# Original version (C) 2000 Pontscho/fresh!mindworkz
+#                      pontscho@makacs.poliod.hu
+#
+# History / Contributors: check the cvs log !
+#
+# Cleanups all over the place (c) 2001 pl
+#
+#
+# This configure script is *not* autoconf-based and has different semantics.
+# It attempts to autodetect all settings and options where possible. It is
+# possible to override autodetection with the --enable-option/--disable-option
+# command line parameters.  --enable-option forces the option on skipping
+# autodetection. Yes, this means that compilation may fail and yes, this is not
+# how autoconf-based configure scripts behave.
+#
+# configure generates config.mak.autogen, then included in the Makefile.
+#
+#############################################################################
+
+# Prevent locale nonsense from breaking basic text processing utils
+LC_ALL=C
+export LC_ALL
+
+# These macros only return an error code - NO display is done
+
+compile_check() {
+{
+	echo
+	cat "$1"
+	echo
+	echo "$_cc $CFLAGS $_inc_extra $_ld_static $_ld_extra -o $TMPO $@"
+	rm -f "$TMPO"
+	$_cc $CFLAGS $_inc_extra $_ld_static $_ld_extra -o "$TMPO" "$@" || return $?
+	echo
+	echo "ldd $TMPO"
+	$_ldd "$TMPO" || return $?
+	echo
+} >>"$TMPLOG" 2>&1
+}
+
+cc_check() {
+	compile_check $TMPC $@
+}
+
+# Try to run the compiled file
+tmp_run() {
+	"$TMPO" >> "$TMPLOG" 2>&1
+}
+
+# Display error message, flushes tempfile, exit
+die () {
+	echo
+	echo "Error: $@" >&2
+	echo >&2
+	rm -f "$TMPO" "$TMPC" "$TMPS" "$TMPCPP"
+	echo "Check \"$TMPLOG\" if you do not understand why it failed." >&2
+	exit 1
+}
+
+# OS test booleans functions
+issystem() {
+	test "`echo $system_name | tr A-Z a-z`" = "`echo $1 | tr A-Z a-z`"
+}
+linux()   { issystem "Linux"   ; return "$?" ; }
+sunos()   { issystem "SunOS"   ; return "$?" ; }
+hpux()    { issystem "HP-UX"   ; return "$?" ; }
+irix()    { issystem "IRIX"    ; return "$?" ; }
+aix()     { issystem "AIX"     ; return "$?" ; }
+cygwin()  { issystem "CYGWIN"  ; return "$?" ; }
+freebsd() { issystem "FreeBSD" ; return "$?" ; }
+netbsd()  { issystem "NetBSD"  ; return "$?" ; }
+bsdos()   { issystem "BSD/OS"  ; return "$?" ; }
+openbsd() { issystem "OpenBSD" ; return "$?" ; }
+bsd()     { freebsd || netbsd || bsdos || openbsd ; return "$?" ; }
+qnx()     { issystem "QNX"     ; return "$?" ; }
+darwin()  { issystem "Darwin"  ; return "$?" ; }
+gnu()     { issystem "GNU"     ; return "$?" ; }
+mingw32() { issystem "MINGW32" ; return "$?" ; }
+morphos() { issystem "MorphOS" ; return "$?" ; }
+win32()   { cygwin || mingw32  ; return "$?" ; }
+beos()    { issystem "BEOS"    ; return "$?" ; }
+
+# arch test boolean functions
+# x86/x86pc is used by QNX
+x86() {
+	case "$host_arch" in
+		i[3-9]86|x86|x86pc|k5|k6|k6-2|k6-3|pentium*|athlon*|i586-i686) return 0 ;;
+		*) return 1 ;;
+	esac
+}
+
+x86_64() {
+	case "$host_arch" in
+		x86_64|amd64) return 0 ;;
+		*) return 1 ;;
+	esac
+}
+
+ppc() {
+	case "$host_arch" in
+		ppc) return 0;;
+		*) return 1;;
+	esac
+}
+
+alpha() {
+	case "$host_arch" in
+		alpha) return 0;;
+		*) return 1;;
+	esac
+}
+
+# not boolean test: implement the posix shell "!" operator for a
+# non-posix /bin/sh.
+#   usage:  not {command}
+# returns exit status "success" when the execution of "command"
+# fails.
+not() {
+	eval "$@"
+	test $? -ne 0
+}
+
+# Use this before starting a check
+# The second optional parameter is name of the feature variable;
+# it is preset to an empty string so that it can be dropped into
+# config.mak.autogen seamlessly; use echores_yesno() for reporting.
+echocheck() {
+	echo "============ Checking $@ ============" >> "$TMPLOG"
+	echo ${_echo_n} "Checking $@... ${_echo_c}"
+}
+
+# Use this to echo the results of a check
+echores() {
+	if test "$_res_comment" ; then
+		_res_comment="($_res_comment)"
+	fi
+	echo "Result is: $@ $_res_comment" >> "$TMPLOG"
+	echo "##########################################" >> "$TMPLOG"
+	echo "" >> "$TMPLOG"
+	echo "$@ $_res_comment"
+	_res_comment=""
+}
+
+# Use this to introduce a regular feature with a commandline switch
+# @name is the variable name
+# @switch is the commandline switch
+# @mkvar is the Makefile variable name; prefix with a space to say that it's negated (ow)
+# @desc is a line to insert to the --help output
+# @default is the default value (yes/no/auto)
+add_library() { # --with
+	name="$1"; shift; switch="$1"; shift; mkvar="$1"; shift; default="$1"; shift; desc="$1"; shift
+	case $default in
+		yes) hdefault=with;;
+		no) hdefault=without;;
+		auto) hdefault=autodetect;;
+	esac
+
+	lib_help="$lib_help
+$desc [$hdefault]"
+	switches="$switches switch_lib \"$name\" \"$switch\" \"\$ac_option\" || "
+	mkvars="$mkvars mkvar \"\$$name\" \"$mkvar\";"
+	eval "$name=$default"
+}
+
+add_feature() { # --enable
+	name="$1"; shift; switch="$1"; shift; mkvar="$1"; shift; default="$1"; shift; desc="$1"; shift
+	case $default in
+		yes) hdefault=enable;;
+		no) hdefault=disable;;
+		auto) hdefault=autodetect;;
+	esac
+
+	feature_help="$feature_help
+$desc [$hdefault]"
+	switches="$switches switch_feature \"$name\" \"$switch\" \"\$ac_option\" || "
+	mkvars="$mkvars mkvar \"\$$name\" \"$mkvar\";"
+	eval "$name=$default"
+}
+
+lib_help=
+feature_help=
+switches=
+mkvars=
+
+
+switch_lib() {
+	name="$1"; shift; switch="$1"; shift; option="$1"; shift
+	case $option in
+		--with-$switch) eval "$name=yes";;
+		--without-$switch) eval "$name=no";;
+		*) return 1
+	esac
+	return 0
+}
+
+switch_feature() {
+	name="$1"; shift; switch="$1"; shift; option="$1"; shift
+	case $option in
+		--enable-$switch) eval "$name=yes";;
+		--disable-$switch) eval "$name=no";;
+		*) return 1
+	esac
+	return 0
+}
+
+mkvar() {
+	value="$1"; shift; mkvar="$1"; shift
+	noval=""; yesval="ConfigureYesPlease"
+	case $mkvar in
+		\ *) swap="$noval"; noval="$yesval"; yesval="$swap";;
+	esac
+	case $value in
+		auto) die "$mkvar autodetection failed";;
+		no) echo "$mkvar = $noval";;
+		yes) echo "$mkvar = $yesval";;
+		*) die "$mkvar got invalid value ''$value''";;
+	esac
+}
+
+
+#############################################################################
+
+
+# Check how echo works in this /bin/sh
+case `echo -n` in
+	-n)	_echo_n=	_echo_c='\c'	;;	# SysV echo
+	*)	_echo_n='-n '	_echo_c=	;;	# BSD echo
+esac
+
+
+process_params() {
+	_install=install
+	_cc=cc
+	test "$CC" && _cc="$CC"
+
+	for ac_option do
+		case "$ac_option" in
+		--help|-help|-h)
+			cat << EOF
+Usage: $0 [OPTIONS]...
+
+Configuration:
+  -h, --help             display this help and exit
+
+Installation directories:
+  --prefix=DIR           use this prefix for installing git [HOME]
+  --bindir=DIR           use this prefix for installing git binary
+                         [PREFIX/bin]
+  --gitexecdir=DIR       use this prefix for installing individual git command
+                         binaries [BINDIR]
+  --mandir=DIR           use this prefix for installing manpages [PREFIX/man]
+  --templatedir=DIR      use this prefix for installing configuration file
+                         templates [PREFIX/share/git-core/templates]
+  --gitpythondir=DIR     use this prefix for python libraries [PREFIX/share/git-core/python]
+
+Miscellaneous options:
+  --cc=COMPILER          use this C compiler to build MPlayer [gcc]
+  --target=PLATFORM      target platform (i386-linux, arm-linux, etc)
+  --with-install=PATH    use a custom install program (useful if your OS uses
+                         a GNU-incompatible install utility by default and
+                         you want to use GNU version)
+
+For the options below, see the top of the Makefile for more detailed
+description.
+
+Optional features:$feature_help
+
+Optional libraries:$lib_help
+
+This configure script is NOT autoconf-based, even though its output is similar.
+It will try to autodetect all configuration options. If you --enable an option
+it will be forcefully turned on, skipping autodetection. This can break
+compilation, so you need to know what you are doing.
+EOF
+			exit 0 ;;
+
+		--prefix=*)
+			_prefix=`echo $ac_option | cut -d '=' -f 2` ;;
+		--bindir=*)
+			_bindir=`echo $ac_option | cut -d '=' -f 2` ;;
+		--gitexecdir=*)
+			_gitexecdir=`echo $ac_option | cut -d '=' -f 2` ;;
+		--mandir=*)
+			_mandir=`echo $ac_option | cut -d '=' -f 2` ;;
+		--templatedir=*)
+			_templatedir=`echo $ac_option | cut -d '=' -f 2` ;;
+		--gitpythondir=*)
+			_gitpythondir=`echo $ac_option | cut -d '=' -f 2` ;;
+
+		--cc=*)
+			_cc=`echo $ac_option | cut -d '=' -f 2` ;;
+		--target=*)
+			_target=`echo $ac_option | cut -d '=' -f 2` ;;
+		--with-install=*)
+			_install=`echo $ac_option | cut -d '=' -f 2 ` ;;
+
+		*)
+			# $switches is the real bulk
+			eval "$switches { echo \"Unknown parameter: $ac_option\"; exit 1; }" || exit 1 ;;
+		esac
+	done
+
+	# Determine our OS name and CPU architecture
+	if test -z "$_target" ; then
+		# OS name
+		system_name=`uname -s 2>&1`
+		case "$system_name" in
+		Linux|FreeBSD|NetBSD|BSD/OS|OpenBSD|SunOS|QNX|Darwin|GNU|BeOS|MorphOS|AIX)
+			;;
+		IRIX*)
+			system_name=IRIX ;;
+		HP-UX*)
+			system_name=HP-UX ;;
+		[cC][yY][gG][wW][iI][nN]*)
+			system_name=CYGWIN ;;
+		MINGW32*)
+			system_name=MINGW32 ;;
+		*)
+			system_name="$system_name-UNKNOWN" ;;
+		esac
+
+
+		# host's CPU/instruction set
+		host_arch=`uname -p 2>&1`
+		case "$host_arch" in
+		i386|sparc|ppc|alpha|arm|mips|vax)
+			;;
+		powerpc) # Darwin returns 'powerpc'
+			host_arch=ppc ;;
+		*)	# uname -p on Linux returns 'unknown' for the processor type,
+			# OpenBSD returns 'Intel Pentium/MMX ("Genuine Intel" 586-class)'
+
+			# Maybe uname -m (machine hardware name) returns something we
+			# recognize.
+
+			# x86/x86pc is used by QNX
+			case "`uname -m 2>&1`" in
+				i[3-9]86*|x86|x86pc|k5|k6|k6_2|k6_3|k6-2|k6-3|pentium*|athlon*|i586_i686|i586-i686|BePC) host_arch=i386 ;;
+				ia64) host_arch=ia64 ;;
+				x86_64|amd64)
+				if [ -n "`$_cc -dumpmachine | sed -n '/^x86_64-/p;/^amd64-/p'`" -a \
+					-z "`echo $CFLAGS | grep -- -m32`"  ]; then
+					host_arch=x86_64
+				else
+					host_arch=i386
+				fi
+				;;
+				macppc|ppc|ppc64) host_arch=ppc ;;
+				alpha) host_arch=alpha ;;
+				sparc) host_arch=sparc ;;
+				sparc64) host_arch=sparc64 ;;
+				parisc*|hppa*|9000*) host_arch=hppa ;;
+				arm*|zaurus|cats) host_arch=arm ;;
+				s390) host_arch=s390 ;;
+				s390x) host_arch=s390x ;;
+				mips*) host_arch=mips ;;
+				vax) host_arch=vax ;;
+				*) host_arch=UNKNOWN ;;
+			esac
+			;;
+		esac
+	else # if test -z "$_target"
+		system_name=`echo $_target | cut -d '-' -f 2`
+		case "`echo $system_name | tr A-Z a-z`" in
+			linux) system_name=Linux ;;
+			freebsd) system_name=FreeBSD ;;
+			netbsd) system_name=NetBSD ;;
+			bsd/os) system_name=BSD/OS ;;
+			openbsd) system_name=OpenBSD ;;
+			sunos) system_name=SunOS ;;
+			qnx) system_name=QNX ;;
+			morphos) system_name=MorphOS ;;
+			mingw32msvc) system_name=MINGW32 ;;
+		esac
+		# We need to convert underscores so that values like k6-2 and pentium-mmx can be passed
+		host_arch=`echo $_target | cut -d '-' -f 1 | tr '_' '-'`
+	fi
+
+	echo "Detected operating system: $system_name"
+	echo "Detected host architecture: $host_arch"
+}
+
+
+test_setup() {
+	# LGB: temporary files
+	# FIXME: Use mktemp -d?
+	for I in "$TMPDIR" "$TEMPDIR" "/tmp" ; do
+		test "$I" && break
+	done
+
+	TMPLOG="config.log"
+	rm -f "$TMPLOG"
+	TMPC="$I/git-conf-$RANDOM-$$.c"
+	TMPO="$I/git-conf-$RANDOM-$$.o"
+	TMPS="$I/git-conf-$RANDOM-$$.S"
+}
+
+basic_tests() {
+	echocheck "if your build environment is sane"
+	cat > $TMPC <<EOF
+int main(void) { return 0; }
+EOF
+	{ cc_check && tmp_run; } || die "unusable compiler or produced binary"
+	echores yes
+}
+
+
+write_config() {
+	echo "Creating config.mak.autogen"
+
+	{
+		cat << EOF
+# -------- Generated by configure -----------
+
+CC = $_cc
+INSTALL = $_install
+
+EOF
+		test -z $_prefix || echo "prefix = $_prefix"
+		test -z $_bindir || echo "bindir = $_bindir"
+		test -z $_gitexecdir || echo "gitexecdir = $_gitexecdir"
+		test -z $_mandir || ( echo "mandir = $_mandir" && echo "export mandir" )
+		test -z $_templatedir || echo "template_dir = $_templatedir"
+		test -z $_gitpythondir || echo "GIT_PYTHON_DIR = $_gitpythondir"
+		echo
+		eval "$mkvars"
+	} > config.mak.autogen
+
+	cat << EOF
+
+Config files successfully generated by ./configure.
+You can inspect the results in \`\`./config.mak.autogen''.
+EOF
+}
+
+
+finish() {
+	# Last move:
+	rm -f "$TMPO" "$TMPC" "$TMPS" "$TMPCPP"
+}
+
+trap finish 0
diff --git a/config.mak.in b/config.mak.in
deleted file mode 100644
index 82c9781..0000000
--- a/config.mak.in
+++ /dev/null
@@ -1,18 +0,0 @@
-# git Makefile configuration, included in main Makefile
-# @configure_input@
-
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-bindir = @bindir@
-#gitexecdir = @libexecdir@/git-core/
-template_dir = @datadir@/git-core/templates/
-GIT_PYTHON_DIR = @datadir@/git-core/python
-
-mandir=@mandir@
-
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-export exec_prefix mandir
-export srcdir VPATH
-
diff --git a/configure b/configure
new file mode 100755
index 0000000..2604aa3
--- /dev/null
+++ b/configure
@@ -0,0 +1,78 @@
+#! /bin/sh
+#
+# This configure script is *not* autoconf-based and has different semantics.
+# It attempts to autodetect all settings and options where possible. It is
+# possible to override autodetection with the --enable-option/--disable-option
+# command line parameters.  --enable-option forces the option on skipping
+# autodetection. Yes, this means that compilation may fail and yes, this is not
+# how autoconf-based configure scripts behave.
+#
+# configure generates config.mak.autogen, then included in the Makefile.
+#
+# If you want to add a new check for $feature, add it at two places - to the
+# variable list and to the checks section. You will find both below.
+#
+#############################################################################
+
+[ -f ./config-lib.sh ] || {
+	echo "config-lib.sh not found; please run ./configure from the source tree" >&2
+	exit 1
+}
+. ./config-lib.sh
+
+
+
+#############################################################################
+
+# List variables for features and libraries here:
+
+add_feature "_no_symlink_head" "no-symlink-head" "NO_SYMLINK_HEAD" "auto" \
+"  --enable-no-symlink-head  Never have .git/HEAD as a symbolic link"
+
+add_feature "_nsec" "nsec" "USE_NSEC" "no" \
+"  --enable-nsec          Use sub-second resolution when checking mtimes"
+
+add_library "_expat" "expat" " NO_EXPAT" "auto" \
+"  --without-expat        Disable libexpat support (disables git-http-push)"
+
+
+#############################################################################
+
+
+process_params "$@"
+test_setup
+basic_tests
+
+
+#############################################################################
+
+
+echocheck "whether to prohibit usage of symlinked HEAD"
+if test "$_no_symlink_head" = auto ; then
+	if win32; then
+		_no_symlink_head=yes
+	else
+		_no_symlink_head=no
+	fi
+fi
+echores "$_no_symlink_head"
+
+
+echocheck "for expat"
+if test "$_expat" = auto ; then
+	cat > $TMPC <<EOF
+#include <expat.h>
+int main(void) { return 0; }
+EOF
+	_expat=no
+	cc_check -lexpat && _expat=yes
+fi
+echores "$_expat"
+
+
+# Insert tests for features and libraries here.
+
+#############################################################################
+
+
+write_config
diff --git a/configure.ac b/configure.ac
deleted file mode 100644
index a0374d4..0000000
--- a/configure.ac
+++ /dev/null
@@ -1,14 +0,0 @@
-#                                               -*- Autoconf -*-
-# Process this file with autoconf to produce a configure script.
-
-AC_PREREQ(2.59)
-AC_INIT([git], [1.4.1], [git@vger.kernel.org])
-
-AC_CONFIG_SRCDIR([git.c])
-
-config_file=config.mak.autogen
-config_in=config.mak.in
-
-# Output files
-AC_CONFIG_FILES(["${config_file}":"${config_in}"])
-AC_OUTPUT

^ permalink raw reply related

* [PATCH] Add a custom ./configure script
From: Petr Baudis @ 2006-07-04  0:40 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

This patch adds a custom hand-made and supposedly easy to debug ./configure
script. It is originally based on mplayer's ./configure script but heavily
modified and of course stripped of all the mplayer-specific tests, as well
as many other tests we won't probably need (but we might reintroduce some
of them later). I kept the CPU checks since they might come handy to decide
which assembler SHA1 implementation to choose.

Also, I'm an autogeneration freak so compared to the mplayer's script
this one has a bit different design wrt. the configuration variables; instead
of adding random bits of code at various places you just insert one function
call near the top and your test near the bottom, everything else is taken
care of automagically. Also, the heavy machinery is split to a separate library
config-lib.sh.

It's a shame that we have to carry something like this around. Wouldn't the
world be much happier place if there would be something like autoconf but
instead of mucking with M4 you would just write a shell script while calling
various predefined functions? :/

The patch is on top of pu, that is Jakub Narebski's autoconf patch, because
it reuses most of its infrastructure and just replaces the configure script.

Signed-off-by: Petr Baudis <pasky@suse.cz>
---

 .gitignore    |    6 -
 INSTALL       |    1 
 config-lib.sh |  449 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 config.mak.in |   18 --
 configure     |   78 ++++++++++
 configure.ac  |   14 --
 6 files changed, 528 insertions(+), 38 deletions(-)

diff --git a/.gitignore b/.gitignore
index 616aa98..8950a9e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -136,10 +136,6 @@ git-core.spec
 *.[ao]
 *.py[co]
 config.mak
-autom4te.cache
-config.log
-config.status
-config.mak.in
 config.mak.autogen
-configure
+config.log
 git-blame
diff --git a/INSTALL b/INSTALL
index 6c8fd09..bff6aa6 100644
--- a/INSTALL
+++ b/INSTALL
@@ -16,7 +16,6 @@ install" would not work.
 Alternatively you can use autoconf generated ./configure script to
 set up install paths (via config.mak.autogen), so you can write instead
 
-	$ autoconf ;# as yourself if ./configure doesn't exist yet
 	$ ./configure --prefix=/usr ;# as yourself
 	$ make all doc ;# as yourself
 	# make install install-doc ;# as root
diff --git a/config-lib.sh b/config-lib.sh
new file mode 100755
index 0000000..68fecc5
--- /dev/null
+++ b/config-lib.sh
@@ -0,0 +1,449 @@
+# This script provides a wannabe-generic library for compile-time package
+# autoconfiguration
+# Copyright (c) Petr Baudis, 2006
+#
+#
+# Some design traits and large chunks of this script come from mplayer:
+#
+# Original version (C) 2000 Pontscho/fresh!mindworkz
+#                      pontscho@makacs.poliod.hu
+#
+# History / Contributors: check the cvs log !
+#
+# Cleanups all over the place (c) 2001 pl
+#
+#
+# This configure script is *not* autoconf-based and has different semantics.
+# It attempts to autodetect all settings and options where possible. It is
+# possible to override autodetection with the --enable-option/--disable-option
+# command line parameters.  --enable-option forces the option on skipping
+# autodetection. Yes, this means that compilation may fail and yes, this is not
+# how autoconf-based configure scripts behave.
+#
+# configure generates config.mak.autogen, then included in the Makefile.
+#
+#############################################################################
+
+# Prevent locale nonsense from breaking basic text processing utils
+LC_ALL=C
+export LC_ALL
+
+# These macros only return an error code - NO display is done
+
+compile_check() {
+{
+	echo
+	cat "$1"
+	echo
+	echo "$_cc $CFLAGS $_inc_extra $_ld_static $_ld_extra -o $TMPO $@"
+	rm -f "$TMPO"
+	$_cc $CFLAGS $_inc_extra $_ld_static $_ld_extra -o "$TMPO" "$@" || return $?
+	echo
+	echo "ldd $TMPO"
+	$_ldd "$TMPO" || return $?
+	echo
+} >>"$TMPLOG" 2>&1
+}
+
+cc_check() {
+	compile_check $TMPC $@
+}
+
+# Try to run the compiled file
+tmp_run() {
+	"$TMPO" >> "$TMPLOG" 2>&1
+}
+
+# Display error message, flushes tempfile, exit
+die () {
+	echo
+	echo "Error: $@" >&2
+	echo >&2
+	rm -f "$TMPO" "$TMPC" "$TMPS" "$TMPCPP"
+	echo "Check \"$TMPLOG\" if you do not understand why it failed." >&2
+	exit 1
+}
+
+# OS test booleans functions
+issystem() {
+	test "`echo $system_name | tr A-Z a-z`" = "`echo $1 | tr A-Z a-z`"
+}
+linux()   { issystem "Linux"   ; return "$?" ; }
+sunos()   { issystem "SunOS"   ; return "$?" ; }
+hpux()    { issystem "HP-UX"   ; return "$?" ; }
+irix()    { issystem "IRIX"    ; return "$?" ; }
+aix()     { issystem "AIX"     ; return "$?" ; }
+cygwin()  { issystem "CYGWIN"  ; return "$?" ; }
+freebsd() { issystem "FreeBSD" ; return "$?" ; }
+netbsd()  { issystem "NetBSD"  ; return "$?" ; }
+bsdos()   { issystem "BSD/OS"  ; return "$?" ; }
+openbsd() { issystem "OpenBSD" ; return "$?" ; }
+bsd()     { freebsd || netbsd || bsdos || openbsd ; return "$?" ; }
+qnx()     { issystem "QNX"     ; return "$?" ; }
+darwin()  { issystem "Darwin"  ; return "$?" ; }
+gnu()     { issystem "GNU"     ; return "$?" ; }
+mingw32() { issystem "MINGW32" ; return "$?" ; }
+morphos() { issystem "MorphOS" ; return "$?" ; }
+win32()   { cygwin || mingw32  ; return "$?" ; }
+beos()    { issystem "BEOS"    ; return "$?" ; }
+
+# arch test boolean functions
+# x86/x86pc is used by QNX
+x86() {
+	case "$host_arch" in
+		i[3-9]86|x86|x86pc|k5|k6|k6-2|k6-3|pentium*|athlon*|i586-i686) return 0 ;;
+		*) return 1 ;;
+	esac
+}
+
+x86_64() {
+	case "$host_arch" in
+		x86_64|amd64) return 0 ;;
+		*) return 1 ;;
+	esac
+}
+
+ppc() {
+	case "$host_arch" in
+		ppc) return 0;;
+		*) return 1;;
+	esac
+}
+
+alpha() {
+	case "$host_arch" in
+		alpha) return 0;;
+		*) return 1;;
+	esac
+}
+
+# not boolean test: implement the posix shell "!" operator for a
+# non-posix /bin/sh.
+#   usage:  not {command}
+# returns exit status "success" when the execution of "command"
+# fails.
+not() {
+	eval "$@"
+	test $? -ne 0
+}
+
+# Use this before starting a check
+# The second optional parameter is name of the feature variable;
+# it is preset to an empty string so that it can be dropped into
+# config.mak.autogen seamlessly; use echores_yesno() for reporting.
+echocheck() {
+	echo "============ Checking $@ ============" >> "$TMPLOG"
+	echo ${_echo_n} "Checking $@... ${_echo_c}"
+}
+
+# Use this to echo the results of a check
+echores() {
+	if test "$_res_comment" ; then
+		_res_comment="($_res_comment)"
+	fi
+	echo "Result is: $@ $_res_comment" >> "$TMPLOG"
+	echo "##########################################" >> "$TMPLOG"
+	echo "" >> "$TMPLOG"
+	echo "$@ $_res_comment"
+	_res_comment=""
+}
+
+# Use this to introduce a regular feature with a commandline switch
+# @name is the variable name
+# @switch is the commandline switch
+# @mkvar is the Makefile variable name; prefix with a space to say that it's negated (ow)
+# @desc is a line to insert to the --help output
+# @default is the default value (yes/no/auto)
+add_library() { # --with
+	name="$1"; shift; switch="$1"; shift; mkvar="$1"; shift; default="$1"; shift; desc="$1"; shift
+	case $default in
+		yes) hdefault=with;;
+		no) hdefault=without;;
+		auto) hdefault=autodetect;;
+	esac
+
+	lib_help="$lib_help
+$desc [$hdefault]"
+	switches="$switches switch_lib \"$name\" \"$switch\" \"\$ac_option\" || "
+	mkvars="$mkvars mkvar \"\$$name\" \"$mkvar\";"
+	eval "$name=$default"
+}
+
+add_feature() { # --enable
+	name="$1"; shift; switch="$1"; shift; mkvar="$1"; shift; default="$1"; shift; desc="$1"; shift
+	case $default in
+		yes) hdefault=enable;;
+		no) hdefault=disable;;
+		auto) hdefault=autodetect;;
+	esac
+
+	feature_help="$feature_help
+$desc [$hdefault]"
+	switches="$switches switch_feature \"$name\" \"$switch\" \"\$ac_option\" || "
+	mkvars="$mkvars mkvar \"\$$name\" \"$mkvar\";"
+	eval "$name=$default"
+}
+
+lib_help=
+feature_help=
+switches=
+mkvars=
+
+
+switch_lib() {
+	name="$1"; shift; switch="$1"; shift; option="$1"; shift
+	case $option in
+		--with-$switch) eval "$name=yes";;
+		--without-$switch) eval "$name=no";;
+		*) return 1
+	esac
+	return 0
+}
+
+switch_feature() {
+	name="$1"; shift; switch="$1"; shift; option="$1"; shift
+	case $option in
+		--enable-$switch) eval "$name=yes";;
+		--disable-$switch) eval "$name=no";;
+		*) return 1
+	esac
+	return 0
+}
+
+mkvar() {
+	value="$1"; shift; mkvar="$1"; shift
+	noval=""; yesval="ConfigureYesPlease"
+	case $mkvar in
+		\ *) swap="$noval"; noval="$yesval"; yesval="$swap";;
+	esac
+	case $value in
+		auto) die "$mkvar autodetection failed";;
+		no) echo "$mkvar = $noval";;
+		yes) echo "$mkvar = $yesval";;
+		*) die "$mkvar got invalid value ''$value''";;
+	esac
+}
+
+
+#############################################################################
+
+
+# Check how echo works in this /bin/sh
+case `echo -n` in
+	-n)	_echo_n=	_echo_c='\c'	;;	# SysV echo
+	*)	_echo_n='-n '	_echo_c=	;;	# BSD echo
+esac
+
+
+process_params() {
+	_install=install
+	_cc=cc
+	test "$CC" && _cc="$CC"
+
+	for ac_option do
+		case "$ac_option" in
+		--help|-help|-h)
+			cat << EOF
+Usage: $0 [OPTIONS]...
+
+Configuration:
+  -h, --help             display this help and exit
+
+Installation directories:
+  --prefix=DIR           use this prefix for installing git [HOME]
+  --bindir=DIR           use this prefix for installing git binary
+                         [PREFIX/bin]
+  --gitexecdir=DIR       use this prefix for installing individual git command
+                         binaries [BINDIR]
+  --mandir=DIR           use this prefix for installing manpages [PREFIX/man]
+  --templatedir=DIR      use this prefix for installing configuration file
+                         templates [PREFIX/share/git-core/templates]
+  --gitpythondir=DIR     use this prefix for python libraries [PREFIX/share/git-core/python]
+
+Miscellaneous options:
+  --cc=COMPILER          use this C compiler to build MPlayer [gcc]
+  --target=PLATFORM      target platform (i386-linux, arm-linux, etc)
+  --with-install=PATH    use a custom install program (useful if your OS uses
+                         a GNU-incompatible install utility by default and
+                         you want to use GNU version)
+
+For the options below, see the top of the Makefile for more detailed
+description.
+
+Optional features:$feature_help
+
+Optional libraries:$lib_help
+
+This configure script is NOT autoconf-based, even though its output is similar.
+It will try to autodetect all configuration options. If you --enable an option
+it will be forcefully turned on, skipping autodetection. This can break
+compilation, so you need to know what you are doing.
+EOF
+			exit 0 ;;
+
+		--prefix=*)
+			_prefix=`echo $ac_option | cut -d '=' -f 2` ;;
+		--bindir=*)
+			_bindir=`echo $ac_option | cut -d '=' -f 2` ;;
+		--gitexecdir=*)
+			_gitexecdir=`echo $ac_option | cut -d '=' -f 2` ;;
+		--mandir=*)
+			_mandir=`echo $ac_option | cut -d '=' -f 2` ;;
+		--templatedir=*)
+			_templatedir=`echo $ac_option | cut -d '=' -f 2` ;;
+		--gitpythondir=*)
+			_gitpythondir=`echo $ac_option | cut -d '=' -f 2` ;;
+
+		--cc=*)
+			_cc=`echo $ac_option | cut -d '=' -f 2` ;;
+		--target=*)
+			_target=`echo $ac_option | cut -d '=' -f 2` ;;
+		--with-install=*)
+			_install=`echo $ac_option | cut -d '=' -f 2 ` ;;
+
+		*)
+			# $switches is the real bulk
+			eval "$switches { echo \"Unknown parameter: $ac_option\"; exit 1; }" || exit 1 ;;
+		esac
+	done
+
+	# Determine our OS name and CPU architecture
+	if test -z "$_target" ; then
+		# OS name
+		system_name=`uname -s 2>&1`
+		case "$system_name" in
+		Linux|FreeBSD|NetBSD|BSD/OS|OpenBSD|SunOS|QNX|Darwin|GNU|BeOS|MorphOS|AIX)
+			;;
+		IRIX*)
+			system_name=IRIX ;;
+		HP-UX*)
+			system_name=HP-UX ;;
+		[cC][yY][gG][wW][iI][nN]*)
+			system_name=CYGWIN ;;
+		MINGW32*)
+			system_name=MINGW32 ;;
+		*)
+			system_name="$system_name-UNKNOWN" ;;
+		esac
+
+
+		# host's CPU/instruction set
+		host_arch=`uname -p 2>&1`
+		case "$host_arch" in
+		i386|sparc|ppc|alpha|arm|mips|vax)
+			;;
+		powerpc) # Darwin returns 'powerpc'
+			host_arch=ppc ;;
+		*)	# uname -p on Linux returns 'unknown' for the processor type,
+			# OpenBSD returns 'Intel Pentium/MMX ("Genuine Intel" 586-class)'
+
+			# Maybe uname -m (machine hardware name) returns something we
+			# recognize.
+
+			# x86/x86pc is used by QNX
+			case "`uname -m 2>&1`" in
+				i[3-9]86*|x86|x86pc|k5|k6|k6_2|k6_3|k6-2|k6-3|pentium*|athlon*|i586_i686|i586-i686|BePC) host_arch=i386 ;;
+				ia64) host_arch=ia64 ;;
+				x86_64|amd64)
+				if [ -n "`$_cc -dumpmachine | sed -n '/^x86_64-/p;/^amd64-/p'`" -a \
+					-z "`echo $CFLAGS | grep -- -m32`"  ]; then
+					host_arch=x86_64
+				else
+					host_arch=i386
+				fi
+				;;
+				macppc|ppc|ppc64) host_arch=ppc ;;
+				alpha) host_arch=alpha ;;
+				sparc) host_arch=sparc ;;
+				sparc64) host_arch=sparc64 ;;
+				parisc*|hppa*|9000*) host_arch=hppa ;;
+				arm*|zaurus|cats) host_arch=arm ;;
+				s390) host_arch=s390 ;;
+				s390x) host_arch=s390x ;;
+				mips*) host_arch=mips ;;
+				vax) host_arch=vax ;;
+				*) host_arch=UNKNOWN ;;
+			esac
+			;;
+		esac
+	else # if test -z "$_target"
+		system_name=`echo $_target | cut -d '-' -f 2`
+		case "`echo $system_name | tr A-Z a-z`" in
+			linux) system_name=Linux ;;
+			freebsd) system_name=FreeBSD ;;
+			netbsd) system_name=NetBSD ;;
+			bsd/os) system_name=BSD/OS ;;
+			openbsd) system_name=OpenBSD ;;
+			sunos) system_name=SunOS ;;
+			qnx) system_name=QNX ;;
+			morphos) system_name=MorphOS ;;
+			mingw32msvc) system_name=MINGW32 ;;
+		esac
+		# We need to convert underscores so that values like k6-2 and pentium-mmx can be passed
+		host_arch=`echo $_target | cut -d '-' -f 1 | tr '_' '-'`
+	fi
+
+	echo "Detected operating system: $system_name"
+	echo "Detected host architecture: $host_arch"
+}
+
+
+test_setup() {
+	# LGB: temporary files
+	# FIXME: Use mktemp -d?
+	for I in "$TMPDIR" "$TEMPDIR" "/tmp" ; do
+		test "$I" && break
+	done
+
+	TMPLOG="config.log"
+	rm -f "$TMPLOG"
+	TMPC="$I/git-conf-$RANDOM-$$.c"
+	TMPO="$I/git-conf-$RANDOM-$$.o"
+	TMPS="$I/git-conf-$RANDOM-$$.S"
+}
+
+basic_tests() {
+	echocheck "if your build environment is sane"
+	cat > $TMPC <<EOF
+int main(void) { return 0; }
+EOF
+	{ cc_check && tmp_run; } || die "unusable compiler or produced binary"
+	echores yes
+}
+
+
+write_config() {
+	echo "Creating config.mak.autogen"
+
+	{
+		cat << EOF
+# -------- Generated by configure -----------
+
+CC = $_cc
+INSTALL = $_install
+
+EOF
+		test -z $_prefix || echo "prefix = $_prefix"
+		test -z $_bindir || echo "bindir = $_bindir"
+		test -z $_gitexecdir || echo "gitexecdir = $_gitexecdir"
+		test -z $_mandir || ( echo "mandir = $_mandir" && echo "export mandir" )
+		test -z $_templatedir || echo "template_dir = $_templatedir"
+		test -z $_gitpythondir || echo "GIT_PYTHON_DIR = $_gitpythondir"
+		echo
+		eval "$mkvars"
+	} > config.mak.autogen
+
+	cat << EOF
+
+Config files successfully generated by ./configure.
+You can inspect the results in \`\`./config.mak.autogen''.
+EOF
+}
+
+
+finish() {
+	# Last move:
+	rm -f "$TMPO" "$TMPC" "$TMPS" "$TMPCPP"
+}
+
+trap finish 0
diff --git a/config.mak.in b/config.mak.in
deleted file mode 100644
index 82c9781..0000000
--- a/config.mak.in
+++ /dev/null
@@ -1,18 +0,0 @@
-# git Makefile configuration, included in main Makefile
-# @configure_input@
-
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-bindir = @bindir@
-#gitexecdir = @libexecdir@/git-core/
-template_dir = @datadir@/git-core/templates/
-GIT_PYTHON_DIR = @datadir@/git-core/python
-
-mandir=@mandir@
-
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-export exec_prefix mandir
-export srcdir VPATH
-
diff --git a/configure b/configure
new file mode 100755
index 0000000..2604aa3
--- /dev/null
+++ b/configure
@@ -0,0 +1,78 @@
+#! /bin/sh
+#
+# This configure script is *not* autoconf-based and has different semantics.
+# It attempts to autodetect all settings and options where possible. It is
+# possible to override autodetection with the --enable-option/--disable-option
+# command line parameters.  --enable-option forces the option on skipping
+# autodetection. Yes, this means that compilation may fail and yes, this is not
+# how autoconf-based configure scripts behave.
+#
+# configure generates config.mak.autogen, then included in the Makefile.
+#
+# If you want to add a new check for $feature, add it at two places - to the
+# variable list and to the checks section. You will find both below.
+#
+#############################################################################
+
+[ -f ./config-lib.sh ] || {
+	echo "config-lib.sh not found; please run ./configure from the source tree" >&2
+	exit 1
+}
+. ./config-lib.sh
+
+
+
+#############################################################################
+
+# List variables for features and libraries here:
+
+add_feature "_no_symlink_head" "no-symlink-head" "NO_SYMLINK_HEAD" "auto" \
+"  --enable-no-symlink-head  Never have .git/HEAD as a symbolic link"
+
+add_feature "_nsec" "nsec" "USE_NSEC" "no" \
+"  --enable-nsec          Use sub-second resolution when checking mtimes"
+
+add_library "_expat" "expat" " NO_EXPAT" "auto" \
+"  --without-expat        Disable libexpat support (disables git-http-push)"
+
+
+#############################################################################
+
+
+process_params "$@"
+test_setup
+basic_tests
+
+
+#############################################################################
+
+
+echocheck "whether to prohibit usage of symlinked HEAD"
+if test "$_no_symlink_head" = auto ; then
+	if win32; then
+		_no_symlink_head=yes
+	else
+		_no_symlink_head=no
+	fi
+fi
+echores "$_no_symlink_head"
+
+
+echocheck "for expat"
+if test "$_expat" = auto ; then
+	cat > $TMPC <<EOF
+#include <expat.h>
+int main(void) { return 0; }
+EOF
+	_expat=no
+	cc_check -lexpat && _expat=yes
+fi
+echores "$_expat"
+
+
+# Insert tests for features and libraries here.
+
+#############################################################################
+
+
+write_config
diff --git a/configure.ac b/configure.ac
deleted file mode 100644
index a0374d4..0000000
--- a/configure.ac
+++ /dev/null
@@ -1,14 +0,0 @@
-#                                               -*- Autoconf -*-
-# Process this file with autoconf to produce a configure script.
-
-AC_PREREQ(2.59)
-AC_INIT([git], [1.4.1], [git@vger.kernel.org])
-
-AC_CONFIG_SRCDIR([git.c])
-
-config_file=config.mak.autogen
-config_in=config.mak.in
-
-# Output files
-AC_CONFIG_FILES(["${config_file}":"${config_in}"])
-AC_OUTPUT

^ permalink raw reply related

* Re: git-fetch per-repository speed issues
From: Ryan Anderson @ 2006-07-04  1:22 UTC (permalink / raw)
  To: Jeff King; +Cc: Linus Torvalds, Keith Packard, Git Mailing List
In-Reply-To: <20060704002138.GB5716@coredump.intra.peff.net>

[-- Attachment #1: Type: text/plain, Size: 1158 bytes --]

Jeff King wrote:
> On Mon, Jul 03, 2006 at 04:14:10PM -0700, Linus Torvalds wrote:
>
>   
>> Well, you could use multiple branches in the same repository, even if they 
>> are totally unrealated. That would allow you to fetch them all in one go.
>>     
>
> One annoying thing about this is that you may want to have several of
> the branches checked out at a time (i.e., you want the actual directory
> structure of libXrandr/, Xorg/, etc). You could pull everything down
> into one repo and point small pseudo-repos at it with alternates, but I
> would think that would become a mess with pushes. You can do some magic
> with read-tree --prefix, but again, I'm not sure how you'd make commits
> on the correct branch.  Is there an easier way to do this?
>   
You can have multiple source trees, one per 'branch' (which is a bit of
a bad term here), and have completely unrelated things in the branches.

See, for an example, the main Git repo, which has the "man", "html", and
"todo" branches, logically distinct and (somewhat) unrelated to the main
branch tucked away in "master".

-- 

Ryan Anderson
  sometimes Pug Majere



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

^ permalink raw reply

* [PATCH 1/2] annotate: Support annotation of files on other revisions.
From: Ryan Anderson @ 2006-07-04  1:30 UTC (permalink / raw)
  To: junkio; +Cc: git, Ryan Anderson
In-Reply-To: <11519766021208-git-send-email-ryan@michonline.com>

This is a bug fix, and cleans up one or two other things spotted during the
course of tracking down the main bug here.

Also, the test-suite is updated to reflect this case.

Signed-off-by: Ryan Anderson <ryan@michonline.com>
(cherry picked from 2f7554b4db3ab2c2d3866b160245c91c9236fc9a commit)
---
 t/t8001-annotate.sh |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/t/t8001-annotate.sh b/t/t8001-annotate.sh
index 2496397..70e2ad2 100755
--- a/t/t8001-annotate.sh
+++ b/t/t8001-annotate.sh
@@ -6,4 +6,10 @@ test_description='git-annotate'
 PROG='git annotate'
 . ../annotate-tests.sh
 
+test_expect_success \
+    'Annotating an old revision works' \
+    '[ $(git annotate file master | awk "{print \$3}" | grep -c "^A$") == 2 ] && \
+     [ $(git annotate file master | awk "{print \$3}" | grep -c "^B$") == 2 ]'
+
+
 test_done
-- 
1.4.1.g8fced

^ permalink raw reply related

* [PATCH 2/2] annotate: Correct most merge following to annotate correctly.
From: Ryan Anderson @ 2006-07-04  1:30 UTC (permalink / raw)
  To: junkio; +Cc: git, Ryan Anderson
In-Reply-To: <11519766033852-git-send-email-ryan@michonline.com>

There is still a bug involving octopus merges, somewhere, but this gets normal
merges correct, so it's still an improvement over the existing version.

Signed-off-by: Ryan Anderson <ryan@michonline.com>
---
 git-annotate.perl |  197 +++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 139 insertions(+), 58 deletions(-)

diff --git a/git-annotate.perl b/git-annotate.perl
index a6a7a48..9a7b022 100755
--- a/git-annotate.perl
+++ b/git-annotate.perl
@@ -102,10 +102,10 @@ while (my $bound = pop @stack) {
 push @revqueue, $head;
 init_claim( defined $starting_rev ? $head : 'dirty');
 unless (defined $starting_rev) {
-	my $diff = open_pipe("git","diff","-R", "HEAD", "--",$filename)
+	my $diff = open_pipe("git","diff","HEAD", "--",$filename)
 		or die "Failed to call git diff to check for dirty state: $!";
 
-	_git_diff_parse($diff, $head, "dirty", (
+	_git_diff_parse($diff, [$head], "dirty", (
 				'author' => gitvar_name("GIT_AUTHOR_IDENT"),
 				'author_date' => sprintf("%s +0000",time()),
 				)
@@ -154,14 +154,13 @@ sub handle_rev {
 
 		my %revinfo = git_commit_info($rev);
 
-		foreach my $p (@{$revs{$rev}{'parents'}}) {
-
-			git_diff_parse($p, $rev, %revinfo);
-			push @revqueue, $p;
-		}
+		if (exists $revs{$rev}{parents} &&
+		    scalar @{$revs{$rev}{parents}} != 0) {
 
+			git_diff_parse($revs{$rev}{'parents'}, $rev, %revinfo);
+			push @revqueue, @{$revs{$rev}{'parents'}};
 
-		if (scalar @{$revs{$rev}{parents}} == 0) {
+ 		} else {
 			# We must be at the initial rev here, so claim everything that is left.
 			for (my $i = 0; $i < @{$revs{$rev}{lines}}; $i++) {
 				if (ref ${$revs{$rev}{lines}}[$i] eq '' || ${$revs{$rev}{lines}}[$i][1] eq '') {
@@ -252,89 +251,171 @@ sub git_find_parent {
 # Get a diff between the current revision and a parent.
 # Record the commit information that results.
 sub git_diff_parse {
-	my ($parent, $rev, %revinfo) = @_;
+	my ($parents, $rev, %revinfo) = @_;
+
+	my @filenames = ( $revs{$rev}{'filename'} );
+	foreach my $parent (@$parents) {
+		push @filenames, $revs{$parent}{'filename'};
+	}
 
-	my $diff = open_pipe("git-diff-tree","-M","-p",$rev,$parent,"--",
-			$revs{$rev}{'filename'}, $revs{$parent}{'filename'})
+	my $diff = open_pipe("git-diff-tree","-M","-p","-c",$rev,"--",
+				@filenames )
 		or die "Failed to call git-diff for annotation: $!";
 
-	_git_diff_parse($diff, $parent, $rev, %revinfo);
+	_git_diff_parse($diff, $parents, $rev, %revinfo);
 
 	close($diff);
 }
 
 sub _git_diff_parse {
-	my ($diff, $parent, $rev, %revinfo) = @_;
+	my ($diff, $parents, $rev, %revinfo) = @_;
+
+	my $ri = 0;
 
-	my ($ri, $pi) = (0,0);
 	my $slines = $revs{$rev}{'lines'};
-	my @plines;
+	my (%plines, %pi);
 
 	my $gotheader = 0;
 	my ($remstart);
-	my ($hunk_start, $hunk_index);
+	my $parent_count = @$parents;
+
+	my $diff_header_regexp = "^@";
+	$diff_header_regexp .= "@" x @$parents;
+	$diff_header_regexp .= ' -\d+,\d+' x @$parents;
+	$diff_header_regexp .= ' \+(\d+),\d+';
+
+	my %claim_regexps;
+	my $allparentplus = '^' . '\\+' x @$parents . '(.*)$';
+
+	{
+		my $i = 0;
+		foreach my $parent (@$parents) {
+
+			$pi{$parent} = 0;
+			my $r = '^' . '.' x @$parents . '(.*)$';
+			my $p = $r;		     
+			substr($p,$i+1, 1) = '\\+';
+
+			my $m = $r;
+			substr($m,$i+1, 1) = '-';
+
+			$claim_regexps{$parent}{plus} = $p;
+			$claim_regexps{$parent}{minus} = $m;
+
+			$plines{$parent} = [];
+
+			$i++;
+		}
+	}
+
+	DIFF:
 	while(<$diff>) {
 		chomp;
-		if (m/^@@ -(\d+),(\d+) \+(\d+),(\d+)/) {
-			$remstart = $1;
-			# Adjust for 0-based arrays
-			$remstart--;
-			# Reinit hunk tracking.
-			$hunk_start = $remstart;
-			$hunk_index = 0;
+		if (m/$diff_header_regexp/) {
+			$remstart = $1 - 1;
+			# (0-based arrays)
+
 			$gotheader = 1;
 
-			for (my $i = $ri; $i < $remstart; $i++) {
-				$plines[$pi++] = $slines->[$i];
-				$ri++;
+			printf("Copying from %d to %d\n", $ri, $remstart);
+			foreach my $parent (@$parents) {
+				for (my $i = $ri; $i < $remstart; $i++) {
+					$plines{$parent}[$pi{$parent}++] = $slines->[$i];
+				}
 			}
-			next;
-		} elsif (!$gotheader) {
-			next;
-		}
+			$ri = $remstart;
 
-		if (m/^\+(.*)$/) {
-			my $line = $1;
-			$plines[$pi++] = [ $line, '', '', '', 0 ];
-			next;
+			next DIFF;
 
-		} elsif (m/^-(.*)$/) {
-			my $line = $1;
-			if (get_line($slines, $ri) eq $line) {
-				# Found a match, claim
-				claim_line($ri, $rev, $slines, %revinfo);
-			} else {
-				die sprintf("Sync error: %d/%d\n|%s\n|%s\n%s => %s\n",
-						$ri, $hunk_start + $hunk_index,
-						$line,
-						get_line($slines, $ri),
-						$rev, $parent);
-			}
-			$ri++;
+		} elsif (!$gotheader) {
+			# Skip over the leadin.
+			next DIFF;
+		}
 
-		} elsif (m/^\\/) {
+		if (m/^\\/) {
 			;
 			# Skip \No newline at end of file.
 			# But this can be internationalized, so only look
 			# for an initial \
 
 		} else {
-			if (substr($_,1) ne get_line($slines,$ri) ) {
-				die sprintf("Line %d (%d) does not match:\n|%s\n|%s\n%s => %s\n",
-						$hunk_start + $hunk_index, $ri,
-						substr($_,1),
-						get_line($slines,$ri),
-						$rev, $parent);
+			my %claims = ();
+			my $negclaim = 0;
+			my $allclaimed = 0;
+			my $line;
+
+			if (m/$allparentplus/) {
+				claim_line($ri, $rev, $slines, %revinfo);
+				$allclaimed = 1;
+
+			}
+
+			PARENT:
+			foreach my $parent (keys %claim_regexps) {
+				my $m = $claim_regexps{$parent}{minus};
+				my $p = $claim_regexps{$parent}{plus};
+
+				if (m/$m/) {
+					$line = $1;
+					$plines{$parent}[$pi{$parent}++] = [ $line, '', '', '', 0 ];
+					$negclaim++;
+
+				} elsif (m/$p/) {
+					$line = $1;
+					if (get_line($slines, $ri) eq $line) {
+						# Found a match, claim
+					       	$claims{$parent}++;
+
+					} else {
+						die sprintf("Sync error: %d\n|%s\n|%s\n%s => %s\n",
+								$ri, $line,
+								get_line($slines, $ri),
+								$rev, $parent);
+					}
+				}
+			}
+
+			if (%claims) {
+				foreach my $parent (@$parents) {
+					next if $claims{$parent} || $allclaimed;
+					$plines{$parent}[$pi{$parent}++] = $slines->[$ri];
+					    #[ $line, '', '', '', 0 ];
+				}
+				$ri++;
+
+			} elsif ($negclaim) {
+				next DIFF;
+
+			} else {
+				if (substr($_,scalar @$parents) ne get_line($slines,$ri) ) {
+				        foreach my $parent (@$parents) {
+						printf("parent %s is on line %d\n", $parent, $pi{$parent});
+					}
+
+					die sprintf("Line %d, does not match:\n|%s|\n|%s|\n%s\n",
+						    $ri,
+						substr($_,scalar @$parents),
+						get_line($slines,$ri), $rev);
+				}
+				foreach my $parent (@$parents) {
+					$plines{$parent}[$pi{$parent}++] = $slines->[$ri];
+				}
+				$ri++;
 			}
-			$plines[$pi++] = $slines->[$ri++];
 		}
-		$hunk_index++;
 	}
+
 	for (my $i = $ri; $i < @{$slines} ; $i++) {
-		push @plines, $slines->[$ri++];
+		foreach my $parent (@$parents) {
+			push @{$plines{$parent}}, $slines->[$ri];
+		}
+		$ri++;
+	}
+
+	foreach my $parent (@$parents) {
+		$revs{$parent}{lines} = $plines{$parent};
 	}
 
-	$revs{$parent}{lines} = \@plines;
 	return;
 }
 
-- 
1.4.1.g8fced

^ permalink raw reply related

* [PATCH 0/2] Fix handling of merges in git-annotate
From: Ryan Anderson @ 2006-07-04  1:30 UTC (permalink / raw)
  To: junkio; +Cc: git

This 2-patch series is a major overhaul to the way git-annotate calculates the blame for each line.

Instead of parsing each diff in reverse, this uses the output from "git
diff-tree --combined", so that merges can be handled sanely.

Ryan Anderson:
      annotate: Support annotation of files on other revisions.
      annotate: Correct most merge following to annotate correctly.

 git-annotate.perl   |  197 ++++++++++++++++++++++++++++++++++++---------------
 t/t8001-annotate.sh |    6 ++
 2 files changed, 145 insertions(+), 58 deletions(-)

^ permalink raw reply

* Re: [PATCH 0/2] Fix handling of merges in git-annotate
From: Ryan Anderson @ 2006-07-04  1:34 UTC (permalink / raw)
  To: Ryan Anderson; +Cc: junkio, git
In-Reply-To: <11519766021208-git-send-email-ryan@michonline.com>

[-- Attachment #1: Type: text/plain, Size: 411 bytes --]

Ryan Anderson wrote:
> This 2-patch series is a major overhaul to the way git-annotate calculates the blame for each line.
>
> Instead of parsing each diff in reverse, this uses the output from "git
> diff-tree --combined", so that merges can be handled sanely.
>   
I forgot:

Please pull from http://h4x0r5.com/~ryan/git/ryan.git annotate-upstream

-- 

Ryan Anderson
  sometimes Pug Majere



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

^ permalink raw reply

* Re: git-fetch per-repository speed issues
From: Jeff King @ 2006-07-04  1:44 UTC (permalink / raw)
  To: Ryan Anderson; +Cc: Linus Torvalds, Keith Packard, Git Mailing List
In-Reply-To: <44A9C2D2.6010409@michonline.com>

On Mon, Jul 03, 2006 at 06:22:26PM -0700, Ryan Anderson wrote:

> You can have multiple source trees, one per 'branch' (which is a bit of
> a bad term here), and have completely unrelated things in the branches.
> 
> See, for an example, the main Git repo, which has the "man", "html", and
> "todo" branches, logically distinct and (somewhat) unrelated to the main
> branch tucked away in "master".

Right, I know, but my complaint is that I can't then turn that into a
directory hierarchy of .../man, .../html, .../todo that are all checked
out at the same time (there are obviously ways of playing with it, say
by setting GIT_DIR and doing a checkout in those directories, but then I
can't use git in the normal way).

The best I can come up with is having man, html, and todo repos pointing
to the one (now local) repo which contains everything. But then pushing
is a two-step process.

-Peff

^ permalink raw reply

* Re: [PATCH] send-email: do not barf when Term::ReadLine does not like your terminal
From: Ryan Anderson @ 2006-07-04  1:44 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7vpsgn1ue8.fsf@assigned-by-dhcp.cox.net>

[-- Attachment #1: Type: text/plain, Size: 3080 bytes --]

Junio C Hamano wrote:
> As long as we do not need to readline from the terminal, we
> should not barf when starting up the program.  Without this
> patch, t9001 test on Cygwin occasionally died with the following
> error message:
>
> Unable to get Terminal Size. The TIOCGWINSZ ioctl didn't work. The COLUMNS and LINES environment variables didn't work. The resize program didn't work. at /usr/lib/perl5/vendor_perl/5.8/cygwin/Term/ReadKey.pm line 362.
> Compilation failed in require at /usr/lib/perl5/vendor_perl/5.8/Term/ReadLine/Perl.pm line 58.
>
> Signed-off-by: Junio C Hamano <junkio@cox.net>
> ---
>
>  * I do not use send-email myself that often so extra sets of
>    eyeballs are appreciated.
>   
Looks fine to me.

Acked-by: Ryan Anderson <ryan@michonline.com>

(I personally would have put the package declaration at the end of the
file, but it's not significant enough for me to send a patch, heh.)


>  git-send-email.perl   |   18 +++++++++++++++++-
>  t/t9001-send-email.sh |   11 +++++++----
>  2 files changed, 24 insertions(+), 5 deletions(-)
>
> diff --git a/git-send-email.perl b/git-send-email.perl
> index c5d9e73..b04b8f4 100755
> --- a/git-send-email.perl
> +++ b/git-send-email.perl
> @@ -22,6 +22,17 @@ use Term::ReadLine;
>  use Getopt::Long;
>  use Data::Dumper;
>  
> +package FakeTerm;
> +sub new {
> +	my ($class, $reason) = @_;
> +	return bless \$reason, shift;
> +}
> +sub readline {
> +	my $self = shift;
> +	die "Cannot use readline on FakeTerm: $$self";
> +}
> +package main;
> +
>  # most mail servers generate the Date: header, but not all...
>  $ENV{LC_ALL} = 'C';
>  use POSIX qw/strftime/;
> @@ -46,7 +57,12 @@ my $smtp_server;
>  # Example reply to:
>  #$initial_reply_to = ''; #<20050203173208.GA23964@foobar.com>';
>  
> -my $term = new Term::ReadLine 'git-send-email';
> +my $term = eval {
> +	new Term::ReadLine 'git-send-email';
> +};
> +if ($@) {
> +	$term = new FakeTerm "$@: going non-interactive";
> +}
>  
>  # Begin by accumulating all the variables (defined above), that we will end up
>  # needing, first, from the command line:
> diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
> index a61da1e..e9ea33c 100755
> --- a/t/t9001-send-email.sh
> +++ b/t/t9001-send-email.sh
> @@ -25,10 +25,13 @@ test_expect_success \
>       git add fake.sendmail
>       GIT_AUTHOR_NAME="A" git commit -a -m "Second."'
>  
> -test_expect_success \
> -    'Extract patches and send' \
> -    'git format-patch -n HEAD^1
> -     git send-email -from="Example <nobody@example.com>" --to=nobody@example.com --smtp-server="$(pwd)/fake.sendmail" ./0001*txt'
> +test_expect_success 'Extract patches' '
> +    patches=`git format-patch -n HEAD^1`
> +'
> +
> +test_expect_success 'Send patches' '
> +     git send-email -from="Example <nobody@example.com>" --to=nobody@example.com --smtp-server="$(pwd)/fake.sendmail" $patches 2>errors
> +'
>  
>  cat >expected <<\EOF
>  !nobody@example.com!
>   


-- 

Ryan Anderson
  sometimes Pug Majere



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

^ permalink raw reply

* New and hot I think, yes. Be delighted with
From: Marla @ 2006-07-04  1:54 UTC (permalink / raw)
  To: git

How are you bro ?

You crave to shoot like a film star… 

Show your girl a huge explosion as I used to do
 Have you some doubt?

 Check up here: http://www.basszass.com 

 We thank you for being our customer!

^ permalink raw reply

* Re: git-fetch per-repository speed issues
From: Ryan Anderson @ 2006-07-04  1:55 UTC (permalink / raw)
  To: Jeff King; +Cc: Linus Torvalds, Keith Packard, Git Mailing List
In-Reply-To: <20060704014441.GB9061@coredump.intra.peff.net>

[-- Attachment #1: Type: text/plain, Size: 1406 bytes --]

Jeff King wrote:
> On Mon, Jul 03, 2006 at 06:22:26PM -0700, Ryan Anderson wrote:
>
>   
>> You can have multiple source trees, one per 'branch' (which is a bit of
>> a bad term here), and have completely unrelated things in the branches.
>>
>> See, for an example, the main Git repo, which has the "man", "html", and
>> "todo" branches, logically distinct and (somewhat) unrelated to the main
>> branch tucked away in "master".
>>     
>
> Right, I know, but my complaint is that I can't then turn that into a
> directory hierarchy of .../man, .../html, .../todo that are all checked
> out at the same time (there are obviously ways of playing with it, say
> by setting GIT_DIR and doing a checkout in those directories, but then I
> can't use git in the normal way).
>
> The best I can come up with is having man, html, and todo repos pointing
> to the one (now local) repo which contains everything. But then pushing
> is a two-step process.
>
>   
Hrm, if I understand CVS at all, the old workflow was "cvsup a copy of
the repository, update a working tree against that", which is, I think,
actually even worse than the Git equivalent, since you can't reliably
even commit to that local clone of the CVS repository.

What am I missing?

You can still push directly upstream, I suppose, and just do 2-stage
pulls down.

-- 

Ryan Anderson
  sometimes Pug Majere



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

^ permalink raw reply

* Re: git-fetch per-repository speed issues
From: Linus Torvalds @ 2006-07-04  3:07 UTC (permalink / raw)
  To: Jeff King; +Cc: Keith Packard, Git Mailing List
In-Reply-To: <20060704002138.GB5716@coredump.intra.peff.net>



On Mon, 3 Jul 2006, Jeff King wrote:
> 
> Fetching by ssh actually makes two ssh connections (the second is to
> grab tags).

True. Although that should happen only if there are any new tags.

		Linus

^ permalink raw reply

* Re: git-fetch per-repository speed issues
From: Linus Torvalds @ 2006-07-04  3:21 UTC (permalink / raw)
  To: Keith Packard; +Cc: Git Mailing List, Junio C Hamano
In-Reply-To: <1151973438.4723.70.camel@neko.keithp.com>



On Mon, 3 Jul 2006, Keith Packard wrote:
> On Mon, 2006-07-03 at 16:14 -0700, Linus Torvalds wrote:
> > 
> > Well, you could use multiple branches in the same repository, even if they 
> > are totally unrealated. That would allow you to fetch them all in one go.
> 
> I'd like to avoid this; the hope is that most people won't ever need to
> look at most repositories; it would be somewhat like having glibc in the
> same repo as the kernel...

Sure, understood. I'm just saying that if you want to fetch in one go, 
it's one possibility.

However, your setup has something else seriously wrong.

> Yeah, I tried with the git protocol and it's a few seconds faster (about
> 14 seconds instead of 17). Ick.

That's -still- about 13 seconds too much.

> I think it might have something to do with the number of heads we're
> tracking.

It really shouldn't matter. You get all the heads in one go with a single 
connection, so if 32 heads takes 32 times longer, there's something wrong.

> > Also, one thing to try is to just do
> > 
> > 	strace -Ttt git-peek-remote ...
> 
> That's plenty fast, 0.410 seconds, with nothing ugly in the strace.

Ok, a "git fetch" really shouldn't take any longer than a single 
connection. However, the fact that you have 32 heads, and it takes pretty 
close to _exactly_ 32 times 0.410 seconds (32*0.410s = 13.1s) makes me 
suspect that "git fetch" is just broken and fetches one branch at a time. 

Which would be just stupid.

But look as I might, I see only that one "git-fetch-pack" in git-fetch.sh 
that should trigger. Once. Not 32 times. But your timings sure sound like 
it's doing a _lot_ more than it should.

Junio, any ideas?

Keithp, can you try this trivial patch? It _should_ say something like

	Fetching
	refs/heads/master
	refs/heads/...
	refs/heads/...
	...
	refs/heads/... from git://..../...

and more importantly, it should say so only once.

And then it should leave a "fetch.trace" file in your working directory, 
which should show where that _one_ thing spends its time.

		Linus

----
diff --git a/git-fetch.sh b/git-fetch.sh
index 48818f8..4739202 100755
--- a/git-fetch.sh
+++ b/git-fetch.sh
@@ -339,6 +339,8 @@ fetch_main () {
     ( : subshell because we muck with IFS
       IFS=" 	$LF"
       (
+	  echo "Fetching $rref from $remote" >&2
+	  strace -o fetch.trace -Ttt \
 	  git-fetch-pack $exec $keep --thin "$remote" $rref || echo failed "$remote"
       ) |
       while read sha1 remote_name

^ permalink raw reply related

* Re: Why's Git called Git ?
From: Linus Torvalds @ 2006-07-04  3:28 UTC (permalink / raw)
  To: Aaron Gray; +Cc: Git Mailing List
In-Reply-To: <013001c69f04$ae4e2400$0200a8c0@amd2500>



On Tue, 4 Jul 2006, Aaron Gray wrote:
>
> Why the name I could not find any answer in the documentation ?

It's really quite random. It needs to be a two- or three-letter thing just 
because I end up typing a lot. 

My favourite explanation is "I name all my projects after myself: first 
'Linux', now 'git'".

Which only makes sense if you know british slang.

The runner up was "Because 'twerp' was too hard to type".

But really, there's not a lot of real thinking behind it. The made-up 
acronym was "global information tracker", but that's a pretty bad excuse 
too.

It just happened. Don't ask me why. All the explanations are really made 
up after the fact.

		Linus

^ permalink raw reply

* Re: git-fetch per-repository speed issues
From: Junio C Hamano @ 2006-07-04  3:30 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: git
In-Reply-To: <Pine.LNX.4.64.0607032008590.12404@g5.osdl.org>

Linus Torvalds <torvalds@osdl.org> writes:

> Ok, a "git fetch" really shouldn't take any longer than a single 
> connection. However, the fact that you have 32 heads, and it takes pretty 
> close to _exactly_ 32 times 0.410 seconds (32*0.410s = 13.1s) makes me 
> suspect that "git fetch" is just broken and fetches one branch at a time. 
>
> Which would be just stupid.
>
> But look as I might, I see only that one "git-fetch-pack" in git-fetch.sh 
> that should trigger. Once. Not 32 times. But your timings sure sound like 
> it's doing a _lot_ more than it should.
>
> Junio, any ideas?

Isn't that because the repository have 32 subprojects, totally
unrelated content-wise?  If you have real stuff to pull from
there your pack generation needs to do 32 time as much work as
you would for a single head in that case.

If you are discussing "peek-remote runs, find out the 32 heads
are all up to date and no pack is generated" case, then you are
right.  There is one single fetch-pack to grab the specified
heads, and after that, an optional single ls-remote and
fetch-pack runs only once to follow all new tags.

^ permalink raw reply

* Re: git-fetch per-repository speed issues
From: Linus Torvalds @ 2006-07-04  3:40 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7vsllinj1m.fsf@assigned-by-dhcp.cox.net>



On Mon, 3 Jul 2006, Junio C Hamano wrote:
> 
> Isn't that because the repository have 32 subprojects, totally
> unrelated content-wise?  If you have real stuff to pull from
> there your pack generation needs to do 32 time as much work as
> you would for a single head in that case.

No, Keith said this was for the case where the fetching repository is 
already totally up-to-date:

    "And, it's painfully slow, even when the repository is up to date"

and gave a 17-second time.

			Linus

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox