1. 13 12月, 2011 4 次提交
    • J
      add generic terminal prompt function · 21aeafce
      Jeff King 提交于
      When we need to prompt the user for input interactively, we
      want to access their terminal directly. We can't rely on
      stdio because it may be connected to pipes or files, rather
      than the terminal. Instead, we use "getpass()", because it
      abstracts the idea of prompting and reading from the
      terminal.  However, it has some problems:
      
        1. It never echoes the typed characters, which makes it OK
           for passwords but annoying for other input (like usernames).
      
        2. Some implementations of getpass() have an extremely
           small input buffer (e.g., Solaris 8 is reported to
           support only 8 characters).
      
        3. Some implementations of getpass() will fall back to
           reading from stdin (e.g., glibc). We explicitly don't
           want this, because our stdin may be connected to a pipe
           speaking a particular protocol, and reading will
           disrupt the protocol flow (e.g., the remote-curl
           helper).
      
        4. Some implementations of getpass() turn off signals, so
           that hitting "^C" on the terminal does not break out of
           the password prompt. This can be a mild annoyance.
      
      Instead, let's provide an abstract "git_terminal_prompt"
      function that addresses these concerns. This patch includes
      an implementation based on /dev/tty, enabled by setting
      HAVE_DEV_TTY. The fallback is to use getpass() as before.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      21aeafce
    • J
      move git_getpass to its own source file · d3c58b83
      Jeff King 提交于
      This is currently in connect.c, but really has nothing to
      do with the git protocol itself. Let's make a new source
      file all about prompting the user, which will make it
      cleaner to refactor.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      d3c58b83
    • J
      credentials: add "store" helper · 71e1b4b6
      Jeff King 提交于
      This is like "cache", except that we actually put the
      credentials on disk. This can be terribly insecure, of
      course, but we do what we can to protect them by filesystem
      permissions, and we warn the user in the documentation.
      
      This is not unlike using .netrc to store entries, but it's a
      little more user-friendly. Instead of putting credentials in
      place ahead of time, we transparently store them after
      prompting the user for them once.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      71e1b4b6
    • J
      Makefile: unix sockets may not available on some platforms · 6320358e
      Johannes Sixt 提交于
      Introduce a configuration option NO_UNIX_SOCKETS to exclude code that
      depends on Unix sockets and use it in MSVC and MinGW builds.
      
      Notice that unix-socket.h was missing from LIB_H before; fix that, too.
      Signed-off-by: NJohannes Sixt <j6t@kdbg.org>
      Helped-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      6320358e
  2. 12 12月, 2011 2 次提交
    • J
      credentials: add "cache" helper · e2770979
      Jeff King 提交于
      If you access repositories over smart-http using http
      authentication, then it can be annoying to have git ask you
      for your password repeatedly. We cache credentials in
      memory, of course, but git is composed of many small
      programs. Having to input your password for each one can be
      frustrating.
      
      This patch introduces a credential helper that will cache
      passwords in memory for a short period of time.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      e2770979
    • J
      introduce credentials API · abca927d
      Jeff King 提交于
      There are a few places in git that need to get a username
      and password credential from the user; the most notable one
      is HTTP authentication for smart-http pushing.
      
      Right now the only choices for providing credentials are to
      put them plaintext into your ~/.netrc, or to have git prompt
      you (either on the terminal or via an askpass program). The
      former is not very secure, and the latter is not very
      convenient.
      
      Unfortunately, there is no "always best" solution for
      password management. The details will depend on the tradeoff
      you want between security and convenience, as well as how
      git can integrate with other security systems (e.g., many
      operating systems provide a keychain or password wallet for
      single sign-on).
      
      This patch provides an abstract notion of credentials as a
      data item, and provides three basic operations:
      
        - fill (i.e., acquire from external storage or from the
          user)
      
        - approve (mark a credential as "working" for further
          storage)
      
        - reject (mark a credential as "not working", so it can
          be removed from storage)
      
      These operations can be backed by external helper processes
      that interact with system- or user-specific secure storage.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      abca927d
  3. 19 11月, 2011 2 次提交
    • J
      Makefile: add option to disable automatic dependency generation · 024c843d
      Jonathan Nieder 提交于
      Now that the COMPUTE_HEADER_DEPENDENCIES feature is turned on
      automatically for compilers that support it (see v1.7.8-rc0~142^2~1,
      2011-08-18), there is no easy way to force it off.  For example,
      setting COMPUTE_HEADER_DEPENDENCIES to the empty string in config.mak
      just tells the makefile to treat it as undefined and run a test
      command to see if the -MMD option is supported.
      
      So allow setting COMPUTE_HEADER_DEPENDENCIES=no to explicitly force
      the feature off.  The new semantics:
      
       - "yes" means to explicitly enable the feature
       - "no" means to disable it
       - "auto" means to autodetect
      
      The default is still "auto".  Any value other than these three will
      cause the build to error out with a descriptive message so typos and
      stale settings in config.mak don't result in mysterious behavior.
      
      	Makefile:1278: *** please set COMPUTE_HEADER_DEPENDENCIES to
      	yes, no, or auto (not "1").  Stop.
      
      So now when someone using a compiler without -MMD support reports
      trouble building git, you can reproduce it by running "make
      COMPUTE_HEADER_DEPENDENCIES=no".
      Suggested-by: NNguyễn Thái Ngọc Duy <pclouds@gmail.com>
      Improved-by: NJunio C Hamano <gitster@pobox.com>
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Tested-by: NNguyễn Thái Ngọc Duy <pclouds@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      024c843d
    • J
      Makefile: add missing header file dependencies · 487da9cd
      Jonathan Nieder 提交于
      When the streaming filter API was introduced in v1.7.7-rc0~60^2~7
      (2011-05-20), we forgot to add its header to LIB_H.  Most translation
      units depend on streaming.h via cache.h.
      
      v1.7.5-rc0~48 (Fix sparse warnings, 2011-03-22) introduced undeclared
      dependencies by url.o on url.h and thread-utils.o on thread-utils.h.
      
      Noticed by make CHECK_HEADER_DEPENDENCIES=1.
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      487da9cd
  4. 02 11月, 2011 1 次提交
  5. 31 10月, 2011 1 次提交
  6. 19 10月, 2011 1 次提交
  7. 10 10月, 2011 1 次提交
    • J
      Makefile: fix permissions of mergetools/ checked out with permissive umask · 53b74252
      Jonathan Nieder 提交于
      Ever since mergetool--lib was split into multiple files in
      v1.7.7-rc0~3^2~1 (2011-08-18), the Makefile takes care to reset umask
      and use tar --no-owner when installing merge tool definitions to
      $(gitexecdir)/mergetools/.  Unfortunately it does not take into
      account the possibility that the permission bits of the files being
      copied might already be wrong.
      
      Rather than fixing the "tar" incantation and making it even more
      complicated, let's just use the "install" utility.  This only means
      losing the ability to install executables and subdirectories of
      mergetools/, which wasn't used.
      
      Noticed by installing from a copy of git checked out with umask 002.
      Compare v1.6.0.3~81^2 (Fix permission bits on sources checked out with
      an overtight umask, 2008-08-21).
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      53b74252
  8. 04 10月, 2011 1 次提交
    • J
      Makefile: do not set setgid bit on directories on GNU/kFreeBSD · 0b20dd8f
      Jonathan Nieder 提交于
      The g+s bit on directories to make group ownership inherited is a
      SysVism --- BSD and most of its descendants do not need it since they
      do the sane thing by default without g+s.  In fact, on some
      filesystems (but not all --- tmpfs works this way but UFS does not),
      the kernel of FreeBSD does not even allow non-root users to set setgid
      bit on directories and produces errors when one tries:
      
      	$ git init --shared dir
      	fatal: Could not make /tmp/dir/.git/refs writable by group
      
      Since the setgid bit would only mean "do what you were going to do
      already", it's better to avoid setting it.  Accordingly, ever since
      v1.5.5-rc0~59^2 (Do not use GUID on dir in git init --share=all on
      FreeBSD, 2008-03-05), git on true FreeBSD has done exactly that.  Set
      DIR_HAS_BSD_GROUP_SEMANTICS in the makefile for GNU/kFreeBSD, too, so
      machines that use glibc with the kernel of FreeBSD get the same fix.
      
      This fixes t0001-init.sh and t1301-shared-repo.sh on GNU/kFreeBSD
      when running tests with --root pointing to a directory that uses
      tmpfs.
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      0b20dd8f
  9. 15 9月, 2011 1 次提交
    • J
      refactor argv_array into generic code · c1189cae
      Jeff King 提交于
      The submodule code recently grew generic code to build a
      dynamic argv array. Many other parts of the code can reuse
      this, too, so let's make it generically available.
      
      There are two enhancements not found in the original code:
      
        1. We now handle the NULL-termination invariant properly,
           even when no strings have been pushed (before, you
           could have an empty, NULL argv). This was not a problem
           for the submodule code, which always pushed at least
           one argument, but was not sufficiently safe for
           generic code.
      
        2. There is a formatted variant of the "push" function.
           This is a convenience function which was not needed by
           the submodule code, but will make it easier to port
           other users to the new code.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      c1189cae
  10. 12 9月, 2011 1 次提交
  11. 10 9月, 2011 1 次提交
  12. 31 8月, 2011 1 次提交
    • D
      Makefile: Improve compiler header dependency check · 1816bf26
      David Aguilar 提交于
      The Makefile enables CHECK_HEADER_DEPENDENCIES when the
      compiler supports generating header dependencies.
      Make the check use the same flags as the invocation
      to avoid a false positive when user-configured compiler
      flags contain incompatible options.
      
      For example, without this patch, trying to build universal
      binaries on a Mac using CFLAGS='-arch i386 -arch x86_64'
      produces:
      
      	gcc-4.2: -E, -S, -save-temps and -M options are
      	not allowed with multiple -arch flags
      
      While at it, remove "sh -c" in the command passed to $(shell);
      at this point in the Makefile, SHELL has already been set to
      a sensible shell and it is better not to override that.
      Signed-off-by: NDavid Aguilar <davvid@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      1816bf26
  13. 21 8月, 2011 2 次提交
    • F
      Use kwset in pickaxe · b95c5ada
      Fredrik Kuivinen 提交于
      Benchmarks in the hot cache case:
      
      before:
      $ perf stat --repeat=5 git log -Sqwerty
      
      Performance counter stats for 'git log -Sqwerty' (5 runs):
      
             47,092,744 cache-misses             #      2.825 M/sec   ( +-   1.607% )
            123,368,389 cache-references         #      7.400 M/sec   ( +-   0.812% )
            330,040,998 branch-misses            #      3.134 %       ( +-   0.257% )
         10,530,896,750 branches                 #    631.663 M/sec   ( +-   0.121% )
         62,037,201,030 instructions             #      1.399 IPC     ( +-   0.142% )
         44,331,294,321 cycles                   #   2659.073 M/sec   ( +-   0.326% )
                 96,794 page-faults              #      0.006 M/sec   ( +-  11.952% )
                     25 CPU-migrations           #      0.000 M/sec   ( +-  25.266% )
                  1,424 context-switches         #      0.000 M/sec   ( +-   0.540% )
           16671.708650 task-clock-msecs         #      0.997 CPUs    ( +-   0.343% )
      
            16.728692052  seconds time elapsed   ( +-   0.344% )
      
      after:
      $ perf stat --repeat=5 git log -Sqwerty
      
      Performance counter stats for 'git log -Sqwerty' (5 runs):
      
             51,385,522 cache-misses             #      4.619 M/sec   ( +-   0.565% )
            129,177,880 cache-references         #     11.611 M/sec   ( +-   0.219% )
            319,222,775 branch-misses            #      6.946 %       ( +-   0.134% )
          4,595,913,233 branches                 #    413.086 M/sec   ( +-   0.112% )
         31,395,042,533 instructions             #      1.062 IPC     ( +-   0.129% )
         29,558,348,598 cycles                   #   2656.740 M/sec   ( +-   0.204% )
                 93,224 page-faults              #      0.008 M/sec   ( +-   4.487% )
                     19 CPU-migrations           #      0.000 M/sec   ( +-  10.425% )
                    950 context-switches         #      0.000 M/sec   ( +-   0.360% )
           11125.796039 task-clock-msecs         #      0.997 CPUs    ( +-   0.239% )
      
            11.164216599  seconds time elapsed   ( +-   0.240% )
      
      So the kwset code is about 33% faster.
      Signed-off-by: NFredrik Kuivinen <frekui@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b95c5ada
    • F
      Add obstack.[ch] from EGLIBC 2.10 · e831171d
      Fredrik Kuivinen 提交于
      Signed-off-by: NFredrik Kuivinen <frekui@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      e831171d
  14. 19 8月, 2011 2 次提交
  15. 12 8月, 2011 1 次提交
    • D
      Reduce parse-options.o dependencies · 06876284
      Dmitry Ivankov 提交于
      Currently parse-options.o pulls quite a big bunch of dependencies.
      his complicates it's usage in contrib/ because it pulls external
      dependencies and it also increases executables size.
      
      Split off less generic and more internal to git part of
      parse-options.c to parse-options-cb.c.
      
      Move prefix_filename function from setup.c to abspath.c. abspath.o
      and wrapper.o pull each other, so it's unlikely to increase the
      dependencies. It was a dependency of parse-options.o that pulled
      many others.
      
      Now parse-options.o pulls just abspath.o, ctype.o, strbuf.o, usage.o,
      wrapper.o, libc directly and strlcpy.o indirectly.
      Signed-off-by: NDmitry Ivankov <divanorama@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      06876284
  16. 05 8月, 2011 1 次提交
  17. 04 8月, 2011 1 次提交
  18. 21 7月, 2011 1 次提交
    • T
      Makefile: add Minix configuration options. · bc5f813a
      Thomas Cort 提交于
      Add a $(uname_S) case for Minix with the correct options.
      
      Minix's linker needs all libraries specified explicitly.
      Add NEEDS_SSL_WITH_CURL to add -lssl when using -lcurl.
      Add NEEDS_IDN_WITH_CURL to add -lidn when using -lcurl.
      
      When NEEDS_SSL_WITH_CURL is defined and NEEDS_CRYPTO_WITH_SSL
      is defined, add -lcrypt to CURL_LIBCURL.
      
      Change OPENSSL_LINK to OPENSSL_LIBSSL in the
      NEEDS_CRYPTO_WITH_SSL conditional in the libopenssl
      section. Libraries go in OPENSSL_LIBSSL, OPENSSL_LINK
      is for linker flags.
      Signed-off-by: NThomas Cort <tcort@minix3.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      bc5f813a
  19. 15 7月, 2011 1 次提交
  20. 13 7月, 2011 1 次提交
    • T
      teach --histogram to diff · 8c912eea
      Tay Ray Chuan 提交于
      Port JGit's HistogramDiff algorithm over to C. Rough numbers (TODO) show
      that it is faster than its --patience cousin, as well as the default
      Meyers algorithm.
      
      The implementation has been reworked to use structs and pointers,
      instead of bitmasks, thus doing away with JGit's 2^28 line limit.
      
      We also use xdiff's default hash table implementation (xdl_hash_bits()
      with XDL_HASHLONG()) for convenience.
      Signed-off-by: NTay Ray Chuan <rctay89@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      8c912eea
  21. 01 7月, 2011 1 次提交
    • J
      git skew: a tool to find how big a clock skew exists in the history · 188c35e3
      Jeff King 提交于
      > As you probably guessed from the specificity of the number, I wrote a
      > short program to actually traverse and find the worst skew. It takes
      > about 5 seconds to run (unsurprisingly, since it is doing the same full
      > traversal that we end up doing in the above numbers). So we could
      > "autoskew" by setting up the configuration on clone, and then
      > periodically updating it as part of "git gc".
      
      This patch doesn't implement auto-detection of skew, but is the program
      I used to calculate, and would provide the basis for such
      auto-detection. It would be interesting to see average skew numbers for
      popular repositories. You can run it as "git skew --all".
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      Signed-off-by: NÆvar Arnfjörð Bjarmason <avarab@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      188c35e3
  22. 23 6月, 2011 1 次提交
  23. 21 6月, 2011 2 次提交
    • A
      Add profile feedback build to git · 7ddc2710
      Andi Kleen 提交于
      Add a gcc profile feedback build option "profile-all" to the main
      Makefile. It simply runs the test suite to generate feedback data and the
      recompiles the main executables with that. The basic structure is similar
      to the existing gcov code.
      
      gcc is often able to generate better code with profile feedback data. The
      training load also doesn't need to be too similar to the actual load, it
      still gives benefits.
      
      The test suite run is unfortunately quite long. It would be good to find a
      suitable subset that runs faster and still gives reasonable feedback.
      
      For now the test suite runs single threaded (I had some trouble running
      the test suite with -jX)
      
      I tested it with git gc and git blame kernel/sched.c on a Linux kernel
      tree. For gc I get about 2.7% improvement in wall clock time by using the
      feedback build, for blame about 2.4%.  That's not gigantic, but not shabby
      either for a very small patch.
      
      If anyone has any favourite CPU intensive git benchmarks feel free to try
      them too.
      
      I hope distributors will switch to use a feedback build in their packages.
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      7ddc2710
    • J
      Add option to disable NORETURN · 6520c846
      Junio C Hamano 提交于
      Due to a bug in gcc 4.6+ it can crash when doing profile feedback
      with a noreturn function pointer
      
      (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49299)
      
      This adds a Makefile variable to disable noreturns.
      
      [Patch by Junio, description by Andi Kleen]
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      6520c846
  24. 16 6月, 2011 1 次提交
  25. 21 5月, 2011 1 次提交
    • J
      streaming: a new API to read from the object store · 46bf0438
      Junio C Hamano 提交于
      Given an object name, use open_istream() to get a git_istream handle
      that you can read_istream() from as if you are using read(2) to read
      the contents of the object, and close it with close_istream() when
      you are done.
      
      Currently, we do not do anything fancy--it just calls read_sha1_file()
      and keeps the contents in memory as a whole, and carve it out as you
      request with read_istream().
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      46bf0438
  26. 20 5月, 2011 3 次提交
  27. 16 5月, 2011 1 次提交
  28. 15 5月, 2011 3 次提交
    • Æ
      Makefile: add xgettext target for *.sh files · adc3b2b2
      Ævar Arnfjörð Bjarmason 提交于
      Change the "pot" target to also extract strings from our $(SCRIPT_SH)
      files with xgettext(1).
      
      Note that due to Jonathan Nieder's trick of doing "mv $@+ $@" at the
      end of the target the "pot" target will now warn:
      
          $ make pot
              XGETTEXT po/git.pot
          po/git.pot+: warning: Charset "CHARSET" is not a portable encoding name.
                                Message conversion to user's charset might not work.
      
      This warnings is emitted because xgettext is writing into a non-*.pot
      file, it's harmless however. The content that's written out is
      equivalent to what it would be if we were writing directly into an
      existing POT file with --join-existing.
      
      As part of this change I've eliminated the && chain between xgettext
      calls, this is incompatible with $(QUIET_XGETTEXT), if the && is left
      in it'll emit:
      
          /bin/sh: @echo: not found
      
      Since it's redundant (the Makefile will stop if there's an error) I've
      removed it altogether.
      Signed-off-by: NÆvar Arnfjörð Bjarmason <avarab@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      adc3b2b2
    • Æ
      git-sh-i18n.sh: add no-op gettext() and eval_gettext() wrappers · e00cf070
      Ævar Arnfjörð Bjarmason 提交于
      Add a no-op wrapper library for Git's shell scripts. To split up the
      gettext series I'm first submitting patches to gettextize the source
      tree before I add any of the Makefile and Shell library changes needed
      to actually use them.
      Signed-off-by: NÆvar Arnfjörð Bjarmason <avarab@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      e00cf070
    • Æ
      git-sh-i18n--envsubst: our own envsubst(1) for eval_gettext() · ba67aaf2
      Ævar Arnfjörð Bjarmason 提交于
      Add a git-sh-i18n--envsubst program which is a stripped-down version
      of the GNU envsubst(1) program that comes with GNU gettext for use in
      the eval_gettext() fallback.
      
      We need a C helper program because implementing eval_gettext() purely
      in shell turned out to be unworkable. Digging through the Git mailing
      list archives will reveal two shell implementations of eval_gettext
      that are almost good enough, but fail on an edge case which is tested
      for in the tests which are part of this patch.
      
      These are the modifications I made to envsubst.c as I turned it into
      sh-i18n--envsubst.c:
      
       * Added our git-compat-util.h header for xrealloc() and friends.
      
       * Removed inclusion of gettext-specific headers.
      
       * Removed most of main() and replaced it with my own. The modified
         version only does option parsing for --variables. That's all it
         needs.
      
       * Modified error() invocations to use our error() instead of
         error(3).
      
       * Replaced the gettext XNMALLOC(n, size) macro with just
         xmalloc(n). Since XNMALLOC() only allocated char's.
      
       * Removed the string_list_destroy function. It's redundant (also in
         the upstream code).
      
       * Replaced the use of stdbool.h (a C99 header) by doing the following
         replacements on the code:
      
          * s/bool/unsigned short int/g
          * s/true/1/g
          * s/false/0/g
      Reported-by: NJohannes Sixt <j.sixt@viscovery.net>
      Signed-off-by: NÆvar Arnfjörð Bjarmason <avarab@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      ba67aaf2