1. 22 10月, 2015 1 次提交
    • J
      mailinfo: libify · c6905e45
      Junio C Hamano 提交于
      Move the bulk of the code from builtin/mailinfo.c to mailinfo.c
      so that new callers can start calling mailinfo() directly.
      
      Note that a few calls to exit() and die() need to be cleaned up
      for the API to be truly useful, which will come in later steps.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      c6905e45
  2. 11 9月, 2015 1 次提交
  3. 26 8月, 2015 1 次提交
    • E
      generate-cmdlist: re-implement as shell script · 82aec45b
      Eric Sunshine 提交于
      527ec398 (generate-cmdlist: parse common group commands, 2015-05-21)
      replaced generate-cmdlist.sh with a more functional Perl version,
      generate-cmdlist.perl. The Perl version gleans named tags from a new
      "common groups" section in command-list.txt and recognizes those
      tags in "command list" section entries in place of the old 'common'
      tag. This allows git-help to, not only recognize, but also group
      common commands.
      
      Although the tests require Perl, 527ec398 creates an unconditional
      dependence upon Perl in the build system itself, which can not be
      overridden with NO_PERL. Such a dependency may be undesirable; for
      instance, the 'git-lite' package in the FreeBSD ports tree is
      intended as a minimal Git installation (which may, for example, be
      useful on servers needing only local clone and update capability),
      which, historically, has not depended upon Perl[1].
      
      Therefore, revive generate-cmdlist.sh and extend it to recognize
      "common groups" and its named tags. Retire generate-cmdlist.perl.
      
      [1]: http://thread.gmane.org/gmane.comp.version-control.git/275905/focus=276132Signed-off-by: NEric Sunshine <sunshine@sunshineco.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      82aec45b
  4. 20 8月, 2015 1 次提交
    • H
      submodule: implement a config API for lookup of .gitmodules values · 959b5455
      Heiko Voigt 提交于
      In a superproject some commands need to interact with submodules. They
      need to query values from the .gitmodules file either from the worktree
      of from certain revisions. At the moment this is quite hard since a
      caller would need to read the .gitmodules file from the history and then
      parse the values. We want to provide an API for this so we have one
      place to get values from .gitmodules from any revision (including the
      worktree).
      
      The API is realized as a cache which allows us to lazily read
      .gitmodules configurations by commit into a runtime cache which can then
      be used to easily lookup values from it. Currently only the values for
      path or name are stored but it can be extended for any value needed.
      
      It is expected that .gitmodules files do not change often between
      commits. Thats why we lookup the .gitmodules sha1 from a commit and then
      either lookup an already parsed configuration or parse and cache an
      unknown one for each sha1. The cache is lazily build on demand for each
      requested commit.
      
      This cache can be used for all purposes which need knowledge about
      submodule configurations. Example use cases are:
      
       * Recursive submodule checkout needs to lookup a submodule name from
         its path when a submodule first appears. This needs be done before
         this configuration exists in the worktree.
      
       * The implementation of submodule support for 'git archive' needs to
         lookup the submodule name to generate the archive when given a
         revision that is not checked out.
      
       * 'git fetch' when given the --recurse-submodules=on-demand option (or
         configuration) needs to lookup submodule names by path from the
         database rather than reading from the worktree. For new submodule it
         needs to lookup the name from its path to allow cloning new
         submodules into the .git folder so they can be checked out without
         any network interaction when the user does a checkout of that
         revision.
      Signed-off-by: NHeiko Voigt <hvoigt@hvoigt.net>
      Signed-off-by: NStefan Beller <sbeller@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      959b5455
  5. 11 8月, 2015 1 次提交
  6. 05 8月, 2015 2 次提交
    • P
      builtin-am: remove redirection to git-am.sh · 783d7e86
      Paul Tan 提交于
      At the beginning of the rewrite of git-am.sh to C, in order to not break
      existing test scripts that depended on a functional git-am, a
      redirection to git-am.sh was introduced that would activate if the
      environment variable _GIT_USE_BUILTIN_AM was not defined.
      
      Now that all of git-am.sh's functionality has been re-implemented in
      builtin/am.c, remove this redirection, and retire git-am.sh into
      contrib/examples/.
      Signed-off-by: NPaul Tan <pyokagan@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      783d7e86
    • P
      builtin-am: implement skeletal builtin am · 73c2779f
      Paul Tan 提交于
      For the purpose of rewriting git-am.sh into a C builtin, implement a
      skeletal builtin/am.c that redirects to $GIT_EXEC_PATH/git-am if the
      environment variable _GIT_USE_BUILTIN_AM is not defined. Since in the
      Makefile git-am.sh takes precedence over builtin/am.c,
      $GIT_EXEC_PATH/git-am will contain the shell script git-am.sh, and thus
      this allows us to fall back on the functional git-am.sh when running the
      test suite for tests that depend on a working git-am implementation.
      
      Since git-am.sh cannot handle any environment modifications by
      setup_git_directory(), "am" is declared with no setup flags in git.c. On
      the other hand, to re-implement git-am.sh in builtin/am.c, we need to
      run all the git dir and work tree setup logic that git.c typically does
      for us. As such, we work around this temporarily by copying the logic in
      git.c's run_builtin(), which is roughly:
      
      	prefix = setup_git_directory();
      	trace_repo_setup(prefix);
      	setup_work_tree();
      
      This redirection should be removed when all the features of git-am.sh
      have been re-implemented in builtin/am.c.
      Helped-by: NJunio C Hamano <gitster@pobox.com>
      Signed-off-by: NPaul Tan <pyokagan@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      73c2779f
  7. 04 8月, 2015 1 次提交
  8. 02 7月, 2015 1 次提交
  9. 29 6月, 2015 1 次提交
  10. 19 6月, 2015 1 次提交
    • P
      pull: remove redirection to git-pull.sh · b1456605
      Paul Tan 提交于
      At the beginning of the rewrite of git-pull.sh to C, we introduced a
      redirection to git-pull.sh if the environment variable
      _GIT_USE_BUILTIN_PULL was not defined in order to not break test scripts
      that relied on a functional git-pull.
      
      Now that all of git-pull's functionality has been re-implemented in
      builtin/pull.c, remove this redirection, and retire the old git-pull.sh
      into contrib/examples/.
      Signed-off-by: NPaul Tan <pyokagan@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b1456605
  11. 16 6月, 2015 1 次提交
    • P
      pull: implement skeletal builtin pull · 1e1ea69f
      Paul Tan 提交于
      For the purpose of rewriting git-pull.sh into a C builtin, implement a
      skeletal builtin/pull.c that redirects to $GIT_EXEC_PATH/git-pull.sh if
      the environment variable _GIT_USE_BUILTIN_PULL is not defined. This
      allows us to fall back on the functional git-pull.sh when running the
      test suite for tests that depend on a working git-pull implementation.
      
      This redirection should be removed when all the features of git-pull.sh
      have been re-implemented in builtin/pull.c.
      Helped-by: NJunio C Hamano <gitster@pobox.com>
      Signed-off-by: NPaul Tan <pyokagan@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      1e1ea69f
  12. 30 5月, 2015 3 次提交
    • J
      Makefile: silence perl/PM.stamp recipe · 7c37a5dc
      Jeff King 提交于
      Every time we run "make", we update perl/PM.stamp, which
      contains a list of all of the perl module files (if it's
      updated, we need to rebuild perl/perl.mak, since the
      Makefile will not otherwise know about the new files).
      
      This means that every time "make" is run, we see:
      
            GEN perl/PM.stamp
      
      in the output, even though it is not likely to have changed.
      Let's make this recipe completely silent, as we do for other
      auto-generated dependency files (e.g., GIT-CFLAGS).
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      7c37a5dc
    • J
      Makefile: avoid timestamp updates to GIT-BUILD-OPTIONS · a2d25ef0
      Jeff King 提交于
      We force the GIT-BUILD-OPTIONS recipe to run every time
      "make" is invoked. We must do this to catch new options
      which may have come from the command-line or environment.
      
      However, we actually update the file's timestamp each time
      the recipe is run, whether anything changed or not. As a
      result, any files which depend on it (for example, all of
      the perl scripts, which need to know whether NO_PERL was
      set) will be re-built every time.
      
      Let's do our usual trick of writing to a tempfile, then
      doing a "cmp || mv" to update the file only when something
      changed.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      a2d25ef0
    • J
      Makefile: drop dependency between git-instaweb and gitweb · e25c7cc1
      Jeff King 提交于
      The rule for "git-instaweb" depends on "gitweb". This makes
      no sense, because:
      
        1. git-instaweb has no build-time dependency on gitweb; it
           is a run-time dependency
      
        2. gitweb is a directory that we want to recursively make
           in. As a result, its recipe is marked .PHONY, which
           causes "make" to rebuild git-instaweb every time it is
           run.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      e25c7cc1
  13. 22 5月, 2015 2 次提交
  14. 08 5月, 2015 1 次提交
  15. 16 4月, 2015 1 次提交
    • J
      strbuf_getwholeline: use getdelim if it is available · 0cc30e0e
      Jeff King 提交于
      We spend a lot of time in strbuf_getwholeline in a tight
      loop reading characters from a stdio handle into a buffer.
      The libc getdelim() function can do this for us with less
      overhead. It's in POSIX.1-2008, and was a GNU extension
      before that. Therefore we can't rely on it, but can fall
      back to the existing getc loop when it is not available.
      
      The HAVE_GETDELIM knob is turned on automatically for Linux,
      where we have glibc. We don't need to set any new
      feature-test macros, because we already define _GNU_SOURCE.
      Other systems that implement getdelim may need to other
      macros (probably _POSIX_C_SOURCE >= 200809L), but we can
      address that along with setting the Makefile knob after
      testing the feature on those systems.
      
      Running "git rev-parse refs/heads/does-not-exist" on a repo
      with an extremely large (1.6GB) packed-refs file went from
      (best-of-5):
      
        real    0m8.601s
        user    0m8.084s
        sys     0m0.524s
      
      to:
      
        real    0m6.768s
        user    0m6.340s
        sys     0m0.432s
      
      for a wall-clock speedup of 21%.
      
      Based on a patch from Rasmus Villemoes <rv@rasmusvillemoes.dk>.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      0cc30e0e
  16. 13 3月, 2015 1 次提交
  17. 11 3月, 2015 1 次提交
  18. 04 2月, 2015 1 次提交
  19. 13 1月, 2015 1 次提交
    • K
      gettext.h: add parentheses around N_ expansion if supported · 290c8e7a
      Kyle J. McKay 提交于
      The gettext N_ macro is used to mark strings for translation
      without actually translating them.  At runtime the string is
      expected to be passed to the gettext API for translation.
      
      If two N_ macro invocations appear next to each other with only
      whitespace (or nothing at all) between them, the two separate
      strings will be marked for translation, but the preprocessor
      will then silently combine the strings into one and at runtime
      the string passed to gettext will not match the strings that
      were translated so no translation will actually occur.
      
      Avoid this by adding parentheses around the expansion of the
      N_ macro so that instead of ending up with two adjacent strings
      that are then combined by the preprocessor, two adjacent strings
      surrounded by parentheses result instead which causes a compile
      error so the mistake can be quickly found and corrected.
      
      However, since these string literals are typically assigned to
      static variables and not all compilers support parenthesized
      string literal assignments, allow this to be controlled by the
      Makefile with the default only enabled when the compiler is
      known to support the syntax.
      
      For now only __GNUC__ enables this by default which covers both
      gcc and clang which should result in early detection of any
      adjacent N_ macros.
      
      Although the necessary tests make the affected files a bit less
      elegant, the benefit of avoiding propagation of a translation-
      marking error to all the translation teams thus creating extra
      work for them when the error is eventually detected and fixed
      would seem to outweigh the minor inelegance the additional
      configuration tests introduce.
      Helped-by: NJunio C Hamano <gitster@pobox.com>
      Signed-off-by: NKyle J. McKay <mackyle@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      290c8e7a
  20. 10 1月, 2015 2 次提交
  21. 05 12月, 2014 1 次提交
    • D
      compat: convert modes to use portable file type values · d543d9c0
      David Michael 提交于
      This adds simple wrapper functions around calls to stat(), fstat(),
      and lstat() that translate the operating system's native file type
      bits to those used by most operating systems.  It also rewrites the
      S_IF* macros to the common values, so all file type processing is
      performed using the translated modes.  This makes projects portable
      across operating systems that use different file type definitions.
      
      Only the file type bits may be affected by these compatibility
      functions; the file permission bits are assumed to be 07777 and are
      passed through unchanged.
      Signed-off-by: NDavid Michael <fedora.dm0@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      d543d9c0
  22. 19 11月, 2014 3 次提交
    • J
      Makefile: have python scripts depend on NO_PYTHON setting · ca2051d6
      Jonathan Nieder 提交于
      Like the perl scripts, python scripts need a dependency to ensure they
      are rebuilt when switching between the "dummy" versions that run
      without Python and the real thing.
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      ca2051d6
    • J
      Makefile: simplify by using SCRIPT_{PERL,SH}_GEN macros · 64c07db9
      Jonathan Nieder 提交于
      SCRIPT_PERL_GEN is defined as $(patsubst %.perl,%,$(SCRIPT_PERL))
      for use in targets like build-perl-script used by makefiles in
      subdirectories that override SCRIPT_PERL (see v1.8.2-rc0~17^2,
      "git-remote-mediawiki: use toplevel's Makefile", 2013-02-08).
      
      The same expression is used in the rules that actually write the
      generated perl scripts, and since these rules were introduced before
      SCRIPT_PERL_GEN, they use the longhand instead of that macro.  Use the
      macro to make reading easier.
      
      Likewise for SCRIPT_SH_GEN.  The Python rules already got the same
      simplification in v1.8.4-rc0~162^2~8 (2013-05-24).
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Reviewed-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      64c07db9
    • J
      Makefile: have perl scripts depend on NO_PERL setting · e204b001
      Jeff King 提交于
      If NO_PERL is not set, our perl scripts are built as
      usual. If it is set, then we build "dummy" versions that
      tell you git was built without perl support and exit
      gracefully.
      
      However, if you switch to NO_PERL in a directory with
      existing build artifacts, we do not notice that the files
      need rebuilt. We see only that they are newer than the
      "unimplemented.sh" wrapper and assume they are done. So
      doing:
      
        make
        make NO_PERL=Nope
      
      would result in a git-add--interactive script that uses perl
      (and running the test suite would make use of it).
      
      Instead, we should trigger a rebuild of the perl scripts
      anytime NO_PERL changes.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      e204b001
  23. 11 11月, 2014 1 次提交
    • B
      git-imap-send: use libcurl for implementation · 1e16b255
      Bernhard Reiter 提交于
      Use libcurl's high-level API functions to implement git-imap-send
      instead of the previous low-level OpenSSL-based functions.
      
      Since version 7.30.0, libcurl's API has been able to communicate with
      IMAP servers. Using those high-level functions instead of the current
      ones would reduce imap-send.c by some 1200 lines of code. For now,
      the old ones are wrapped in #ifdefs, and the new functions are enabled
      by make if curl's version is >= 7.34.0, from which version on curl's
      CURLOPT_LOGIN_OPTIONS (enabling IMAP authentication) parameter has been
      available. The low-level functions will still be used for tunneling
      into the server for now.
      
      As I don't have access to that many IMAP servers, I haven't been able to
      test the new code with a wide variety of parameter combinations. I did
      test both secure and insecure (imaps:// and imap://) connections and
      values of "PLAIN" and "LOGIN" for the authMethod.
      
      In order to suppress a sparse warning about "using sizeof on a
      function", we use the same solution used in commit 9371322a
      ("sparse: suppress some "using sizeof on a function" warnings",
      06-10-2013) which solved exactly this problem for the other commands
      using libcurl.
      Helped-by: NRamsay Jones <ramsay@ramsay1.demon.co.uk>
      Signed-off-by: NBernhard Reiter <ockham@raz.or.at>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      1e16b255
  24. 28 10月, 2014 1 次提交
  25. 14 10月, 2014 2 次提交
  26. 02 10月, 2014 1 次提交
  27. 16 9月, 2014 1 次提交
  28. 03 9月, 2014 1 次提交
  29. 27 8月, 2014 1 次提交
    • J
      Makefile: drop CHECK_HEADER_DEPENDENCIES code · 14821f88
      Jeff King 提交于
      This code was useful when we kept a static list of header
      files, and it was easy to forget to update it. Since the last
      commit, we generate the list dynamically.
      
      Technically this could still be used to find a dependency
      that our dynamic check misses (e.g., a header file without a
      ".h" extension).  But that is reasonably unlikely to be
      added, and even less likely to be noticed by this tool
      (because it has to be run manually)., It is not worth
      carrying around the cruft in the Makefile.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      14821f88
  30. 26 8月, 2014 2 次提交
    • J
      Makefile: use `find` to determine static header dependencies · d85b0dff
      Jeff King 提交于
      Most modern platforms will use automatically computed header
      dependencies to figure out when a C file needs rebuilt due
      to a header changing. With old compilers, however, we
      fallback to a static list of header files. If any of them
      changes, we recompile everything. This is overly
      conservative, but the best we can do on older platforms.
      
      It is unfortunately easy for our static header list to grow
      stale, as none of the regular developers make use of it.
      Instead of trying to keep it up to date, let's invoke "find"
      to generate the list dynamically.
      
      Since we do not use the value $(LIB_H) unless either
      COMPUTE_HEADER_DEPENDENCIES is turned on or the user is
      building "po/git.pot" (where it comes in via $(LOCALIZED_C),
      make is smart enough to not even run this "find" in most
      cases. However, we do need to stop using the "immediate"
      variable assignment ":=" for $(LOCALIZED_C). That's OK,
      because it was not otherwise useful here.
      Signed-off-by: NJeff King <peff@peff.net>
      Reviewed-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      d85b0dff
    • J
      i18n: treat "make pot" as an explicitly-invoked target · 1f31963e
      Jonathan Nieder 提交于
      po/git.pot is normally used as-is and not regenerated by people
      building git, so it is okay if an explicit "make po/git.pot" always
      automatically regenerates it.  Depend on the magic FORCE target
      instead of explicitly keeping track of dependencies.
      
      This simplifies the makefile, in particular preparing for a moment
      when $(LIB_H), which is part of $(LOCALIZED_C), can be computed on the
      fly. It also fixes a slight breakage in which changes to perl and shell
      scripts did not trigger a rebuild of po/git.pot.
      
      We still need a dependency on GENERATED_H, to force those files to be
      built when regenerating git.pot.
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      1f31963e
  31. 20 8月, 2014 1 次提交