1. 20 3月, 2015 2 次提交
  2. 16 3月, 2015 1 次提交
  3. 13 3月, 2015 6 次提交
    • J
      t5551: make EXPENSIVE test cheaper · 376e4b39
      Jeff King 提交于
      We create 50,000 tags to check that we don't overflow the
      command-line of fetch-pack. But by using run_with_cmdline_limit,
      we can get the same effect with a much smaller number of
      tags. This makes the test fast enough that we can drop the
      EXPENSIVE prereq, which means people will actually run it.
      
      It was not documented to do so, but this test was also the
      only test of a clone-over-http that requires multiple POSTs
      during the conversation. We can continue to test that by
      dropping http.postbuffer to its minimum size, and checking
      that we get two POSTs.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      376e4b39
    • J
      t5541: move run_with_cmdline_limit to test-lib.sh · 9a308de3
      Jeff King 提交于
      We use this to test http pushing with a restricted
      commandline. Other scripts (like t5551, which does http
      fetching) will want to use it, too.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      9a308de3
    • J
      t: pass GIT_TRACE through Apache · 89c57ab3
      Jeff King 提交于
      Apache removes GIT_TRACE from the environment before running
      git-http-backend. This can make it hard to debug the server
      side of an http session. Let's let it through.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      89c57ab3
    • J
      t: redirect stderr GIT_TRACE to descriptor 4 · 025232e8
      Jeff King 提交于
      If you run a test script like:
      
        GIT_TRACE=1 ./t0061-run-command.sh
      
      you may get test failures, because some tests capture and
      check the stderr output from git commands (and with
      GIT_TRACE set to 1, the trace output will be included
      there).
      
      When we see GIT_TRACE set like this, we print a warning to
      the user. However, we can do even better than that by just
      pointing it to descriptor 4, which all tests leave connected
      to the test script's stderr. That's likely what the user
      intended (and any scripts that do want to see GIT_TRACE
      output will set GIT_TRACE themselves).
      
      Not only does this avoid false negatives in the tests, but
      it means the user will actually see trace output for git
      calls that redirect their stderr (whereas before, it was
      sometimes confusingly buried in a file).
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      025232e8
    • J
      t: translate SIGINT to an exit · da706545
      Jeff King 提交于
      Right now if a test script receives SIGINT (e.g., because a
      test was hanging and the user hit ^C), the shell exits
      immediately. This can be annoying if the test script did any
      global setup, like starting apache or git-daemon, as it will
      not have an opportunity to clean up after itself. A
      subsequent run of the test won't be able to start its own
      daemon, and will either fail or skip the tests.
      
      Instead, let's trap SIGINT to make sure we do a clean
      shutdown, and just chain it to a normal exit (which will
      trigger any cleanup).
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      da706545
    • J
      upload-pack: fix transfer.hiderefs over smart-http · e172755b
      Jeff King 提交于
      When upload-pack advertises the refs (either for a normal,
      non-stateless request, or for the initial contact in a
      stateless one), we call for_each_ref with the send_ref
      function as its callback. send_ref, in turn, calls
      mark_our_ref, which checks whether the ref is hidden, and
      sets OUR_REF or HIDDEN_REF on the object as appropriate.  If
      it is hidden, mark_our_ref also returns "1" to signal
      send_ref that the ref should not be advertised.
      
      If we are not advertising refs, (i.e., the follow-up
      invocation by an http client to send its "want" lines), we
      use mark_our_ref directly as a callback to for_each_ref. Its
      marking does the right thing, but when it then returns "1"
      to for_each_ref, the latter interprets this as an error and
      stops iterating. As a result, we skip marking all of the
      refs that come lexicographically after it. Any "want" lines
      from the client asking for those objects will fail, as they
      were not properly marked with OUR_REF.
      
      To solve this, we introduce a wrapper callback around
      mark_our_ref which always returns 0 (even if the ref is
      hidden, we want to keep iterating). We also tweak the
      signature of mark_our_ref to exclude unnecessary parameters
      that were present only to conform to the callback interface.
      This should make it less likely for somebody to accidentally
      use it as a callback in the future.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      e172755b
  4. 11 3月, 2015 3 次提交
  5. 07 3月, 2015 8 次提交
  6. 06 3月, 2015 1 次提交
    • R
      archive-zip: mark text files in archives · 4aff646d
      René Scharfe 提交于
      Set the text flag for ZIP archive entries that look like text files so
      that unzip -a can be used to perform end-of-line conversions.  Info-ZIP
      zip does the same.
      
      Detect binary files the same way as git diff and git grep do, namely by
      checking for the attribute "diff" and its negation "-diff", and if none
      is found by falling back to checking for the presence of NUL bytes in
      the first few bytes of the file contents.
      
      7-Zip, Windows' built-in ZIP functionality and Info-ZIP unzip without
      the switch -a are not affected by the change and still extract text
      files without doing any end-of-line conversions.
      
      NB: The actual end-of-line style used in the archive entries doesn't
      matter to unzip -a, as it converts any CR, CRLF and LF to the line end
      characters appropriate for the platform it is running on.
      Suggested-by: NUlrike Fischer <luatex@nililand.de>
      Signed-off-by: NRene Scharfe <l.s.r@web.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      4aff646d
  7. 05 3月, 2015 1 次提交
    • J
      log --decorate: do not leak "commit" color into the next item · 5ee87585
      Junio C Hamano 提交于
      In "git log --decorate", you would see the commit header like this:
      
          commit ... (HEAD, jc/decorate-leaky-separator-color)
      
      where "commit ... (" is painted in color.diff.commit, "HEAD" in
      color.decorate.head, ", " in color.diff.commit, the branch name in
      color.decorate.branch and then closing ")" in color.diff.commit.
      
      If you wanted to paint the HEAD and local branch name in the same
      color as the body text (perhaps because cyan and green are too faint
      on a black-on-white terminal to be readable), you would not want to
      have to say
      
          [color "decorate"]
              head = black
              branch = black
      
      because that you would not be able to reuse same configuration on a
      white-on-black terminal.  You would naively expect
      
          [color "decorate"]
              head = normal
      	branch = normal
      
      to work, but unfortunately it does not.  It paints the string "HEAD"
      and the branch name in the same color as the opening parenthesis or
      comma between the decoration elements.  This is because the code
      forgets to reset the color after printing the "prefix" in its own
      color.
      
      It theoretically is possible that some people were expecting and
      relying on that the attribute set as the "diff.commit" color, which
      is used to draw these opening parenthesis and inter-item comma, is
      inherited by the drawing of branch names, but it is not how the
      coloring works everywhere else.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      5ee87585
  8. 04 3月, 2015 1 次提交
  9. 03 3月, 2015 1 次提交
    • M
      diff --shortstat --dirstat: remove duplicate output · ab27389a
      Mårten Kongstad 提交于
      When --shortstat is used in conjunction with --dirstat=changes, git diff will
      output the dirstat information twice: first as calculated by the 'lines'
      algorithm, then as calculated by the 'changes' algorithm:
      
          $ git diff --dirstat=changes,10 --shortstat v2.2.0..v2.2.1
           23 files changed, 453 insertions(+), 54 deletions(-)
            33.5% Documentation/RelNotes/
            26.2% t/
            46.6% Documentation/RelNotes/
            16.6% t/
      
      The same duplication happens for --shortstat together with --dirstat=files, but
      not for --shortstat together with --dirstat=lines.
      
      Limit output to only include one dirstat part, calculated as specified
      by the --dirstat parameter. Also, add test for this.
      Signed-off-by: NMårten Kongstad <marten.kongstad@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      ab27389a
  10. 28 2月, 2015 2 次提交
  11. 24 2月, 2015 1 次提交
    • J
      test_ln_s_add: refresh stat info of fake symbolic links · 817d03e1
      Johannes Sixt 提交于
      We have a helper function test_ln_s_add that inserts a symbolic link
      into the index even if the file system does not support symbolic links.
      There is a small flaw in the emulation path: the added entry does not
      pick up stat information of the fake symbolic link from the file system,
      as a consequence, the index is not exactly the same as for the "regular"
      path (where symbolic links are available). To fix this, just call
      git update-index again.
      
      This flaw was revealed by the earlier change that tightened
      compare_diff_raw(), because a test case in t4008 depends on the
      correctly updated index.
      Signed-off-by: NJohannes Sixt <j6t@kdbg.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      817d03e1
  12. 23 2月, 2015 3 次提交
  13. 18 2月, 2015 4 次提交
    • J
      daemon: sanitize incoming virtual hostname · b4853730
      Jeff King 提交于
      We use the daemon_avoid_alias function to make sure that the
      pathname the user gives us is sane. However, after applying
      that check, we might then interpolate the path using a
      string given by the server admin, but which may contain more
      untrusted data from the client. We should be sure to
      sanitize this data, as well.
      
      We cannot use daemon_avoid_alias here, as it is more strict
      than we need in requiring a leading '/'. At the same time,
      we can be much more strict here. We are interpreting a
      hostname, which should not contain slashes or excessive runs
      of dots, as those things are not allowed in DNS names.
      
      Note that in addition to cleansing the hostname field, we
      must check the "canonical hostname" (%CH) as well as the
      port (%P), which we take as a raw string.  For the canonical
      hostname, this comes from an actual DNS lookup on the
      accessed IP, which makes it a much less likely vector for
      problems. But it does not hurt to sanitize it in the same
      way. Unfortunately we cannot test this case easily, as it
      would involve a custom hostname lookup.
      
      We do not need to check %IP, as it comes straight from
      inet_ntop, so must have a sane form.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b4853730
    • J
      t5570: test git-daemon's --interpolated-path option · 5248f2dd
      Jeff King 提交于
      We did not test this at all; let's just give a basic sanity
      check that we can find a path based on virtual hosting, and
      that the downcase canonicalization works.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      5248f2dd
    • M
      commit: avoid race when creating orphan commits · a933c23e
      Michael Haggerty 提交于
      If HEAD doesn't point at anything during the initial check, then we
      should make sure that it *still* doesn't point at anything when we are
      ready to update the reference. Otherwise, another process might commit
      while we are working (e.g., while we are waiting for the user to edit
      the commit message) and we will silently overwrite it.
      
      This fixes a failing test in t7516.
      Signed-off-by: NMichael Haggerty <mhagger@alum.mit.edu>
      Reviewed-by: NStefan Beller <sbeller@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      a933c23e
    • M
      commit: add tests of commit races · a908a31c
      Michael Haggerty 提交于
      Committing involves the following steps:
      
      1. Determine the current value of HEAD (if any).
      2. Create the new commit object.
      3. Update HEAD.
      
      Please note that step 2 can take arbitrarily long, because it might
      involve the user editing a commit message.
      
      If a second process sneaks in a commit during step 2, then the first
      commit process should fail. This is usually done correctly, because
      step 3 verifies that HEAD still points at the same commit that it
      pointed to during step 1.
      
      However, if there is a race when creating an *orphan* commit, then the
      test in step 3 is skipped.
      
      Add tests for proper handling of such races. One of the new tests
      fails. It will be fixed in a moment.
      Signed-off-by: NMichael Haggerty <mhagger@alum.mit.edu>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      a908a31c
  14. 17 2月, 2015 1 次提交
  15. 16 2月, 2015 5 次提交
    • T
      test-lib.sh: set prerequisite SANITY by testing what we really need · f400e51c
      Torsten Bögershausen 提交于
      What we wanted out of the SANITY precondition is that the filesystem
      behaves sensibly with permission bits settings.
      
       - You should not be able to remove a file in a read-only directory,
      
       - You should not be able to tell if a file in a directory exists if
         the directory lacks read or execute permission bits.
      
      We used to cheat by approximating that condition with "is the /
      writable?" test and/or "are we running as root?" test.  Neither test
      is sufficient or appropriate in environments like Cygwin.
      Signed-off-by: NTorsten Bögershausen <tboegi@web.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      f400e51c
    • J
      t4008: modernise style · db7b9e3a
      Junio C Hamano 提交于
      Update this ancient test script to a more modern style in which the
      expected result is prepared inside the body of the test that uses
      it.  Also, instead of using $tree, a shell variable, throughout the
      test script, create a tag that points at it, to make it easier to
      manually debug the test script in its trash directory.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      db7b9e3a
    • J
      t/diff-lib: check exact object names in compare_diff_raw · bd9150b7
      Junio C Hamano 提交于
      The "sanitize" helper wanted to strip the similarity and
      dissimilarity scores when making comparison, but it was
      stripping away the object names as well.
      
      While we do not want to require the exact object names the tests
      expect to be maintained, as it would be seen as an extra burden,
      this would have prevented us catching a silly bug such as showing
      non 0{40} object name on the preimage side of an addition or on the
      postimage side of a deletion, because all [0-9a-f]{40} strings were
      considered equally OK.
      
      In the longer term, when a test only wants to see the status of the
      change without having to worry about object names, it should be
      rewritten not to inspect the raw format.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      bd9150b7
    • J
      tests: do not borrow from COPYING and README from the real source · 459b8d22
      Junio C Hamano 提交于
      These two files have been modified since the tests started using
      as test input, making the exact object names they expect to be
      different from what actually happens in the trash repository they
      use to run tests.
      
      Instead, take a snapshot of these two files and keep them in
      t/diff-lib/ so that we can update the real ones without having to
      worry about breaking tests.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      459b8d22
    • J
      t4010: correct expected object names · bb8db1b5
      Junio C Hamano 提交于
      The output the test expects is bogus.
      
      It was left unnoticed only because compare_diff_raw, which only
      cares about the add/delete/rename/copy was used to check the result.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      bb8db1b5