aboutsummaryrefslogtreecommitdiff
path: root/diff-cache.c
Commit message (Collapse)AuthorAge
* [PATCH] Introducing software archaeologist's tool "pickaxe".Junio C Hamano2005-05-21
| | | | | | | | | | | | | | | | | | | | | | | | | | This steals the "pickaxe" feature from JIT and make it available to the bare Plumbing layer. From the command line, the user gives a string he is intersted in. Using the diff-core infrastructure previously introduced, it filters the differences to limit the output only to the diffs between <src> and <dst> where the string appears only in one but not in the other. For example: $ ./git-rev-list HEAD | ./git-diff-tree -Sdiff-tree-helper --stdin -M would show the diffs that touch the string "diff-tree-helper". In real software-archaeologist application, you would typically look for a few to several lines of code and see where that code came from. The "pickaxe" module runs after "rename/copy detection" module, so it even crosses the file rename boundary, as the above example demonstrates. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* [PATCH] Diff overhaul, adding half of copy detection.Junio C Hamano2005-05-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* sparse cleanupLinus Torvalds2005-05-20
| | | | | | | | | Fix various things that sparse complains about: - use NULL instead of 0 - make sure we declare everything properly, or mark it static - use proper function declarations ("fn(void)" instead of "fn()") Sparse is always right.
* [PATCH] diff overhaulJunio C Hamano2005-05-19
| | | | | | | | | | | | | | | | | | | | | | | | This cleans up the way calls are made into the diff core from diff-tree family and diff-helper. Earlier, these programs had "if (generating_patch)" sprinkled all over the place, but those ugliness are gone and handled uniformly from the diff core, even when not generating patch format. This also allowed diff-cache and diff-files to acquire -R (reverse) option to generate diff in reverse. Users of diff-tree can swap two trees easily so I did not add -R there. [ Linus' note: I'll add -R to "diff-tree" too, since a "commit diff" doesn't have another tree to switch around: the other tree is always the parent(s) of the commit ] Also -M<digits-as-mantissa> suggestion made by Linus has been implemented. Documentation updates are also included. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* [PATCH] cleanup of in-code namesAlexey Nezhdanov2005-05-19
| | | | | | | Fixes all in-code names that leaved during "big name change". Signed-off-by: Alexey Nezhdanov <snake@penza-gsm.ru> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* [PATCH] Detect renames in diff family.Junio C Hamano2005-05-19
| | | | | | | | | | | | | | | | | | | | | 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>
* [PATCH] Kill a bunch of pointer sign warnings for gcc4Brian Gerst2005-05-18
| | | | | | | | | - Raw hashes should be unsigned char. - String functions want signed char. - Hash and compress functions want unsigned char. Signed-off By: Brian Gerst <bgerst@didntduck.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* Rename some more cache-related functionsBrad Roberts2005-05-15
| | | | | | | | same_name -> ce_same_name() remove_entry_at() -> remove_cache_entry_at() Signed-off-by: Brad Roberts <braddr@puremagic.com> Signed-off-by: Petr Baudis <pasky@ucw.cz>
* Rename cache_match_stat() to ce_match_stat()Brad Roberts2005-05-15
| | | | | Signed-off-by: Brad Roberts <braddr@puremagic.com> Signed-off-by: Petr Baudis <pasky@ucw.cz>
* Fix usage string of git-diff-cache and add documentation of -m flag.Junio C Hamano2005-05-07
| | | | Signed-off-by: Junio C Hamano <junkio@cox.net>
* diff-cache shows differences for unmerged paths without --cache.Junio C Hamano2005-05-05
| | | | | | | | | | | | | | | | While manually resolving a merge conflict, being able to run diff-cache without --cache option between files in the work tree and either of the ancestor trees is helpful to verify the hand merged result. However, diff-cache refuses to handle unmerged paths, even when run without --cache option. This changes the behaviour so that the above use case will report the differences between the compared tree and the magic 0{40} SHA1 (i.e. "look at the work tree"). When there is no corresponding file in the work tree, or when the command is run with "--cache" option, it continues to report "unmerged". Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-diff-cache: add "-m" flag to match all non-checked-out files with the index.Linus Torvalds2005-05-05
| | | | | This allows you to work with a directory tree that isn't fully populated, without making diff-cache say that all the files are gone.
* [PATCH] git and symlinks as tracked contentKay Sievers2005-05-05
| | | | | | | | | | Allow to store and track symlink in the repository. A symlink is stored the same way as a regular file, only with the appropriate mode bits set. The symlink target is therefore stored in a blob object. This will hopefully make our udev repository fully functional. :) Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* Add "get_sha1()" helper function.Linus Torvalds2005-05-01
| | | | | | | | | | | | This allows the programs to use various simplified versions of the SHA1 names, eg just say "HEAD" for the SHA1 pointed to by the .git/HEAD file etc. For example, this commit has been done with git-commit-tree $(git-write-tree) -p HEAD instead of the traditional "$(cat .git/HEAD)" syntax.
* [PATCH] Rename and extend read_tree_with_tree_or_commit_sha1Junio C Hamano2005-04-28
| | | | | | | | | | | | | | | This patch renames read_tree_with_tree_or_commit_sha1() to read_object_with_reference() and extends it to automatically dereference not just "commit" objects but "tag" objects. With this patch, you can say e.g.: ls-tree $tag read-tree -m $(merge-base $tag $HEAD) $tag $HEAD diff-cache $tag diff-tree $tag $HEAD Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* [PATCH] diff-cache.c compilation warning fix.Junio C Hamano2005-04-28
| | | | | | | | | Nobody uses return value from show_new_file() function but it is defined as returning int and falls off at the end without returning. Make it void. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* diff-cache: handle modified new files correctlyLinus Torvalds2005-04-27
| | | | | | Junio pointed out that diff-cache didn't handle the case of a new file that was different from its index entry correctly. It needs to check the working copy the same way the modified file case did.
* [PATCH] Add -p (patch) to diff-cache.Junio C Hamano2005-04-27
| | | | | | | | This uses the reworked diff interface to generate patches directly out of diff-cache when -p is specified. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* diff-cache: fix handling of unmerged files.Linus Torvalds2005-04-26
| | | | | | | We've always warned about them properly, but we would then do the wrong thing if that filename existed in the tree we were comparing against (we'd think the file has been deleted, because we forgot about the unmerged cases).
* diff-cache.c: use the "U <pathname>" format for unmerged entries.Linus Torvalds2005-04-26
| | | | This makes it match "show-diff" behaviour.
* [PATCH] diff-cache bugletJunio C Hamano2005-04-26
| | | | | | | | | | | diff-cache attempts to first remove all merge entries before letting the diff_cache() do its work, but it incorrectly stops after the first merge-entry it finds. Fix by just replacing the "break" with a "continue". Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* [PATCH] Fix broken diff-cache output on added filesPetr Baudis2005-04-23
| | | | | | | | | Added files were errorneously reported with the - prefix by diff-cache, obviously leading to great confusion. Signed-off-by: Petr Baudis <pasky@ucw.cz> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* New "diff-cache" implementation.Linus Torvalds2005-04-22
| | | | | | | | | | This one is about a million times simpler, and much more likely to be correct too. Instead of trying to match up a tree object against the index, we just read in the tree object side-by-side into the index, and just walk the resulting index file. This was what all the read-tree cleanups were all getting to.
* [PATCH] Usage-string fixes.Junio C Hamano2005-04-20
| | | | | | | | | | | | | | Usage string fixes to make maintenance easier (only one instance of a string to update not multiple copies). I've spotted and corrected inconsistent usage text in diff-tree while doing this. Also diff-cache and read-tree usage text have been corrected to match their up-to-date features. Earlier, neither "--cached" form of diff-cache nor "-m single-merge" form of read-tree were described. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* [PATCH] Teach diff-cache about commit objectsJunio C Hamano2005-04-20
| | | | | | | | | Updates diff-cache.c to use read_tree_with_tree_or_commit_sha1() function. The end-user visible result is the same --- the command takes either tree or commit ID. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* Add "diff-cache" helper program to compare a tree (or commit) withLinus Torvalds2005-04-19
the current cache state and/or working directory. Very useful to see what has changed since the last commit, either in the index file or in the whole working directory. Also very possibly very buggy. Matching the two up is not entirely trivial.