Commit graph

9 commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek dc801e71a7 diff --stat: use less columns for change counts
Number of columns required for change counts is now computed based on
the maximum number of changed lines instead of being fixed. This means
that usually a few more columns will be available for the filenames
and the graph.

The graph width logic is also modified to include enough space for
"Bin XXX -> YYY bytes".

If changes to binary files are mixed with changes to text files,
change counts are padded to take at least three columns. And the other
way around, if change counts require more than three columns, then
"Bin"s are padded to align with the change count. This way, the +-
part starts in the same column as "XXX -> YYY" part for binary files.
This makes the graph easier to parse visually thanks to the empty
column. This mimics the layout of diff --stat before this change.

Tests and the tutorial are updated to reflect the new --stat output.
This means either the removal of extra padding and/or the addition of
up to three extra characters to truncated filenames. One test is added
to check the graph alignment when a binary file change and text file
change of more than 999 lines are committed together.

Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-30 14:17:26 -07:00
Nguyễn Thái Ngọc Duy 7f814632f5 Use correct grammar in diffstat summary line
"git diff --stat" and "git apply --stat" now learn to print the line
"%d files changed, %d insertions(+), %d deletions(-)" in singular form
whenever applicable. "0 insertions" and "0 deletions" are also omitted
unless they are both zero.

This matches how versions of "diffstat" that are not prehistoric produced
their output, and also makes this line translatable.

[jc: with help from Thomas Dickey in archaeology of "diffstat"]
[jc: squashed Jonathan's updates to illustrations in tutorials and a test]

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-02-03 23:19:42 -08:00
Stephen Boyd 108dab2811 format-patch: --attach/inline uses filename instead of SHA1
Currently when format-patch is used with --attach or --inline the patch
attachment has the SHA1 of the commit for its filename.  This replaces
the SHA1 with the filename used by format-patch when outputting to
files.

Fix tests relying on the SHA1 output and add a test showing how the
--suffix option affects the attachment filename output.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-22 21:45:19 -07:00
Kevin Ballard 6b2fbaaffc format-patch: Produce better output with --inline or --attach
This patch makes two small changes to improve the output of --inline
and --attach.

The first is to write a newline preceding the boundary. This is needed because
MIME defines the encapsulation boundary as including the preceding CRLF (or in
this case, just LF), so we should be writing one. Without this, the last
newline in the pre-diff content is consumed instead.

The second change is to always write the line termination character
(default: newline) even when using --inline or --attach. This is simply to
improve the aesthetics of the resulting message. When using --inline an email
client should render the resulting message identically to the non-inline
version. And when using --attach this adds a blank line preceding the
attachment in the email, which is visually attractive.

Signed-off-by: Kevin Ballard <kevin@sb.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-29 23:18:15 -07:00
Junio C Hamano 33ee4cfb69 format-patch --attach: not folding some long headers.
Panagiotis Issaris reports that some MUAs seem not to like
folded "content-type" and "content-disposition" headers, so this
makes format-patch --attach output to avoid them.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-04 17:31:29 -08:00
Johannes Schindelin c112f689c2 format-patch: add --inline option and make --attach a true attachment
The existing --attach option did not create a true "attachment"
but multipart/mixed with Content-Disposition: inline.  It should
have been with Content-Disposition: attachment.

Introduce --inline to add multipart/mixed that is inlined, and
make --attach to create an attachement.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-04 17:31:29 -08:00
Junio C Hamano c261e4385e Add --summary to git-format-patch by default
This adds --summary output in addition to the --stat to the
output from git-format-patch by default.

I think additions, removals and filemode changes are rare but
notable events and always showing it makes sense.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-17 23:48:20 -08:00
Junio C Hamano 855409296d Adjust t4013 tests to corrected format-patch.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-13 21:40:44 -07:00
Junio C Hamano d410e43b35 t4013: add format-patch tests.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-29 00:28:30 -07:00