Junio C Hamano [Fri, 24 Mar 2017 20:47:25 +0000 (13:47 -0700)]
Merge branch 'sb/submodule-update-initial-runs-custom-script' into next
A test fix.
* sb/submodule-update-initial-runs-custom-script:
t7406: correct test case for submodule-update initial population
Junio C Hamano [Fri, 24 Mar 2017 20:47:24 +0000 (13:47 -0700)]
Merge branch 'jk/quote-env-path-list-component' into next
A test fix.
* jk/quote-env-path-list-component:
t5615: fix a here-doc syntax error
Junio C Hamano [Thu, 23 Mar 2017 20:40:01 +0000 (13:40 -0700)]
Sync with 'master'
Junio C Hamano [Thu, 23 Mar 2017 18:20:46 +0000 (11:20 -0700)]
Merge branch 'js/rebase-helper'
A hotfix for a regression fix
* js/rebase-helper:
sequencer: fix missing newline
Brandon Williams [Thu, 23 Mar 2017 17:02:33 +0000 (10:02 -0700)]
sequencer: fix missing newline
When using rebase --interactive where one of the lines is marked as
'edit' this is the resulting output:
Stopped at
ec3b9c4... stuffYou can amend the commit now, with
git commit --amend
Once you are satisfied with your changes, run
git rebase --continue
A newline character is missing at the end of the "Stopped at ..." line and
before the "You can amend ..." line. This patch fixes the malformed output by
adding the missing newline character to the end of the "Stopped at ..." line.
Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Thu, 23 Mar 2017 00:47:34 +0000 (17:47 -0700)]
Merge branch 'km/t1400-modernization' into next
Code clean-up.
* km/t1400-modernization:
t1400: use test_when_finished for cleanup
t1400: remove a set of unused output files
t1400: use test_path_is_* helpers
t1400: set core.logAllRefUpdates in "logged by touch" tests
t1400: rename test descriptions to be unique
Junio C Hamano [Thu, 23 Mar 2017 00:47:33 +0000 (17:47 -0700)]
Merge branch 'jk/prefix-filename' into next
Code clean-up with minor bugfixes.
* jk/prefix-filename:
bundle: use prefix_filename with bundle path
prefix_filename: simplify windows #ifdef
prefix_filename: return newly allocated string
prefix_filename: drop length parameter
prefix_filename: move docstring to header file
hash-object: fix buffer reuse with --path in a subdirectory
Junio C Hamano [Thu, 23 Mar 2017 00:47:33 +0000 (17:47 -0700)]
Merge branch 'bw/submodule-is-active' into next
"what URL do we want to update this submodule?" and "are we
interested in this submodule?" are split into two distinct
concepts, and then the way used to express the latter got extended,
paving a way to make it easier to manage a project with many
submodules and make it possible to later extend use of multiple
worktrees for a project with submodules.
* bw/submodule-is-active:
submodule add: respect submodule.active and submodule.<name>.active
submodule--helper init: set submodule.<name>.active
clone: teach --recurse-submodules to optionally take a pathspec
submodule init: initialize active submodules
submodule: decouple url and submodule interest
submodule--helper clone: check for configured submodules using helper
submodule sync: use submodule--helper is-active
submodule sync: skip work for inactive submodules
submodule status: use submodule--helper is-active
submodule--helper: add is-active subcommand
Junio C Hamano [Thu, 23 Mar 2017 00:47:33 +0000 (17:47 -0700)]
Merge branch 'sb/checkout-recurse-submodules' into next
"git checkout" is taught the "--recurse-submodules" option.
* sb/checkout-recurse-submodules:
builtin/read-tree: add --recurse-submodules switch
builtin/checkout: add --recurse-submodules switch
entry.c: create submodules when interesting
unpack-trees: check if we can perform the operation for submodules
unpack-trees: pass old oid to verify_clean_submodule
update submodules: add submodule_move_head
submodule.c: get_super_prefix_or_empty
update submodules: move up prepare_submodule_repo_env
submodules: introduce check to see whether to touch a submodule
update submodules: add a config option to determine if submodules are updated
update submodules: add submodule config parsing
make is_submodule_populated gently
lib-submodule-update.sh: define tests for recursing into submodules
lib-submodule-update.sh: replace sha1 by hash
lib-submodule-update: teach test_submodule_content the -C <dir> flag
lib-submodule-update.sh: do not use ./. as submodule remote
lib-submodule-update.sh: reorder create_lib_submodule_repo
submodule--helper.c: remove duplicate code
connect_work_tree_and_git_dir: safely create leading directories
Junio C Hamano [Wed, 22 Mar 2017 22:12:07 +0000 (15:12 -0700)]
t7406: correct test case for submodule-update initial population
There are three issues with the test:
* The syntax of the here-doc was wrong, such that the entire test was
sucked into the here-doc, which is why the test succeeded.
* The variable $submodulesha1 was not expanded as it was inside a quoted
here text. We do not want to quote EOF marker for this.
* The redirection from the git command to the output file for comparison
was wrong as the -C operator from git doesn't apply to the redirect path.
Also we're interested in stderr of that command.
Noticed-by: Jan Palus <jan.palus@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Wed, 22 Mar 2017 19:56:43 +0000 (12:56 -0700)]
t5615: fix a here-doc syntax error
This came as part of jk/quote-env-path-list-component and was merged
to 2.11.1 and later.
Noticed-by: Jan Palus <jan.palus@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Tue, 21 Mar 2017 22:14:51 +0000 (15:14 -0700)]
Sync with master
Junio C Hamano [Tue, 21 Mar 2017 22:14:31 +0000 (15:14 -0700)]
Merge branch 'bw/grep-recurse-submodules' into next
Build fix for NO_PTHREADS build.
* bw/grep-recurse-submodules:
grep: fix builds with with no thread support
grep: set default output method
Junio C Hamano [Tue, 21 Mar 2017 22:11:38 +0000 (15:11 -0700)]
Sync with maint
Junio C Hamano [Tue, 21 Mar 2017 22:11:13 +0000 (15:11 -0700)]
Sixth batch for 2.13
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Tue, 21 Mar 2017 22:07:20 +0000 (15:07 -0700)]
Merge branch 'nd/commit-hook-doc-fix'
Doc fix.
* nd/commit-hook-doc-fix:
git-commit.txt: list post-rewrite in HOOKS section
Junio C Hamano [Tue, 21 Mar 2017 22:07:19 +0000 (15:07 -0700)]
Merge branch 'ab/push-default-doc-fix'
Doc fix.
* ab/push-default-doc-fix:
push: mention "push.default=tracking" in the documentation
Junio C Hamano [Tue, 21 Mar 2017 22:07:19 +0000 (15:07 -0700)]
Merge branch 'ab/doc-no-option-notation-fix'
Doc fix.
* ab/doc-no-option-notation-fix:
doc: change erroneous --[no]-whatever into --[no-]whatever
Junio C Hamano [Tue, 21 Mar 2017 22:07:18 +0000 (15:07 -0700)]
Merge branch 'sb/wt-status-cleanup'
Code clean-up.
* sb/wt-status-cleanup:
wt-status: simplify by using for_each_string_list_item
Junio C Hamano [Tue, 21 Mar 2017 22:07:18 +0000 (15:07 -0700)]
Merge branch 'js/rebase-helper'
Recent update to "rebase -i" started showing a message that is not
a warning with "warning:" prefix by mistake. This has been fixed.
* js/rebase-helper:
sequencer: drop "warning:" when stopping for edit
Junio C Hamano [Tue, 21 Mar 2017 22:07:18 +0000 (15:07 -0700)]
Merge branch 'nd/conditional-config-include'
The configuration file learned a new "includeIf.<condition>.path"
that includes the contents of the given path only when the
condition holds. This allows you to say "include this work-related
bit only in the repositories under my ~/work/ directory".
* nd/conditional-config-include:
config: add conditional include
config.txt: reflow the second include.path paragraph
config.txt: clarify multiple key values in include.path
Junio C Hamano [Tue, 21 Mar 2017 22:07:17 +0000 (15:07 -0700)]
Merge branch 'jk/pack-name-cleanups'
Code clean-up.
* jk/pack-name-cleanups:
index-pack: make pointer-alias fallbacks safer
replace snprintf with odb_pack_name()
odb_pack_keep(): stop generating keepfile name
sha1_file.c: make pack-name helper globally accessible
move odb_* declarations out of git-compat-util.h
Junio C Hamano [Tue, 21 Mar 2017 22:07:17 +0000 (15:07 -0700)]
Merge branch 'sb/submodule-config-parse-ignore-fix'
Code to read submodule.<name>.ignore config did not state the
variable name correctly when giving an error message diagnosing
misconfiguration.
* sb/submodule-config-parse-ignore-fix:
submodule-config: correct error reporting for invalid ignore value
Junio C Hamano [Tue, 21 Mar 2017 22:07:17 +0000 (15:07 -0700)]
Merge branch 'mg/prompt-describe-tags'
The command line prompt (in contrib/) learned a new 'tag' style
that can be specified with GIT_PS1_DESCRIBE_STYLE, to describe a
detached HEAD with "git describe --tags".
* mg/prompt-describe-tags:
git-prompt: add a describe style for any tags
Junio C Hamano [Tue, 21 Mar 2017 22:07:16 +0000 (15:07 -0700)]
Merge branch 'jk/rev-parse-cleanup'
Code clean-up.
* jk/rev-parse-cleanup:
rev-parse: simplify parsing of ref options
rev-parse: add helper for parsing "--foo/--foo="
rev-parse: use skip_prefix when parsing options
Junio C Hamano [Tue, 21 Mar 2017 22:04:12 +0000 (15:04 -0700)]
Prepare for 2.12.2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Tue, 21 Mar 2017 22:03:30 +0000 (15:03 -0700)]
Merge branch 'jh/send-email-one-cc' into maint
"Cc:" on the trailer part does not have to conform to RFC strictly,
unlike in the e-mail header. "git send-email" has been updated to
ignore anything after '>' when picking addresses, to allow non-address
cruft like " # stable 4.4" after the address.
* jh/send-email-one-cc:
send-email: only allow one address per body tag
Junio C Hamano [Tue, 21 Mar 2017 22:03:30 +0000 (15:03 -0700)]
Merge branch 'jk/t6300-cleanup' into maint
A test that creates a confusing branch whose name is HEAD has been
corrected not to do so.
* jk/t6300-cleanup:
t6300: avoid creating refs/heads/HEAD
Junio C Hamano [Tue, 21 Mar 2017 22:03:29 +0000 (15:03 -0700)]
Merge branch 'rs/commit-parsing-optim' into maint
The code that parses header fields in the commit object has been
updated for (micro)performance and code hygiene.
* rs/commit-parsing-optim:
commit: don't check for space twice when looking for header
commit: be more precise when searching for headers
Junio C Hamano [Tue, 21 Mar 2017 22:03:29 +0000 (15:03 -0700)]
Merge branch 'jk/show-branch-lift-name-len-limit' into maint
"git show-branch" expected there were only very short branch names
in the repository and used a fixed-length buffer to hold them
without checking for overflow.
* jk/show-branch-lift-name-len-limit:
show-branch: use skip_prefix to drop magic numbers
show-branch: store resolved head in heap buffer
show-branch: drop head_len variable
Junio C Hamano [Tue, 21 Mar 2017 22:03:28 +0000 (15:03 -0700)]
Merge branch 'jk/tempfile-ferror-fclose-confusion' into maint
A caller of tempfile API that uses stdio interface to write to
files may ignore errors while writing, which is detected when
tempfile is closed (with a call to ferror()). By that time, the
original errno that may have told us what went wrong is likely to
be long gone and was overwritten by an irrelevant value.
close_tempfile() now resets errno to EIO to make errno at least
predictable.
* jk/tempfile-ferror-fclose-confusion:
tempfile: set errno to a known value before calling ferror()
Junio C Hamano [Tue, 21 Mar 2017 22:03:28 +0000 (15:03 -0700)]
Merge branch 'rl/remote-allow-missing-branch-name-merge' into maint
"git remote rm X", when a branch has remote X configured as the
value of its branch.*.remote, tried to remove branch.*.remote and
branch.*.merge and failed if either is unset.
* rl/remote-allow-missing-branch-name-merge:
remote: ignore failure to remove missing branch.<name>.merge
Junio C Hamano [Tue, 21 Mar 2017 22:03:28 +0000 (15:03 -0700)]
Merge branch 'dt/gc-ignore-old-gc-logs' into maint
A "gc.log" file left by a backgrounded "gc --auto" disables further
automatic gc; it has been taught to run at least once a day (by
default) by ignoring a stale "gc.log" file that is too old.
* dt/gc-ignore-old-gc-logs:
gc: ignore old gc.log files
Junio C Hamano [Tue, 21 Mar 2017 22:03:27 +0000 (15:03 -0700)]
Merge branch 'jt/upload-pack-error-report' into maint
"git upload-pack", which is a counter-part of "git fetch", did not
report a request for a ref that was not advertised as invalid.
This is generally not a problem (because "git fetch" will stop
before making such a request), but is the right thing to do.
* jt/upload-pack-error-report:
upload-pack: report "not our ref" to client
Junio C Hamano [Tue, 21 Mar 2017 22:03:27 +0000 (15:03 -0700)]
Merge branch 'rs/sha1-file-plug-fallback-base-leak' into maint
A leak in a codepath to read from a packed object in (rare) cases
has been plugged.
* rs/sha1-file-plug-fallback-base-leak:
sha1_file: release fallback base's memory in unpack_entry()
Junio C Hamano [Tue, 21 Mar 2017 22:03:26 +0000 (15:03 -0700)]
Merge branch 'ss/remote-bzr-hg-placeholder-wo-python' into maint
There is no need for Python only to give a few messages to the
standard error stream, but we somehow did.
* ss/remote-bzr-hg-placeholder-wo-python:
contrib: git-remote-{bzr,hg} placeholders don't need Python
Junio C Hamano [Tue, 21 Mar 2017 22:03:26 +0000 (15:03 -0700)]
Merge branch 'jc/diff-populate-filespec-size-only-fix' into maint
"git diff --quiet" relies on the size field in diff_filespec to be
correctly populated, but diff_populate_filespec() helper function
made an incorrect short-cut when asked only to populate the size
field for paths that need to go through convert_to_git() (e.g. CRLF
conversion).
* jc/diff-populate-filespec-size-only-fix:
diff: do not short-cut CHECK_SIZE_ONLY check in diff_populate_filespec()
Junio C Hamano [Tue, 21 Mar 2017 22:03:25 +0000 (15:03 -0700)]
Merge branch 'jk/http-walker-buffer-underflow-fix' into maint
"Dumb http" transport used to misparse a nonsense http-alternates
response, which has been fixed.
* jk/http-walker-buffer-underflow-fix:
http-walker: fix buffer underflow processing remote alternates
Junio C Hamano [Tue, 21 Mar 2017 22:03:25 +0000 (15:03 -0700)]
Merge branch 'mg/status-porcelain-no-i18n' into maint
"git status --porcelain" is supposed to give a stable output, but a
few strings were left as translatable by mistake.
* mg/status-porcelain-no-i18n:
git-status: make porcelain more robust
Junio C Hamano [Tue, 21 Mar 2017 22:03:25 +0000 (15:03 -0700)]
Merge branch 'ps/docs-diffcore' into maint
Doc update.
* ps/docs-diffcore:
docs/diffcore: unquote "Complete Rewrites" in headers
docs/diffcore: fix grammar in diffcore-rename header
Junio C Hamano [Tue, 21 Mar 2017 22:03:24 +0000 (15:03 -0700)]
Merge branch 'ew/markdown-url-in-readme' into maint
Doc update.
* ew/markdown-url-in-readme:
README: create HTTP/HTTPS links from URLs in Markdown
Junio C Hamano [Tue, 21 Mar 2017 22:03:24 +0000 (15:03 -0700)]
Merge branch 'rj/remove-unused-mktemp' into maint
Code cleanup.
* rj/remove-unused-mktemp:
wrapper.c: remove unused gitmkstemps() function
wrapper.c: remove unused git_mkstemp() function
Junio C Hamano [Tue, 21 Mar 2017 22:03:23 +0000 (15:03 -0700)]
Merge branch 'jk/ewah-use-right-type-in-sizeof' into maint
Code clean-up.
* jk/ewah-use-right-type-in-sizeof:
ewah: fix eword_t/uint64_t confusion
Jeff King [Tue, 21 Mar 2017 01:31:27 +0000 (21:31 -0400)]
bundle: use prefix_filename with bundle path
We may take the path to a bundle file as an argument, and
need to adjust the filename based on the prefix we
discovered while setting up the git directory. We do so
manually into a fixed-size buffer, but using
prefix_filename() is the normal way.
Besides being more concise, there are two subtle
improvements:
1. The original inserted a "/" between the two paths, even
though the "prefix" argument always has the "/"
appended. That means that:
cd subdir && git bundle verify ../foo.bundle
was looking at (and reporting) subdir//../foo.bundle.
Harmless, but ugly. Using prefix_filename() gets this
right.
2. The original checked for an absolute path by looking
for a leading '/'. It should have been using
is_absolute_path(), which also covers more cases on
Windows (backslashes and dos drive prefixes).
But it's easier still to just pass the name to
prefix_filename(), which handles this case
automatically.
Note that we'll just leak the resulting buffer in the name
of simplicity, since it needs to last through the duration
of the program anyway.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Tue, 21 Mar 2017 01:30:41 +0000 (21:30 -0400)]
prefix_filename: simplify windows #ifdef
The prefix_filename function used to do an early return when
there was no prefix on non-Windows platforms, but always
allocated on Windows so that it could call convert_slashes().
Now that the function always allocates, we can unify the
logic and make convert_slashes() the only conditional part.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Tue, 21 Mar 2017 01:28:49 +0000 (21:28 -0400)]
prefix_filename: return newly allocated string
The prefix_filename() function returns a pointer to static
storage, which makes it easy to use dangerously. We already
fixed one buggy caller in hash-object recently, and the
calls in apply.c are suspicious (I didn't dig in enough to
confirm that there is a bug, but we call the function once
in apply_all_patches() and then again indirectly from
parse_chunk()).
Let's make it harder to get wrong by allocating the return
value. For simplicity, we'll do this even when the prefix is
empty (and we could just return the original file pointer).
That will cause us to allocate sometimes when we wouldn't
otherwise need to, but this function isn't called in
performance critical code-paths (and it already _might_
allocate on any given call, so a caller that cares about
performance is questionable anyway).
The downside is that the callers need to remember to free()
the result to avoid leaking. Most of them already used
xstrdup() on the result, so we know they are OK. The
remainder have been converted to use free() as appropriate.
I considered retaining a prefix_filename_unsafe() for cases
where we know the static lifetime is OK (and handling the
cleanup is awkward). This is only a handful of cases,
though, and it's not worth the mental energy in worrying
about whether the "unsafe" variant is OK to use in any
situation.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Tue, 21 Mar 2017 01:22:28 +0000 (21:22 -0400)]
prefix_filename: drop length parameter
This function takes the prefix as a ptr/len pair, but in
every caller the length is exactly strlen(ptr). Let's
simplify the interface and just take the string. This saves
callers specifying it (and in some cases handling a NULL
prefix).
In a handful of cases we had the length already without
calling strlen, so this is technically slower. But it's not
likely to matter (after all, if the prefix is non-empty
we'll allocate and copy it into a buffer anyway).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Tue, 21 Mar 2017 01:21:27 +0000 (21:21 -0400)]
prefix_filename: move docstring to header file
This is a public function, so we should make its
documentation available near the declaration.
While we're at it, we can give a few details about how it
works.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Tue, 21 Mar 2017 01:20:42 +0000 (21:20 -0400)]
hash-object: fix buffer reuse with --path in a subdirectory
The hash-object command uses prefix_filename() without
duplicating its return value. Since that function returns a
static buffer, the value is overwritten by subsequent calls.
This can cause incorrect results when we use --path along
with hashing a file by its relative path, both of which need
to call prefix_filename(). We overwrite the filename
computed for --path, effectively ignoring it.
We can fix this by calling xstrdup on the return value. Note
that we don't bother freeing the "vpath" instance, as it
remains valid until the program exit.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Kyle Meyer [Tue, 21 Mar 2017 00:56:16 +0000 (20:56 -0400)]
t1400: use test_when_finished for cleanup
Move cleanup lines that occur after test blocks into
test_when_finished calls within the test bodies. Don't move cleanup
lines that seem to be related to mutiple tests rather than a single
test.
Signed-off-by: Kyle Meyer <kyle@kyleam.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Kyle Meyer [Tue, 21 Mar 2017 00:56:15 +0000 (20:56 -0400)]
t1400: remove a set of unused output files
This test case redirects stdout and stderr to output files, but,
unlike the other cases of redirection in the t1400 tests, these files
are not examined downstream. Remove the redirection so that the
output is visible when running the tests verbosely.
Signed-off-by: Kyle Meyer <kyle@kyleam.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Kyle Meyer [Tue, 21 Mar 2017 00:56:14 +0000 (20:56 -0400)]
t1400: use test_path_is_* helpers
Signed-off-by: Kyle Meyer <kyle@kyleam.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Kyle Meyer [Tue, 21 Mar 2017 00:56:13 +0000 (20:56 -0400)]
t1400: set core.logAllRefUpdates in "logged by touch" tests
A group of update-ref tests verifies that logs are created when either
the log file for the ref already exists or core.logAllRefUpdates is
"true". However, when the default for core.logAllRefUpdates was
changed in
0bee59186 (Enable reflogs by default in any repository with
a working directory., 2006-12-14), the setup for the tests was not
updated. As a result, the "logged by touch" tests would pass even if
the log file did not exist (i.e., if "--create-reflog" was removed
from the first "git update-ref" call).
Update the "logged by touch" tests to disable core.logAllRefUpdates
explicitly so that the behavior does not depend on the default value.
While we're here, update the "logged by config" tests to use
test_config() rather than setting core.logAllRefUpdates to "true"
outside of the tests.
Signed-off-by: Kyle Meyer <kyle@kyleam.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Kyle Meyer [Tue, 21 Mar 2017 00:56:12 +0000 (20:56 -0400)]
t1400: rename test descriptions to be unique
A few tests share their description with another test. Extend the
descriptions to indicate how the tests differ.
Signed-off-by: Kyle Meyer <kyle@kyleam.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Mon, 20 Mar 2017 21:03:35 +0000 (14:03 -0700)]
Sync with master
Junio C Hamano [Mon, 20 Mar 2017 21:03:28 +0000 (14:03 -0700)]
Merge branch 'jk/sha1dc' into next
Borrow "detect attempt to create collisions" variant of SHA-1
implementation by Marc Stevens (CWI) and Dan Shumow (Microsoft).
* jk/sha1dc:
Makefile: make DC_SHA1 the default
t0013: add a basic sha1 collision detection test
Makefile: add DC_SHA1 knob
sha1dc: disable safe_hash feature
sha1dc: adjust header includes for git
sha1dc: add collision-detecting sha1 implementation
Junio C Hamano [Mon, 20 Mar 2017 21:03:28 +0000 (14:03 -0700)]
Merge branch 'nd/commit-hook-doc-fix' into next
Doc fix.
* nd/commit-hook-doc-fix:
git-commit.txt: list post-rewrite in HOOKS section
Junio C Hamano [Mon, 20 Mar 2017 21:03:27 +0000 (14:03 -0700)]
Merge branch 'ab/push-default-doc-fix' into next
Doc fix.
* ab/push-default-doc-fix:
push: mention "push.default=tracking" in the documentation
Junio C Hamano [Mon, 20 Mar 2017 21:03:27 +0000 (14:03 -0700)]
Merge branch 'ab/doc-no-option-notation-fix' into next
Doc fix.
* ab/doc-no-option-notation-fix:
doc: change erroneous --[no]-whatever into --[no-]whatever
Junio C Hamano [Mon, 20 Mar 2017 21:03:27 +0000 (14:03 -0700)]
Merge branch 'sg/test-with-stdin' into next
Teach the "debug" helper used in the test framework that allows a
command to run under "gdb" to make the session interactive.
* sg/test-with-stdin:
tests: make the 'test_pause' helper work in non-verbose mode
tests: create an interactive gdb session with the 'debug' helper
Junio C Hamano [Mon, 20 Mar 2017 21:03:26 +0000 (14:03 -0700)]
Merge branch 'rs/update-hook-optim' into next
Code clean-up.
* rs/update-hook-optim:
receive-pack: simplify run_update_post_hook()
Junio C Hamano [Mon, 20 Mar 2017 21:03:26 +0000 (14:03 -0700)]
Merge branch 'rs/shortlog-cleanup' into next
Code clean-up.
* rs/shortlog-cleanup:
shortlog: don't set after_subject to an empty string
Junio C Hamano [Mon, 20 Mar 2017 21:03:25 +0000 (14:03 -0700)]
Merge branch 'rs/path-name-safety-cleanup' into next
Code clean-up.
* rs/path-name-safety-cleanup:
revision: remove declaration of path_name()
Junio C Hamano [Mon, 20 Mar 2017 21:03:24 +0000 (14:03 -0700)]
Merge branch 'rs/http-push-cleanup' into next
Code clean-up.
* rs/http-push-cleanup:
http-push: don't check return value of lookup_unknown_object()
Junio C Hamano [Mon, 20 Mar 2017 21:03:24 +0000 (14:03 -0700)]
Merge branch 'js/regexec-buf' into next
Fix for potential segv introduced in v2.11.0 and later (also
v2.10.2).
* js/regexec-buf:
pickaxe: fix segfault with '-S<...> --pickaxe-regex'
Junio C Hamano [Mon, 20 Mar 2017 21:03:23 +0000 (14:03 -0700)]
Merge branch 'jk/execv-dashed-external' into next
Fix for NO_PTHREADS build.
* jk/execv-dashed-external:
run-command: fix segfault when cleaning forked async process
Junio C Hamano [Mon, 20 Mar 2017 21:03:23 +0000 (14:03 -0700)]
Merge branch 'dl/credential-cache-socket-in-xdg-cache' into next
The default location "~/.git-credential-cache/socket" for the
socket used to communicate with the credential-cache daemon has
been moved to "~/.cache/git/credential/socket".
* dl/credential-cache-socket-in-xdg-cache:
credential-cache: add tests for XDG functionality
credential-cache: use XDG_CACHE_HOME for socket
path.c: add xdg_cache_home
Junio C Hamano [Mon, 20 Mar 2017 21:03:22 +0000 (14:03 -0700)]
Merge branch 'sb/wt-status-cleanup' into next
Code clean-up.
* sb/wt-status-cleanup:
wt-status: simplify by using for_each_string_list_item
Junio C Hamano [Mon, 20 Mar 2017 21:03:22 +0000 (14:03 -0700)]
Merge branch 'js/rebase-helper' into next
Recent update to "rebase -i" started showing a message that is not
a warning with "warning:" prefix by mistake. This has been fixed.
* js/rebase-helper:
sequencer: drop "warning:" when stopping for edit
Junio C Hamano [Mon, 20 Mar 2017 20:56:09 +0000 (13:56 -0700)]
Sync with 2.12.1
Junio C Hamano [Mon, 20 Mar 2017 20:56:00 +0000 (13:56 -0700)]
Merge branch 'js/difftool-builtin'
"git difftool --dir-diff" used to die a controlled death giving a
"fatal" message when encountering a locally modified symbolic link,
but it started segfaulting since v2.12. This has been fixed.
* js/difftool-builtin:
difftool: handle modified symlinks in dir-diff mode
t7800: cleanup cruft left behind by tests
t7800: remove whitespace before redirect
Junio C Hamano [Mon, 20 Mar 2017 20:17:08 +0000 (13:17 -0700)]
Git 2.12.1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ævar Arnfjörð Bjarmason [Sun, 19 Mar 2017 14:36:36 +0000 (14:36 +0000)]
push: mention "push.default=tracking" in the documentation
Change the documentation for push.tracking=* to re-include a mention
of what "tracking" does.
The "tracking" option was renamed to "upstream" back in
53c4031 ("push.default: Rename 'tracking' to 'upstream'", 2011-02-16),
this section was then subsequently rewritten in
87a70e4 ("config doc:
rewrite push.default section", 2013-06-19) to remove any mention of
"tracking".
Maybe we should just warn or die nowadays if this option is in the
config, but I had some old config of mine use this option, I'd
forgotten that it was a synonym, and nothing in git's documentation
mentioned that.
That's bad, either we shouldn't support it at all, or we should
document what it does. This patch does the latter.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy [Sun, 19 Mar 2017 09:01:02 +0000 (16:01 +0700)]
git-commit.txt: list post-rewrite in HOOKS section
The hook was added in
a86ed83cce (Merge branch 'tr/notes-display' -
2010-03-24), which updated githooks.txt but not git-commit.txt.
git-commit.txt was later updated in
e858af6d50 (commit: document a
couple of options - 2012-06-08). Since this commit focused on command
line options, this section was probably forgotten.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ævar Arnfjörð Bjarmason [Mon, 20 Mar 2017 13:20:29 +0000 (13:20 +0000)]
doc: change erroneous --[no]-whatever into --[no-]whatever
Change these two obvious typos to be in line with the rest of the
documentation, which uses the correct --[no-]whatever form.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
SZEDER Gábor [Sat, 18 Mar 2017 18:24:08 +0000 (19:24 +0100)]
pickaxe: fix segfault with '-S<...> --pickaxe-regex'
'git {log,diff,...} -S<...> --pickaxe-regex' can segfault as a result
of out-of-bounds memory reads.
diffcore-pickaxe.c:contains() looks for all matches of the given regex
in a buffer in a loop, advancing the buffer pointer to the end of the
last match in each iteration. When we switched to REG_STARTEND in
b7d36ffca (regex: use regexec_buf(), 2016-09-21), we started passing
the size of that buffer to the regexp engine, too. Unfortunately,
this buffer size is never updated on subsequent iterations, and as the
buffer pointer advances on each iteration, this "bufptr+bufsize"
points past the end of the buffer. This results in segmentation
fault, if that memory can't be accessed. In case of 'git log' it can
also result in erroneously listed commits, if the memory past the end
of buffer is accessible and happens to contain data matching the
regex.
Reduce the buffer size on each iteration as the buffer pointer is
advanced, thus maintaining the correct end of buffer location.
Furthermore, make sure that the buffer pointer is not dereferenced in
the control flow statements when we already reached the end of the
buffer.
The new test is flaky, I've never seen it fail on my Linux box even
without the fix, but this is expected according to
db5dfa3 (regex:
-G<pattern> feeds a non NUL-terminated string to regexec() and fails,
2016-09-21). However, it did fail on Travis CI with the first (and
incomplete) version of the fix, and based on that commit message I
would expect the new test without the fix to fail most of the time on
Windows.
Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Fri, 17 Mar 2017 23:20:04 +0000 (19:20 -0400)]
run-command: fix segfault when cleaning forked async process
Callers of the run-command API may mark a child as
"clean_on_exit"; it gets added to a list and killed when the
main process dies. Since commit
46df6906f
(execv_dashed_external: wait for child on signal death,
2017-01-06), we respect an extra "wait_after_clean" flag,
which we expect to find in the child_process struct.
When Git is built with NO_PTHREADS, we start "struct
async" processes by forking rather than spawning a thread.
The resulting processes get added to the cleanup list but
they don't have a child_process struct, and the cleanup
function ends up dereferencing NULL.
We should notice this case and assume that the processes do
not need to be waited for (i.e., the same behavior they had
before
46df6906f).
Reported-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe [Fri, 17 Mar 2017 23:52:28 +0000 (00:52 +0100)]
shortlog: don't set after_subject to an empty string
The string after_subject is added to a strbuf by pp_title_line() if
it's not NULL. Adding an empty string has the same effect as not
adding anything, but the latter is easier, so don't bother changing
the context member from NULL to "".
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
SZEDER Gábor [Sat, 18 Mar 2017 16:14:00 +0000 (17:14 +0100)]
tests: make the 'test_pause' helper work in non-verbose mode
When the 'test_pause' helper function invokes the shell mid-test, it
explicitly redirects the shell's stdout and stderr to file descriptors
3 and 4, which are the stdout and stderr of the tests (i.e. where they
would be connected anyway without those redirections). These file
descriptors are only attached to the terminal in verbose mode, hence
the restriction of 'test_pause' to work only with '-v'.
Redirect the shell's stdout and stderr to the test environment's
original stdout and stderr, allowing it to work properly even in
non-verbose mode, and the restriction can be lifted.
Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
SZEDER Gábor [Sat, 18 Mar 2017 16:13:59 +0000 (17:13 +0100)]
tests: create an interactive gdb session with the 'debug' helper
The 'debug' test helper is supposed to facilitate debugging by running
a command of the test suite under gdb. Unfortunately, its usefulness
is severely limited, because that gdb session is not interactive,
since the test's, and thus gdb's standard input is redirected from
/dev/null (for a good reason, see
781f76b15 (test-lib: redirect stdin
of tests, 2011-12-15)).
Redirect gdb's standard file descriptors from/to the test
environment's stdin, stdout and stderr in the 'debug' helper, thus
creating an interactive gdb session (even in non-verbose mode), which
is much, much more useful.
Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe [Fri, 17 Mar 2017 22:15:03 +0000 (23:15 +0100)]
revision: remove declaration of path_name()
The definition of path_name() was removed by
2824e1841 (list-objects:
pass full pathname to callbacks); remove its declaration as well.
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe [Fri, 17 Mar 2017 22:12:31 +0000 (23:12 +0100)]
http-push: don't check return value of lookup_unknown_object()
This function always returns a reference to an object, creating one if
needed, so remove the unnecessary NULL check.
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe [Fri, 17 Mar 2017 22:02:13 +0000 (23:02 +0100)]
receive-pack: simplify run_update_post_hook()
Instead of counting the arguments to see if there are any and then
building the full command use a single loop and add the hook command
just before the first argument. This reduces duplication and overall
code size.
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Brandon Williams [Fri, 17 Mar 2017 18:41:55 +0000 (11:41 -0700)]
grep: fix builds with with no thread support
Commit
0281e487fd91 ("grep: optionally recurse into submodules")
added functions grep_submodule() and grep_submodule_launch() which
use "struct work_item" which is defined only when thread support
is available.
The original implementation of grep_submodule() used the "struct
work_item" in order to gain access to a strbuf to store its output which
was to be printed at a later point in time. This differs from how both
grep_file() and grep_sha1() handle their output. This patch eliminates
the reliance on the "struct work_item" and instead opts to use the
output function stored in the output field of the "struct grep_opt"
object directly, making it behave similarly to both grep_file() and
grep_sha1().
Reported-by: Rahul Bedarkar <rahul.bedarkar@imgtec.com>
Signed-off-by: Brandon Williams <bmwill@google.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Brandon Williams [Fri, 17 Mar 2017 22:38:05 +0000 (15:38 -0700)]
submodule add: respect submodule.active and submodule.<name>.active
In addition to adding submodule.<name>.url to the config, set
submodule.<name>.active to true unless submodule.active is configured
and the submodule's path matches the configured pathspec.
Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Brandon Williams [Fri, 17 Mar 2017 22:38:04 +0000 (15:38 -0700)]
submodule--helper init: set submodule.<name>.active
When initializing a submodule set the submodule.<name>.active config to
true if the module hasn't already been configured to be active by some
other means (e.g. a pathspec set in submodule.active).
Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Brandon Williams [Fri, 17 Mar 2017 22:38:03 +0000 (15:38 -0700)]
clone: teach --recurse-submodules to optionally take a pathspec
Teach clone --recurse-submodules to optionally take a pathspec argument
which describes which submodules should be recursively initialized and
cloned. If no pathspec is provided, --recurse-submodules will
recursively initialize and clone all submodules by using a default
pathspec of ".". In order to construct more complex pathspecs,
--recurse-submodules can be given multiple times.
This also configures the 'submodule.active' configuration option to be
the given pathspec, such that any future invocation of `git submodule
update` will keep up with the pathspec.
Additionally the switch '--recurse' is removed from the Documentation as
well as marked hidden in the options array, to streamline the options
for submodules. A simple '--recurse' doesn't convey what is being
recursed, e.g. it could mean directories or trees (c.f. ls-tree) In a
lot of other commands we already have '--recurse-submodules' to mean
recursing into submodules, so advertise this spelling here as the
genuine option.
Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Brandon Williams [Fri, 17 Mar 2017 22:38:02 +0000 (15:38 -0700)]
submodule init: initialize active submodules
Teach `submodule init` to initialize submodules which have been
configured to be active by setting 'submodule.active' with a pathspec.
Now if no path arguments are given and 'submodule.active' is configured,
`init` will initialize all submodules which have been configured to be
active. If no path arguments are given and 'submodule.active' is not
configured, then `init` will retain the old behavior of initializing all
submodules.
This allows users to record more complex patterns as it saves retyping
them whenever you invoke update.
Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Brandon Williams [Fri, 17 Mar 2017 22:38:01 +0000 (15:38 -0700)]
submodule: decouple url and submodule interest
Currently the submodule.<name>.url config option is used to determine if
a given submodule is of interest to the user. This ends up being
cumbersome in a world where we want to have different submodules checked
out in different worktrees or a more generalized mechanism to select
which submodules are of interest.
In a future with worktree support for submodules, there will be multiple
working trees, each of which may only need a subset of the submodules
checked out. The URL (which is where the submodule repository can be
obtained) should not differ between different working trees.
It may also be convenient for users to more easily specify groups of
submodules they are interested in as opposed to running "git submodule
init <path>" on each submodule they want checked out in their working
tree.
To this end two config options are introduced, submodule.active and
submodule.<name>.active. The submodule.active config holds a pathspec
that specifies which submodules should exist in the working tree. The
submodule.<name>.active config is a boolean flag used to indicate if
that particular submodule should exist in the working tree.
Its important to note that submodule.active functions differently than
the other configuration options since it takes a pathspec. This allows
users to adopt at least two new workflows:
1. Submodules can be grouped with a leading directory, such that a
pathspec e.g. 'lib/' would cover all library-ish modules to allow
those who are interested in library-ish modules to set
"submodule.active = lib/" just once to say any and all modules in
'lib/' are interesting.
2. Once the pathspec-attribute feature is invented, users can label
submodules with attributes to group them, so that a broad pathspec
with attribute requirements, e.g. ':(attr:lib)', can be used to say
any and all modules with the 'lib' attribute are interesting.
Since the .gitattributes file, just like the .gitmodules file, is
tracked by the superproject, when a submodule moves in the
superproject tree, the project can adjust which path gets the
attribute in .gitattributes, just like it can adjust which path has
the submodule in .gitmodules.
Neither of these two additional configuration options solve the problem
of wanting different submodules checked out in different worktrees
because multiple worktrees share .git/config. Only once per-worktree
configurations become a reality can this be solved, but this is a
necessary preparatory step for that future.
Given these multiple ways to check if a submodule is of interest, the
more fine-grained submodule.<name>.active option has the highest order
of precedence followed by the pathspec check against submodule.active.
To ensure backwards compatibility, if neither of these options are set,
git falls back to checking the submodule.<name>.url option to determine
if a submodule is interesting.
Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Fri, 17 Mar 2017 20:54:26 +0000 (13:54 -0700)]
Sync with master
* master:
Fifth batch for 2.13
Junio C Hamano [Fri, 17 Mar 2017 20:54:15 +0000 (13:54 -0700)]
Merge branch 'nd/conditional-config-include' into next
The configuration file learned a new "includeIf.<condition>.path"
that includes the contents of the given path only when the
condition holds. This allows you to say "include this work-related
bit only in the repositories under my ~/work/ directory".
* nd/conditional-config-include:
config: add conditional include
config.txt: reflow the second include.path paragraph
config.txt: clarify multiple key values in include.path
Junio C Hamano [Fri, 17 Mar 2017 20:51:58 +0000 (13:51 -0700)]
Fifth batch for 2.13
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Fri, 17 Mar 2017 20:50:28 +0000 (13:50 -0700)]
Merge branch 'jk/cherry-pick-0-mainline'
"git revert -m 0 $merge_commit" complained that reverting a merge
needs to say relative to which parent the reversion needs to
happen, as if "-m 0" weren't given. The correct diagnosis is that
"-m 0" does not refer to the first parent ("-m 1" does). This has
been fixed.
* jk/cherry-pick-0-mainline:
cherry-pick: detect bogus arguments to --mainline
Junio C Hamano [Fri, 17 Mar 2017 20:50:28 +0000 (13:50 -0700)]
Merge branch 'js/early-config'
The start-up sequence of "git" needs to figure out some configured
settings before it finds and set itself up in the location of the
repository and was quite messy due to its "chicken-and-egg" nature.
The code has been restructured.
* js/early-config:
setup.c: mention unresolved problems
t1309: document cases where we would want early config not to die()
setup_git_directory_gently_1(): avoid die()ing
t1309: test read_early_config()
read_early_config(): really discover .git/
read_early_config(): avoid .git/config hack when unneeded
setup: make read_early_config() reusable
setup: introduce the discover_git_directory() function
setup_git_directory_1(): avoid changing global state
setup: prepare setup_discovered_git_dir() for the root directory
setup_git_directory(): use is_dir_sep() helper
t7006: replace dubious test
Junio C Hamano [Fri, 17 Mar 2017 20:50:27 +0000 (13:50 -0700)]
Merge branch 'bc/sha1-header-selection-with-cpp-macros'
Our source code has used the SHA1_HEADER cpp macro after "#include"
in the C code to switch among the SHA-1 implementations. Instead,
list the exact header file names and switch among implementations
using "#ifdef BLK_SHA1/#include "block-sha1/sha1.h"/.../#endif";
this helps some IDE tools.
* bc/sha1-header-selection-with-cpp-macros:
hash.h: move SHA-1 implementation selection into a header file
Junio C Hamano [Fri, 17 Mar 2017 20:50:27 +0000 (13:50 -0700)]
Merge branch 'mg/status-porcelain-no-i18n'
"git status --porcelain" is supposed to give a stable output, but a
few strings were left as translatable by mistake.
* mg/status-porcelain-no-i18n:
git-status: make porcelain more robust
Junio C Hamano [Fri, 17 Mar 2017 20:50:26 +0000 (13:50 -0700)]
Merge branch 'jk/add-i-use-pathspecs'
"git add -p <pathspec>" unnecessarily expanded the pathspec to a
list of individual files that matches the pathspec by running "git
ls-files <pathspec>", before feeding it to "git diff-index" to see
which paths have changes, because historically the pathspec
language supported by "diff-index" was weaker. These days they are
equivalent and there is no reason to internally expand it. This
helps both performance and avoids command line argument limit on
some platforms.
* jk/add-i-use-pathspecs:
add--interactive: do not expand pathspecs with ls-files
Junio C Hamano [Fri, 17 Mar 2017 20:50:26 +0000 (13:50 -0700)]
Merge branch 'jk/http-walker-buffer-underflow-fix'
"Dumb http" transport used to misparse a nonsense http-alternates
response, which has been fixed.
* jk/http-walker-buffer-underflow-fix:
http-walker: fix buffer underflow processing remote alternates
Junio C Hamano [Fri, 17 Mar 2017 20:50:26 +0000 (13:50 -0700)]
Merge branch 'bw/attr-pathspec'
The pathspec mechanism learned to further limit the paths that
match the pattern to those that have specified attributes attached
via the gitattributes mechanism.
* bw/attr-pathspec:
pathspec: allow escaped query values
pathspec: allow querying for attributes
Junio C Hamano [Fri, 17 Mar 2017 20:50:25 +0000 (13:50 -0700)]
Merge branch 'jk/ref-filter-flags-cleanup'
"git tag --contains" used to (ab)use the object bits to keep track
of the state of object reachability without clearing them after
use; this has been cleaned up and made to use the newer commit-slab
facility.
* jk/ref-filter-flags-cleanup:
ref-filter: use separate cache for contains_tag_algo
ref-filter: die on parse_commit errors
ref-filter: use contains_result enum consistently
ref-filter: move ref_cbdata definition into ref-filter.c