aboutsummaryrefslogtreecommitdiff
path: root/read-tree.c
Commit message (Collapse)AuthorAge
* Documentation: read-tree --aggressiveJunio C Hamano2006-03-02
| | | | Signed-off-by: Junio C Hamano <junkio@cox.net>
* Merge branch 'maint'Junio C Hamano2006-03-01
|\ | | | | | | | | * maint: read-tree --aggressive: remove deleted entry from the working tree.
| * read-tree --aggressive: remove deleted entry from the working tree.Junio C Hamano2006-03-01
| | | | | | | | | | | | | | | | | | | | When both heads deleted, or our side deleted while the other side did not touch, we did not have to update the working tree. However, we forgot to remove existing working tree file when we did not touch and the other side did. Signed-off-by: Junio C Hamano <junkio@cox.net>
* | Merge fixes early for next maint series.Junio C Hamano2006-02-23
|\ \ | |/
| *-. Merge branches 'jc/fix-co-candy', 'jc/fix-rename-leak' and 'ar/fix-win' into ↵Junio C Hamano2006-02-23
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | maint * jc/fix-co-candy: checkout - eye candy. * jc/fix-rename-leak: diffcore-rename: plug memory leak. * ar/fix-win: fix t5600-clone-fail-cleanup.sh on windows
| | * | checkout - eye candy.Junio C Hamano2006-02-22
| | |/ | | | | | | | | | | | | | | | | | | | | | This implements "eye candy" similar to the pack-object/unpack-object to entertain users while a large tree is being checked out after a clone or a pull. Signed-off-by: Junio C Hamano <junkio@cox.net>
| * | Give no terminating LF to error() function.Junio C Hamano2006-02-22
| |/ | | | | | | Signed-off-by: Junio C Hamano <junkio@cox.net>
* | "Assume unchanged" gitJunio C Hamano2006-02-08
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds "assume unchanged" logic, started by this message in the list discussion recently: <Pine.LNX.4.64.0601311807470.7301@g5.osdl.org> This is a workaround for filesystems that do not have lstat() that is quick enough for the index mechanism to take advantage of. On the paths marked as "assumed to be unchanged", the user needs to explicitly use update-index to register the object name to be in the next commit. You can use two new options to update-index to set and reset the CE_VALID bit: git-update-index --assume-unchanged path... git-update-index --no-assume-unchanged path... These forms manipulate only the CE_VALID bit; it does not change the object name recorded in the index file. Nor they add a new entry to the index. When the configuration variable "core.ignorestat = true" is set, the index entries are marked with CE_VALID bit automatically after: - update-index to explicitly register the current object name to the index file. - when update-index --refresh finds the path to be up-to-date. - when tools like read-tree -u and apply --index update the working tree file and register the current object name to the index file. The flag is dropped upon read-tree that does not check out the index entry. This happens regardless of the core.ignorestat settings. Index entries marked with CE_VALID bit are assumed to be unchanged most of the time. However, there are cases that CE_VALID bit is ignored for the sake of safety and usability: - while "git-read-tree -m" or git-apply need to make sure that the paths involved in the merge do not have local modifications. This sacrifices performance for safety. - when git-checkout-index -f -q -u -a tries to see if it needs to checkout the paths. Otherwise you can never check anything out ;-). - when git-update-index --really-refresh (a new flag) tries to see if the index entry is up to date. You can start with everything marked as CE_VALID and run this once to drop CE_VALID bit for paths that are modified. Most notably, "update-index --refresh" honours CE_VALID and does not actively stat, so after you modified a file in the working tree, update-index --refresh would not notice until you tell the index about it with "git-update-index path" or "git-update-index --no-assume-unchanged path". This version is not expected to be perfect. I think diff between index and/or tree and working files may need some adjustment, and there probably needs other cases we should automatically unmark paths that are marked to be CE_VALID. But the basics seem to work, and ready to be tested by people who asked for this feature. Signed-off-by: Junio C Hamano <junkio@cox.net>
* read-tree --aggressiveJunio C Hamano2006-02-06
| | | | | | | | | | | A new flag --aggressive resolves what we traditionally resolved with external git-merge-one-file inside index while read-tree 3-way merge works. git-merge-octopus and git-merge-resolve use this flag before running git-merge-index with git-merge-one-file. Signed-off-by: Junio C Hamano <junkio@cox.net>
* avoid asking ?alloc() for zero bytes.Junio C Hamano2005-12-26
| | | | | | | | Avoid asking for zero bytes when that change simplifies overall logic. Later we would change the wrapper to ask for 1 byte on platforms that return NULL for zero byte request. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Make the rest of commands work from a subdirectory.Junio C Hamano2005-11-28
| | | | | | | | | | These commands are converted to run from a subdirectory. commit-tree convert-objects merge-base merge-index mktag pack-objects pack-redundant prune-packed read-tree tar-tree unpack-file unpack-objects update-server-info write-tree Signed-off-by: Junio C Hamano <junkio@cox.net>
* ls-files and read-tree need core.filemodeAlex Riesen2005-11-08
| | | | | | | | | ls-files.c and read-tree.c miss the default configuration, in particular the filemode=false part. The recent +x bit flip made me notice that, because git-merge refused to merge anything saying that git-pull.sh is not up to date. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Remove empty directories after read-tree -u.Junio C Hamano2005-10-10
| | | | | | | This fixes everybody's favorite gripe that switching branche with 'git checkout' leaves empty directories. Signed-off-by: Junio C Hamano <junkio@cox.net>
* read-tree: --trivialLinus Torvalds2005-10-02
| | | | | | | | This adds an option --trivial to restrict 3-way 'read-tree -m -u' to happen only if there is no file-level merging required. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* read-tree: remove --head option.Junio C Hamano2005-10-02
| | | | | | | Initially it was to allow specifying more than one remote to allow creation of an Octopus, but it is not being used. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Document -i flag to git-read-treeJunio C Hamano2005-09-20
| | | | | | | | Somehow I missed it when we updated read-tree to support the recursive merge strategy. Also -i should require -m as well, which the command did not check. Signed-off-by: Junio C Hamano <junkio@cox.net>
* read-tree: fix bogus debugging statement.Junio C Hamano2005-09-13
| | | | | | | We wanted to detect case #16 which should be rare, but botched the case when some paths are missing, causing a segfault. My fault. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Add a new merge strategy by Fredrik Kuivinen.Junio C Hamano2005-09-10
| | | | | | | | | | | I really wanted to try this out, instead of asking for an adjustment to the 'git merge' driver and waiting. For now the new strategy is called 'fredrik' and not in the list of default strategies to be tried. The script wants Python 2.4 so this commit also adjusts Debian and RPM build procecure files. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Plug leak in Daniel's read-tree.Junio C Hamano2005-09-10
| | | | | | ... and it is ready to be pushed out in the "master" branch. Signed-off-by: Junio C Hamano <junkio@cox.net>
* [PATCH] Add debugging help for case #16 to read-tree.cJunio C Hamano2005-09-10
| | | | | | | | This will help us detect if real-world example merges have multiple merge-base candidates and one of them matches one head while another matches the other head. Signed-off-by: Junio C Hamano <junkio@cox.net>
* [PATCH] Disable debugging from read-tree.Junio C Hamano2005-09-10
| | | | Signed-off-by: Junio C Hamano <junkio@cox.net>
* [PATCH] Rewrite read-treeDaniel Barkalow2005-09-10
| | | | | | | Adds support for multiple ancestors, removes --emu23, much simplification. Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* [PATCH] Unify usage strings declarationPetr Baudis2005-07-29
| | | | | | | | | All usage strings are now declared as static const char []. This is carried over from my old git-pb branch. Signed-off-by: Petr Baudis <pasky@ucw.cz> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Start adding interfaces to read in partial treesLinus Torvalds2005-07-14
| | | | | The same way "git-diff-tree" can limit its output to just a set of matches, we can read in just a partial tree for comparison purposes.
* git-read-tree: fix "--reset" handlingLinus Torvalds2005-06-15
|
* [PATCH] read-tree: loosen too strict index requirementsJunio C Hamano2005-06-12
| | | | | | | | | | | | This patch teaches read-tree 3-way merge that, when only "the other tree" changed a path, and if the index file already has the same change, we are not in a situation that would clobber the index and the work tree, and lets the merge succeed; this is case #14ALT in t1000 test. It does not change the result of the merge, but prevents it from failing when it does not have to. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* [PATCH] Finish making --emu23 equivalent to pure 2-way merge.Junio C Hamano2005-06-12
| | | | | | | | | | | | | | | | | This adds #3ALT rule (and #2ALT rule for symmetry) to the read-tree 3-way merge logic that collapses paths that are added only in one branch and not in the other internally. This makes --emu23 to succeed in the last remaining case where the pure 2-way merge succeeded and earlier one failed. Running diff between t1001 and t1005 test scripts shows that the only difference between the two is that --emu23 can leave the states into separate stages so that the user can use usual 3-way merge resolution techniques to carry forward the local changes when pure 2-way merge would have refused to run. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* [PATCH] read-tree: fix too strong index requirement #5ALTJunio C Hamano2005-06-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes too strong index requirement 3-way merge enforces in one case: the same file is added in both branches. In this case, the original code insisted that if the index file has that path, it must match our branch and be up-to-date. However in this particular case, it only has to match it, and can be dirty. We just need to make sure that we keep the work-tree copy instead of checking out the merge result. The resolution of such a path, however, cannot be left to outside script, because we will not keep the original stage0 entries for unmerged paths when read-tree finishes, and at that point, the knowledge of "if we resolve it to match the new file added in both branches, the merge succeeds and the work tree would not lose information, but we should _not_ update the work tree from the resulting index file" is lost. For this reason, the now code needs to resolve this case (#5ALT) internally. This affects some existing tests in the test suite, but all in positive ways. In t1000 (3-way test), this #5ALT case now gets one stage0 entry, instead of an identical stage2 and stage3 entry pair, for such a path, and one test that checked for merge failure (because the test assumed the "stricter-than-necessary" behaviour) does not have to fail anymore. In t1005 (emu23 test), two tests that involves a case where the work tree already had a change introduced in the upstream (aka "merged head"), the merge succeeds instead of failing. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* [PATCH] read-tree --emu23.Junio C Hamano2005-06-12
| | | | | | | | | | | | | | | | | | | | This new flag causes two-way fast forward to internally use the three-way merge mechanism. This behaviour is intended to offer a better fast forward semantics when used in a dirty work tree. The new test t1005 is parallel to the existing t1001 "pure 2-way" tests, but some parts that are commented out would fail. These failures are due to three-way merge enforcing too strict index requirements for cases that could succeed. This problem will be addressed by later patches. Without even changing three-way mechanism, the --emu23 two-way fast forward already gives the user an easier-to-handle merge result when a file that "merged head" updates has local modifications. This is demonstrated as "case 16" test in t1005. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* git-read-tree: remove deleted files in the working directoryLinus Torvalds2005-06-09
| | | | Only when "-u" is used of course.
* git-read-tree: add "--reset" flagLinus Torvalds2005-06-09
| | | | | | | | | | | | | | | | This is the same as "-m", but it will silently ignore any unmerged entries, which makes it useful for efficiently forcing a new position regardless of the state of the current index file. IOW, to reset to a previous HEAD (in case you have had a failed merge, for example), you'd just do git-read-tree -u --reset HEAD which will also update your working tree to the right state. NOTE! The "update" will not remove files that may have been added by the merge. Yet.
* git-read-tree: -u without -m is meaningless. Don't allow it.Linus Torvalds2005-06-07
| | | | Also, documetn the "-u" in the usage string.
* git-read-tree: make one-way merge also honor the "update" flagLinus Torvalds2005-06-07
| | | | It didn't set CE_UPDATE before, so "-u" was a no-op.
* [PATCH] read-tree: save more user hassles during fast-forward.Junio C Hamano2005-06-07
| | | | | | | | | | | | This implements the "never lose the current cache information or the work tree state, but favor a successful merge over merge failure" principle in the fast-forward two-tree merge operation. It comes with a set of tests to cover all the cases described in the case matrix found in the new documentation. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* git-read-tree: some "final" cleanupsLinus Torvalds2005-06-06
| | | | | | Looking good, but hey, it's not like I even have a real testcase for any of this. But unlike the mess that this was yerstday, today read-cache is pretty readable and understandable. Which is always a good sign.
* git-read-tree: simplify merge loops enormouslyLinus Torvalds2005-06-06
| | | | | | | | | Stop trying to haev this stateful thing that keeps track of what it has seen, and use a much simpler "gather all the different stages with the same name together and just merge them in one go" approach. Makes it a lot more understandable, and allows the different merge algorithms to share the basic merge loop.
* [PATCH] index locking like everybody elseJunio C Hamano2005-06-06
| | | | | | | | This patch teaches read-tree how to use the index file locking helpers the same way "checkout-cache -u" and "update-cache" do. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* Fix off-by-one in new three-way-merge updatesLinus Torvalds2005-06-05
| | | | | | | | | That's the final one ("Yeah, sure, we believe you"). Anyway, at least the tests pass, which is not saying a lot, since they don't end up testing all the new the things that the new merge world order tries to do. But hopefully we're now at least not any worse off than we were before the rewrite.
* Three-way merge: fix silly bug that made trivial merges not workLinus Torvalds2005-06-05
| | | | | | Making the main loop look more like the one- and two-way cases introduced a bug where "src" had been updated early, but later users hadn't been adjusted to match.
* git-read-tree: fix up two-way mergeLinus Torvalds2005-06-05
| | | | This is starting to look better.
* More work on merging with git-read-tree..Linus Torvalds2005-06-05
| | | | | | | | | Add a "-u" flag to update the tree as a result of a merge. Right now this code is way too anal about things, and fails merges it shouldn't, but let me fix up the different cases and this will allow for much smoother merging even in the presense of dirty data in the working tree.
* git-read-tree: fix up three-way merge testsLinus Torvalds2005-06-05
| | | | | When we collapse three entries, we need to check all of the collapsed entries against the old pre-merge state.
* git-read-tree: be a lot more careful about merging dirty treesLinus Torvalds2005-06-05
| | | | | | | | We don't want to overwrite state that we haven't committed yet when merging, so it's better to make git-read-tree fail than end up with a merge tree that ends up not having the dirty changes. Update git-resolve-script to fail cleanly when git-read-tree fails.
* 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] 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>
* Fixed a leak in read-treePetr Baudis2005-05-11
| | | | unpack_tree() would not free the tree object it has read.
* 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>
* Move "read_tree()" to "tree.c" to be used as a generic helper function.Linus Torvalds2005-04-22
| | | | Next step: make "diff-cache" use it.
* Clean up and simplify read-tree a bit.Linus Torvalds2005-04-22
| | | | | This is preparation for moving parts of it into "tree.c" to be used as a library function.