aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* git-diff: squelch "empty" diffsJunio C Hamano2007-08-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | After starting to edit a working tree file but later when your edit ends up identical to the original (this can also happen when you ran a wholesale regexp replace with something like "perl -i" that does not actually modify many of the paths), "git diff" between the index and the working tree outputs many "empty" diffs that show "diff --git" headers and nothing else, because these paths are stat-dirty. While it was a way to warn the user that the earlier action of the user made the index ineffective as an optimization mechanism, it was felt too loud for the purpose of warning even to experienced users, and also resulted in confusing people new to git. This replaces the "empty" diffs with a single warning message at the end. Having many such paths hurts performance, and you can run "git-update-index --refresh" to update the lstat(2) information recorded in the index in such a case. "git-status" does so as a side effect, and that is more familiar to the end-user, so we recommend it to them. The change affects only "git diff" that outputs patch text, because that is where the annoyance of too many "empty" diff is most strongly felt, and because the warning message can be safely ignored by downstream tools without getting mistaken as part of the patch. For the low-level "git diff-files" and "git diff-index", the traditional behaviour is retained. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Improved hint on how to set identitySteffen Prohaska2007-08-13
| | | | | | | | | | | The first thing we teach in the tutorial is to set the default identity in $HOME/.gitconfig using "git config --global". The suggestion in the error message should match the order, while hinting that per repository identity can later be configured differently. Signed-off-by: Steffen Prohaska <prohaska@zib.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Add a test for git-commit being confused by relative GIT_DIRDavid Kastrup2007-08-13
| | | | | Signed-off-by: David Kastrup <dak@gnu.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git-sh-setup.sh: make GIT_DIR absoluteDavid Kastrup2007-08-13
| | | | | | | | | | | | | | | | Quite a few of the scripts are rather careless about using GIT_DIR while changing directories. Some try their hands (with different likelihood of success) in making GIT_DIR absolute. This patch lets git-sh-setup.sh cater for absolute directories (in a way that should work reliably also with non-Unix path names) and removes the respective kludges in git-filter-branch.sh and git-instaweb.sh. Signed-off-by: David Kastrup <dak@gnu.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Allow git-svnimport to take "" as the trunk directory.Alberto Bertogli2007-08-13
| | | | | | | | | | | | | | Some repositories started with the trunk in "/" and then moved it to the standard "trunk/" location. On these repositories, the correct thing would be to call git-svnimport -T "", but because of the way the options are handled, it uses the default "trunk" instead of the given empty string. This patch fixes that behaviour. Reported by Leandro Lucarella <llucax@gmail.com>. Signed-off-by: Alberto Bertogli <albertito@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Fix t5701-clone-local for white space from wcBrian Gernhardt2007-08-13
| | | | | Signed-off-by: Brian Gernhardt <benji@silverinsanity.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git-p4: Fix the sorting of changelists when cloning a Perforce repository.Reece H. Dunn2007-08-13
| | | | | | | | | | | When performing a git-p4 clone operation on a Perforce repository, where the changelists change in order of magnitude (e.g. 100 to 1000), the set of changes to import from is not sorted properly. This is because the data in the list is strings not integers. The other place where this is done already converts the value to an integer, so it is not affected. Acked-by: Simon Hausmann <simon@lst.de>
* diff: don't run pager if user asked for a diff style exit codeRené Scharfe2007-08-13
| | | | | | | | | | | | | As Wincent Colaiuta found out, it's a bit unexpected for git diff to start a pager even when the --quiet option is specified. The problem is that the pager hides the return code -- which is the only output we're interested in in this case. Push pager setup down into builtin-diff.c and don't start the pager if --exit-code or --quiet (which implies --exit-code) was specified. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* builtin-bundle create - use lock_fileJunio C Hamano2007-08-13
| | | | | | | "git bundle create" left an invalid, partially written bundle if an error occured during creation. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* t3902 - skip test if file system doesn't support HT in namesMark Levedahl2007-08-13
| | | | | | | | Windows / cygwin don't support HT, LF, or TAB in file name so this test is meaningless there. Signed-off-by: Mark Levedahl <mdl123@verizon.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git-add: Add support for --refresh option.Alexandre Julliard2007-08-13
| | | | | | | | This allows to refresh only a subset of the project files, based on the specified pathspecs. Signed-off-by: Alexandre Julliard <julliard@winehq.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* t3404: fix "fake-editor"Junio C Hamano2007-08-13
| | | | | | | | | | | | Here-text to create fake-editor did not use <<\EOF but <<EOF, but there was no point doing so, as it quoted all the variables anyway. Simplify it. Also futureproof the special mode to edit COMMIT_EDITMSG file; it is interested in editing the COMMIT_EDITMSG file in any GIT_DIR; GIT_DIR may be given as an absolute path. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git.el: Always set the current directory in the git-diff buffer.Alexandre Julliard2007-08-13
| | | | | | | This allows jumping to the correct file with the diff-mode commands. Signed-off-by: Alexandre Julliard <julliard@winehq.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git.el: Add support for interactive diffs.Alexandre Julliard2007-08-13
| | | | | Signed-off-by: Alexandre Julliard <julliard@winehq.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'master' of git://git.kernel.org/pub/scm/gitk/gitkJunio C Hamano2007-08-13
|\ | | | | | | | | | | | | | | | | | | | | | | * 'master' of git://git.kernel.org/pub/scm/gitk/gitk: gitk: Fix bug causing Tcl error when updating graph gitk: Fix bug introduced in commit 67a4f1a7 [PATCH] gitk: Show an error and exit if no .git could be found [PATCH] gitk: Continue and show error message in new repos [PATCH] gitk: Handle MouseWheel events on Windows [PATCH] gitk: Enable selected patch text on Windows gitk: Fix bug causing the "can't unset idinlist(...)" error gitk: Add a context menu for file list entries
| * gitk: Fix bug causing Tcl error when updating graphPaul Mackerras2007-08-13
| | | | | | | | | | | | | | | | | | | | If "Show nearby tags" is turned off, selecting "Update" from the File menu will cause a Tcl error. This fixes it. The problem was that we were calling regetallcommits unconditionally, but it assumed that getallcommits had been called previously. This also restructures {re,}getallcommits to be a bit simpler. Signed-off-by: Paul Mackerras <paulus@samba.org>
| * gitk: Fix bug introduced in commit 67a4f1a7Paul Mackerras2007-08-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In fixing the "can't unset idinlist" error, I moved the setting of idinlist into the loop that splits the parents into "new" parents (i.e. those of which this is the first child) and "old" parents. Unfortunately this is incorrect in the case where we hit the break statement a few lines further down, since when we come back in, we'll see idinlist($p) set for some parents that aren't in the list. This fixes it by moving the loop that sets up newolds and oldolds further down. Signed-off-by: Paul Mackerras <paulus@samba.org>
| * [PATCH] gitk: Show an error and exit if no .git could be foundAlex Riesen2007-08-12
| | | | | | | | | | | | | | | | This is to help people starting gitk from graphical file managers where the stderr output is hidden. Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
| * [PATCH] gitk: Continue and show error message in new reposAlex Riesen2007-08-12
| | | | | | | | | | | | | | | | | | If there is no commit made yet, gitk just dumps a Tcl error on stderr, which sometimes is hard to see. Noticed when gitk was run from Xfce file manager (thunar's custom action). Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
| * [PATCH] gitk: Handle MouseWheel events on WindowsMark Levedahl2007-08-12
| | | | | | | | | | | | | | | | | | | | | | | | | | Windows, unlike X-Windows, sends mousewheel events by default to the window that has keyboard focus and uses the MouseWheel event to do so. The window to be scrolled must be able to take focus, but gitk's panels are disabled so cannot take focus. For all these reasons, a different design is needed to use the mousewheel on Windows. The approach here is to bind the mousewheel events to the top level window and redirect them based upon the current mouse position. Signed-off-by: Mark Levedahl <mdl123@verizon.net> Signed-off-by: Paul Mackerras <paulus@samba.org>
| * [PATCH] gitk: Enable selected patch text on WindowsMark Levedahl2007-08-12
| | | | | | | | | | | | | | | | | | | | | | On windows, mouse input follows the keyboard focus, so to allow selecting text from the patch canvas we must not shift focus back to the top level. This change has no negative impact on X, so we don't explicitly test for Win32 on this change. This provides similar selection capability as already available using X-Windows. Signed-off-by: Mark Levedahl <mdl123@verizon.net> Signed-off-by: Paul Mackerras <paulus@samba.org>
| * gitk: Fix bug causing the "can't unset idinlist(...)" errorPaul Mackerras2007-08-12
| | | | | | | | | | | | | | | | | | | | | | | | Under some circumstances, having duplicate parents in a commit could trigger a "can't unset idinlist" Tcl error. This fixes the cause (the logic in layoutrows could end up putting the same commit into rowidlist twice) and also puts a catch around the unset to ignore the error. Thanks to Jeff King for coming up with a test script to generate a repo that shows the problem. Signed-off-by: Paul Mackerras <paulus@samba.org>
| * gitk: Add a context menu for file list entriesPaul Mackerras2007-07-27
| | | | | | | | | | | | | | At the moment this just has two entries, which allow you to add the file that you clicked on to the list of filenames to highlight, or replace the list with the file. Signed-off-by: Paul Mackerras <paulus@samba.org>
* | Documentation/Makefile: remove cmd-list.made before redirecting to it.David Kastrup2007-08-10
| | | | | | | | | | | | | | | | If cmd-list.made has been created by a previous run as root, output redirection to it will fail. So remove it before regeneration. Signed-off-by: David Kastrup <dak@gnu.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'cr/tag'Junio C Hamano2007-08-10
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | * cr/tag: Teach "git stripspace" the --strip-comments option Make verify-tag a builtin. builtin-tag.c: Fix two memory leaks and minor notation changes. launch_editor(): Heed GIT_EDITOR and core.editor settings Make git tag a builtin.
| * | Teach "git stripspace" the --strip-comments optionJohannes Schindelin2007-07-26
| | | | | | | | | | | | | | | | | | | | | | | | With --strip-comments (or short -s), git stripspace now removes lines beginning with a '#', too. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | Make verify-tag a builtin.Carlos Rica2007-07-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This replaces "git-verify-tag.sh" with "builtin-verify-tag.c". Testing relies on the "git tag -v" tests calling this command. A temporary file is needed when calling to gpg, because git is already creating detached signatures (gpg option -b) to sign tags (instead of leaving gpg to add the signature to the file by itself), and those signatures need to be supplied in a separate file to be verified by gpg. The program uses git_mkstemp to create that temporary file needed by gpg, instead of the previously used "$GIT_DIR/.tmp-vtag", in order to allow the command to be used in read-only repositories, and also prevent other instances of git to read or remove the same file. Signal SIGPIPE is ignored because the program sometimes was terminated because that signal when writing the input for gpg. The command now can receive many tag names to be verified. Documentation is also updated here to reflect this new behaviour. Signed-off-by: Carlos Rica <jasampler@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | builtin-tag.c: Fix two memory leaks and minor notation changes.Carlos Rica2007-07-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A repeated call to read_sha1_file was not freing memory when the buffer was allocated but returned size was zero. Also, now the program does not allow many -F or -m options, which was a bug too because it was not freing the memory allocated for any previous -F or -m options. Tests are provided for ensuring that only one option -F or -m is given. Also, another test is shipped here, to check that "git tag" fails when a non-existing file is passed to the -F option, something that git-tag.sh allowed creating the tag with an empty message. Signed-off-by: Carlos Rica <jasampler@gmail.com> Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | launch_editor(): Heed GIT_EDITOR and core.editor settingsJohannes Schindelin2007-07-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the commit 'Add GIT_EDITOR environment and core.editor configuration variables', this was done for the shell scripts. Port it over to builtin-tag's version of launch_editor(), which is just about to be refactored into editor.c. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | Make git tag a builtin.Carlos Rica2007-07-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This replaces the script "git-tag.sh" with "builtin-tag.c". The existing test suite for "git tag" guarantees the compatibility with the features provided by the script version. There are some minor changes in the behaviour of "git tag" here: "git tag -v" now can get more than one tag to verify, like "git tag -d" does, "git tag" with no arguments prints all tags, more like "git branch" does, and "git tag -n" also prints all tags with annotations (without needing -l). Tests and documentation were also updated to reflect these changes. The program is currently calling the script "git verify-tag" for verify. This can be changed porting it to C and calling its functions directly from builtin-tag.c. Signed-off-by: Carlos Rica <jasampler@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | INSTALL: explain info installation and dependencies.David Kastrup2007-08-10
| | | | | | | | | | | | Signed-off-by: David Kastrup <dak@gnu.org>
* | | Add support for an info version of the user manualDavid Kastrup2007-08-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These patches use docbook2x in order to create an info version of the git user manual. No existing Makefile targets (including "all") are touched, so you need to explicitly say make info sudo make install-info to get git.info created and installed. If the info target directory does not already contain a "dir" file, no directory entry is created. This facilitates $(DESTDIR)-based installations. The same could be achieved with sudo make INSTALL_INFO=: install-info explicitly. perl is used for patching up sub-par file and directory information in the Texinfo file. It would be cleaner to place the respective info straight into user-manual.txt or the conversion configurations, but I find myself unable to find out how to do this with Asciidoc/Texinfo. Signed-off-by: David Kastrup <dak@gnu.org>
* | | Merge branch 'jc/clone'Junio C Hamano2007-08-10
|\ \ \ | | | | | | | | | | | | | | | | | | | | * jc/clone: git-clone: aggressively optimize local clone behaviour. connect: accept file:// URL scheme
| * | | git-clone: aggressively optimize local clone behaviour.Junio C Hamano2007-08-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changes the behaviour of cloning from a repository on the local machine, by defaulting to "-l" (use hardlinks to share files under .git/objects) and making "-l" a no-op. A new option, --no-hardlinks, is also added to cause file-level copy of files under .git/objects while still avoiding the normal "pack to pipe, then receive and index pack" network transfer overhead. The old behaviour of local cloning without -l nor -s is availble by specifying the source repository with the newly introduced file:///path/to/repo.git/ syntax (i.e. "same as network" cloning). * With --no-hardlinks (i.e. have all .git/objects/ copied via cpio) would not catch the source repository corruption, and also risks corrupted recipient repository if an alpha-particle hits memory cell while indexing and resolving deltas. As long as the recipient is created uncorrupted, you have a good back-up. * same-as-network is expensive, but it would catch the breakage of the source repository. It still risks corrupted recipient repository due to hardware failure. As long as the recipient is created uncorrupted, you have a good back-up. * The new default on the same filesystem, as long as the source repository is healthy, it is very likely that the recipient would be, too. Also it is very cheap. You do not get any back-up benefit, though. None of the method is resilient against the source repository corruption, so let's discount that from the comparison. Then the difference with and without --no-hardlinks matters primarily if you value the back-up benefit or not. If you want to use the cloned repository as a back-up, then it is cheaper to do a clone with --no-hardlinks and two git-fsck (source before clone, recipient after clone) than same-as-network clone, especially as you are likely to do a git-fsck on the recipient if you are so paranoid anyway. Which leads me to believe that being able to use file:/// is probably a good idea, if only for testability, but probably of little practical value. We default to hardlinked clone for everyday use, and paranoids can use --no-hardlinks as a way to make a back-up. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | connect: accept file:// URL schemeLinus Torvalds2007-08-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We might make it something like: "if you use an url, we don't default to local", so the difference would be that git clone file:///directory/to/repo would work the way it does now, but git clone /directory/to/repo would default to "-l" behaviour. That kind of would make sense (and should be easy to implement. This adds support for "file://" URL to underlying connect codepath to make it happen. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | Optimize the three-way merge of git-read-treeLinus Torvalds2007-08-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As mentioned, the three-way case *should* be as trivial as the following. It passes all the tests, and I verified that a conflicting merge in the 100,000 file horror-case merged correctly (with the conflict markers) in 0.687 seconds with this, so it works, but I'm lazy and somebody else should double-check it [jc: followed all three-way merge codepaths and verified it removes when it should]. Without this patch, the merge took 8.355 seconds, so this patch really does make a huge difference for merge performance with lots and lots of files, and we're not talking percentages, we're talking orders-of-magnitude differences! Now "unpack_trees()" is just fast enough that we don't need to avoid it (although it's probably still a good idea to eventually convert it to use the traverse_trees() infrastructure some day - just to avoid having extraneous tree traversal functions). Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | Fix filehandle leak in "git branch -D"Alex Riesen2007-08-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On Windows (it can't touch open files in any way) the following fails: git branch -D branch1 branch2 if the both branches are in packed-refs. Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | builtin-bundle - use buffered reads for bundle headerMark Levedahl2007-08-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This eliminates all use of byte-at-a-time reading of data in this function: as Junio noted, a bundle file is seekable so we can reset the file position to the first part of the pack-file using lseek after reading the header. Signed-off-by: Mark Levedahl <mdl123@verizon.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | builtin-bundle.c - use stream buffered input for rev-listMark Levedahl2007-08-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git-bundle create on cygwin was nearly unusable due to 1 character at a time (unbuffered) reading from an exec'ed process. Fix by using fdopen to get a buffered stream. Results for "time git bundle create test.bdl v1.0.3..v1.5.2" are: before this patch: cygwin linux real 1m38.828s 0m3.578s user 0m12.122s 0m2.896s sys 1m28.215s 0m0.692s after this patch: real 0m3.688s 0m2.835s user 0m3.075s 0m2.731s sys 0m1.075s 0m0.149s Signed-off-by: Mark Levedahl <mdl123@verizon.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | allow git-bundle to create bottomless bundleJunio C Hamano2007-08-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mark Levedahl <mlevedahl@gmail.com> writes: > Junio C Hamano wrote: >> While "git bundle" was a useful way to sneakernet incremental >> changes, we did not allow: >> > Thanks - I've been thinking for months I could fix this bug, never > figured it out and didn't want to nag Dscho one more time. I confirm > that this allows creation of bundles with arbitrary refs, not just > those under refs/heads. Yahoo! Actually, there is another bug nearby. If you do: git bundle create v2.6-20-v2.6.22.bndl v2.6.20..v2.6.22 the bundle records that it requires v2.6.20^0 commit (correct) and gives you tag v2.6.22 (incorrect); the bug is that the object it lists in fact is the commit v2.6.22^0, not the tag. This is because the revision range operation .. is always about set of commits, but the code near where my patch touches does not validate that the sha1 value obtained from dwim_ref() against the commit object name e->item->sha1 before placing the head information in the commit. The attached patch attempts to fix this problem. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | allow git-bundle to create bottomless bundleJunio C Hamano2007-08-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While "git bundle" was a useful way to sneakernet incremental changes, we did not allow: $ git bundle create v2.6.20.bndl v2.6.20 to create a bundle that contains the whole history to a well-known good revision. Such a bundle can be mirrored everywhere, and people can prime their repository with it to reduce the load on the repository that serves near the tip of the development. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | Optimize the two-way merge of git-read-tree tooLinus Torvalds2007-08-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This trivially optimizes the two-way merge case of git-read-tree too, which affects switching branches. When you have tons and tons of files in your repository, but there are only small differences in the branches (maybe just a couple of files changed), the biggest cost of the branch switching was actually just the index calculations. This fixes it (timings for switching between the "testing" and "master" branches in the 100,000 file testing-repo-from-hell, where the branches only differ in one small file). Before: [torvalds@woody bummer]$ time git checkout master real 0m9.919s user 0m8.461s sys 0m0.264s After: [torvalds@woody bummer]$ time git checkout testing real 0m0.576s user 0m0.348s sys 0m0.228s so it's easily an order of magnitude different. This concludes the series. I think we could/should do the three-way merge too (to speed up merges), but I'm lazy. Somebody else can do it. The rule is very simple: you need to remove the old entry if: - you want to remove the file entirely - you replace it with a "merge conflict" entry (ie a non-stage-0 entry) and you can avoid removing it if you either - keep the old one - or resolve it to a new one. and these rules should all be valid for the three-way case too. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | Optimize the common cases of git-read-treeLinus Torvalds2007-08-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This optimizes bind_merge() and oneway_merge() to not unnecessarily remove and re-add the old index entries when they can just get replaced by updated ones. This makes these operations much faster for large trees (where "large" is in the 50,000+ file range), because we don't unnecessarily move index entries around in the index array all the time. Using the "bummer" tree (a test-tree with 100,000 files) we get: Before: [torvalds@woody bummer]$ time git commit -m"Change one file" 50/500 real 0m9.470s user 0m8.729s sys 0m0.476s After: [torvalds@woody bummer]$ time git commit -m"Change one file" 50/500 real 0m1.173s user 0m0.720s sys 0m0.452s so for large trees this is easily very noticeable indeed. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | Move old index entry removal from "unpack_trees()" into the individual functionsLinus Torvalds2007-08-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes no changes to current code, but it allows the individual merge functions to decide what to do about the old entry. They might decide to update it in place, rather than force them to always delete and re-add it. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | Merge branch 'lt/readtree'Junio C Hamano2007-08-10
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | * lt/readtree: Start moving unpack-trees to "struct tree_desc"
| * | | | Start moving unpack-trees to "struct tree_desc"Linus Torvalds2007-08-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This doesn't actually change any real code, but it changes the interface to unpack_trees() to take an array of "struct tree_desc" entries, the same way the tree-walk.c functions do. The reason for this is that we would be much better off if we can do the tree-unpacking using the generic "traverse_trees()" functionality instead of having to the special "unpack" infrastructure. This really is a pretty minimal diff, just to change the calling convention. It passes all the tests, and looks sane. There were only two users of "unpack_trees()": builtin-read-tree and merge-recursive, and I tried to keep the changes minimal. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | Fix "git commit directory/" performance anomalyLinus Torvalds2007-08-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This trivial patch avoids re-hashing files that are already clean in the index. This mirrors what commit 0781b8a9b2fe760fc4ed519a3a26e4b9bd6ccffe did for "git add .", only for "git commit ." instead. This improves the cold-cache case immensely, since we don't need to bring in all the file contents, just the index and any files dirty in the index. Before: [torvalds@woody linux]$ time git commit . real 1m49.537s user 0m3.892s sys 0m2.432s After: [torvalds@woody linux]$ time git commit . real 0m14.273s user 0m1.312s sys 0m0.516s (both after doing a "echo 3 > /proc/sys/vm/drop_caches" to get cold-cache behaviour - even with the index optimization git still has to "lstat()" all the files, so with a truly cold cache, bringing all the inodes in will take some time). [jc: trivial "return 0;" fixed] Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | Optimize "diff --cached" performance.Junio C Hamano2007-08-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The read_tree() function is called only from the call chain to run "git diff --cached" (this includes the internal call made by git-runstatus to run_diff_index()). The function vacates stage without any funky "merge" magic. The caller then goes and compares stage #1 entries from the tree with stage #0 entries from the original index. When adding the cache entries this way, it used the general purpose add_cache_entry(). This function looks for an existing entry to replace or if there is none to find where to insert the new entry, resolves D/F conflict and all the other things. For the purpose of reading entries into an empty stage, none of that processing is needed. We can instead append everything and then sort the result at the end. This commit changes read_tree() to first make sure that there is no existing cache entries at specified stage, and if that is the case, it runs add_cache_entry() with ADD_CACHE_JUST_APPEND flag (new), and then sort the resulting cache using qsort(). This new flag tells add_cache_entry() to omit all the checks such as "Does this path already exist? Does adding this path remove other existing entries because it turns a directory to a file?" and instead append the given cache entry straight at the end of the active cache. The caller of course is expected to sort the resulting cache at the end before using the result. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | Revert "tweak manpage formatting"Junio C Hamano2007-08-10
|/ / / / | | | | | | | | | | | | | | | | | | | | This reverts commit 524e5ffcf41a67ec113a9c3730ddc8fb8d3317f5. It is reported that this change breaks formatting with docbook 1.69.
* | | | Reinstate the old behaviour when GIT_DIR is set and GIT_WORK_TREE is unsetJohannes Schindelin2007-08-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The old behaviour was to unilaterally default to the cwd is the work tree when GIT_DIR was set, but GIT_WORK_TREE wasn't, no matter if we are inside the GIT_DIR, or if GIT_DIR is actually something like ../../../.git. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>