Merge branch 'sr/remote-helper-export'
authorJunio C Hamano <gitster@pobox.com>
Fri, 21 May 2010 11:02:15 +0000 (04:02 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 21 May 2010 11:02:15 +0000 (04:02 -0700)
* sr/remote-helper-export:
t5800: testgit helper requires Python support
Makefile: Simplify handling of python scripts
remote-helpers: add tests for testgit helper
remote-helpers: add testgit helper
remote-helpers: add support for an export command
remote-helpers: allow requesing the path to the .git directory
fast-import: always create marks_file directories
clone: also configure url for bare clones
clone: pass the remote name to remote_get

Conflicts:
Makefile

1  2 
.gitignore
Makefile
builtin/clone.c
diff --combined .gitignore
index dbf1b90c63573b08efc894ed8c1e02de58fd53e4,7aebd6b40e84f7939585c48b74a5f500cb15b200..14e2b6bde9bef55d678da8ba44dc180b039cd3ac
  /git-remote-https
  /git-remote-ftp
  /git-remote-ftps
+ /git-remote-testgit
  /git-repack
  /git-replace
  /git-repo-config
  /git-write-tree
  /git-core-*/?*
  /gitk-git/gitk-wish
 +/gitweb/GITWEB-BUILD-OPTIONS
  /gitweb/gitweb.cgi
 +/gitweb/gitweb.min.*
  /test-chmtime
  /test-ctype
  /test-date
  *.exe
  *.[aos]
  *.py[co]
 -*.o.d
 +.depend/
  *+
  /config.mak
  /autom4te.cache
diff --combined Makefile
index 4f7224a59a9c93b12a7878b0f692c1bc469d6daf,29aa5a6ccc274b408699c83cc4b2898a11cb560a..e38f0dd445acf87aeb52ae07720e7063579c890e
+++ b/Makefile
@@@ -34,7 -34,7 +34,7 @@@ all:
  # Define NO_D_INO_IN_DIRENT if you don't have d_ino in your struct dirent.
  #
  # Define NO_D_TYPE_IN_DIRENT if your platform defines DT_UNKNOWN but lacks
 -# d_type in struct dirent (latest Cygwin -- will be fixed soonish).
 +# d_type in struct dirent (Cygwin 1.5, fixed in Cygwin 1.7).
  #
  # Define NO_C99_FORMAT if your formatted IO functions (printf/scanf et.al.)
  # do not support the 'size specifiers' introduced by C99, namely ll, hh,
  # Define NO_PTHREADS if you do not have or do not want to use Pthreads.
  #
  # Define NO_PREAD if you have a problem with pread() system call (e.g.
 -# cygwin.dll before v1.5.22).
 +# cygwin1.dll before v1.5.22).
  #
  # Define NO_FAST_WORKING_DIRECTORY if accessing objects in pack files is
  # generally faster on your platform than accessing the working directory.
  # Define JSMIN to point to JavaScript minifier that functions as
  # a filter to have gitweb.js minified.
  #
 +# Define CSSMIN to point to a CSS minifier in order to generate a minified
 +# version of gitweb.css
 +#
  # Define DEFAULT_PAGER to a sensible pager command (defaults to "less") if
  # you want to use something different.  The value will be interpreted by the
  # shell at runtime when it is used.
@@@ -282,6 -279,9 +282,6 @@@ lib = li
  # DESTDIR=
  pathsep = :
  
 -# JavaScript minifier invocation that can function as filter
 -JSMIN =
 -
  export prefix bindir sharedir sysconfdir
  
  CC = gcc
@@@ -366,6 -366,8 +366,8 @@@ SCRIPT_PERL += git-relink.per
  SCRIPT_PERL += git-send-email.perl
  SCRIPT_PERL += git-svn.perl
  
+ SCRIPT_PYTHON += git-remote-testgit.py
  SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \
          $(patsubst %.perl,%,$(SCRIPT_PERL)) \
          $(patsubst %.py,%,$(SCRIPT_PYTHON)) \
@@@ -486,7 -488,6 +488,7 @@@ LIB_H += log-tree.
  LIB_H += mailmap.h
  LIB_H += merge-recursive.h
  LIB_H += notes.h
 +LIB_H += notes-cache.h
  LIB_H += object.h
  LIB_H += pack.h
  LIB_H += pack-refs.h
@@@ -576,7 -577,6 +578,7 @@@ LIB_OBJS += merge-file.
  LIB_OBJS += merge-recursive.o
  LIB_OBJS += name-hash.o
  LIB_OBJS += notes.o
 +LIB_OBJS += notes-cache.o
  LIB_OBJS += object.o
  LIB_OBJS += pack-check.o
  LIB_OBJS += pack-refs.o
@@@ -833,24 -833,22 +835,24 @@@ ifeq ($(uname_S),SunOS
        BASIC_CFLAGS += -D__EXTENSIONS__ -D__sun__ -DHAVE_ALLOCA_H
  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
 +      ifeq ($(shell expr "$(uname_R)" : '1\.[1-6]\.'),4)
 +              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
 +              NO_IPV6 = YesPlease
 +              OLD_ICONV = UnfortunatelyYes
 +      endif
        NEEDS_LIBICONV = YesPlease
        NO_FAST_WORKING_DIRECTORY = UnfortunatelyYes
        NO_TRUSTABLE_FILEMODE = UnfortunatelyYes
 -      OLD_ICONV = UnfortunatelyYes
        NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
        # There are conflicting reports about this.
        # On some boxes NO_MMAP is needed, and not so elsewhere.
        # Try commenting this out if you suspect MMAP is more efficient
        NO_MMAP = YesPlease
 -      NO_IPV6 = YesPlease
        X = .exe
        COMPAT_OBJS += compat/cygwin.o
        UNRELIABLE_FSTAT = UnfortunatelyYes
@@@ -868,7 -866,6 +870,7 @@@ ifeq ($(uname_S),FreeBSD
                NO_UINTMAX_T = YesPlease
                NO_STRTOUMAX = YesPlease
        endif
 +      PYTHON_PATH = /usr/local/bin/python
  endif
  ifeq ($(uname_S),OpenBSD)
        NO_STRCASESTR = YesPlease
@@@ -1481,7 -1478,7 +1483,7 @@@ endi
  ifndef NO_PYTHON
        $(QUIET_SUBDIR0)git_remote_helpers $(QUIET_SUBDIR1) PYTHON_PATH='$(PYTHON_PATH_SQ)' prefix='$(prefix_SQ)' all
  endif
 -      $(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1)
 +      $(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1) SHELL_PATH='$(SHELL_PATH_SQ)' PERL_PATH='$(PERL_PATH_SQ)'
  
  please_set_SHELL_PATH_to_a_more_modern_shell:
        @$$(:)
@@@ -1563,29 -1560,18 +1565,29 @@@ gitweb
        $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) all
  
  ifdef JSMIN
 -OTHER_PROGRAMS += gitweb/gitweb.cgi   gitweb/gitweb.min.js
 -gitweb/gitweb.cgi: gitweb/gitweb.perl gitweb/gitweb.min.js
 +GITWEB_PROGRAMS += gitweb/gitweb.min.js
 +GITWEB_JS = gitweb/gitweb.min.js
  else
 -OTHER_PROGRAMS += gitweb/gitweb.cgi
 -gitweb/gitweb.cgi: gitweb/gitweb.perl
 +GITWEB_JS = gitweb/gitweb.js
  endif
 +ifdef CSSMIN
 +GITWEB_PROGRAMS += gitweb/gitweb.min.css
 +GITWEB_CSS = gitweb/gitweb.min.css
 +else
 +GITWEB_CSS = gitweb/gitweb.css
 +endif
 +OTHER_PROGRAMS +=  gitweb/gitweb.cgi  $(GITWEB_PROGRAMS)
 +gitweb/gitweb.cgi: gitweb/gitweb.perl $(GITWEB_PROGRAMS)
        $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@)
  
  ifdef JSMIN
  gitweb/gitweb.min.js: gitweb/gitweb.js
        $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@)
  endif # JSMIN
 +ifdef CSSMIN
 +gitweb/gitweb.min.css: gitweb/gitweb.css
 +      $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@)
 +endif # CSSMIN
  
  
  git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css gitweb/gitweb.js
            -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
            -e '/@@GITWEB_CGI@@/r gitweb/gitweb.cgi' \
            -e '/@@GITWEB_CGI@@/d' \
 -          -e '/@@GITWEB_CSS@@/r gitweb/gitweb.css' \
 +          -e '/@@GITWEB_CSS@@/r $(GITWEB_CSS)' \
            -e '/@@GITWEB_CSS@@/d' \
 -          -e '/@@GITWEB_JS@@/r gitweb/gitweb.js' \
 +          -e '/@@GITWEB_JS@@/r $(GITWEB_JS)' \
            -e '/@@GITWEB_JS@@/d' \
            -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
 +            -e 's|@@GITWEB_CSS_NAME@@|$(GITWEB_CSS)|' \
 +            -e 's|@@GITWEB_JS_NAME@@|$(GITWEB_JS)|' \
            $@.sh > $@+ && \
        chmod +x $@+ && \
        mv $@+ $@
@@@ -1622,13 -1606,8 +1624,8 @@@ $(patsubst %.py,%,$(SCRIPT_PYTHON)): % 
        INSTLIBDIR=`MAKEFLAGS= $(MAKE) -C git_remote_helpers -s \
                --no-print-directory prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' \
                instlibdir` && \
-       sed -e '1{' \
-           -e '        s|#!.*python|#!$(PYTHON_PATH_SQ)|' \
-           -e '}' \
-           -e 's|^import sys.*|&; \\\
-                  import os; \\\
-                  sys.path.insert(0, os.getenv("GITPYTHONLIB",\
-                                               "@@INSTLIBDIR@@"));|' \
+       sed -e '1s|#!.*python|#!$(PYTHON_PATH_SQ)|' \
+           -e 's|\(os\.getenv("GITPYTHONLIB"\)[^)]*)|\1,"@@INSTLIBDIR@@")|' \
            -e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR"'|g' \
            $@.py >$@+ && \
        chmod +x $@+ && \
@@@ -2100,7 -2079,7 +2097,7 @@@ clean
        $(RM) $(htmldocs).tar.gz $(manpages).tar.gz
        $(MAKE) -C Documentation/ clean
  ifndef NO_PERL
 -      $(RM) gitweb/gitweb.cgi
 +      $(MAKE) -C gitweb clean
        $(MAKE) -C perl clean
  endif
  ifndef NO_PYTHON
diff --combined builtin/clone.c
index 0bedde41f077f7c6e6106b144854c208ed4f6076,05be999bd4bee572826652c1cd6eafd61dc873f1..44579224270c194a0ab4a90280515ec55e3b6842
@@@ -302,8 -302,6 +302,8 @@@ static const struct ref *clone_local(co
        transport = transport_get(remote, src_repo);
        ret = transport_get_remote_refs(transport);
        transport_disconnect(transport);
 +      if (0 <= option_verbosity)
 +              printf("done.\n");
        return ret;
  }
  
@@@ -463,9 -461,7 +463,9 @@@ int cmd_clone(int argc, const char **ar
                die("could not create leading directories of '%s'", git_dir);
        set_git_dir(make_absolute_path(git_dir));
  
 -      init_db(option_template, (option_verbosity < 0) ? INIT_DB_QUIET : 0);
 +      if (0 <= option_verbosity)
 +              printf("Cloning into %s...\n", get_git_dir());
 +      init_db(option_template, INIT_DB_QUIET);
  
        /*
         * At this point, the config exists, so we do not need the
         */
        unsetenv(CONFIG_ENVIRONMENT);
  
-       if (option_reference)
-               setup_reference(git_dir);
        git_config(git_default_config, NULL);
  
        if (option_bare) {
                        git_config_set(key.buf, "true");
                        strbuf_reset(&key);
                }
-               strbuf_addf(&key, "remote.%s.url", option_origin);
-               git_config_set(key.buf, repo);
-               strbuf_reset(&key);
        }
  
+       strbuf_addf(&key, "remote.%s.url", option_origin);
+       git_config_set(key.buf, repo);
+       strbuf_reset(&key);
+       if (option_reference)
+               setup_reference(git_dir);
        fetch_pattern = value.buf;
        refspec = parse_fetch_refspec(1, &fetch_pattern);
  
                refs = clone_local(path, git_dir);
                mapped_refs = wanted_peer_refs(refs, refspec);
        } else {
-               struct remote *remote = remote_get(argv[0]);
+               struct remote *remote = remote_get(option_origin);
                transport = transport_get(remote, remote->url[0]);
  
                if (!transport->get_refs_list || !transport->fetch)