summaryrefslogtreecommitdiff
path: root/builtin
AgeCommit message (Collapse)AuthorFilesLines
2013-03-27Merge branch 'maint-1.8.1' into maintLibravatar Junio C Hamano1-1/+1
* maint-1.8.1: merge-tree: fix typo in merge-tree.c::unresolved git-commit doc: describe use of multiple `-m` options git-pull doc: fix grammo ("conflicts" is plural)
2013-03-27merge-tree: fix typo in merge-tree.c::unresolvedLibravatar John Keeping1-1/+1
When calculating whether there is a d/f conflict, the calculation of whether both sides are directories generates an incorrect references mask because it does not use the loop index to set the correct bit. Fix this typo. Signed-off-by: John Keeping <john@keeping.me.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-03-26Merge branch 'jk/mailsplit-maildir-muttsort' into maintLibravatar Junio C Hamano1-0/+23
Sort filenames read from the maildir/ in a way that is more likely to sort messages in the order the writing MUA meant to, by sorting numeric segment in numeric order and non-numeric segment in alphabetical order. * jk/mailsplit-maildir-muttsort: mailsplit: sort maildir filenames more cleverly
2013-03-26Merge branch 'nd/branch-error-cases' into maintLibravatar Junio C Hamano1-0/+27
"git branch" had more cases where it did not bother to check nonsense command line parameters. * nd/branch-error-cases: branch: segfault fixes and validation
2013-03-26Merge branch 'ap/maint-update-index-h-is-for-help' into maintLibravatar Junio C Hamano1-1/+1
"git update-index -h" did not do the usual "-h(elp)" thing. * ap/maint-update-index-h-is-for-help: update-index: allow "-h" to also display options
2013-03-26Merge branch 'nd/index-pack-l10n-buf-overflow' into maintLibravatar Junio C Hamano1-4/+5
* nd/index-pack-l10n-buf-overflow: index-pack: fix buffer overflow caused by translations
2013-03-26Merge branch 'gp/avoid-explicit-mention-of-dot-git-refs' into maintLibravatar Junio C Hamano1-2/+2
* gp/avoid-explicit-mention-of-dot-git-refs: Fix ".git/refs" stragglers
2013-03-26Merge branch 'jc/maint-reflog-expire-clean-mark-typofix' into maintLibravatar Junio C Hamano1-1/+1
In "git reflog expire", REACHABLE bit was not cleared from the correct objects. * jc/maint-reflog-expire-clean-mark-typofix: reflog: fix typo in "reflog expire" clean-up codepath
2013-03-21drop some obsolete "x = x" compiler warning hacksLibravatar Jeff King1-1/+1
In cases where the setting and access of a variable are protected by the same conditional flag, older versions of gcc would generate a "might be used unitialized" warning. We silence the warning by initializing the variable to itself, a hack that gcc recognizes. Modern versions of gcc are smart enough to get this right, going back to at least version 4.3.5. gcc 4.1 does get it wrong in both cases, but is sufficiently old that we probably don't need to care about it anymore. Signed-off-by: Jeff King <peff@peff.net> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-03-16index-pack: fix buffer overflow caused by translationsLibravatar Nguyễn Thái Ngọc Duy1-4/+5
The translation of "completed with %d local objects" is put in a 48-byte buffer, which may be enough for English but not true for any translations. Convert it to use strbuf (i.e. no hard limit on translation length). Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-03-11add: update pathless 'add [-u|-A]' warning to reflect change of planLibravatar Matthieu Moy1-3/+3
We originally thought the transition would need a period where "git add [-u|-A]" without pathspec would be forbidden, but the warning is big enough to scare people and teach them not to use it (or, if so, to understand the consequences). Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-03-05reflog: fix typo in "reflog expire" clean-up codepathLibravatar Junio C Hamano1-1/+1
In "reflog expire" we were not clearing the REACHABLE bit from objects reachable from the tip of refs we marked earlier. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-03-02mailsplit: sort maildir filenames more cleverlyLibravatar Jeff King1-0/+23
A maildir does not technically record the order in which items were placed into it. That means that when applying a patch series from a maildir, we may get the patches in the wrong order. We try to work around this by sorting the filenames. Unfortunately, this may or may not work depending on the naming scheme used by the writer of the maildir. For instance, mutt will write: ${epoch_seconds}.${pid}_${seq}.${host} where we have: - epoch_seconds: timestamp at which entry was written - pid: PID of writing process - seq: a sequence number to ensure uniqueness of filenames - host: hostname None of the numbers are zero-padded. Therefore, when we sort the names as byte strings, entries that cross a digit boundary (e.g., 10) will sort out of order. In the case of timestamps, it almost never matters (because we do not cross a digit boundary in the epoch time very often these days). But for the sequence number, a 10-patch series would be ordered as 1, 10, 2, 3, etc. To fix this, we can use a custom sort comparison function which traverses each string, comparing chunks of digits numerically, and otherwise doing a byte-for-byte comparison. That would sort: 123.456_1.bar 123.456_2.bar ... 123.456_10.bar according to the sequence number. Since maildir does not define a filename format, this is really just a heuristic. But it happens to work for mutt, and there is a reasonable chance that it will work for other writers, too (at least as well as a straight sort). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-02-25Merge branch 'as/check-ignore'Libravatar Junio C Hamano1-1/+1
"git check-ignore ." segfaulted, as a function it calls deep in its callchain took a string in the <ptr, length> form but did not stop when given an empty string. * as/check-ignore: name-hash: allow hashing an empty string t0008: document test_expect_success_multi
2013-02-25Merge branch 'jk/apply-similaritly-parsing' into maintLibravatar Junio C Hamano1-4/+6
* jk/apply-similaritly-parsing: builtin/apply: tighten (dis)similarity index parsing
2013-02-25Merge branch 'zk/clean-report-failure' into maintLibravatar Junio C Hamano1-29/+125
* zk/clean-report-failure: git-clean: Display more accurate delete messages
2013-02-25Merge branch 'nd/clone-no-separate-git-dir-with-bare' into maintLibravatar Junio C Hamano1-0/+2
* nd/clone-no-separate-git-dir-with-bare: clone: forbid --bare --separate-git-dir <dir>
2013-02-24Fix ".git/refs" stragglersLibravatar Greg Price1-2/+2
A couple of references still survive to .git/refs as a tree of all refs. Fix one in docs, one in a -h message, one in a -h message quoted in docs. Signed-off-by: Greg Price <price@mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-02-23update-index: allow "-h" to also display optionsLibravatar Antoine Pelisse1-1/+1
Even though "git update-index" was updated to use parse-options infrastracture some time ago to make it possible to show list of options with usage_with_options(), "git update-index -h" only shows the usage. Detect this case and call usage_with_options() to show the list of options as well. Signed-off-by: Antoine Pelisse <apelisse@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-02-23branch: segfault fixes and validationLibravatar Nguyễn Thái Ngọc Duy1-0/+27
branch_get() can return NULL (so far on detached HEAD only) but some code paths in builtin/branch.c cannot deal with that and cause segfaults. While at there, make sure to bail out when the user gives 2 or more branches with --set-upstream-to or --unset-upstream, where only the first branch is processed and the rest silently dropped. Reported-by: Per Cederqvist <cederp@opera.com> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-02-19name-hash: allow hashing an empty stringLibravatar Junio C Hamano1-1/+1
Usually we do not pass an empty string to the function hash_name() because we almost always ask for hash values for a path that is a candidate to be added to the index. However, check-ignore (and most likely check-attr, but I didn't check) apparently has a callchain to ask the hash value for an empty path when it was given a "." from the top-level directory to ask "Is the path . excluded by default?" Make sure that hash_name() does not overrun the end of the given pathname even when it is empty. Remove a sweep-the-issue-under-the-rug conditional in check-ignore that avoided to pass an empty string to the callchain while at it. It is a valid question to ask for check-ignore if the top-level is set to be ignored by default, even though the answer is most likely no, if only because there is currently no way to specify such an entry in the .gitignore file. But it is an unusual thing to ask and it is not worth optimizing for it by special casing at the top level of the call chain. Signed-off-by: Adam Spiers <git@adamspiers.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-02-17Merge branch 'jc/hidden-refs'Libravatar Junio C Hamano1-0/+24
Allow the server side to redact the refs/ namespace it shows to the client. Will merge to 'master'. * jc/hidden-refs: upload/receive-pack: allow hiding ref hierarchies upload-pack: simplify request validation upload-pack: share more code
2013-02-14Merge branch 'jc/extended-fake-ancestor-for-gitlink'Libravatar Junio C Hamano1-2/+38
Instead of requiring the full 40-hex object names on the index line, we can read submodule commit object names from the textual diff when synthesizing a fake ancestore tree for "git am -3". * jc/extended-fake-ancestor-for-gitlink: apply: verify submodule commit object name better
2013-02-12Merge branch 'maint'Libravatar Junio C Hamano2-3/+3
* maint: Replace filepattern with pathspec for consistency
2013-02-12Replace filepattern with pathspec for consistencyLibravatar Matthieu Moy2-3/+3
pathspec is the most widely used term, and is the one defined in gitglossary.txt. <filepattern> was used only in the synopsys for git-add and git-commit, and in git-add.txt. Get rid of it. This patch is obtained with by running: perl -pi -e 's/filepattern/pathspec/' `git grep -l filepattern` Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-02-08Merge branch 'jk/apply-similaritly-parsing'Libravatar Junio C Hamano1-4/+6
Make sure the similarity value shown in the "apply --summary" output is sensible, even when the input had a bogus value. * jk/apply-similaritly-parsing: builtin/apply: tighten (dis)similarity index parsing
2013-02-07Merge branch 'jc/fake-ancestor-with-non-blobs' into maintLibravatar Junio C Hamano1-14/+16
Rebasing the history of superproject with change in the submodule has been broken since v1.7.12. * jc/fake-ancestor-with-non-blobs: apply: diagnose incomplete submodule object name better apply: simplify build_fake_ancestor() git-am: record full index line in the patch used while rebasing
2013-02-07Merge branch 'nd/branch-error-cases'Libravatar Junio C Hamano1-9/+15
Fix various error messages and conditions in "git branch", e.g. we advertised "branch -d/-D" to remove one or more branches but actually implemented removal of zero or more branches---request to remove no branches was not rejected. * nd/branch-error-cases: branch: let branch filters imply --list docs: clarify git-branch --list behavior branch: mark more strings for translation branch: give a more helpful message on redundant arguments branch: reject -D/-d without branch name
2013-02-07upload/receive-pack: allow hiding ref hierarchiesLibravatar Junio C Hamano1-0/+24
A repository may have refs that are only used for its internal bookkeeping purposes that should not be exposed to the others that come over the network. Teach upload-pack to omit some refs from its initial advertisement by paying attention to the uploadpack.hiderefs multi-valued configuration variable. Do the same to receive-pack via the receive.hiderefs variable. As a convenient short-hand, allow using transfer.hiderefs to set the value to both of these variables. Any ref that is under the hierarchies listed on the value of these variable is excluded from responses to requests made by "ls-remote", "fetch", etc. (for upload-pack) and "push" (for receive-pack). Because these hidden refs do not count as OUR_REF, an attempt to fetch objects at the tip of them will be rejected, and because these refs do not get advertised, "git push :" will not see local branches that have the same name as them as "matching" ones to be sent. An attempt to update/delete these hidden refs with an explicit refspec, e.g. "git push origin :refs/hidden/22", is rejected. This is not a new restriction. To the pusher, it would appear that there is no such ref, so its push request will conclude with "Now that I sent you all the data, it is time for you to update the refs. I saw that the ref did not exist when I started pushing, and I want the result to point at this commit". The receiving end will apply the compare-and-swap rule to this request and rejects the push with "Well, your update request conflicts with somebody else; I see there is such a ref.", which is the right thing to do. Otherwise a push to a hidden ref will always be "the last one wins", which is not a good default. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-02-05Merge branch 'jc/fake-ancestor-with-non-blobs'Libravatar Junio C Hamano1-14/+16
Rebasing the history of superproject with change in the submodule was broken since v1.7.12. * jc/fake-ancestor-with-non-blobs: apply: diagnose incomplete submodule object name better apply: simplify build_fake_ancestor() git-am: record full index line in the patch used while rebasing
2013-02-05apply: verify submodule commit object name betterLibravatar Junio C Hamano1-2/+38
A textual patch also records the submodule commit object name in full. Make the parsing more robust by reading from there and verifying the (possibly abbreviated) name on the index line matches. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-02-04Merge branch 'jk/read-commit-buffer-data-after-free'Libravatar Junio C Hamano2-30/+6
Clarify the ownership rule for commit->buffer field, which some callers incorrectly accessed without making sure it is populated. * jk/read-commit-buffer-data-after-free: logmsg_reencode: lazily load missing commit buffers logmsg_reencode: never return NULL commit: drop useless xstrdup of commit message
2013-02-04Merge branch 'mm/add-u-A-sans-pathspec'Libravatar Junio C Hamano1-1/+43
Forbid "git add -u" and "git add -A" without pathspec run from a subdirectory, to train people to type "." (or ":/") to make the choice of default does not matter. * mm/add-u-A-sans-pathspec: add: warn when -u or -A is used without pathspec
2013-02-04Merge branch 'jc/push-reject-reasons'Libravatar Junio C Hamano2-2/+41
Improve error and advice messages given locally when "git push" refuses when it cannot compute fast-forwardness by separating these cases from the normal "not a fast-forward; merge first and push again" case. * jc/push-reject-reasons: push: finishing touches to explain REJECT_ALREADY_EXISTS better push: introduce REJECT_FETCH_FIRST and REJECT_NEEDS_FORCE push: further simplify the logic to assign rejection reason push: further clean up fields of "struct ref"
2013-02-04Merge branch 'jk/config-parsing-cleanup'Libravatar Junio C Hamano2-13/+14
Configuration parsing for tar.* configuration variables were broken. Introduce a new config-keyname parser API to make the callers much less error prone. * jk/config-parsing-cleanup: reflog: use parse_config_key in config callback help: use parse_config_key for man config submodule: simplify memory handling in config parsing submodule: use parse_config_key when parsing config userdiff: drop parse_driver function convert some config callbacks to parse_config_key archive-tar: use parse_config_key when parsing config config: add helper function for parsing key names
2013-02-04Merge branch 'jc/custom-comment-char'Libravatar Junio C Hamano7-60/+86
Allow a configuration variable core.commentchar to customize the character used to comment out the hint lines in the edited text from the default '#'. * jc/custom-comment-char: Allow custom "comment char"
2013-02-04Merge branch 'nd/edit-branch-desc-while-detached' into maintLibravatar Junio C Hamano1-4/+4
Attempt to "branch --edit-description" an existing branch, while being on a detached HEAD, errored out. * nd/edit-branch-desc-while-detached: branch: no detached HEAD check when editing another branch's description
2013-02-04Merge branch 'jc/help' into maintLibravatar Junio C Hamano1-18/+0
* jc/help: help: include <common-cmds.h> only in one file
2013-02-04Merge branch 'jc/merge-blobs' into maintLibravatar Junio C Hamano2-37/+59
* jc/merge-blobs: Makefile: Replace merge-file.h with merge-blobs.h in LIB_H merge-tree: fix d/f conflicts merge-tree: add comments to clarify what these functions are doing merge-tree: lose unused "resolve_directories" merge-tree: lose unused "flags" from merge_list Which merge_file() function do you mean?
2013-02-03builtin/apply: tighten (dis)similarity index parsingLibravatar John Keeping1-4/+6
This was prompted by an incorrect warning issued by clang [1], and a suggestion by Linus to restrict the range to check for values greater than INT_MAX since these will give bogus output after casting to int. In fact the (dis)similarity index is a percentage, so reject values greater than 100. [1] http://article.gmane.org/gmane.comp.version-control.git/213857 Signed-off-by: John Keeping <john@keeping.me.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-02-01Merge branch 'nd/edit-branch-desc-while-detached'Libravatar Junio C Hamano1-4/+4
Attempt to "branch --edit-description" an existing branch, while being on a detached HEAD, errored out. * nd/edit-branch-desc-while-detached: branch: no detached HEAD check when editing another branch's description
2013-02-01Merge branch 'jk/gc-auto-after-fetch'Libravatar Junio C Hamano1-0/+5
Help "fetch only" repositories that do not trigger "gc --auto" often enough. * jk/gc-auto-after-fetch: fetch-pack: avoid repeatedly re-scanning pack directory fetch: run gc --auto after fetching
2013-02-01Merge branch 'jc/no-git-config-in-clone'Libravatar Junio C Hamano1-9/+0
We stopped paying attention to $GIT_CONFIG environment that points at a single configuration file from any command other than "git config" quite a while ago, but "git clone" internally set, exported, and then unexported the variable during its operation unnecessarily. * jc/no-git-config-in-clone: clone: do not export and unexport GIT_CONFIG
2013-02-01Merge branch 'nd/fetch-depth-is-broken'Libravatar Junio C Hamano1-1/+16
"git fetch --depth" was broken in at least three ways. The resulting history was deeper than specified by one commit, it was unclear how to wipe the shallowness of the repository with the command, and documentation was misleading. * nd/fetch-depth-is-broken: fetch: elaborate --depth action upload-pack: fix off-by-one depth calculation in shallow clone fetch: add --unshallow for turning shallow repo into complete one
2013-01-31apply: diagnose incomplete submodule object name betterLibravatar Junio C Hamano1-1/+5
"git am -3" uses this function to build a tree that records how the preimage the patch was created from would have looked like. An abbreviated object name on the index line is ordinarily sufficient for us to figure out the object name the preimage tree would have contained, but a change to a submodule by definition shows an object name of a submodule commit which our repository should not have, and get_sha1_blob() is not an appropriate way to read it (or get_sha1() for that matter). Use get_sha1_hex() and complain if we do not find a full object name there. We could read from the payload part of the patch to learn the full object name of the commit, but the primary user "git rebase" has been fixed to give us a full object name, so this should suffice for now. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-31apply: simplify build_fake_ancestor()Libravatar Junio C Hamano1-14/+12
The local variable sha1_ptr in the build_fake_ancestor() function used to either point at the null_sha1[] (if the ancestor did not have the path) or at sha1[] (if we read the object name into the local array), but 7a98869 (apply: get rid of --index-info in favor of --build-fake-ancestor, 2007-09-17) made the "missing in the ancestor" case unnecessary, hence sha1_ptr, when used, always points at the local array. Get rid of the unneeded variable, and restructure the if/else cascade a bit to make it easier to read. There should be no behaviour change. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-31branch: let branch filters imply --listLibravatar Jeff King1-0/+3
Currently, a branch filter like `--contains`, `--merged`, or `--no-merged` is ignored when we are not in listing mode. For example: git branch --contains=foo bar will create the branch "bar" from the current HEAD, ignoring the `--contains` argument entirely. This is not very helpful. There are two reasonable behaviors for git here: 1. Flag an error; the arguments do not make sense. 2. Implicitly go into `--list` mode This patch chooses the latter, as it is more convenient, and there should not be any ambiguity with attempting to create a branch; using `--contains` and not wanting to list is nonsensical. That leaves the case where an explicit modification option like `-d` is given. We already catch the case where `--list` is given alongside `-d` and flag an error. With this patch, we will also catch the use of `--contains` and other filter options alongside `-d`. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-30branch: mark more strings for translationLibravatar Nguyễn Thái Ngọc Duy1-5/+6
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-30Merge branch 'nd/edit-branch-desc-while-detached' into HEADLibravatar Junio C Hamano1-4/+4
* nd/edit-branch-desc-while-detached: branch: no detached HEAD check when editing another branch's description
2013-01-30branch: give a more helpful message on redundant argumentsLibravatar Nguyễn Thái Ngọc Duy1-2/+2
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>