* 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
* [PATCH] Additional merge-base tests
From: A Large Angry SCM @ 2006-07-04 3:55 UTC (permalink / raw)
To: Junio C Hamano, git
Signed-off-by: A Large Angry SCM <gitzilla@gmail.com>
---
This demonstrates a problem with git-merge-base.
t6010-merge-base.sh | 33 +++++++++++++++++++++++++++++++++
1 files changed, 33 insertions(+)
diff --git a/t/t6010-merge-base.sh b/t/t6010-merge-base.sh
index 1dce123..9a815bd 100755
--- a/t/t6010-merge-base.sh
+++ b/t/t6010-merge-base.sh
@@ -44,6 +44,31 @@ A=$(doit 1 A $B)
G=$(doit 7 G $B $E)
H=$(doit 8 H $A $F)
+# Setup for second test set
+#
+# PL PR
+# / \/ \
+# L2 C2 R2
+# | | |
+# L1 C1 R1
+# | | |
+# L0 C0 R0
+# \ | /
+# S
+
+S=$(doit 0 S)
+C0=$(doit -3 C0 $S)
+L0=$(doit 2 L0 $S)
+R0=$(doit 2 R0 $S)
+C1=$(doit -2 C1 $C0)
+L1=$(doit 3 L1 $L0)
+R1=$(doit 3 R1 $R0)
+C2=$(doit -1 C2 $C1)
+L2=$(doit 4 L2 $L1)
+R2=$(doit 4 R2 $R1)
+PL=$(doit 1 PL $L2 $C2)
+PR=$(doit 1 PR $C2 $R2)
+
test_expect_success 'compute merge-base (single)' \
'MB=$(git-merge-base G H) &&
expr "$(git-name-rev "$MB")" : "[0-9a-f]* tags/B"'
@@ -56,4 +81,12 @@ test_expect_success 'compute merge-base
'MB=$(git-show-branch --merge-base G H) &&
expr "$(git-name-rev "$MB")" : "[0-9a-f]* tags/B"'
+test_expect_success 'compute merge-base (single)' \
+ 'MB=$(git-merge-base PL PR) &&
+ expr "$(git-name-rev "$MB")" : "[0-9a-f]* tags/C2"'
+
+test_expect_success 'compute merge-base (all)' \
+ 'MB=$(git-merge-base --all PL PR) &&
+ expr "$(git-name-rev "$MB")" : "[0-9a-f]* tags/C2"'
+
test_done
^ permalink raw reply related
* Re: git-fetch per-repository speed issues
From: Keith Packard @ 2006-07-04 4:02 UTC (permalink / raw)
To: Linus Torvalds, Git Mailing List; +Cc: keithp
In-Reply-To: <Pine.LNX.4.64.0607032008590.12404@g5.osdl.org>
[-- Attachment #1: Type: text/plain, Size: 732 bytes --]
On Mon, 2006-07-03 at 20:21 -0700, Linus Torvalds wrote:
> Keithp, can you try this trivial patch? It _should_ say something like
Yeah, it says that only once. And, it runs the fetch-pack in about .5
seconds. And, now the whole process completes in 4.7 seconds; perhaps
the remote server is less loaded than earlier this afternoon? It's also
possible that I was running old git bits here, but I don't think so.
> And then it should leave a "fetch.trace" file in your working directory,
> which should show where that _one_ thing spends its time.
It looks boring to me and spent 0.55 from start to finish. I can send
along the whole trace if you have an acute desire to peer at it.
--
keith.packard@intel.com
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* Re: git-fetch per-repository speed issues
From: Linus Torvalds @ 2006-07-04 4:19 UTC (permalink / raw)
To: Keith Packard; +Cc: Git Mailing List
In-Reply-To: <1151985747.4723.102.camel@neko.keithp.com>
On Mon, 3 Jul 2006, Keith Packard wrote:
>
> Yeah, it says that only once. And, it runs the fetch-pack in about .5
> seconds. And, now the whole process completes in 4.7 seconds; perhaps
> the remote server is less loaded than earlier this afternoon?
Well, that's still strange. What takes 4.2 seconds then?
> > And then it should leave a "fetch.trace" file in your working directory,
> > which should show where that _one_ thing spends its time.
>
> It looks boring to me and spent 0.55 from start to finish. I can send
> along the whole trace if you have an acute desire to peer at it.
No, the 0.5 seconds is what I _expected_. There's something strange going
on in your git fetch that it takes any longer than that.
Can you instrument your "git-fetch.sh" script (just add random
(echo $LINENO ; date) >&2
lines all over) to see what is so expensive?
That fetch-pack really should be the most expensive part by far (and half
a second sounds right), but it clearly isn't. At 4.7s, your fetch is still
taking about ten times longer than it _should_.
Linus
^ permalink raw reply
* Re: git-fetch per-repository speed issues
From: Keith Packard @ 2006-07-04 4:30 UTC (permalink / raw)
To: Linus Torvalds; +Cc: keithp, Junio C Hamano, git
In-Reply-To: <Pine.LNX.4.64.0607032039010.12404@g5.osdl.org>
[-- Attachment #1: Type: text/plain, Size: 2093 bytes --]
On Mon, 2006-07-03 at 20:40 -0700, Linus Torvalds wrote:
> "And, it's painfully slow, even when the repository is up to date"
>
> and gave a 17-second time.
It's faster this evening, down to 8 seconds using ssh and 4 seconds
using git. I clearly need to force use of the git protocol. Anyone else
like the attached patch?
---
connect.c | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/connect.c b/connect.c
index 9a87bd9..e74eddc 100644
--- a/connect.c
+++ b/connect.c
@@ -303,6 +303,7 @@ enum protocol {
PROTO_LOCAL = 1,
PROTO_SSH,
PROTO_GIT,
+ PROTO_GIT_SSH,
};
static enum protocol get_protocol(const char *name)
@@ -312,9 +313,9 @@ static enum protocol get_protocol(const
if (!strcmp(name, "git"))
return PROTO_GIT;
if (!strcmp(name, "git+ssh"))
- return PROTO_SSH;
+ return PROTO_GIT_SSH;
if (!strcmp(name, "ssh+git"))
- return PROTO_SSH;
+ return PROTO_GIT_SSH;
die("I don't handle protocol '%s'", name);
}
@@ -572,6 +573,14 @@ static void git_proxy_connect(int fd[2],
close(pipefd[1][0]);
}
+/* returns whether the specified command can be interpreted by the
daemon */
+int git_is_daemon_command (const char *prog)
+{
+ if (!strcmp("git-upload-pack", prog))
+ return 1;
+ return 0;
+}
+
/*
* Yeah, yeah, fixme. Need to pass in the heads etc.
*/
@@ -641,7 +650,8 @@ int git_connect(int fd[2], char *url, co
*ptr = '\0';
}
- if (protocol == PROTO_GIT) {
+ if (protocol == PROTO_GIT ||
+ (protocol == PROTO_GIT_SSH && git_is_daemon_command (prog))) {
/* These underlying connection commands die() if they
* cannot connect.
*/
@@ -678,7 +688,7 @@ int git_connect(int fd[2], char *url, co
close(pipefd[0][1]);
close(pipefd[1][0]);
close(pipefd[1][1]);
- if (protocol == PROTO_SSH) {
+ if (protocol == PROTO_SSH || protocol == PROTO_GIT_SSH) {
const char *ssh, *ssh_basename;
ssh = getenv("GIT_SSH");
if (!ssh) ssh = "ssh";
--
1.4.1.g8fced-dirty
--
keith.packard@intel.com
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply related
* Re: git-fetch per-repository speed issues
From: Keith Packard @ 2006-07-04 5:05 UTC (permalink / raw)
To: Linus Torvalds; +Cc: keithp, Git Mailing List
In-Reply-To: <Pine.LNX.4.64.0607032115340.12404@g5.osdl.org>
[-- Attachment #1: Type: text/plain, Size: 865 bytes --]
On Mon, 2006-07-03 at 21:19 -0700, Linus Torvalds wrote:
> Can you instrument your "git-fetch.sh" script (just add random
>
> (echo $LINENO ; date) >&2
>
> lines all over) to see what is so expensive?
5 Start: 21:59:01.584648000
66 After args: 21:59:01.605987000
248 fetch_main() start: 21:59:02.408559000
339 fetch_main() before fetch-pack: 21:59:03.293228000
387 fetch_main() done: 21:59:04.784388000
422 After tag following: 21:59:05.311439000
438 All done: 21:59:05.315338000
fetch-pack itself took 0.421 seconds (measured with time(1)).
Looks like the bulk of the time here is caused by simple shell
processing overhead, some of which scales with the number of heads and
tags to track.
--
keith.packard@intel.com
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* Re: git-fetch per-repository speed issues
From: Keith Packard @ 2006-07-04 5:29 UTC (permalink / raw)
To: Linus Torvalds; +Cc: keithp, Git Mailing List
In-Reply-To: <Pine.LNX.4.64.0607032115340.12404@g5.osdl.org>
[-- Attachment #1: Type: text/plain, Size: 837 bytes --]
On Mon, 2006-07-03 at 21:19 -0700, Linus Torvalds wrote:
> Well, that's still strange. What takes 4.2 seconds then?
$ strace -e trace=execve -f git-fetch 2>&1 | grep execve | sed -e 's/^.*execve("//' -e 's/".*$//' | sort | uniq -c | sort -n
1 /bin/rm
1 /home/keithp/bin/git
1 /home/keithp/bin/git-fetch
1 /home/keithp/bin/git-fetch-pack
1 /home/keithp/bin/git-ls-remote
1 /home/keithp/bin/git-peek-remote
1 /usr/bin/sort
3 /bin/sed
4 /home/keithp/bin/git-repo-config
30 /bin/mkdir
30 /home/keithp/bin/git-cat-file
30 /home/keithp/bin/git-check-ref-format
30 /home/keithp/bin/git-merge-base
30 /usr/bin/dirname
64 /home/keithp/bin/git-rev-parse
361 /usr/bin/expr
someone sure likes 'expr'...
--
keith.packard@intel.com
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* Re: git-fetch per-repository speed issues
From: Linus Torvalds @ 2006-07-04 5:36 UTC (permalink / raw)
To: Keith Packard; +Cc: Git Mailing List
In-Reply-To: <1151989503.4723.126.camel@neko.keithp.com>
On Mon, 3 Jul 2006, Keith Packard wrote:
>
> 5 Start: 21:59:01.584648000
> 66 After args: 21:59:01.605987000
> 248 fetch_main() start: 21:59:02.408559000
> 339 fetch_main() before fetch-pack: 21:59:03.293228000
> 387 fetch_main() done: 21:59:04.784388000
> 422 After tag following: 21:59:05.311439000
> 438 All done: 21:59:05.315338000
>
> fetch-pack itself took 0.421 seconds (measured with time(1)).
>
> Looks like the bulk of the time here is caused by simple shell
> processing overhead, some of which scales with the number of heads and
> tags to track.
Ahh.. Do you have tons of tags at the other end?
Looking closer, I suspect a big part of it is that
git-ls-remote $upload_pack --tags "$remote" |
sed -ne 's|^\([0-9a-f]*\)[ ]\(refs/tags/.*\)^{}$|\1 \2|p' |
while read sha1 name
do
..
done
loop.
With a lot of tags, the shell overhead there can indeed be pretty
disgusting. And I was wrong - I thought it would do that git-ls-remote
only if the first time around we noticed that we would need to, but we do
actually do it all the time that we're fetching any new branches.
The sad part is that we really already got the list once, we just never
saved it away (ie "git-fetch-pack" actually _knows_ what the tags at the
other end are, and also knows which tags we already have, so if we made
git-fetch-pack just create that list and save it off, all the overhead
would just go away).
And yes, the shell script loops are really really simple, but some of them
are actually quadratic in the number of refs (O(local*remote)). If this
was a C program, we'd never even care, but with shell, the thing is slow
enough that having even a modest amount of tags and refs is going to just
make it waste a lot of time in shell scripting.
We already do a lot of the infrastructure for "git fetch" in C - the
remotes parsing etc is all things that "git fetch" used to share with "git
push", but "git push" has been a builtin C program for a while now. I
suspect we should just do the same to "git fetch", which would make all
these issues just totally go away.
Linus
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox