aboutsummaryrefslogtreecommitdiff
path: root/t/t4013
Commit message (Collapse)AuthorAge
* diff --stat: use less columns for change countsZbigniew Jędrzejewski-Szmek2012-04-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Use correct grammar in diffstat summary lineNguyễn Thái Ngọc Duy2012-02-03
| | | | | | | | | | | | | | | | | "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>
* Teach --dirstat not to completely ignore rearranged lines within a fileJohan Herland2011-04-11
| | | | | | | | | | | | | | | | | | | Currently, the --dirstat analysis ignores when lines within a file are rearranged, because the "damage" calculated by show_dirstat() is 0. However, if the object name has changed, we already know that there is some damage, and it is unintuitive to claim there is _no_ damage. Teach show_dirstat() to assign a minimum amount of damage (== 1) to entries for which the analysis otherwise yields zero damage, to still represent that these files are changed, instead of saying that there is no change. Also, skip --dirstat analysis when the object names are the same (e.g. for a pure file rename). Signed-off-by: Johan Herland <johan@herland.net> Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* --dirstat-by-file: Make it faster and more correctJohan Herland2011-04-11
| | | | | | | | | | | | | | | | | | | | | | | Currently, when using --dirstat-by-file, it first does the full --dirstat analysis (using diffcore_count_changes()), and then resets 'damage' to 1, if any damage was found by diffcore_count_changes(). But --dirstat-by-file is not interested in the file damage per se. It only cares if the file changed at all. In that sense it only cares if the blob object for a file has changed. We therefore only need to compare the object names of each file pair in the diff queue and we can skip the entire --dirstat analysis and simply set 'damage' to 1 for each entry where the object name has changed. This makes --dirstat-by-file faster, and also bypasses --dirstat's practice of ignoring rearranged lines within a file. The patch also contains an added testcase verifying that --dirstat-by-file now detects changes that only rearrange lines within a file. Signed-off-by: Johan Herland <johan@herland.net> Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* --dirstat: Describe non-obvious differences relative to --stat or regular diffJohan Herland2011-04-11
| | | | | | | | | Also add a testcase documenting the current behavior. Improved-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Johan Herland <johan@herland.net> Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* log: fix --max-count when used together with -S or -GMatthieu Moy2011-03-09
| | | | | | | | | | | | | | The --max-count limit is implemented by counting revisions in get_revision(), but the -S and -G take effect later when running diff. Hence "--max-count=10 -Sfoo" meant "examine the 10 first revisions, and out of them, show only those changing the occurences of foo", not "show 10 revisions changing the occurences of foo". In case the commit isn't actually shown, cancel the decrement of max_count. Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* diff: support --cached on unborn branchesNguyễn Thái Ngọc Duy2011-02-07
| | | | | | | | | | | | | | | | "git diff --cached" (without revision) used to mean "git diff --cached HEAD" (i.e. the user was too lazy to type HEAD). This "correctly" failed when there was no commit yet. But was that correctness useful? This patch changes the definition of what particular command means. It is a request to show what _would_ be committed without further "git add". The internal implementation is the same "git diff --cached HEAD" when HEAD exists, but when there is no commit yet, it compares the index with an empty tree object to achieve the desired result. Signed-off-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* diff/log -G<pattern>: testsJunio C Hamano2010-08-31
| | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
* diff: parse separate options like -S fooMatthieu Moy2010-08-06
| | | | | | | | | | | | | | | | | | | Change the option parsing logic in revision.c to accept separate forms like `-S foo' in addition to `-Sfoo'. The rest of git already accepted this form, but revision.c still used its own option parsing. Short options affected are -S<string>, -l<num> and -O<orderfile>, for which an empty string wouldn't make sense, hence -<option> <arg> isn't ambiguous. This patch does not handle --stat-name-width and --stat-width, which are special-cases where diff_long_opt do not apply. They are handled in a separate patch to ease review. Original patch by Matthieu Moy, plus refactoring by Jonathan Nieder. Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* format-patch: Add a signature option (--signature)Stephen Boyd2010-06-16
| | | | | | | | | | | | | | | | | | | | | | By default, git uses the version string as the signature for all patches output by format-patch. Many employers (mine included) require the use of a signature on all outgoing mails. In a format-patch | send-email workflow there isn't an easy way to modify the signature without breaking the pipe and manually replacing the version string with the signature required. Instead of doing all that work, add an option (--signature) and a config variable (format.signature) to replace the default git version signature when formatting patches. This does modify the original behavior of format-patch a bit. First off the version string is now placed in the cover letter by default. Secondly, once the configuration variable format.signature is added to the .config file there is no way to revert back to the default git version signature. Instead, specifying the --no-signature option will remove the signature from the patches entirely. Signed-off-by: Stephen Boyd <bebarino@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* show --first-parent/-m: do not default to --ccJunio C Hamano2010-03-09
| | | | | | | | | | | | Given that "git show" always shows some diff and does not walk the history by default, it is natural to expect "git show --first-parent" to show the difference between the given commit and its first parent. It also would be natural, given that "--cc" is the default, "git show -m" to show pairwise difference from each of the parents. We however always defaulted to --cc and there was no way to turn it off. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* show -c: show patch textJunio C Hamano2010-03-09
| | | | | | | | | | | | | | | | | | Traditionally, "show" defaulted to "show --cc" (dense combined patch), but asking for combined patch with "show -c" didn't turn the patch output format on; the placement of this logic in setup_revisions() dates back to cd2bdc5 (Common option parsing for "git log --diff" and friends, 2006-04-14). This unfortunately cannot be done as a trivial change of "if dense combined is asked, default to patch format" done in setup_revisions() to "if any combined is asked, default to patch format", as "diff-tree -c" needs to default to raw, while "diff-tree --cc" needs to default to patch, and they share the codepath. These command specific defaults are now handled in the new "tweak" callback that can be customized by individual command implementations. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* t4013: add tests for log -p -m --first-parentJunio C Hamano2010-03-09
| | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Let --decorate show HEAD positionThomas Rast2009-10-12
| | | | | | | | | | 'git log --graph --oneline --decorate --all' is a useful way to get a general overview of the repository state, similar to 'gitk --all'. Let it indicate the position of HEAD by loading that ref too, so that the --decorate code can see it. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git-log: allow --decorate[=short|full]Lars Hjemli2009-08-18
| | | | | | | | | | | | | | | Commit de435ac0 changed the behavior of --decorate from printing the full ref (e.g., "refs/heads/master") to a shorter, more human-readable version (e.g., just "master"). While this is nice for human readers, external tools using the output from "git log" may prefer the full version. This patch introduces an extension to --decorate to allow the caller to specify either the short or the full versions. Signed-off-by: Lars Hjemli <hjemli@gmail.com> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Prettify log decorations even moreFelipe Contreras2009-05-13
| | | | | | | | "tag: v1.6.2.5" looks much better than "tag: refs/tags/v1.6.2.5". Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* format-patch: --numbered-files and --stdout aren't mutually exclusiveStephen Boyd2009-03-22
| | | | | | | | | | | | | | For example: git format-patch --numbered-files --stdout --attach HEAD~~ will create two messages with files 1 and 2 attached respectively. There is no effect when using --numbered-files and --stdout together without an --attach or --inline, the --numbered-files option will be ignored. Add a test to show this. Signed-off-by: Stephen Boyd <bebarino@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* format-patch: --attach/inline uses filename instead of SHA1Stephen Boyd2009-03-22
| | | | | | | | | | | | | 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>
* Merge branch 'tr/gcov'Junio C Hamano2009-03-11
|\ | | | | | | | | | | | | | | | | | | | | | | * tr/gcov: Test git-patch-id Test rev-list --parents/--children Test log --decorate Test fsck a bit harder Test log --graph Test diff --dirstat functionality Test that diff can read from stdin Support coverage testing with GCC/gcov
| * Test rev-list --parents/--childrenThomas Rast2009-02-20
| | | | | | | | | | Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * Test log --decorateThomas Rast2009-02-20
| | | | | | | | | | Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * Test diff --dirstat functionalityThomas Rast2009-02-20
| | | | | | | | | | | | | | This is only a very rudimentary test, but it was untested before. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'maint'Junio C Hamano2009-02-18
|\ \ | |/ |/| | | | | | | | | * maint: tests: fix "export var=val" Skip timestamp differences for diff --no-index Documentation/git-push: --all, --mirror, --tags can not be combined
| * Skip timestamp differences for diff --no-indexMichael Spang2009-02-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We display empty diffs for files whose timestamps have changed. Usually, refreshing the index makes those empty diffs go away. However, when not using the index they are not very useful and there is no option to suppress them. This forces on the skip_stat_unmatch option for diff --no-index, suppressing any empty diffs. This option is also used for diffs against the index when "diff.autorefreshindex" is set, but that option does not apply to diff --no-index. Signed-off-by: Michael Spang <mspang@uwaterloo.ca> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | log: do not print ellipses with --abbrev-commitThomas Rast2009-02-13
|/ | | | | | | | | | | | | | | 'git log --abbrev-commit' added an ellipsis to all commit names that were abbreviated. This was particularly annoying if you wanted to cut&paste the sha1 from the terminal, since selecting by word would pick up '...' too. So use find_unique_abbrev() instead of diff_unique_abbrev() in all log-related commit sha1 printing routines, and also change the formatting of the 'Merge: parent1 parent2' line output via pretty_print_commit(). Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* diff: accept -- when using --no-indexThomas Rast2009-01-06
| | | | | | | | | | | | | | Accept -- as an "end of options" marker even when using --no-index. Previously, the -- triggered a "normal" index/tree diff and subsequently failed because of the unrecognized (in that mode) --no-index. Note that the second loop can treat '--' as a normal option, because the preceding checks ensure it is the third-to-last argument. While at it, fix the parsing of "-q" option in --no-index mode as well. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* format-patch: autonumber by defaultBrian Gernhardt2008-10-18
| | | | | | | | | | | | | | | | | | | format-patch is most commonly used for multiple patches at once when sending a patchset, in which case we want to number the patches; on the other hand, single patches are not usually expected to be numbered. In other words, the typical behavior expected from format-patch is the one obtained by enabling autonumber, so we set it to be the default. Users that want to disable numbering for a particular patchset can do so with the existing -N command-line switch. Users that want to change the default behavior can use the format.numbering config key. Signed-off-by: Brian Gernhardt <benji@silverinsanity.com> Test-updates-by: Jeff King <peff@peff.net> Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* "git diff <tree>{3,}": do not reverse order of argumentsMatt McCutchen2008-10-12
| | | | | | | | | | | | According to the message of commit 0fe7c1de16f71312e6adac4b85bddf0d62a47168, "git diff" with three or more trees expects the merged tree first followed by the parents, in order. However, this command reversed the order of its arguments, resulting in confusing diffs. A comment /* Again, the revs are all reverse */ suggested there was a reason for this, but I can't figure out the reason, so I removed the reversal of the arguments. Test case included. Signed-off-by: Matt McCutchen <matt@mattmccutchen.net> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* format-patch: Produce better output with --inline or --attachKevin Ballard2008-07-29
| | | | | | | | | | | | | | | | | | | | 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>
* "git diff": do not ignore index without --no-indexJunio C Hamano2008-05-24
| | | | | | | | | | | | Even if "foo" and/or "bar" does not exist in index, "git diff foo bar" should not change behaviour drastically from "git diff foo bar baz" or "git diff foo". A feature that "sometimes works and is handy" is an unreliable cute hack. "git diff foo bar" outside a git repository continues to work as a more colourful alternative to "diff -u" as before. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* format-patch: wrap cover-letter's shortlog sensiblyJohannes Schindelin2008-03-02
| | | | | | | | | | | Earlier, overly-long onelines would not be wrapped at all, and indented with 6 spaces. Instead, we now wrap around at 72 characters, with a first-line indent of 2 spaces, and the rest with 4 spaces. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Add a --cover-letter option to format-patchDaniel Barkalow2008-02-19
| | | | | | | | | | If --cover-letter is provided, generate a cover letter message before the patches, numbered 0. Original patch thanks to Johannes Schindelin Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Clean up "git log" format with DIFF_FORMAT_NO_OUTPUTLinus Torvalds2007-10-15
| | | | | | | | | | | | | | | | | | This fixes an unnecessary empty line that we add to the log message when we generate diffs, but don't actually end up printing any due to having DIFF_FORMAT_NO_OUTPUT set. This can happen with pickaxe or with rename following. The reason is that we normally add an empty line between the commit and the diff, but we do that even for the case where we've then suppressed the actual printing of the diff. This also updates a couple of tests that assumed the extraneous empty line would exist at the end of output. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Lars Hjemli <hjemli@gmail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Merge branch 'maint'Junio C Hamano2007-07-03
|\ | | | | | | | | | | | | | | * maint: Document -<n> for git-format-patch glossary: add 'reflog' diff --no-index: fix --name-status with added files Don't smash stack when $GIT_ALTERNATE_OBJECT_DIRECTORIES is too long
| * diff --no-index: fix --name-status with added filesJohannes Schindelin2007-07-03
| | | | | | | | | | | | | | | | | | Without this patch, an added file would be reported as /dev/null. Noticed by David Kastrup. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | format-patch: Add format.subjectprefix config optionAdam Roben2007-07-02
|/ | | | | | | | This change lets you use the format.subjectprefix config option to override the default subject prefix. Signed-off-by: Adam Roben <aroben@apple.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Add testcase for format-patch --subject-prefix (take 3)Robin H. Johnson2007-04-11
| | | | | | | Add testcase for format-patch --subject-prefix support. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* format-patch --attach: not folding some long headers.Junio C Hamano2007-03-04
| | | | | | | | 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>
* format-patch: add --inline option and make --attach a true attachmentJohannes Schindelin2007-03-04
| | | | | | | | | | | | 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>
* Add --summary to git-format-patch by defaultJunio C Hamano2007-01-17
| | | | | | | | | | 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>
* Turn on recursive with --summaryJohannes Schindelin2006-10-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes "git log/diff --summary" imply recursive behaviour, whose effect is summarized in one test output: --- a/t/t4013/diff.diff-tree_--pretty_--root_--summary_initial +++ b/t/t4013/diff.diff-tree_--pretty_--root_--summary_initial @@ -5,7 +5,7 @@ Date: Mon Jun 26 00:00:00 2006 +0000 Initial - create mode 040000 dir + create mode 100644 dir/sub create mode 100644 file0 create mode 100644 file2 $ When a file is created in a subdirectory, we used to say just the directory name only when that directory also was created, which did not make sense from two reasons. It is not any more significant to create a new file in a new directory than to create a new file in an existing directory, and even if it were, reportinging the new directory name without saying the actual filename is not useful. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Adjust t4013 tests to corrected format-patch.Junio C Hamano2006-07-13
| | | | Signed-off-by: Junio C Hamano <junkio@cox.net>
* t4013 diff format tests updateJunio C Hamano2006-07-13
| | | | | | | | | | This changes one test commit in the sequence to have more than one lines of commit log. A few output formats (--pretty=email aka format-patch and --pretty=oneline) need to behave differently on single and multi-line log, and this change will help catching breakages. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Merge branch 'jc/diff-test'Junio C Hamano2006-07-05
|\ | | | | | | | | * jc/diff-test: t4013: add "diff" UI program tests.
| * t4013: add "diff" UI program tests.Junio C Hamano2006-07-01
| | | | | | | | Signed-off-by: Junio C Hamano <junkio@cox.net>
* | t4013: note improvements brought by the new output code.Junio C Hamano2006-06-29
| | | | | | | | Signed-off-by: Junio C Hamano <junkio@cox.net>
* | Merge branch 'jc/diff-test' into jc/diff-test-updatesJunio C Hamano2006-06-29
|\ \ | |/ | | | | | | * jc/diff-test: t4013: add format-patch tests.
| * t4013: add format-patch tests.Junio C Hamano2006-06-29
| | | | | | | | Signed-off-by: Junio C Hamano <junkio@cox.net>
* | t4013 test updates for new output code.Junio C Hamano2006-06-27
|/ | | | | | | | These are updates to the test vector that shows the "incompatibility" of the new output code. The changes are actually the good ones, so instead of keeping the older output we adjust the test to the new code. Signed-off-by: Junio C Hamano <junkio@cox.net>
* t4013: add more tests around -c and --ccJunio C Hamano2006-06-26
| | | | Signed-off-by: Junio C Hamano <junkio@cox.net>