Junio C Hamano [Wed, 21 Mar 2018 18:30:15 +0000 (11:30 -0700)]
Merge branch 'jk/attributes-path-doc'
Doc update.
* jk/attributes-path-doc:
doc/gitattributes: mention non-recursive behavior
Junio C Hamano [Wed, 21 Mar 2018 18:30:15 +0000 (11:30 -0700)]
Merge branch 'rj/warning-uninitialized-fix'
Compilation fix.
* rj/warning-uninitialized-fix:
read-cache: fix an -Wmaybe-uninitialized warning
-Wuninitialized: remove some 'init-self' workarounds
Junio C Hamano [Wed, 21 Mar 2018 18:30:15 +0000 (11:30 -0700)]
Merge branch 'tz/complete-tag-delete-tagname'
* tz/complete-tag-delete-tagname:
completion: complete tags with git tag --delete/--verify
Junio C Hamano [Wed, 21 Mar 2018 18:30:14 +0000 (11:30 -0700)]
Merge branch 'ml/filter-branch-portability-fix'
Shell script portability fix.
* ml/filter-branch-portability-fix:
filter-branch: use printf instead of echo -e
Junio C Hamano [Wed, 21 Mar 2018 18:30:14 +0000 (11:30 -0700)]
Merge branch 'js/ming-strftime'
* js/ming-strftime:
mingw: abort on invalid strftime formats
Junio C Hamano [Wed, 21 Mar 2018 18:30:13 +0000 (11:30 -0700)]
Merge branch 'dp/merge-strategy-doc-fix'
Doc fix.
* dp/merge-strategy-doc-fix:
Documentation/merge-strategies: typofix
Junio C Hamano [Wed, 21 Mar 2018 18:30:12 +0000 (11:30 -0700)]
Merge branch 'tz/relnotes-1.7-on-perl'
* tz/relnotes-1.7-on-perl:
RelNotes: add details on Perl module changes
Junio C Hamano [Wed, 21 Mar 2018 18:30:12 +0000 (11:30 -0700)]
Merge branch 'rj/http-code-cleanup'
There was an unused file-scope static variable left in http.c when
building for versions of libCURL that is older than 7.19.4, which
has been fixed.
* rj/http-code-cleanup:
http: fix an unused variable warning for 'curl_no_proxy'
Junio C Hamano [Wed, 21 Mar 2018 18:30:12 +0000 (11:30 -0700)]
Merge branch 'ks/t3200-typofix'
Test typofix.
* ks/t3200-typofix:
t/t3200: fix a typo in a test description
Junio C Hamano [Wed, 21 Mar 2018 18:30:11 +0000 (11:30 -0700)]
Merge branch 'jt/transfer-fsck-with-promissor'
The transfer.fsckobjects configuration tells "git fetch" to
validate the data and connected-ness of objects in the received
pack; the code to perform this check has been taught about the
narrow clone's convention that missing objects that are reachable
from objects in a pack that came from a promissor remote is OK.
* jt/transfer-fsck-with-promissor:
fetch-pack: do not check links for partial fetch
index-pack: support checking objects but not links
Junio C Hamano [Wed, 21 Mar 2018 18:30:11 +0000 (11:30 -0700)]
Merge branch 'bp/refresh-cache-ent-rehash-fix'
The codepath to replace an existing entry in the index had a bug in
updating the name hash structure, which has been fixed.
* bp/refresh-cache-ent-rehash-fix:
Fix bugs preventing adding updated cache entries to the name hash
Junio C Hamano [Wed, 21 Mar 2018 18:30:10 +0000 (11:30 -0700)]
Merge branch 'jh/fsck-promisors'
A hotfix to a topic that graduated recently.
* jh/fsck-promisors:
sha1_file: restore OBJECT_INFO_QUICK functionality
Junio C Hamano [Wed, 21 Mar 2018 18:30:10 +0000 (11:30 -0700)]
Merge branch 'ma/skip-writing-unchanged-index'
Internal API clean-up to allow write_locked_index() optionally skip
writing the in-core index when it is not modified.
* ma/skip-writing-unchanged-index:
write_locked_index(): add flag to avoid writing unchanged index
Junio C Hamano [Wed, 21 Mar 2018 18:30:09 +0000 (11:30 -0700)]
Merge branch 'ma/config-page-only-in-list-mode'
In a way similar to how "git tag" learned to honor the pager
setting only in the list mode, "git config" learned to ignore the
pager setting when it is used for setting values (i.e. when the
purpose of the operation is not to "show").
* ma/config-page-only-in-list-mode:
config: change default of `pager.config` to "on"
config: respect `pager.config` in list/get-mode only
t7006: add tests for how git config paginates
Jeff King [Tue, 20 Mar 2018 04:14:54 +0000 (00:14 -0400)]
doc/gitattributes: mention non-recursive behavior
The gitattributes documentation claims that the pattern
rules are largely the same as for gitignore. However, the
rules for recursion are different.
In an ideal world, we would make them the same (if for
nothing else than consistency and simplicity), but that
would create backwards compatibility issues. For some
discussion, see this thread:
https://public-inbox.org/git/slrnkldd3g.1l4.jan@majutsushi.net/
But let's at least document the differences instead of
actively misleading the user by claiming that they're the
same.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ramsay Jones [Mon, 19 Mar 2018 17:56:11 +0000 (17:56 +0000)]
read-cache: fix an -Wmaybe-uninitialized warning
The function ce_write_entry() uses a 'self-initialised' variable
construct, for the symbol 'saved_namelen', to suppress a gcc
'-Wmaybe-uninitialized' warning, given that the warning is a false
positive.
For the purposes of this discussion, the ce_write_entry() function has
three code blocks of interest, that look like so:
/* block #1 */
if (ce->ce_flags & CE_STRIP_NAME) {
saved_namelen = ce_namelen(ce);
ce->ce_namelen = 0;
}
/* block #2 */
/*
* several code blocks that contain, among others, calls
* to copy_cache_entry_to_ondisk(ondisk, ce);
*/
/* block #3 */
if (ce->ce_flags & CE_STRIP_NAME) {
ce->ce_namelen = saved_namelen;
ce->ce_flags &= ~CE_STRIP_NAME;
}
The warning implies that gcc thinks it is possible that the first
block is not entered, the calls to copy_cache_entry_to_ondisk()
could toggle the CE_STRIP_NAME flag on, thereby entering block #3
with saved_namelen unset. However, the copy_cache_entry_to_ondisk()
function does not write to ce->ce_flags (it only reads). gcc could
easily determine this, since that function is local to this file,
but it obviously doesn't.
In order to suppress this warning, we make it clear to the reader
(human and compiler), that block #3 will only be entered when the
first block has been entered, by introducing a new 'stripped_name'
boolean variable. We also take the opportunity to change the type
of 'saved_namelen' to 'unsigned int' to match ce->ce_namelen.
Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ramsay Jones [Mon, 19 Mar 2018 17:54:35 +0000 (17:54 +0000)]
-Wuninitialized: remove some 'init-self' workarounds
The 'self-initialised' variables construct (ie <type> var = var;) has
been used to silence gcc '-W[maybe-]uninitialized' warnings. This has,
unfortunately, caused MSVC to issue 'uninitialized variable' warnings.
Also, using clang static analysis causes complaints about an 'Assigned
value is garbage or undefined'.
There are six such constructs in the current codebase. Only one of the
six causes gcc to issue a '-Wmaybe-uninitialized' warning (which will
be addressed elsewhere). The remaining five 'init-self' gcc workarounds
are noted below, along with the commit which introduced them:
1. builtin/rev-list.c: 'reaches' and 'all', see commit
457f08a030
("git-rev-list: add --bisect-vars option.", 2007-03-21).
2. merge-recursive.c:2064 'mrtree', see commit
f120ae2a8e ("merge-
recursive.c: mrtree in merge() is not used before set", 2007-10-29).
3. fast-import.c:3023 'oe', see commit
85c62395b1 ("fast-import: let
importers retrieve blobs", 2010-11-28).
4. fast-import.c:3006 'oe', see commit
28c7b1f7b7 ("fast-import: add a
get-mark command", 2015-07-01).
Remove the 'self-initialised' variable constructs noted above.
Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michele Locati [Mon, 19 Mar 2018 15:52:59 +0000 (16:52 +0100)]
filter-branch: use printf instead of echo -e
In order to echo a tab character, it's better to use printf instead of
"echo -e", because it's more portable (for instance, "echo -e" doesn't work
as expected on a Mac).
This solves the "fatal: Not a valid object name" error in git-filter-branch
when using the --state-branch option.
Furthermore, let's switch from "/bin/echo" to just "echo", so that the
built-in echo command is used where available.
Signed-off-by: Michele Locati <michele@locati.it>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Schindelin [Mon, 19 Mar 2018 16:49:22 +0000 (17:49 +0100)]
mingw: abort on invalid strftime formats
On Windows, strftime() does not silently ignore invalid formats, but
warns about them and then returns 0 and sets errno to EINVAL.
Unfortunately, Git does not expect such a behavior, as it disagrees
with strftime()'s semantics on Linux. As a consequence, Git
misinterprets the return value 0 as "I need more space" and grows the
buffer. As the larger buffer does not fix the format, the buffer grows
and grows and grows until we are out of memory and abort.
Ideally, we would switch off the parameter validation just for
strftime(), but we cannot even override the invalid parameter handler
via _set_thread_local_invalid_parameter_handler() using MINGW because
that function is not declared. Even _set_invalid_parameter_handler(),
which *is* declared, does not help, as it simply does... nothing.
So let's just bite the bullet and override strftime() for MINGW and
abort on an invalid format string. While this does not provide the
best user experience, it is the best we can do.
See https://msdn.microsoft.com/en-us/library/fe06s4ak.aspx for more
details.
This fixes https://github.com/git-for-windows/git/issues/863
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Todd Zullinger [Sun, 18 Mar 2018 04:01:35 +0000 (00:01 -0400)]
completion: complete tags with git tag --delete/--verify
Completion of tag names has worked for the short -d/-v options since
88e21dc746 ("Teach bash about completing arguments for git-tag",
2007-08-31). The long options were not added to "git tag" until many
years later, in
c97eff5a95 ("git-tag: introduce long forms for the
options", 2011-08-28).
Extend tag name completion to --delete/--verify.
Signed-off-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
David Pursehouse [Sat, 17 Mar 2018 03:31:42 +0000 (12:31 +0900)]
Documentation/merge-strategies: typofix
It's strategy, not stragegy.
Signed-off-by: David Pursehouse <dpursehouse@collab.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Todd Zullinger [Fri, 16 Mar 2018 22:07:48 +0000 (18:07 -0400)]
RelNotes: add details on Perl module changes
Document changes to core and non-core Perl module handling in 2.17.
Signed-off-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Thu, 15 Mar 2018 22:01:05 +0000 (15:01 -0700)]
Git 2.17-rc0
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Thu, 15 Mar 2018 22:00:47 +0000 (15:00 -0700)]
Merge branch 'tl/userdiff-csharp-async'
Update funcname pattern used for C# to recognize "async" keyword.
* tl/userdiff-csharp-async:
userdiff.c: add C# async keyword in diff pattern
Junio C Hamano [Thu, 15 Mar 2018 22:00:46 +0000 (15:00 -0700)]
Merge branch 'sg/cvs-tests-with-x'
Allow running a couple of tests with "sh -x".
* sg/cvs-tests-with-x:
t9402-git-cvsserver-refs: don't check the stderr of a subshell
t9400-git-cvsserver-server: don't rely on the output of 'test_cmp'
Junio C Hamano [Thu, 15 Mar 2018 22:00:46 +0000 (15:00 -0700)]
Merge branch 'ab/man-sec-list'
Doc update.
* ab/man-sec-list:
git manpage: note git-security@googlegroups.com
Junio C Hamano [Thu, 15 Mar 2018 22:00:46 +0000 (15:00 -0700)]
Merge branch 'ab/perl-fixes'
Clean-up to various pieces of Perl code we have.
* ab/perl-fixes:
perl Git::LoadCPAN: emit better errors under NO_PERL_CPAN_FALLBACKS
Makefile: add NO_PERL_CPAN_FALLBACKS knob
perl: move the perl/Git/FromCPAN tree to perl/FromCPAN
perl: generalize the Git::LoadCPAN facility
perl: move CPAN loader wrappers to another namespace
perl: update our copy of Mail::Address
perl: update our ancient copy of Error.pm
git-send-email: unconditionally use Net::{SMTP,Domain}
Git.pm: hard-depend on the File::{Temp,Spec} modules
gitweb: hard-depend on the Digest::MD5 5.8 module
Git.pm: add the "use warnings" pragma
Git.pm: remove redundant "use strict" from sub-package
perl: *.pm files should not have the executable bit
Junio C Hamano [Thu, 15 Mar 2018 22:00:45 +0000 (15:00 -0700)]
Merge branch 'cl/send-email-reply-to'
"git send-email" learned "--reply-to=<address>" option.
* cl/send-email-reply-to:
send-email: support separate Reply-To address
send-email: rename variable for clarity
Junio C Hamano [Thu, 15 Mar 2018 22:00:45 +0000 (15:00 -0700)]
Merge branch 'np/send-email-header-parsing'
Code refactoring.
* np/send-email-header-parsing:
send-email: extract email-parsing code into a subroutine
Kaartic Sivaraam [Sat, 10 Mar 2018 15:54:16 +0000 (21:24 +0530)]
t/t3200: fix a typo in a test description
Signed-off-by: Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ramsay Jones [Wed, 14 Mar 2018 21:56:06 +0000 (21:56 +0000)]
http: fix an unused variable warning for 'curl_no_proxy'
Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ben Peart [Thu, 15 Mar 2018 15:25:20 +0000 (11:25 -0400)]
Fix bugs preventing adding updated cache entries to the name hash
Update replace_index_entry() to clear the CE_HASHED flag from the new cache
entry so that it can add it to the name hash in set_index_entry()
Fix refresh_cache_ent() to use the copy_cache_entry() macro instead of memcpy()
so that it doesn't incorrectly copy the hash state from the old entry.
Signed-off-by: Ben Peart <benpeart@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jonathan Tan [Wed, 14 Mar 2018 18:42:41 +0000 (11:42 -0700)]
fetch-pack: do not check links for partial fetch
When doing a partial clone or fetch with transfer.fsckobjects=1, use the
--fsck-objects instead of the --strict flag when invoking index-pack so
that links are not checked, only objects. This is because incomplete
links are expected when doing a partial clone or fetch.
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jonathan Tan [Wed, 14 Mar 2018 18:42:40 +0000 (11:42 -0700)]
index-pack: support checking objects but not links
The index-pack command currently supports the
--check-self-contained-and-connected argument, for internal use only,
that instructs it to only check for broken links and not broken objects.
For partial clones, we need the inverse, so add a --fsck-objects
argument that checks for broken objects and not broken links, also for
internal use only.
This will be used by fetch-pack in a subsequent patch.
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Wed, 14 Mar 2018 19:01:06 +0000 (12:01 -0700)]
Merge branch 'nd/parseopt-completion'
Teach parse-options API an option to help the completion script,
and make use of the mechanism in command line completion.
* nd/parseopt-completion: (45 commits)
completion: more subcommands in _git_notes()
completion: complete --{reuse,reedit}-message= for all notes subcmds
completion: simplify _git_notes
completion: don't set PARSE_OPT_NOCOMPLETE on --rerere-autoupdate
completion: use __gitcomp_builtin in _git_worktree
completion: use __gitcomp_builtin in _git_tag
completion: use __gitcomp_builtin in _git_status
completion: use __gitcomp_builtin in _git_show_branch
completion: use __gitcomp_builtin in _git_rm
completion: use __gitcomp_builtin in _git_revert
completion: use __gitcomp_builtin in _git_reset
completion: use __gitcomp_builtin in _git_replace
remote: force completing --mirror= instead of --mirror
completion: use __gitcomp_builtin in _git_remote
completion: use __gitcomp_builtin in _git_push
completion: use __gitcomp_builtin in _git_pull
completion: use __gitcomp_builtin in _git_notes
completion: use __gitcomp_builtin in _git_name_rev
completion: use __gitcomp_builtin in _git_mv
completion: use __gitcomp_builtin in _git_merge_base
...
Junio C Hamano [Wed, 14 Mar 2018 19:01:06 +0000 (12:01 -0700)]
Merge branch 'nd/object-allocation-comments'
Code doc update.
* nd/object-allocation-comments:
object.h: realign object flag allocation comment
object.h: update flag allocation comment
Junio C Hamano [Wed, 14 Mar 2018 19:01:05 +0000 (12:01 -0700)]
Merge branch 'jk/smart-http-protocol-doc-fix'
A doc update.
* jk/smart-http-protocol-doc-fix:
smart-http: document flush after "# service" line
Junio C Hamano [Wed, 14 Mar 2018 19:01:05 +0000 (12:01 -0700)]
Merge branch 'jk/add-i-diff-filter'
The "interactive.diffFilter" used by "git add -i" must retain
one-to-one correspondence between its input and output, but it was
not enforced and caused end-user confusion. We now at least make
sure the filtered result has the same number of lines as its input
to detect a broken filter.
* jk/add-i-diff-filter:
add--interactive: detect bogus diffFilter output
t3701: add a test for interactive.diffFilter
Junio C Hamano [Wed, 14 Mar 2018 19:01:05 +0000 (12:01 -0700)]
Merge branch 'nd/worktree-move'
"git worktree" learned move and remove subcommands.
* nd/worktree-move:
t2028: fix minor error and issues in newly-added "worktree move" tests
worktree remove: allow it when $GIT_WORK_TREE is already gone
worktree remove: new command
worktree move: refuse to move worktrees with submodules
worktree move: accept destination as directory
worktree move: new command
worktree.c: add update_worktree_location()
worktree.c: add validate_worktree()
Junio C Hamano [Wed, 14 Mar 2018 19:01:04 +0000 (12:01 -0700)]
Merge branch 'pw/add-p-recount'
"git add -p" has been lazy in coalescing split patches before
passing the result to underlying "git apply", leading to corner
case bugs; the logic to prepare the patch to be applied after hunk
selections has been tightened.
* pw/add-p-recount:
add -p: don't rely on apply's '--recount' option
add -p: fix counting when splitting and coalescing
add -p: calculate offset delta for edited patches
add -p: adjust offsets of subsequent hunks when one is skipped
t3701: add failing test for pathological context lines
t3701: don't hard code sha1 hash values
t3701: use test_write_lines and write_script
t3701: indent here documents
add -i: add function to format hunk header
Junio C Hamano [Wed, 14 Mar 2018 19:01:04 +0000 (12:01 -0700)]
Merge branch 'ab/pre-auto-gc-battery'
A sample auto-gc hook (in contrib/) to skip auto-gc while on
battery has been updated to almost always allow running auto-gc
unless on_ac_power command is absolutely sure that we are on
battery power (earlier, it skipped unless the command is sure that
we are on ac power).
* ab/pre-auto-gc-battery:
hooks/pre-auto-gc-battery: allow gc to run on non-laptops
Junio C Hamano [Wed, 14 Mar 2018 19:01:03 +0000 (12:01 -0700)]
Merge branch 'sg/test-x'
Running test scripts under -x option of the shell is often not a
useful way to debug them, because the error messages from the
commands tests try to capture and inspect are contaminated by the
tracing output by the shell. An earlier work done to make it more
pleasant to run tests under -x with recent versions of bash is
extended to cover posix shells that do not support BASH_XTRACEFD.
* sg/test-x:
travis-ci: run tests with '-x' tracing
t/README: add a note about don't saving stderr of compound commands
t1510-repo-setup: mark as untraceable with '-x'
t9903-bash-prompt: don't check the stderr of __git_ps1()
t5570-git-daemon: don't check the stderr of a subshell
t5526: use $TRASH_DIRECTORY to specify the path of GIT_TRACE log file
t5500-fetch-pack: don't check the stderr of a subshell
t3030-merge-recursive: don't check the stderr of a subshell
t1507-rev-parse-upstream: don't check the stderr of a shell function
t: add means to disable '-x' tracing for individual test scripts
t: prevent '-x' tracing from interfering with test helpers' stderr
Junio C Hamano [Wed, 14 Mar 2018 19:01:03 +0000 (12:01 -0700)]
Merge branch 'rj/test-i18ngrep'
Test updates.
* rj/test-i18ngrep:
t5536: simplify checking of messages output to stderr
t4151: consolidate multiple calls to test_i18ngrep
Junio C Hamano [Wed, 14 Mar 2018 19:01:03 +0000 (12:01 -0700)]
Merge branch 'ma/roll-back-lockfiles'
Some codepaths used to take a lockfile and did not roll it back;
they are automatically rolled back at program exit, so there is no
real "breakage", but it still is a good practice to roll back when
you are done with a lockfile.
* ma/roll-back-lockfiles:
sequencer: do not roll back lockfile unnecessarily
merge: always roll back lock in `checkout_fast_forward()`
merge-recursive: always roll back lock in `merge_recursive_generic()`
sequencer: always roll back lock in `do_recursive_merge()`
sequencer: make lockfiles non-static
Junio C Hamano [Wed, 14 Mar 2018 19:01:02 +0000 (12:01 -0700)]
Merge branch 'nd/diff-stat-with-summary'
"git diff" and friends learned "--compact-summary" that shows the
information usually given with the "--summary" option on the same
line as the diffstat output of the "--stat" option (which saves
vertical space and keeps info on a single path at the same place).
* nd/diff-stat-with-summary:
diff: add --compact-summary
diff.c: refactor pprint_rename() to use strbuf
Jonathan Tan [Tue, 13 Mar 2018 15:30:29 +0000 (08:30 -0700)]
sha1_file: restore OBJECT_INFO_QUICK functionality
Support for the OBJECT_INFO_QUICK flag in sha1_object_info_extended()
was added in commit
dfdd4afcf9 ("sha1_file: teach
sha1_object_info_extended more flags", 2017-06-26) in order to support
commit
e83e71c5e1 ("sha1_file: refactor has_sha1_file_with_flags",
2017-06-26), but it was inadvertently removed in commit
8b4c0103a9
("sha1_file: support lazily fetching missing objects", 2017-12-08).
Restore this functionality.
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
SZEDER Gábor [Thu, 8 Mar 2018 12:38:44 +0000 (13:38 +0100)]
t9402-git-cvsserver-refs: don't check the stderr of a subshell
Four 'cvs diff' related tests in 't9402-git-cvsserver-refs.sh' fail
when the test script is run with '-x' tracing (and using a shell other
than a Bash version supporting BASH_XTRACEFD). The reason for those
failures is that the tests check the emptiness of a subshell's stderr,
which includes the trace of commands executed in that subshell as
well, throwing off the emptiness check.
Save the stdout and stderr of the invoked 'cvs' command instead of the
whole subshell, so the latter remains free from tracing output. (Note
that changing how stdout is saved is only done for the sake of
consistency, it's not necessary for correctness.)
After this change t9402 passes with '-x', even when running with
/bin/sh.
Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
SZEDER Gábor [Thu, 8 Mar 2018 22:44:58 +0000 (23:44 +0100)]
t9400-git-cvsserver-server: don't rely on the output of 'test_cmp'
The test 'cvs update (-p)' redirects and checks 'test_cmp's stdout and
even its stderr. The commit introducing this test in
6e8937a084
(cvsserver: Add test for update -p, 2008-03-27) doesn't discuss why,
in fact its log message only consists of that subject line. Anyway,
weird as it is, it kind of made sense due to the way that test was
structured:
After a bit of preparation, this test updates four files via CVS and
checks their contents using 'test_cmp', but it does so in a for loop
iterating over the names of those four files. Now, the exit status of
a for loop is the exit status of the last command executed in the
loop, meaning that the test can't simply rely on the exit code of
'test_cmp' in the loop's body. Instead, the test works it around by
relying on the stdout of 'test_cmp' being silent on success and
showing the diff on failure, as it appends the stdout of all four
'test_cmp' invocations to a single file and checks that file's
emptiness after the loop (with 'test -z "$(cat ...)"', no less; there
was no 'test_must_be_empty' back then). Furthermore, the test
redirects the stderr of those 'test_cmp' invocations to this file,
too: while 'test_cmp' itself doesn't output anything to stderr, the
invoked 'diff' or 'cmp' commands do send their error messages there,
e.g. if they can't open a file because its name was misspelled.
This also makes this test fail when the test script is run with '-x'
tracing (and using a shell other than a Bash version supporting
BASH_XTRACEFD), because 'test_cmp's stderr contains the trace of the
'diff' command executed inside the helper function, throwing off the
subsequent emptiness check.
Stop relying on 'test_cmp's output and instead run 'test_cmp a b ||
return 1' in the for loop in order to make 'test_cmp's error code fail
the test. Furthermore, add the missing && after the cvs command to
create a && chain in the loop's body.
After this change t9400 passes with '-x', even when running with
/bin/sh.
Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Thu, 8 Mar 2018 20:42:06 +0000 (12:42 -0800)]
Eighth batch for 2.17
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Thu, 8 Mar 2018 20:36:30 +0000 (12:36 -0800)]
Merge branch 'ag/userdiff-go-funcname'
"git diff" and friends learned funcname patterns for Go language
source files.
* ag/userdiff-go-funcname:
userdiff: add built-in pattern for golang
Junio C Hamano [Thu, 8 Mar 2018 20:36:30 +0000 (12:36 -0800)]
Merge branch 'ab/gc-auto-in-commit'
"git commit" used to run "gc --auto" near the end, which was lost
when the command was reimplemented in C by mistake.
* ab/gc-auto-in-commit:
commit: run git gc --auto just before the post-commit hook
Junio C Hamano [Thu, 8 Mar 2018 20:36:30 +0000 (12:36 -0800)]
Merge branch 'bp/untracked-cache-noflush'
Writing out the index file when the only thing that changed in it
is the untracked cache information is often wasteful, and this has
been optimized out.
* bp/untracked-cache-noflush:
untracked cache: use git_env_bool() not getenv() for customization
dir.c: don't flag the index as dirty for changes to the untracked cache
Junio C Hamano [Thu, 8 Mar 2018 20:36:29 +0000 (12:36 -0800)]
Merge branch 'rs/perf-repeat-thrice-by-default'
Perf test regression fix.
* rs/perf-repeat-thrice-by-default:
perf: use GIT_PERF_REPEAT_COUNT=3 by default even without config file
Junio C Hamano [Thu, 8 Mar 2018 20:36:29 +0000 (12:36 -0800)]
Merge branch 'mk/doc-pretty-fill'
Docfix.
* mk/doc-pretty-fill:
docs/pretty-formats: fix typo '% <(<N>)' -> '%<|(<N>)'
Junio C Hamano [Thu, 8 Mar 2018 20:36:27 +0000 (12:36 -0800)]
Merge branch 'jc/test-must-be-empty'
Test framework tweak to catch developer thinko.
* jc/test-must-be-empty:
test_must_be_empty: make sure the file exists, not just empty
Junio C Hamano [Thu, 8 Mar 2018 20:36:27 +0000 (12:36 -0800)]
Merge branch 'ds/mark-parents-uninteresting-optim'
Micro optimization in revision traversal code.
* ds/mark-parents-uninteresting-optim:
revision.c: reduce object database queries
Junio C Hamano [Thu, 8 Mar 2018 20:36:26 +0000 (12:36 -0800)]
Merge branch 'ds/find-unique-abbrev-optim'
While finding unique object name abbreviation, the code may
accidentally have read beyond the end of the array of object names
in a pack.
* ds/find-unique-abbrev-optim:
sha1_name: fix uninitialized memory errors
Junio C Hamano [Thu, 8 Mar 2018 20:36:25 +0000 (12:36 -0800)]
Merge branch 'sg/subtree-signed-commits'
"git subtree" script (in contrib/) scripted around "git log", whose
output got affected by end-user configuration like log.showsignature
* sg/subtree-signed-commits:
subtree: fix add and pull for GPG-signed commits
Junio C Hamano [Thu, 8 Mar 2018 20:36:25 +0000 (12:36 -0800)]
Merge branch 'rv/grep-cleanup'
Threaded "git grep" has been optimized to avoid allocation in code
section that is covered under a mutex.
* rv/grep-cleanup:
grep: simplify grep_oid and grep_file
grep: move grep_source_init outside critical section
Junio C Hamano [Thu, 8 Mar 2018 20:36:24 +0000 (12:36 -0800)]
Merge branch 'ot/ref-filter-cleanup'
Code cleanup.
* ot/ref-filter-cleanup:
ref-filter: get rid of goto
ref-filter: get rid of duplicate code
Junio C Hamano [Thu, 8 Mar 2018 20:36:24 +0000 (12:36 -0800)]
Merge branch 'jh/status-no-ahead-behind'
"git status" can spend a lot of cycles to compute the relation
between the current branch and its upstream, which can now be
disabled with "--no-ahead-behind" option.
* jh/status-no-ahead-behind:
status: support --no-ahead-behind in long format
status: update short status to respect --no-ahead-behind
status: add --[no-]ahead-behind to status and commit for V2 format.
stat_tracking_info: return +1 when branches not equal
Junio C Hamano [Thu, 8 Mar 2018 20:36:23 +0000 (12:36 -0800)]
Merge branch 'sg/travis-build-during-script-phase'
Build the executable in 'script' phase in Travis CI integration, to
follow the established practice, rather than during 'before_script'
phase. This allows the CI categorize the failures better ('failed'
is project's fault, 'errored' is build environment's).
* sg/travis-build-during-script-phase:
travis-ci: build Git during the 'script' phase
Ævar Arnfjörð Bjarmason [Thu, 8 Mar 2018 15:08:20 +0000 (15:08 +0000)]
git manpage: note git-security@googlegroups.com
Add a mention of the security mailing list to the "Reporting Bugs"
section. There's a mention of this list at
https://git-scm.com/community but none in git.git itself.
The copy is pasted from the git-scm.com website. Let's use the same
wording in both places.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Thomas Levesque [Thu, 8 Mar 2018 11:05:32 +0000 (11:05 +0000)]
userdiff.c: add C# async keyword in diff pattern
Currently C# async methods are not shown in diff hunk headers. I just
added the async keyword to the csharp method pattern so that they are
properly detected.
Signed-off-by: Thomas Levesque <thomas.levesque@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy [Wed, 7 Mar 2018 01:05:04 +0000 (08:05 +0700)]
completion: more subcommands in _git_notes()
Two subcommands are added for completion: merge and get-ref. get-ref
is more like plumbing. But since it does not share the prefix with any
other subcommands, it won't slow anybody down.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy [Wed, 7 Mar 2018 01:05:03 +0000 (08:05 +0700)]
completion: complete --{reuse,reedit}-message= for all notes subcmds
The new subcommand that takes these options is 'git notes edit'. Just
accept the options from subcommands since we handle them the same way
in builtin/notes.c anyway. If a user does
git prune --reuse-message=...
just let the command catches that error when it's executed.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy [Wed, 7 Mar 2018 01:05:02 +0000 (08:05 +0700)]
completion: simplify _git_notes
This also adds completion for 'git notes remove' and 'git notes edit'.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy [Wed, 7 Mar 2018 01:05:01 +0000 (08:05 +0700)]
completion: don't set PARSE_OPT_NOCOMPLETE on --rerere-autoupdate
There is not a strong reason to hide this option, and git-merge already
completes this one. Let's allow to complete this for all commands (and
let git-completion.bash do the suppressing if needed).
This makes --rerere-autoupdate completable for am, cherry-pick and
revert. rebase completion is fixed manually because it's a shell
script and does not benefit from --git-completion-helper.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Tue, 6 Mar 2018 22:59:10 +0000 (14:59 -0800)]
Seventh batch for 2.17
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Tue, 6 Mar 2018 22:54:08 +0000 (14:54 -0800)]
Merge branch 'bw/perl-timegm-timelocal-fix'
Y2k20 fix ;-) for our perl scripts.
* bw/perl-timegm-timelocal-fix:
perl: call timegm and timelocal with 4-digit year
Junio C Hamano [Tue, 6 Mar 2018 22:54:08 +0000 (14:54 -0800)]
Merge branch 'jk/strbuf-read-file-close-error'
Code clean-up.
* jk/strbuf-read-file-close-error:
strbuf_read_file(): preserve errno across close() call
Junio C Hamano [Tue, 6 Mar 2018 22:54:07 +0000 (14:54 -0800)]
Merge branch 'bw/c-plus-plus'
Avoid using identifiers that clash with C++ keywords. Even though
it is not a goal to compile Git with C++ compilers, changes like
this help use of code analysis tools that targets C++ on our
codebase.
* bw/c-plus-plus: (37 commits)
replace: rename 'new' variables
trailer: rename 'template' variables
tempfile: rename 'template' variables
wrapper: rename 'template' variables
environment: rename 'namespace' variables
diff: rename 'template' variables
environment: rename 'template' variables
init-db: rename 'template' variables
unpack-trees: rename 'new' variables
trailer: rename 'new' variables
submodule: rename 'new' variables
split-index: rename 'new' variables
remote: rename 'new' variables
ref-filter: rename 'new' variables
read-cache: rename 'new' variables
line-log: rename 'new' variables
imap-send: rename 'new' variables
http: rename 'new' variables
entry: rename 'new' variables
diffcore-delta: rename 'new' variables
...
Junio C Hamano [Tue, 6 Mar 2018 22:54:07 +0000 (14:54 -0800)]
Merge branch 'rs/strbuf-read-file-or-whine'
Code clean-up.
* rs/strbuf-read-file-or-whine:
sequencer: factor out strbuf_read_file_or_whine()
Junio C Hamano [Tue, 6 Mar 2018 22:54:06 +0000 (14:54 -0800)]
Merge branch 'ms/non-ascii-ticks'
Doc markup fix.
* ms/non-ascii-ticks:
Documentation/gitsubmodules.txt: avoid non-ASCII apostrophes
Junio C Hamano [Tue, 6 Mar 2018 22:54:05 +0000 (14:54 -0800)]
Merge branch 'jk/test-helper-v-output-fix'
Test framework update.
* jk/test-helper-v-output-fix:
t: send verbose test-helper output to fd 4
Junio C Hamano [Tue, 6 Mar 2018 22:54:05 +0000 (14:54 -0800)]
Merge branch 'jk/cached-commit-buffer'
Code clean-up.
* jk/cached-commit-buffer:
revision: drop --show-all option
commit: drop uses of get_cached_commit_buffer()
Junio C Hamano [Tue, 6 Mar 2018 22:54:05 +0000 (14:54 -0800)]
Merge branch 'bw/doc-submodule-recurse-config-with-clone'
Doc update.
* bw/doc-submodule-recurse-config-with-clone:
submodule: indicate that 'submodule.recurse' doesn't apply to clone
Junio C Hamano [Tue, 6 Mar 2018 22:54:04 +0000 (14:54 -0800)]
Merge branch 'jc/allow-ff-merging-kept-tags'
Since Git 1.7.9, "git merge" defaulted to --no-ff (i.e. even when
the side branch being merged is a descendant of the current commit,
create a merge commit instead of fast-forwarding) when merging a
tag object. This was appropriate default for integrators who pull
signed tags from their downstream contributors, but caused an
unnecessary merges when used by downstream contributors who
habitually "catch up" their topic branches with tagged releases
from the upstream. Update "git merge" to default to --no-ff only
when merging a tag object that does *not* sit at its usual place in
refs/tags/ hierarchy, and allow fast-forwarding otherwise, to
mitigate the problem.
* jc/allow-ff-merging-kept-tags:
merge: allow fast-forward when merging a tracked tag
Junio C Hamano [Tue, 6 Mar 2018 22:54:04 +0000 (14:54 -0800)]
Merge branch 'ab/simplify-perl-makefile'
Hotfix for a topic already in 'master'.
* ab/simplify-perl-makefile:
Makefile: generate Git(3pm) as dependency of the 'doc' and 'man' targets
Junio C Hamano [Tue, 6 Mar 2018 22:54:03 +0000 (14:54 -0800)]
Merge branch 'pw/add-p-single'
"git add -p" used to offer "/" (look for a matching hunk) as a
choice, even there was only one hunk, which has been corrected.
Also the single-key help is now given only for keys that are
enabled (e.g. help for '/' won't be shown when there is only one
hunk).
* pw/add-p-single:
add -p: improve error messages
add -p: only bind search key if there's more than one hunk
add -p: only display help for active keys
Junio C Hamano [Tue, 6 Mar 2018 22:54:03 +0000 (14:54 -0800)]
Merge branch 'sg/t6300-modernize'
Test update.
* sg/t6300-modernize:
t6300-for-each-ref: fix "more than one quoting style" tests
Junio C Hamano [Tue, 6 Mar 2018 22:54:02 +0000 (14:54 -0800)]
Merge branch 'sb/color-h-cleanup'
Devdoc update.
* sb/color-h-cleanup:
color.h: document and modernize header
Junio C Hamano [Tue, 6 Mar 2018 22:54:02 +0000 (14:54 -0800)]
Merge branch 'nd/rebase-show-current-patch'
The new "--show-current-patch" option gives an end-user facing way
to get the diff being applied when "git rebase" (and "git am")
stops with a conflict.
* nd/rebase-show-current-patch:
rebase: introduce and use pseudo-ref REBASE_HEAD
rebase: add --show-current-patch
am: add --show-current-patch
Junio C Hamano [Tue, 6 Mar 2018 22:54:02 +0000 (14:54 -0800)]
Merge branch 'xz/send-email-batch-size'
"git send-email" learned to complain when the batch-size option is
not defined when the relogin-delay option is, since these two are
mutually required.
* xz/send-email-batch-size:
send-email: error out when relogin delay is missing
Junio C Hamano [Tue, 6 Mar 2018 22:54:01 +0000 (14:54 -0800)]
Merge branch 'ab/fetch-prune'
Clarify how configured fetch refspecs interact with the "--prune"
option of "git fetch", and also add a handy short-hand for getting
rid of stale tags that are locally held.
* ab/fetch-prune:
fetch: make the --prune-tags work with <url>
fetch: add a --prune-tags option and fetch.pruneTags config
fetch tests: add scaffolding for the new fetch.pruneTags
git-fetch & config doc: link to the new PRUNING section
git remote doc: correct dangerous lies about what prune does
git fetch doc: add a new section to explain the ins & outs of pruning
fetch tests: fetch <url> <spec> as well as fetch [<remote>]
fetch tests: expand case/esac for later change
fetch tests: double quote a variable for interpolation
fetch tests: test --prune and refspec interaction
fetch tests: add a tag to be deleted to the pruning tests
fetch tests: re-arrange arguments for future readability
fetch tests: refactor in preparation for testing tag pruning
remote: add a macro for "refs/tags/*:refs/tags/*"
fetch: stop accessing "remote" variable indirectly
fetch: trivially refactor assignment to ref_nr
fetch: don't redundantly NULL something calloc() gave us
Junio C Hamano [Tue, 6 Mar 2018 22:54:00 +0000 (14:54 -0800)]
Merge branch 'sm/mv-dry-run-update'
Code clean-up.
* sm/mv-dry-run-update:
mv: remove unneeded 'if (!show_only)'
t7001: add test case for --dry-run
Junio C Hamano [Tue, 6 Mar 2018 22:53:59 +0000 (14:53 -0800)]
Merge branch 'nm/tag-edit'
"git tag" learned an explicit "--edit" option that allows the
message given via "-m" and "-F" to be further edited.
* nm/tag-edit:
tag: add --edit option
Eric Sunshine [Sun, 4 Mar 2018 05:26:47 +0000 (00:26 -0500)]
t2028: fix minor error and issues in newly-added "worktree move" tests
Recently-added "git worktree move" tests include a minor error and a few
small issues. Specifically:
* checking non-existence of wrong file ("source" instead of
"destination")
* unneeded redirect (">empty")
* unused variable ("toplevel")
* restoring a worktree location by means of a separate test somewhat
distant from the test which moved it rather than using
test_when_finished() to restore it in a self-contained fashion
* having git command on the left-hand-side of a pipe ("git foo | grep")
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Acked-by: Duy Nguyen <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy [Tue, 6 Mar 2018 10:16:15 +0000 (17:16 +0700)]
object.h: realign object flag allocation comment
Some new path names are too long and eat into the graph part. Move the
graph 9 columns to the right to avoid this.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy [Tue, 6 Mar 2018 10:16:14 +0000 (17:16 +0700)]
object.h: update flag allocation comment
Since the "flags" is shared, it's a good idea to keep track of who
uses what bit. When we need to use more flags in library code, we can
be sure it won't be re-used for another purpose by some caller.
While at there, fix the location of "5" (should be in a different
column than "4" two lines down)
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Christian Ludwig [Sat, 3 Mar 2018 23:58:14 +0000 (00:58 +0100)]
send-email: support separate Reply-To address
In some projects contributions from groups are only accepted from a
common group email address. But every individual may want to receive
replies to her own personal address. That's what we have 'Reply-To'
headers for in SMTP. So introduce an optional '--reply-to' command
line option.
This patch re-uses the $reply_to variable. This could break
out-of-tree patches!
Signed-off-by: Christian Ludwig <chrissicool@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Christian Ludwig [Sat, 3 Mar 2018 23:58:13 +0000 (00:58 +0100)]
send-email: rename variable for clarity
The SMTP protocol has both, the 'Reply-To' and the 'In-Reply-To' header
fields. We only use the latter. To avoid confusion, rename the variable
for it.
Signed-off-by: Christian Ludwig <chrissicool@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Sat, 3 Mar 2018 05:58:49 +0000 (00:58 -0500)]
add--interactive: detect bogus diffFilter output
It's important that the diff-filter only filter the
individual lines, and that there remain a one-to-one mapping
between the input and output lines. Otherwise, things like
hunk-splitting will behave quite unexpectedly (e.g., you
think you are splitting at one point, but it has a different
effect in the text patch we apply).
We can't detect all problematic cases, but we can at least
catch the obvious case where we don't even have the correct
number of lines.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Sat, 3 Mar 2018 05:58:10 +0000 (00:58 -0500)]
t3701: add a test for interactive.diffFilter
This feature was added in
01143847db (add--interactive:
allow custom diff highlighting programs, 2016-02-27) but
never tested. Let's add a basic test.
Note that we only apply the filter when color is enabled,
so we have to use test_terminal. This is an open limitation
explicitly mentioned in the original commit. So take this
commit as testing the status quo, and not making a statement
on whether we'd want to enhance that in the future.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Sat, 3 Mar 2018 05:27:08 +0000 (00:27 -0500)]
smart-http: document flush after "# service" line
The http-protocol.txt spec fails to mention that a flush packet
comes in the smart server response after sending the "service"
header.
Technically the client code is actually ready to receive an
arbitrary number of headers here, but since we haven't
introduced any other headers in the past decade (and the
client would just throw them away), let's not mention it in
the spec.
This fixes both BNF and the example. While we're fixing the
latter, let's also add the missing flush after the ref list.
Reported-by: Dorian Taylor <dorian.taylor.lists@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ævar Arnfjörð Bjarmason [Sat, 3 Mar 2018 15:38:17 +0000 (15:38 +0000)]
perl Git::LoadCPAN: emit better errors under NO_PERL_CPAN_FALLBACKS
Before my
20d2a30f8f ("Makefile: replace perl/Makefile.PL with simple
make rules", 2017-12-10) on an OS package that removed the
private-Error.pm copy we carried around manually removing the OS's
Error.pm would yield:
$ git add -p
Can't locate Error.pm in @INC (you may need to install the Error module) [...]
Now, before this change we'll instead emit this more cryptic error:
$ git add -p
BUG: '/usr/share/perl5/Git/FromCPAN' should be a directory! at /usr/share/perl5/Git/Error.pm line 36.
This is a confusing error. Now if the new NO_PERL_CPAN_FALLBACKS
option is specified and we can't find the module we'll instead emit:
$ /tmp/git/bin/git add -p
BUG: The 'Error' module is not here, but NO_PERL_CPAN_FALLBACKS was set!
[...]
Where [...] is the lengthy explanation seen in the change below, which
explains what the potential breakage is, and how to fix it.
The reason for checking @@NO_PERL_CPAN_FALLBACKS@@] against the empty
string in Perl is as opposed to checking for a boolean value is that
that's (as far as I can tell) make's idea of a string that's set, and
e.g. NO_PERL_CPAN_FALLBACKS=0 is enough to set NO_PERL_CPAN_FALLBACKS.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Todd Zullinger [Sat, 3 Mar 2018 15:38:16 +0000 (15:38 +0000)]
Makefile: add NO_PERL_CPAN_FALLBACKS knob
We include some perl modules which are not part of the core perl
install, as a convenience. This allows us to rely on those modules in
our perl-based tools and scripts without requiring users to install the
modules from CPAN or their operating system packages.
Users whose operating system provides these modules and packagers of Git
often don't want to ship or use these bundled modules. Allow these
users to set NO_PERL_CPAN_FALLBACKS to avoid installing the bundled
modules.
Signed-off-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ævar Arnfjörð Bjarmason [Sat, 3 Mar 2018 15:38:15 +0000 (15:38 +0000)]
perl: move the perl/Git/FromCPAN tree to perl/FromCPAN
Move the CPAN modules that have lived under perl/Git/FromCPAN since my
20d2a30f8f ("Makefile: replace perl/Makefile.PL with simple make
rules", 2017-12-10) to perl/FromCPAN.
A subsequent change will teach the Makefile to only install these
copies of CPAN modules if a flag that distro packagers would like to
set isn't set. Due to how the wildcard globbing is being done it's
much easier to accomplish that if they're moved to their own
directory.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ævar Arnfjörð Bjarmason [Sat, 3 Mar 2018 15:38:14 +0000 (15:38 +0000)]
perl: generalize the Git::LoadCPAN facility
Change the two wrappers that load from CPAN (local OS) or our own copy
to do so via the same codepath.
I added the Error.pm wrapper in
20d2a30f8f ("Makefile: replace
perl/Makefile.PL with simple make rules", 2017-12-10), and shortly
afterwards Matthieu Moy added a wrapper for Mail::Address in
bd869f67b9 ("send-email: add and use a local copy of Mail::Address",
2018-01-05).
His loader was simpler since Mail::Address doesn't have an "import"
method, but didn't do the same sanity checking; For example, a missing
FromCPAN directory (which OS packages are likely not to have) wouldn't
be explicitly warned about as a "BUG: ...".
Update both to use a common implementation based on the previous
Error.pm loader. Which has been amended to take the module to load as
parameter, as well as whether or not that module has an import
method.
This loader should be generic enough to handle almost all CPAN modules
out there, some use some crazy loading magic and wouldn't like being
wrapped like this, but that would be immediately obvious, and we'd
find out right away since the module wouldn't work at all.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ævar Arnfjörð Bjarmason [Sat, 3 Mar 2018 15:38:13 +0000 (15:38 +0000)]
perl: move CPAN loader wrappers to another namespace
Move the Git::Error and Git::Mail::Address wrappers to the
Git::LoadCPAN::Loader::* namespace, e.g. Git::LoadCPAN::Error. That
module will then either load Error from CPAN (if installed on the OS),
or use Git::FromCPAN::Error.
When I added the Error wrapper in
20d2a30f8f ("Makefile: replace
perl/Makefile.PL with simple make rules", 2017-12-10) I didn't think
about how confusing it would be to have these modules sitting in the
same tree as our normal modules. Let's put these all into
Git::{Load,From}CPAN::* to clearly distinguish them from the rest.
This also makes things a bit less confusing since there was already a
Git::Error namespace ever since
8b9150e3e3 ("Git.pm: Handle failed
commands' output", 2006-06-24).
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>