summaryrefslogtreecommitdiff
path: root/builtin
AgeCommit message (Collapse)AuthorFilesLines
2011-11-07Merge branch 'ss/blame-textconv-fake-working-tree'Libravatar Junio C Hamano1-4/+3
* ss/blame-textconv-fake-working-tree: blame.c: Properly initialize strbuf after calling textconv_object(), again
2011-11-07blame.c: Properly initialize strbuf after calling textconv_object(), againLibravatar Sebastian Schuberth1-4/+3
2564aa4 started to initialize buf.alloc, but that should actually be one more byte than the string length due to the trailing \0. Also, do not modify buf.alloc out of the strbuf code. Use the existing strbuf_attach instead. Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-03receive-pack: do not expect object 0{40} to existLibravatar Junio C Hamano1-6/+11
When pushing to delete a ref, it uses 0{40} as an object name to signal that the request is a deletion. We shouldn't trigger "deletion of a corrupt ref" warning in such a case, which was designed to notice that a ref points at an object that is truly missing from the repository. Reported-by: Stefan Näwe Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-02branch -m: handle no arg properlyLibravatar Tay Ray Chuan1-5/+8
Modify the option parsing heuristic to handle all -m (rename) cases, including the no-arg case. Previously, this "fell through" to the (argc <= 2) case and caused segfault. Reported-by: Stefan Näwe <stefan.naewe@atlas-elektronik.com> Signed-off-by: Tay Ray Chuan <rctay89@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-01Merge branch 'ss/blame-textconv-fake-working-tree'Libravatar Junio C Hamano1-1/+3
* ss/blame-textconv-fake-working-tree: (squash) test for previous blame.c: Properly initialize strbuf after calling, textconv_object() Conflicts: t/t8006-blame-textconv.sh
2011-11-01Merge branch 'ef/mingw-upload-archive'Libravatar Junio C Hamano2-48/+26
* ef/mingw-upload-archive: mingw: poll.h is no longer in sys/ upload-archive: use start_command instead of fork compat/win32/poll.c: upgrade from upstream mingw: move poll out of sys-folder
2011-11-01Merge branch 'dm/pack-objects-update'Libravatar Junio C Hamano1-19/+55
* dm/pack-objects-update: pack-objects: don't traverse objects unnecessarily pack-objects: rewrite add_descendants_to_write_order() iteratively pack-objects: use unsigned int for counter and offset values pack-objects: mark add_to_write_order() as inline
2011-10-30upload-archive: use start_command instead of forkLibravatar Erik Faye-Lund2-48/+26
The POSIX-function fork is not supported on Windows. Use our start_command API instead. As this is the last call-site that depends on the fork-stub in compat/mingw.h, remove that as well. Add an undocumented flag to git-archive that tells it that the action originated from a remote, so features can be disabled. Thanks to Jeff King for work on this part. Remove the NOT_MINGW-prereq for t5000, as git-archive --remote now works. Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com> Helped-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-28blame.c: Properly initialize strbuf after calling, textconv_object()Libravatar Sebastian Schuberth1-1/+3
For a plain string where only the length is known, strbuf.alloc needs to be initialized to the length. Otherwise strbuf.alloc is 0 and a later call to strbuf_setlen() will fail. This bug surfaced when calling git blame under Windows on a *.doc file. The *.doc file is converted to plain text by antiword via the textconv mechanism. However, the plain text returned by antiword contains DOS line endings instead of Unix line endings which triggered the strbuf_setlen() which previous to this patch failed. Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-27Merge branch 'js/grep-mutex'Libravatar Junio C Hamano1-11/+26
* js/grep-mutex: builtin/grep: simplify lock_and_read_sha1_file() builtin/grep: make lock/unlock into static inline functions git grep: be careful to use mutexes only when they are initialized
2011-10-27Merge branch 'maint'Libravatar Junio C Hamano1-2/+2
* maint: clone: Quote user supplied path in a single quote pair read-cache.c: fix index memory allocation
2011-10-27clone: Quote user supplied path in a single quote pairLibravatar Richard Hartmann1-2/+2
Without this patch, $ git clone foo . results in this: Cloning into .... done. With it: Cloning into '.'... done. Signed-off-by: Richard Hartmann <richih.mailinglist@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-26Merge branch 'cn/fetch-prune'Libravatar Junio C Hamano2-6/+30
* cn/fetch-prune: fetch: treat --tags like refs/tags/*:refs/tags/* when pruning fetch: honor the user-provided refspecs when pruning refs remote: separate out the remote_find_tracking logic into query_refspecs t5510: add tests for fetch --prune fetch: free all the additional refspecs Conflicts: remote.c
2011-10-26Merge branch 'jk/argv-array' into maintLibravatar Junio C Hamano1-19/+8
* jk/argv-array: run_hook: use argv_array API checkout: use argv_array API bisect: use argv_array API quote: provide sq_dequote_to_argv_array refactor argv_array into generic code quote.h: fix bogus comment add sha1_array API docs
2011-10-26Merge branch 'jc/run-receive-hook-cleanup' into maintLibravatar Junio C Hamano1-19/+52
* jc/run-receive-hook-cleanup: refactor run_receive_hook()
2011-10-26Merge branch 'maint-1.7.6' into maintLibravatar Junio C Hamano1-7/+21
* maint-1.7.6: notes_merge_commit(): do not pass temporary buffer to other function gitweb: Fix links to lines in blobs when javascript-actions are enabled mergetool: no longer need to save standard input mergetool: Use args as pathspec to unmerged files t9159-*.sh: skip for mergeinfo test for svn <= 1.4 date.c: Support iso8601 timezone formats remote: only update remote-tracking branch if updating refspec remote rename: warn when refspec was not updated remote: "rename o foo" should not rename ref "origin/bar" remote: write correct fetch spec when renaming remote 'remote'
2011-10-26Merge branch 'mz/remote-rename' into maint-1.7.6Libravatar Junio C Hamano1-7/+21
* mz/remote-rename: remote: only update remote-tracking branch if updating refspec remote rename: warn when refspec was not updated remote: "rename o foo" should not rename ref "origin/bar" remote: write correct fetch spec when renaming remote 'remote'
2011-10-26builtin/grep: simplify lock_and_read_sha1_file()Libravatar Junio C Hamano1-7/+3
As read_sha1_lock/unlock have been made aware of use_threads, this caller can be made a lot simpler. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-26builtin/grep: make lock/unlock into static inline functionsLibravatar Junio C Hamano1-5/+23
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-26git grep: be careful to use mutexes only when they are initializedLibravatar Johannes Schindelin1-4/+5
Rather nasty things happen when a mutex is not initialized but locked nevertheless. Now, when we're not running in a threaded manner, the mutex is not initialized, which is correct. But then we went and used the mutex anyway, which -- at least on Windows -- leads to a hard crash (ordinarily it would be called a segmentation fault, but in Windows speak it is an access violation). This problem was identified by our faithful tests when run in the msysGit environment. To avoid having to wrap the line due to the 80 column limit, we use the name "WHEN_THREADED" instead of "IF_USE_THREADS" because it is one character shorter. Which is all we need in this case. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-21Merge branch 'jc/match-refs-clarify'Libravatar Junio C Hamano2-4/+4
* jc/match-refs-clarify: rename "match_refs()" to "match_push_refs()" send-pack: typofix error message
2011-10-21Merge branch 'jk/maint-pack-objects-compete-with-delete'Libravatar Junio C Hamano1-0/+4
* jk/maint-pack-objects-compete-with-delete: downgrade "packfile cannot be accessed" errors to warnings pack-objects: protect against disappearing packs
2011-10-21Merge branch 'nd/maint-autofix-tag-in-head' into maintLibravatar Junio C Hamano3-59/+66
* nd/maint-autofix-tag-in-head: Accept tags in HEAD or MERGE_HEAD merge: remove global variable head[] merge: use return value of resolve_ref() to determine if HEAD is invalid merge: keep stash[] a local variable Conflicts: builtin/merge.c
2011-10-21Merge branch 'jc/apply-blank-at-eof-fix' into maintLibravatar Junio C Hamano1-2/+9
* jc/apply-blank-at-eof-fix: apply --whitespace=error: correctly report new blank lines at end
2011-10-21Merge branch 'il/archive-err-signal' into maintLibravatar Junio C Hamano1-0/+2
* il/archive-err-signal: Support ERR in remote archive like in fetch/push
2011-10-21Merge branch 'jm/maint-apply-detects-corrupt-patch-header' into maintLibravatar Junio C Hamano1-0/+3
* jm/maint-apply-detects-corrupt-patch-header: fix "git apply --index ..." not to deref NULL
2011-10-21Merge branch 'jc/checkout-from-tree-keep-local-changes' into maintLibravatar Junio C Hamano1-1/+5
* jc/checkout-from-tree-keep-local-changes: checkout $tree $path: do not clobber local changes in $path not in $tree
2011-10-21Merge branch 'mm/maint-config-explicit-bool-display' into maintLibravatar Junio C Hamano1-7/+13
* mm/maint-config-explicit-bool-display: config: display key_delim for config --bool --get-regexp
2011-10-20pack-objects: don't traverse objects unnecessarilyLibravatar Dan McGee1-6/+12
This brings back some of the performance lost in optimizing recency order inside pack objects. We were doing extreme amounts of object re-traversal: for the 2.14 million objects in the Linux kernel repository, we were calling add_to_write_order() over 1.03 billion times (a 0.2% hit rate, making 99.8% of of these calls extraneous). Two optimizations take place here- we can start our objects array iteration from a known point where we left off before we started trying to find our tags, and we don't need to do the deep dives required by add_family_to_write_order() if the object has already been marked as filled. These two optimizations bring some pretty spectacular results via `perf stat`: task-clock: 83373 ms --> 43800 ms (50% faster) cycles: 221,633,461,676 --> 116,307,209,986 (47% fewer) instructions: 149,299,179,939 --> 122,998,800,184 (18% fewer) Helped-by: Ramsay Jones (format string fix in "die" message) Signed-off-by: Dan McGee <dpmcgee@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-19Merge branch 'js/merge-edit-option'Libravatar Junio C Hamano1-39/+70
* js/merge-edit-option: Teach merge the '[-e|--edit]' option Conflicts: builtin/merge.c
2011-10-19Merge branch 'js/no-cherry-pick-head-after-punted'Libravatar Junio C Hamano1-7/+16
* js/no-cherry-pick-head-after-punted: cherry-pick: do not give irrelevant advice when cherry-pick punted revert.c: defer writing CHERRY_PICK_HEAD till it is safe to do so
2011-10-19Merge branch 'jm/maint-apply-detects-corrupt-patch-header'Libravatar Junio C Hamano1-0/+3
* jm/maint-apply-detects-corrupt-patch-header: fix "git apply --index ..." not to deref NULL
2011-10-18pack-objects: rewrite add_descendants_to_write_order() iterativelyLibravatar Dan McGee1-7/+37
This removes the need to call this function recursively, shinking the code size slightly and netting a small performance increase. Signed-off-by: Dan McGee <dpmcgee@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-18pack-objects: use unsigned int for counter and offset valuesLibravatar Dan McGee1-6/+6
This is done in some of the new pack layout code introduced in commit 1b4bb16b9ec331c. This more closely matches the nr_objects global that is unsigned that these variables are based off of and bounded by. Signed-off-by: Dan McGee <dpmcgee@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-18pack-objects: mark add_to_write_order() as inlineLibravatar Dan McGee1-1/+1
This function is a whole 26 bytes when compiled on x86_64, but is currently invoked over 1.037 billion times when running pack-objects on the Linux kernel git repository. This is hitting the point where micro-optimizations do make a difference, and inlining it only increases the object file size by 38 bytes. As reported by perf, this dropped task-clock from 84183 to 83373 ms, and total cycles from 223.5 billion to 221.6 billion. Not astronomical, but worth getting for adding one word. Signed-off-by: Dan McGee <dpmcgee@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-17Merge branch 'bc/attr-ignore-case'Libravatar Junio C Hamano2-1/+7
* bc/attr-ignore-case: attr.c: respect core.ignorecase when matching attribute patterns attr: read core.attributesfile from git_default_core_config builtin/mv.c: plug miniscule memory leak cleanup: use internal memory allocation wrapper functions everywhere attr.c: avoid inappropriate access to strbuf "buf" member Conflicts: transport-helper.c
2011-10-17Merge branch 'mm/maint-config-explicit-bool-display'Libravatar Junio C Hamano1-7/+13
* mm/maint-config-explicit-bool-display: config: display key_delim for config --bool --get-regexp
2011-10-17Merge branch 'tc/fetch-leak'Libravatar Junio C Hamano1-4/+9
* tc/fetch-leak: fetch: plug two leaks on error exit in store_updated_refs Conflicts: builtin/fetch.c
2011-10-17Merge branch 'ph/push-to-delete-nothing'Libravatar Junio C Hamano1-8/+18
* ph/push-to-delete-nothing: receive-pack: don't pass non-existent refs to post-{receive,update} hooks Conflicts: builtin/receive-pack.c
2011-10-17Merge branch 'jc/checkout-from-tree-keep-local-changes'Libravatar Junio C Hamano1-1/+5
* jc/checkout-from-tree-keep-local-changes: checkout $tree $path: do not clobber local changes in $path not in $tree
2011-10-15fetch: treat --tags like refs/tags/*:refs/tags/* when pruningLibravatar Carlos Martín Nieto1-2/+21
If --tags is specified, add that refspec to the list given to prune_refs so it knows to treat it as a filter on what refs to should consider for prunning. This way git fetch --prune --tags origin only prunes tags and doesn't delete the branch refs. Signed-off-by: Carlos Martín Nieto <cmn@elego.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-15fetch: honor the user-provided refspecs when pruning refsLibravatar Carlos Martín Nieto2-5/+10
If the user gave us refspecs on the command line, we should use those when deciding whether to prune a ref instead of relying on the refspecs in the config. Previously, running git fetch --prune origin refs/heads/master:refs/remotes/origin/master would delete every other ref under the origin namespace because we were using the refspec to filter the available refs but using the configured refspec to figure out if a ref had been deleted on the remote. This is clearly the wrong thing to do. Change prune_refs and get_stale_heads to simply accept a list of references and a list of refspecs. The caller of either function needs to decide what refspecs should be used to decide whether a ref is stale. Signed-off-by: Carlos Martín Nieto <cmn@elego.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-15Merge branch 'ms/patch-id-with-overlong-line' into maintLibravatar Junio C Hamano1-4/+6
* ms/patch-id-with-overlong-line: patch-id.c: use strbuf instead of a fixed buffer
2011-10-15Merge branch 'jc/maint-bundle-too-quiet' into maintLibravatar Junio C Hamano1-1/+1
* jc/maint-bundle-too-quiet: Teach progress eye-candy to fetch_refs_from_bundle()
2011-10-15Merge branch 'jc/maint-fsck-fwrite-size-check' into maintLibravatar Junio C Hamano1-6/+3
* jc/maint-fsck-fwrite-size-check: fsck: do not abort upon finding an empty blob
2011-10-15Merge branch 'nm/grep-object-sha1-lock' into maintLibravatar Junio C Hamano1-0/+3
* nm/grep-object-sha1-lock: grep: Fix race condition in delta_base_cache Conflicts: builtin/grep.c
2011-10-15Merge branch 'jc/grep-untracked-exclude'Libravatar Junio C Hamano1-1/+1
* jc/grep-untracked-exclude: grep: fix the error message that mentions --exclude
2011-10-15Merge branch 'jc/maint-grep-untracked-exclude' into jc/grep-untracked-excludeLibravatar Junio C Hamano1-1/+1
* jc/maint-grep-untracked-exclude: grep: fix the error message that mentions --exclude Conflicts: builtin/grep.c
2011-10-14downgrade "packfile cannot be accessed" errors to warningsLibravatar Jeff King1-1/+1
These can happen if another process simultaneously prunes a pack. But that is not usually an error condition, because a properly-running prune should have repacked the object into a new pack. So we will notice that the pack has disappeared unexpectedly, print a message, try other packs (possibly after re-scanning the list of packs), and find it in the new pack. Acked-by: Nicolas Pitre <nico@fluxnic.net> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-14pack-objects: protect against disappearing packsLibravatar Jeff King1-0/+4
It's possible that while pack-objects is running, a simultaneously running prune process might delete a pack that we are interested in. Because we load the pack indices early on, we know that the pack contains our item, but by the time we try to open and map it, it is gone. Since c715f78, we already protect against this in the normal object access code path, but pack-objects accesses the packs at a lower level. In the normal access path, we call find_pack_entry, which will call find_pack_entry_one on each pack index, which does the actual lookup. If it gets a hit, we will actually open and verify the validity of the matching packfile (using c715f78's is_pack_valid). If we can't open it, we'll issue a warning and pretend that we didn't find it, causing us to go on to the next pack (or on to loose objects). Furthermore, we will cache the descriptor to the opened packfile. Which means that later, when we actually try to access the object, we are likely to still have that packfile opened, and won't care if it has been unlinked from the filesystem. Notice the "likely" above. If there is another pack access in the interim, and we run out of descriptors, we could close the pack. And then a later attempt to access the closed pack could fail (we'll try to re-open it, of course, but it may have been deleted). In practice, this doesn't happen because we tend to look up items and then access them immediately. Pack-objects does not follow this code path. Instead, it accesses the packs at a much lower level, using find_pack_entry_one directly. This means we skip the is_pack_valid check, and may end up with the name of a packfile, but no open descriptor. We can add the same is_pack_valid check here. Unfortunately, the access patterns of pack-objects are not quite as nice for keeping lookup and object access together. We look up each object as we find out about it, and the only later when writing the packfile do we necessarily access it. Which means that the opened packfile may be closed in the interim. In practice, however, adding this check still has value, for three reasons. 1. If you have a reasonable number of packs and/or a reasonable file descriptor limit, you can keep all of your packs open simultaneously. If this is the case, then the race is impossible to trigger. 2. Even if you can't keep all packs open at once, you may end up keeping the deleted one open (i.e., you may get lucky). 3. The race window is shortened. You may notice early that the pack is gone, and not try to access it. Triggering the problem without this check means deleting the pack any time after we read the list of index files, but before we access the looked-up objects. Triggering it with this check means deleting the pack means deleting the pack after we do a lookup (and successfully access the packfile), but before we access the object. Which is a smaller window. Acked-by: Nicolas Pitre <nico@fluxnic.net> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>