gitweb.git
trace: add trace_performance facility to debug performa... Karsten Blees Sat, 12 Jul 2014 00:06:28 +0000 (02:06 +0200)

trace: add trace_performance facility to debug performance issues

Add trace_performance and trace_performance_since macros that print a
duration and an optional printf-formatted text to the file specified in
environment variable GIT_TRACE_PERFORMANCE.

These macros, in conjunction with getnanotime(), are intended to simplify
performance measurements from within the application (i.e. profiling via
manual instrumentation, rather than using an external profiling tool).

Unless enabled via GIT_TRACE_PERFORMANCE, these macros have no noticeable
impact on performance, so that test code for well known time killers may
be shipped in release builds. Alternatively, a developer could provide an
additional performance patch (not meant for master) that allows reviewers
to reproduce performance tests more easily, e.g. on other platforms or
using their own repositories.

Usage examples:

Simple use case (measure one code section):

uint64_t start = getnanotime();
/* code section to measure */
trace_performance_since(start, "foobar");

Complex use case (measure repetitive code sections):

uint64_t t = 0;
for (;;) {
/* ignore */
t -= getnanotime();
/* code section to measure */
t += getnanotime();
/* ignore */
}
trace_performance(t, "frotz");

Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

trace: add high resolution timer function to debug... Karsten Blees Sat, 12 Jul 2014 00:05:42 +0000 (02:05 +0200)

trace: add high resolution timer function to debug performance issues

Add a getnanotime() function that returns nanoseconds since 01/01/1970 as
unsigned 64-bit integer (i.e. overflows in july 2554). This is easier to
work with than e.g. struct timeval or struct timespec. Basing the timer on
the epoch allows using the results with other time-related APIs.

To simplify adaption to different platforms, split the implementation into
a common getnanotime() and a platform-specific highres_nanos() function.

The common getnanotime() function handles errors, falling back to
gettimeofday() if highres_nanos() isn't implemented or doesn't work.

getnanotime() is also responsible for normalizing to the epoch. The offset
to the system clock is calculated only once on initialization, i.e.
manually setting the system clock has no impact on the timer (except if
the fallback gettimeofday() is in use). Git processes are typically short
lived, so we don't need to handle clock drift.

The highres_nanos() function returns monotonically increasing nanoseconds
relative to some arbitrary point in time (e.g. system boot), or 0 on
failure. Providing platform-specific implementations should be relatively
easy, e.g. adapting to clock_gettime() as defined by the POSIX realtime
extensions is seven lines of code.

This version includes highres_nanos() implementations for:
* Linux: using clock_gettime(CLOCK_MONOTONIC)
* Windows: using QueryPerformanceCounter()

Todo:
* enable clock_gettime() on more platforms
* add Mac OSX version, e.g. using mach_absolute_time + mach_timebase_info

Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

trace: add 'file:line' to all trace outputKarsten Blees Sat, 12 Jul 2014 00:05:03 +0000 (02:05 +0200)

trace: add 'file:line' to all trace output

This is useful to see where trace output came from.

Add 'const char *file, int line' parameters to the printing functions and
rename them to *_fl.

Add trace_printf* and trace_strbuf macros resolving to the *_fl functions
and let the preprocessor fill in __FILE__ and __LINE__.

As the trace_printf* functions take a variable number of arguments, this
requires variadic macros (i.e. '#define foo(...) foo_impl(__VA_ARGS__)'.
Though part of C99, it is unclear whether older compilers support this.
Thus keep the old functions and only enable variadic macros for GNUC and
MSVC 2005+ (_MSC_VER 1400). This has the nice side effect that the old
C-style declarations serve as documentation how the macros are to be used.

Print 'file:line ' as prefix to each trace line. Align the remaining trace
output at column 40 to accommodate 18 char file names + 4 digit line
number (currently there are 30 *.c files of length 18 and just 11 of 19).
Trace output from longer source files (e.g. builtin/receive-pack.c) will
not be aligned.

Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

trace: move code around, in preparation to file:line... Karsten Blees Sat, 12 Jul 2014 00:04:29 +0000 (02:04 +0200)

trace: move code around, in preparation to file:line output

No functional changes, just move stuff around so that the next patch isn't
that ugly...

Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

trace: add current timestamp to all trace outputKarsten Blees Sat, 12 Jul 2014 00:03:50 +0000 (02:03 +0200)

trace: add current timestamp to all trace output

This is useful to tell apart trace output of separate test runs.

It can also be used for basic, coarse-grained performance analysis. Note
that the accuracy is tainted by writing to the trace file, and you have to
calculate the deltas yourself (which is next to impossible if multiple
threads or processes are involved).

Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

trace: disable additional trace output for unit testsKarsten Blees Sat, 12 Jul 2014 00:03:01 +0000 (02:03 +0200)

trace: disable additional trace output for unit tests

Some unit-tests use trace output to verify internal state, and unstable
output such as timestamps and line numbers are not useful there.

Disable additional trace output if GIT_TRACE_BARE is set.

Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

trace: add infrastructure to augment trace output with... Karsten Blees Sat, 12 Jul 2014 00:02:18 +0000 (02:02 +0200)

trace: add infrastructure to augment trace output with additional info

To be able to add a common prefix or suffix to all trace output (e.g.
a timestamp or file:line of the caller), factor out common setup and
cleanup tasks of the trace* functions.

When adding a common prefix, it makes sense that the output of each trace
call starts on a new line. Add '\n' in case the caller forgot.

Note that this explicitly limits trace output to line-by-line, it is no
longer possible to trace-print just part of a line. Until now, this was
just an implicit assumption (trace-printing part of a line worked, but
messed up the trace file if multiple threads or processes were involved).

Thread-safety / inter-process-safety is also the reason why we need to do
the prefixing and suffixing in memory rather than issuing multiple write()
calls. Write_or_whine_pipe() / xwrite() is atomic unless the size exceeds
MAX_IO_SIZE (8MB, see wrapper.c). In case of trace_strbuf, this costs an
additional string copy (which should be irrelevant for performance in light
of actual file IO).

While we're at it, rename trace_strbuf's 'buf' argument, which suggests
that the function is modifying the buffer. Trace_strbuf() currently is the
only trace API that can print arbitrary binary data (without barfing on
'%' or stopping at '\0'), so 'data' seems more appropriate.

Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sha1_file: change GIT_TRACE_PACK_ACCESS logging to... Karsten Blees Sat, 12 Jul 2014 00:01:38 +0000 (02:01 +0200)

sha1_file: change GIT_TRACE_PACK_ACCESS logging to use trace API

This changes GIT_TRACE_PACK_ACCESS functionality as follows:
* supports the same options as GIT_TRACE (e.g. printing to stderr)
* no longer supports relative paths
* appends to the trace file rather than overwriting

Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation/git.txt: improve documentation of 'GIT_TR... Karsten Blees Sat, 12 Jul 2014 00:00:53 +0000 (02:00 +0200)

Documentation/git.txt: improve documentation of 'GIT_TRACE*' variables

Separate GIT_TRACE description into what it prints and how to configure
where trace output is printed to. Change other GIT_TRACE_* descriptions to
refer to GIT_TRACE.

Add descriptions for GIT_TRACE_SETUP and GIT_TRACE_SHALLOW.

Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

trace: improve trace performanceKarsten Blees Sat, 12 Jul 2014 00:00:06 +0000 (02:00 +0200)

trace: improve trace performance

The trace API currently rechecks the environment variable and reopens the
trace file on every API call. This has the ugly side effect that errors
(e.g. file cannot be opened, or the user specified a relative path) are
also reported on every call. Performance can be improved by about factor
three by remembering the environment state and keeping the file open.

Replace the 'const char *key' parameter in the API with a pointer to a
'struct trace_key' that bundles the environment variable name with
additional, trace-internal state. Change the call sites of these APIs to
use a static 'struct trace_key' instead of a string constant.

In trace.c::get_trace_fd(), save and reuse the file descriptor in 'struct
trace_key'.

Add a 'trace_disable()' API, so that packet_trace() can cleanly disable
tracing when it encounters packed data (instead of using unsetenv()).

Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

trace: remove redundant printf format attributeKarsten Blees Wed, 11 Jun 2014 07:57:59 +0000 (09:57 +0200)

trace: remove redundant printf format attribute

trace_printf_key() is the only non-static function that duplicates the
printf format attribute in the .c file, remove it for consistency.

Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

trace: consistently name the format parameterKarsten Blees Wed, 11 Jun 2014 07:57:23 +0000 (09:57 +0200)

trace: consistently name the format parameter

The format parameter to trace_printf functions is sometimes abbreviated
'fmt'. Rename to 'format' everywhere (consistent with POSIX' printf
specification).

Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

trace: move trace declarations from cache.h to new... Karsten Blees Wed, 11 Jun 2014 07:56:49 +0000 (09:56 +0200)

trace: move trace declarations from cache.h to new trace.h

Also include direct dependencies (strbuf.h and git-compat-util.h for
__attribute__) so that trace.h can be used independently of cache.h, e.g.
in test programs.

Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Third batch for 2.1Junio C Hamano Mon, 16 Jun 2014 19:39:35 +0000 (12:39 -0700)

Third batch for 2.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'ib/test-selectively-run'Junio C Hamano Mon, 16 Jun 2014 19:18:56 +0000 (12:18 -0700)

Merge branch 'ib/test-selectively-run'

Allow specifying only certain individual test pieces to be run
using a range notation (e.g. "t1234-test.sh --run='1-4 6 8 9-'").

* ib/test-selectively-run:
t0000-*.sh: fix the GIT_SKIP_TESTS sub-tests
test-lib: '--run' to run only specific tests
test-lib: tests skipped by GIT_SKIP_TESTS say so
test-lib: document short options in t/README

Merge branch 'ta/string-list-init'Junio C Hamano Mon, 16 Jun 2014 19:18:55 +0000 (12:18 -0700)

Merge branch 'ta/string-list-init'

* ta/string-list-init:
string-list: spell all values out that are given to a string_list initializer

Merge branch 'jm/dedup-test-config'Junio C Hamano Mon, 16 Jun 2014 19:18:54 +0000 (12:18 -0700)

Merge branch 'jm/dedup-test-config'

* jm/dedup-test-config:
t/t7810-grep.sh: remove duplicate test_config()

Merge branch 'dt/refs-check-refname-component-optim'Junio C Hamano Mon, 16 Jun 2014 19:18:52 +0000 (12:18 -0700)

Merge branch 'dt/refs-check-refname-component-optim'

* dt/refs-check-refname-component-optim:
refs.c: optimize check_refname_component()

Merge branch 'sk/test-cmp-bin'Junio C Hamano Mon, 16 Jun 2014 19:18:50 +0000 (12:18 -0700)

Merge branch 'sk/test-cmp-bin'

* sk/test-cmp-bin:
t5000, t5003: do not use test_cmp to compare binary files

Merge branch 'sh/enable-preloadindex'Junio C Hamano Mon, 16 Jun 2014 19:18:49 +0000 (12:18 -0700)

Merge branch 'sh/enable-preloadindex'

* sh/enable-preloadindex:
environment.c: enable core.preloadindex by default

Merge branch 'rs/read-ref-at'Junio C Hamano Mon, 16 Jun 2014 19:18:48 +0000 (12:18 -0700)

Merge branch 'rs/read-ref-at'

* rs/read-ref-at:
refs.c: change read_ref_at to use the reflog iterators

Merge branch 'jk/error-resolve-conflict-advice'Junio C Hamano Mon, 16 Jun 2014 19:18:47 +0000 (12:18 -0700)

Merge branch 'jk/error-resolve-conflict-advice'

* jk/error-resolve-conflict-advice:
error_resolve_conflict: drop quotations around operation
error_resolve_conflict: rewrap advice message

Merge branch 'rs/pack-objects-no-unnecessary-realloc'Junio C Hamano Mon, 16 Jun 2014 19:18:42 +0000 (12:18 -0700)

Merge branch 'rs/pack-objects-no-unnecessary-realloc'

Avoid unnecessary copy of previous contents when extending the
hashtable used in pack-objects.

* rs/pack-objects-no-unnecessary-realloc:
pack-objects: use free()+xcalloc() instead of xrealloc()+memset()

Merge branch 'lt/log-auto-decorate'Junio C Hamano Mon, 16 Jun 2014 19:18:41 +0000 (12:18 -0700)

Merge branch 'lt/log-auto-decorate'

* lt/log-auto-decorate:
git log: support "auto" decorations

Merge branch 'jm/doc-wording-tweaks'Junio C Hamano Mon, 16 Jun 2014 19:18:39 +0000 (12:18 -0700)

Merge branch 'jm/doc-wording-tweaks'

* jm/doc-wording-tweaks:
Documentation: wording fixes in the user manual and glossary

Merge branch 'jm/format-patch-mail-sig'Junio C Hamano Mon, 16 Jun 2014 19:18:38 +0000 (12:18 -0700)

Merge branch 'jm/format-patch-mail-sig'

* jm/format-patch-mail-sig:
format-patch: add "--signature-file=<file>" option
format-patch: make newline after signature conditional

Merge branch 'jk/http-errors'Junio C Hamano Mon, 16 Jun 2014 19:18:35 +0000 (12:18 -0700)

Merge branch 'jk/http-errors'

Propagate the error messages from the webserver better to the
client coming over the HTTP transport.

* jk/http-errors:
http: default text charset to iso-8859-1
remote-curl: reencode http error messages
strbuf: add strbuf_reencode helper
http: optionally extract charset parameter from content-type
http: extract type/subtype portion of content-type
t5550: test display of remote http error messages
t/lib-httpd: use write_script to copy CGI scripts
test-lib: preserve GIT_CURL_VERBOSE from the environment

Merge branch 'ow/config-mailmap-pathname'Junio C Hamano Mon, 16 Jun 2014 19:18:24 +0000 (12:18 -0700)

Merge branch 'ow/config-mailmap-pathname'

mailmap.file configuration names a pathname, hence should honor
~/path and ~user/path as its value.

* ow/config-mailmap-pathname:
config: respect '~' and '~user' in mailmap.file

Merge branch 'fc/remote-helper-refmap'Junio C Hamano Mon, 16 Jun 2014 19:18:15 +0000 (12:18 -0700)

Merge branch 'fc/remote-helper-refmap'

Allow remote-helper/fast-import based transport to rename the refs
while transferring the history.

* fc/remote-helper-refmap:
transport-helper: remove unnecessary strbuf resets
transport-helper: add support to delete branches
fast-export: add support to delete refs
fast-import: add support to delete refs
transport-helper: add support to push symbolic refs
transport-helper: add support for old:new refspec
fast-export: add new --refspec option
fast-export: improve argument parsing

Merge branch 'nd/daemonize-gc'Junio C Hamano Mon, 16 Jun 2014 19:18:12 +0000 (12:18 -0700)

Merge branch 'nd/daemonize-gc'

"git gc --auto" was recently changed to run in the background to
give control back early to the end-user sitting in front of the
terminal, but it forgot that housekeeping involving reflogs should
be done without other processes competing for accesses to the refs.

* nd/daemonize-gc:
gc --auto: do not lock refs in the background

Merge branch 'jm/t9138-style-fix'Junio C Hamano Mon, 16 Jun 2014 19:18:09 +0000 (12:18 -0700)

Merge branch 'jm/t9138-style-fix'

* jm/t9138-style-fix:
t9138-git-svn-authors-prog.sh fixups

Merge branch 'jm/instaweb-apache-24'Junio C Hamano Mon, 16 Jun 2014 19:18:06 +0000 (12:18 -0700)

Merge branch 'jm/instaweb-apache-24'

* jm/instaweb-apache-24:
git-instaweb: add support for Apache 2.4

Merge branch 'jl/remote-rm-prune'Junio C Hamano Mon, 16 Jun 2014 19:17:58 +0000 (12:17 -0700)

Merge branch 'jl/remote-rm-prune'

"git remote rm" and "git remote prune" can involve removing many
refs at once, which is not a very efficient thing to do when very
many refs exist in the packed-refs file.

* jl/remote-rm-prune:
remote prune: optimize "dangling symref" check/warning
remote: repack packed-refs once when deleting multiple refs
remote rm: delete remote configuration as the last

Merge branch 'jk/complete-merge-pull'Junio C Hamano Mon, 16 Jun 2014 19:17:53 +0000 (12:17 -0700)

Merge branch 'jk/complete-merge-pull'

The completion code did not know about quite a few options that are
common between "git merge" and "git pull", and a couple of options
unique to "git merge".

* jk/complete-merge-pull:
completion: add missing options for git-merge
completion: add a note that merge options are shared

Merge branch 'bg/xcalloc-nmemb-then-size'Junio C Hamano Mon, 16 Jun 2014 19:17:50 +0000 (12:17 -0700)

Merge branch 'bg/xcalloc-nmemb-then-size'

Like calloc(3), xcalloc() takes nmemb and then size.

* bg/xcalloc-nmemb-then-size:
transport-helper.c: rearrange xcalloc arguments
remote.c: rearrange xcalloc arguments
reflog-walk.c: rearrange xcalloc arguments
pack-revindex.c: rearrange xcalloc arguments
notes.c: rearrange xcalloc arguments
imap-send.c: rearrange xcalloc arguments
http-push.c: rearrange xcalloc arguments
diff.c: rearrange xcalloc arguments
config.c: rearrange xcalloc arguments
commit.c: rearrange xcalloc arguments
builtin/remote.c: rearrange xcalloc arguments
builtin/ls-remote.c: rearrange xcalloc arguments

Merge branch 'jl/status-added-submodule-is-never-ignored'Junio C Hamano Mon, 16 Jun 2014 17:07:19 +0000 (10:07 -0700)

Merge branch 'jl/status-added-submodule-is-never-ignored'

submodule.*.ignore and diff.ignoresubmodules are used to ignore all
submodule changes in "diff" output, but it can be confusing to
apply these configuration values to status and commit.

This is a backward-incompatible change, but should be so in a good
way (aka bugfix).

* jl/status-added-submodule-is-never-ignored:
commit -m: commit staged submodules regardless of ignore config
status/commit: show staged submodules regardless of ignore config

Merge branch 'cb/byte-order'Junio C Hamano Mon, 16 Jun 2014 17:07:17 +0000 (10:07 -0700)

Merge branch 'cb/byte-order'

Compatibility enhancement for Solaris.

* cb/byte-order:
compat/bswap.h: fix endianness detection
compat/bswap.h: restore preference __BIG_ENDIAN over BIG_ENDIAN
compat/bswap.h: detect endianness on more platforms that don't use BYTE_ORDER

Merge branch 'jk/strbuf-tolower'Junio C Hamano Mon, 16 Jun 2014 17:07:16 +0000 (10:07 -0700)

Merge branch 'jk/strbuf-tolower'

* jk/strbuf-tolower:
strbuf: add strbuf_tolower function

Merge branch 'jk/daemon-tolower'Junio C Hamano Mon, 16 Jun 2014 17:07:14 +0000 (10:07 -0700)

Merge branch 'jk/daemon-tolower'

* jk/daemon-tolower:
daemon/config: factor out duplicate xstrdup_tolower

Merge branch 'as/pretty-truncate'Junio C Hamano Mon, 16 Jun 2014 17:07:12 +0000 (10:07 -0700)

Merge branch 'as/pretty-truncate'

* as/pretty-truncate:
pretty.c: format string with truncate respects logOutputEncoding
t4205, t6006: add tests that fail with i18n.logOutputEncoding set
t4205 (log-pretty-format): use `tformat` rather than `format`
t4041, t4205, t6006, t7102: don't hardcode tested encoding value
t4205 (log-pretty-formats): don't hardcode SHA-1 in expected outputs

Merge branch 'jk/diff-follow-must-take-one-pathspec'Junio C Hamano Mon, 16 Jun 2014 17:07:09 +0000 (10:07 -0700)

Merge branch 'jk/diff-follow-must-take-one-pathspec'

* jk/diff-follow-must-take-one-pathspec:
move "--follow needs one pathspec" rule to diff_setup_done

Merge branch 'sk/windows-unc-path'Junio C Hamano Mon, 16 Jun 2014 17:07:03 +0000 (10:07 -0700)

Merge branch 'sk/windows-unc-path'

* sk/windows-unc-path:
Windows: allow using UNC path for git repository

Merge branch 'rr/rebase-autostash-fix'Junio C Hamano Mon, 16 Jun 2014 17:06:57 +0000 (10:06 -0700)

Merge branch 'rr/rebase-autostash-fix'

* rr/rebase-autostash-fix:
rebase -i: test "Nothing to do" case with autostash
rebase -i: handle "Nothing to do" case with autostash

Merge branch 'jk/report-fail-to-read-objects-better'Junio C Hamano Mon, 16 Jun 2014 17:06:15 +0000 (10:06 -0700)

Merge branch 'jk/report-fail-to-read-objects-better'

* jk/report-fail-to-read-objects-better:
open_sha1_file: report "most interesting" errno

Merge branch 'jk/diff-files-assume-unchanged'Junio C Hamano Mon, 16 Jun 2014 17:06:12 +0000 (10:06 -0700)

Merge branch 'jk/diff-files-assume-unchanged'

* jk/diff-files-assume-unchanged:
run_diff_files: do not look at uninitialized stat data

Merge branch 'jk/argv-array-for-child-process'Junio C Hamano Mon, 16 Jun 2014 17:06:10 +0000 (10:06 -0700)

Merge branch 'jk/argv-array-for-child-process'

* jk/argv-array-for-child-process:
argv-array: drop "detach" code
get_importer: use run-command's internal argv_array
get_exporter: use argv_array
get_helper: use run-command's internal argv_array
git_connect: use argv_array
run_column_filter: use argv_array
run-command: store an optional argv_array

Merge branch 'sk/wincred'Junio C Hamano Mon, 16 Jun 2014 17:06:08 +0000 (10:06 -0700)

Merge branch 'sk/wincred'

* sk/wincred:
wincred: avoid overwriting configured variables
wincred: add install target

Merge branch 'jk/do-not-run-httpd-tests-as-root'Junio C Hamano Mon, 16 Jun 2014 17:06:05 +0000 (10:06 -0700)

Merge branch 'jk/do-not-run-httpd-tests-as-root'

* jk/do-not-run-httpd-tests-as-root:
t/lib-httpd: require SANITY prereq

Merge branch 'cc/replace-edit'Junio C Hamano Mon, 16 Jun 2014 17:06:01 +0000 (10:06 -0700)

Merge branch 'cc/replace-edit'

"git replace" learns a new "--edit" option.

* cc/replace-edit:
Documentation: replace: describe new --edit option
replace: add --edit to usage string
replace: add tests for --edit
replace: die early if replace ref already exists
replace: refactor checking ref validity
replace: make sure --edit results in a different object
replace: add --edit option
replace: factor object resolution out of replace_object
replace: use OPT_CMDMODE to handle modes
replace: refactor command-mode determination

Merge branch 'mt/patch-id-stable' (early part)Junio C Hamano Mon, 16 Jun 2014 17:05:37 +0000 (10:05 -0700)

Merge branch 'mt/patch-id-stable' (early part)

* 'mt/patch-id-stable' (early part):
patch-id-test: test stable and unstable behaviour
patch-id: make it stable against hunk reordering
test doc: test_write_lines does not split its arguments
test: add test_write_lines helper

Sync with maintJunio C Hamano Thu, 12 Jun 2014 19:22:38 +0000 (12:22 -0700)

Sync with maint

* maint:
pull: do not abuse 'break' inside a shell 'case'

Merge branch 'jc/rev-parse-argh-dashed-multi-words... Junio C Hamano Thu, 12 Jun 2014 19:17:57 +0000 (12:17 -0700)

Merge branch 'jc/rev-parse-argh-dashed-multi-words' into maint

* jc/rev-parse-argh-dashed-multi-words:
update-index: fix segfault with missing --cacheinfo argument

pull: do not abuse 'break' inside a shell 'case'Jacek Konieczny Wed, 11 Jun 2014 08:47:45 +0000 (10:47 +0200)

pull: do not abuse 'break' inside a shell 'case'

It is not C. The code would break under mksh when 'pull.ff' is set:

$ git pull
/usr/lib/git-core/git-pull[67]: break: can't break
Already up-to-date.

Signed-off-by: Jacek Konieczny <jajcus@jajcus.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Windows: allow using UNC path for git repositoryCezary Zawadka Tue, 13 Jul 2010 14:17:43 +0000 (16:17 +0200)

Windows: allow using UNC path for git repository

[efl: moved MinGW-specific part to compat/]
[jes: fixed compilation on non-Windows]

Eric Sunshine fixed mingw_offset_1st_component() to return
consistently "foo" for UNC "//machine/share/foo", cf

http://groups.google.com/group/msysgit/browse_thread/thread/c0af578549b5dda0

Author: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Cezary Zawadka <czawadka@gmail.com>
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Stepan Kasal <kasal@ucw.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

patch-id-test: test stable and unstable behaviourMichael S. Tsirkin Sun, 27 Apr 2014 18:15:51 +0000 (21:15 +0300)

patch-id-test: test stable and unstable behaviour

Verify that patch ID supports an algorithm
that is stable against diff split and reordering.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

patch-id: make it stable against hunk reorderingMichael S. Tsirkin Sun, 27 Apr 2014 18:15:44 +0000 (21:15 +0300)

patch-id: make it stable against hunk reordering

Patch id changes if users reorder file diffs that make up a patch.

As the result is functionally equivalent, a different patch id is
surprising to many users.
In particular, reordering files using diff -O is helpful to make patches
more readable (e.g. API header diff before implementation diff).

Add an option to change patch-id behaviour making it stable against
these kinds of patch change:
calculate SHA1 hash for each hunk separately and sum all hashes
(using a symmetrical sum) to get patch id

We use a 20byte sum and not xor - since xor would give 0 output
for patches that have two identical diffs, which isn't all that
unlikely (e.g. append the same line in two places).

The new behaviour is enabled
- when patchid.stable is true
- when --stable flag is present

Using a new flag --unstable or setting patchid.stable to false force
the historical behaviour.

In the documentation, clarify that patch ID can now be a sum of hashes,
not a hash.
Document how command line and config options affect the
behaviour.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

test doc: test_write_lines does not split its argumentsJonathan Nieder Mon, 5 May 2014 23:51:43 +0000 (16:51 -0700)

test doc: test_write_lines does not split its arguments

test_write_lines carefully quotes its arguments as "$@", so

test_write_lines "a b" c

writes two lines as requested, not three.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

test: add test_write_lines helperMichael S. Tsirkin Sun, 27 Apr 2014 18:15:47 +0000 (21:15 +0300)

test: add test_write_lines helper

API and implementation as suggested by Junio.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Update draft release notes to 2.1Junio C Hamano Mon, 9 Jun 2014 18:39:43 +0000 (11:39 -0700)

Update draft release notes to 2.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'jc/shortlog-ref-exclude'Junio C Hamano Mon, 9 Jun 2014 18:30:12 +0000 (11:30 -0700)

Merge branch 'jc/shortlog-ref-exclude'

"log --exclude=<glob> --all | shortlog" worked as expected, but
"shortlog --exclude=<glob> --all" was not accepted at the command
line argument parser level.

* jc/shortlog-ref-exclude:
shortlog: allow --exclude=<glob> to be passed

Merge branch 'mn/sideband-no-ansi'Junio C Hamano Mon, 9 Jun 2014 18:27:55 +0000 (11:27 -0700)

Merge branch 'mn/sideband-no-ansi'

Tools that read diagnostic output in our standard error stream do
not want to see terminal control sequence (e.g. erase-to-eol).
Detect them by checking if the standard error stream is connected to
a tty.

* mn/sideband-no-ansi:
sideband.c: do not use ANSI control sequence on non-terminal

Merge branch 'rs/mailinfo-header-cmp'Junio C Hamano Mon, 9 Jun 2014 18:27:53 +0000 (11:27 -0700)

Merge branch 'rs/mailinfo-header-cmp'

Avoid running over the end of header string while parsing an
incoming e-mail message to extract the patch.

* rs/mailinfo-header-cmp:
mailinfo: use strcmp() for string comparison

Merge branch 'pb/trim-trailing-spaces'Junio C Hamano Mon, 9 Jun 2014 18:27:47 +0000 (11:27 -0700)

Merge branch 'pb/trim-trailing-spaces'

Fix an error in parsing of .gitignore files that use a trailing
"\ " to mark pathnames that end with a SP.

* pb/trim-trailing-spaces:
dir.c:trim_trailing_spaces(): fix for " \ " sequence

Merge branch 'na/no-http-test-in-the-middle'Junio C Hamano Mon, 9 Jun 2014 18:26:51 +0000 (11:26 -0700)

Merge branch 'na/no-http-test-in-the-middle'

The mode to run tests with HTTP server tests disabled was broken.

* na/no-http-test-in-the-middle:
t5538: move http push tests out to t5542

Merge branch 'jc/rev-parse-argh-dashed-multi-words'Junio C Hamano Mon, 9 Jun 2014 18:26:49 +0000 (11:26 -0700)

Merge branch 'jc/rev-parse-argh-dashed-multi-words'

"update-index --cacheinfo" in 2.0 crashes on a malformed command line.

* jc/rev-parse-argh-dashed-multi-words:
update-index: fix segfault with missing --cacheinfo argument

Merge branch 'lt/request-pull'Junio C Hamano Mon, 9 Jun 2014 18:26:22 +0000 (11:26 -0700)

Merge branch 'lt/request-pull'

A brown-paper-bag bugfix to a test that turned out to be a no-op by
mistake.

* lt/request-pull:
fix brown paper bag breakage in t5150-request-pull.sh

string-list: spell all values out that are given to... Tanay Abhra Tue, 3 Jun 2014 09:13:18 +0000 (02:13 -0700)

string-list: spell all values out that are given to a string_list initializer

STRING_LIST_INIT_{NODUP,DUP} initializers list values only
for earlier structure members, relying on the usual
convention in C that the omitted members are initailized to
0, i.e. the former is expanded to the latter:

struct string_list l = STRING_LIST_INIT_DUP;
struct string_list l = { NULL, 0, 0, 1 };

and the last member that is not mentioned (i.e. 'cmp') is
initialized to NULL.

While there is nothing wrong in this construct, spelling out
all the values where the macros are defined will serve also
as a documentation, so let's do so.

Signed-off-by: Tanay Abhra <tanayabh@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t0000-*.sh: fix the GIT_SKIP_TESTS sub-testsRamsay Jones Tue, 20 May 2014 23:33:46 +0000 (00:33 +0100)

t0000-*.sh: fix the GIT_SKIP_TESTS sub-tests

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

test-lib: '--run' to run only specific testsIlya Bobyr Wed, 30 Apr 2014 09:50:44 +0000 (02:50 -0700)

test-lib: '--run' to run only specific tests

Allow better control of the set of tests that will be executed for a
single test suite. Mostly useful while debugging or developing as it
allows to focus on a specific test.

Signed-off-by: Ilya Bobyr <ilya.bobyr@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

test-lib: tests skipped by GIT_SKIP_TESTS say soIlya Bobyr Wed, 30 Apr 2014 09:50:43 +0000 (02:50 -0700)

test-lib: tests skipped by GIT_SKIP_TESTS say so

We used to show "(missing )" next to tests skipped because they are
specified in GIT_SKIP_TESTS. Use "(GIT_SKIP_TESTS)" instead.

Plus tests that check basic GIT_SKIP_TESTS functions.

Signed-off-by: Ilya Bobyr <ilya.bobyr@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

test-lib: document short options in t/READMEIlya Bobyr Wed, 30 Apr 2014 09:50:42 +0000 (02:50 -0700)

test-lib: document short options in t/README

Most arguments that could be provided to a test have short forms.
Unless documented, the only way to learn them is to read the code.

Signed-off-by: Ilya Bobyr <ilya.bobyr@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Second batch for 2.1Junio C Hamano Fri, 6 Jun 2014 18:42:05 +0000 (11:42 -0700)

Second batch for 2.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'ss/howto-manage-trunk'Junio C Hamano Fri, 6 Jun 2014 18:39:12 +0000 (11:39 -0700)

Merge branch 'ss/howto-manage-trunk'

* ss/howto-manage-trunk:
How to keep a project's canonical history correct.

Merge branch 'mc/git-p4-prepare-p4-only'Junio C Hamano Fri, 6 Jun 2014 18:38:57 +0000 (11:38 -0700)

Merge branch 'mc/git-p4-prepare-p4-only'

* mc/git-p4-prepare-p4-only:
git-p4: Do not include diff in spec file when just preparing p4

Merge branch 'jn/test-lint-unmoor'Junio C Hamano Fri, 6 Jun 2014 18:38:54 +0000 (11:38 -0700)

Merge branch 'jn/test-lint-unmoor'

* jn/test-lint-unmoor:
test-lint: find unportable sed, echo, test, and export usage after &&

Merge branch 'ep/shell-assign-and-export-vars'Junio C Hamano Fri, 6 Jun 2014 18:38:51 +0000 (11:38 -0700)

Merge branch 'ep/shell-assign-and-export-vars'

* ep/shell-assign-and-export-vars:
scripts: more "export VAR=VALUE" fixes
scripts: "export VAR=VALUE" construct is not portable

Merge branch 'jj/command-line-adjective'Junio C Hamano Fri, 6 Jun 2014 18:38:48 +0000 (11:38 -0700)

Merge branch 'jj/command-line-adjective'

* jj/command-line-adjective:
Documentation: use "command-line" when used as a compound adjective, and fix other minor grammatical issues

Merge branch 'jc/coding-guidelines'Junio C Hamano Fri, 6 Jun 2014 18:38:44 +0000 (11:38 -0700)

Merge branch 'jc/coding-guidelines'

* jc/coding-guidelines:
CodingGuidelines: avoid "test <cond> -a/-o <cond>"
CodingGuidelines: on splitting a long line
CodingGuidelines: on comparison
CodingGuidelines: do not call the conditional statement "if()"
CodingGuidelines: give an example for shell function preamble
CodingGuidelines: give an example for control statements
CodingGuidelines: give an example for redirection
CodingGuidelines: give an example for case/esac statement
CodingGuidelines: once it is in, it is not worth the code churn

Merge branch 'nd/status-auto-comment-char'Junio C Hamano Fri, 6 Jun 2014 18:36:10 +0000 (11:36 -0700)

Merge branch 'nd/status-auto-comment-char'

* nd/status-auto-comment-char:
commit: allow core.commentChar=auto for character auto selection
config: be strict on core.commentChar

Merge branch 'mt/rebase-i-keep-empty-test'Junio C Hamano Fri, 6 Jun 2014 18:36:06 +0000 (11:36 -0700)

Merge branch 'mt/rebase-i-keep-empty-test'

* mt/rebase-i-keep-empty-test:
rebase --keep-empty -i: add test

Merge branch 'mk/show-s-no-extra-blank-line-for-merges'Junio C Hamano Fri, 6 Jun 2014 18:35:01 +0000 (11:35 -0700)

Merge branch 'mk/show-s-no-extra-blank-line-for-merges'

* mk/show-s-no-extra-blank-line-for-merges:
git-show: fix 'git show -s' to not add extra terminator after merge commit

Merge branch 'sk/spawn-less-case-insensitively-from... Junio C Hamano Fri, 6 Jun 2014 18:32:49 +0000 (11:32 -0700)

Merge branch 'sk/spawn-less-case-insensitively-from-grep-O-i'

* sk/spawn-less-case-insensitively-from-grep-O-i:
git grep -O -i: if the pager is 'less', pass the '-I' option

Merge branch 'jd/subtree'Junio C Hamano Fri, 6 Jun 2014 18:32:21 +0000 (11:32 -0700)

Merge branch 'jd/subtree'

* jd/subtree:
contrib/subtree: allow adding an annotated tag
contrib/subtree/Makefile: clean up rule for "clean"
contrib/subtree/Makefile: clean up rules to generate documentation
contrib/subtree/Makefile: s/libexecdir/gitexecdir/
contrib/subtree/Makefile: use GIT-VERSION-FILE
contrib/subtree/Makefile: scrap unused $(gitdir)

Merge branch 'wk/doc-clarify-upstream'Junio C Hamano Fri, 6 Jun 2014 18:32:13 +0000 (11:32 -0700)

Merge branch 'wk/doc-clarify-upstream'

* wk/doc-clarify-upstream:
Documentation: mention config sources for @{upstream}

Merge branch 'tb/unicode-6.3-zero-width'Junio C Hamano Fri, 6 Jun 2014 18:29:38 +0000 (11:29 -0700)

Merge branch 'tb/unicode-6.3-zero-width'

Update the logic to compute the display width needed for utf8
strings and allow us to more easily maintain the tables used in
that logic.

We may want to let the users choose if codepoints with ambiguous
widths are treated as a double or single width in a follow-up patch.

* tb/unicode-6.3-zero-width:
utf8: make it easier to auto-update git_wcwidth()
utf8.c: use a table for double_width

Merge branch 'jk/index-pack-report-missing'Junio C Hamano Fri, 6 Jun 2014 18:28:13 +0000 (11:28 -0700)

Merge branch 'jk/index-pack-report-missing'

* jk/index-pack-report-missing:
index-pack: distinguish missing objects from type errors

Merge branch 'bc/blame-crlf-test'Junio C Hamano Fri, 6 Jun 2014 18:26:50 +0000 (11:26 -0700)

Merge branch 'bc/blame-crlf-test'

If a file contained CRLF line endings in a repository with
core.autocrlf=input, then blame always marked lines as "Not
Committed Yet", even if they were unmodified.

* bc/blame-crlf-test:
blame: correctly handle files regardless of autocrlf

Merge branch 'sk/submodules-absolute-path-on-windows'Junio C Hamano Fri, 6 Jun 2014 18:26:38 +0000 (11:26 -0700)

Merge branch 'sk/submodules-absolute-path-on-windows'

* sk/submodules-absolute-path-on-windows:
Revert "submodules: fix ambiguous absolute paths under Windows"

Merge branch 'dk/blame-reorg'Junio C Hamano Fri, 6 Jun 2014 18:24:44 +0000 (11:24 -0700)

Merge branch 'dk/blame-reorg'

"git blame" has been optimized greatly by reorganising the data
structure that is used to keep track of the work to be done, thanks
to David Karstrup <dak@gnu.org>.

* dk/blame-reorg:
blame: large-scale performance rewrite

Merge branch 'wg/svn-fe-style-fixes'Junio C Hamano Fri, 6 Jun 2014 18:24:32 +0000 (11:24 -0700)

Merge branch 'wg/svn-fe-style-fixes'

* wg/svn-fe-style-fixes:
svn-fe: conform to pep8

Merge branch 'jn/contrib-remove-vim'Junio C Hamano Fri, 6 Jun 2014 18:24:30 +0000 (11:24 -0700)

Merge branch 'jn/contrib-remove-vim'

Spring cleaning of contrib/.

* jn/contrib-remove-vim:
contrib: remove vim support instructions

Merge branch 'jn/contrib-remove-diffall'Junio C Hamano Fri, 6 Jun 2014 18:23:46 +0000 (11:23 -0700)

Merge branch 'jn/contrib-remove-diffall'

Spring cleaning of contrib/.

* jn/contrib-remove-diffall:
contrib: remove git-diffall

Merge branch 'dt/merge-recursive-case-insensitive'Junio C Hamano Fri, 6 Jun 2014 18:23:13 +0000 (11:23 -0700)

Merge branch 'dt/merge-recursive-case-insensitive'

On a case insensitive filesystem, merge-recursive incorrectly
deleted the file that is to be renamed to a name that is the same
except for case differences.

* dt/merge-recursive-case-insensitive:
mv: allow renaming to fix case on case insensitive filesystems
merge-recursive.c: fix case-changing merge bug

Merge branch 'rs/reflog-exists'Junio C Hamano Fri, 6 Jun 2014 18:23:04 +0000 (11:23 -0700)

Merge branch 'rs/reflog-exists'

* rs/reflog-exists:
checkout.c: use ref_exists instead of file_exist
refs.c: add new functions reflog_exists and delete_reflog

Merge branch 'tg/tag-state-tag-name-in-editor-hints'Junio C Hamano Fri, 6 Jun 2014 18:22:24 +0000 (11:22 -0700)

Merge branch 'tg/tag-state-tag-name-in-editor-hints'

* tg/tag-state-tag-name-in-editor-hints:
builtin/tag.c: show tag name to hint in the message editor

Merge branch 'jk/grep-tell-run-command-to-cd-when-runni... Junio C Hamano Fri, 6 Jun 2014 18:21:49 +0000 (11:21 -0700)

Merge branch 'jk/grep-tell-run-command-to-cd-when-running-pager'

* jk/grep-tell-run-command-to-cd-when-running-pager:
grep: use run-command's "dir" option for --open-files-in-pager

Merge branch 'fc/status-printf-squelch-format-zero... Junio C Hamano Fri, 6 Jun 2014 18:21:47 +0000 (11:21 -0700)

Merge branch 'fc/status-printf-squelch-format-zero-length-warnings'

* fc/status-printf-squelch-format-zero-length-warnings:
silence a bunch of format-zero-length warnings

Merge branch 'jk/squelch-compiler-warning-from-funny... Junio C Hamano Fri, 6 Jun 2014 18:21:36 +0000 (11:21 -0700)

Merge branch 'jk/squelch-compiler-warning-from-funny-error-macro'

* jk/squelch-compiler-warning-from-funny-error-macro:
let clang use the constant-return error() macro
inline constant return from error() function

Merge branch 'dk/raise-core-deltabasecachelimit'Junio C Hamano Fri, 6 Jun 2014 18:18:34 +0000 (11:18 -0700)

Merge branch 'dk/raise-core-deltabasecachelimit'

The `core.deltabasecachelimit` used to default to 16 MiB , but this
proved to be too small, and has been bumped to 96 MiB.

* dk/raise-core-deltabasecachelimit:
Bump core.deltaBaseCacheLimit to 96m

Merge branch 'tl/relax-in-poll-emulation'Junio C Hamano Fri, 6 Jun 2014 18:18:29 +0000 (11:18 -0700)

Merge branch 'tl/relax-in-poll-emulation'

* tl/relax-in-poll-emulation:
compat/poll: sleep 1 millisecond to avoid busy wait