1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-28 05:46:38 +02:00
Commit Graph

256 Commits

Author SHA1 Message Date
Samuel Bronson 6d8940b562 diff: add diff.orderfile configuration variable
diff.orderfile acts as a default for the -O command line option.

[sb: split up aw's original patch; rework tests and docs, treat option
as pathname]

Signed-off-by: Anders Waldenborg <anders@0x63.nu>
Signed-off-by: Samuel Bronson <naesten@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-12-18 16:39:00 -08:00
Junio C Hamano e2ecd252b5 Merge branch 'mm/diff-no-patch-synonym-to-s'
"git show -s" was less discoverable than it should be.

* mm/diff-no-patch-synonym-to-s:
  Documentation/git-log.txt: capitalize section names
  Documentation: move description of -s, --no-patch to diff-options.txt
  Documentation/git-show.txt: include common diff options, like git-log.txt
  diff: allow --patch & cie to override -s/--no-patch
  diff: allow --no-patch as synonym for -s
  t4000-diff-format.sh: modernize style
2013-07-22 11:23:27 -07:00
Matthieu Moy 7b02c83463 Documentation: move description of -s, --no-patch to diff-options.txt
Technically, "-s, --no-patch" is implemented in diff.c ("git diff
--no-patch" is essentially useless, but valid). From the user point of
view, this allows the documentation to show up in "git show --help",
which is one of the most useful use of the option.

While we're there, add a sentence explaining why the option can be
useful.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-17 17:50:56 -07:00
Junio C Hamano 6492deafdd Merge branch 'ft/diff-rename-default-score-is-half'
* ft/diff-rename-default-score-is-half:
  diff-options: document default similarity index
2013-07-12 12:04:13 -07:00
Fraser Tweedale 8240943bd7 diff-options: document default similarity index
The default similarity index of 50% is documented in gitdiffcore(7)
but it is worth also mentioning it in the description of the
-M/--find-renames option.

Signed-off-by: Fraser Tweedale <frase@frase.id.au>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-05 23:14:37 -07:00
Junio C Hamano 08585fd48d Merge branch 'ap/diff-ignore-blank-lines'
"git diff" learned a mode that ignores hunks whose change consists
only of additions and removals of blank lines, which is the same as
"diff -B" (ignore blank lines) of GNU diff.

* ap/diff-ignore-blank-lines:
  diff: add --ignore-blank-lines option
2013-06-30 15:39:53 -07:00
Antoine Pelisse 36617af7ed diff: add --ignore-blank-lines option
The goal of the patch is to introduce the GNU diff
-B/--ignore-blank-lines as closely as possible. The short option is not
available because it's already used for "break-rewrites".

When this option is used, git-diff will not create hunks that simply
add or remove empty lines, but will still show empty lines
addition/suppression if they are close enough to "valuable" changes.

There are two differences between this option and GNU diff -B option:
- GNU diff doesn't have "--inter-hunk-context", so this must be handled
- The following sequence looks like a bug (context is displayed twice):

    $ seq 5 >file1
    $ cat <<EOF >file2
    change
    1
    2

    3
    4
    5
    change
    EOF
    $ diff -u -B file1 file2
    --- file1	2013-06-08 22:13:04.471517834 +0200
    +++ file2	2013-06-08 22:13:23.275517855 +0200
    @@ -1,5 +1,7 @@
    +change
     1
     2
    +
     3
     4
     5
    @@ -3,3 +5,4 @@
     3
     4
     5
    +change

So here is a more thorough description of the option:
- real changes are interesting
- blank lines that are close enough (less than context size) to
interesting changes are considered interesting (recursive definition)
- "context" lines are used around each hunk of interesting changes
- If two hunks are separated by less than "inter-hunk-context", they
will be merged into one.

The implementation does the "interesting changes selection" in a single
pass.

Signed-off-by: Antoine Pelisse <apelisse@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-19 15:17:45 -07:00
Junio C Hamano 71e120202f Merge branch 'rr/diffcore-pickaxe-doc'
Update the low-level diffcore documentation on -S/-G and --pickaxe-all.

* rr/diffcore-pickaxe-doc:
  diffcore-pickaxe doc: document -S and -G properly
  diffcore-pickaxe: make error messages more consistent
2013-06-11 13:31:04 -07:00
Ramkumar Ramachandra 5bc3f0b567 diffcore-pickaxe doc: document -S and -G properly
The documentation of -S and -G is very sketchy.  Completely rewrite the
sections in Documentation/diff-options.txt and
Documentation/gitdiffcore.txt.

References:
52e9578 ([PATCH] Introducing software archaeologist's tool "pickaxe".)
f506b8e (git log/diff: add -G<regexp> that greps in the patch text)

Inputs-from: Phil Hord <phil.hord@gmail.com>
Co-authored-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-03 10:53:11 -07:00
Phil Hord b1d04bfcf8 trivial: Add missing period in documentation
Signed-off-by: Phil Hord <hordp@cisco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-05-28 15:15:29 -07:00
Junio C Hamano f7b1ad870c Merge branch 'maint-1.8.1' into maint
* maint-1.8.1:
  bundle: Add colons to list headings in "verify"
  bundle: Fix "verify" output if history is complete
  Documentation: filter-branch env-filter example
  git-filter-branch.txt: clarify ident variables usage
  git-compat-util.h: Provide missing netdb.h definitions
  describe: Document --match pattern format
  Documentation/githooks: Explain pre-rebase parameters
  update-index: list supported idx versions and their features
  diff-options: unconfuse description of --color
  read-cache.c: use INDEX_FORMAT_{LB,UB} in verify_hdr()
  index-format.txt: mention of v4 is missing in some places
2013-03-25 13:46:42 -07:00
Junio C Hamano 82b955c513 Merge branch 'jc/color-diff-doc' into maint-1.8.1
The "--color=<when>" argument to the commands in the diff family
was described poorly.

* jc/color-diff-doc:
  diff-options: unconfuse description of --color
2013-03-25 13:44:53 -07:00
Junio C Hamano 3e1b08bbf5 Merge branch 'jc/color-diff-doc'
The --color[=<when>] option to the diff family was documented in a
confusing way.

* jc/color-diff-doc:
  diff-options: unconfuse description of --color
2013-03-19 12:11:32 -07:00
Junio C Hamano 3d0e75f2f7 diff-options: unconfuse description of --color
It said "by default it is off" while it also said "the default is
always", which confused everybody who read it only once.  It wanted
to say (1) if you do not say --color, it is not enabled, and (2) if
you say --color but do not say when to enable it, it will always be
enabled".

Rephrase to clarify by using "default" only once.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-02-22 22:24:10 -08:00
Junio C Hamano abea4dc76a Merge branch 'mp/diff-algo-config'
Add diff.algorithm configuration so that the user does not type
"diff --histogram".

* mp/diff-algo-config:
  diff: Introduce --diff-algorithm command line option
  config: Introduce diff.algorithm variable
  git-completion.bash: Autocomplete --minimal and --histogram for git-diff
2013-02-17 15:25:52 -08:00
Thomas Ackermann 2de9b71138 Documentation: the name of the system is 'Git', not 'git'
Signed-off-by: Thomas Ackermann <th.acker@arcor.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-02-01 13:53:33 -08:00
Michal Privoznik 07924d4d50 diff: Introduce --diff-algorithm command line option
Since command line options have higher priority than config file
variables and taking previous commit into account, we need a way
how to specify myers algorithm on command line. However,
inventing `--myers` is not the right answer. We need far more
general option, and that is `--diff-algorithm`.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-16 09:41:18 -08:00
Junio C Hamano b7cd0c9b69 Sync with 'maint' 2012-12-18 10:51:22 -08:00
Sitaram Chamarty 31d66aa408 clarify -M without % symbol in diff-options
Signed-off-by: Sitaram Chamarty <sitaramc@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-12-18 08:46:15 -08:00
Ramkumar Ramachandra c47ef57caa diff: introduce diff.submodule configuration variable
Introduce a diff.submodule configuration variable corresponding to the
'--submodule' command-line option of 'git diff'.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-11-18 19:18:13 -08:00
Leila Muhtasib 8d8136c37a Documentation: Fix misspellings
Signed-off-by: Leila Muhtasib <muhtasib@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-22 14:25:04 -07:00
Jeff King 6cf378f0cb docs: stop using asciidoc no-inline-literal
In asciidoc 7, backticks like `foo` produced a typographic
effect, but did not otherwise affect the syntax. In asciidoc
8, backticks introduce an "inline literal" inside which markup
is not interpreted. To keep compatibility with existing
documents, asciidoc 8 has a "no-inline-literal" attribute to
keep the old behavior. We enabled this so that the
documentation could be built on either version.

It has been several years now, and asciidoc 7 is no longer
in wide use. We can now decide whether or not we want
inline literals on their own merits, which are:

  1. The source is much easier to read when the literal
     contains punctuation. You can use `master~1` instead
     of `master{tilde}1`.

  2. They are less error-prone. Because of point (1), we
     tend to make mistakes and forget the extra layer of
     quoting.

This patch removes the no-inline-literal attribute from the
Makefile and converts every use of backticks in the
documentation to an inline literal (they must be cleaned up,
or the example above would literally show "{tilde}" in the
output).

Problematic sites were found by grepping for '`.*[{\\]' and
examined and fixed manually. The results were then verified
by comparing the output of "html2text" on the set of
generated html pages. Doing so revealed that in addition to
making the source more readable, this patch fixes several
formatting bugs:

  - HTML rendering used the ellipsis character instead of
    literal "..." in code examples (like "git log A...B")

  - some code examples used the right-arrow character
    instead of '->' because they failed to quote

  - api-config.txt did not quote tilde, and the resulting
    HTML contained a bogus snippet like:

      <tt><sub></tt> foo <tt></sub>bar</tt>

    which caused some parsers to choke and omit whole
    sections of the page.

  - git-commit.txt confused ``foo`` (backticks inside a
    literal) with ``foo'' (matched double-quotes)

  - mentions of `A U Thor <author@example.com>` used to
    erroneously auto-generate a mailto footnote for
    author@example.com

  - the description of --word-diff=plain incorrectly showed
    the output as "[-removed-] and {added}", not "{+added+}".

  - using "prime" notation like:

      commit `C` and its replacement `C'`

    confused asciidoc into thinking that everything between
    the first backtick and the final apostrophe were meant
    to be inside matched quotes

  - asciidoc got confused by the escaping of some of our
    asterisks. In particular,

      `credential.\*` and `credential.<url>.\*`

    properly escaped the asterisk in the first case, but
    literally passed through the backslash in the second
    case.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-26 13:19:06 -07:00
Junio C Hamano c58499c317 Merge branch 'th/doc-diff-submodule-option'
* th/doc-diff-submodule-option:
  Documentation/diff-options: reword description of --submodule option
2012-03-15 21:54:31 -07:00
Tim Henigan 3fe271e91b Documentation/diff-options: reword description of --submodule option
The previous description was confusing.  This rewrite makes it easier
to understand.

Signed-off-by: Tim Henigan <tim.henigan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-03-14 12:15:46 -07:00
Junio C Hamano af050219e4 Merge branch 'zj/diff-stat-dyncol'
By Zbigniew Jędrzejewski-Szmek (8) and Junio C Hamano (1)
* zj/diff-stat-dyncol:
  : This breaks tests. Perhaps it is not worth using the decimal-width stuff
  : for this series, at least initially.
  diff --stat: add config option to limit graph width
  diff --stat: enable limiting of the graph part
  diff --stat: add a test for output with COLUMNS=40
  diff --stat: use a maximum of 5/8 for the filename part
  merge --stat: use the full terminal width
  log --stat: use the full terminal width
  show --stat: use the full terminal width
  diff --stat: use the full terminal width
  diff --stat: tests for long filenames and big change counts
2012-03-06 14:53:06 -08:00
Junio C Hamano e521850bfd Merge branch 'maint-1.7.7' into maint-1.7.8
By Thomas Rast
* maint-1.7.7:
  Document the --histogram diff option
2012-03-06 12:04:48 -08:00
Thomas Rast d909e0761c Document the --histogram diff option
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-03-06 11:53:29 -08:00
Zbigniew Jędrzejewski-Szmek df44483a5d diff --stat: add config option to limit graph width
Config option diff.statGraphWidth=<width> is equivalent to
--stat-graph-width=<width>, except that the config option is ignored
by format-patch.

For the graph-width limiting to be usable, it should happen
'automatically' once configured, hence the config option.
Nevertheless, graph width limiting only makes sense when used on a
wide terminal, so it should not influence the output of format-patch,
which adheres to the 80-column standard.

Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-03-01 09:15:58 -08:00
Zbigniew Jędrzejewski-Szmek 969fe57b84 diff --stat: enable limiting of the graph part
A new option --stat-graph-width=<width> can be used to limit the width
of the graph part even is more space is available. Up to <width>
columns will be used for the graph.

If commits changing a lot of lines are displayed in a wide terminal
window (200 or more columns), and the +- graph uses the full width,
the output can be hard to comfortably scan with a horizontal movement
of human eyes. Messages wrapped to about 80 columns would be
interspersed with very long +- lines. It makes sense to limit the
width of the graph part to a fixed value (e.g. 70 columns), even if
more columns are available.

Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-03-01 09:15:47 -08:00
Zbigniew Jędrzejewski-Szmek 1b058bc30d diff --stat: use a maximum of 5/8 for the filename part
The way that available columns are divided between the filename part
and the graph part is modified to use as many columns as necessary for
the filenames and the rest for the graph.

If there isn't enough columns to print both the filename and the
graph, at least 5/8 of available space is devoted to filenames. On a
standard 80 column terminal, or if not connected to a terminal and
using the default of 80 columns, this gives the same partition as
before.

The effect of this change is visible in the patch to the test vector
in t4052; with a small change with long filename, it stops truncating
the name part too short, and also allocates a bit more columns to the
graph for larger changes.

Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-03-01 09:14:58 -08:00
Junio C Hamano 14ba45a2e6 Sync with 1.7.7.3
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-08 16:38:14 -08:00
Jeff King 939ca96b0e docs: don't mention --quiet or --exit-code in git-log(1)
These are diff-options, but they don't actually make sense
in the context of log.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-08 13:37:02 -08:00
Junio C Hamano 9b55aa03da Merge branch 'rs/diff-whole-function'
* rs/diff-whole-function:
  diff: add option to show whole functions as context
  xdiff: factor out get_func_line()
2011-10-19 10:49:13 -07:00
René Scharfe 14937c2c06 diff: add option to show whole functions as context
Add the option -W/--function-context to git diff.  It is similar to
the same option of git grep and expands the context of change hunks
so that the whole surrounding function is shown.  This "natural"
context can allow changes to be understood better.

Note: GNU patch doesn't like diffs generated with the new option;
it seems to expect context lines to be the same before and after
changes.  git apply doesn't complain.

This implementation has the same shortcoming as the one in grep,
namely that there is no way to explicitly find the end of a
function.  That means that a few lines of extra context are shown,
right up to the next recognized function begins.  It's already
useful in its current form, though.

The function get_func_line() in xdiff/xemit.c is extended to work
forward as well as backward to find post-context as well as
pre-context.  It returns the position of the first found matching
line.  The func_line parameter is made optional, as we don't need
it for -W.

The enhanced function is then used in xdl_emit_diff() to extend
the context as needed.  If the added context overlaps with the
next change, it is merged into the current hunk.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-10 12:05:07 -07:00
Junio C Hamano 81b568c839 diff: resurrect XDF_NEED_MINIMAL with --minimal
Earlier, 582aa00 (git diff too slow for a file, 2010-05-02)
unconditionally dropped XDF_NEED_MINIMAL option from the internal xdiff
invocation to help performance on pathological cases, while hinting that a
follow-up patch could reintroduce it with "--minimal" option from the
command line.

Make it so.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-03 11:58:18 -07:00
Junio C Hamano 395f65d438 Merge branch 'maint'
* maint:
  docs: document --textconv diff option
2011-07-06 16:48:59 -07:00
Jeff King d28790dc31 docs: document --textconv diff option
This has been there since textconv existed, but was never
documented. There is some overlap with what's in
gitattributes(5), but it's important to warn in both places
that textconv diffs probably can't be applied.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-07-06 11:10:11 -07:00
Junio C Hamano a852aac48d Merge branch 'mg/diff-stat-count'
* mg/diff-stat-count:
  diff --stat-count: finishing touches
  diff-options.txt: describe --stat-{width,name-width,count}
  diff: introduce --stat-lines to limit the stat lines
  diff.c: omit hidden entries from namelen calculation with --stat
2011-06-29 17:03:10 -07:00
Junio C Hamano def98035d0 Merge branch 'maint'
* maint:
  Documentation: git diff --check respects core.whitespace
2011-06-22 14:01:18 -07:00
Christof Krüger 4f8303905e Documentation: git diff --check respects core.whitespace
Fix documentation on "git diff --check" by adopting the description from
"git apply --whitespace".

Signed-off-by: Christof Krüger <git@christof-krueger.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-06-22 11:40:32 -07:00
Michael J Gruber 86e1ce96d7 diff-options.txt: describe --stat-{width,name-width,count}
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-27 10:44:37 -07:00
Michael J Gruber 808e1db231 diff: introduce --stat-lines to limit the stat lines
Often one is interested in the full --stat output only for commits which
change a few files, but not others, because larger restructuring gives a
--stat which fills a few screens.

Introduce a new option --stat-count=<count> which limits the --stat output
to the first <count> lines, followed by a "..." line. It can
also be given as the third parameter in
--stat=<width>,<name-width>,<count>.

Also, the unstuck form is supported analogous to the other two stat
parameters.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-27 10:44:34 -07:00
Junio C Hamano 5f8937db39 Merge branch 'mg/diff-uiconfig-doc' into maint
* mg/diff-uiconfig-doc:
  config.txt,diff-options.txt: porcelain vs. plumbing for color.diff
2011-05-26 09:41:11 -07:00
Junio C Hamano df54e2bfd6 Merge branch 'jh/dirstat-lines'
* jh/dirstat-lines:
  Mark dirstat error messages for translation
  Improve error handling when parsing dirstat parameters
  New --dirstat=lines mode, doing dirstat analysis based on diffstat
  Allow specifying --dirstat cut-off percentage as a floating point number
  Add config variable for specifying default --dirstat behavior
  Refactor --dirstat parsing; deprecate --cumulative and --dirstat-by-file
  Make --dirstat=0 output directories that contribute < 0.1% of changes
  Add several testcases for --dirstat and friends
2011-05-13 11:01:32 -07:00
Junio C Hamano 12b99a3598 Merge branch 'mg/diff-uiconfig-doc'
* mg/diff-uiconfig-doc:
  config.txt,diff-options.txt: porcelain vs. plumbing for color.diff
2011-05-06 10:49:53 -07:00
Junio C Hamano ef6b43a44b Merge branch 'maint'
* maint:
  Remove duplicated "is a"
2011-05-06 10:44:23 -07:00
João Britto 4c007ae835 Remove duplicated "is a"
Signed-off-by: João Britto <jabcalves@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-05 22:14:15 -07:00
Johan Herland 1c57a627bf New --dirstat=lines mode, doing dirstat analysis based on diffstat
This patch adds an alternative implementation of show_dirstat(), called
show_dirstat_by_line(), which uses the more expensive diffstat analysis
(as opposed to show_dirstat()'s own (relatively inexpensive) analysis)
to derive the numbers from which the --dirstat output is computed.

The alternative implementation is controlled by the new "lines" parameter
to the --dirstat option (or the diff.dirstat config variable).

For binary files, the diffstat analysis counts bytes instead of lines,
so to prevent binary files from dominating the dirstat results, the
byte counts for binary files are divided by 64 before being compared to
their textual/line-based counterparts. This is a stupid and ugly - but
very cheap - heuristic.

In linux-2.6.git, running the three different --dirstat modes:

  time git diff v2.6.20..v2.6.30 --dirstat=changes > /dev/null
vs.
  time git diff v2.6.20..v2.6.30 --dirstat=lines > /dev/null
vs.
  time git diff v2.6.20..v2.6.30 --dirstat=files > /dev/null

yields the following average runtimes on my machine:

 - "changes" (default): ~6.0 s
 - "lines":             ~9.6 s
 - "files":             ~0.1 s

So, as expected, there's a considerable performance hit (~60%) by going
through the full diffstat analysis as compared to the default "changes"
analysis (obviously, "files" is much faster than both). As such, the
"lines" mode is probably only useful if you really need the --dirstat
numbers to be consistent with the numbers returned from the other
--*stat options.

The patch also includes documentation and tests for the new dirstat mode.

Improved-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-29 11:22:55 -07:00
Johan Herland 2d17495196 Add config variable for specifying default --dirstat behavior
The new diff.dirstat config variable takes the same arguments as
'--dirstat=<args>', and specifies the default arguments for --dirstat.
The config is obviously overridden by --dirstat arguments passed on the
command line.

When not specified, the --dirstat defaults are 'changes,noncumulative,3'.

The patch also adds several tests verifying the interaction between the
diff.dirstat config variable, and the --dirstat command line option.

Improved-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-29 11:20:03 -07:00
Johan Herland 333f3fb0c5 Refactor --dirstat parsing; deprecate --cumulative and --dirstat-by-file
Instead of having multiple interconnected dirstat-related options, teach
the --dirstat option itself to accept all behavior modifiers as parameters.

 - Preserve the current --dirstat=<limit> (where <limit> is an integer
   specifying a cut-off percentage)
 - Add --dirstat=cumulative, replacing --cumulative
 - Add --dirstat=files, replacing --dirstat-by-file
 - Also add --dirstat=changes and --dirstat=noncumulative for specifying the
   current default behavior. These allow the user to reset other --dirstat
   parameters (e.g. 'cumulative' and 'files') occuring earlier on the
   command line.

The deprecated options (--cumulative and --dirstat-by-file) are still
functional, although they have been removed from the documentation.

Allow multiple parameters to be separated by commas, e.g.:
  --dirstat=files,10,cumulative

Update the documentation accordingly, and add testcases verifying the
behavior of the new syntax.

Improved-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-29 11:17:36 -07:00
Junio C Hamano 50d3062ab2 Merge branch 'jc/diff-irreversible-delete'
* jc/diff-irreversible-delete:
  git diff -D: omit the preimage of deletes
2011-04-28 14:11:47 -07:00
Michael J Gruber 6999c54029 config.txt,diff-options.txt: porcelain vs. plumbing for color.diff
Reading the diff-family and config man pages one may think that the
color.diff and color.ui settings apply to all diff commands. Make it
clearer that they do not apply to the plumbing variants
diff-{files,index,tree}.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-27 11:25:47 -07:00
Johan Herland 2ff3a80334 Teach --dirstat not to completely ignore rearranged lines within a file
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>
2011-04-11 11:16:15 -07:00
Johan Herland 204f01a2f7 --dirstat: Describe non-obvious differences relative to --stat or regular diff
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>
2011-04-11 10:11:17 -07:00
Junio C Hamano 467ddc14fe git diff -D: omit the preimage of deletes
When reviewing a patch while concentrating primarily on the text after
then change, wading through pages of deleted text involves a cognitive
burden.

Introduce the -D option that omits the preimage text from the patch output
for deleted files.  When used with -B (represent total rewrite as a single
wholesale deletion followed by a single wholesale addition), the preimage
text is also omitted.

To prevent such a patch from being applied by mistake, the output is
designed not to be usable by "git apply" (or GNU "patch"); it is strictly
for human consumption.

It of course is possible to "apply" such a patch by hand, as a human can
read the intention out of such a patch.  It however is impossible to apply
such a patch even manually in reverse, as the whole point of this option
is to omit the information necessary to do so from the output.

Initial request by Mart Sõmermaa, documentation and tests helped by
Michael J Gruber.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-02 23:52:20 -07:00
Yann Dirson f611ddc774 diff: use "find" instead of "detect" as prefix for long forms of -M and -C
It is more consistent with existing --find-copies-harder; luckily "detect"
variant has not appeared in any officially released version of git.

Signed-off-by: Yann Dirson <ydirson@altern.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-10 13:52:05 -08:00
Kevin Ballard 150a5daad0 diff: add --detect-copies-harder as a synonym for --find-copies-harder
Signed-off-by: Kevin Ballard <kevin@sb.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-29 16:58:27 -08:00
Junio C Hamano 5a7a0fae8f Merge branch 'maint'
* maint:
  clean: remove redundant variable baselen
  Documentation/git-pull: clarify configuration
  Document that rev-list --graph triggers parent rewriting.
  clean: avoid quoting twice
  document sigchain api
  Keep together options controlling the behaviour of diffcore-rename.
  t3402: test "rebase -s<strategy> -X<opt>"
2010-11-17 13:57:58 -08:00
Yann Dirson f1037448e2 Keep together options controlling the behaviour of diffcore-rename.
It makes little sense to have --diff-filter in the middle of them, and
even spares an ifndef::git-format-patch.

Signed-off-by: Yann Dirson <ydirson@altern.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-16 09:29:37 -08:00
Junio C Hamano 329351feeb Merge branch 'kb/merge-recursive-rename-threshold'
* kb/merge-recursive-rename-threshold:
  diff: add synonyms for -M, -C, -B
  merge-recursive: option to specify rename threshold

Conflicts:
	Documentation/diff-options.txt
	Documentation/merge-strategies.txt
2010-10-26 21:54:04 -07:00
Junio C Hamano d4c4369752 Sync with 1.7.3.2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-21 17:16:10 -07:00
Štěpán Němec 01398df31c Fix odd markup in --diff-filter documentation
Instead of using the regex-like bracket expression, use grouping to make
it more consistent with other similar places. The brackets now have the
same meaning as in other documentation (i.e., the argument is optional).

Signed-off-by: Štěpán Němec <stepnem@gmail.com>
Mentored-and-Acked-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-08 12:30:52 -07:00
Štěpán Němec 62b4698e55 Use angles for placeholders consistently
Signed-off-by: Štěpán Němec <stepnem@gmail.com>
Acked-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-08 12:29:52 -07:00
Kevin Ballard 37ab5156ae diff: add synonyms for -M, -C, -B
Add new long-form options --detect-renames[=<n>], --detect-copies[=<n>],
and --break-rewrites[=[<n>][/<m>]] as synonyms for the -M, -C, and -B
options (respectively).

Signed-off-by: Kevin Ballard <kevin@sb.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-29 13:18:04 -07:00
Junio C Hamano f506b8e8b5 git log/diff: add -G<regexp> that greps in the patch text
Teach "-G<regexp>" that is similar to "-S<regexp> --pickaxe-regexp" to the
"git diff" family of commands.  This limits the diff queue to filepairs
whose patch text actually has an added or a deleted line that matches the
given regexp.  Unlike "-S<regexp>", changing other parts of the line that
has a substring that matches the given regexp IS counted as a change, as
such a change would appear as one deletion followed by one addition in a
patch text.

Unlike -S (pickaxe) that is intended to be used to quickly detect a commit
that changes the number of occurrences of hits between the preimage and
the postimage to serve as a part of larger toolchain, this is meant to be
used as the top-level Porcelain feature.

The implementation unfortunately has to run "diff" twice if you are
running "log" family of commands to produce patches in the final output
(e.g. "git log -p" or "git format-patch").  I think we _could_ cache the
result in-core if we wanted to, but that would require larger surgery to
the diffcore machinery (i.e. adding an extra pointer in the filepair
structure to keep a pointer to a strbuf around, stuff the textual diff to
the strbuf inside diffgrep_consume(), and make use of it in later stages
when it is available) and it may not be worth it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-31 14:30:29 -07:00
Junio C Hamano cc34bb0b02 Merge branch 'jl/submodule-ignore-diff'
* jl/submodule-ignore-diff:
  Add tests for the diff.ignoreSubmodules config option
  Add the 'diff.ignoreSubmodules' config setting
  Submodules: Use "ignore" settings from .gitmodules too for diff and status
  Submodules: Add the new "ignore" config option for diff and status

Conflicts:
	diff.c
2010-08-18 12:36:25 -07:00
Matthieu Moy cf958afd83 Document -B<n>[/<m>], -M<n> and -C<n> variants of -B, -M and -C
These options take an optional argument, but this optional argument was
not documented.

Original patch by Matthieu Moy, but documentation for -B mostly copied
from the explanations of Junio C Hamano.

While we're there, fix a typo in a comment in diffcore.h.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-09 09:16:11 -07:00
Jens Lehmann 302ad7a993 Submodules: Use "ignore" settings from .gitmodules too for diff and status
The .gitmodules file is parsed for "submodule.<name>.ignore" entries
before looking for them in .git/config. Thus settings found in .git/config
will override those from .gitmodules, thereby allowing the local developer
to ignore settings given by the remote side while also letting upstream
set defaults for those users who don't have special needs.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-09 09:11:44 -07:00
Jens Lehmann aee9c7d654 Submodules: Add the new "ignore" config option for diff and status
The new "ignore" config option controls the default behavior for "git
status" and the diff family. It specifies under what circumstances they
consider submodules as modified and can be set separately for each
submodule.

The command line option "--ignore-submodules=" has been extended to accept
the new parameter "none" for both status and diff.

Users that chose submodules to get rid of long work tree scanning times
might want to set the "dirty" option for those submodules. This brings
back the pre 1.7.0 behavior, where submodule work trees were never
scanned for modifications. By using "--ignore-submodules=none" on the
command line the status and diff commands can be told to do a full scan.

This option can be set to the following values (which have the same name
and meaning as for the "--ignore-submodules" option of status and diff):

"all": All changes to the submodule will be ignored.

"dirty": Only differences of the commit recorded in the superproject and
	the submodules HEAD will be considered modifications, all changes
	to the work tree of the submodule will be ignored. When using this
	value, the submodule will not be scanned for work tree changes at
	all, leading to a performance benefit on large submodules.

"untracked": Only untracked files in the submodules work tree are ignored,
	a changed HEAD and/or modified files in the submodule will mark it
	as modified.

"none" (which is the default): Either untracked or modified files in a
	submodules work tree or a difference between the subdmodules HEAD
	and the commit recorded in the superproject will make it show up
	as changed. This value is added as a new parameter for the
	"--ignore-submodules" option of the diff family and "git status"
	so the user can override the settings in the configuration.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-09 09:01:52 -07:00
Junio C Hamano e1165dd144 Merge branch 'jl/maint-diff-ignore-submodules'
* jl/maint-diff-ignore-submodules:
  t4027,4041: Use test -s to test for an empty file
  Add optional parameters to the diff option "--ignore-submodules"
  git diff: rename test that had a conflicting name
2010-06-30 11:55:37 -07:00
Junio C Hamano b0fd34ecd5 Merge branch 'jk/diff-m-doc'
* jk/diff-m-doc:
  docs: clarify meaning of -M for git-log
2010-06-13 11:22:27 -07:00
Jens Lehmann dd44d419d3 Add optional parameters to the diff option "--ignore-submodules"
In some use cases it is not desirable that the diff family considers
submodules that only contain untracked content as dirty. This may happen
e.g. when the submodule is not under the developers control and not all
build generated files have been added to .gitignore by the upstream
developers. Using the "untracked" parameter for the "--ignore-submodules"
option disables checking for untracked content and lets git diff report
them as changed only when they have new commits or modified content.

Sometimes it is not wanted to have submodules show up as changed when they
just contain changes to their work tree. An example for that are scripts
which just want to check for submodule commits while ignoring any changes
to the work tree. Also users having large submodules known not to change
might want to use this option, as the - sometimes substantial - time it
takes to scan the submodule work tree(s) is saved.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-11 13:33:17 -07:00
Junio C Hamano 1bdd46cd3a Merge branch 'tr/word-diff'
* tr/word-diff:
  diff: add --word-diff option that generalizes --color-words

Conflicts:
	diff.c
2010-05-21 04:02:17 -07:00
Will Palmer 1c9eecff97 diff-options: make --patch a synonym for -p
Here we simply make --patch a synonym for -p, whose mnemonic was "patch"
all along.

Signed-off-by: Will Palmer <wmpalmer@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-18 21:50:03 -07:00
Jeff King 7ffad25014 docs: clarify meaning of -M for git-log
As an option to the "diff" family, it is fairly obvious what
"detect renames" means. However, for revision traversal, the
"-M" option is just included in the long list of options,
with no indication that it is about showing renames in diffs
versus following renames. Let's make it more explicit.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-18 21:32:41 -07:00
Junio C Hamano fab45027e0 Merge branch 'maint'
* maint:
  Documentation: Describe other situations where -z affects git diff
2010-04-18 21:31:20 -07:00
Charles Bailey 03aa87ed99 Documentation: Describe other situations where -z affects git diff
-z also alters the behaviour of --name-only and --name-status.

Signed-off-by: Charles Bailey <charles@hashpling.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-18 13:43:53 -07:00
Thomas Rast 882749a04f diff: add --word-diff option that generalizes --color-words
This teaches the --color-words engine a more general interface that
supports two new modes:

* --word-diff=plain, inspired by the 'wdiff' utility (most similar to
  'wdiff -n <old> <new>'): uses delimiters [-removed-] and {+added+}

* --word-diff=porcelain, which generates an ad-hoc machine readable
  format:
  - each diff unit is prefixed by [-+ ] and terminated by newline as
    in unified diff
  - newlines in the input are output as a line consisting only of a
    tilde '~'

Both of these formats still support color if it is enabled, using it
to highlight the differences.  --color-words becomes a synonym for
--word-diff=color, which is the color-only format.  Also adds some
compatibility/convenience options.

Thanks to Junio C Hamano and Miles Bader for good ideas.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-14 10:56:53 -07:00
Mark Lodato 73e9da0196 Add an optional argument for --color options
Make git-branch, git-show-branch, git-grep, and all the diff-based
programs accept an optional argument <when> for --color.  The argument
is a colorbool: "always", "never", or "auto".  If no argument is given,
"always" is used;  --no-color is an alias for --color=never.  This makes
the command-line interface consistent with other GNU tools, such as `ls'
and `grep', and with the git-config color options.  Note that, without
an argument, --color and --no-color work exactly as before.

To implement this, two internal changes were made:

1. Allow the first argument of git_config_colorbool() to be NULL,
   in which case it returns -1 if the argument isn't "always", "never",
   or "auto".

2. Add OPT_COLOR_FLAG(), OPT__COLOR(), and parse_opt_color_flag_cb()
   to the option parsing library.  The callback uses
   git_config_colorbool(), so color.h is now a dependency
   of parse-options.c.

Signed-off-by: Mark Lodato <lodatom@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-18 17:21:40 -08:00
Björn Gustavsson 5c931c8da2 Fix over-simplified documentation for 'git log -z'
In commit 64485b4a, the documentation for 'git log -z' was
simplified too much. The -z option actually changes the behavior
of 'git log' in two ways: commits will be ended with a NUL
instead of a LF (correctly documented) and the --raw and
--numstat will have NUL as field terminators (omitted in
the documentation for 'git log').

Signed-off-by: Björn Gustavsson <bgustavsson@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-23 01:21:51 -08:00
Björn Gustavsson 64485b4aba Clarify and correct -z
The description for -z is too vague and general for the
apply, diff*, and log commands.

Change the description of -z for 'git log' to note that
commits will be separated by NULs.

Change the description of -z for 'git diff*' and 'git apply'
to note that it applies to the --numstat option, and for
'git diff*' also for --raw option.

Also correct the description of the "munging" of pathanmes that
takes place in the absence of -z for the 'git diff*' and
'git apply' commands, namely that apart from the characters mentioned,
double quotes will also be escaped and that the pathname will be
enclosed in double quotes if any characters are escaped.

Signed-off-by: Björn Gustavsson <bgustavsson@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-22 12:08:00 -08:00
Junio C Hamano 1a02a85d63 Merge branch 'bg/format-patch-doc-update'
* bg/format-patch-doc-update:
  format-patch: Add "--no-stat" as a synonym for "-p"
  format-patch documentation: Fix formatting
  format-patch documentation: Remove diff options that are not useful
  format-patch: Always generate a patch
2009-11-20 23:47:10 -08:00
Björn Gustavsson 2cfa8330e4 format-patch: Add "--no-stat" as a synonym for "-p"
"-p" means "generate patch" in 'git log' and 'git diff', so it's
quite surprising that it means "suppress diffstat" in
'git format-patch'.

Keep the "-p" option for backward compatibility, but add
"--no-stat" as a more intuitive synonym. For backward compatibility
with scripts, we must allow combinations of --stat and --no-stat.

Signed-off-by: Björn Gustavsson <bgustavsson@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-10 11:47:30 -08:00
Björn Gustavsson dce5ef1420 format-patch documentation: Fix formatting
Format git commands and options consistently using back quotes
(i.e. a fixed font in the resulting HTML document).

Signed-off-by: Björn Gustavsson <bgustavsson@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-10 11:38:21 -08:00
Björn Gustavsson d4cb003fff format-patch documentation: Remove diff options that are not useful
To simplify reading the documentation for format-patch, remove the
description of common diff options that are not useful for the
purpose of the command (i.e. "Prepare patches for e-mail submission").

Specifically, this removes the description of the following options:

  --raw
  -z
  --color
  --no-color
  --color-words
  --diff-filter
  -S
  --pickaxe-all
  --pickaxe-regex
  -R
  --relative
  --exit-code
  --quiet

Signed-off-by: Björn Gustavsson <bgustavsson@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-10 11:38:21 -08:00
Björn Gustavsson 02bc5b03f5 format-patch: Always generate a patch
Jeff King recently reinstated -p to suppress the default diffstat
(as -p used to work before 68daa64, about 14 months ago).

However, -p is also needed in combination with certain options
(e.g. --stat or --numstat) in order to produce any patch at all.
The documentation does not mention this.

Since the purpose of format-patch is to produce a patch that
can be emailed, it does not make sense that certain combination
of options will suppress the generation of the patch itself.

Therefore:

* Update 'git format-patch' to always generate a patch.

* Since the --name-only, --name-status, and --check suppresses
  the generation of the patch, disallow those options,
  and remove the description of them in the documentation.

* Remove the reference to -p in the description of -U.

* Remove the descriptions of the options that are synonyms for -p
  plus another option (--patch-with-raw and --patch-with-stat).

* While at it, slightly tweak the description of -p itself
  to say that it generates "plain patches", so that you can
  think of -p as "plain patch" as an mnemonic aid.

Signed-off-by: Björn Gustavsson <bgustavsson@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-10 11:37:47 -08:00
Johannes Schindelin 752c0c2492 Add the --submodule option to the diff option family
When you use the option --submodule=log you can see the submodule
summaries inlined in the diff, instead of not-quite-helpful SHA-1 pairs.

The format imitates what "git submodule summary" shows.

To do that, <path>/.git/objects/ is added to the alternate object
databases (if that directory exists).

This option was requested by Jens Lehmann at the GitTogether in Berlin.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-19 22:31:00 -07:00
Jeff King 821d56aa68 doc: clarify how -S works
The existing text was very vague about what exactly it means
for difference to "contain" a change. This seems to cause
confusion on the mailing list every month or two.

To fix it we:

  1. use "introduce or remove an instance of" instead of
     "contain"

  2. point the user to gitdiffcore(7), which contains a more
     complete explanation

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-19 02:47:40 -07:00
Junio C Hamano 9847a52432 Merge branch 'js/diff-color-words'
* js/diff-color-words:
  Change the spelling of "wordregex".
  color-words: Support diff.wordregex config option
  color-words: make regex configurable via attributes
  color-words: expand docs with precise semantics
  color-words: enable REG_NEWLINE to help user
  color-words: take an optional regular expression describing words
  color-words: change algorithm to allow for 0-character word boundaries
  color-words: refactor word splitting and use ALLOC_GROW()
  Add color_fwrite_lines(), a function coloring each line individually
2009-01-25 17:13:29 -08:00
Teemu Likonen ec74042dc7 diff-options.txt: Fix asciidoc markup issue
Must be "--patience::", not "--patience:".

Signed-off-by: Teemu Likonen <tlikonen@iki.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-01-25 17:09:58 -08:00
Junio C Hamano 5dc1308562 Merge branch 'js/patience-diff'
* js/patience-diff:
  bash completions: Add the --patience option
  Introduce the diff option '--patience'
  Implement the patience diff algorithm

Conflicts:
	contrib/completion/git-completion.bash
2009-01-23 21:51:38 -08:00
Boyd Stephen Smith Jr 98a4d87b87 color-words: Support diff.wordregex config option
When diff is invoked with --color-words (w/o =regex), use the regular
expression the user has configured as diff.wordregex.

diff drivers configured via attributes take precedence over the
diff.wordregex-words setting.  If the user wants to change them, they have
their own configuration variables.

Signed-off-by: Boyd Stephen Smith Jr <bss@iguanasuicide.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-01-21 00:51:12 -08:00
Thomas Rast 80c49c3de2 color-words: make regex configurable via attributes
Make the --color-words splitting regular expression configurable via
the diff driver's 'wordregex' attribute.  The user can then set the
driver on a file in .gitattributes.  If a regex is given on the
command line, it overrides the driver's setting.

We also provide built-in regexes for the languages that already had
funcname patterns, and add an appropriate diff driver entry for C/++.
(The patterns are designed to run UTF-8 sequences into a single chunk
to make sure they remain readable.)

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-01-17 10:44:21 -08:00
Thomas Rast c4b252c3d8 color-words: expand docs with precise semantics
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-01-17 10:44:13 -08:00
Johannes Schindelin 2b6a5417d7 color-words: take an optional regular expression describing words
In some applications, words are not delimited by white space.  To
allow for that, you can specify a regular expression describing
what makes a word with

	git diff --color-words='[A-Za-z0-9]+'

Note that words cannot contain newline characters.

As suggested by Thomas Rast, the words are the exact matches of the
regular expression.

Note that a regular expression beginning with a '^' will match only
a word at the beginning of the hunk, not a word at the beginning of
a line, and is probably not what you want.

This commit contains a quoting fix by Thomas Rast.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-01-17 10:43:08 -08:00
Jon Loeliger 323b9db839 Fix Documentation typos surrounding the word 'handful'.
Some instances replaced by "handful of", others use
the word "few", a couple get a slight rewording.

Signed-off-by: Jon Loeliger <jdl@freescale.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-01-13 00:18:53 -08:00
Johannes Schindelin 34292bddb8 Introduce the diff option '--patience'
This commit teaches Git to produce diff output using the patience diff
algorithm with the diff option '--patience'.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-01-07 13:37:07 -08:00
Junio C Hamano 7bb5321be0 Merge branch 'rs/diff-ihc'
* rs/diff-ihc:
  diff: add option to show context between close hunks

Conflicts:
	Documentation/diff-options.txt
2009-01-07 00:10:14 -08:00
jidanni@jidanni.org a9e67c8ccc Documentation/diff-options.txt: unify options
Instead of listing short option (e.g. "-U<n>") as a shorthand for its
longer counterpart (e.g. "--unified=<n>"), list the synonyms together.  It
saves one indirection to find what the reader wants.

Signed-off-by: jidanni <jidanni@jidanni.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-12-29 01:08:02 -08:00
René Scharfe 6d0e674a57 diff: add option to show context between close hunks
Merge two hunks if there is only the specified number of otherwise unshown
context between them.  For --inter-hunk-context=1, the resulting patch has
the same number of lines but shows uninterrupted context instead of a
context header line in between.

Patches generated with this option are easier to read but are also more
likely to conflict if the file to be patched contains other changes.

This patch keeps the default for this option at 0.  It is intended to just
make the feature available in order to see its advantages and downsides.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-12-29 01:05:21 -08:00
Junio C Hamano 58e0fa5416 Merge branch 'maint'
* maint:
  Hopefully the final draft release notes update before 1.6.0.3
  diff(1): clarify what "T"ypechange status means
  contrib: update packinfo.pl to not use dashed commands
  force_object_loose: Fix memory leak
  tests: shell negation portability fix
2008-10-18 08:26:44 -07:00
Junio C Hamano f07c3c53f8 diff(1): clarify what "T"ypechange status means
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-10-18 08:20:51 -07:00
Heikki Orsila fd33777b78 diff --dirstat-by-file: count changed files, not lines
This new option --dirstat-by-file is the same as --dirstat, but it
counts "impacted files" instead of "impacted lines" (lines that are
added or removed).

Signed-off-by: Heikki Orsila <heikki.orsila@iki.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-09-05 14:04:26 -07:00
Junio C Hamano 106db883b7 Merge branch 'maint'
* maint:
  Makefile: add merge_recursive.h to LIB_H
  Improve documentation for --dirstat diff option
  Bring local clone's origin URL in line with that of a remote clone
  Documentation: minor cleanup in a use case in 'git stash' manual
  Documentation: fix disappeared lines in 'git stash' manpage
  Documentation: fix reference to a for-each-ref option
2008-09-02 17:10:08 -07:00
Heikki Orsila 62e00b0a9a Improve documentation for --dirstat diff option
Signed-off-by: Heikki Orsila <heikki.orsila@iki.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-09-01 23:48:45 -07:00
Jim Meyering 6457e58c8f reword --full-index description
Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-19 19:33:12 -07:00
Jonathan Nieder 6998e4db52 Documentation: fix links to tutorials and other new manual pages
With the conversion of HTML documentation to man pages

tutorial.html -> gittutorial (7)
tutorial-2.html -> gittutorial-2 (7)
cvs-migration.html -> gitcvs-migration (7)
diffcore.html -> gitdiffcore (7)
repository-layout.html -> gitrepository-layout (5)
hooks.html -> githooks (5)
glossary.html -> gitglossary (7)
core-tutorial.html -> gitcore-tutorial (7)

and the automatic update of references to these pages,
a little debris was left behind. We clear it away.

Signed-off-by: Jonathan Nieder <jrnieder@uchicago.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-01 17:20:09 -07:00
Christian Couder 30eba7bf2c documentation: convert "diffcore" and "repository-layout" to man pages
This patch renames the following documents and at the same time converts
them to the man format:

diffcore.txt          -> gitdiffcore.txt		(man section 7)
repository-layout.txt -> gitrepository-layout.txt	(man section 5)

Other documents that reference the above ones are changed accordingly.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-06 11:14:52 -07:00
Johannes Schindelin 50fd9bd843 diff options: Introduce --ignore-submodules
The new option --ignore-submodules can now be used to ignore changes in
submodules.

Why?  Sometimes it is not interesting when a submodule changed.

For example, when reordering some commits in the superproject, a dirty
submodule is usually totally uninteresting.  So we will use this option
in git-rebase to test for a dirty working tree.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-15 16:12:40 -07:00
Junio C Hamano d6958a1a32 Merge branch 'maint-1.5.4' into maint
* maint-1.5.4:
  svn-git: Use binmode for reading/writing binary rev maps
  diff options documentation: refer to --diff-filter in --name-status
  git-svn bug with blank commits and author file
  archive.c: format_subst - fixed bogus argument to memchr
  copy.c: copy_fd - correctly report write errors
  gitattributes: Fix subdirectory attributes specified from root directory
2008-04-22 23:37:06 -07:00
Miklos Vajna a6f47b2be4 diff options documentation: refer to --diff-filter in --name-status
git diff --name-status outputs letters, but the meaning of those letters
is documented elsewhere. Add a note to make the manpage more intuitive.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-22 21:42:38 -07:00
Gerrit Pape 37152d8310 diff-options.txt: document the new "--dirstat" option
This commit adds the documentation for the new option added by 7df7c01
(Add "--dirstat" for some directory statistics, 2008-02-12).

Noticed by Clint Adams, reported through
 http://bugs.debian.org/476437

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-21 22:50:21 -07:00
Junio C Hamano c0cb4a0679 diff --relative: help working in a bare repository
This allows the --relative option to say which subdirectory to
pretend to be in, so that in a bare repository, you can say:

    $ git log --relative=drivers/ v2.6.20..v2.6.22 -- drivers/scsi/

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-13 14:59:34 -08:00
Junio C Hamano cd676a5136 diff --relative: output paths as relative to the current subdirectory
This adds --relative option to the diff family.  When you start
from a subdirectory:

        $ git diff --relative

shows only the diff that is inside your current subdirectory,
and without $prefix part.  People who usually live in
subdirectories may like it.

There are a few things I should also mention about the change:

 - This works not just with diff but also works with the log
   family of commands, but the history pruning is not affected.

   In other words, if you go to a subdirectory, you can say:

        $ git log --relative -p

   but it will show the log message even for commits that do not
   touch the current directory.  You can limit it by giving
   pathspec yourself:

        $ git log --relative -p .

   This originally was not a conscious design choice, but we
   have a way to affect diff pathspec and pruning pathspec
   independently.  IOW "git log --full-diff -p ." tells it to
   prune history to commits that affect the current subdirectory
   but show the changes with full context.  I think it makes
   more sense to leave pruning independent from --relative than
   the obvious alternative of always pruning with the current
   subdirectory, which would break the symmetry.

 - Because this works also with the log family, you could
   format-patch a single change, limiting the effect to your
   subdirectory, like so:

        $ cd gitk-git
        $ git format-patch -1 --relative 911f1eb

   But because that is a special purpose usage, this option will
   never become the default, with or without repository or user
   preference configuration.  The risk of producing a partial
   patch and sending it out by mistake is too great if we did
   so.

 - This is inherently incompatible with --no-index, which is a
   bolted-on hack that does not have much to do with git
   itself.  I didn't bother checking and erroring out on the
   combined use of the options, but probably I should.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-13 14:58:07 -08:00
Dan McGee 5162e69732 Documentation: rename gitlink macro to linkgit
Between AsciiDoc 8.2.2 and 8.2.3, the following change was made to the stock
Asciidoc configuration:

@@ -149,7 +153,10 @@
 # Inline macros.
 # Backslash prefix required for escape processing.
 # (?s) re flag for line spanning.
-(?su)[\\]?(?P<name>\w(\w|-)*?):(?P<target>\S*?)(\[(?P<attrlist>.*?)\])=
+
+# Explicit so they can be nested.
+(?su)[\\]?(?P<name>(http|https|ftp|file|mailto|callto|image|link)):(?P<target>\S*?)(\[(?P<attrlist>.*?)\])=
+
 # Anchor: [[[id]]]. Bibliographic anchor.
 (?su)[\\]?\[\[\[(?P<attrlist>[\w][\w-]*?)\]\]\]=anchor3
 # Anchor: [[id,xreflabel]]

This default regex now matches explicit values, and unfortunately in this
case gitlink was being matched by just 'link', causing the wrong inline
macro template to be applied. By renaming the macro, we can avoid being
matched by the wrong regex.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-01-06 18:41:44 -08:00
Johannes Schindelin eab9a40b6d Teach diff machinery to display other prefixes than "a/" and "b/"
With the new options "--src-prefix=<prefix>", "--dst-prefix=<prefix>"
and "--no-prefix", you can now control the path prefixes of the diff
machinery.  These used to by hardwired to "a/" for the source prefix
and "b/" for the destination prefix.

Initial patch by Pascal Obry.  Sane option names suggested by Linus.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-20 01:10:39 -08:00
Wincent Colaiuta 62c64895cf "diff --check" should affect exit status
"git diff" has a --check option that can be used to check for whitespace
problems but it only reported by printing warnings to the
console.

Now when the --check option is used we give a non-zero exit status,
making "git diff --check" nicer to use in scripts and hooks.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-13 23:05:42 -08:00
Wincent Colaiuta 0ac7903ee3 Use "whitespace" consistently
For consistency, change "white space" and "whitespaces" to
"whitespace", fixing a couple of adjacent grammar problems in the
docs.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-12 10:59:22 -08:00
Miklos Vajna 272bd3cfd0 Include diff options in the git-log manpage
[jc: with quite a few fixups]

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-05 01:57:40 -08:00
Sergei Organov c1a95fa629 Documentation: customize diff-options depending on particular command
Customize diff-options depending on particular command as follows,
mostly to make git-diff and git-format-patch manuals less confusing:

* git-format-patch:

  - Mark --patch-with-stat as being the default.

  - Change -p description so that it matches what it actually does and
    so that it doesn't refer to absent "section on generating
    patches".

* git-diff: mark -p as being the default.

* git-diff-index/git-diff-files/git-diff-tree: mark --raw as being
  the default.

Signed-off-by: Sergei Organov <osv@javad.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-15 22:44:17 -08:00
Steffen Prohaska 63a1f810a6 fixed link in documentation of diff-options
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-01 23:27:20 -07:00
Junio C Hamano 654a7ccc56 Update description of -z option.
The NUL you see in "git log" (without diff) output are between records,
not at the end of each record.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-25 23:45:42 -07:00
Robin Rosenberg 4eb994733d Document --unified/-U option
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-25 13:27:26 -07:00
Johannes Schindelin 72909befaa Add diff-option --ext-diff
To prevent funky games with external diff engines, git-log and
friends prevent external diff engines from being called. That makes
sense in the context of git-format-patch or git-rebase.

However, for "git log -p" it is not so nice to get the message
that binary files cannot be compared, while "git diff" has no
problems with them, if you provided an external diff driver.

With this patch, "git log --ext-diff -p" will do what you expect,
and the option "--no-ext-diff" can be used to override that
setting.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-03 19:05:55 -07:00
Johannes Schindelin ca6c097089 Teach diff to imply --find-copies-harder upon -C -C
Earlier, a second "-C" on the command line had no effect.
But "--find-copies-harder" is so long to type, let's make doubled -C
enable that option.  It is in line with how "git blame" handles such
doubled options to mean "work harder".

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-12 01:00:38 -07:00
Junio C Hamano a6080a0a44 War on whitespace
This uses "git-apply --whitespace=strip" to fix whitespace errors that have
crept in to our source files over time.  There are a few files that need
to have trailing whitespaces (most notably, test vectors).  The results
still passes the test, and build result in Documentation/ area is unchanged.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-07 00:04:01 -07:00
Alex Riesen 2a18c266d0 Document --quiet option to git-diff
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-24 22:32:55 -07:00
Alex Riesen 41bbf9d585 Allow git-diff exit with codes similar to diff(1)
This introduces a new command-line option: --exit-code. The diff
programs will return 1 for differences, return 0 for equality, and
something else for errors.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-14 16:21:19 -07:00
Junio C Hamano a44a0c9966 Document --ignore-space-at-eol option.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-14 00:41:32 -08:00
Bill Lear 16507fcf0a Document --check option to git diff.
Signed-off-by: Bill Lear <rael@zopyra.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-27 13:46:59 -08:00
Junio C Hamano 2f89543eaf Document --numstat in git-apply and git-diff
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-26 00:15:26 -08:00
Nicolas Pitre ebd124c678 make commit message a little more consistent and conforting
It is nicer to let the user know when a commit succeeded all the time,
not only the first time.  Also the commit sha1 is much more useful than
the tree sha1 in this case.

This patch also introduces a -q switch to supress this message as well
as the summary of created/deleted files.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-15 22:29:54 -08:00
Jakub Narebski 8ebe185bbf Document git-diff whitespace flags -b and -w
Document git diff options -b / --ignore-space-change and
-w / --ignore-all-space, introduced by Johannes Schindelin
in commit 0d21efa5, "Teach diff about -b and -w flags".

The description of options is taken from GNU diff man page and
GNU Diffutils info documentation.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-04 16:30:54 -08:00
Junio C Hamano 74e2abe5b7 diff --numstat
[jc: with documentation from Jakub]

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-13 21:37:10 -07:00
Linus Torvalds 5c5b2ea9ab diff --stat=width[,name-width]: allow custom diffstat output width.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-28 22:27:29 -07:00
Johannes Schindelin f59a59e22f Add the --color-words option to the diff options family
With this option, the changed words are shown inline. For example,
if a file containing "This is foo" is changed to "This is bar", the diff
will now show "This is " in plain text, "foo" in red, and "bar" in green.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-10 15:28:57 -07:00
Junio C Hamano b53766483f Update diff-options and config documentation.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-07 12:28:54 -07:00
Stephan Feder d507bb1500 diff-options: Explain --text and -a
Signed-off-by: Stephan Feder <sf@b-i-t.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-07 12:28:04 -07:00
Sean 4bbd261bbd Add "--summary" option to git diff.
Remove the need to pipe git diff through git apply to
get the extended headers summary.

Signed-off-by: Sean Estabrooks <seanlkml@sympatico.ca>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-14 16:28:45 -07:00
Johannes Schindelin 2935327394 diff-options: add --patch-with-stat
With this option, git prepends a diffstat in front of the patch.

Since I really, really do not know what a diffstat of a combined diff
("merge diff") should look like, the diffstat is not generated for these.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-15 19:30:27 -07:00
Johannes Schindelin d75f7952ef diff-options: add --stat (take 2)
Now, you can say "git diff --stat" (to get an idea how many changes are
uncommitted), or "git log --stat".

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-13 16:48:24 -07:00
Petr Baudis 5c91da25d7 Document --patch-with-raw
Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-11 11:16:51 -07:00
Petr Baudis d01d8c6782 Support for pickaxe matching regular expressions
git-diff-* --pickaxe-regex will change the -S pickaxe to match
POSIX extended regular expressions instead of fixed strings.

The regex.h library is a rather stupid interface and I like pcre too, but
with any luck it will be everywhere we will want to run Git on, it being
POSIX.2 and all. I'm not sure if we can expect platforms like AIX to
conform to POSIX.2 or if win32 has regex.h. We might add a flag to
Makefile if there is a portability trouble potential.

Signed-off-by: Petr Baudis <pasky@suse.cz>
2006-04-04 13:44:15 -07:00
Jon Loeliger 147cf31738 Add --diff-filter= documentation paragraph
Signed-off-by: Jon Loeliger <jdl@jdl.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-09 12:06:57 -08:00
Junio C Hamano 89438677ab Documentation: spell.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-29 01:32:56 -08:00
Junio C Hamano 913419fcc6 diff --abbrev: document --abbrev=<n> form.
It was implemented there but was not advertised.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-19 18:32:44 -08:00
Junio C Hamano 47dd0d595d diff: --abbrev option
When I show transcripts to explain how something works, I often
find myself hand-editing the diff-raw output to shorten various
object names in the output.

This adds --abbrev option to the diff family, which shortens
diff-raw output and diff-tree commit id headers.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-19 18:32:44 -08:00
Junio C Hamano 80b1e511d7 diff: --full-index
A new option, --full-index, is introduced to diff family.  This
causes the full object name of pre- and post-images to appear on
the index line of patch formatted output, to be used in
conjunction with --allow-binary-replacement option of git-apply.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-16 16:20:40 -08:00
Lukas_Sandström 5f3aa197ac Change 'cache' to 'index' in the docs
This patch makes the documentation refer to the index
as index instead of cache, but some references still
remain. (e.g. git-update-index.txt)

Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-11 15:12:29 -08:00
c.shoemaker@cox.net 1cb7f22e5c Remove -r from common diff options documentation in one more place
Signed-off-by: Chris Shoemaker <c.shoemaker at cox.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-28 22:21:32 -07:00