Merge branch 'il/remote-fd-ext'
authorJunio C Hamano <gitster@pobox.com>
Wed, 8 Dec 2010 19:24:14 +0000 (11:24 -0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 8 Dec 2010 19:24:14 +0000 (11:24 -0800)
* il/remote-fd-ext:
remote-fd/ext: finishing touches after code review
git-remote-ext
git-remote-fd
Add bidirectional_transfer_loop()

Conflicts:
compat/mingw.h

1  2 
Makefile
builtin.h
compat/mingw.h
git.c
diff --combined Makefile
index 91567c651ef902b100976e0f1912e4d878cac7aa,d8ada7892c6c5d2b145ff490a2301d64e3ff00fe..1fe1a3b480a02094315cfc3558a0363c7540edee
+++ b/Makefile
@@@ -70,11 -70,6 +70,11 @@@ all:
  #
  # Define NO_STRTOK_R if you don't have strtok_r in the C library.
  #
 +# Define NO_FNMATCH if you don't have fnmatch in the C library.
 +#
 +# Define NO_FNMATCH_CASEFOLD if your fnmatch function doesn't have the
 +# FNM_CASEFOLD GNU extension.
 +#
  # Define NO_LIBGEN_H if you don't have libgen.h.
  #
  # Define NEEDS_LIBGEN if your libgen needs -lgen when linking
@@@ -275,7 -270,6 +275,7 @@@ STRIP ?= stri
  #   infodir
  #   htmldir
  #   ETC_GITCONFIG (but not sysconfdir)
 +#   ETC_GITATTRIBUTES
  # can be specified as a relative path some/where/else;
  # this is interpreted as relative to $(prefix) and "git" at
  # runtime figures out where they are based on the path to the executable.
@@@ -294,11 -288,9 +294,11 @@@ htmldir = share/doc/git-do
  ifeq ($(prefix),/usr)
  sysconfdir = /etc
  ETC_GITCONFIG = $(sysconfdir)/gitconfig
 +ETC_GITATTRIBUTES = $(sysconfdir)/gitattributes
  else
  sysconfdir = $(prefix)/etc
  ETC_GITCONFIG = etc/gitconfig
 +ETC_GITATTRIBUTES = etc/gitattributes
  endif
  lib = lib
  # DESTDIR=
@@@ -398,15 -390,12 +398,15 @@@ SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH
          $(patsubst %.py,%,$(SCRIPT_PYTHON)) \
          git-instaweb
  
 +ETAGS_TARGET = TAGS
 +
  # Empty...
  EXTRA_PROGRAMS =
  
  # ... and all the rest that could be moved out of bindir to gitexecdir
  PROGRAMS += $(EXTRA_PROGRAMS)
  
 +PROGRAM_OBJS += daemon.o
  PROGRAM_OBJS += fast-import.o
  PROGRAM_OBJS += imap-send.o
  PROGRAM_OBJS += shell.o
@@@ -502,8 -491,6 +502,8 @@@ LIB_H += compat/bswap.
  LIB_H += compat/cygwin.h
  LIB_H += compat/mingw.h
  LIB_H += compat/win32/pthread.h
 +LIB_H += compat/win32/syslog.h
 +LIB_H += compat/win32/sys/poll.h
  LIB_H += csum-file.h
  LIB_H += decorate.h
  LIB_H += delta.h
@@@ -525,7 -512,6 +525,7 @@@ LIB_H += mailmap.
  LIB_H += merge-recursive.h
  LIB_H += notes.h
  LIB_H += notes-cache.h
 +LIB_H += notes-merge.h
  LIB_H += object.h
  LIB_H += pack.h
  LIB_H += pack-refs.h
@@@ -616,7 -602,6 +616,7 @@@ LIB_OBJS += merge-recursive.
  LIB_OBJS += name-hash.o
  LIB_OBJS += notes.o
  LIB_OBJS += notes-cache.o
 +LIB_OBJS += notes-merge.o
  LIB_OBJS += object.o
  LIB_OBJS += pack-check.o
  LIB_OBJS += pack-refs.o
@@@ -672,7 -657,6 +672,7 @@@ LIB_OBJS += write_or_die.
  LIB_OBJS += ws.o
  LIB_OBJS += wt-status.o
  LIB_OBJS += xdiff-interface.o
 +LIB_OBJS += zlib.o
  
  BUILTIN_OBJS += builtin/add.o
  BUILTIN_OBJS += builtin/annotate.o
@@@ -739,6 -723,8 +739,8 @@@ BUILTIN_OBJS += builtin/read-tree.
  BUILTIN_OBJS += builtin/receive-pack.o
  BUILTIN_OBJS += builtin/reflog.o
  BUILTIN_OBJS += builtin/remote.o
+ BUILTIN_OBJS += builtin/remote-ext.o
+ BUILTIN_OBJS += builtin/remote-fd.o
  BUILTIN_OBJS += builtin/replace.o
  BUILTIN_OBJS += builtin/rerere.o
  BUILTIN_OBJS += builtin/reset.o
@@@ -857,7 -843,6 +859,7 @@@ ifeq ($(uname_S),SunOS
        NO_MKDTEMP = YesPlease
        NO_MKSTEMPS = YesPlease
        NO_REGEX = YesPlease
 +      NO_FNMATCH_CASEFOLD = YesPlease
        ifeq ($(uname_R),5.6)
                SOCKLEN_T = int
                NO_HSTRERROR = YesPlease
@@@ -1064,7 -1049,6 +1066,7 @@@ ifeq ($(uname_S),Windows
        NO_STRCASESTR = YesPlease
        NO_STRLCPY = YesPlease
        NO_STRTOK_R = YesPlease
 +      NO_FNMATCH = YesPlease
        NO_MEMMEM = YesPlease
        # NEEDS_LIBICONV = YesPlease
        NO_ICONV = YesPlease
        NO_SVN_TESTS = YesPlease
        NO_PERL_MAKEMAKER = YesPlease
        RUNTIME_PREFIX = YesPlease
 -      NO_POSIX_ONLY_PROGRAMS = YesPlease
        NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
        NO_NSEC = YesPlease
        USE_WIN32_MMAP = YesPlease
        NO_CURL = YesPlease
        NO_PYTHON = YesPlease
        BLK_SHA1 = YesPlease
 +      NO_POSIX_GOODIES = UnfortunatelyYes
        NATIVE_CRLF = YesPlease
  
        CC = compat/vcbuild/scripts/clink.pl
        AR = compat/vcbuild/scripts/lib.pl
        CFLAGS =
        BASIC_CFLAGS = -nologo -I. -I../zlib -Icompat/vcbuild -Icompat/vcbuild/include -DWIN32 -D_CONSOLE -DHAVE_STRING_H -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE
 -      COMPAT_OBJS = compat/msvc.o compat/fnmatch/fnmatch.o compat/winansi.o compat/win32/pthread.o
 -      COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DNOGDI -DHAVE_STRING_H -DHAVE_ALLOCA_H -Icompat -Icompat/fnmatch -Icompat/regex -Icompat/fnmatch -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
 +      COMPAT_OBJS = compat/msvc.o compat/winansi.o compat/win32/pthread.o compat/win32/syslog.o compat/win32/sys/poll.o
 +      COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DNOGDI -DHAVE_STRING_H -DHAVE_ALLOCA_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
        BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -SUBSYSTEM:CONSOLE -NODEFAULTLIB:MSVCRT.lib
        EXTLIBS = advapi32.lib shell32.lib wininet.lib ws2_32.lib
        PTHREAD_LIBS =
  endif
        X = .exe
  endif
 +ifeq ($(uname_S),Interix)
 +      NO_SYS_POLL_H = YesPlease
 +      NO_INTTYPES_H = YesPlease
 +      NO_INITGROUPS = YesPlease
 +      NO_IPV6 = YesPlease
 +      NO_MEMMEM = YesPlease
 +      NO_MKDTEMP = YesPlease
 +      NO_STRTOUMAX = YesPlease
 +      NO_NSEC = YesPlease
 +      NO_MKSTEMPS = YesPlease
 +      ifeq ($(uname_R),3.5)
 +              NO_INET_NTOP = YesPlease
 +              NO_INET_PTON = YesPlease
 +      endif
 +      ifeq ($(uname_R),5.2)
 +              NO_INET_NTOP = YesPlease
 +              NO_INET_PTON = YesPlease
 +      endif
 +endif
  ifneq (,$(findstring MINGW,$(uname_S)))
        pathsep = ;
        NO_PREAD = YesPlease
        NO_STRCASESTR = YesPlease
        NO_STRLCPY = YesPlease
        NO_STRTOK_R = YesPlease
 +      NO_FNMATCH = YesPlease
        NO_MEMMEM = YesPlease
        NEEDS_LIBICONV = YesPlease
        OLD_ICONV = YesPlease
        NO_SVN_TESTS = YesPlease
        NO_PERL_MAKEMAKER = YesPlease
        RUNTIME_PREFIX = YesPlease
 -      NO_POSIX_ONLY_PROGRAMS = YesPlease
        NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
        NO_NSEC = YesPlease
        USE_WIN32_MMAP = YesPlease
        NO_REGEX = YesPlease
        NO_PYTHON = YesPlease
        BLK_SHA1 = YesPlease
 -      COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat -Icompat/fnmatch -Icompat/win32
 +      ETAGS_TARGET = ETAGS
 +      NO_INET_PTON = YesPlease
 +      NO_INET_NTOP = YesPlease
 +      NO_POSIX_GOODIES = UnfortunatelyYes
 +      COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat -Icompat/win32
        COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
 -      COMPAT_OBJS += compat/mingw.o compat/fnmatch/fnmatch.o compat/winansi.o \
 -              compat/win32/pthread.o
 +      COMPAT_OBJS += compat/mingw.o compat/winansi.o \
 +              compat/win32/pthread.o compat/win32/syslog.o \
 +              compat/win32/sys/poll.o
        EXTLIBS += -lws2_32
        PTHREAD_LIBS =
        X = .exe
@@@ -1282,6 -1242,9 +1284,6 @@@ ifdef ZLIB_PAT
  endif
  EXTLIBS += -lz
  
 -ifndef NO_POSIX_ONLY_PROGRAMS
 -      PROGRAM_OBJS += daemon.o
 -endif
  ifndef NO_OPENSSL
        OPENSSL_LIBSSL = -lssl
        ifdef OPENSSLDIR
@@@ -1375,17 -1338,6 +1377,17 @@@ ifdef NO_STRTOK_
        COMPAT_CFLAGS += -DNO_STRTOK_R
        COMPAT_OBJS += compat/strtok_r.o
  endif
 +ifdef NO_FNMATCH
 +      COMPAT_CFLAGS += -Icompat/fnmatch
 +      COMPAT_CFLAGS += -DNO_FNMATCH
 +      COMPAT_OBJS += compat/fnmatch/fnmatch.o
 +else
 +ifdef NO_FNMATCH_CASEFOLD
 +      COMPAT_CFLAGS += -Icompat/fnmatch
 +      COMPAT_CFLAGS += -DNO_FNMATCH_CASEFOLD
 +      COMPAT_OBJS += compat/fnmatch/fnmatch.o
 +endif
 +endif
  ifdef NO_SETENV
        COMPAT_CFLAGS += -DNO_SETENV
        COMPAT_OBJS += compat/setenv.o
@@@ -1404,15 -1356,6 +1406,15 @@@ endi
  ifdef NO_SYS_SELECT_H
        BASIC_CFLAGS += -DNO_SYS_SELECT_H
  endif
 +ifdef NO_SYS_POLL_H
 +      BASIC_CFLAGS += -DNO_SYS_POLL_H
 +endif
 +ifdef NO_INTTYPES_H
 +      BASIC_CFLAGS += -DNO_INTTYPES_H
 +endif
 +ifdef NO_INITGROUPS
 +      BASIC_CFLAGS += -DNO_INITGROUPS
 +endif
  ifdef NO_MMAP
        COMPAT_CFLAGS += -DNO_MMAP
        COMPAT_OBJS += compat/mmap.o
@@@ -1450,11 -1393,9 +1452,11 @@@ endi
  endif
  ifdef NO_INET_NTOP
        LIB_OBJS += compat/inet_ntop.o
 +      BASIC_CFLAGS += -DNO_INET_NTOP
  endif
  ifdef NO_INET_PTON
        LIB_OBJS += compat/inet_pton.o
 +      BASIC_CFLAGS += -DNO_INET_PTON
  endif
  
  ifdef NO_ICONV
@@@ -1469,10 -1410,6 +1471,10 @@@ ifdef NO_DEFLATE_BOUN
        BASIC_CFLAGS += -DNO_DEFLATE_BOUND
  endif
  
 +ifdef NO_POSIX_GOODIES
 +      BASIC_CFLAGS += -DNO_POSIX_GOODIES
 +endif
 +
  ifdef BLK_SHA1
        SHA1_HEADER = "block-sha1/sha1.h"
        LIB_OBJS += block-sha1/sha1.o
@@@ -1585,7 -1522,6 +1587,7 @@@ endi
  
  SHA1_HEADER_SQ = $(subst ','\'',$(SHA1_HEADER))
  ETC_GITCONFIG_SQ = $(subst ','\'',$(ETC_GITCONFIG))
 +ETC_GITATTRIBUTES_SQ = $(subst ','\'',$(ETC_GITATTRIBUTES))
  
  DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
  bindir_SQ = $(subst ','\'',$(bindir))
@@@ -1825,8 -1761,6 +1827,8 @@@ XDIFF_OBJS = xdiff/xdiffi.o xdiff/xprep
        xdiff/xmerge.o xdiff/xpatience.o
  VCSSVN_OBJS = vcs-svn/string_pool.o vcs-svn/line_buffer.o \
        vcs-svn/repo_tree.o vcs-svn/fast_export.o vcs-svn/svndump.o
 +VCSSVN_TEST_OBJS = test-obj-pool.o test-string-pool.o \
 +      test-line-buffer.o test-treap.o
  OBJECTS := $(GIT_OBJS) $(XDIFF_OBJS) $(VCSSVN_OBJS)
  
  dep_files := $(foreach f,$(OBJECTS),$(dir $f).depend/$(notdir $f).d)
@@@ -1950,12 -1884,10 +1952,12 @@@ xdiff-interface.o $(XDIFF_OBJS): 
        xdiff/xinclude.h xdiff/xmacros.h xdiff/xdiff.h xdiff/xtypes.h \
        xdiff/xutils.h xdiff/xprepare.h xdiff/xdiffi.h xdiff/xemit.h
  
 -$(VCSSVN_OBJS): \
 +$(VCSSVN_OBJS) $(VCSSVN_TEST_OBJS): $(LIB_H) \
        vcs-svn/obj_pool.h vcs-svn/trp.h vcs-svn/string_pool.h \
        vcs-svn/line_buffer.h vcs-svn/repo_tree.h vcs-svn/fast_export.h \
        vcs-svn/svndump.h
 +
 +test-svn-fe.o: vcs-svn/svndump.h
  endif
  
  exec_cmd.s exec_cmd.o: EXTRA_CPPFLAGS = \
@@@ -1968,8 -1900,6 +1970,8 @@@ builtin/init-db.s builtin/init-db.o: EX
  
  config.s config.o: EXTRA_CPPFLAGS = -DETC_GITCONFIG='"$(ETC_GITCONFIG_SQ)"'
  
 +attr.s attr.o: EXTRA_CPPFLAGS = -DETC_GITATTRIBUTES='"$(ETC_GITATTRIBUTES_SQ)"'
 +
  http.s http.o: EXTRA_CPPFLAGS = -DGIT_HTTP_USER_AGENT='"git/$(GIT_VERSION)"'
  
  ifdef NO_EXPAT
@@@ -1990,7 -1920,7 +1992,7 @@@ git-%$X: %.o $(GITLIBS
  
  git-imap-send$X: imap-send.o $(GITLIBS)
        $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
 -              $(LIBS) $(OPENSSL_LINK) $(OPENSSL_LIBSSL)
 +              $(LIBS) $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO)
  
  git-http-fetch$X: revision.o http.o http-walker.o http-fetch.o $(GITLIBS)
        $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
@@@ -2033,11 -1963,11 +2035,11 @@@ info
  pdf:
        $(MAKE) -C Documentation pdf
  
 -TAGS:
 -      $(RM) TAGS
 -      $(FIND) . -name '*.[hcS]' -print | xargs etags -a
 +$(ETAGS_TARGET): FORCE
 +      $(RM) $(ETAGS_TARGET)
 +      $(FIND) . -name '*.[hcS]' -print | xargs etags -a -o $(ETAGS_TARGET)
  
 -tags:
 +tags: FORCE
        $(RM) tags
        $(FIND) . -name '*.[hcS]' -print | xargs ctags -a
  
@@@ -2046,7 -1976,7 +2048,7 @@@ cscope
        $(FIND) . -name '*.[hcS]' -print | xargs cscope -b
  
  ### Detect prefix changes
 -TRACK_CFLAGS = $(subst ','\'',$(ALL_CFLAGS)):\
 +TRACK_CFLAGS = $(CC):$(subst ','\'',$(ALL_CFLAGS)):\
               $(bindir_SQ):$(gitexecdir_SQ):$(template_dir_SQ):$(prefix_SQ)
  
  GIT-CFLAGS: FORCE
@@@ -2307,7 -2237,7 +2309,7 @@@ clean
        $(RM) $(TEST_PROGRAMS)
        $(RM) -r bin-wrappers
        $(RM) -r $(dep_dirs)
 -      $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h TAGS tags cscope*
 +      $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h $(ETAGS_TARGET) tags cscope*
        $(RM) -r autom4te.cache
        $(RM) config.log config.mak.autogen config.mak.append config.status config.cache
        $(RM) -r $(GIT_TARNAME) .doc-tmp-dir
@@@ -2331,7 -2261,7 +2333,7 @@@ endi
  
  .PHONY: all install clean strip
  .PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
 -.PHONY: FORCE TAGS tags cscope
 +.PHONY: FORCE cscope
  
  ### Check documentation
  #
diff --combined builtin.h
index c3e5db268566d3f78cebb4021ed0a201e1dbfa87,c5bfabd01ca3e6cd9398f1a3c7257f7597dc5efb..904e067a88f242b42f16b715d2b67b45a101e468
+++ b/builtin.h
@@@ -7,16 -7,15 +7,16 @@@
  #include "commit.h"
  #include "notes.h"
  
 +#define DEFAULT_MERGE_LOG_LEN 20
 +
  extern const char git_version_string[];
  extern const char git_usage_string[];
  extern const char git_more_info_string[];
  
  extern void prune_packed_objects(int);
 -extern int fmt_merge_msg(int merge_summary, struct strbuf *in,
 -      struct strbuf *out);
 -extern int fmt_merge_msg_shortlog(struct strbuf *in, struct strbuf *out);
 -extern int commit_notes(struct notes_tree *t, const char *msg);
 +extern int fmt_merge_msg(struct strbuf *in, struct strbuf *out,
 +                       int merge_title, int shortlog_len);
 +extern void commit_notes(struct notes_tree *t, const char *msg);
  
  struct notes_rewrite_cfg {
        struct notes_tree **trees;
@@@ -36,7 -35,7 +36,7 @@@ void finish_copy_notes_for_rewrite(stru
  
  extern int check_pager_config(const char *cmd);
  
 -extern int textconv_object(const char *path, const unsigned char *sha1, char **buf, unsigned long *buf_size);
 +extern int textconv_object(const char *path, unsigned mode, const unsigned char *sha1, char **buf, unsigned long *buf_size);
  
  extern int cmd_add(int argc, const char **argv, const char *prefix);
  extern int cmd_annotate(int argc, const char **argv, const char *prefix);
@@@ -108,6 -107,8 +108,8 @@@ extern int cmd_read_tree(int argc, cons
  extern int cmd_receive_pack(int argc, const char **argv, const char *prefix);
  extern int cmd_reflog(int argc, const char **argv, const char *prefix);
  extern int cmd_remote(int argc, const char **argv, const char *prefix);
+ extern int cmd_remote_ext(int argc, const char **argv, const char *prefix);
+ extern int cmd_remote_fd(int argc, const char **argv, const char *prefix);
  extern int cmd_config(int argc, const char **argv, const char *prefix);
  extern int cmd_rerere(int argc, const char **argv, const char *prefix);
  extern int cmd_reset(int argc, const char **argv, const char *prefix);
diff --combined compat/mingw.h
index 99a746703f3c9fb19e043109e4a044efe151e0e7,f27a7b69b1e30a560d8b17fc9613b065c37afe0a..35d9813b6badb34068601f35302f8859a786db05
@@@ -6,37 -6,26 +6,40 @@@
   */
  
  typedef int pid_t;
 +typedef int uid_t;
 +typedef int socklen_t;
  #define hstrerror strerror
  
  #define S_IFLNK    0120000 /* Symbolic link */
  #define S_ISLNK(x) (((x) & S_IFMT) == S_IFLNK)
  #define S_ISSOCK(x) 0
 +
 +#ifndef _STAT_H_
 +#define S_IRUSR 0
 +#define S_IWUSR 0
 +#define S_IXUSR 0
 +#define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
 +#endif
  #define S_IRGRP 0
  #define S_IWGRP 0
  #define S_IXGRP 0
 -#define S_ISGID 0
 +#define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
  #define S_IROTH 0
 +#define S_IWOTH 0
  #define S_IXOTH 0
 +#define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
 +#define S_ISUID 0
 +#define S_ISGID 0
 +#define S_ISVTX 0
  
  #define WIFEXITED(x) 1
  #define WIFSIGNALED(x) 0
  #define WEXITSTATUS(x) ((x) & 0xff)
  #define WTERMSIG(x) SIGTERM
  
+ #define EWOULDBLOCK EAGAIN
+ #define SHUT_WR SD_SEND
  #define SIGHUP 1
  #define SIGQUIT 3
  #define SIGKILL 9
@@@ -48,9 -37,6 +51,9 @@@
  #define F_SETFD 2
  #define FD_CLOEXEC 0x1
  
 +#define EAFNOSUPPORT WSAEAFNOSUPPORT
 +#define ECONNABORTED WSAECONNABORTED
 +
  struct passwd {
        char *pw_name;
        char *pw_gecos;
  
  extern char *getpass(const char *prompt);
  
 -#ifndef POLLIN
 -struct pollfd {
 -      int fd;           /* file descriptor */
 -      short events;     /* requested events */
 -      short revents;    /* returned events */
 -};
 -#define POLLIN 1
 -#define POLLHUP 2
 -#define POLLOUT 4
 -#define POLLNVAL 8
 -#endif
 -
  typedef void (__cdecl *sig_handler_t)(int);
  struct sigaction {
        sig_handler_t sa_handler;
@@@ -72,12 -70,6 +75,12 @@@ struct itimerval 
  };
  #define ITIMER_REAL 0
  
 +/*
 + * sanitize preprocessor namespace polluted by Windows headers defining
 + * macros which collide with git local versions
 + */
 +#undef HELP_COMMAND /* from winuser.h */
 +
  /*
   * trivial stubs
   */
@@@ -88,17 -80,17 +91,17 @@@ static inline int symlink(const char *o
  { errno = ENOSYS; return -1; }
  static inline int fchmod(int fildes, mode_t mode)
  { errno = ENOSYS; return -1; }
 -static inline int fork(void)
 +static inline pid_t fork(void)
  { errno = ENOSYS; return -1; }
  static inline unsigned int alarm(unsigned int seconds)
  { return 0; }
  static inline int fsync(int fd)
  { return _commit(fd); }
 -static inline int getppid(void)
 +static inline pid_t getppid(void)
  { return 1; }
  static inline void sync(void)
  {}
 -static inline int getuid()
 +static inline uid_t getuid(void)
  { return 1; }
  static inline struct passwd *getpwnam(const char *name)
  { return NULL; }
@@@ -130,11 -122,13 +133,11 @@@ static inline int mingw_unlink(const ch
  }
  #define unlink mingw_unlink
  
 -static inline int waitpid(pid_t pid, int *status, unsigned options)
 -{
 -      if (options == 0)
 -              return _cwait(status, pid, 0);
 -      errno = EINVAL;
 -      return -1;
 -}
 +#define WNOHANG 1
 +pid_t waitpid(pid_t pid, int *status, unsigned options);
 +
 +#define kill mingw_kill
 +int mingw_kill(pid_t pid, int sig);
  
  #ifndef NO_OPENSSL
  #include <openssl/ssl.h>
@@@ -165,10 -159,11 +168,10 @@@ int pipe(int filedes[2])
  unsigned int sleep (unsigned int seconds);
  int mkstemp(char *template);
  int gettimeofday(struct timeval *tv, void *tz);
 -int poll(struct pollfd *ufds, unsigned int nfds, int timeout);
  struct tm *gmtime_r(const time_t *timep, struct tm *result);
  struct tm *localtime_r(const time_t *timep, struct tm *result);
  int getpagesize(void);        /* defined in MinGW's libgcc.a */
 -struct passwd *getpwuid(int uid);
 +struct passwd *getpwuid(uid_t uid);
  int setitimer(int type, struct itimerval *in, struct itimerval *out);
  int sigaction(int sig, struct sigaction *in, struct sigaction *out);
  int link(const char *oldpath, const char *newpath);
@@@ -216,18 -211,6 +219,18 @@@ int mingw_socket(int domain, int type, 
  int mingw_connect(int sockfd, struct sockaddr *sa, size_t sz);
  #define connect mingw_connect
  
 +int mingw_bind(int sockfd, struct sockaddr *sa, size_t sz);
 +#define bind mingw_bind
 +
 +int mingw_setsockopt(int sockfd, int lvl, int optname, void *optval, int optlen);
 +#define setsockopt mingw_setsockopt
 +
 +int mingw_listen(int sockfd, int backlog);
 +#define listen mingw_listen
 +
 +int mingw_accept(int sockfd, struct sockaddr *sa, socklen_t *sz);
 +#define accept mingw_accept
 +
  int mingw_rename(const char*, const char*);
  #define rename mingw_rename
  
@@@ -244,11 -227,10 +247,11 @@@ int mingw_getpagesize(void)
  #ifndef ALREADY_DECLARED_STAT_FUNCS
  #define stat _stati64
  int mingw_lstat(const char *file_name, struct stat *buf);
 +int mingw_stat(const char *file_name, struct stat *buf);
  int mingw_fstat(int fd, struct stat *buf);
  #define fstat mingw_fstat
  #define lstat mingw_lstat
 -#define _stati64(x,y) mingw_lstat(x,y)
 +#define _stati64(x,y) mingw_stat(x,y)
  #endif
  
  int mingw_utime(const char *file_name, const struct utimbuf *times);
@@@ -259,8 -241,6 +262,8 @@@ pid_t mingw_spawnvpe(const char *cmd, c
                     int fhin, int fhout, int fherr);
  void mingw_execvp(const char *cmd, char *const *argv);
  #define execvp mingw_execvp
 +void mingw_execv(const char *cmd, char *const *argv);
 +#define execv mingw_execv
  
  static inline unsigned int git_ntohl(unsigned int x)
  { return (unsigned int)ntohl(x); }
@@@ -308,13 -288,11 +311,13 @@@ void free_environ(char **env)
  static int mingw_main(); \
  int main(int argc, const char **argv) \
  { \
 +      extern CRITICAL_SECTION pinfo_cs; \
        _fmode = _O_BINARY; \
        _setmode(_fileno(stdin), _O_BINARY); \
        _setmode(_fileno(stdout), _O_BINARY); \
        _setmode(_fileno(stderr), _O_BINARY); \
        argv[0] = xstrdup(_pgmptr); \
 +      InitializeCriticalSection(&pinfo_cs); \
        return mingw_main(argc, argv); \
  } \
  static int mingw_main(c,v)
diff --combined git.c
index 81221cff4658c421d62022b32a45842900c2b436,e95a1baea21824a21e38f2ca56179a0ce988ee4f..d532576cdff244fcd3945ef4fcc580e1bf0b04ae
--- 1/git.c
--- 2/git.c
+++ b/git.c
@@@ -6,35 -6,27 +6,35 @@@
  #include "run-command.h"
  
  const char git_usage_string[] =
 -      "git [--version] [--exec-path[=GIT_EXEC_PATH]] [--html-path]\n"
 +      "git [--version] [--exec-path[=<path>]] [--html-path]\n"
        "           [-p|--paginate|--no-pager] [--no-replace-objects]\n"
 -      "           [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE]\n"
 +      "           [--bare] [--git-dir=<path>] [--work-tree=<path>]\n"
        "           [-c name=value] [--help]\n"
 -      "           COMMAND [ARGS]";
 +      "           <command> [<args>]";
  
  const char git_more_info_string[] =
 -      "See 'git help COMMAND' for more information on a specific command.";
 +      "See 'git help <command>' for more information on a specific command.";
  
  static struct startup_info git_startup_info;
  static int use_pager = -1;
  struct pager_config {
        const char *cmd;
 -      int val;
 +      int want;
 +      char *value;
  };
  
  static int pager_command_config(const char *var, const char *value, void *data)
  {
        struct pager_config *c = data;
 -      if (!prefixcmp(var, "pager.") && !strcmp(var + 6, c->cmd))
 -              c->val = git_config_bool(var, value);
 +      if (!prefixcmp(var, "pager.") && !strcmp(var + 6, c->cmd)) {
 +              int b = git_config_maybe_bool(var, value);
 +              if (b >= 0)
 +                      c->want = b;
 +              else {
 +                      c->want = 1;
 +                      c->value = xstrdup(value);
 +              }
 +      }
        return 0;
  }
  
@@@ -43,12 -35,9 +43,12 @@@ int check_pager_config(const char *cmd
  {
        struct pager_config c;
        c.cmd = cmd;
 -      c.val = -1;
 +      c.want = -1;
 +      c.value = NULL;
        git_config(pager_command_config, &c);
 -      return c.val;
 +      if (c.value)
 +              pager_program = c.value;
 +      return c.want;
  }
  
  static void commit_pager_choice(void) {
@@@ -385,6 -374,8 +385,8 @@@ static void handle_internal_command(in
                { "receive-pack", cmd_receive_pack },
                { "reflog", cmd_reflog, RUN_SETUP },
                { "remote", cmd_remote, RUN_SETUP },
+               { "remote-ext", cmd_remote_ext },
+               { "remote-fd", cmd_remote_fd },
                { "replace", cmd_replace, RUN_SETUP },
                { "repo-config", cmd_config, RUN_SETUP_GENTLY },
                { "rerere", cmd_rerere, RUN_SETUP },