Merge branch 'bf/commit-template-no-cleanup'
authorJunio C Hamano <gitster@pobox.com>
Fri, 13 May 2011 18:03:08 +0000 (11:03 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 13 May 2011 18:03:08 +0000 (11:03 -0700)
* bf/commit-template-no-cleanup:
Do not strip empty lines / trailing spaces from a commit message template

1  2 
t/t7500-commit.sh
diff --combined t/t7500-commit.sh
index 47096f9014a0f36251eeb643ea302555e9ddc4d5,9ef00906cc5eb029c0236331e9a39f3d5272ab67..1c908f4d3966cb9a2769465652981bef831f312d
@@@ -15,7 -15,7 +15,7 @@@ commit_msg_is () 
  
        printf "%s" "$(git log --pretty=format:%s%b -1)" >$expect &&
        printf "%s" "$1" >$actual &&
 -      test_cmp $expect $actual
 +      test_i18ncmp $expect $actual
  }
  
  # A sanity check to see if commit is working at all.
@@@ -72,7 -72,7 +72,7 @@@ test_expect_success 'adding comments t
        )
  '
  
 -test_expect_success C_LOCALE_OUTPUT 'adding real content to a template should commit' '
 +test_expect_success 'adding real content to a template should commit' '
        (
                test_set_editor "$TEST_DIRECTORY"/t7500/add-content &&
                git commit --template "$TEMPLATE"
@@@ -80,7 -80,7 +80,7 @@@
        commit_msg_is "template linecommit message"
  '
  
 -test_expect_success C_LOCALE_OUTPUT '-t option should be short for --template' '
 +test_expect_success '-t option should be short for --template' '
        echo "short template" > "$TEMPLATE" &&
        echo "new content" >> foo &&
        git add foo &&
@@@ -91,7 -91,7 +91,7 @@@
        commit_msg_is "short templatecommit message"
  '
  
 -test_expect_success C_LOCALE_OUTPUT 'config-specified template should commit' '
 +test_expect_success 'config-specified template should commit' '
        echo "new template" > "$TEMPLATE" &&
        git config commit.template "$TEMPLATE" &&
        echo "more content" >> foo &&
@@@ -123,6 -123,20 +123,20 @@@ test_expect_success 'commit message fro
        commit_msg_is "standard input msg"
  '
  
+ cat >"$TEMPLATE" <<\EOF
+ ### template
+ EOF
+ test_expect_success 'commit message from template with whitespace issue' '
+       echo "content galore" >>foo &&
+       git add foo &&
+       GIT_EDITOR="$TEST_DIRECTORY"/t7500/add-whitespaced-content git commit \
+               --template "$TEMPLATE" &&
+       commit_msg_is "commit message"
+ '
  test_expect_success 'using alternate GIT_INDEX_FILE (1)' '
  
        cp .git/index saved-index &&
@@@ -290,7 -304,7 +304,7 @@@ test_expect_success 'commit --squash wo
        commit_msg_is "squash! edited commit"
  '
  
 -test_expect_success C_LOCALE_OUTPUT 'commit --squash works with editor' '
 +test_expect_success 'commit --squash works with editor' '
        commit_for_rebase_autosquash_setup &&
        test_set_editor "$TEST_DIRECTORY"/t7500/add-content &&
        git commit --squash HEAD~1 &&