diff options
author | Thomas Gummerer <t.gummerer@gmail.com> | 2018-02-01 20:57:21 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-02-02 12:17:51 -0800 |
commit | 1cf823fb68cae95fa1887e9eaa314c2b6e619e09 (patch) | |
tree | 0ffcd36f573a6855301ec55376d48d43ff4fd91b /t/t9803-git-p4-shell-metachars.sh | |
parent | Git 2.13.6 (diff) | |
download | tgif-1cf823fb68cae95fa1887e9eaa314c2b6e619e09.tar.xz |
reset --hard: make use of the pretty machinery
reset --hard currently uses its own logic for printing the first line of
the commit message in its output. Instead of just using the first line,
use the pretty machinery to create the output.
In addition to the easier to follow code, this makes the output more
consistent with other commands that print the title of the commit, such
as 'git commit --oneline' or 'git checkout', which both use
'pp_commit_easy()' with the CMIT_FMT_ONELINE modifier.
It is a slight change of the output if the second line of the commit
message is not a blank line, i.e. if the commit message is
foo
bar
previously we would print "HEAD is now at 000000 foo", while after
this change we print "HEAD is now at 000000 foo bar", same as 'git log
--oneline' shows "000000 foo bar".
So this does make the output more consistent with other commands, and
'reset' is a porcelain command, so nobody should be parsing the output
in scripts.
The current behaviour dates back to 0e5a7faa3a ("Make "git reset" a
builtin.", 2007-09-11), so I assume (without digging into the old
codebase too much) that the logic was implemented because there was
no convenience function such as 'pp_commit_easy' that would do this
already.
Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t9803-git-p4-shell-metachars.sh')
0 files changed, 0 insertions, 0 deletions