Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/diff.c
AgeCommit message (Collapse)Author
2010-10-27Merge branch 'kb/merge-recursive-rename-threshold'Junio C Hamano
* 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-27Merge branch 'maint'Junio C Hamano
* maint: Fix copy-pasted comments related to tree diff handling.
2010-10-25Fix copy-pasted comments related to tree diff handling.Yann Dirson
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-30Merge branch 'jc/pickaxe-grep'Junio C Hamano
* jc/pickaxe-grep: diff/log -G<pattern>: tests git log/diff: add -G<regexp> that greps in the patch text diff: pass the entire diff-options to diffcore_pickaxe() gitdiffcore doc: update pickaxe description
2010-09-30diff: trivial fix for --output file error messageMatthieu Moy
The option argument is either after the equal sign in --output=... or in the next command-line argument. optarg is the reliable way to access it. Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-30diff: add synonyms for -M, -C, -BKevin Ballard
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-30merge-recursive: option to specify rename thresholdKevin Ballard
The recursive merge strategy turns on rename detection but leaves the rename threshold at the default. Add a strategy option to allow the user to specify a rename threshold to use. Signed-off-by: Kevin Ballard <kevin@sb.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-10Merge branch 'maint'Junio C Hamano
* maint: xdiff-interface.c: always trim trailing space from xfuncname matches diff.c: call regfree to free memory allocated by regcomp when necessary
2010-09-10diff.c: call regfree to free memory allocated by regcomp when necessaryBrandon Casey
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-01Merge branch 'cb/binary-patch-id'Junio C Hamano
* cb/binary-patch-id: hash binary sha1 into patch id
2010-09-01git log/diff: add -G<regexp> that greps in the patch textJunio C Hamano
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-09-01diff: pass the entire diff-options to diffcore_pickaxe()Junio C Hamano
That would make it easier to give enhanced feature to the pickaxe transformation. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-22Merge branch 'mm/shortopt-detached'Junio C Hamano
* mm/shortopt-detached: log: parse separate option for --glob log: parse separate options like git log --grep foo diff: parse separate options --stat-width n, --stat-name-width n diff: split off a function for --stat-* option parsing diff: parse separate options like -S foo Conflicts: revision.c
2010-08-18Merge branch 'jc/maint-follow-rename-fix'Junio C Hamano
* jc/maint-follow-rename-fix: log: test for regression introduced in v1.7.2-rc0~103^2~2 diff --follow: do call diffcore_std() as necessary diff --follow: do not waste cycles while recursing
2010-08-18Merge branch 'jl/submodule-ignore-diff'Junio C Hamano
* 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-17hash binary sha1 into patch idClemens Buchacher
Since commit 2f82f760 (Take binary diffs into account for "git rebase"), binary files are included in patch ID computation. Binary files are diffed using the text diff algorithm, however, which has a huge impact on performance. The following tests performance for a 50000 line file marked as binary in .gitattributes. $ git format-patch --stdout --ignore-if-in-upstream master real 0m0.367s user 0m0.354s sys 0m0.010s Instead of diffing the binary files, hash the pre- and post-image sha1, which is just as unique. As a result, performance is much improved. $ git format-patch --stdout --ignore-if-in-upstream master real 0m0.016s user 0m0.015s sys 0m0.001s Signed-off-by: Clemens Buchacher <drizzd@aon.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-13diff --follow: do call diffcore_std() as necessaryJunio C Hamano
Usually, diff frontends populate the output queue with filepairs without any rename information and call diffcore_std() to sort the renames out. When --follow is in effect, however, diff-tree family of frontend has a hack that looks like this: diff-tree frontend -> diff_tree_sha1() . populate diff_queued_diff . if --follow is in effect and there is only one change that creates the target path, then -> try_to_follow_renames() -> diff_tree_sha1() with no pathspec but with -C -> diffcore_std() to find renames . if rename is found, tweak diff_queued_diff and put a single filepair that records the found rename there -> diffcore_std() . tweak elements on diff_queued_diff by - rename detection - path ordering - pickaxe filtering We need to skip parts of the second call to diffcore_std() that is related to rename detection, and do so only when try_to_follow_renames() did find a rename. Earlier 1da6175 (Make diffcore_std only can run once before a diff_flush, 2010-05-06) tried to deal with this issue incorrectly; it unconditionally disabled any second call to diffcore_std(). This hopefully fixes the breakage. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-11diff: strip extra "/" when stripping prefixJakub Narebski
There are two ways a user might want to use "diff --relative": 1. For a file in a directory, like "subdir/file", the user can use "--relative=subdir/" to strip the directory. 2. To strip part of a filename, like "foo-10", they can use "--relative=foo-". We currently handle both of those situations. However, if the user passes "--relative=subdir" (without the trailing slash), we produce inconsistent results. For the unified diff format, we collapse the double-slash of "a//file" correctly into "a/file". But for other formats (raw, stat, name-status), we end up with "/file". We can do what the user means here and strip the extra "/" (and only a slash). We are not hurting any existing users of (2) above with this behavior change because the existing output for this case was nonsensical. Patch by Jakub, tests and commit message by Jeff King. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-09Add the 'diff.ignoreSubmodules' config settingJohannes Schindelin
When you have a lot of submodules checked out, the time penalty to check for dirty submodules can easily imply a multiplication of the total time by the factor 20. This makes the difference between almost instantaneous (< 2 seconds) and unbearably slow (> 50 seconds) here, since the disk caches are constantly overloaded. To this end, the submodule.*.ignore config option was introduced, but it is per-submodule. This commit introduces a global config setting to set a default (porcelain) value for the --ignore-submodules option, keeping the default at 'none'. It can be overridden by the submodule.*.ignore setting and by the --ignore-submodules option. Incidentally, this commit fixes an issue with the overriding logic: multiple --ignore-submodules options would not clear the previously set flags. While at it, fix a typo in the documentation for submodule.*.ignore. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-09Submodules: Add the new "ignore" config option for diff and statusJens Lehmann
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-06diff: parse separate options --stat-width n, --stat-name-width nMatthieu Moy
Part of a campaign for unstuck forms of options. [jn: with some refactoring] Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-06diff: split off a function for --stat-* option parsingJonathan Nieder
As an optimization, the diff_opt_parse() switchboard has a single case for all the --stat-* options. Split it off into a separate function so we can enhance it without bringing code dangerously close to the right margin. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-06diff: parse separate options like -S fooMatthieu Moy
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>
2010-08-04Merge branch 'sv/maint-diff-q-clear-fix' into maintJunio C Hamano
* sv/maint-diff-q-clear-fix: Fix DIFF_QUEUE_CLEAR refactoring
2010-08-02Fix DIFF_QUEUE_CLEAR refactoringJunio C Hamano
It introduced a macro to reduce repeated assignments to three fields, but an unrelated and incorrect change snuck in by mistake, which broke commands like "git diff-files -p --submodule". Noticed by Sven Verdoolaege. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-07-09diff.c: fix a graph output bugBo Yang
When --graph is in effect, the line-prefix typically has colored graph line segments and ends with reset. The color sequence "set" given to this function is for showing the metainfo part of the patch text and (1) it should not be applied to the graph lines, and (2) it will be reset at the end of line_prefix so it won't be in effect anyway. Signed-off-by: Bo Yang <struggleyb.nku@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-30Merge branch 'jl/status-ignore-submodules'Junio C Hamano
* jl/status-ignore-submodules: Add the option "--ignore-submodules" to "git status" git submodule: ignore dirty submodules for summary and status Conflicts: builtin/commit.c t/t7508-status.sh wt-status.c wt-status.h
2010-06-30Merge branch 'jl/maint-diff-ignore-submodules'Junio C Hamano
* 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-27Merge branch 'ab/blame-textconv'Junio C Hamano
* ab/blame-textconv: t/t8006: test textconv support for blame textconv: support for blame textconv: make the API public Conflicts: diff.h
2010-06-25Add the option "--ignore-submodules" to "git status"Jens Lehmann
In some use cases it is not desirable that "git status" 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 (this was the behavior before 1.7.0). 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 when using the "dirty" parameter. And if you want to ignore any changes to submodules, you can now do that by using this option without parameters or with "all" (when the config option status.submodulesummary is set, using "all" will also suppress the output of the submodule summary). A new function handle_ignore_submodules_arg() is introduced to parse this option new to "git status" in a single location, as "git diff" already knew it. Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-22Merge branch 'maint'Junio C Hamano
* maint: Update draft release notes to 1.7.1.1 tests: remove unnecessary '^' from 'expr' regular expression Conflicts: diff.c
2010-06-22Merge branch 'cc/maint-diff-CC-binary' into maintJunio C Hamano
* cc/maint-diff-CC-binary: diff: fix "git show -C -C" output when renaming a binary file Conflicts: diff.c
2010-06-21Merge branch 'bw/diff-metainfo-color' into maintJunio C Hamano
* bw/diff-metainfo-color: diff: fix coloring of extended diff headers
2010-06-21Merge branch 'rs/diff-no-minimal' into maintJunio C Hamano
* rs/diff-no-minimal: git diff too slow for a file
2010-06-18Merge branch 'cc/maint-diff-CC-binary'Junio C Hamano
* cc/maint-diff-CC-binary: diff: fix "git show -C -C" output when renaming a binary file Conflicts: diff.c
2010-06-18Merge branch 'by/diff-graph'Junio C Hamano
* by/diff-graph: Make --color-words work well with --graph graph.c: register a callback for graph output Emit a whole line in one go diff.c: Output the text graph padding before each diff line Output the graph columns at the end of the commit message Add a prefix output callback to diff output Conflicts: diff.c
2010-06-18Merge branch 'jh/diff-index-line-abbrev'Junio C Hamano
* jh/diff-index-line-abbrev: diff.c: Ensure "index $from..$to" line contains unambiguous SHA1s Conflicts: diff.c
2010-06-18Merge branch 'ec/diff-noprefix-config'Junio C Hamano
* ec/diff-noprefix-config: diff: add configuration option for disabling diff prefixes.
2010-06-13Merge branch 'bw/diff-metainfo-color'Junio C Hamano
* bw/diff-metainfo-color: diff: fix coloring of extended diff headers
2010-06-13Merge branch 'rs/diff-no-minimal'Junio C Hamano
* rs/diff-no-minimal: git diff too slow for a file
2010-06-12Add optional parameters to the diff option "--ignore-submodules"Jens Lehmann
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-12textconv: make the API publicAxel Bonnet
The textconv functionality allows one to convert a file into text before running diff. But this functionality can be useful to other features such as blame. Signed-off-by: Axel Bonnet <axel.bonnet@ensimag.imag.fr> Signed-off-by: Clément Poulain <clement.poulain@ensimag.imag.fr> Signed-off-by: Diane Gasselin <diane.gasselin@ensimag.imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-07diff: fix "git show -C -C" output when renaming a binary fileChristian Couder
A bug was introduced in 3e97c7c6af2901cec63bf35fcd43ae3472e24af8 (No diff -b/-w output for all-whitespace changes, Nov 19 2009) that made the lines: diff --git a/bar b/sub/bar similarity index 100% rename from bar rename to sub/bar disappear from "git show -C -C" output when file bar is a binary file. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-01Make --color-words work well with --graphBo Yang
'--color-words' algorithm can be described as: 1. collect a the minus/plus lines of a diff hunk, divided into minus-lines and plus-lines; 2. break both minus-lines and plus-lines into words and place them into two mmfile_t with one word for each line; 3. use xdiff to run diff on the two mmfile_t to get the words level diff; And for the common parts of the both file, we output the plus side text. diff_words->current_plus is used to trace the current position of the plus file which printed. diff_words->last_minus is used to trace the last minus word printed. For '--graph' to work with '--color-words', we need to output the graph prefix on each line of color words output. Generally, there are two conditions on which we should output the prefix. 1. diff_words->last_minus == 0 && diff_words->current_plus == diff_words->plus.text.ptr that is: the plus text must start as a new line, and if there is no minus word printed, a graph prefix must be printed. 2. diff_words->current_plus > diff_words->plus.text.ptr && *(diff_words->current_plus - 1) == '\n' that is: a graph prefix must be printed following a '\n' Signed-off-by: Bo Yang <struggleyb.nku@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-01Emit a whole line in one goBo Yang
Since the graph prefix will be printed when calling emit_line, so the functions should be used to emit a complete line out once a time. No one should call emit_line to just output some strings instead of a complete line. Use a strbuf to compose the whole line, and then call emit_line to output it once. Signed-off-by: Bo Yang <struggleyb.nku@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-01diff.c: Output the text graph padding before each diff lineBo Yang
Change output from diff with -p/--dirstat/--binary/--numstat/--stat/ --shortstat/--check/--summary options to align with graph paddings. Thanks Jeff King <peff@peff.net> for reporting the '--summary' bug and his initial patch. Signed-off-by: Bo Yang <struggleyb.nku@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-01Add a prefix output callback to diff outputBo Yang
The callback can be used to add some prefix string to each line of diff output. Signed-off-by: Bo Yang <struggleyb.nku@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-01diff.c: Ensure "index $from..$to" line contains unambiguous SHA1sJohan Herland
In the metainfo section of git diffs there's an "index" line providing abbreviated (unless --full-index is used) blob SHA1s from the pre-/post-images used to generate the diff. These provide hints that can be used to reconstruct a 3-way merge when applying the patch (see the --3way option to 'git am' for more details). In order for this to work, however, the blob SHA1s must not be abbreviated into ambiguity. This patch eliminates the possible ambiguity by using find_unique_abbrev() to produce the abbreviated SHA1s (instead of blind abbreviation by way of "%.*s"). A testcase verifying the fix is also included. Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-21Merge branch 'by/log-follow'Junio C Hamano
* by/log-follow: tests: rename duplicate t4205 Make git log --follow find copies among unmodified files. Make diffcore_std only can run once before a diff_flush Add a macro DIFF_QUEUE_CLEAR.
2010-05-21Merge branch 'tr/word-diff'Junio C Hamano
* tr/word-diff: diff: add --word-diff option that generalizes --color-words Conflicts: diff.c