summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2017-06-23pull: optionally rebase submodules (remote submodule changes only)Libravatar Stefan Beller5-16/+157
Teach pull to optionally update submodules when '--recurse-submodules' is provided. This will teach pull to run 'submodule update --rebase' when the '--recurse-submodules' and '--rebase' flags are given under specific circumstances. On a rebase workflow: ===================== 1. Both sides change the submodule ------------------------------ Let's assume the following history in a submodule: H---I---J---K---L local branch \ M---N---O---P remote branch and the following in the superproject (recorded submodule in parens): A(H)---B(I)---F(K)---G(L) local branch \ C(N)---D(N)---E(P) remote branch In an ideal world this would rebase the submodule and rewrite the submodule pointers that the superproject points at such that the superproject looks like A(H)---B(I) F(K')---G(L') rebased branch \ / C(N)---D(N)---E(P) remote branch and the submodule as: J---K---L (old dangeling tip) / H---I J'---K'---L' rebased branch \ / M---N---O---P remote branch And if a conflict arises in the submodule the superproject rebase would stop at that commit at which the submodule conflict occurs. Currently a "pull --rebase" in the superproject produces a merge conflict as the submodule pointer changes are conflicting and cannot be resolved. 2. Local submodule changes only ----------------------- Assuming histories as above, except that the remote branch would not contain submodule changes, then a result as A(H)---B(I) F(K)---G(L) rebased branch \ / C(I)---D(I)---E(I) remote branch is desire-able. This is what currently happens in rebase. If the recursive flag is given, the ideal git would produce a superproject as: A(H)---B(I) F(K')---G(L') rebased branch (incl. sub rebase!) \ / C(I)---D(I)---E(I) remote branch and the submodule as: J---K---L (old dangeling tip) / H---I J'---K'---L' locally rebased branch \ / M---N---O---P advanced branch This patch doesn't address this issue, however a test is added that this fails up front. 3. Remote submodule changes only ---------------------- Assuming histories as in (1) except that the local superproject branch would not have touched the submodule the rebase already works out in the superproject with no conflicts: A(H)---B(I) F(P)---G(P) rebased branch (no sub changes) \ / C(N)---D(N)---E(P) remote branch The recurse flag as presented in this patch would additionally update the submodule as: H---I J'---K'---L' rebased branch \ / M---N---O---P remote branch As neither J, K, L nor J', K', L' are referred to from the superproject, no rewriting of the superproject commits is required. Conclusion for 'pull --rebase --recursive' ----------------------------------------- If there are no local superproject changes it is sufficient to call "submodule update --rebase" as this produces the desired results. In case of conflicts, the behavior is the same as in 'submodule update --recursive' which is assumed to be sane. This patch implements (3) only. On a merge workflow: ==================== We'll start off with the same underlying DAG as in (1) in the rebase workflow. So in an ideal world a 'pull --merge --recursive' would produce this: H---I---J---K---L----X \ / M---N---O---P with X as the new merge-commit in the submodule and the superproject as: A(H)---B(I)---F(K)---G(L)---Y(X) \ / C(N)---D(N)---E(P) However modifying the submodules on the fly is not supported in git-merge such that Y(X) is not easy to produce in a single patch. In fact git-merge doesn't know about submodules at all. However when at least one side does not contain commits touching the submodule at all, then we do not need to perform the merge for the submodule but a fast-forward can be done via checking out either L or P in the submodule. This strategy is implemented in 68d03e4a6e (Implement automatic fast-forward merge for submodules, 2010-07-07) already, so to align with the rebase behavior we need to also update the worktree of the submodule. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-23builtin/fetch: parse recurse-submodules-default at default options parsingLibravatar Stefan Beller1-9/+10
Instead of just storing the string and then later calling our own parsing function 'parse_fetch_recurse_submodules_arg', make use of the function callback 'option_fetch_parse_recurse_submodules' that was introduced in the last patch. Also move all submodule recursing variables in one spot at the top of the file. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-23builtin/fetch: factor submodule recurse parsing out to submodule configLibravatar Stefan Beller3-16/+27
Later we want to access this parsing in builtin/pull as well. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-22Tenth batch for 2.14Libravatar Junio C Hamano1-0/+28
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-22Merge branch 'rs/strbuf-addftime-zZ'Libravatar Junio C Hamano5-11/+73
As there is no portable way to pass timezone information to strftime, some output format from "git log" and friends are impossible to produce. Teach our own strbuf_addftime to replace %z and %Z with caller-supplied values to help working around this. * rs/strbuf-addftime-zZ: date: use localtime() for "-local" time formats t0006: check --date=format zone offsets strbuf: let strbuf_addftime handle %z and %Z itself
2017-06-22Merge branch 'sd/t3200-branch-m-test'Libravatar Junio C Hamano1-0/+17
New test. * sd/t3200-branch-m-test: t3200: add test for single parameter passed to -m option
2017-06-22Merge branch 'ps/stash-push-pathspec-fix'Libravatar Junio C Hamano2-0/+19
"git stash push <pathspec>" did not work from a subdirectory at all. Bugfix for a topic in v2.13 * ps/stash-push-pathspec-fix: git-stash: fix pushing stash with pathspec from subdir
2017-06-22Merge branch 'ls/github'Libravatar Junio C Hamano2-0/+26
Help contributors that visit us at GitHub. * ls/github: Configure Git contribution guidelines for github.com
2017-06-22Merge branch 'sg/revision-parser-skip-prefix'Libravatar Junio C Hamano2-48/+44
Code clean-up. * sg/revision-parser-skip-prefix: revision.c: use skip_prefix() in handle_revision_pseudo_opt() revision.c: use skip_prefix() in handle_revision_opt() revision.c: stricter parsing of '--early-output' revision.c: stricter parsing of '--no-{min,max}-parents' revision.h: turn rev_info.early_output back into an unsigned int
2017-06-22Merge branch 'mh/fast-import-raise-default-depth'Libravatar Junio C Hamano2-2/+2
"fast-import" uses a default pack chain depth that is consistent with other parts of the system. * mh/fast-import-raise-default-depth: fast-import: increase the default pack depth to 50
2017-06-22Merge branch 'km/test-mailinfo-b-failure'Libravatar Junio C Hamano1-0/+42
New tests. * km/test-mailinfo-b-failure: t5100: add some more mailinfo tests
2017-06-22Merge branch 'ah/filter-branch-setup'Libravatar Junio C Hamano2-11/+26
"filter-branch" learned a pseudo filter "--setup" that can be used to define a common function/variable that can be used by other filters. * ah/filter-branch-setup: filter-branch: add [--] to usage filter-branch: add `--setup` step
2017-06-22Merge branch 'pc/dir-count-slashes'Libravatar Junio C Hamano4-21/+15
Three instances of the same helper function have been consolidated to one. * pc/dir-count-slashes: dir: create function count_slashes()
2017-06-22Merge branch 'sb/t4005-modernize'Libravatar Junio C Hamano1-52/+43
Test clean-up. * sb/t4005-modernize: t4005: modernize style and drop hard coded sha1
2017-06-22Merge branch 'nd/fopen-errors'Libravatar Junio C Hamano2-3/+4
Hotfix for a topic that is already in 'master'. * nd/fopen-errors: configure.ac: loosen FREAD_READS_DIRECTORIES test program
2017-06-19Ninth batch for 2.14Libravatar Junio C Hamano1-0/+29
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-19Merge branch 'jk/consistent-h'Libravatar Junio C Hamano12-13/+72
"git $cmd -h" for builtin commands calls the implementation of the command (i.e. cmd_$cmd() function) without doing any repository set-up, and the commands that expect RUN_SETUP is done by the Git potty needs to be prepared to show the help text without barfing. * jk/consistent-h: t0012: test "-h" with builtins git: add hidden --list-builtins option version: convert to parse-options diff- and log- family: handle "git cmd -h" early submodule--helper: show usage for "-h" remote-{ext,fd}: print usage message on invalid arguments upload-archive: handle "-h" option early credential: handle invalid arguments earlier
2017-06-19Merge branch 'ab/perf-remove-index-lock'Libravatar Junio C Hamano1-1/+8
When an existing repository is used for t/perf testing, we first create bit-for-bit copy of it, which may grab a transient state of the repository and freeze it into the repository used for testing, which then may cause Git operations to fail. Single out "the index being locked" case and forcibly drop the lock from the copy. * ab/perf-remove-index-lock: perf: work around the tested repo having an index.lock
2017-06-19Merge branch 'bw/object-id'Libravatar Junio C Hamano36-525/+539
Conversion from uchar[20] to struct object_id continues. * bw/object-id: (33 commits) diff: rename diff_fill_sha1_info to diff_fill_oid_info diffcore-rename: use is_empty_blob_oid tree-diff: convert path_appendnew to object_id tree-diff: convert diff_tree_paths to struct object_id tree-diff: convert try_to_follow_renames to struct object_id builtin/diff-tree: cleanup references to sha1 diff-tree: convert diff_tree_sha1 to struct object_id notes-merge: convert write_note_to_worktree to struct object_id notes-merge: convert verify_notes_filepair to struct object_id notes-merge: convert find_notes_merge_pair_ps to struct object_id notes-merge: convert merge_from_diffs to struct object_id notes-merge: convert notes_merge* to struct object_id tree-diff: convert diff_root_tree_sha1 to struct object_id combine-diff: convert find_paths_* to struct object_id combine-diff: convert diff_tree_combined to struct object_id diff: convert diff_flush_patch_id to struct object_id patch-ids: convert to struct object_id diff: finish conversion for prepare_temp_file to struct object_id diff: convert reuse_worktree_file to struct object_id diff: convert fill_filespec to struct object_id ...
2017-06-19Merge branch 'sb/submodule-rm-absorb'Libravatar Junio C Hamano1-4/+5
Doc update to a recently graduated topic. * sb/submodule-rm-absorb: Documentation/git-rm: correct submodule description
2017-06-19Merge branch 'ab/pcre-v2'Libravatar Junio C Hamano10-29/+349
Update "perl-compatible regular expression" support to enable JIT and also allow linking with the newer PCRE v2 library. * ab/pcre-v2: grep: add support for PCRE v2 grep: un-break building with PCRE >= 8.32 without --enable-jit grep: un-break building with PCRE < 8.20 grep: un-break building with PCRE < 8.32 grep: add support for the PCRE v1 JIT API log: add -P as a synonym for --perl-regexp grep: skip pthreads overhead when using one thread grep: don't redundantly compile throwaway patterns under threading
2017-06-19Merge branch 'jk/pathspec-magic-disambiguation'Libravatar Junio C Hamano2-10/+64
The convention for a command line is to follow "git cmdname --options" with revisions followed by an optional "--" disambiguator and then finally pathspecs. When "--" is not there, we make sure early ones are all interpretable as revs (and do not look like paths) and later ones are the other way around. A pathspec with "magic" (e.g. ":/p/a/t/h" that matches p/a/t/h from the top-level of the working tree, no matter what subdirectory you are working from) are conservatively judged as "not a path", which required disambiguation more often. The command line parser learned to say "it's a pathspec" a bit more often when the syntax looks like so. * jk/pathspec-magic-disambiguation: verify_filename(): flip order of checks verify_filename(): treat ":(magic)" as a pathspec check_filename(): handle ":^" path magic check_filename(): use skip_prefix check_filename(): refactor ":/" handling t4208: add check for ":/" without matching file
2017-06-15date: use localtime() for "-local" time formatsLibravatar Jeff King2-2/+13
When we convert seconds-since-epochs timestamps into a broken-down "struct tm", we do so by adjusting the timestamp according to the known offset and then using gmtime() to break down the result. This means that the resulting struct "knows" that it's in GMT, even though the time it represents is adjusted for a different zone. The fields where it stores this data are not portably accessible, so we have no way to override them to tell them the real zone info. For the most part, this works. Our date-formatting routines don't pay attention to these inaccessible fields, and use the same tz info we provided for adjustment. The one exception is when we call strftime(), whose %Z format reveals this hidden timezone data. We solved that by always showing the empty string for %Z. This is allowed by POSIX, but not very helpful to the user. We can't make this work in the general case, as there's no portable function for setting an arbitrary timezone (and anyway, we don't have the zone name for the author zones, only their offsets). But for the special case of the "-local" formats, we can just skip the adjustment and use localtime() instead of gmtime(). This makes --date=format-local:%Z work correctly, showing the local timezone instead of an empty string. The new test checks the result for "UTC", our default test-lib value for $TZ. Using something like EST5 might be more interesting, but the actual zone string is system-dependent (for instance, on my system it expands to just EST). Hopefully "UTC" is vanilla enough that every system treats it the same. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-15t0006: check --date=format zone offsetsLibravatar Jeff King1-2/+7
We already test that "%z" and "%Z" show the right thing, but we don't actually check that the time we display is the correct one. Let's add two new tests: 1. Test that "format:" shows the time in the author's timezone, just like the other time formats. 2. Test that "format-local:" shows time in the local timezone. We don't want to use our normal UTC for this, because its offset is zero (so the result would be "correct" even if the code forgot to apply the offset or applied it in the wrong direction). We'll use the EST5 zone, which is already used elsewhere in the script (and so is assumed to be available everywhere). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-15strbuf: let strbuf_addftime handle %z and %Z itselfLibravatar René Scharfe5-8/+54
There is no portable way to pass timezone information to strftime. Add parameters for timezone offset and name to strbuf_addftime and let it handle the timezone-related format specifiers %z and %Z internally. Callers can opt out for %Z by passing NULL as timezone name. %z is always handled internally -- this helps on Windows, where strftime would expand it to a timezone name (same as %Z), in violation of POSIX. Modifiers are not handled, e.g. %Ez is still passed to strftime. Use an empty string as timezone name in show_date (the only current caller) for now because we only have the timezone offset in non-local mode. POSIX allows %Z to resolve to an empty string in case of missing information. Helped-by: Ulrich Mueller <ulm@gentoo.org> Helped-by: Jeff King <peff@peff.net> Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-15sub-process: correct path to API docs in a commentLibravatar Christian Couder1-1/+1
Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Acked-by: Ben Peart <peartben@gmail.com> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-15Merge branch 'svn-doc' of git://bogomips.org/git-svnLibravatar Junio C Hamano1-0/+15
* 'svn-doc' of git://bogomips.org/git-svn: git-svn: document special options for commit-diff
2017-06-15configure.ac: loosen FREAD_READS_DIRECTORIES test programLibravatar Jeff King2-3/+4
We added an FREAD_READS_DIRECTORIES Makefile knob long ago in cba22528f (Add compat/fopen.c which returns NULL on attempt to open directory, 2008-02-08) to handle systems where reading from a directory returned garbage. This works by catching the problem at the fopen() stage and returning NULL. More recently, we found that there is a class of systems (including Linux) where fopen() succeeds but fread() fails. Since the solution is the same (having fopen return NULL), they use the same Makefile knob as of e2d90fd1c (config.mak.uname: set FREAD_READS_DIRECTORIES for Linux and FreeBSD, 2017-05-03). This works fine except for one thing: the autoconf test in configure.ac to set FREAD_READS_DIRECTORIES actually checks whether fread succeeds. Which means that on Linux systems, the knob isn't set (and we even override the config.mak.uname default). t1308 catches the failure. We can fix this by tweaking the autoconf test to cover both cases. In theory we might care about the distinction between the traditional "fread reads directories" case and the new "fopen opens directories". But since our solution catches the problem at the fopen stage either way, we don't actually need to know the difference. The "fopen" case is a superset. This does mean the FREAD_READS_DIRECTORIES name is slightly misleading. Probably FOPEN_OPENS_DIRECTORIES would be more accurate. But it would be disruptive to simply change the name (people's existing build configs would fail), and it's not worth the complexity of handling both. Let's just add a comment in the knob description. Reported-by: Øyvind A. Holm <sunny@sunbase.org> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-15git-svn: document special options for commit-diffLibravatar Andreas Heiduk1-0/+15
Some options specific for `git svn commit-diff` where not documented so far. Signed-off-by: Andreas Heiduk <asheiduk@gmail.com> Signed-off-by: Eric Wong <e@80x24.org>
2017-06-13Sync with maintLibravatar Junio C Hamano1-0/+37
2017-06-13Eighth batch for 2.14Libravatar Junio C Hamano1-14/+21
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-13Merge branch 'jk/pack-idx-corruption-safety'Libravatar Junio C Hamano1-1/+7
A flaky test has been corrected. * jk/pack-idx-corruption-safety: t5313: make extended-table test more deterministic
2017-06-13Merge branch 'nd/fopen-errors'Libravatar Junio C Hamano32-92/+125
We often try to open a file for reading whose existence is optional, and silently ignore errors from open/fopen; report such errors if they are not due to missing files. * nd/fopen-errors: mingw_fopen: report ENOENT for invalid file names mingw: verify that paths are not mistaken for remote nicknames log: fix memory leak in open_next_file() rerere.c: move error_errno() closer to the source system call print errno when reporting a system call error wrapper.c: make warn_on_inaccessible() static wrapper.c: add and use fopen_or_warn() wrapper.c: add and use warn_on_fopen_errors() config.mak.uname: set FREAD_READS_DIRECTORIES for Darwin, too config.mak.uname: set FREAD_READS_DIRECTORIES for Linux and FreeBSD clone: use xfopen() instead of fopen() use xfopen() in more places git_fopen: fix a sparse 'not declared' warning
2017-06-13Merge branch 'rf/completion'Libravatar Junio C Hamano1-1/+28
Completion updates. * rf/completion: completion: add git config credentialCache.ignoreSIGHUP completion: add git config credential completions completion: add git config advice completions completion: add git config am.threeWay completion completion: add git config core completions completion: add git config gc completions
2017-06-13Merge branch 'jc/diff-tree-stale-comment'Libravatar Junio C Hamano1-3/+5
Comment fix. * jc/diff-tree-stale-comment: diff-tree: update stale in-code comments
2017-06-13Merge branch 'sb/submodule-blanket-recursive'Libravatar Junio C Hamano16-98/+179
Many commands learned to pay attention to submodule.recurse configuration. * sb/submodule-blanket-recursive: builtin/fetch.c: respect 'submodule.recurse' option builtin/push.c: respect 'submodule.recurse' option builtin/grep.c: respect 'submodule.recurse' option Introduce 'submodule.recurse' option for worktree manipulators submodule loading: separate code path for .gitmodules and config overlay reset/checkout/read-tree: unify config callback for submodule recursion submodule test invocation: only pass additional arguments submodule recursing: do not write a config variable twice
2017-06-13Merge branch 'jc/noent-notdir'Libravatar Junio C Hamano9-10/+25
Our code often opens a path to an optional file, to work on its contents when we can successfully open it. We can ignore a failure to open if such an optional file does not exist, but we do want to report a failure in opening for other reasons (e.g. we got an I/O error, or the file is there, but we lack the permission to open). The exact errors we need to ignore are ENOENT (obviously) and ENOTDIR (less obvious). Instead of repeating comparison of errno with these two constants, introduce a helper function to do so. * jc/noent-notdir: treewide: use is_missing_file_error() where ENOENT and ENOTDIR are checked compat-util: is_missing_file_error()
2017-06-13Prepare for 2.13.2Libravatar Junio C Hamano2-1/+38
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-13Merge branch 'ad/pull-remote-doc' into maintLibravatar Junio C Hamano1-3/+3
Docfix. * ad/pull-remote-doc: docs: fix formatting and grammar
2017-06-13Merge branch 'jk/drop-free-refspecs' into maintLibravatar Junio C Hamano1-22/+6
Code clean-up. * jk/drop-free-refspecs: remote: drop free_refspecs() function
2017-06-13Merge branch 'jk/connect-symref-info-leak-fix' into maintLibravatar Junio C Hamano1-1/+1
Leakfix. * jk/connect-symref-info-leak-fix: connect.c: fix leak in parse_one_symref_info()
2017-06-13Merge branch 'rf/completion-config-commit' into maintLibravatar Junio C Hamano1-0/+3
Completion update. * rf/completion-config-commit: completion: add completions for git config commit
2017-06-13Merge branch 'ab/t3070-test-dedup' into maintLibravatar Junio C Hamano1-1/+0
Test cleanup. * ab/t3070-test-dedup: wildmatch test: remove redundant duplicate test
2017-06-13Merge branch 'jh/memihash-opt' into maintLibravatar Junio C Hamano1-5/+42
perf-test update. * jh/memihash-opt: p0004: don't error out if test repo is too small p0004: don't abort if multi-threaded is too slow p0004: use test_perf p0004: avoid using pipes p0004: simplify calls of test-lazy-init-name-hash
2017-06-13Merge branch 'tb/pull-ff-rebase-autostash' into maintLibravatar Junio C Hamano2-11/+32
"git pull --rebase --autostash" didn't auto-stash when the local history fast-forwards to the upstream. * tb/pull-ff-rebase-autostash: pull: ff --rebase --autostash works in dirty repo
2017-06-13Merge branch 'jh/close-index-before-stat' into maintLibravatar Junio C Hamano1-4/+9
The timestamp of the index file is now taken after the file is closed, to help Windows, on which a stale timestamp is reported by fstat() on a file that is opened for writing and data was written but not yet closed. * jh/close-index-before-stat: read-cache: close index.lock in do_write_index
2017-06-13Merge branch 'sl/clean-d-ignored-fix' into maintLibravatar Junio C Hamano6-5/+109
"git clean -d" used to clean directories that has ignored files, even though the command should not lose ignored ones without "-x". "git status --ignored" did not list ignored and untracked files without "-uall". These have been corrected. * sl/clean-d-ignored-fix: clean: teach clean -d to preserve ignored paths dir: expose cmp_name() and check_contains() dir: hide untracked contents of untracked dirs dir: recurse into untracked dirs for ignored files t7061: status --ignored should search untracked dirs t7300: clean -d should skip dirs with ignored files
2017-06-13Merge branch 'dk/send-email-avoid-net-smtp-ssl-when-able' into maintLibravatar Junio C Hamano1-19/+35
A hotfix to a topic in 'master'. * dk/send-email-avoid-net-smtp-ssl-when-able: send-email: Net::SMTP::starttls was introduced in v2.34 send-email: Net::SMTP::SSL is obsolete, use only when necessary
2017-06-13Merge branch 'jc/skip-test-in-the-middle' into maintLibravatar Junio C Hamano2-50/+56
A recent update to t5545-push-options.sh started skipping all the tests in the script when a web server testing is disabled or unavailable, not just the ones that require a web server. Non HTTP tests have been salvaged to always run in this script. * jc/skip-test-in-the-middle: t5545: enhance test coverage when no http server is installed test: allow skipping the remainder
2017-06-13Merge branch 'bw/forking-and-threading' into maintLibravatar Junio C Hamano9-134/+449
The "run-command" API implementation has been made more robust against dead-locking in a threaded environment. * bw/forking-and-threading: usage.c: drop set_error_handle() run-command: restrict PATH search to executable files run-command: expose is_executable function run-command: block signals between fork and execve run-command: add note about forking and threading run-command: handle dup2 and close errors in child run-command: eliminate calls to error handling functions in child run-command: don't die in child when duping /dev/null run-command: prepare child environment before forking string-list: add string_list_remove function run-command: use the async-signal-safe execv instead of execvp run-command: prepare command before forking t0061: run_command executes scripts without a #! line t5550: use write_script to generate post-update hook