1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-06 17:23:00 +01:00
Commit graph

9 commits

Author SHA1 Message Date
Junio C Hamano
427dcb4bca [PATCH] Diff overhaul, adding half of copy detection.
This introduces the diff-core, the layer between the diff-tree
family and the external diff interface engine.  The calls to the
interface diff-tree family uses (diff_change and diff_addremove)
have not changed and will not change.  The purpose of the
diff-core layer is to provide an infrastructure to transform the
set of differences sent from the applications, before sending
them to the external diff interface.

The recently introduced rename detection code has been rewritten
to use the diff-core facility.  When applications send in
separate creates and deletes, matching ones are transformed into
a single rename-and-edit diff, and sent out to the external diff
interface as such.

This patch also enhances the rename detection code further to be
able to detect copies.  Currently this happens only as long as
copy sources appear as part of the modified files, but there
already is enough provision for callers to report unmodified
files to diff-core, so that they can be also used as copy source
candidates.  Extending the callers this way will be done in a
separate patch.

Please see and marvel at how well this works by trying out the
newly added t/t4003-diff-rename-1.sh test script.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-21 09:58:03 -07:00
Junio C Hamano
5c97558c9a [PATCH] Detect renames in diff family.
This rips out the rename detection engine from diff-helper and moves it
to the diff core, and updates the internal calling convention used by
diff-tree family into the diff core.  In order to give the same option
name to diff-tree family as well as to diff-helper, I've changed the
earlier diff-helper '-r' option to '-M' (stands for Move; sorry but the
natural abbreviation 'r' for 'rename' is already taken for 'recursive').

Although I did a fair amount of test with the git-diff-tree with
existing rename commits in the core GIT repository, this should still be
considered beta (preview) release.  This patch depends on the diff-delta
infrastructure just committed.

This implements almost everything I wanted to see in this series of
patch, except a few minor cleanups in the calling convention into diff
core, but that will be a separate cleanup patch.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-19 08:59:40 -07:00
Junio C Hamano
e4f5b8c69d Fix thinko in the logic to refuse unmerged path fed to git-apply-patch-script.
An unmerged path is given as the sole parameter to the script, so it
should check against $# being 1, not 2.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-05-07 00:48:00 -07:00
Junio C Hamano
fc54a9c30c Update git-apply-patch-script for symbolic links.
This patch updates the git-apply-patch-script for the symbolic links
in the cache, recently added by Kay Sievers.

It currently is very anal about symbolic link changes.  It refuses to
change between a regular file and a symbolic link, and only allows
symbolic link changes if the patch is based on the same original.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-05-05 16:14:01 -07:00
Junio C Hamano
8a9d32b7e9 When the patch tries to create a new file and the file exists, abort.
This fixes an error introduced to git-apply-patch-script in the previous
round.  We do not invoke patch for create/delete case, so we need to
be a bit careful about detecting conflicts like this.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-05-04 10:45:36 -07:00
Junio C Hamano
6fa28064b0 Terminate diff-* on non-zero exit from GIT_EXTERNAL_DIFF
(slightly updated from the version posted to the GIT mailing list
with small bugfixes).

This patch changes the git-apply-patch-script to exit non-zero when
the patch cannot be applied.  Previously, the external diff driver
deliberately ignored the exit status of GIT_EXTERNAL_DIFF command,
which was a design mistake.  It now stops the processing when
GIT_EXTERNAL_DIFF exits non-zero, so the damages from running
git-diff-* with git-apply-patch-script between two wrong trees can be
contained.

The "diff" command line generated by the built-in driver is changed to
always exit 0 in order to match this new behaviour.  I know Pasky does
not use GIT_EXTERNAL_DIFF yet, so this change should not break Cogito,
either.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-05-04 01:38:06 -07:00
Junio C Hamano
285bf834be Make git-apply-patch-script executable. 2005-05-01 23:17:28 -07:00
Junio C Hamano
7fa76eeb75 [PATCH] typo fixes to git-apply-patch-script
When git-apply-patch-script creates a new file without
executable mode set, a typo caused it not to report that
activity to the user.  Also it was mistakenly running
git-update-cache twice for newly created or deleted paths.  This
patch fixes these problems.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-01 21:09:28 -07:00
Junio C Hamano
5d2f8b2753 [PATCH] Add git-apply-patch-script.
I said:

     - Stop attempting to be compatible with cg-patch, and drop
       (mode:XXXXXX) bits from the diff.

     - Do keep the /dev/null change for created and deleted case.

     - No "Index:" line, no "Mode change:" line, anywhere in the
       output.  Anything that wants the mode bits and sha1 hash can
       do things from GIT_EXTERNAL_DIFF mechanism.  Maybe document
       suggested usage better.

This adds an example script git-apply-patch-script, that can be
used as the GIT_EXTERNAL_DIFF to apply changes between two trees
directly on the current work tree, like this:

 GIT_EXTERNAL_DIFF=git-apply-patch-script git-diff-tree -p <tree> <tree>

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-01 09:33:12 -07:00