summaryrefslogtreecommitdiff
path: root/diff.c
AgeCommit message (Collapse)Author
2019-10-11Merge branch 'bc/object-id-part17'Junio C Hamano
Preparation for SHA-256 upgrade continues. * bc/object-id-part17: (26 commits) midx: switch to using the_hash_algo builtin/show-index: replace sha1_to_hex rerere: replace sha1_to_hex builtin/receive-pack: replace sha1_to_hex builtin/index-pack: replace sha1_to_hex packfile: replace sha1_to_hex wt-status: convert struct wt_status to object_id cache: remove null_sha1 builtin/worktree: switch null_sha1 to null_oid builtin/repack: write object IDs of the proper length pack-write: use hash_to_hex when writing checksums sequencer: convert to use the_hash_algo bisect: switch to using the_hash_algo sha1-lookup: switch hard-coded constants to the_hash_algo config: use the_hash_algo in abbrev comparison combine-diff: replace GIT_SHA1_HEXSZ with the_hash_algo bundle: switch to use the_hash_algo connected: switch GIT_SHA1_HEXSZ to the_hash_algo show-index: switch hard-coded constants to the_hash_algo blame: remove needless comparison with GIT_SHA1_HEXSZ ...
2019-09-18Merge branch 'cc/multi-promisor'Junio C Hamano
Teach the lazy clone machinery that there can be more than one promisor remote and consult them in order when downloading missing objects on demand. * cc/multi-promisor: Move core_partial_clone_filter_default to promisor-remote.c Move repository_format_partial_clone to promisor-remote.c Remove fetch-object.{c,h} in favor of promisor-remote.{c,h} remote: add promisor and partial clone config to the doc partial-clone: add multiple remotes in the doc t0410: test fetching from many promisor remotes builtin/fetch: remove unique promisor remote limitation promisor-remote: parse remote.*.partialclonefilter Use promisor_remote_get_direct() and has_promisor_remote() promisor-remote: use repository_format_partial_clone promisor-remote: add promisor_remote_reinit() promisor-remote: implement promisor_remote_get_direct() Add initial support for many promisor remotes fetch-object: make functions return an error code t0410: remove pipes after git commands
2019-09-09Merge branch 'jt/diff-lazy-fetch-submodule-fix'Junio C Hamano
On-demand object fetching in lazy clone incorrectly tried to fetch commits from submodule projects, while still working in the superproject, which has been corrected. * jt/diff-lazy-fetch-submodule-fix: diff: skip GITLINK when lazy fetching missing objs
2019-08-20diff: skip GITLINK when lazy fetching missing objsJonathan Tan
In 7fbbcb21b1 ("diff: batch fetching of missing blobs", 2019-04-08), diff was taught to batch the fetching of missing objects when operating on a partial clone, but was not taught to refrain from fetching GITLINKs. Teach diff to check if an object is a GITLINK before including it in the set to be fetched. (As stated in the commit message of that commit, unpack-trees was also taught a similar thing prior, but unpack-trees correctly checks for GITLINK before including objects in the set to be fetched.) Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-08-19patch-id: convert to use the_hash_algobrian m. carlson
Convert the two separate patch-id implementations to use the_hash_algo in their implementation. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-07-29Merge branch 'js/unmap-before-ext-diff' into maintJunio C Hamano
Windows update. * js/unmap-before-ext-diff: diff: munmap() file contents before running external diff
2019-07-25Merge branch 'js/unmap-before-ext-diff'Junio C Hamano
Windows update. * js/unmap-before-ext-diff: diff: munmap() file contents before running external diff
2019-07-11range-diff: suppress line count in outer diffThomas Gummerer
The line count in the outer diff's hunk headers of a range diff is not all that interesting. It merely shows how far along the inner diff are on both sides. That number is of no use for human readers, and range-diffs are not meant to be machine readable. In a subsequent commit we're going to add some more contextual information such as the filename corresponding to the diff to the hunk headers. Remove the unnecessary information, and just keep the "@@" to indicate that a new hunk of the outer diff is starting. Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-07-11diff: munmap() file contents before running external diffJohannes Schindelin
When running an external diff from, say, a diff tool, it is safe to assume that we want to write the files in question. On Windows, that means that there cannot be any other process holding an open handle to said files, or even just a mapped region. So let's make sure that `git diff` itself is not holding any open handle to the files in question. In fact, we will just release the file pair right away, as the external diff uses the files we just wrote, so we do not need to hold the file contents in memory anymore. This fixes https://github.com/git-for-windows/git/issues/1315 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-06-25Use promisor_remote_get_direct() and has_promisor_remote()Christian Couder
Instead of using the repository_format_partial_clone global and fetch_objects() directly, let's use has_promisor_remote() and promisor_remote_get_direct(). This way all the configured promisor remotes will be taken into account, not only the one specified by extensions.partialClone. Also when cloning or fetching using a partial clone filter, remote.origin.promisor will be set to "true" instead of setting extensions.partialClone to "origin". This makes it possible to use many promisor remote just by fetching from them. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-06-13Merge branch 'sb/format-patch-base-patch-id-fix'Junio C Hamano
The "--base" option of "format-patch" computed the patch-ids for prerequisite patches in an unstable way, which has been updated to compute in a way that is compatible with "git patch-id --stable". * sb/format-patch-base-patch-id-fix: format-patch: make --base patch-id output stable format-patch: inform user that patch-id generation is unstable
2019-06-03i18n: fix typos found during l10n for git 2.22.0Jiang Xin
Fix two typos introduced by the following commits: + 31fba9d3b4 (diff-parseopt: convert --[src|dst]-prefix, 2019-03-24) + ed8b4132c8 (remote-curl: mark all error messages for translation, 2019-03-05) Signed-off-by: Jiang Xin <worldhello.net@gmail.com> Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-05-30Merge branch 'ja/diff-opt-typofix'Junio C Hamano
Typofix. * ja/diff-opt-typofix: diff: fix mistake in translatable strings
2019-05-30Merge branch 'nd/diff-parseopt'Junio C Hamano
A brown-paper-bag bugfix to a change already in 'master'. * nd/diff-parseopt: parse-options: check empty value in OPT_INTEGER and OPT_ABBREV diff-parseopt: restore -U (no argument) behavior diff-parseopt: correct variable types that are used by parseopt
2019-05-29diff-parseopt: restore -U (no argument) behaviorNguyễn Thái Ngọc Duy
Before d473e2e0e8 (diff.c: convert -U|--unified, 2019-01-27), -U and --unified are implemented with a custom parser opt_arg() in diff.c. I didn't check this code carefully and not realize that it's the equivalent of PARSE_OPT_NONEG | PARSE_OPT_OPTARG. In other words, if -U is specified without any argument, the option should be accepted, and the default value should be used. Without PARSE_OPT_OPTARG, parse_options() will reject this case and cause a regression. Reported-by: Bryan Turner <bturner@atlassian.com> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-05-19diff: fix mistake in translatable stringsJean-Noël Avila
Signed-off-by: Jean-Noël Avila <jn.avila@free.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-05-08format-patch: make --base patch-id output stableStephen Boyd
We weren't flushing the context each time we processed a hunk in the patch-id generation code in diff.c, but we were doing that when we generated "stable" patch-ids with the 'patch-id' tool. Let's port that similar logic over from patch-id.c into diff.c so we can get the same hash when we're generating patch-ids for 'format-patch --base=' types of command invocations. Cc: Xiaolong Ye <xiaolong.ye@intel.com> Signed-off-by: Stephen Boyd <sboyd@kernel.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-04-25Merge branch 'jt/batch-fetch-blobs-in-diff'Junio C Hamano
While running "git diff" in a lazy clone, we can upfront know which missing blobs we will need, instead of waiting for the on-demand machinery to discover them one by one. Aim to achieve better performance by batching the request for these promised blobs. * jt/batch-fetch-blobs-in-diff: diff: batch fetching of missing blobs sha1-file: support OBJECT_INFO_FOR_PREFETCH
2019-04-25Merge branch 'nd/diff-parseopt-4'Junio C Hamano
Fourth batch to teach the diff machinery to use the parse-options API. * nd/diff-parseopt-4: am: avoid diff_opt_parse() diff --no-index: use parse_options() instead of diff_opt_parse() range-diff: use parse_options() instead of diff_opt_parse() diff.c: allow --no-color-moved-ws diff-parseopt: convert --color-moved-ws diff-parseopt: convert --[no-]color-moved diff-parseopt: convert --inter-hunk-context diff-parseopt: convert --no-prefix diff-parseopt: convert --line-prefix diff-parseopt: convert --[src|dst]-prefix diff-parseopt: convert --[no-]abbrev diff-parseopt: convert --diff-filter diff-parseopt: convert --find-object diff-parseopt: convert -O diff-parseopt: convert --pickaxe-all|--pickaxe-regex diff-parseopt: convert -S|-G diff-parseopt: convert -l diff-parseopt: convert -z diff-parseopt: convert --ita-[in]visible-in-index diff-parseopt: convert --ws-error-highlight
2019-04-16Merge branch 'nd/diff-parseopt-3'Junio C Hamano
Third batch to teach the diff machinery to use the parse-options API. * nd/diff-parseopt-3: diff-parseopt: convert --submodule diff-parseopt: convert --ignore-submodules diff-parseopt: convert --textconv diff-parseopt: convert --ext-diff diff-parseopt: convert --quiet diff-parseopt: convert --exit-code diff-parseopt: convert --color-words diff-parseopt: convert --word-diff-regex diff-parseopt: convert --word-diff diff-parseopt: convert --[no-]color diff-parseopt: convert --[no-]follow diff-parseopt: convert -R diff-parseopt: convert -a|--text diff-parseopt: convert --full-index diff-parseopt: convert --binary diff-parseopt: convert --anchored diff-parseopt: convert --diff-algorithm diff-parseopt: convert --histogram diff-parseopt: convert --patience diff-parseopt: convert --[no-]indent-heuristic
2019-04-08diff: batch fetching of missing blobsJonathan Tan
When running a command like "git show" or "git diff" in a partial clone, batch all missing blobs to be fetched as one request. This is similar to c0c578b33c ("unpack-trees: batch fetching of missing blobs", 2017-12-08), but for another command. Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-03-24am: avoid diff_opt_parse()Nguyễn Thái Ngọc Duy
diff_opt_parse() is a heavy hammer to just set diff filter. But it's the only way because of the diff_status_letters[] mapping. Add a new API to set diff filter and use it in git-am. diff_opt_parse()'s only remaining call site in revision.c will be gone soon and having it here just because of git-am does not make sense. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-03-24diff.c: allow --no-color-moved-wsNguyễn Thái Ngọc Duy
This option is added in commit b73bcbac4a (diff: allow --no-color-moved-ws - 2018-11-23) in pw/diff-color-moved-ws-fix. To ease merge conflict resolution, re-implement the option handling here so that the conflict could be resolved by taking this side of change. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-03-24diff-parseopt: convert --color-moved-wsNguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-03-24diff-parseopt: convert --[no-]color-movedNguyễn Thái Ngọc Duy
Mark one more string for translation while at there Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-03-24diff-parseopt: convert --inter-hunk-contextNguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-03-24diff-parseopt: convert --no-prefixNguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-03-24diff-parseopt: convert --line-prefixNguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-03-24diff-parseopt: convert --[src|dst]-prefixNguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-03-24diff-parseopt: convert --[no-]abbrevNguyễn Thái Ngọc Duy
OPT__ABBREV() has the same behavior as the deleted code with one difference: it does check for valid number and error out if not. And the '40' change is self explanatory. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-03-24diff-parseopt: convert --diff-filterNguyễn Thái Ngọc Duy
While at it, mark one more string for translation Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-03-24diff-parseopt: convert --find-objectNguyễn Thái Ngọc Duy
While at it, mark one more string for translation. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-03-24diff-parseopt: convert -ONguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-03-24diff-parseopt: convert --pickaxe-all|--pickaxe-regexNguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-03-24diff-parseopt: convert -S|-GNguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-03-24diff-parseopt: convert -lNguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-03-24diff-parseopt: convert -zNguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-03-24diff-parseopt: convert --ita-[in]visible-in-indexNguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-03-24diff-parseopt: convert --ws-error-highlightNguyễn Thái Ngọc Duy
Mark one more string for translation while at there. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-03-07Merge branch 'nd/diff-parseopt-2'Junio C Hamano
Second batch to teach the diff machinery to use the parse-options API. * nd/diff-parseopt-2: (21 commits) diff-parseopt: convert --ignore-some-changes diff-parseopt: convert --[no-]minimal diff-parseopt: convert --relative diff-parseopt: convert --no-renames|--[no--rename-empty diff-parseopt: convert --find-copies-harder diff-parseopt: convert -C|--find-copies diff-parseopt: convert -D|--irreversible-delete diff-parseopt: convert -M|--find-renames diff-parseopt: convert -B|--break-rewrites diff-parseopt: convert --output-* diff-parseopt: convert --[no-]compact-summary diff-parseopt: convert --stat* diff-parseopt: convert -s|--no-patch diff-parseopt: convert --name-status diff-parseopt: convert --name-only diff-parseopt: convert --patch-with-stat diff-parseopt: convert --summary diff-parseopt: convert --check diff-parseopt: convert --dirstat and friends diff-parseopt: convert --numstat and --shortstat ...
2019-03-07Merge branch 'nd/completion-more-parameters'Junio C Hamano
The command line completion (in contrib/) has been taught to complete more subcommand parameters. * nd/completion-more-parameters: completion: add more parameter value completion
2019-03-07Merge branch 'jk/unused-params'Junio C Hamano
Code clean-up. * jk/unused-params: ref-filter: drop unused "sz" parameters ref-filter: drop unused "obj" parameters ref-filter: drop unused buf/sz pairs files-backend: drop refs parameter from split_symref_update() pack-objects: drop unused parameter from oe_map_new_pack() merge-recursive: drop several unused parameters diff: drop complete_rewrite parameter from run_external_diff() diff: drop unused emit data parameter from sane_truncate_line() diff: drop unused color reset parameters diff: drop options parameter from diffcore_fix_diff_index()
2019-03-07Merge branch 'nd/diff-parseopt'Junio C Hamano
The diff machinery, one of the oldest parts of the system, which long predates the parse-options API, uses fairly long and complex handcrafted option parser. This is being rewritten to use the parse-options API. * nd/diff-parseopt: diff.c: convert --raw diff.c: convert -W|--[no-]function-context diff.c: convert -U|--unified diff.c: convert -u|-p|--patch diff.c: prepare to use parse_options() for parsing diff.h: avoid bit fields in struct diff_flags diff.h: keep forward struct declarations sorted parse-options: allow ll_callback with OPTION_CALLBACK parse-options: avoid magic return codes parse-options: stop abusing 'callback' for lowlevel callbacks parse-options: add OPT_BITOP() parse-options: disable option abbreviation with PARSE_OPT_KEEP_UNKNOWN parse-options: add one-shot mode parse-options.h: remove extern on function prototypes
2019-03-06diff-parseopt: convert --submoduleNguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-03-06diff-parseopt: convert --ignore-submodulesNguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-03-06diff-parseopt: convert --textconvNguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-03-06diff-parseopt: convert --ext-diffNguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-03-06diff-parseopt: convert --quietNguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-03-06diff-parseopt: convert --exit-codeNguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-03-06diff-parseopt: convert --color-wordsNguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>