<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/t/t7502-commit.sh, branch v1.8.2.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v1.8.2.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v1.8.2.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2013-02-19T17:30:50Z</updated>
<entry>
<title>git-commit: only append a newline to -m mesg if necessary</title>
<updated>2013-02-19T17:30:50Z</updated>
<author>
<name>Brandon Casey</name>
<email>drafnel@gmail.com</email>
</author>
<published>2013-02-19T04:17:06Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a24a41ea9a928ccde2db074ab0835c4817223c9d'/>
<id>urn:sha1:a24a41ea9a928ccde2db074ab0835c4817223c9d</id>
<content type='text'>
Currently, git will append two newlines to every message supplied via
the -m switch.  The purpose of this is to allow -m to be supplied
multiple times and have each supplied string become a paragraph in the
resulting commit message.

Normally, this does not cause a problem since any trailing newlines will
be removed by the cleanup operation.  If cleanup=verbatim for example,
then the trailing newlines will not be removed and will survive into the
resulting commit message.

Instead, let's ensure that the string supplied to -m is newline terminated,
but only append a second newline when appending additional messages.

Fixes the test in t7502.

Signed-off-by: Brandon Casey &lt;drafnel@gmail.com&gt;
Reviewed-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>t7502: demonstrate breakage with a commit message with trailing newlines</title>
<updated>2013-02-19T17:30:23Z</updated>
<author>
<name>Brandon Casey</name>
<email>drafnel@gmail.com</email>
</author>
<published>2013-02-19T04:17:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5b012c80a165236dde57c386fd62465e9137b2ce'/>
<id>urn:sha1:5b012c80a165236dde57c386fd62465e9137b2ce</id>
<content type='text'>
This test attempts to verify that a commit message supplied to 'git
commit' via the -m switch was used in full as the commit message for a
commit when --cleanup=verbatim was used.

But, this test has been broken since it was introduced.  Since the
commit message containing trailing newlines was supplied to 'git commit'
using a command substitution, the trailing newlines were removed by the
shell.  This means that a string without any trailing newlines was
actually supplied to 'git commit'.

The test was able to complete successfully since internally, git appends
two newlines to each string supplied via the -m switch.  So, the two
newlines removed by the shell were then re-added by git, and the
resulting commit matched what was expected.

So, let's move the initial creation of the commit message string out
from within a previous test so that it stands alone.  Assign the desired
commit message to a variable using literal newlines.  Then populate the
expect file from the contents of the commit message variable.  This way
the shell variable becomes the authoritative source of the commit
message and can be supplied via the -m switch with the trailing newlines
intact.

Mark this test as failing, since it is not handled correctly by git.
As described above, git appends two extra newlines to every string
supplied via -m, even to the ones that already end with a newline.

Signed-off-by: Brandon Casey &lt;drafnel@gmail.com&gt;
Reviewed-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>t/t7502: compare entire commit message with what was expected</title>
<updated>2013-02-19T17:29:13Z</updated>
<author>
<name>Brandon Casey</name>
<email>drafnel@gmail.com</email>
</author>
<published>2013-02-19T04:17:04Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=67dabab05820d97df175c724123b1232ff8d051d'/>
<id>urn:sha1:67dabab05820d97df175c724123b1232ff8d051d</id>
<content type='text'>
This test attempts to verify that a commit in "verbatim" mode, when
supplied a commit template, produces a commit in which the commit
message matches exactly the template that was supplied.  But, since the
commit operation appends additional instructions for the user as
comments in the commit buffer, which would cause the comparison to fail,
this test decided to compare only the first three lines (the length of
the template) of the resulting commit message to the original template
file.

This has two problems.

  1. It does not allow the template to be lengthened or shortened
     without also modifying the number of lines that are considered
     significant (i.e. the argument to 'head -n').
  2. It will not catch a bug in git that causes git to append additional
     lines to the commit message.

So, let's use the --no-status option to 'git commit' which will cause
git to refrain from appending the lines of instructional text to the
commit message.  This will allow the entire resulting commit message to
be compared against the expected value.

Signed-off-by: Brandon Casey &lt;drafnel@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jc/custom-comment-char'</title>
<updated>2013-02-04T18:23:49Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2013-02-04T18:23:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=149a4211a4b8d8bbcdd72685d538d6ac7365e29e'/>
<id>urn:sha1:149a4211a4b8d8bbcdd72685d538d6ac7365e29e</id>
<content type='text'>
Allow a configuration variable core.commentchar to customize the
character used to comment out the hint lines in the edited text from
the default '#'.

* jc/custom-comment-char:
  Allow custom "comment char"
</content>
</entry>
<entry>
<title>Allow custom "comment char"</title>
<updated>2013-01-16T20:48:22Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2013-01-16T19:18:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=eff80a9fd990de3605063050dae32f969ef18ba8'/>
<id>urn:sha1:eff80a9fd990de3605063050dae32f969ef18ba8</id>
<content type='text'>
Some users do want to write a line that begin with a pound sign, #,
in their commit log message.  Many tracking system recognise
a token of #&lt;bugid&gt; form, for example.

The support we offer these use cases is not very friendly to the end
users.  They have a choice between

 - Don't do it.  Avoid such a line by rewrapping or indenting; and

 - Use --cleanup=whitespace but remove all the hint lines we add.

Give them a way to set a custom comment char, e.g.

    $ git -c core.commentchar="%" commit

so that they do not have to do either of the two workarounds.

[jc: although I started the topic, all the tests and documentation
updates, many of the call sites of the new strbuf_add_commented_*()
functions, and the change to git-submodule.sh scripted Porcelain are
from Ralf.]

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
Signed-off-by: Ralf Thielow &lt;ralf.thielow@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>commit: make default of "cleanup" option configurable</title>
<updated>2013-01-10T19:45:02Z</updated>
<author>
<name>Ralf Thielow</name>
<email>ralf.thielow@gmail.com</email>
</author>
<published>2013-01-10T17:45:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=51fb3a3dfa4ffeeb210fb0e7d6f631503a5a1dfb'/>
<id>urn:sha1:51fb3a3dfa4ffeeb210fb0e7d6f631503a5a1dfb</id>
<content type='text'>
The default of the "cleanup" option in "git commit"
is not configurable. Users who don't want to use the
default have to pass this option on every commit since
there's no way to configure it. This commit introduces
a new config option "commit.cleanup" which can be used
to change the default of the "cleanup" option in
"git commit".

Signed-off-by: Ralf Thielow &lt;ralf.thielow@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>t7502: factor out autoident prerequisite</title>
<updated>2012-11-16T01:47:24Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2012-11-15T00:33:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=09feffb633d9e27fa2f3b96ff7c367baa3164ce0'/>
<id>urn:sha1:09feffb633d9e27fa2f3b96ff7c367baa3164ce0</id>
<content type='text'>
t7502 checks the behavior of commit when we can and cannot
determine a valid committer ident. Let's move that into
test-lib as a lazy prerequisite so other scripts can use it.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>t7502: test early quit from commit with bad ident</title>
<updated>2012-07-26T21:23:35Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2012-07-26T20:32:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=8c8b3bc3f4e859be0af49f91e0d1831a9ae50324'/>
<id>urn:sha1:8c8b3bc3f4e859be0af49f91e0d1831a9ae50324</id>
<content type='text'>
In commit f20f387, "git commit" notices and dies much
earlier when we have a bogus commit identity. That commit
did not add a test because we cannot do so reliably (namely,
we can only trigger the behavior on a system where the
automatically generated identity is bogus). However, now
that we have a prerequisite check for this feature, we can
add a test that will at least run on systems that produce
such a bogus identity.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>t7502: handle systems where auto-identity is broken</title>
<updated>2012-07-26T21:23:35Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2012-07-26T20:32:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1d7dc26498b5d7b7879d579f40be63210c50400c'/>
<id>urn:sha1:1d7dc26498b5d7b7879d579f40be63210c50400c</id>
<content type='text'>
Test t7502.21 checks whether we write the committer name
into COMMIT_EDITMSG when it has been automatically
determined. However, not all systems can produce valid
automatic identities.

Prior to f20f387 (commit: check committer identity more
strictly), this test worked even when we did not have a
valid automatic identity, since it did not run the strict
test until after we had generated the template. That commit
tightened the check to fail early (since we would fail
later, anyway), meaning that systems without a valid GECOS
name or hostname would fail the test.

We cannot just work around this, because it depends on
configuration outside the control of the test script.
Therefore we introduce a new test_prerequisite to run this
test only on systems where automatic ident works at all.

As a result, we can drop the confusing test_must_fail bit
from the test. The intent was that by giving "git commit"
invalid input (namely, nothing to commit), that it would
stop at a predictable point, whether we had a valid identity
or not, from which we could view the contents of
COMMIT_EDITMSG. Since that assumption no longer holds, and
we can only run the test when we have a valid identity,
there is no reason not to let commit run to completion. That
lets us be more robust to other unforeseen failures.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>t7502: drop confusing test_might_fail call</title>
<updated>2012-07-26T21:23:35Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2012-07-26T20:31:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ceacd91a063b8efea169d07913cabb0f4d33aee4'/>
<id>urn:sha1:ceacd91a063b8efea169d07913cabb0f4d33aee4</id>
<content type='text'>
In t7502.20, we run "git commit" and check that it warns us
that the author and committer identity are not the same
(this is always the case in the test environment, since we
set up the idents differently).

Instead of actually making a commit, we have a clean index,
so the "git commit" we run will fail. This is marked as
might_fail, which is not really correct; it will always fail
since there is nothing to commit.

However, the only reason not to do a complete commit would
be to see the intermediate state of the COMMIT_EDITMSG file
when the commit is not completed. We don't need to care
about this, though; even a complete commit will leave
COMMIT_EDITMSG for us to view.  By doing a real commit and
dropping the might_fail, we are more robust against other
unforeseen failures of "git commit" that might influence our
test result.

It might seem less robust to depend on the fact that "git
commit" leaves COMMIT_EDITMSG in place after a successful
commit. However, that brings this test in line with others
parts of the script, which make the same assumption.
Furthermore, if that ever does change, the right solution is
not to prevent commit from completing, but to set EDITOR to
a script that will record the contents we see. After all,
the point of these tests is to check what the user sees in
their EDITOR, so that would be the most direct test. For
now, though, we can continue to use the "shortcut" that
COMMIT_EDITMSG is left intact.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
