summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2014-07-15paint_down_to_common: use prio_queueLibravatar Jeff King1-23/+19
When we are traversing to find merge bases, we keep our usual commit_list of commits to process, sorted by their commit timestamp. As we add each parent to the list, we have to spend "O(width of history)" to do the insertion, where the width of history is the number of simultaneous lines of development. If we instead use a heap-based priority queue, we can do these insertions in "O(log width)" time. This provides minor speedups to merge-base calculations (timings in linux.git, warm cache, best-of-five): [before] $ git merge-base HEAD v2.6.12 real 0m3.251s user 0m3.148s sys 0m0.104s [after] $ git merge-base HEAD v2.6.12 real 0m3.234s user 0m3.108s sys 0m0.128s That's only an 0.5% speedup, but it does help protect us against pathological cases. While we are munging the "interesting" function, we also take the opportunity to give it a more descriptive name, and convert the return value to an int (we returned the first interesting commit, but nobody ever looked at it). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-07-15prio-queue: make output stable with respect to insertionLibravatar Jeff King2-6/+17
If two items are added to a prio_queue and compare equal, they currently come out in an apparently random order (this order is deterministic for a particular sequence of insertions and removals, but does not necessarily match the insertion order). This makes it unlike using a date-ordered commit_list, which is one of the main types we would like to replace with it (because prio_queue does not suffer from O(n) insertions). We can make the priority queue stable by keeping an insertion counter for each element, and using it to break ties. This does increase the memory usage of the structure (one int per element), but in practice it does not seem to affect runtime. A best-of-five "git rev-list --topo-order" on linux.git showed less than 1% difference (well within the run-to-run noise). In an ideal world, we would offer both stable and unstable priority queues (the latter to try to maximize performance). However, given the lack of a measurable performance difference, it is not worth the extra code. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-07-15prio-queue: factor out compare and swap operationsLibravatar Jeff King1-24/+25
When manipulating the priority queue's heap, we frequently have to compare and swap heap entries. As we are storing only void pointers right now, this is quite easy to do inline in a few lines. However, when we start using a more complicated heap entry in a future patch, that will get longer. Factoring out these operations lets us make future changes in one place. It also makes the code a little shorter and more readable. Note that we actually accept indices into the queue array instead of pointers. This is slightly less flexible than passing pointers-to-pointers (we could not swap items from unrelated arrays, but we would not want to), but will make further refactoring simpler (and lets us avoid repeating "queue->array" at each callsite, which led to some long lines). And finally, note that we are cleaning up an accidental use of a "struct commit" pointer to hold a temporary entry during swap. Even though we currently only use this code for commits, it is supposed to be type-agnostic. In practice this didn't matter anyway because we never dereferenced the commit pointer (and on most systems, the pointer values themselves are interchangeable between types). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-07-10Merge branch 'maint'Libravatar Junio C Hamano1-0/+13
* maint: Start preparing for 2.0.2
2014-07-10Seventh batch for 2.1Libravatar Junio C Hamano1-0/+22
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-07-10Merge branch 'dt/refs-check-refname-component-sse-fix'Libravatar Junio C Hamano2-5/+13
Fixes to a topic that is already in 'master'. * dt/refs-check-refname-component-sse-fix: refs: fix valgrind suppression file refs.c: handle REFNAME_REFSPEC_PATTERN at end of page
2014-07-10Merge branch 'rs/simplify-archive-tests'Libravatar Junio C Hamano2-16/+8
* rs/simplify-archive-tests: t5000, t5003: simplify commit
2014-07-10Merge branch 'rs/fix-alt-odb-path-comparison'Libravatar Junio C Hamano1-1/+2
* rs/fix-alt-odb-path-comparison: sha1_file: avoid overrunning alternate object base string
2014-07-10Merge branch 'rs/status-code-clean-up'Libravatar Junio C Hamano1-8/+5
* rs/status-code-clean-up: wt-status: simplify building of summary limit argument wt-status: use argv_array for environment
2014-07-10Merge branch 'kb/path-max-must-go'Libravatar Junio C Hamano3-39/+36
* kb/path-max-must-go: symlinks: remove PATH_MAX limitation
2014-07-10Merge branch 'mg/verify-commit'Libravatar Junio C Hamano12-7/+162
Add 'verify-commit' to be used in a way similar to 'verify-tag' is used. Further work on verifying the mergetags might be needed. * mg/verify-commit: t7510: test verify-commit t7510: exit for loop with test result verify-commit: scriptable commit signature verification gpg-interface: provide access to the payload gpg-interface: provide clear helper for struct signature_check
2014-07-10Merge branch 'jc/fix-clone-single-starting-at-a-tag'Libravatar Junio C Hamano1-1/+1
"git clone -b brefs/tags/bar" would have mistakenly thought we were following a single tag, even though it was a name of the branch, because it incorrectly used strstr(). * jc/fix-clone-single-starting-at-a-tag: builtin/clone.c: detect a clone starting at a tag correctly
2014-07-10Start preparing for 2.0.2Libravatar Junio C Hamano2-1/+14
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-07-10Merge branch 'pb/trim-trailing-spaces' into maintLibravatar Junio C Hamano2-15/+44
* pb/trim-trailing-spaces: t0008: do not depend on 'echo' handling backslashes specially dir.c:trim_trailing_spaces(): fix for " \ " sequence
2014-07-10Merge branch 'jk/repack-pack-keep-objects' into maintLibravatar Junio C Hamano2-7/+27
* jk/repack-pack-keep-objects: repack: s/write_bitmap/&s/ in code repack: respect pack.writebitmaps repack: do not accidentally pack kept objects by default
2014-07-10Merge branch 'mc/doc-submodule-sync-recurse' into maintLibravatar Junio C Hamano1-1/+1
* mc/doc-submodule-sync-recurse: submodule: document "sync --recursive"
2014-07-09Sixth batch for 2.1Libravatar Junio C Hamano1-0/+18
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-07-09Merge branch 'sk/mingw-unicode-spawn-args'Libravatar Junio C Hamano1-23/+71
* sk/mingw-unicode-spawn-args: Win32: Unicode arguments (incoming) Win32: Unicode arguments (outgoing) MinGW: disable CRT command line globbing Win32: fix potential multi-threading issue Win32: simplify internal mingw_spawn* APIs Win32: let mingw_execve() return an int
2014-07-09Merge branch 'sk/mingw-dirent'Libravatar Junio C Hamano3-67/+59
* sk/mingw-dirent: Win32 dirent: improve dirent implementation Win32 dirent: clarify #include directives Win32 dirent: change FILENAME_MAX to MAX_PATH Win32 dirent: remove unused dirent.d_reclen member Win32 dirent: remove unused dirent.d_ino member
2014-07-09Merge branch 'sk/mingw-uni-console'Libravatar Junio C Hamano3-123/+533
* sk/mingw-uni-console: Win32: reliably detect console pipe handles Win32: fix broken pipe detection Win32: Thread-safe windows console output Win32: add Unicode conversion functions Win32: warn if the console font doesn't support Unicode Win32: detect console streams more reliably Win32: support Unicode console output
2014-07-09Merge branch 'sk/mingw-main'Libravatar Junio C Hamano2-10/+19
* sk/mingw-main: mingw: avoid const warning Win32: move main macro to a function
2014-07-09Merge branch 'jk/pretty-G-format-fixes'Libravatar Junio C Hamano3-9/+70
* jk/pretty-G-format-fixes: move "%G" format test from t7510 to t6006 pretty: avoid reading past end-of-string with "%G" t7510: check %G* pretty-format output t7510: test a commit signed by an unknown key t7510: use consistent &&-chains in loop t7510: stop referring to master in later tests
2014-07-09Merge branch 'jk/xstrfmt'Libravatar Junio C Hamano20-163/+122
* jk/xstrfmt: setup_git_env(): introduce git_path_from_env() helper unique_path: fix unlikely heap overflow walker_fetch: fix minor memory leak merge: use argv_array when spawning merge strategy sequencer: use argv_array_pushf setup_git_env: use git_pathdup instead of xmalloc + sprintf use xstrfmt to replace xmalloc + strcpy/strcat use xstrfmt to replace xmalloc + sprintf use xstrdup instead of xmalloc + strcpy use xstrfmt in favor of manual size calculations strbuf: add xstrfmt helper
2014-07-09Merge branch 'jk/skip-prefix'Libravatar Junio C Hamano40-401/+407
* jk/skip-prefix: http-push: refactor parsing of remote object names imap-send: use skip_prefix instead of using magic numbers use skip_prefix to avoid repeated calculations git: avoid magic number with skip_prefix fetch-pack: refactor parsing in get_ack fast-import: refactor parsing of spaces stat_opt: check extra strlen call daemon: use skip_prefix to avoid magic numbers fast-import: use skip_prefix for parsing input use skip_prefix to avoid repeating strings use skip_prefix to avoid magic numbers transport-helper: avoid reading past end-of-string fast-import: fix read of uninitialized argv memory apply: use skip_prefix instead of raw addition refactor skip_prefix to return a boolean avoid using skip_prefix as a boolean daemon: mark some strings as const parse_diff_color_slot: drop ofs parameter
2014-07-08refs: fix valgrind suppression fileLibravatar David Turner1-4/+11
Add all of the ways in which check_refname_format violates valgrind's expectations to the valgrind suppression file; remove an assumption about the call chain of check_refname_format from same. Signed-off-by: David Turner <dturner@twitter.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-07-08line-log: use commit_list_append() instead of duplicating its codeLibravatar René Scharfe1-3/+1
Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-07-08diff-tree: call free_commit_list() instead of duplicating its codeLibravatar René Scharfe1-6/+2
Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-07-07t5000, t5003: simplify commitLibravatar René Scharfe2-16/+8
Add the whole directory of test files at once using git add instead of calling git update-index on each of them and use git commit instead of the plumbing commands write-tree, update-ref and commit-tree to build the commit. This simplifies the code considerably. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-07-07symlinks: remove PATH_MAX limitationLibravatar Karsten Blees3-39/+36
'git checkout' fails if a directory is longer than PATH_MAX, because the lstat_cache in symlinks.c checks if the leading directory exists using PATH_MAX-bounded string operations. Remove the limitation by using strbuf instead. Signed-off-by: Karsten Blees <blees@dcon.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-07-07refs.c: handle REFNAME_REFSPEC_PATTERN at end of pageLibravatar David Turner1-1/+2
When a ref crosses a memory page boundary, we restart the parsing at the beginning with the bytewise code. Pass the original flags to that code, rather than the current flags. Reported-By: Øyvind A. Holm <sunny@sunbase.org> Signed-off-by: David Turner <dturner@twitter.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-07-02Merge branch 'dt/refs-check-refname-component-sse'Libravatar Junio C Hamano4-18/+250
Further micro-optimization of a leaf-function. * dt/refs-check-refname-component-sse: refs.c: SSE2 optimizations for check_refname_component
2014-07-02Merge branch 'ye/http-extract-charset'Libravatar Junio C Hamano3-2/+11
* ye/http-extract-charset: http: fix charset detection of extract_content_type()
2014-07-02Merge branch 'bc/fix-rebase-merge-skip'Libravatar Junio C Hamano2-2/+18
"git rebase --skip" did not work well when it stopped due to a conflict twice in a row. * bc/fix-rebase-merge-skip: rebase--merge: fix --skip with two conflicts in a row
2014-07-02Merge branch 'jk/commit-buffer-length'Libravatar Junio C Hamano27-197/+284
Move "commit->buffer" out of the in-core commit object and keep track of their lengths. Use this to optimize the code paths to validate GPG signatures in commit objects. * jk/commit-buffer-length: reuse cached commit buffer when parsing signatures commit: record buffer length in cache commit: convert commit->buffer to a slab commit-slab: provide a static initializer use get_commit_buffer everywhere convert logmsg_reencode to get_commit_buffer use get_commit_buffer to avoid duplicate code use get_cached_commit_buffer where appropriate provide helpers to access the commit buffer provide a helper to set the commit buffer provide a helper to free commit buffer sequencer: use logmsg_reencode in get_message logmsg_reencode: return const buffer do not create "struct commit" with xcalloc commit: push commit_index update into alloc_commit_node alloc: include any-object allocations in alloc_report replace dangerous uses of strbuf_attach commit_tree: take a pointer/len pair rather than a const strbuf
2014-07-02enums: remove trailing ',' after last item in enumLibravatar Ronnie Sahlberg1-1/+1
Signed-off-by: Ronnie Sahlberg <sahlberg@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-07-02Merge branch 'maint'Libravatar Junio C Hamano3-4/+4
* maint: t7300: repair filesystem permissions with test_when_finished enums: remove trailing ',' after last item in enum
2014-07-02Merge branch 'maint-1.8.5' into maintLibravatar Junio C Hamano3-4/+4
* maint-1.8.5: t7300: repair filesystem permissions with test_when_finished enums: remove trailing ',' after last item in enum
2014-07-02t7300: repair filesystem permissions with test_when_finishedLibravatar Jeff King1-2/+2
We create a directory that cannot be removed, confirm that it cannot be removed, and then fix it like: chmod 0 foo && test_must_fail git clean -d -f && chmod 755 foo If the middle step fails but leaves the directory (e.g., the bug is that clean does not notice the failure), this pollutes the test repo with an unremovable directory. Not only does this cause further tests to fail, but it means that "rm -rf" fails on the whole trash directory, and the user has to intervene manually to even re-run the test script. We can bump the "chmod 755" recovery to a test_when_finished block to be sure that it always runs. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-07-02enums: remove trailing ',' after last item in enumLibravatar Ronnie Sahlberg2-2/+2
Signed-off-by: Ronnie Sahlberg <sahlberg@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-07-01sha1_file: avoid overrunning alternate object base stringLibravatar René Scharfe1-1/+2
While checking if a new alternate object database is a duplicate make sure that old and new base paths have the same length before comparing them with memcmp. This avoids overrunning the buffer of the existing entry if the new one is longer and it stops rejecting foobar/ after foo/ was already added. Signed-off-by: Rene Scharfe <ls.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-06-29wt-status: simplify building of summary limit argumentLibravatar René Scharfe1-3/+1
Use argv_array_pushf for building the number string for the option --summary-limit directly instead of using an intermediate buffer. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-06-29wt-status: use argv_array for environmentLibravatar René Scharfe1-5/+4
Instead of using a PATH_MAX buffer, use argv_array for constructing the environment for git submodule summary. This simplifies the code a bit and removes the arbitrary length limit. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-06-27Merge git://ozlabs.org/~paulus/gitkLibravatar Junio C Hamano1-6/+18
* git://ozlabs.org/~paulus/gitk: gitk: Add visiblerefs option, which lists always-shown branches gitk: Catch mkdtemp errors gitk: Use mktemp -d to avoid predictable temporary directories gitk: Honor TMPDIR when viewing external diffs
2014-06-27gitk: Add visiblerefs option, which lists always-shown branchesLibravatar Max Kirillov1-4/+6
When many branches contain a commit, the branches used to be shown in the form "A, B and many more", where A, B can be master of current HEAD. But there are more which might be interesting to always know about. For example, "origin/master". The new option, visiblerefs, is stored in ~/.gitk. It contains a list of references which are always shown before "and many more" if they contain the commit. By default it is `{"master"}', which is compatible with previous behavior. Signed-off-by: Max Kirillov <max@max630.net> Signed-off-by: Paul Mackerras <paulus@samba.org>
2014-06-27gitk: Catch mkdtemp errorsLibravatar David Aguilar1-1/+3
105b5d3f ("gitk: Use mktemp -d to avoid predictable temporary directories") introduced a dependency on mkdtemp, which is not available on Windows. Use the original temporary directory behavior when mkdtemp fails. This makes the code use mkdtemp when available and gracefully fallback to the existing behavior when it is not available. Helped-by: Junio C Hamano <gitster@pobox.com> Helped-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
2014-06-26Merge early parts from git://ozlabs.org/~paulus/gitk.gitLibravatar Junio C Hamano2-6/+1391
* master~2: gitk: Show staged submodules regardless of ignore config gitk: Allow displaying time zones from author and commit dates timestamps gitk: Switch to patch mode when searching for line origin gitk: Replace SHA1 entry field on keyboard paste l10n: Init Vietnamese translation
2014-06-26Merge git://repo.or.cz/git-guiLibravatar Junio C Hamano2-1/+8
* git://repo.or.cz/git-gui: git-gui: tolerate major version changes when comparing the git version git-gui: show staged submodules regardless of ignore config
2014-06-25move "%G" format test from t7510 to t6006Libravatar Jeff King2-6/+6
The final test in t7510 checks that "--format" placeholders that look similar to GPG placeholders (but that we don't actually understand) are passed through. That test was placed in t7510, since the other GPG placeholder tests are there. However, it does not have a GPG prerequisite, because it is not actually checking any signed commits. This causes the test to erroneously fail when gpg is not installed on a system, however. Not because we need signed commits, but because we need _any_ commit to run "git log". If we don't have gpg installed, t7510 doesn't create any commits at all. We can fix this by moving the test into t6006. This is arguably a better place anyway, because it is where we test most of the other placeholders (we do not test GPG placeholders there because of the infrastructure needed to make signed commits). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-06-25Sync with maintLibravatar Junio C Hamano2-1/+117
2014-06-25Fifth batch for 2.1Libravatar Junio C Hamano1-2/+14
Signed-off-by: Junio C Hamano <gitster@pobox.com>