summaryrefslogtreecommitdiff
path: root/builtin
AgeCommit message (Collapse)AuthorFilesLines
2015-12-10Merge branch 'bc/object-id'Libravatar Junio C Hamano37-279/+281
More transition from "unsigned char[40]" to "struct object_id". This needed a few merge fixups, but is mostly disentangled from other topics. * bc/object-id: remote: convert functions to struct object_id Remove get_object_hash. Convert struct object to object_id Add several uses of get_object_hash. object: introduce get_object_hash macro. ref_newer: convert to use struct object_id push_refs_with_export: convert to struct object_id get_remote_heads: convert to struct object_id parse_fetch: convert to use struct object_id add_sought_entry_mem: convert to struct object_id Convert struct ref to use object_id. sha1_file: introduce has_object_file helper.
2015-12-08Merge branch 'dt/refs-backend-pre-vtable'Libravatar Junio C Hamano1-12/+0
Code preparation for pluggable ref backends. * dt/refs-backend-pre-vtable: refs: break out ref conflict checks files_log_ref_write: new function initdb: make safe_create_dir public refs: split filesystem-based refs code into a new file refs/refs-internal.h: new header file refname_is_safe(): improve docstring pack_if_possible_fn(): use ref_type() instead of is_per_worktree_ref() copy_msg(): rename to copy_reflog_msg() verify_refname_available(): new function verify_refname_available(): rename function
2015-12-04Merge branch 'rs/parseopt-short-help'Libravatar Junio C Hamano2-27/+2
Make "-h" command line option work more consistently in all commands. * rs/parseopt-short-help: show-ref: stop using PARSE_OPT_NO_INTERNAL_HELP grep: stop using PARSE_OPT_NO_INTERNAL_HELP parse-options: allow -h as a short option parse-options: inline parse_options_usage() at its only remaining caller parse-options: deduplicate parse_options_usage() calls
2015-12-01Merge branch 'mk/blame-first-parent'Libravatar Jeff King1-16/+14
Regression fix for a topic already in master. * mk/blame-first-parent: blame: fix object casting regression
2015-12-01Merge branch 'maint'Libravatar Jeff King1-0/+3
* maint: http: treat config options sslCAPath and sslCAInfo as paths Documentation/diff: give --word-diff-regex=. example filter-branch: deal with object name vs. pathname ambiguity in tree-filter check-ignore: correct documentation about output git-p4: clean up after p4 submit failure git-p4: work with a detached head git-p4: add option to system() to return subshell status git-p4: add failing test for submit from detached head remote-http(s): support SOCKS proxies t5813: avoid creating urls that break on cygwin Escape Git's exec path in contrib/rerere-train.sh script allow hooks to ignore their standard input stream rebase-i-exec: Allow space in SHELL_PATH Documentation: make environment variable formatting more consistent
2015-11-24blame: fix object casting regressionLibravatar Jeff King1-16/+14
Commit 1b0d400 refactored the prepare_final() function so that it could be reused in multiple places. Originally, the loop had two outputs: a commit to stuff into sb->final, and the name of the commit from the rev->pending array. After the refactor, that loop is put in its own function with a single return value: the object_array_entry from the rev->pending array. This contains both the name and the object, but with one important difference: the object is the _original_ object found by the revision parser, not the dereferenced commit. If one feeds a tag to "git blame", we end up casting the tag object to a "struct commit", which causes a segfault. Instead, let's return the commit (properly casted) directly from the function, and take the "name" as an optional out-parameter. This does the right thing, and actually simplifies the callers, who no longer need to cast or dereference the object_array_entry themselves. [test case by Max Kirillov <max@max630.net>] Signed-off-by: Jeff King <peff@peff.net>
2015-11-20show-ref: stop using PARSE_OPT_NO_INTERNAL_HELPLibravatar René Scharfe1-11/+1
The flag PARSE_OPT_NO_INTERNAL_HELP is set to allow overriding the option -h, except when it's the only one given. This is the default behavior now, so remove the flag and the hand-rolled --help-all handling. The internal --help-all handler now actually shows hidden options, i.e. -h in this case. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Jeff King <peff@peff.net>
2015-11-20grep: stop using PARSE_OPT_NO_INTERNAL_HELPLibravatar René Scharfe1-16/+1
The flag PARSE_OPT_NO_INTERNAL_HELP is set to allow overriding the option -h, except when it's the only one given. This is the default behavior now, so remove the flag and the hand-rolled --help-all handling. The internal --help-all handler now actually shows hidden options, i.e. --debug in this case. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Jeff King <peff@peff.net>
2015-11-20Remove get_object_hash.Libravatar brian m. carlson27-107/+107
Convert all instances of get_object_hash to use an appropriate reference to the hash member of the oid member of struct object. This provides no functional change, as it is essentially a macro substitution. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Jeff King <peff@peff.net>
2015-11-20Convert struct object to object_idLibravatar brian m. carlson25-125/+125
struct object is one of the major data structures dealing with object IDs. Convert it to use struct object_id instead of an unsigned char array. Convert get_object_hash to refer to the new member as well. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Jeff King <peff@peff.net>
2015-11-20Add several uses of get_object_hash.Libravatar brian m. carlson26-109/+109
Convert most instances where the sha1 member of struct object is dereferenced to use get_object_hash. Most instances that are passed to functions that have versions taking struct object_id, such as get_sha1_hex/get_oid_hex, or instances that can be trivially converted to use struct object_id instead, are not converted. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Jeff King <peff@peff.net>
2015-11-20ref_newer: convert to use struct object_idLibravatar brian m. carlson1-1/+1
Convert ref_newer and its caller to use struct object_id instead of unsigned char *. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Jeff King <peff@peff.net>
2015-11-20add_sought_entry_mem: convert to struct object_idLibravatar brian m. carlson1-6/+8
Convert this function to use struct object_id. Express several hardcoded constants in terms of GIT_SHA1_HEXSZ. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Jeff King <peff@peff.net>
2015-11-20Convert struct ref to use object_id.Libravatar brian m. carlson6-43/+43
Use struct object_id in three fields in struct ref and convert all the necessary places that use it. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Jeff King <peff@peff.net>
2015-11-20Merge branch 'lf/ref-is-hidden-namespace'Libravatar Jeff King1-6/+21
Extend transfer.hideRefs to work better with use of namespaces. * lf/ref-is-hidden-namespace: t5509: add basic tests for hideRefs hideRefs: add support for matching full refs upload-pack: strip refs before calling ref_is_hidden() config.txt: document the semantics of hideRefs with namespaces
2015-11-20Merge branch 'dk/gc-idx-wo-pack'Libravatar Jeff King2-2/+45
Having a leftover .idx file without corresponding .pack file in the repository hurts performance; "git gc" learned to prune them. * dk/gc-idx-wo-pack: gc: remove garbage .idx files from pack dir t5304: test cleaning pack garbage prepare_packed_git(): refactor garbage reporting in pack directory
2015-11-20initdb: make safe_create_dir publicLibravatar David Turner1-12/+0
Soon we will want to create initdb functions for ref backends, and code from initdb that calls this function needs to move into the files backend. So this function needs to be public. Signed-off-by: David Turner <dturner@twopensource.com> Signed-off-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Jeff King <peff@peff.net>
2015-11-16allow hooks to ignore their standard input streamLibravatar Clemens Buchacher1-0/+3
Since ec7dbd145 (receive-pack: allow hooks to ignore its standard input stream) the pre-receive and post-receive hooks ignore SIGPIPE. Do the same for the remaining hooks pre-push and post-rewrite, which read from standard input. The same arguments for ignoring SIGPIPE apply. Include test by Jeff King which checks that SIGPIPE does not cause pre-push hook failure. With the use of git update-ref --stdin it is fast enough to be enabled by default. Signed-off-by: Clemens Buchacher <clemens.buchacher@intel.com> Signed-off-by: Jeff King <peff@peff.net>
2015-11-05Merge branch 'ea/checkout-progress'Libravatar Junio C Hamano1-2/+12
"git checkout" did not follow the usual "--[no-]progress" convention and implemented only "--quiet" that is essentially a superset of "--no-progress". Extend the command to support the usual "--[no-]progress". * ea/checkout-progress: checkout: add --progress option
2015-11-05Merge branch 'js/misc-fixes' into maintLibravatar Junio C Hamano1-1/+1
Various compilation fixes and squelching of warnings. * js/misc-fixes: Correct fscanf formatting string for I64u values Silence GCC's "cast of pointer to integer of a different size" warning Squelch warning about an integer overflow
2015-11-05Merge branch 'jc/add-u-A-default-to-top' into maintLibravatar Junio C Hamano1-7/+1
"git --literal-pathspecs add -u/-A" without any command line argument misbehaved ever since Git 2.0. * jc/add-u-A-default-to-top: add: simplify -u/-A without pathspec
2015-11-05Merge branch 'nd/clone-linked-checkout' into maintLibravatar Junio C Hamano1-3/+10
It was not possible to use a repository-lookalike created by "git worktree add" as a local source of "git clone". * nd/clone-linked-checkout: clone: better error when --reference is a linked checkout clone: allow --local from a linked checkout enter_repo: allow .git files in strict mode enter_repo: avoid duplicating logic, use is_git_directory() instead t0002: add test for enter_repo(), non-strict mode path.c: delete an extra space
2015-11-05hideRefs: add support for matching full refsLibravatar Lukas Fleischer1-6/+21
In addition to matching stripped refs, one can now add hideRefs patterns that the full (unstripped) ref is matched against. To distinguish between stripped and full matches, those new patterns must be prefixed with a circumflex (^). This commit also removes support for the undocumented and unintended hideRefs settings ".have" (suppressing all "have" lines) and "capabilities^{}" (suppressing the capabilities line). Signed-off-by: Lukas Fleischer <lfleischer@lfos.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-11-04Merge branch 'es/worktree-add' into maintLibravatar Junio C Hamano1-1/+1
* es/worktree-add: worktree: usage: denote <branch> as optional with 'add'
2015-11-04gc: remove garbage .idx files from pack dirLibravatar Doug Kelly1-0/+21
Add a custom report_garbage handler to collect and remove garbage .idx files from the pack directory. Signed-off-by: Doug Kelly <dougk.ff7@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-11-03Merge branch 'mk/blame-error-message' into maintLibravatar Junio C Hamano1-1/+1
The error message from "git blame --contents --reverse" incorrectly talked about "--contents --children". * mk/blame-error-message: blame: fix option name in error message
2015-11-03Merge branch 'jk/merge-file-exit-code' into maintLibravatar Junio C Hamano1-0/+3
"git merge-file" tried to signal how many conflicts it found, which obviously would not work well when there are too many of them. * jk/merge-file-exit-code: merge-file: clamp exit code to maximum 127
2015-11-03Merge branch 'jc/am-3-fallback-regression-fix' into maintLibravatar Junio C Hamano1-16/+33
"git am -3" had a small regression where it is aborted in its error handling codepath when underlying merge-recursive failed in certain ways, as it assumed that the internal call to merge-recursive will never die, which is not the case (yet). * jc/am-3-fallback-regression-fix: am -3: do not let failed merge from completing the error codepath
2015-11-03Merge branch 'jc/usage-stdin' into maintLibravatar Junio C Hamano11-12/+12
The synopsis text and the usage string of subcommands that read list of things from the standard input are often shown as if they only take input from a file on a filesystem, which was misleading. * jc/usage-stdin: usage: do not insist that standard input must come from a file
2015-11-03Merge branch 'rt/placeholder-in-usage' into maintLibravatar Junio C Hamano1-2/+2
A couple of commands still showed "[options]" in their usage string to note where options should come on their command line, but we spell that "[<options>]" in most places these days. * rt/placeholder-in-usage: am, credential-cache: add angle brackets to usage string
2015-11-03Merge branch 'nd/gc-auto-background-fix' into maintLibravatar Junio C Hamano1-1/+55
When "git gc --auto" is backgrounded, its diagnosis message is lost. Save it to a file in $GIT_DIR and show it next time the "gc --auto" is run. * nd/gc-auto-background-fix: gc: save log from daemonized gc --auto and print it next time
2015-11-03Merge branch 'js/clone-dissociate' into maintLibravatar Junio C Hamano1-1/+3
"git clone --dissociate" runs a big "git repack" process at the end, and it helps to close file descriptors that are open on the packs and their idx files before doing so on filesystems that cannot remove a file that is still open. * js/clone-dissociate: clone --dissociate: avoid locking pack files sha1_file.c: add a function to release all packs sha1_file: consolidate code to close a pack's file descriptor t5700: demonstrate a Windows file locking issue with `git clone --dissociate`
2015-11-03Merge branch 'tk/stripspace' into maintLibravatar Junio C Hamano7-102/+42
The internal stripspace() function has been moved to where it logically belongs to, i.e. strbuf API, and the command line parser of "git stripspace" has been updated to use the parse_options API. * tk/stripspace: stripspace: use parse-options for command-line parsing strbuf: make stripspace() part of strbuf
2015-11-03Merge branch 'jk/repository-extension' into maintLibravatar Junio C Hamano3-9/+17
Prepare for Git on-disk repository representation to undergo backward incompatible changes by introducing a new repository format version "1", with an extension mechanism. * jk/repository-extension: introduce "preciousObjects" repository extension introduce "extensions" form of core.repositoryformatversion
2015-11-03Merge branch 'mk/blame-first-parent'Libravatar Junio C Hamano1-14/+47
"git blame" learnt to take "--first-parent" and "--reverse" at the same time when it makes sense. * mk/blame-first-parent: blame: allow blame --reverse --first-parent when it makes sense blame: extract find_single_final blame: test to describe use of blame --reverse --first-parent
2015-11-03Merge branch 'rs/show-branch-argv-array'Libravatar Junio C Hamano1-16/+8
Code simplification. * rs/show-branch-argv-array: show-branch: use argv_array for default arguments
2015-11-01checkout: add --progress optionLibravatar Edmundo Carmona Antoranz1-2/+12
Under normal circumstances, and like other git commands, git checkout will write progress info to stderr if attached to a terminal. This option allows progress to be forced even if not using a terminal. Also, progress can be skipped if using option --no-progress. Signed-off-by: Edmundo Carmona Antoranz <eantoranz@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-11-01show-branch: use argv_array for default argumentsLibravatar René Scharfe1-16/+8
Use argv_array instead of open-coding it. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-10-30blame: allow blame --reverse --first-parent when it makes senseLibravatar Max Kirillov1-2/+30
Allow combining --reverse and --first-parent if initial commit of specified range is at the first-parent chain starting from the final commit. Disable the prepare_revision_walk()'s builtin children collection, instead picking only the ones which are along the first parent chain. Signed-off-by: Max Kirillov <max@max630.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-10-30blame: extract find_single_finalLibravatar Max Kirillov1-12/+17
Signed-off-by: Max Kirillov <max@max630.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-10-30Merge branch 'jk/merge-file-exit-code'Libravatar Junio C Hamano1-0/+3
"git merge-file" tried to signal how many conflicts it found, which obviously would not work well when there are too many of them. * jk/merge-file-exit-code: merge-file: clamp exit code to maximum 127
2015-10-30Merge branch 'rs/pop-commit'Libravatar Junio C Hamano5-37/+14
Code simplification. * rs/pop-commit: use pop_commit() for consuming the first entry of a struct commit_list
2015-10-30Merge branch 'mk/blame-error-message'Libravatar Junio C Hamano1-1/+1
The error message from "git blame --contents --reverse" incorrectly talked about "--contents --children". * mk/blame-error-message: blame: fix option name in error message
2015-10-30Merge branch 'js/misc-fixes'Libravatar Junio C Hamano1-1/+1
Various compilation fixes and squelching of warnings. * js/misc-fixes: Correct fscanf formatting string for I64u values Silence GCC's "cast of pointer to integer of a different size" warning Squelch warning about an integer overflow
2015-10-30Merge branch 'jc/add-u-A-default-to-top'Libravatar Junio C Hamano1-7/+1
"git --literal-pathspecs add -u/-A" without any command line argument misbehaved ever since Git 2.0. * jc/add-u-A-default-to-top: add: simplify -u/-A without pathspec
2015-10-30Merge branch 'ar/clone-dissociate'Libravatar Junio C Hamano1-8/+8
"git clone --dissociate" used to require that "--reference" was used at the same time, but you can create a new repository that borrows objects from another without using "--reference", namely with "clone --local" from a repository that borrows objects from other repositories. * ar/clone-dissociate: clone: allow "--dissociate" without reference
2015-10-29Merge branch 'jc/am-mailinfo-direct'Libravatar Junio C Hamano1-19/+23
"git am" used to spawn "git mailinfo" via run_command() API once per each patch, but learned to make a direct call to mailinfo() instead. * jc/am-mailinfo-direct: am: make direct call to mailinfo
2015-10-29Merge branch 'jc/mailinfo-lib'Libravatar Junio C Hamano1-1035/+20
The implementation of "git mailinfo" was refactored so that a mailinfo() function can be directly called from inside a process. * jc/mailinfo-lib: (34 commits) mailinfo: remove calls to exit() and die() deep in the callchain mailinfo: handle charset conversion errors in the caller mailinfo: libify mailinfo: keep the parsed log message in a strbuf mailinfo: handle_commit_msg() shouldn't be called after finding patchbreak mailinfo: move content/content_top to struct mailinfo mailinfo: move [ps]_hdr_data to struct mailinfo mailinfo: move cmitmsg and patchfile to struct mailinfo mailinfo: move charset to struct mailinfo mailinfo: move transfer_encoding to struct mailinfo mailinfo: move check for metainfo_charset to convert_to_utf8() mailinfo: move metainfo_charset to struct mailinfo mailinfo: move use_scissors and use_inbody_headers to struct mailinfo mailinfo: move add_message_id and message_id to struct mailinfo mailinfo: move patch_lines to struct mailinfo mailinfo: move filter/header stage to struct mailinfo mailinfo: move global "FILE *fin, *fout" to struct mailinfo mailinfo: move keep_subject & keep_non_patch_bracket to struct mailinfo mailinfo: introduce "struct mailinfo" to hold globals mailinfo: move global "line" into mailinfo() function ...
2015-10-29merge-file: clamp exit code to maximum 127Libravatar Jeff King1-0/+3
Git-merge-file is documented to return one of three exit codes: - zero means the merge was successful - a negative number means an error occurred - a positive number indicates the number of conflicts Unfortunately, this all gets stuffed into an 8-bit return code. Which means that if you have 256 conflicts, this wraps to zero, and the merge appears to succeed (and commits a blob full of conflict-marker cruft!). This patch clamps the return value to a maximum of 127, which we should be able to safely represent everywhere. This also leaves 128-255 for other values. Shells (and some parts of git) will typically represent signal death as 128 plus the signal number. And negative values are typically coerced to an 8-bit unsigned value (so "return -1" ends up as 255). Technically negative returns have the same problem (e.g., "-256" wraps back to 0), but this is not a problem in practice, as the only negative value we use is "-1". Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-10-26Merge branch 'jk/repository-extension'Libravatar Junio C Hamano3-9/+17
Prepare for Git on-disk repository representation to undergo backward incompatible changes by introducing a new repository format version "1", with an extension mechanism. * jk/repository-extension: introduce "preciousObjects" repository extension introduce "extensions" form of core.repositoryformatversion