Merge branch 'maint-1.6.1' into maint
authorJunio C Hamano <gitster@pobox.com>
Sat, 28 Mar 2009 07:41:50 +0000 (00:41 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sat, 28 Mar 2009 07:41:50 +0000 (00:41 -0700)
* maint-1.6.1:
test-lib: Clean up comments and Makefile.
diff --no-index: Do not generate patch output if other output is requested

1  2 
diff-no-index.c
t/test-lib.sh
diff --combined diff-no-index.c
index 0a14268ba952da5ff66be753cc0cc147ba64ee2b,a3e47a76e401a1b98891b15a406b5806a294af3d..7273a7a0b648cc8cbd6dce2043a6e544b87d28b6
@@@ -40,7 -40,7 +40,7 @@@ static int get_mode(const char *path, i
                *mode = 0;
        else if (!strcmp(path, "-"))
                *mode = create_ce_mode(0666);
 -      else if (stat(path, &st))
 +      else if (lstat(path, &st))
                return error("Could not access '%s'", path);
        else
                *mode = st.st_mode;
@@@ -201,8 -201,6 +201,6 @@@ void diff_no_index(struct rev_info *rev
                    no_index ? "--no-index" : "[--no-index]");
  
        diff_setup(&revs->diffopt);
-       if (!revs->diffopt.output_format)
-               revs->diffopt.output_format = DIFF_FORMAT_PATCH;
        for (i = 1; i < argc - 2; ) {
                int j;
                if (!strcmp(argv[i], "--no-index"))
                revs->diffopt.paths = argv + argc - 2;
        revs->diffopt.nr_paths = 2;
        revs->diffopt.skip_stat_unmatch = 1;
+       if (!revs->diffopt.output_format)
+               revs->diffopt.output_format = DIFF_FORMAT_PATCH;
  
        DIFF_OPT_SET(&revs->diffopt, EXIT_WITH_STATUS);
        DIFF_OPT_SET(&revs->diffopt, NO_INDEX);
diff --combined t/test-lib.sh
index 0c455929e4e52795e616c3e2635f5899dff665c2,1b4f21638574a5cd9eb70bd9ba5d16ff10ba4058..59d82d25e9ad586ff43a4a9485d348492fb36d19
@@@ -127,7 -127,7 +127,7 @@@ f
  
  error () {
        say_color error "error: $*"
 -      trap - exit
 +      trap - EXIT
        exit 1
  }
  
@@@ -163,7 -163,7 +163,7 @@@ die () 
        exit 1
  }
  
 -trap 'die' exit
 +trap 'die' EXIT
  
  # The semantics of the editor variables are that of invoking
  # sh -c "$EDITOR \"$@\"" files ...
@@@ -193,31 -193,6 +193,31 @@@ test_tick () 
        export GIT_COMMITTER_DATE GIT_AUTHOR_DATE
  }
  
 +# Call test_commit with the arguments "<message> [<file> [<contents>]]"
 +#
 +# This will commit a file with the given contents and the given commit
 +# message.  It will also add a tag with <message> as name.
 +#
 +# Both <file> and <contents> default to <message>.
 +
 +test_commit () {
 +      file=${2:-"$1.t"}
 +      echo "${3-$1}" > "$file" &&
 +      git add "$file" &&
 +      test_tick &&
 +      git commit -m "$1" &&
 +      git tag "$1"
 +}
 +
 +# Call test_merge with the arguments "<message> <commit>", where <commit>
 +# can be a tag pointing to the commit-to-merge.
 +
 +test_merge () {
 +      test_tick &&
 +      git merge -m "$1" "$2" &&
 +      git tag "$1"
 +}
 +
  # You are not expected to call test_ok_ and test_failure_ directly, use
  # the text_expect_* functions instead.
  
@@@ -233,7 -208,7 +233,7 @@@ test_failure_ () 
        say_color error "FAIL $test_count: $1"
        shift
        echo "$@" | sed -e 's/^/        /'
 -      test "$immediate" = "" || { trap - exit; exit 1; }
 +      test "$immediate" = "" || { trap - EXIT; exit 1; }
  }
  
  test_known_broken_ok_ () {
@@@ -441,7 -416,7 +441,7 @@@ test_create_repo () 
  }
  
  test_done () {
 -      trap - exit
 +      trap - EXIT
        test_results_dir="$TEST_DIRECTORY/test-results"
        mkdir -p "$test_results_dir"
        test_results_path="$test_results_dir/${0%-*}-$$"
        fi
        case "$test_failure" in
        0)
-               # We could:
-               # cd .. && rm -fr 'trash directory'
-               # but that means we forbid any tests that use their own
-               # subdirectory from calling test_done without coming back
-               # to where they started from.
-               # The Makefile provided will clean this test area so
-               # we will leave things as they are.
                say_color pass "passed all $msg"
  
                test -d "$remove_trash" &&
@@@ -518,7 -485,7 +510,7 @@@ f
  test="trash directory.$(basename "$0" .sh)"
  test ! -z "$debug" || remove_trash="$TEST_DIRECTORY/$test"
  rm -fr "$test" || {
 -      trap - exit
 +      trap - EXIT
        echo >&5 "FATAL: Cannot prepare test area"
        exit 1
  }