]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'sb/repack-in-c'
authorJunio C Hamano <gitster@pobox.com>
Fri, 18 Oct 2013 20:49:56 +0000 (13:49 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 18 Oct 2013 20:49:57 +0000 (13:49 -0700)
Rewrite "git repack" in C.

* sb/repack-in-c:
  repack: improve warnings about failure of renaming and removing files
  repack: retain the return value of pack-objects
  repack: rewrite the shell script in C

1  2 
Makefile
git.c

diff --combined Makefile
index 4fde227f1f28b6de9c205457b7da84c9631a24a0,69e5267f869cb532eac2ce381d4b66dc982be408..af847f84685af41a7da02c3c12fbdc1daa780f1c
+++ b/Makefile
@@@ -69,6 -69,9 +69,6 @@@ all:
  # Define NO_MSGFMT_EXTENDED_OPTIONS if your implementation of msgfmt
  # doesn't support GNU extensions like --check and --statistics
  #
 -# Define NEEDS_CLIPPED_WRITE if your write(2) cannot write more than
 -# INT_MAX bytes at once (e.g. MacOS X).
 -#
  # Define HAVE_PATHS_H if you have paths.h and want to use the default PATH
  # it specifies.
  #
@@@ -461,7 -464,6 +461,6 @@@ SCRIPT_SH += git-pull.s
  SCRIPT_SH += git-quiltimport.sh
  SCRIPT_SH += git-rebase.sh
  SCRIPT_SH += git-remote-testgit.sh
- SCRIPT_SH += git-repack.sh
  SCRIPT_SH += git-request-pull.sh
  SCRIPT_SH += git-stash.sh
  SCRIPT_SH += git-submodule.sh
@@@ -485,9 -487,11 +484,9 @@@ SCRIPT_PERL += git-relink.per
  SCRIPT_PERL += git-send-email.perl
  SCRIPT_PERL += git-svn.perl
  
 -SCRIPT_PYTHON += git-remote-testpy.py
  SCRIPT_PYTHON += git-p4.py
  
  NO_INSTALL += git-remote-testgit
 -NO_INSTALL += git-remote-testpy
  
  # Generated files for scripts
  SCRIPT_SH_GEN = $(patsubst %.sh,%,$(SCRIPT_SH))
@@@ -575,7 -579,6 +574,7 @@@ TEST_PROGRAMS_NEED_X += test-sigchai
  TEST_PROGRAMS_NEED_X += test-string-list
  TEST_PROGRAMS_NEED_X += test-subprocess
  TEST_PROGRAMS_NEED_X += test-svn-fe
 +TEST_PROGRAMS_NEED_X += test-urlmatch-normalization
  TEST_PROGRAMS_NEED_X += test-wildmatch
  
  TEST_PROGRAMS = $(patsubst %,%$X,$(TEST_PROGRAMS_NEED_X))
@@@ -732,7 -735,6 +731,7 @@@ LIB_H += tree-walk.
  LIB_H += tree.h
  LIB_H += unpack-trees.h
  LIB_H += url.h
 +LIB_H += urlmatch.h
  LIB_H += userdiff.h
  LIB_H += utf8.h
  LIB_H += varint.h
@@@ -883,7 -885,6 +882,7 @@@ LIB_OBJS += tree.
  LIB_OBJS += tree-walk.o
  LIB_OBJS += unpack-trees.o
  LIB_OBJS += url.o
 +LIB_OBJS += urlmatch.o
  LIB_OBJS += usage.o
  LIB_OBJS += userdiff.o
  LIB_OBJS += utf8.o
@@@ -969,6 -970,7 +968,7 @@@ BUILTIN_OBJS += builtin/reflog.
  BUILTIN_OBJS += builtin/remote.o
  BUILTIN_OBJS += builtin/remote-ext.o
  BUILTIN_OBJS += builtin/remote-fd.o
+ BUILTIN_OBJS += builtin/repack.o
  BUILTIN_OBJS += builtin/replace.o
  BUILTIN_OBJS += builtin/rerere.o
  BUILTIN_OBJS += builtin/reset.o
@@@ -1180,9 -1182,6 +1180,9 @@@ ifdef NEEDS_SSL_WITH_CRYPT
  else
        LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto
  endif
 +ifdef APPLE_COMMON_CRYPTO
 +      LIB_4_CRYPTO += -framework Security -framework CoreFoundation
 +endif
  endif
  ifdef NEEDS_LIBICONV
        ifdef ICONVDIR
@@@ -1494,6 -1493,11 +1494,6 @@@ ifndef NO_MSGFMT_EXTENDED_OPTION
        MSGFMT += --check --statistics
  endif
  
 -ifdef NEEDS_CLIPPED_WRITE
 -      BASIC_CFLAGS += -DNEEDS_CLIPPED_WRITE
 -      COMPAT_OBJS += compat/clipped-write.o
 -endif
 -
  ifneq (,$(XDL_FAST_HASH))
        BASIC_CFLAGS += -DXDL_FAST_HASH
  endif
@@@ -1662,6 -1666,9 +1662,6 @@@ ifndef NO_TCLT
  endif
  ifndef NO_PERL
        $(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' localedir='$(localedir_SQ)' all
 -endif
 -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) SHELL_PATH='$(SHELL_PATH_SQ)' PERL_PATH='$(PERL_PATH_SQ)'
  
@@@ -1830,7 -1837,12 +1830,7 @@@ ifndef NO_PYTHO
  $(SCRIPT_PYTHON_GEN): GIT-CFLAGS GIT-PREFIX GIT-PYTHON-VARS
  $(SCRIPT_PYTHON_GEN): % : %.py
        $(QUIET_GEN)$(RM) $@ $@+ && \
 -      INSTLIBDIR=`MAKEFLAGS= $(MAKE) -C git_remote_helpers -s \
 -              --no-print-directory prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' \
 -              instlibdir` && \
        sed -e '1s|#!.*python|#!$(PYTHON_PATH_SQ)|' \
 -          -e 's|\(os\.getenv("GITPYTHONLIB"\)[^)]*)|\1,"@@INSTLIBDIR@@")|' \
 -          -e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR"'|g' \
            $< >$@+ && \
        chmod +x $@+ && \
        mv $@+ $@
@@@ -2018,9 -2030,6 +2018,9 @@@ gettext.sp gettext.s gettext.o: GIT-PRE
  gettext.sp gettext.s gettext.o: EXTRA_CPPFLAGS = \
        -DGIT_LOCALE_PATH='"$(localedir_SQ)"'
  
 +http-push.sp http.sp http-walker.sp remote-curl.sp: SPARSE_FLAGS += \
 +      -DCURL_DISABLE_TYPECHECK
 +
  ifdef NO_EXPAT
  http-walker.sp http-walker.s http-walker.o: EXTRA_CPPFLAGS = -DNO_EXPAT
  endif
@@@ -2340,6 -2349,9 +2340,6 @@@ ifndef NO_PER
        $(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install
        $(MAKE) -C gitweb install
  endif
 -ifndef NO_PYTHON
 -      $(MAKE) -C git_remote_helpers prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install
 -endif
  ifndef NO_TCLTK
        $(MAKE) -C gitk-git install
        $(MAKE) -C git-gui gitexecdir='$(gitexec_instdir_SQ)' install
@@@ -2486,6 -2498,9 +2486,6 @@@ clean: profile-clean coverage-clea
  ifndef NO_PERL
        $(MAKE) -C gitweb clean
        $(MAKE) -C perl clean
 -endif
 -ifndef NO_PYTHON
 -      $(MAKE) -C git_remote_helpers clean
  endif
        $(MAKE) -C templates/ clean
        $(MAKE) -C t/ clean
diff --combined git.c
index 1188979465654248c5936e8246886341846cc6f1,03510be95d98c5554342976fb7b49542cda78a3e..cb5208de6a5aab7c222a1d1655fe37089a119fe0
--- 1/git.c
--- 2/git.c
+++ b/git.c
@@@ -7,7 -7,7 +7,7 @@@
  #include "commit.h"
  
  const char git_usage_string[] =
 -      "git [--version] [--help] [-c name=value]\n"
 +      "git [--version] [--help] [-C <path>] [-c name=value]\n"
        "           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n"
        "           [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]\n"
        "           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\n"
@@@ -147,35 -147,12 +147,35 @@@ static int handle_options(const char **
                        setenv(GIT_LITERAL_PATHSPECS_ENVIRONMENT, "0", 1);
                        if (envchanged)
                                *envchanged = 1;
 +              } else if (!strcmp(cmd, "--glob-pathspecs")) {
 +                      setenv(GIT_GLOB_PATHSPECS_ENVIRONMENT, "1", 1);
 +                      if (envchanged)
 +                              *envchanged = 1;
 +              } else if (!strcmp(cmd, "--noglob-pathspecs")) {
 +                      setenv(GIT_NOGLOB_PATHSPECS_ENVIRONMENT, "1", 1);
 +                      if (envchanged)
 +                              *envchanged = 1;
 +              } else if (!strcmp(cmd, "--icase-pathspecs")) {
 +                      setenv(GIT_ICASE_PATHSPECS_ENVIRONMENT, "1", 1);
 +                      if (envchanged)
 +                              *envchanged = 1;
                } else if (!strcmp(cmd, "--shallow-file")) {
                        (*argv)++;
                        (*argc)--;
                        set_alternate_shallow_file((*argv)[0]);
                        if (envchanged)
                                *envchanged = 1;
 +              } else if (!strcmp(cmd, "-C")) {
 +                      if (*argc < 2) {
 +                              fprintf(stderr, "No directory given for -C.\n" );
 +                              usage(git_usage_string);
 +                      }
 +                      if (chdir((*argv)[1]))
 +                              die_errno("Cannot change to '%s'", (*argv)[1]);
 +                      if (envchanged)
 +                              *envchanged = 1;
 +                      (*argv)++;
 +                      (*argc)--;
                } else {
                        fprintf(stderr, "Unknown option: %s\n", cmd);
                        usage(git_usage_string);
@@@ -419,6 -396,7 +419,7 @@@ static void handle_internal_command(in
                { "remote", cmd_remote, RUN_SETUP },
                { "remote-ext", cmd_remote_ext },
                { "remote-fd", cmd_remote_fd },
+               { "repack", cmd_repack, RUN_SETUP },
                { "replace", cmd_replace, RUN_SETUP },
                { "repo-config", cmd_repo_config, RUN_SETUP_GENTLY },
                { "rerere", cmd_rerere, RUN_SETUP },