git/Documentation
Elijah Newren 37a2514364 diffcore-rename: use directory rename guided basename comparisons
A previous commit noted that it is very common for people to move files
across directories while keeping their filename the same.  The last few
commits took advantage of this and showed that we can accelerate rename
detection significantly using basenames; since files with the same
basename serve as likely rename candidates, we can check those first and
remove them from the rename candidate pool if they are sufficiently
similar.

Unfortunately, the previous optimization was limited by the fact that
the remaining basenames after exact rename detection are not always
unique.  Many repositories have hundreds of build files with the same
name (e.g. Makefile, .gitignore, build.gradle, etc.), and may even have
hundreds of source files with the same name.  (For example, the linux
kernel has 100 setup.c, 87 irq.c, and 112 core.c files.  A repository at
$DAYJOB has a lot of ObjectFactory.java and Plugin.java files).

For these files with non-unique basenames, we are faced with the task of
attempting to determine or guess which directory they may have been
relocated to.  Such a task is precisely the job of directory rename
detection.  However, there are two catches: (1) the directory rename
detection code has traditionally been part of the merge machinery rather
than diffcore-rename.c, and (2) directory rename detection currently
runs after regular rename detection is complete.  The 1st catch is just
an implementation issue that can be overcome by some code shuffling.
The 2nd requires us to add a further approximation: we only have access
to exact renames at this point, so we need to do directory rename
detection based on just exact renames.  In some cases we won't have
exact renames, in which case this extra optimization won't apply.  We
also choose to not apply the optimization unless we know that the
underlying directory was removed, which will require extra data to be
passed in to diffcore_rename_extended().  Also, even if we get a
prediction about which directory a file may have relocated to, we will
still need to check to see if there is a file in the predicted
directory, and then compare the two files to see if they meet the higher
min_basename_score threshold required for marking the two files as
renames.

This commit introduces an idx_possible_rename() function which will
do this directory rename detection for us and give us the index within
rename_dst of the resulting filename.  For now, this function is
hardcoded to return -1 (not found) and just hooks up how its results
would be used once we have a more complete implementation in place.

Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-02-26 17:53:11 -08:00
..
RelNotes The seventh batch 2021-02-10 14:48:33 -08:00
config Merge branch 'sj/untracked-files-in-submodule-directory-is-not-dirty' 2021-01-25 14:19:18 -08:00
howto
…
technical Merge branch 'ma/doc-pack-format-varint-for-sizes' into maint 2021-02-08 14:05:54 -08:00
.gitattributes
…
.gitignore
…
CodingGuidelines
…
Makefile mailmap doc: create a new "gitmailmap(5)" man page 2021-01-12 14:04:39 -08:00
MyFirstContribution.txt tests: remove support for GIT_TEST_GETTEXT_POISON 2021-01-21 15:50:01 -08:00
MyFirstObjectWalk.txt MyFirstObjectWalk: drop `init_walken_defaults()` 2020-11-30 13:55:54 -08:00
SubmittingPatches SubmittingPatches: tighten wording on "sign-off" procedure 2021-01-07 15:41:36 -08:00
asciidoc.conf
…
asciidoctor-extensions.rb
…
blame-options.txt blame-options.txt: also mention 'funcname' in '-L' description 2020-11-01 15:54:14 -08:00
build-docdep.perl
…
cat-texi.perl
…
cmd-list.perl
…
config.txt Merge branch 'sn/config-doc-typofix' 2020-12-08 15:11:22 -08:00
date-formats.txt
…
diff-format.txt
…
diff-generate-patch.txt doc/diff-generate-patch: mention new --diff-merges option 2020-12-21 13:47:32 -08:00
diff-options.txt Merge branch 'so/log-diff-merge' 2021-02-05 16:40:44 -08:00
doc-diff
…
docbook-xsl.css
…
docbook.xsl
…
everyday.txto
…
fetch-options.txt fetch: implement support for atomic reference updates 2021-01-12 12:06:15 -08:00
fix-texi.perl
…
git-add.txt
…
git-am.txt Documentation: stylistically normalize references to Signed-off-by: 2020-10-20 11:57:40 -07:00
git-annotate.txt
…
git-apply.txt git-apply.txt: update descriptions of --cached, --index 2020-08-20 16:34:37 -07:00
git-archimport.txt
…
git-archive.txt archive: add --add-file 2020-09-19 15:56:06 -07:00
git-bisect-lk2009.txt git-bisect-lk2009: make continuation of list indented 2020-10-08 14:01:15 -07:00
git-bisect.txt bisect: swap command-line options in documentation 2020-08-28 14:06:06 -07:00
git-blame.txt mailmap doc: create a new "gitmailmap(5)" man page 2021-01-12 14:04:39 -08:00
git-branch.txt doc: clarify that --abbrev=<n> is about the minimum length 2020-11-04 14:04:44 -08:00
git-bugreport.txt
…
git-bundle.txt
…
git-cat-file.txt
…
git-check-attr.txt
…
git-check-ignore.txt
…
git-check-mailmap.txt check-mailmap doc: note config options 2021-01-12 14:04:40 -08:00
git-check-ref-format.txt
…
git-checkout-index.txt
…
git-checkout.txt Merge branch 'dl/checkout-guess' 2020-10-27 15:09:51 -07:00
git-cherry-pick.txt Documentation: stylistically normalize references to Signed-off-by: 2020-10-20 11:57:40 -07:00
git-cherry.txt
…
git-citool.txt
…
git-clean.txt
…
git-clone.txt Documentation/git-clone.txt: document race with --local 2021-01-11 22:03:08 -08:00
git-column.txt
…
git-commit-graph.txt Merge branch 'ds/commit-graph-merging-fix' 2020-11-02 13:17:39 -08:00
git-commit-tree.txt
…
git-commit.txt doc: preparatory clean-up of description on the sign-off option 2020-10-20 11:57:35 -07:00
git-config.txt Merge branch 'ps/config-env-pairs' 2021-01-25 14:19:19 -08:00
git-count-objects.txt
…
git-credential-cache--daemon.txt
…
git-credential-cache.txt
…
git-credential-store.txt
…
git-credential.txt
…
git-cvsexportcommit.txt
…
git-cvsimport.txt
…
git-cvsserver.txt
…
git-daemon.txt
…
git-describe.txt
…
git-diff-files.txt
…
git-diff-index.txt builtin/diff-index: learn --merge-base 2020-09-20 21:30:26 -07:00
git-diff-tree.txt builtin/diff-tree: learn --merge-base 2020-09-21 13:37:03 -07:00
git-diff.txt builtin/diff-tree: learn --merge-base 2020-09-21 13:37:03 -07:00
git-difftool.txt
…
git-fast-export.txt
…
git-fast-import.txt fast-import: fix typo in documentation 2020-10-04 12:56:29 -07:00
git-fetch-pack.txt
…
git-fetch.txt fetch: allow refspecs specified through stdin 2020-08-18 13:25:05 -07:00
git-filter-branch.txt filter-branch doc: fix filter-repo typo 2020-10-20 12:22:25 -07:00
git-fmt-merge-msg.txt
…
git-for-each-ref.txt Doc: prefer more specific file name 2020-09-18 15:41:56 -07:00
git-for-each-repo.txt for-each-repo: run subcommands on configured repos 2020-09-25 10:59:44 -07:00
git-format-patch.txt Merge branch 'jc/format-patch-name-max' 2020-11-21 15:14:38 -08:00
git-fsck-objects.txt
…
git-fsck.txt fsck doc: remove ancient out-of-date diagnostics 2021-01-20 19:10:42 -08:00
git-gc.txt
…
git-get-tar-commit-id.txt
…
git-grep.txt doc: add more pointers to gitattributes(5) for userdiff 2020-11-01 15:54:14 -08:00
git-gui.txt
…
git-hash-object.txt
…
git-help.txt
…
git-http-backend.txt
…
git-http-fetch.txt
…
git-http-push.txt
…
git-imap-send.txt git-imap-send.txt: add note about localized Gmail folders 2020-08-31 11:44:33 -07:00
git-index-pack.txt
…
git-init-db.txt
…
git-init.txt init: document `init.defaultBranch` better 2020-12-13 15:53:50 -08:00
git-instaweb.txt
…
git-interpret-trailers.txt
…
git-log.txt Merge branch 'so/log-diff-merge' 2021-02-05 16:40:44 -08:00
git-ls-files.txt ls-files.c: add --deduplicate option 2021-01-23 11:48:20 -08:00
git-ls-remote.txt
…
git-ls-tree.txt doc: clarify that --abbrev=<n> is about the minimum length 2020-11-04 14:04:44 -08:00
git-mailinfo.txt Doc: show example scissors line 2020-09-28 16:09:04 -07:00
git-mailsplit.txt
…
git-maintenance.txt Merge branch 'ds/maintenance-part-4' 2021-01-15 21:48:45 -08:00
git-merge-base.txt
…
git-merge-file.txt
…
git-merge-index.txt
…
git-merge-one-file.txt
…
git-merge-tree.txt
…
git-merge.txt
…
git-mergetool--lib.txt
…
git-mergetool.txt
…
git-mktag.txt mktag: add a --[no-]strict option 2021-01-06 14:22:24 -08:00
git-mktree.txt
…
git-multi-pack-index.txt
…
git-mv.txt
…
git-name-rev.txt
…
git-notes.txt
…
git-p4.txt doc: fix some typos 2021-01-04 11:27:48 -08:00
git-pack-objects.txt
…
git-pack-redundant.txt
…
git-pack-refs.txt
…
git-patch-id.txt
…
git-prune-packed.txt
…
git-prune.txt
…
git-pull.txt
…
git-push.txt t, doc: update tests, reference for "--force-if-includes" 2020-10-03 09:59:19 -07:00
git-quiltimport.txt
…
git-range-diff.txt
…
git-read-tree.txt
…
git-rebase.txt Documentation: stylistically normalize references to Signed-off-by: 2020-10-20 11:57:40 -07:00
git-receive-pack.txt
…
git-reflog.txt
…
git-remote-ext.txt
…
git-remote-fd.txt
…
git-remote-helpers.txto
…
git-remote.txt remote: add meaningful exit code on missing/existing 2020-10-27 11:40:33 -07:00
git-repack.txt
…
git-replace.txt
…
git-request-pull.txt
…
git-rerere.txt
…
git-reset.txt
…
git-restore.txt Doc: document "A...B" form for <tree-ish> in checkout and switch 2020-10-07 09:49:05 -07:00
git-rev-list.txt
…
git-rev-parse.txt rev-parse: add option for absolute or relative path formatting 2020-12-12 23:35:51 -08:00
git-revert.txt Documentation: stylistically normalize references to Signed-off-by: 2020-10-20 11:57:40 -07:00
git-rm.txt
…
git-send-email.txt Merge branch 'vv/send-email-with-less-secure-apps-access' into maint 2021-02-05 16:31:25 -08:00
git-send-pack.txt
…
git-sh-i18n--envsubst.txt
…
git-sh-i18n.txt
…
git-sh-setup.txt
…
git-shell.txt
…
git-shortlog.txt mailmap doc: create a new "gitmailmap(5)" man page 2021-01-12 14:04:39 -08:00
git-show-branch.txt
…
git-show-index.txt
…
git-show-ref.txt
…
git-show.txt doc/git-show: include --diff-merges description 2020-12-21 13:47:32 -08:00
git-sparse-checkout.txt
…
git-stage.txt
…
git-stash.txt
…
git-status.txt docs: rephrase and clarify the git status --short format 2021-01-11 12:14:07 -08:00
git-stripspace.txt
…
git-submodule.txt
…
git-svn.txt Documentation: stylistically normalize references to Signed-off-by: 2020-10-20 11:57:40 -07:00
git-switch.txt checkout: learn to respect checkout.guess 2020-10-08 09:25:29 -07:00
git-symbolic-ref.txt
…
git-tag.txt Doc: prefer more specific file name 2020-09-18 15:41:56 -07:00
git-tools.txt
…
git-unpack-file.txt
…
git-unpack-objects.txt
…
git-update-index.txt doc: remove "directory cache" from man pages 2021-01-09 22:57:24 -08:00
git-update-ref.txt update-ref: allow creation of multiple transactions 2020-11-16 13:44:01 -08:00
git-update-server-info.txt
…
git-upload-archive.txt
…
git-upload-pack.txt
…
git-var.txt
…
git-verify-commit.txt
…
git-verify-pack.txt
…
git-verify-tag.txt
…
git-web--browse.txt
…
git-whatchanged.txt
…
git-worktree.txt worktree: teach `list` verbose mode 2021-01-30 09:57:40 -08:00
git-write-tree.txt
…
git.txt Merge branch 'ps/config-env-pairs' 2021-01-25 14:19:19 -08:00
gitattributes.txt userdiff: support Bash 2020-10-22 10:29:30 -07:00
gitcli.txt
…
gitcore-tutorial.txt
…
gitcredentials.txt
…
gitcvs-migration.txt
…
gitdiffcore.txt diffcore-rename: use directory rename guided basename comparisons 2021-02-26 17:53:11 -08:00
giteveryday.txt
…
gitfaq.txt docs: explain how to deal with files that are always modified 2020-09-20 21:29:02 -07:00
gitglossary.txt
…
githooks.txt doc: fix some typos 2021-01-04 11:27:48 -08:00
gitignore.txt
…
gitk.txt doc: log, gitk: move '-L' description to 'line-range-options.txt' 2020-11-01 15:54:14 -08:00
gitmailmap.txt mailmap doc: use correct environment variable 'GIT_WORK_TREE' 2021-01-14 21:54:06 -08:00
gitmodules.txt gitmodules.txt: fix 'GIT_WORK_TREE' variable name 2021-01-04 11:29:36 -08:00
gitnamespaces.txt
…
gitremote-helpers.txt
…
gitrepository-layout.txt
…
gitrevisions.txt
…
gitsubmodules.txt gitsubmodules doc: invoke 'ls-files' with '--recurse-submodules' 2020-10-04 12:54:07 -07:00
gittutorial-2.txt
…
gittutorial.txt
…
gitweb.conf.txt
…
gitweb.txt
…
gitworkflows.txt
…
glossary-content.txt glossary: improve "branch" definition 2020-12-02 14:53:42 -08:00
howto-index.sh
…
i18n.txt
…
install-doc-quick.sh
…
install-webdoc.sh
…
line-range-format.txt doc: add more pointers to gitattributes(5) for userdiff 2020-11-01 15:54:14 -08:00
line-range-options.txt blame-options.txt: also mention 'funcname' in '-L' description 2020-11-01 15:54:14 -08:00
lint-gitlink.perl
…
manpage-base-url.xsl.in
…
manpage-bold-literal.xsl
…
manpage-normal.xsl
…
manpage-quote-apos.xsl
…
manpage.xsl
…
merge-options.txt doc: preparatory clean-up of description on the sign-off option 2020-10-20 11:57:35 -07:00
merge-strategies.txt
…
object-format-disclaimer.txt
…
pretty-formats.txt pretty format %(trailers): add a "key_value_separator" 2020-12-09 14:16:42 -08:00
pretty-options.txt doc: clarify that --abbrev=<n> is about the minimum length 2020-11-04 14:04:44 -08:00
pull-fetch-param.txt refspec: add support for negative refspecs 2020-09-30 14:52:00 -07:00
ref-reachability-filters.txt Doc: prefer more specific file name 2020-09-18 15:41:56 -07:00
rev-list-description.txt
…
rev-list-options.txt doc/rev-list-options: document --first-parent changes merges format 2020-12-21 13:47:32 -08:00
revisions.txt
…
sequencer.txt
…
signoff-option.txt Documentation: stylistically normalize references to Signed-off-by: 2020-10-20 11:57:40 -07:00
texi.xsl
…
trace2-target-values.txt
…
transfer-data-leaks.txt
…
urls-remotes.txt
…
urls.txt
…
user-manual.conf
…
user-manual.txt
…