Merge branch 'maint'
authorJunio C Hamano <gitster@pobox.com>
Tue, 30 Jun 2009 23:12:35 +0000 (16:12 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 30 Jun 2009 23:12:35 +0000 (16:12 -0700)
* maint:
attr: plug minor memory leak
request-pull: really disable pager
Makes some cleanup/review in gittutorial
Makefile: git.o depends on library headers
git-submodule documentation: fix foreach example

1  2 
Documentation/git-submodule.txt
Makefile
index 470bd75ad9ca7760bef33c1c4a326c79da92eb2b,15b34d3760820655c76da3d3b8508db81c8e8dae..683ba1a1ebe080e6e093d27686068823448e459c
@@@ -9,12 -9,10 +9,12 @@@ git-submodule - Initialize, update or i
  SYNOPSIS
  --------
  [verse]
 -'git submodule' [--quiet] add [-b branch] [--] <repository> <path>
 +'git submodule' [--quiet] add [-b branch]
 +            [--reference <repository>] [--] <repository> <path>
  'git submodule' [--quiet] status [--cached] [--] [<path>...]
  'git submodule' [--quiet] init [--] [<path>...]
 -'git submodule' [--quiet] update [--init] [-N|--no-fetch] [--] [<path>...]
 +'git submodule' [--quiet] update [--init] [-N|--no-fetch] [--rebase]
 +            [--reference <repository>] [--] [<path>...]
  'git submodule' [--quiet] summary [--summary-limit <n>] [commit] [--] [<path>...]
  'git submodule' [--quiet] foreach <command>
  'git submodule' [--quiet] sync [--] [<path>...]
@@@ -115,9 -113,7 +115,9 @@@ init:
  update::
        Update the registered submodules, i.e. clone missing submodules and
        checkout the commit specified in the index of the containing repository.
 -      This will make the submodules HEAD be detached.
 +      This will make the submodules HEAD be detached unless '--rebase' or
 +      '--merge' is specified or the key `submodule.$name.update` is set to
 +      `rebase` or `merge`.
  +
  If the submodule is not yet initialized, and you just want to use the
  setting as stored in .gitmodules, you can automatically initialize the
@@@ -141,8 -137,9 +141,9 @@@ foreach:
        the processing to terminate. This can be overridden by adding '|| :'
        to the end of the command.
  +
- As an example, "git submodule foreach 'echo $path `git rev-parse HEAD`' will
- show the path and currently checked out commit for each submodule.
+ As an example, +git submodule foreach \'echo $path {backtick}git
+ rev-parse HEAD{backtick}'+ will show the path and currently checked out
+ commit for each submodule.
  
  sync::
        Synchronizes submodules' remote URL configuration setting
@@@ -181,33 -178,6 +182,33 @@@ OPTION
        This option is only valid for the update command.
        Don't fetch new objects from the remote site.
  
 +--merge::
 +      This option is only valid for the update command.
 +      Merge the commit recorded in the superproject into the current branch
 +      of the submodule. If this option is given, the submodule's HEAD will
 +      not be detached. If a merge failure prevents this process, you will
 +      have to resolve the resulting conflicts within the submodule with the
 +      usual conflict resolution tools.
 +      If the key `submodule.$name.update` is set to `merge`, this option is
 +      implicit.
 +
 +--rebase::
 +      This option is only valid for the update command.
 +      Rebase the current branch onto the commit recorded in the
 +      superproject. If this option is given, the submodule's HEAD will not
 +      be detached. If a a merge failure prevents this process, you will have
 +      to resolve these failures with linkgit:git-rebase[1].
 +      If the key `submodule.$name.update` is set to `rebase`, this option is
 +      implicit.
 +
 +--reference <repository>::
 +      This option is only valid for add and update commands.  These
 +      commands sometimes need to clone a remote repository. In this case,
 +      this option will be passed to the linkgit:git-clone[1] command.
 ++
 +*NOTE*: Do *not* use this option unless you have read the note
 +for linkgit:git-clone[1]'s --reference and --shared options carefully.
 +
  <path>...::
        Paths to submodule(s). When specified this will restrict the command
        to only operate on the submodules found at the specified paths.
diff --combined Makefile
index 41ab8e9e0db59647b2e872757ec05e86f615ea1c,c6b81d0125ee5ff37db7cd8aea1cd9a732915864..cdc40d05ca758714e506c0a403790e61fa82125e
+++ b/Makefile
@@@ -3,11 -3,6 +3,11 @@@ all:
  
  # Define V=1 to have a more verbose compile.
  #
 +# Define SHELL_PATH to a POSIX shell if your /bin/sh is broken.
 +#
 +# Define SANE_TOOL_PATH to a colon-separated list of paths to prepend
 +# to PATH if your tools in /usr/bin are broken.
 +#
  # Define SNPRINTF_RETURNS_BOGUS if your are on a system which snprintf()
  # or vsnprintf() return -1 instead of number of characters which would
  # have been written to the final string if enough space had been available.
  #
  # Define NO_MKDTEMP if you don't have mkdtemp in the C library.
  #
 +# Define NO_MKSTEMPS if you don't have mkstemps in the C library.
 +#
 +# Define NO_LIBGEN_H if you don't have libgen.h.
 +#
  # Define NO_SYS_SELECT_H if you don't have sys/select.h.
  #
  # Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link.
  # Define NEEDS_SOCKET if linking with libc is not enough (SunOS,
  # Patrick Mauritz).
  #
 +# Define NEEDS_RESOLV if linking with -lnsl and/or -lsocket is not enough.
 +# Notably on Solaris hstrerror resides in libresolv and on Solaris 7
 +# inet_ntop and inet_pton additionally reside there.
 +#
  # Define NO_MMAP if you want to avoid mmap.
  #
  # Define NO_PTHREADS if you do not have or do not want to use Pthreads.
  #
  # Define NO_CROSS_DIRECTORY_HARDLINKS if you plan to distribute the installed
  # programs as a tar, where bin/ and libexec/ might be on different file systems.
 +#
 +# Define USE_NED_ALLOCATOR if you want to replace the platforms default
 +# memory allocators with the nedmalloc allocator written by Niall Douglas.
  
  GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
        @$(SHELL_PATH) ./GIT-VERSION-GEN
@@@ -244,7 -228,6 +244,7 @@@ ETC_GITCONFIG = etc/gitconfi
  endif
  lib = lib
  # DESTDIR=
 +pathsep = :
  
  # default configuration for gitweb
  GITWEB_CONFIG = gitweb_config.perl
@@@ -352,6 -335,7 +352,6 @@@ PROGRAMS += git-index-pack$
  PROGRAMS += git-merge-index$X
  PROGRAMS += git-merge-tree$X
  PROGRAMS += git-mktag$X
 -PROGRAMS += git-mktree$X
  PROGRAMS += git-pack-redundant$X
  PROGRAMS += git-patch-id$X
  PROGRAMS += git-shell$X
@@@ -605,7 -589,6 +605,7 @@@ BUILTIN_OBJS += builtin-merge-base.
  BUILTIN_OBJS += builtin-merge-file.o
  BUILTIN_OBJS += builtin-merge-ours.o
  BUILTIN_OBJS += builtin-merge-recursive.o
 +BUILTIN_OBJS += builtin-mktree.o
  BUILTIN_OBJS += builtin-mv.o
  BUILTIN_OBJS += builtin-name-rev.o
  BUILTIN_OBJS += builtin-pack-objects.o
@@@ -652,12 -635,10 +652,12 @@@ EXTLIBS 
  
  ifeq ($(uname_S),Linux)
        NO_STRLCPY = YesPlease
 +      NO_MKSTEMPS = YesPlease
        THREADED_DELTA_SEARCH = YesPlease
  endif
  ifeq ($(uname_S),GNU/kFreeBSD)
        NO_STRLCPY = YesPlease
 +      NO_MKSTEMPS = YesPlease
        THREADED_DELTA_SEARCH = YesPlease
  endif
  ifeq ($(uname_S),UnixWare)
        SHELL_PATH = /usr/local/bin/bash
        NO_IPV6 = YesPlease
        NO_HSTRERROR = YesPlease
 +      NO_MKSTEMPS = YesPlease
        BASIC_CFLAGS += -Kthread
        BASIC_CFLAGS += -I/usr/local/include
        BASIC_LDFLAGS += -L/usr/local/lib
@@@ -693,7 -673,6 +693,7 @@@ ifeq ($(uname_S),SCO_SV
        SHELL_PATH = /usr/bin/bash
        NO_IPV6 = YesPlease
        NO_HSTRERROR = YesPlease
 +      NO_MKSTEMPS = YesPlease
        BASIC_CFLAGS += -I/usr/local/include
        BASIC_LDFLAGS += -L/usr/local/lib
        NO_STRCASESTR = YesPlease
@@@ -718,21 -697,11 +718,21 @@@ ifeq ($(uname_S),SunOS
        NEEDS_SOCKET = YesPlease
        NEEDS_NSL = YesPlease
        SHELL_PATH = /bin/bash
 +      SANE_TOOL_PATH = /usr/xpg6/bin:/usr/xpg4/bin
        NO_STRCASESTR = YesPlease
        NO_MEMMEM = YesPlease
 -      NO_HSTRERROR = YesPlease
        NO_MKDTEMP = YesPlease
 -      OLD_ICONV = UnfortunatelyYes
 +      NO_MKSTEMPS = YesPlease
 +      ifeq ($(uname_R),5.7)
 +              NEEDS_RESOLV = YesPlease
 +              NO_IPV6 = YesPlease
 +              NO_SOCKADDR_STORAGE = YesPlease
 +              NO_UNSETENV = YesPlease
 +              NO_SETENV = YesPlease
 +              NO_STRLCPY = YesPlease
 +              NO_C99_FORMAT = YesPlease
 +              NO_STRTOUMAX = YesPlease
 +      endif
        ifeq ($(uname_R),5.8)
                NO_UNSETENV = YesPlease
                NO_SETENV = YesPlease
                NO_C99_FORMAT = YesPlease
                NO_STRTOUMAX = YesPlease
        endif
 -      INSTALL = ginstall
 +      ifdef NO_IPV6
 +              NEEDS_RESOLV = YesPlease
 +      endif
 +      INSTALL = /usr/ucb/install
        TAR = gtar
 -      BASIC_CFLAGS += -D__EXTENSIONS__
 +      BASIC_CFLAGS += -D__EXTENSIONS__ -D__sun__
  endif
  ifeq ($(uname_O),Cygwin)
        NO_D_TYPE_IN_DIRENT = YesPlease
        NO_D_INO_IN_DIRENT = YesPlease
        NO_STRCASESTR = YesPlease
        NO_MEMMEM = YesPlease
 +      NO_MKSTEMPS = YesPlease
        NO_SYMLINK_HEAD = YesPlease
        NEEDS_LIBICONV = YesPlease
        NO_FAST_WORKING_DIRECTORY = UnfortunatelyYes
@@@ -801,13 -766,11 +801,13 @@@ ifeq ($(uname_S),NetBSD
        BASIC_LDFLAGS += -L/usr/pkg/lib $(CC_LD_DYNPATH)/usr/pkg/lib
        THREADED_DELTA_SEARCH = YesPlease
        USE_ST_TIMESPEC = YesPlease
 +      NO_MKSTEMPS = YesPlease
  endif
  ifeq ($(uname_S),AIX)
        NO_STRCASESTR=YesPlease
        NO_MEMMEM = YesPlease
        NO_MKDTEMP = YesPlease
 +      NO_MKSTEMPS = YesPlease
        NO_STRLCPY = YesPlease
        NO_NSEC = YesPlease
        FREAD_READS_DIRECTORIES = UnfortunatelyYes
@@@ -823,14 -786,12 +823,14 @@@ endi
  ifeq ($(uname_S),GNU)
        # GNU/Hurd
        NO_STRLCPY=YesPlease
 +      NO_MKSTEMPS = YesPlease
  endif
  ifeq ($(uname_S),IRIX64)
        NO_IPV6=YesPlease
        NO_SETENV=YesPlease
        NO_STRCASESTR=YesPlease
        NO_MEMMEM = YesPlease
 +      NO_MKSTEMPS = YesPlease
        NO_STRLCPY = YesPlease
        NO_SOCKADDR_STORAGE=YesPlease
        SHELL_PATH=/usr/gnu/bin/bash
@@@ -843,7 -804,6 +843,7 @@@ ifeq ($(uname_S),HP-UX
        NO_SETENV=YesPlease
        NO_STRCASESTR=YesPlease
        NO_MEMMEM = YesPlease
 +      NO_MKSTEMPS = YesPlease
        NO_STRLCPY = YesPlease
        NO_MKDTEMP = YesPlease
        NO_UNSETENV = YesPlease
@@@ -856,10 -816,9 +856,10 @@@ ifneq (,$(findstring CYGWIN,$(uname_S))
        UNRELIABLE_FSTAT = UnfortunatelyYes
  endif
  ifneq (,$(findstring MINGW,$(uname_S)))
 +      pathsep = ;
        NO_PREAD = YesPlease
        NO_OPENSSL = YesPlease
 -      NO_CURL = YesPlease
 +      NO_LIBGEN_H = YesPlease
        NO_SYMLINK_HEAD = YesPlease
        NO_IPV6 = YesPlease
        NO_SETENV = YesPlease
        NO_STRCASESTR = YesPlease
        NO_STRLCPY = YesPlease
        NO_MEMMEM = YesPlease
 -      NO_PTHREADS = YesPlease
        NEEDS_LIBICONV = YesPlease
        OLD_ICONV = YesPlease
        NO_C99_FORMAT = YesPlease
        NO_STRTOUMAX = YesPlease
        NO_MKDTEMP = YesPlease
 +      NO_MKSTEMPS = YesPlease
        SNPRINTF_RETURNS_BOGUS = YesPlease
        NO_SVN_TESTS = YesPlease
        NO_PERL_MAKEMAKER = YesPlease
        NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
        NO_NSEC = YesPlease
        USE_WIN32_MMAP = YesPlease
 +      USE_NED_ALLOCATOR = YesPlease
        UNRELIABLE_FSTAT = UnfortunatelyYes
        OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
        COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat -Icompat/regex -Icompat/fnmatch
 -      COMPAT_CFLAGS += -DSNPRINTF_SIZE_CORR=1
        COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
        COMPAT_OBJS += compat/mingw.o compat/fnmatch/fnmatch.o compat/regex/regex.o compat/winansi.o
        EXTLIBS += -lws2_32
        X = .exe
 +ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
 +      htmldir=doc/git/html/
 +      prefix =
 +      INSTALL = /bin/install
 +      EXTLIBS += /mingw/lib/libz.a
 +      NO_R_TO_GCC_LINKER = YesPlease
 +      INTERNAL_QSORT = YesPlease
 +      THREADED_DELTA_SEARCH = YesPlease
 +else
 +      NO_CURL = YesPlease
 +      NO_PTHREADS = YesPlease
 +endif
  endif
  ifneq (,$(findstring arm,$(uname_M)))
        ARM_SHA1 = YesPlease
 +      NO_MKSTEMPS = YesPlease
  endif
  
  -include config.mak.autogen
  -include config.mak
  
 +ifdef SANE_TOOL_PATH
 +SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH))
 +BROKEN_PATH_FIX = 's|^\# @@BROKEN_PATH_FIX@@$$|git_broken_path_fix $(SANE_TOOL_PATH_SQ)|'
 +PATH := $(SANE_TOOL_PATH):${PATH}
 +else
 +BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d'
 +endif
 +
  ifeq ($(uname_S),Darwin)
        ifndef NO_FINK
                ifeq ($(shell test -d /sw/lib && echo y),y)
@@@ -944,11 -882,6 +944,11 @@@ ifndef CC_LD_DYNPAT
        endif
  endif
  
 +ifdef NO_LIBGEN_H
 +      COMPAT_CFLAGS += -DNO_LIBGEN_H
 +      COMPAT_OBJS += compat/basename.o
 +endif
 +
  ifdef NO_CURL
        BASIC_CFLAGS += -DNO_CURL
  else
@@@ -1021,9 -954,6 +1021,9 @@@ endi
  ifdef NEEDS_NSL
        EXTLIBS += -lnsl
  endif
 +ifdef NEEDS_RESOLV
 +      EXTLIBS += -lresolv
 +endif
  ifdef NO_D_TYPE_IN_DIRENT
        BASIC_CFLAGS += -DNO_D_TYPE_IN_DIRENT
  endif
@@@ -1079,10 -1009,6 +1079,10 @@@ ifdef NO_MKDTEM
        COMPAT_CFLAGS += -DNO_MKDTEMP
        COMPAT_OBJS += compat/mkdtemp.o
  endif
 +ifdef NO_MKSTEMPS
 +      COMPAT_CFLAGS += -DNO_MKSTEMPS
 +      COMPAT_OBJS += compat/mkstemps.o
 +endif
  ifdef NO_UNSETENV
        COMPAT_CFLAGS += -DNO_UNSETENV
        COMPAT_OBJS += compat/unsetenv.o
@@@ -1201,11 -1127,6 +1201,11 @@@ ifdef UNRELIABLE_FSTA
        BASIC_CFLAGS += -DUNRELIABLE_FSTAT
  endif
  
 +ifdef USE_NED_ALLOCATOR
 +       COMPAT_CFLAGS += -DUSE_NED_ALLOCATOR -DOVERRIDE_STRDUP -DNDEBUG -DREPLACE_SYSTEM_ALLOCATOR -Icompat/nedmalloc
 +       COMPAT_OBJS += compat/nedmalloc/nedmalloc.o
 +endif
 +
  ifeq ($(TCLTK_PATH),)
  NO_TCLTK=NoThanks
  endif
@@@ -1280,7 -1201,7 +1280,7 @@@ SHELL = $(SHELL_PATH
  
  all:: shell_compatibility_test $(ALL_PROGRAMS) $(BUILT_INS) $(OTHER_PROGRAMS) GIT-BUILD-OPTIONS
  ifneq (,$X)
 -      $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), test '$p' -ef '$p$X' || $(RM) '$p';)
 +      $(QUIET_BUILT_IN)$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), test '$p' -ef '$p$X' || $(RM) '$p';)
  endif
  
  all::
@@@ -1331,9 -1252,9 +1331,9 @@@ $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %
        $(QUIET_GEN)$(RM) $@ $@+ && \
        sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
            -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
 -          -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
            -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
            -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
 +          -e $(BROKEN_PATH_FIX) \
            $@.sh >$@+ && \
        chmod +x $@+ && \
        mv $@+ $@
@@@ -1350,7 -1271,7 +1350,7 @@@ $(patsubst %.perl,%,$(SCRIPT_PERL)): % 
        sed -e '1{' \
            -e '        s|#!.*perl|#!$(PERL_PATH_SQ)|' \
            -e '        h' \
 -          -e '        s=.*=use lib (split(/:/, $$ENV{GITPERLLIB} || "@@INSTLIBDIR@@"));=' \
 +          -e '        s=.*=use lib (split(/$(pathsep)/, $$ENV{GITPERLLIB} || "@@INSTLIBDIR@@"));=' \
            -e '        H' \
            -e '        x' \
            -e '}' \
@@@ -1464,7 -1385,7 +1464,7 @@@ git-http-push$X: revision.o http.o http
                $(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
  
  $(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H)
- $(patsubst git-%$X,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h)
+ $(patsubst git-%$X,%.o,$(PROGRAMS)) git.o: $(LIB_H) $(wildcard */*.h)
  builtin-revert.o wt-status.o: wt-status.h
  
  $(LIB_FILE): $(LIB_OBJS)
@@@ -1573,8 -1494,6 +1573,8 @@@ test-delta$X: diff-delta.o patch-delta.
  
  test-parse-options$X: parse-options.o
  
 +test-parse-options.o: parse-options.h
 +
  .PRECIOUS: $(patsubst test-%$X,test-%.o,$(TEST_PROGRAMS))
  
  test-%$X: test-%.o $(GITLIBS)
@@@ -1722,7 -1641,7 +1722,7 @@@ distclean: clea
        $(RM) configure
  
  clean:
 -      $(RM) *.o mozilla-sha1/*.o arm/*.o ppc/*.o compat/*.o xdiff/*.o \
 +      $(RM) *.o mozilla-sha1/*.o arm/*.o ppc/*.o compat/*.o compat/*/*.o xdiff/*.o \
                $(LIB_FILE) $(XDIFF_LIB)
        $(RM) $(ALL_PROGRAMS) $(BUILT_INS) git$X
        $(RM) $(TEST_PROGRAMS)