summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2016-04-26clone: add `--shallow-submodules` flagLibravatar Stefan Beller3-3/+102
When creating a shallow clone of a repository with submodules, the depth argument does not influence the submodules, i.e. the submodules are done as non-shallow clones. It is unclear what the best default is for the depth of submodules of a shallow clone, so we need to have the possibility to do all kinds of combinations: * shallow super project with shallow submodules e.g. build bots starting always from scratch. They want to transmit the least amount of network data as well as using the least amount of space on their hard drive. * shallow super project with unshallow submodules e.g. The superproject is just there to track a collection of repositories and it is not important to have the relationship between the repositories intact. However the history of the individual submodules matter. * unshallow super project with shallow submodules e.g. The superproject is the actual project and the submodule is a library which is rarely touched. The new switch to select submodules to be shallow or unshallow supports all of these three cases. It is easy to transition from the first to the second case by just unshallowing the submodules (`git submodule foreach git fetch --unshallow`), but it is not possible to transition from the second to the first case (as we would have already transmitted the non shallow over the network). That is why we want to make the first case the default in case of a shallow super project. This leads to the inconvenience in the second case with the shallow super project and unshallow submodules, as you need to pass `--no-shallow-submodules`. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-03-01clone: allow an explicit argument for parallel submodule clonesLibravatar Stefan Beller3-7/+33
Just pass it along to "git submodule update", which may pick reasonable defaults if you don't specify an explicit number. Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-03-01submodule update: expose parallelism to the userLibravatar Stefan Beller4-2/+34
Expose possible parallelism either via the "--jobs" CLI parameter or the "submodule.fetchJobs" setting. By having the variable initialized to -1, we make sure 0 can be passed into the parallel processing machine, which will then pick as many parallel workers as there are CPUs. Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-03-01submodule helper: remove double 'fatal: ' prefixLibravatar Stefan Beller1-2/+2
The prefix is added by die(...), so we don't have to do it. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-03-01git submodule update: have a dedicated helper for cloningLibravatar Stefan Beller2-34/+259
This introduces a new helper function in git submodule--helper which takes care of cloning all submodules, which we want to parallelize eventually. Some tests (such as empty URL, update_mode=none) are required in the helper to make the decision for cloning. These checks have been moved into the C function as well (no need to repeat them in the shell script). Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-03-01run_processes_parallel: rename parameters for the callbacksLibravatar Stefan Beller2-7/+7
The refs code has a similar pattern of passing around 'struct strbuf *err', which is strictly used for error reporting. This is not the case here, as the strbuf is used to accumulate all the output (whether it is error or not) for the user. Rename it to 'out'. Suggested-by: Jonathan Nieder <jrnieder@gmail.com> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-03-01run_processes_parallel: treat output of children as byte arrayLibravatar Stefan Beller3-4/+16
We do not want the output to be interrupted by a NUL byte, so we cannot use raw fputs. Introduce strbuf_write to avoid having long arguments in run-command.c. Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-03-01submodule update: direct error message to stderrLibravatar Stefan Beller2-4/+4
Reroute the error message for specified but initialized submodules to stderr instead of stdout. Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-03-01fetching submodules: respect `submodule.fetchJobs` config optionLibravatar Stefan Beller5-2/+38
This allows to configure fetching and updating in parallel without having the command line option. This moved the responsibility to determine how many parallel processes to start from builtin/fetch to submodule.c as we need a way to communicate "The user did not specify the number of parallel processes in the command line options" in the builtin fetch. The submodule code takes care of the precedence (CLI > config > default). Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-03-01submodule-config: drop check against NULLLibravatar Stefan Beller1-3/+3
Adhere to the common coding style of Git and not check explicitly for NULL throughout the file. There are still other occurrences in the code base but that is usually inside of conditions with side effects. Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-03-01submodule-config: keep update strategy aroundLibravatar Stefan Beller4-0/+52
Currently submodule.<name>.update is only handled by git-submodule.sh. C code will start to need to make use of that value as more of the functionality of git-submodule.sh moves into library code in C. Add the update field to 'struct submodule' and populate it so it can be read as sm->update or from sm->update_command. Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-03-01run-command: do not pass child process data into callbacksLibravatar Stefan Beller4-32/+9
The expected way to pass data into the callback is to pass them via the customizable callback pointer. The error reporting in default_{start_failure, task_finished} is not user friendly enough, that we want to encourage using the child data for such purposes. Furthermore the struct child data is cleaned by the run-command API, before we access them in the callbacks, leading to use-after-free situations. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-12-16submodules: allow parallel fetching, add tests and documentationLibravatar Stefan Beller6-4/+40
This enables the work of the previous patches. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-12-16fetch_populated_submodules: use new parallel job processingLibravatar Stefan Beller1-44/+98
In a later patch we enable parallel processing of submodules, this only adds the possibility for it. So this change should not change any user facing behavior. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-12-16run-command: add an asynchronous parallel child processorLibravatar Stefan Beller4-1/+522
This allows to run external commands in parallel with ordered output on stderr. If we run external commands in parallel we cannot pipe the output directly to the our stdout/err as it would mix up. So each process's output will flow through a pipe, which we buffer. One subprocess can be directly piped to out stdout/err for a low latency feedback to the user. Example: Let's assume we have 5 submodules A,B,C,D,E and each fetch takes a different amount of time as the different submodules vary in size, then the output of fetches in sequential order might look like this: time --> output: |---A---| |-B-| |-------C-------| |-D-| |-E-| When we schedule these submodules into maximal two parallel processes, a schedule and sample output over time may look like this: process 1: |---A---| |-D-| |-E-| process 2: |-B-| |-------C-------| output: |---A---|B|---C-------|DE So A will be perceived as it would run normally in the single child version. As B has finished by the time A is done, we can dump its whole progress buffer on stderr, such that it looks like it finished in no time. Once that is done, C is determined to be the visible child and its progress will be reported in real time. So this way of output is really good for human consumption, as it only changes the timing, not the actual output. For machine consumption the output needs to be prepared in the tasks, by either having a prefix per line or per block to indicate whose tasks output is displayed, because the output order may not follow the original sequential ordering: |----A----| |--B--| |-C-| will be scheduled to be all parallel: process 1: |----A----| process 2: |--B--| process 3: |-C-| output: |----A----|CB This happens because C finished before B did, so it will be queued for output before B. To detect when a child has finished executing, we check interleaved with other actions (such as checking the liveliness of children or starting new processes) whether the stderr pipe still exists. Once a child closed its stderr stream, we assume it is terminating very soon, and use `finish_command()` from the single external process execution interface to collect the exit status. By maintaining the strong assumption of stderr being open until the very end of a child process, we can avoid other hassle such as an implementation using `waitpid(-1)`, which is not implemented in Windows. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-12-16sigchain: add command to pop all common signalsLibravatar Stefan Beller2-0/+10
The new method removes all common signal handlers that were installed by sigchain_push. CC: Jeff King <peff@peff.net> Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-12-16strbuf: add strbuf_read_once to read without blockingLibravatar Stefan Beller2-0/+19
The new call will read from a file descriptor into a strbuf once. The underlying call xread is just run once. xread only reattempts reading in case of EINTR, which makes it suitable to use for a nonblocking read. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-12-16xread: poll on non blocking fdsLibravatar Stefan Beller1-2/+18
The man page of read(2) says: EAGAIN The file descriptor fd refers to a file other than a socket and has been marked nonblocking (O_NONBLOCK), and the read would block. EAGAIN or EWOULDBLOCK The file descriptor fd refers to a socket and has been marked nonblocking (O_NONBLOCK), and the read would block. POSIX.1-2001 allows either error to be returned for this case, and does not require these constants to have the same value, so a portable application should check for both possibilities. If we get an EAGAIN or EWOULDBLOCK the fd must have set O_NONBLOCK. As the intent of xread is to read as much as possible either until the fd is EOF or an actual error occurs, we can ease the feeder of the fd by not spinning the whole time, but rather wait for it politely by not busy waiting. We should not care if the call to poll failed, as we're in an infinite loop and can only get out with the correct read(). Signed-off-by: Stefan Beller <sbeller@google.com> Acked-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-12-16submodule.c: write "Fetching submodule <foo>" to stderrLibravatar Jonathan Nieder2-26/+27
The "Pushing submodule <foo>" progress output correctly goes to stderr, but "Fetching submodule <foo>" is going to stdout by mistake. Fix it to write to stderr. Noticed while trying to implement a parallel submodule fetch. When this particular output line went to a different file descriptor, it was buffered separately, resulting in wrongly interleaved output if we copied it to the terminal naively. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-12-11Update release notes to 2.7Libravatar Junio C Hamano1-65/+1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-12-11Merge branch 'maint'Libravatar Junio C Hamano1-0/+25
* maint: Prepare for 2.6.5
2015-12-11Prepare for 2.6.5Libravatar Junio C Hamano2-1/+26
This back-merges hopefully the last batch of trivially correct fixes to the 2.6.x maintenance track from the master branch. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-12-11Merge branch 'sn/null-pointer-arith-in-mark-tree-uninteresting' into maintLibravatar Junio C Hamano1-1/+3
mark_tree_uninteresting() has code to handle the case where it gets passed a NULL pointer in its 'tree' parameter, but the function had 'object = &tree->object' assignment before checking if tree is NULL. This gives a compiler an excuse to declare that tree will never be NULL and apply a wrong optimization. Avoid it. * sn/null-pointer-arith-in-mark-tree-uninteresting: revision.c: fix possible null pointer arithmetic
2015-12-11Merge branch 'sg/lock-file-commit-error' into maintLibravatar Junio C Hamano4-5/+8
Cosmetic improvement to lock-file error messages. * sg/lock-file-commit-error: Make error message after failing commit_lock_file() less confusing
2015-12-11Merge branch 'cb/t3404-shellquote' into maintLibravatar Junio C Hamano1-1/+1
* cb/t3404-shellquote: t3404: fix quoting of redirect for some versions of bash
2015-12-11Merge branch 'sb/doc-submodule-sync-recursive' into maintLibravatar Junio C Hamano1-1/+4
* sb/doc-submodule-sync-recursive: document submodule sync --recursive
2015-12-11Merge branch 'nd/doc-check-ref-format-typo' into maintLibravatar Junio C Hamano1-1/+1
* nd/doc-check-ref-format-typo: git-check-ref-format.txt: typo, s/avoids/avoid/
2015-12-11Merge branch 'rs/show-branch-argv-array' into maintLibravatar Junio C Hamano1-16/+8
Code simplification. * rs/show-branch-argv-array: show-branch: use argv_array for default arguments
2015-12-11Merge branch 'rs/pop-commit' into maintLibravatar Junio C Hamano10-92/+31
Code simplification. * rs/pop-commit: use pop_commit() for consuming the first entry of a struct commit_list
2015-12-11Merge branch 'as/subtree-with-spaces' into maintLibravatar Junio C Hamano2-74/+124
Update "git subtree" (in contrib/) so that it can take whitespaces in the pathnames, not only in the in-tree pathname but the name of the directory that the repository is in. * as/subtree-with-spaces: contrib/subtree: respect spaces in a repository path t7900-subtree: test the "space in a subdirectory name" case
2015-12-11Merge branch 'jk/test-lint-forbid-when-finished-in-subshell' into maintLibravatar Junio C Hamano4-16/+31
Because "test_when_finished" in our test framework queues the clean-up tasks to be done in a shell variable, it should not be used inside a subshell. Add a mechanism to allow 'bash' to catch such uses, and fix the ones that were found. * jk/test-lint-forbid-when-finished-in-subshell: test-lib-functions: detect test_when_finished in subshell t7800: don't use test_config in a subshell test-lib-functions: support "test_config -C <dir> ..." t5801: don't use test_when_finished in a subshell t7610: don't use test_config in a subshell
2015-12-11Merge branch 'sn/null-pointer-arith-in-mark-tree-uninteresting'Libravatar Junio C Hamano1-1/+3
mark_tree_uninteresting() has code to handle the case where it gets passed a NULL pointer in its 'tree' parameter, but the function had 'object = &tree->object' assignment before checking if tree is NULL. This gives a compiler an excuse to declare that tree will never be NULL and apply a wrong optimization. Avoid it. * sn/null-pointer-arith-in-mark-tree-uninteresting: revision.c: fix possible null pointer arithmetic
2015-12-11Merge branch 'sb/doc-submodule-sync-recursive'Libravatar Junio C Hamano1-1/+4
* sb/doc-submodule-sync-recursive: document submodule sync --recursive
2015-12-11Merge branch 'cb/t3404-shellquote'Libravatar Junio C Hamano1-1/+1
* cb/t3404-shellquote: t3404: fix quoting of redirect for some versions of bash
2015-12-11Merge branch 'sg/lock-file-commit-error'Libravatar Junio C Hamano4-5/+8
Cosmetic improvement to lock-file error messages. * sg/lock-file-commit-error: Make error message after failing commit_lock_file() less confusing
2015-12-10Git 2.7-rc0Libravatar Junio C Hamano1-1/+1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-12-10Sync with maintLibravatar Junio C Hamano1-0/+1
* maint: Documentation/git-update-index: add missing opts to synopsis
2015-12-10Update release notes to 2.7Libravatar Junio C Hamano1-0/+19
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-12-10Merge branch 'nd/doc-check-ref-format-typo'Libravatar Junio C Hamano1-1/+1
* nd/doc-check-ref-format-typo: git-check-ref-format.txt: typo, s/avoids/avoid/
2015-12-10Merge branch 'bc/object-id'Libravatar Junio C Hamano88-704/+716
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-10Merge branch 'dt/fsck-verify-pack-error'Libravatar Junio C Hamano1-1/+1
The exit code of git-fsck didnot reflect some types of errors found in packed objects, which has been corrected. * dt/fsck-verify-pack-error: verify_pack: do not ignore return value of verification function
2015-12-10Merge branch 'ls/travis-yaml'Libravatar Junio C Hamano1-0/+91
The necessary infrastructure to build topics using the free Travis CI has been added. Developers forking from this topic (and enabling Travis) can do their own builds, and we can turn on auto-builds for git/git (including build-status for pull requests that people open). * ls/travis-yaml: Add Travis CI support
2015-12-10Documentation/git-update-index: add missing opts to synopsisLibravatar Christian Couder1-0/+1
Split index related options should appear in the 'SYNOPSIS' section. These options are already documented in the 'OPTIONS' section. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-12-08Merge branch 'ep/ident-with-getaddrinfo'Libravatar Junio C Hamano1-4/+27
A build without NO_IPv6 used to use gethostbyname() when guessing user's hostname, instead of getaddrinfo() that is used in other codepaths in such a build. * ep/ident-with-getaddrinfo: ident.c: add support for IPv6
2015-12-08Merge branch 'ls/test-must-fail-sigpipe'Libravatar Junio C Hamano3-20/+41
Fix some racy client/server tests by treating SIGPIPE the same as a normal non-zero exit. * ls/test-must-fail-sigpipe: add "ok=sigpipe" to test_must_fail and use it to fix flaky tests implement test_might_fail using a refactored test_must_fail
2015-12-08Merge branch 'dt/refs-backend-pre-vtable'Libravatar Junio C Hamano7-3682/+3776
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-08Sync with 2.6.4Libravatar Junio C Hamano3-6/+21
2015-12-08Git 2.6.4Libravatar Junio C Hamano3-2/+18
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-12-08Merge branch 'rs/status-detached-head-memcmp' into maintLibravatar Junio C Hamano1-5/+4
Fix some string-matching corner cases when digging in the reflog for "git status". * rs/status-detached-head-memcmp: wt-status: correct and simplify check for detached HEAD
2015-12-08Merge branch 'ad/sha1-update-chunked' into maintLibravatar Junio C Hamano7-13/+69
Apple's common crypto implementation of SHA1_Update() does not take more than 4GB at a time, and we now have a compile-time workaround for it. * ad/sha1-update-chunked: sha1: allow limiting the size of the data passed to SHA1_Update() sha1: provide another level of indirection for the SHA-1 functions