summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2016-12-22grep: search history of moved submodulesLibravatar Brandon Williams2-2/+59
If a submodule was renamed at any point since it's inception then if you were to try and grep on a commit prior to the submodule being moved, you wouldn't be able to find a working directory for the submodule since the path in the past is different from the current path. This patch teaches grep to find the .git directory for a submodule in the parents .git/modules/ directory in the event the path to the submodule in the commit that is being searched differs from the state of the currently checked out commit. If found, the child process that is spawned to grep the submodule will chdir into its gitdir instead of a working directory. In order to override the explicit setting of submodule child process's gitdir environment variable (which was introduced in '10f5c526') `GIT_DIR_ENVIORMENT` needs to be pushed onto child process's env_array. This allows the searching of history from a submodule's gitdir, rather than from a working directory. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-12-22grep: enable recurse-submodules to work on <tree> objectsLibravatar Brandon Williams4-9/+211
Teach grep to recursively search in submodules when provided with a <tree> object. This allows grep to search a submodule based on the state of the submodule that is present in a commit of the super project. When grep is provided with a <tree> object, the name of the object is prefixed to all output. In order to provide uniformity of output between the parent and child processes the option `--parent-basename` has been added so that the child can preface all of it's output with the name of the parent's object instead of the name of the commit SHA1 of the submodule. This changes output from the command `git grep -e. -l --recurse-submodules HEAD` from: HEAD:file <commit sha1 of submodule>:sub/file to: HEAD:file HEAD:sub/file Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-12-22grep: optionally recurse into submodulesLibravatar Brandon Williams4-20/+386
Allow grep to recognize submodules and recursively search for patterns in each submodule. This is done by forking off a process to recursively call grep on each submodule. The top level --super-prefix option is used to pass a path to the submodule which can in turn be used to prepend to output or in pathspec matching logic. Recursion only occurs for submodules which have been initialized and checked out by the parent project. If a submodule hasn't been initialized and checked out it is simply skipped. In order to support the existing multi-threading infrastructure in grep, output from each child process is captured in a strbuf so that it can be later printed to the console in an ordered fashion. To limit the number of theads that are created, each child process has half the number of threads as its parents (minimum of 1), otherwise we potentailly have a fork-bomb. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-12-22grep: add submodules as a grep source typeLibravatar Brandon Williams2-1/+16
Add `GREP_SOURCE_SUBMODULE` as a grep_source type and cases for this new type in the various switch statements in grep.c. When initializing a grep_source with type `GREP_SOURCE_SUBMODULE` the identifier can either be NULL (to indicate that the working tree will be used) or a SHA1 (the REV of the submodule to be grep'd). If the identifier is a SHA1 then we want to fall through to the `GREP_SOURCE_SHA1` case to handle the copying of the SHA1. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-12-22submodules: load gitmodules file from commit sha1Libravatar Brandon Williams6-7/+25
teach submodules to load a '.gitmodules' file from a commit sha1. This enables the population of the submodule_cache to be based on the state of the '.gitmodules' file from a particular commit. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-12-22submodules: add helper to determine if a submodule is initializedLibravatar Brandon Williams2-0/+24
Add the `is_submodule_initialized()` helper function to submodules.c. `is_submodule_initialized()` performs a check to determine if the submodule at the given path has been initialized. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-12-22submodules: add helper to determine if a submodule is populatedLibravatar Brandon Williams2-0/+16
Add the `is_submodule_populated()` helper function to submodules.c. `is_submodule_populated()` performes a check to see if a submodule has been checkout out (and has a valid .git directory/file) at the given path. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-12-22real_path: canonicalize directory separators in root partsLibravatar Johannes Sixt1-12/+17
When an absolute path is resolved, resolution begins at the first path component after the root part. The root part is just copied verbatim, because it must not be inspected for symbolic links. For POSIX paths, this is just the initial slash, but on Windows, the root part has the forms c:\ or \\server\share. We do want to canonicalize the back-slashes in the root part because these parts are compared to the result of getcwd(), which does return a fully canonicalized path. Factor out a helper that splits off the root part, and have it canonicalize the copied part. This change was prompted because t1504-ceiling-dirs.sh caught a breakage in GIT_CEILING_DIRECTORIES handling on Windows. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Acked-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-12-12real_path: have callers use real_pathdup and strbuf_realpathLibravatar Brandon Williams7-13/+16
Migrate callers of real_path() who duplicate the retern value to use real_pathdup or strbuf_realpath. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-12-12real_path: create real_pathdupLibravatar Brandon Williams2-0/+14
Create real_pathdup which returns a caller owned string of the resolved realpath based on the provide path. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-12-12real_path: convert real_path_internal to strbuf_realpathLibravatar Brandon Williams2-28/+27
Change the name of real_path_internal to strbuf_realpath. In addition push the static strbuf up to its callers and instead take as a parameter a pointer to a strbuf to use for the final result. This change makes strbuf_realpath reentrant. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-12-12real_path: resolve symlinks by handLibravatar Brandon Williams1-61/+129
The current implementation of real_path uses chdir() in order to resolve symlinks. Unfortunately this isn't thread-safe as chdir() affects a process as a whole and not just an individual thread. Instead perform the symlink resolution by hand so that the calls to chdir() can be removed, making real_path one step closer to being reentrant. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-12-05Start post 2.11 cycleLibravatar Junio C Hamano3-2/+45
For now, let's call it 2.12 tentatively. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-12-05Sync with maint-2.10Libravatar Junio C Hamano1-0/+48
* maint-2.10: preparing for 2.10.3
2016-12-05preparing for 2.10.3Libravatar Junio C Hamano2-1/+49
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-12-05Merge branch 'jk/common-main' into maint-2.10Libravatar Junio C Hamano5-11/+12
* jk/common-main: common-main: stop munging argv[0] path git-compat-util: move content inside ifdef/endif guards
2016-11-29Merge branch 'tk/diffcore-delta-remove-unused' into maintLibravatar Junio C Hamano5-8/+1
Code cleanup. * tk/diffcore-delta-remove-unused: diffcore-delta: remove unused parameter to diffcore_count_changes()
2016-11-29Merge branch 'jk/create-branch-remove-unused-param' into maintLibravatar Junio C Hamano4-13/+18
Code clean-up. * jk/create-branch-remove-unused-param: create_branch: drop unused "head" parameter
2016-11-29Merge branch 'nd/worktree-lock' into maintLibravatar Junio C Hamano1-1/+1
Typofix. * nd/worktree-lock: git-worktree.txt: fix typo "to"/"two", and add comma
2016-11-29Merge branch 'ps/common-info-doc' into maintLibravatar Junio C Hamano1-1/+1
Doc fix. * ps/common-info-doc: doc: fix location of 'info/' with $GIT_COMMON_DIR
2016-11-29Merge branch 'rs/cocci' into maintLibravatar Junio C Hamano1-0/+15
Improve the rule to convert "unsigned char [20]" into "struct object_id *" in contrib/coccinelle/ * rs/cocci: cocci: avoid self-references in object_id transformations
2016-11-29Merge branch 'nd/test-helpers' into maintLibravatar Junio C Hamano2-3/+18
Update to the test framework made in 2.9 timeframe broke running the tests under valgrind, which has been fixed. * nd/test-helpers: valgrind: support test helpers
2016-11-29Merge branch 'sc/fmt-merge-msg-doc-markup-fix' into maintLibravatar Junio C Hamano1-2/+2
Documentation fix. * sc/fmt-merge-msg-doc-markup-fix: Documentation/fmt-merge-msg: fix markup in example
2016-11-29Merge branch 'rs/commit-pptr-simplify' into maintLibravatar Junio C Hamano1-8/+6
Code simplification. * rs/commit-pptr-simplify: commit: simplify building parents list
2016-11-29Merge branch 'jk/rebase-config-insn-fmt-docfix' into maintLibravatar Junio C Hamano1-1/+1
Documentation fix. * jk/rebase-config-insn-fmt-docfix: doc: fix missing "::" in config list
2016-11-29Merge branch 'ak/pre-receive-hook-template-modefix' into maintLibravatar Junio C Hamano1-0/+0
A trivial clean-up to a recently graduated topic. * ak/pre-receive-hook-template-modefix: pre-receive.sample: mark it executable
2016-11-29Merge branch 'ls/macos-update' into maintLibravatar Junio C Hamano2-1/+3
Portability update and workaround for builds on recent Mac OS X. * ls/macos-update: travis-ci: disable GIT_TEST_HTTPD for macOS Makefile: set NO_OPENSSL on macOS by default
2016-11-29Merge branch 'as/merge-attr-sleep' into maintLibravatar Junio C Hamano1-5/+13
Fix for a racy false-positive test failure. * as/merge-attr-sleep: t6026: clarify the point of "kill $(cat sleep.pid)" t6026: ensure that long-running script really is Revert "t6026-merge-attr: don't fail if sleep exits early" Revert "t6026-merge-attr: ensure that the merge driver was called" t6026-merge-attr: ensure that the merge driver was called t6026-merge-attr: don't fail if sleep exits early
2016-11-29Merge branch 'ak/sh-setup-dot-source-i18n-fix' into maintLibravatar Junio C Hamano1-3/+3
Recent update to git-sh-setup (a library of shell functions that are used by our in-tree scripted Porcelain commands) included another shell library git-sh-i18n without specifying where it is, relying on the $PATH. This has been fixed to be more explicit by prefixing $(git --exec-path) output in front. * ak/sh-setup-dot-source-i18n-fix: git-sh-setup: be explicit where to dot-source git-sh-i18n from.
2016-11-29Merge branch 'jk/daemon-path-ok-check-truncation' into maintLibravatar Junio C Hamano1-4/+21
"git daemon" used fixed-length buffers to turn URL to the repository the client asked for into the server side directory path, using snprintf() to avoid overflowing these buffers, but allowed possibly truncated paths to the directory. This has been tightened to reject such a request that causes overlong path to be required to serve. * jk/daemon-path-ok-check-truncation: daemon: detect and reject too-long paths
2016-11-29Merge branch 'rs/ring-buffer-wraparound' into maintLibravatar Junio C Hamano2-2/+4
The code that we have used for the past 10+ years to cycle 4-element ring buffers turns out to be not quite portable in theoretical world. * rs/ring-buffer-wraparound: hex: make wraparound of the index into ring-buffer explicit
2016-11-29Merge branch 'mm/send-email-cc-cruft-after-address' into maintLibravatar Junio C Hamano3-10/+42
"git send-email" attempts to pick up valid e-mails from the trailers, but people in real world write non-addresses there, like "Cc: Stable <add@re.ss> # 4.8+", which broke the output depending on the availability and vintage of Mail::Address perl module. * mm/send-email-cc-cruft-after-address: Git.pm: add comment pointing to t9000 t9000-addresses: update expected results after fix parse_mailboxes: accept extra text after <...> address
2016-11-29Merge branch 'cp/completion-negative-refs' into maintLibravatar Junio C Hamano1-3/+4
The command-line completion script (in contrib/) learned to complete "git cmd ^mas<HT>" to complete the negative end of reference to "git cmd ^master". * cp/completion-negative-refs: completion: support excluding refs
2016-11-29Merge branch 'jc/am-read-author-file' into maintLibravatar Junio C Hamano1-58/+45
Extract a small helper out of the function that reads the authors script file "git am" internally uses. This by itself is not useful until a second caller appears in the future for "rebase -i" helper. * jc/am-read-author-file: am: refactor read_author_script()
2016-11-29Git 2.11Libravatar Junio C Hamano2-1/+6
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-11-29Merge branch 'jk/common-main'Libravatar Junio C Hamano4-9/+10
Fix for a small regression in a topic already in 'master'. * jk/common-main: common-main: stop munging argv[0] path
2016-11-29Merge tag 'l10n-2.11.0-rnd3.1' of git://github.com/git-l10n/git-poLibravatar Junio C Hamano2-4189/+5888
l10n-2.11.0-rnd3.1: update ru and ca translations * tag 'l10n-2.11.0-rnd3.1' of git://github.com/git-l10n/git-po: l10n: ru.po: update Russian translation l10n: ca.po: update translation
2016-11-29common-main: stop munging argv[0] pathLibravatar Jeff King4-9/+10
Since 650c44925 (common-main: call git_extract_argv0_path(), 2016-07-01), the argv[0] that is seen in cmd_main() of individual programs is always the basename of the executable, as common-main strips off the full path. This can produce confusing results for git-daemon, which wants to re-exec itself. For instance, if the program was originally run as "/usr/lib/git/git-daemon", it will try just re-execing "git-daemon", which will find the first instance in $PATH. If git's exec-path has not been prepended to $PATH, we may find the git-daemon from a different version (or no git-daemon at all). Normally this isn't a problem. Git commands are run as "git daemon", the git wrapper puts the exec-path at the front of $PATH, and argv[0] is already "daemon" anyway. But running git-daemon via its full exec-path, while not really a recommended method, did work prior to 650c44925. Let's make it work again. The real goal of 650c44925 was not to munge argv[0], but to reliably set the argv0_path global. The only reason it munges at all is that one caller, the git.c wrapper, piggy-backed on that computation to find the command basename. Instead, let's leave argv[0] untouched in common-main, and have git.c do its own basename computation. While we're at it, let's drop the return value from git_extract_argv0_path(). It was only ever used in this one callsite, and its dual purposes is what led to this confusion in the first place. Note that by changing the interface, the compiler can confirm for us that there are no other callers storing the return value. But the compiler can't tell us whether any of the cmd_main() functions (besides git.c) were relying on the basename munging. However, we can observe that prior to 650c44925, no other cmd_main() functions did that munging, and no new cmd_main() functions have been introduced since then. So we can't be regressing any of those cases. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-11-29Merge branch 'russian-l10n' of https://github.com/DJm00n/git-po-ruLibravatar Jiang Xin1-2066/+2868
* 'russian-l10n' of https://github.com/DJm00n/git-po-ru: l10n: ru.po: update Russian translation
2016-11-29l10n: ru.po: update Russian translationLibravatar Dimitriy Ryazantcev1-2066/+2868
Signed-off-by: Dimitriy Ryazantcev <dimitriy.ryazantcev@gmail.com>
2016-11-28l10n: ca.po: update translationLibravatar Alex Henrie1-2123/+3020
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
2016-11-28RelNotes: spelling and phrasing fixupsLibravatar Marc Branchaud1-76/+72
Signed-off-by: Marc Branchaud <marcnarc@xiplink.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-11-28Merge tag 'l10n-2.11.0-rnd3' of git://github.com/git-l10n/git-poLibravatar Junio C Hamano8-2193/+3167
l10n-2.11.0-rnd3 * tag 'l10n-2.11.0-rnd3' of git://github.com/git-l10n/git-po: l10n: de.po: translate 210 new messages l10n: fix unmatched single quote in error message
2016-11-28l10n: de.po: translate 210 new messagesLibravatar Ralf Thielow1-2111/+3085
Translate 210 new messages came from git.pot update in fda7b09 (l10n: git.pot: v2.11.0 round 1 (209 new, 53 removed)) and c091ffb (l10n: git.pot: v2.11.0 round 2 (1 new, 1 removed)). Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
2016-11-25l10n: fix unmatched single quote in error messageLibravatar Jiang Xin7-82/+82
Translate one message introduced by commit: * 358718064b i18n: fix unmatched single quote in error message Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2016-11-23Git 2.11-rc3Libravatar Junio C Hamano2-1/+10
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-11-23Merge branch 'jc/setup-cleanup-fix'Libravatar Junio C Hamano8-20/+69
"git archive" and "git mailinfo" stopped reading from local configuration file with a recent update. * jc/setup-cleanup-fix: archive: read local configuration mailinfo: read local configuration
2016-11-23Merge branch 'jt/trailer-with-cruft'Libravatar Junio C Hamano1-1/+2
Doc update. * jt/trailer-with-cruft: doc: mention user-configured trailers
2016-11-23Merge branch 'js/rebase-i-commentchar-fix'Libravatar Junio C Hamano4-3/+34
"git rebase -i" did not work well with core.commentchar configuration variable for two reasons, both of which have been fixed. * js/rebase-i-commentchar-fix: rebase -i: handle core.commentChar=auto stripspace: respect repository config rebase -i: highlight problems with core.commentchar
2016-11-23Merge branch 'jc/for-each-ref-head-segfault-fix'Libravatar Junio C Hamano2-1/+11
Using a %(HEAD) placeholder in "for-each-ref --format=" option caused the command to segfault when on an unborn branch. * jc/for-each-ref-head-segfault-fix: for-each-ref: do not segv with %(HEAD) on an unborn branch