summaryrefslogtreecommitdiff
path: root/builtin
AgeCommit message (Collapse)Author
2013-08-01Merge branch 'ob/typofixes'Junio C Hamano
* ob/typofixes: many small typofixes
2013-08-01Merge branch 'jc/rm-submodule-error-message'Junio C Hamano
Consolidate two messages phrased subtly differently without a good reason. * jc/rm-submodule-error-message: builtin/rm.c: consolidate error reporting for removing submodules
2013-08-01Merge branch 'jx/clean-interactive'Junio C Hamano
* jx/clean-interactive: git-clean: implement partial matching for selection Documentation/git-clean: fix description for range
2013-07-31Merge branch 'jk/commit-how-to-abort-cherry-pick'Junio C Hamano
* jk/commit-how-to-abort-cherry-pick: commit: tweak empty cherry pick advice for sequencer
2013-07-29many small typofixesOndřej Bílka
Signed-off-by: Ondřej Bílka <neleai@seznam.cz> Reviewed-by: Marc Branchaud <marcnarc@xiplink.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-29commit: tweak empty cherry pick advice for sequencerJeff King
When we refuse to make an empty commit, we check whether we are in a cherry-pick in order to give better advice on how to proceed. We instruct the user to repeat the commit with "--allow-empty" to force the commit, or to use "git reset" to skip it and abort the cherry-pick. In the case of a single cherry-pick, the distinction between skipping and aborting is not important, as there is no more work to be done afterwards. When we are using the sequencer to cherry pick a series of commits, though, the instruction is confusing: does it skip this commit, or does it abort the rest of the cherry-pick? It does skip, after which the user can continue the cherry-pick. This is the right thing to be advising the user to do, but let's make it more clear what will happen, both by using the word "skip", and by mentioning that the rest of the sequence can be continued via "cherry-pick --continue" (whether we skip or take the commit). Noticed-by: Ramkumar Ramachandra <artagnon@gmail.com> Helped-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-26builtin/rm.c: consolidate error reporting for removing submodulesJunio C Hamano
We have two (not identical) copies of error reporting when attempting to remove submodules that have their repositories embedded within them. Add a helper function so that we do not have to repeat similar error messages with subtly different wording without a good reason. Noticed by Jiang Xin. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-25Merge branch 'jk/cat-file-batch-optim'Junio C Hamano
If somebody wants to only know on-disk footprint of an object without having to know its type or payload size, we can bypass a lot of code to cheaply learn it. * jk/cat-file-batch-optim: Fix some sparse warnings sha1_object_info_extended: pass object_info to helpers sha1_object_info_extended: make type calculation optional packed_object_info: make type lookup optional packed_object_info: hoist delta type resolution to helper sha1_loose_object_info: make type lookup optional sha1_object_info_extended: rename "status" to "type" cat-file: disable object/refname ambiguity check for batch mode
2013-07-25Merge branch 'sb/misc-fixes'Junio C Hamano
Assorted code cleanups and a minor fix. * sb/misc-fixes: diff.c: Do not initialize a variable, which gets reassigned anyway. commit: Fix a memory leak in determine_author_info daemon.c:handle: Remove unneeded check for null pointer.
2013-07-25git-clean: implement partial matching for selectionJiang Xin
Document for interactive git-clean says: "You also could say `c` or `clean` above as long as the choice is unique". But it's not true, because only hotkey `c` and full match (`clean`) could work. Implement partial matching via find_unique function to make the document right. Signed-off-by: Jiang Xin <worldhello.net@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-22Sync with Git 1.8.3.4Junio C Hamano
2013-07-22Merge branch 'jc/name-rev-exact-ref'Junio C Hamano
Corrects the longstanding sloppiness in the implementation of name-rev that conflated "we take commit-ish" and "differences between tags and commits do not matter". * jc/name-rev-exact-ref: describe: fix --contains when a tag is given as input name-rev: differentiate between tags and commits they point at describe: use argv-array name-rev: allow converting the exact object name at the tip of a ref name-ref: factor out name shortening logic from name_ref()
2013-07-22Merge branch 'es/check-mailmap'Junio C Hamano
A new command to allow scripts to query the mailmap information. * es/check-mailmap: t4203: test check-mailmap command invocation builtin: add git-check-mailmap command
2013-07-22Merge branch 'jx/clean-interactive'Junio C Hamano
Add "interactive" mode to "git clean". The early part to refactor relative path related helper functions looked sensible. * jx/clean-interactive: test: run testcases with POSIX absolute paths on Windows test: add t7301 for git-clean--interactive git-clean: add documentation for interactive git-clean git-clean: add ask each interactive action git-clean: add select by numbers interactive action git-clean: add filter by pattern interactive action git-clean: use a git-add-interactive compatible UI git-clean: add colors to interactive git-clean git-clean: show items of del_list in columns git-clean: add support for -i/--interactive git-clean: refactor git-clean into two phases write_name{_quoted_relative,}(): remove redundant parameters quote_path_relative(): remove redundant parameter quote.c: substitute path_relative with relative_path path.c: refactor relative_path(), not only strip prefix test: add test cases for relative_path
2013-07-22Merge branch 'hv/config-from-blob'Junio C Hamano
Allow configuration data to be read from in-tree blob objects, which would help working in a bare repository and submodule updates. * hv/config-from-blob: do not die when error in config parsing of buf occurs teach config --blob option to parse config from database config: make parsing stack struct independent from actual data source config: drop cf validity check in get_next_char() config: factor out config file stack management
2013-07-22Merge branch 'nd/const-struct-cache-entry'Junio C Hamano
* nd/const-struct-cache-entry: Convert "struct cache_entry *" to "const ..." wherever possible
2013-07-22Merge branch 'jk/gcc-function-attributes'Junio C Hamano
Use the function attributes extension to catch mistakes in use of our own variadic functions that use NULL sentinel at the end (i.e. like execl(3)) and format strings (i.e. like printf(3)). * jk/gcc-function-attributes: Add the LAST_ARG_MUST_BE_NULL macro wt-status: use "format" function attribute for status_printf use "sentinel" function attribute for variadic lists add missing "format" function attributes
2013-07-22Merge branch 'db/show-ref-head'Junio C Hamano
The "--head" option to "git show-ref" was only to add "HEAD" to the list of candidate refs to be filtered by the usual rules (e.g. "--heads" that only show refs under refs/heads). Change the meaning of the option to always show "HEAD" regardless of what filtering will be applied to any other ref (this is a backward incompatible change, so I may need to add an entry to the Release Notes). * db/show-ref-head: show-ref: make --head always show the HEAD ref
2013-07-22Merge branch 'tr/do-not-call-submodules-subprojects'Junio C Hamano
* tr/do-not-call-submodules-subprojects: show-branch: fix description of --date-order apply, entry: speak of submodules instead of subprojects
2013-07-22Merge branch 'mm/color-auto-default'Junio C Hamano
A finishing touch to fix breakage to "add -e" caused by defaulting ui.color to "auto". * mm/color-auto-default: git add -e: Explicitly specify that patch should have no color
2013-07-22update URL to the marc.info mail archiveOndřej Bílka
The name marc.theaimsgroup.com is no longer active, and has migrated to marc.info. Signed-off-by: Ondřej Bílka <neleai@seznam.cz> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-22Merge branch 'ph/builtin-srcs-are-in-subdir-these-days' into maintJunio C Hamano
* ph/builtin-srcs-are-in-subdir-these-days: fix "builtin-*" references to be "builtin/*"
2013-07-19git add -e: Explicitly specify that patch should have no colorAndrew Wong
After 4c7f1819 (make color.ui default to 'auto', 2013-06-10), the patch file to be edited during 'git add -e' receives all the color codes. This is because diffopt.use_color defaults to -1, which causes want_color to now return 'auto'. By explicitly setting use_color to 0, we can ensure the diff output has no color codes in it. Signed-off-by: Andrew Wong <andrew.kw.w@gmail.com> Acked-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-19Sync with maintJunio C Hamano
2013-07-19apply.c::find_name_traditional(): do not initialize len to the line's lengthStefan Beller
The variable len is set to len = strchrnul(line, '\n') - line; unconditionally 9 lines later, hence we can remove the call to strlen. Signed-off-by: Stefan Beller <stefanbeller@googlemail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-19Merge branch 'rs/logical-vs-binary-or' into maintJunio C Hamano
* rs/logical-vs-binary-or: use logical OR (||) instead of binary OR (|) in logical context
2013-07-19Add the LAST_ARG_MUST_BE_NULL macroRamsay Jones
The sentinel function attribute is not understood by versions of the gcc compiler prior to v4.0. At present, for earlier versions of gcc, the build issues 108 warnings related to the unknown attribute. In order to suppress the warnings, we conditionally define the LAST_ARG_MUST_BE_NULL macro to provide the sentinel attribute for gcc v4.0 and newer. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-18describe: fix --contains when a tag is given as inputJunio C Hamano
"git describe" takes a commit and gives it a name based on tags in its neighbourhood. The command does take a commit-ish but when given a tag that points at a commit, it should dereference the tag before computing the name for the commit. As the whole processing is internally delegated to name-rev, if we unwrap tags down to the underlying commit when invoking name-rev, it will make the name-rev issue an error message based on the unwrapped object name (i.e. either 40-hex object name, or "$tag^0") that is different from what the end-user gave to the command when the commit cannot be described. Introduce an internal option --peel-tag to the name-rev to tell it to unwrap a tag in its input from the command line. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-18name-rev: differentiate between tags and commits they point atJunio C Hamano
"git name-rev --stdin" has been fixed to convert an object name that points at a tag to a refname of the tag. The codepath to handle its command line arguments, however, fed the commit that the tag points at to the underlying naming machinery. With this fix, you will get this: $ git name-rev --refs=tags/\* --name-only $(git rev-parse v1.8.3 v1.8.3^0) v1.8.3 v1.8.3^0 which is the same as what you would get from the fixed "--stdin" variant: $ git rev-parse v1.8.3 v1.8.3^0 | git name-rev --refs=tags/\* --name-only v1.8.3 v1.8.3^0 Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-18Merge branch 'jk/in-pack-size-measurement'Junio C Hamano
"git cat-file --batch-check=<format>" is added, primarily to allow on-disk footprint of objects in packfiles (often they are a lot smaller than their true size, when expressed as deltas) to be reported. * jk/in-pack-size-measurement: pack-revindex: radix-sort the revindex pack-revindex: use unsigned to store number of objects cat-file: split --batch input lines on whitespace cat-file: add %(objectsize:disk) format atom cat-file: add --batch-check=<format> cat-file: refactor --batch option parsing cat-file: teach --batch to stream blob objects t1006: modernize output comparisons teach sha1_object_info_extended a "disk_size" query zero-initialize object_info structs
2013-07-18Merge branch 'jk/maint-clone-shared-no-connectivity-validation'Junio C Hamano
"git clone -s/-l" is a filesystem level copy and does not offer any protection against source repository being corrupt. While the connectivity validation checks commits and trees being readable, it made the otherwise instantaneous local modes of clone much more expensive, without protecting blob data from bitflips. * jk/maint-clone-shared-no-connectivity-validation: clone: drop connectivity check for local clones
2013-07-18show-branch: fix description of --date-orderThomas Rast
The existing description reads as if it somehow applies a filter. Change it to explain that it is merely about the ordering. Message-proposed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Thomas Rast <trast@inf.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-18apply, entry: speak of submodules instead of subprojectsThomas Rast
There are only four (with some generous rounding) instances in the current source code where we speak of "subproject" instead of "submodule". They are as follows: * one error message in git-apply and two in entry.c * the patch format for submodule changes The latter was introduced in 0478675 (Expose subprojects as special files to "git diff" machinery, 2007-04-15), apparently before the terminology was settled. We can of course not change the patch format. Let's at least change the error messages to consistently call them "submodule". Signed-off-by: Thomas Rast <trast@inf.ethz.ch> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-18show-ref: make --head always show the HEAD refDoug Bell
The docs seem to say that doing git show-ref --head --tags would show both the HEAD ref and all the tag refs. However, doing both --head and either of --tags or --heads would filter out the HEAD ref. Also update the documentation to describe the new behavior and add tests for the show-ref command. [jc: Doug did proofread the tests, but it was done by me and bugs in it are mine]. Signed-off-by: Doug Bell <madcityzen@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-15Merge branch 'tr/maint-apply-non-git-patch-parsefix' into maintJunio C Hamano
"git apply" parsed patches that add new files, generated by programs other than Git, incorrectly. This is an old breakage in v1.7.11. * tr/maint-apply-non-git-patch-parsefix: apply: carefully strdup a possibly-NULL name
2013-07-15Merge branch 'jk/format-patch-from'Junio C Hamano
"git format-patch" learned "--from[=whom]" option, which sets the "From: " header to the specified person (or the person who runs the command, if "=whom" part is missing) and move the original author information to an in-body From: header as necessary. * jk/format-patch-from: teach format-patch to place other authors into in-body "From" pretty.c: drop const-ness from pretty_print_context
2013-07-15Merge branch 'mv/merge-ff-tristate'Junio C Hamano
The configuration variable "merge.ff" was cleary a tri-state to choose one from "favor fast-forward when possible", "always create a merge even when the history could fast-forward" and "do not create any merge, only update when the history fast-forwards", but the command line parser did not implement the usual convention of "last one wins, and command line overrides the configuration" correctly. * mv/merge-ff-tristate: merge: handle --ff/--no-ff/--ff-only as a tri-state option
2013-07-15commit: Fix a memory leak in determine_author_infoStefan Beller
The date variable is assigned new memory via xmemdupz and 2 lines later it is assigned new memory again via xmalloc, but the first assignment is never freed nor used. Signed-off-by: Stefan Beller <stefanbeller@googlemail.com> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-13builtin: add git-check-mailmap commandEric Sunshine
Introduce command check-mailmap, similar to check-attr and check-ignore, which allows direct testing of .mailmap configuration. As plumbing accessible to scripts and other porcelain, check-mailmap publishes the stable, well-tested .mailmap functionality employed by built-in Git commands. Consequently, script authors need not re-implement .mailmap functionality manually, thus avoiding potential quirks and behavioral differences. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-12Merge branch 'ms/remote-tracking-branches-in-doc'Junio C Hamano
* ms/remote-tracking-branches-in-doc: Change "remote tracking" to "remote-tracking"
2013-07-12Merge branch 'jk/pull-to-integrate'Junio C Hamano
* jk/pull-to-integrate: pull: change the description to "integrate" changes push: avoid suggesting "merging" remote changes
2013-07-12Merge branch 'as/log-output-encoding-in-user-format'Junio C Hamano
"log --format=" did not honor i18n.logoutputencoding configuration and this attempts to fix it. * as/log-output-encoding-in-user-format: t4205 (log-pretty-formats): avoid using `sed` t6006 (rev-list-format): add tests for "%b" and "%s" for the case i18n.commitEncoding is not set t4205, t6006, t7102: make functions better readable t4205 (log-pretty-formats): revert back single quotes t4041, t4205, t6006, t7102: use iso8859-1 rather than iso-8859-1 t4205: replace .\+ with ..* in sed commands pretty: --format output should honor logOutputEncoding pretty: Add failing tests: --format output should honor logOutputEncoding t4205 (log-pretty-formats): don't hardcode SHA-1 in expected outputs t7102 (reset): don't hardcode SHA-1 in expected outputs t6006 (rev-list-format): don't hardcode SHA-1 in expected outputs
2013-07-12sha1_object_info_extended: make type calculation optionalJeff King
Each caller of sha1_object_info_extended sets up an object_info struct to tell the function which elements of the object it wants to get. Until now, getting the type of the object has always been required (and it is returned via the return type rather than a pointer in object_info). This can involve actually opening a loose object file to determine its type, or following delta chains to determine a packed file's base type. These effects produce a measurable slow-down when doing a "cat-file --batch-check" that does not include %(objecttype). This patch adds a "typep" query to struct object_info, so that it can be optionally queried just like size and disk_size. As a result, the return type of the function is no longer the object type, but rather 0/-1 for success/error. As there are only three callers total, we just fix up each caller rather than keep a compatibility wrapper: 1. The simpler sha1_object_info wrapper continues to always ask for and return the type field. 2. The istream_source function wants to know the type, and so always asks for it. 3. The cat-file batch code asks for the type only when %(objecttype) is part of the format string. On linux.git, the best-of-five for running: $ git rev-list --objects --all >objects $ time git cat-file --batch-check='%(objectsize:disk)' on a fully packed repository goes from: real 0m8.680s user 0m8.160s sys 0m0.512s to: real 0m7.205s user 0m6.580s sys 0m0.608s Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-12cat-file: disable object/refname ambiguity check for batch modeJeff King
A common use of "cat-file --batch-check" is to feed a list of objects from "rev-list --objects" or a similar command. In this instance, all of our input objects are 40-byte sha1 ids. However, cat-file has always allowed arbitrary revision specifiers, and feeds the result to get_sha1(). Fortunately, get_sha1() recognizes a 40-byte sha1 before doing any hard work trying to look up refs, meaning this scenario should end up spending very little time converting the input into an object sha1. However, since 798c35f (get_sha1: warn about full or short object names that look like refs, 2013-05-29), when we encounter this case, we spend the extra effort to do a refname lookup anyway, just to print a warning. This is further exacerbated by ca91993 (get_packed_ref_cache: reload packed-refs file when it changes, 2013-06-20), which makes individual ref lookup more expensive by requiring a stat() of the packed-refs file for each missing ref. With no patches, this is the time it takes to run: $ git rev-list --objects --all >objects $ time git cat-file --batch-check='%(objectname)' <objects on the linux.git repository: real 1m13.494s user 0m25.924s sys 0m47.532s If we revert ca91993, the packed-refs up-to-date check, it gets a little better: real 0m54.697s user 0m21.692s sys 0m32.916s but we are still spending quite a bit of time on ref lookup (and we would not want to revert that patch, anyway, which has correctness issues). If we revert 798c35f, disabling the warning entirely, we get a much more reasonable time: real 0m7.452s user 0m6.836s sys 0m0.608s This patch does the moral equivalent of this final case (and gets similar speedups). We introduce a global flag that callers of get_sha1() can use to avoid paying the price for the warning. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-12teach config --blob option to parse config from databaseHeiko Voigt
This can be used to read configuration values directly from git's database. For example it is useful for reading to be checked out .gitmodules files directly from the database. Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-12cat-file: split --batch input lines on whitespaceJeff King
If we get an input line to --batch or --batch-check that looks like "HEAD foo bar", we will currently feed the whole thing to get_sha1(). This means that to use --batch-check with `rev-list --objects`, one must pre-process the input, like: git rev-list --objects HEAD | cut -d' ' -f1 | git cat-file --batch-check Besides being more typing and slightly less efficient to invoke `cut`, the result loses information: we no longer know which path each object was found at. This patch teaches cat-file to split input lines at the first whitespace. Everything to the left of the whitespace is considered an object name, and everything to the right is made available as the %(reset) atom. So you can now do: git rev-list --objects HEAD | git cat-file --batch-check='%(objectsize) %(rest)' to collect object sizes at particular paths. Even if %(rest) is not used, we always do the whitespace split (which means you can simply eliminate the `cut` command from the first example above). This whitespace split is backwards compatible for any reasonable input. Object names cannot contain spaces, so any input with spaces would have resulted in a "missing" line. The only input hurt is if somebody really expected input of the form "HEAD is a fine-looking ref!" to fail; it will now parse HEAD, and make "is a fine-looking ref!" available as %(rest). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-12cat-file: add %(objectsize:disk) format atomJeff King
This atom is just like %(objectsize), except that it shows the on-disk size of the object rather than the object's true size. In other words, it makes the "disk_size" query of sha1_object_info_extended available via the command-line. This can be used for rough attribution of disk usage to particular refs, though see the caveats in the documentation. This patch does not include any tests, as the exact numbers returned are volatile and subject to zlib and packing decisions. We cannot even reliably guarantee that the on-disk size is smaller than the object content (though in general this should be the case for non-trivial objects). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-12cat-file: add --batch-check=<format>Jeff King
The `cat-file --batch-check` command can be used to quickly get information about a large number of objects. However, it provides a fixed set of information. This patch adds an optional <format> option to --batch-check to allow a caller to specify which items they are interested in, and in which order to output them. This is not very exciting for now, since we provide the same limited set that you could already get. However, it opens the door to adding new format items in the future without breaking backwards compatibility (or forcing callers to pay the cost to calculate uninteresting items). Since the --batch option shares code with --batch-check, it receives the same feature, though it is less likely to be of interest there. The format atom names are chosen to match their counterparts in for-each-ref. Though we do not (yet) share any code with for-each-ref's formatter, this keeps the interface as consistent as possible, and may help later on if the implementations are unified. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-11Merge branch 'jg/status-config'Junio C Hamano
"git status" learned status.branch and status.short configuration variables to use --branch and --short options by default (override with --no-branch and --no-short options from the command line). * jg/status-config: status/commit: make sure --porcelain is not affected by user-facing config commit: make it work with status.short status: introduce status.branch to enable --branch by default status: introduce status.short to enable --short by default
2013-07-11Merge branch 'rr/rebase-checkout-reflog'Junio C Hamano
Invocations of "git checkout" used internally by "git rebase" were counted as "checkout", and affected later "git checkout -" to the the user to an unexpected place. * rr/rebase-checkout-reflog: checkout: respect GIT_REFLOG_ACTION status: do not depend on rebase reflog messages t/t2021-checkout-last: "checkout -" should work after a rebase finishes wt-status: remove unused field in grab_1st_switch_cbdata t7512: test "detached from" as well