1. 19 6月, 2013 1 次提交
  2. 10 6月, 2013 1 次提交
    • J
      test: test_must_be_empty helper · ca8d148d
      Junio C Hamano 提交于
      There are quite a lot places where an output file is expected to be
      empty, and we fail the test when it is not.  The output from running
      the test script with -i -v can be helped if we showed the unexpected
      contents at that point.
      
      We could of course do
      
          >expected.empty && test_cmp expected.empty actual
      
      but this is commmon enough to be done with a dedicated helper.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      ca8d148d
  3. 08 6月, 2013 1 次提交
  4. 01 4月, 2013 1 次提交
  5. 30 3月, 2013 1 次提交
  6. 23 3月, 2013 1 次提交
    • J
      apply --whitespace=fix: avoid running over the postimage buffer · 250b3c6c
      Junio C Hamano 提交于
      Originally update-pre-post-images could assume that any whitespace
      fixing will make the result only shorter by unexpanding runs of
      leading SPs into HTs and removing trailing whitespaces at the end of
      lines.  Updating the post-image we read from the patch to match the
      actual result can be performed in-place under this assumption.
      These days, however, we have tab-in-indent (aka Python) rule whose
      result can be longer than the original, and we do need to allocate
      a larger buffer than the input and replace the result.
      
      Fortunately the support for lengthening rewrite was already added
      when we began supporting "match while ignoring whitespace
      differences" mode in 86c91f91 (git apply: option to ignore
      whitespace differences, 2009-08-04).  We only need to correctly
      count the number of bytes necessary to hold the updated result and
      tell the function to allocate a new buffer.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      250b3c6c
  7. 13 2月, 2013 1 次提交
  8. 23 12月, 2012 1 次提交
  9. 16 11月, 2012 1 次提交
    • J
      test-lib: allow negation of prerequisites · bdccd3c1
      Jeff King 提交于
      You can set and test a prerequisite like this:
      
        test_set_prereq FOO
        test_have_prereq FOO && echo yes
      
      You can negate the test in the shell like this:
      
        ! test_have_prereq && echo no
      
      However, when you are using the automatic prerequisite
      checking in test_expect_*, there is no opportunity to use
      the shell negation.  This patch introduces the syntax "!FOO"
      to indicate that the test should only run if a prerequisite
      is not meant.
      
      One alternative is to set an explicit negative prerequisite,
      like:
      
        if system_has_foo; then
      	  test_set_prereq FOO
        else
      	  test_set_prereq NO_FOO
        fi
      
      However, this doesn't work for lazy prerequisites, which
      associate a single test with a single name. We could teach
      the lazy prereq evaluator to set both forms, but the code
      change ends up quite similar to this one (because we still
      need to convert NO_FOO into FOO to find the correct lazy
      script).
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      bdccd3c1
  10. 15 9月, 2012 1 次提交
    • M
      cherry-pick: don't forget -s on failure · 5ed75e2a
      Miklos Vajna 提交于
      In case 'git cherry-pick -s <commit>' failed, the user had to use 'git
      commit -s' (i.e. state the -s option again), which is easy to forget
      about.  Instead, write the signed-off-by line early, so plain 'git
      commit' will have the same result.
      
      Also update 'git commit -s', so that in case there is already a relevant
      Signed-off-by line before the Conflicts: line, it won't add one more at
      the end of the message. If there is no such line, then add it before the
      the Conflicts: line.
      Signed-off-by: NMiklos Vajna <vmiklos@suse.cz>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      5ed75e2a
  11. 05 8月, 2012 1 次提交
    • M
      tests: Introduce test_seq · d17cf5f3
      Michał Kiedrowicz 提交于
      Jeff King wrote:
      
      	The seq command is GNU-ism, and is missing at least in older BSD
      	releases and their derivatives, not to mention antique
      	commercial Unixes.
      
      	We already purged it in b3431bc6 (Don't use seq in tests, not
      	everyone has it, 2007-05-02), but a few new instances have crept
      	in. They went unnoticed because they are in scripts that are not
      	run by default.
      
      Replace them with test_seq that is implemented with a Perl snippet
      (proposed by Jeff).  This is better than inlining this snippet
      everywhere it's needed because it's easier to read and it's easier
      to change the implementation (e.g. to C) if we ever decide to remove
      Perl from the test suite.
      
      Note that test_seq is not a complete replacement for seq(1).  It
      just has what we need now, in addition that it makes it possible for
      us to do something like "test_seq a m" if we wanted to in the
      future.
      
      There are also many places that do `for i in 1 2 3 ...` but I'm not sure
      if it's worth converting them to test_seq.  That would introduce running
      more processes of Perl.
      Signed-off-by: NMichał Kiedrowicz <michal.kiedrowicz@gmail.com>
      Acked-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      d17cf5f3
  12. 28 7月, 2012 2 次提交
    • J
      test: allow prerequisite to be evaluated lazily · 04083f27
      Junio C Hamano 提交于
      The test prerequisite mechanism is a useful way to allow some tests
      in a test script to be skipped in environments that do not support
      certain features (e.g. it is pointless to attempt checking how well
      symbolic links are handled by Git on filesystems that do not support
      them).  It is OK for commonly used prerequisites to be always tested
      during start-up of a test script by having a codeblock that tests a
      feature and calls test_set_prereq, but for an uncommon feature,
      forcing 90% of scripts to pay the same probing overhead for
      prerequisite they do not care about is wasteful.
      
      Introduce a mechanism to probe the prerequiste lazily.  Changes are:
      
       - test_lazy_prereq () function, which takes the name of the
         prerequisite it probes and the script to probe for it, is
         added.  This only registers the name of the prerequiste that can
         be lazily probed and the script to eval (without running).
      
       - test_have_prereq() function (which is used by test_expect_success
         and also can be called directly by test scripts) learns to look
         at the list of prerequisites that can be lazily probed, and the
         prerequisites that have already been probed that way.  When asked
         for a prerequiste that can be but haven't been probed, the script
         registered with an earlier call to test_lazy_prereq is evaluated
         and the prerequisite is set.
      
       - test_run_lazy_prereq_() function is a helper to run the probe
         script with the same kind of sandbox as regular tests, helped by
         Jeff King.
      
      Update the codeblock to probe and set SYMLINKS prerequisite using
      the new mechanism as an example.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      04083f27
    • J
      test: rename $satisfied to $satisfied_prereq · f3cfc3b2
      Junio C Hamano 提交于
      All other shell variables that are used to globally keep track of
      states related to prerequisite have "prereq" somewhere in their
      names.  Be consistent and avoid potential name crashes with other
      kinds of satisfaction in the future.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      f3cfc3b2
  13. 25 6月, 2012 1 次提交
  14. 13 6月, 2012 1 次提交
    • V
      t: Replace 'perl' by $PERL_PATH · a3428205
      Vincent van Ravesteijn 提交于
      GIT-BUILD-OPTIONS defines PERL_PATH to be used in the test suite. Only a
      few tests already actually use this variable when perl is needed. The
      other test just call 'perl' and it might happen that the wrong perl
      interpreter is used.
      
      This becomes problematic on Windows, when the perl interpreter that is
      compiled and installed on the Windows system is used, because this perl
      interpreter might introduce some unexpected LF->CRLF conversions.
      
      This patch makes sure that $PERL_PATH is used everywhere in the test suite
      and that the correct perl interpreter is used.
      Signed-off-by: NVincent van Ravesteijn <vfr@lyx.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      a3428205
  15. 18 2月, 2012 1 次提交