gitweb.git
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

gitk: Use mktemp -d to avoid predictable temporary... David Aguilar Fri, 13 Jun 2014 21:43:48 +0000 (14:43 -0700)

gitk: Use mktemp -d to avoid predictable temporary directories

gitk uses a predictable ".gitk-tmp.$PID" pattern when generating
a temporary directory.

Use "mktemp -d .gitk-tmp.XXXXXX" to harden gitk against someone
seeding /tmp with files matching the pid pattern.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>

gitk: Show staged submodules regardless of ignore configJens Lehmann Tue, 8 Apr 2014 19:36:08 +0000 (21:36 +0200)

gitk: Show staged submodules regardless of ignore config

Currently setting submodule.<name>.ignore and/or diff.ignoreSubmodules to
"all" suppresses all output of submodule changes for gitk. This is really
confusing, as even when the user chooses to record a new commit for an
ignored submodule by adding it manually this change won't show up under
"Local changes checked in to index but not committed".

Fix that by using the '--ignore-submodules=dirty' option for both callers
of "git diff-index --cached" when the underlying git version supports that
option.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>

gitk: Honor TMPDIR when viewing external diffsDavid Aguilar Fri, 13 Jun 2014 21:13:37 +0000 (14:13 -0700)

gitk: Honor TMPDIR when viewing external diffs

gitk fails to show diffs when browsing a read-only repository.
This is due to gitk's assumption that the current directory is always
writable.

Teach gitk to honor either the GITK_TMPDIR or TMPDIR environment
variables. This allows users to override the default location
used when writing temporary files.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>

gitk: Allow displaying time zones from author and commi... Anders Kaseorg Mon, 12 May 2014 11:25:58 +0000 (07:25 -0400)

gitk: Allow displaying time zones from author and commit dates timestamps

Now gitk can be configured to display author and commit dates in their
original timezone, by putting %z into datetimeformat in ~/.gitk.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Signed-off-by: Paul Mackerras <paulus@samba.org>

gitk: Switch to patch mode when searching for line... Max Kirillov Sat, 5 Apr 2014 20:38:50 +0000 (23:38 +0300)

gitk: Switch to patch mode when searching for line origin

If the "Show origin of this line" is started from tree mode,
it still shows the result in tree mode, which I suppose not
what user expects to see.

Signed-off-by: Paul Mackerras <paulus@samba.org>

gitk: Replace SHA1 entry field on keyboard pasteIlya Bobyr Thu, 20 Mar 2014 08:58:51 +0000 (01:58 -0700)

gitk: Replace SHA1 entry field on keyboard paste

We already replace old SHA with the clipboard content for the mouse
paste event. It seems reasonable to do the same when pasting from
keyboard.

Signed-off-by: Ilya Bobyr <ilya.bobyr@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>

submodule: document "sync --recursive"Matthew Chen Fri, 13 Jun 2014 17:40:50 +0000 (13:40 -0400)

submodule: document "sync --recursive"

The "git submodule sync" command supports the --recursive flag, but
the documentation does not mention this. That flag is useful, for
example when a remote is changed in a submodule of a submodule.

Signed-off-by: Matthew Chen <charlesmchen@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

blame: simplify prepare_lines()René Scharfe Fri, 13 Jun 2014 19:54:59 +0000 (21:54 +0200)

blame: simplify prepare_lines()

Changing get_next_line() to return the end pointer instead of NULL in
case no newline character is found treats allows us to treat complete
and incomplete lines the same, simplifying the code. Switching to
counting lines instead of EOLs allows us to start counting at the
first character, instead of having to call get_next_line() first.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

blame: factor out get_next_line()René Scharfe Fri, 13 Jun 2014 19:53:03 +0000 (21:53 +0200)

blame: factor out get_next_line()

Move the code for finding the start of the next line into a helper
function in order to reduce duplication.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

completion: handle '!f() { ... }; f' and "!sh -c '... Steffen Prohaska Thu, 12 Jun 2014 18:49:29 +0000 (20:49 +0200)

completion: handle '!f() { ... }; f' and "!sh -c '...' -" aliases

'!f() { ... }; f' and "!sh -c '....' -" are recommended patterns for
declaring more complex aliases (see git wiki [1]). This commit teaches
the completion to handle them.

When determining which completion to use for an alias, an opening brace
or single quote is now skipped, and the search for a git command is
continued. For example, the aliases '!f() { git commit ... }' or "!sh
-c 'git commit ...'" now trigger commit completion. Previously, the
search stopped on the opening brace or quote, and the completion tried
it to determine how to complete, which obviously was useless.

The null command ':' is now skipped, so that it can be used as
a workaround to declare the desired completion style.

For example, the aliases

!f() { : git commit ; if ... } f
!sh -c ': git commit; if ...' -

now trigger commit completion.

Shell function declarations now work with or without space before
the parens, i.e. '!f() ...' and '!f () ...' both work.

[1] https://git.wiki.kernel.org/index.php/Aliases

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t0008: do not depend on 'echo' handling backslashes... Junio C Hamano Fri, 13 Jun 2014 20:23:58 +0000 (13:23 -0700)

t0008: do not depend on 'echo' handling backslashes specially

The original used to pass with /bin/dash but not with /bin/bash set
to $SHELL_PATH. The former turns "\\" into "\", but the latter does
not.

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

reuse cached commit buffer when parsing signaturesJeff King Fri, 13 Jun 2014 06:32:11 +0000 (02:32 -0400)

reuse cached commit buffer when parsing signatures

When we call show_signature or show_mergetag, we read the
commit object fresh via read_sha1_file and reparse its
headers. However, in most cases we already have the object
data available, attached to the "struct commit". This is
partially laziness in dealing with the memory allocation
issues, but partially defensive programming, in that we
would always want to verify a clean version of the buffer
(not one that might have been munged by other users of the
commit).

However, we do not currently ever munge the commit buffer,
and not using the already-available buffer carries a fairly
big performance penalty when we are looking at a large
number of commits. Here are timings on linux.git:

[baseline, no signatures]
$ time git log >/dev/null
real 0m4.902s
user 0m4.784s
sys 0m0.120s

[before]
$ time git log --show-signature >/dev/null
real 0m14.735s
user 0m9.964s
sys 0m0.944s

[after]
$ time git log --show-signature >/dev/null
real 0m9.981s
user 0m5.260s
sys 0m0.936s

Note that our user CPU time drops almost in half, close to
the non-signature case, but we do still spend more
wall-clock and system time, presumably from dealing with
gpg.

An alternative to this is to note that most commits do not
have signatures (less than 1% in this repo), yet we pay the
re-parsing cost for every commit just to find out if it has
a mergetag or signature. If we checked that when parsing the
commit initially, we could avoid re-examining most commits
later on. Even if we did pursue that direction, however,
this would still speed up the cases where we _do_ have
signatures. So it's probably worth doing either way.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

commit: record buffer length in cacheJeff King Tue, 10 Jun 2014 21:44:13 +0000 (17:44 -0400)

commit: record buffer length in cache

Most callsites which use the commit buffer try to use the
cached version attached to the commit, rather than
re-reading from disk. Unfortunately, that interface provides
only a pointer to the NUL-terminated buffer, with no
indication of the original length.

For the most part, this doesn't matter. People do not put
NULs in their commit messages, and the log code is happy to
treat it all as a NUL-terminated string. However, some code
paths do care. For example, when checking signatures, we
want to be very careful that we verify all the bytes to
avoid malicious trickery.

This patch just adds an optional "size" out-pointer to
get_commit_buffer and friends. The existing callers all pass
NULL (there did not seem to be any obvious sites where we
could avoid an immediate strlen() call, though perhaps with
some further refactoring we could).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

commit: convert commit->buffer to a slabJeff King Tue, 10 Jun 2014 21:43:02 +0000 (17:43 -0400)

commit: convert commit->buffer to a slab

This will make it easier to manage the buffer cache
independently of the "struct commit" objects. It also
shrinks "struct commit" by one pointer, which may be
helpful.

Unfortunately it does not reduce the max memory size of
something like "rev-list", because rev-list uses
get_cached_commit_buffer() to decide not to show each
commit's output (and due to the design of slab_at, accessing
the slab requires us to extend it, allocating exactly the
same number of buffer pointers we dropped from the commit
structs).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

commit-slab: provide a static initializerJeff King Tue, 10 Jun 2014 21:42:51 +0000 (17:42 -0400)

commit-slab: provide a static initializer

Callers currently must use init_foo_slab() at runtime before
accessing a slab. For global slabs, it's much nicer if we
can initialize them in BSS, so that each user does not have
to add code to check-and-initialize.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

use get_commit_buffer everywhereJeff King Tue, 10 Jun 2014 21:41:51 +0000 (17:41 -0400)

use get_commit_buffer everywhere

Each of these sites assumes that commit->buffer is valid.
Since they would segfault if this was not the case, they are
likely to be correct in practice. However, we can
future-proof them by using get_commit_buffer.

And as a side effect, we abstract away the final bare uses
of commit->buffer.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

convert logmsg_reencode to get_commit_bufferJeff King Tue, 10 Jun 2014 21:41:39 +0000 (17:41 -0400)

convert logmsg_reencode to get_commit_buffer

Like the callsites in the previous commit, logmsg_reencode
already falls back to read_sha1_file when necessary.
However, I split its conversion out into its own commit
because it's a bit more complex.

We return either:

1. The original commit->buffer

2. A newly allocated buffer from read_sha1_file

3. A reencoded buffer (based on either 1 or 2 above).

while trying to do as few extra reads/allocations as
possible. Callers currently free the result with
logmsg_free, but we can simplify this by pointing them
straight to unuse_commit_buffer. This is a slight layering
violation, in that we may be passing a buffer from (3).
However, since the end result is to free() anything except
(1), which is unlikely to change, and because this makes the
interface much simpler, it's a reasonable bending of the
rules.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

use get_commit_buffer to avoid duplicate codeJeff King Tue, 10 Jun 2014 21:41:02 +0000 (17:41 -0400)

use get_commit_buffer to avoid duplicate code

For both of these sites, we already do the "fallback to
read_sha1_file" trick. But we can shorten the code by just
using get_commit_buffer.

Note that the error cases are slightly different when
read_sha1_file fails. get_commit_buffer will die() if the
object cannot be loaded, or is a non-commit.

For get_sha1_oneline, this will almost certainly never
happen, as we will have just called parse_object (and if it
does, it's probably worth complaining about).

For record_author_date, the new behavior is probably better;
we notify the user of the error instead of silently ignoring
it. And because it's used only for sorting by author-date,
somebody examining a corrupt repo can fallback to the
regular traversal order.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

use get_cached_commit_buffer where appropriateJeff King Tue, 10 Jun 2014 21:40:46 +0000 (17:40 -0400)

use get_cached_commit_buffer where appropriate

Some call sites check commit->buffer to see whether we have
a cached buffer, and if so, do some work with it. In the
long run we may want to switch these code paths to make
their decision on a different boolean flag (because checking
the cache may get a little more expensive in the future).
But for now, we can easily support them by converting the
calls to use get_cached_commit_buffer.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

provide helpers to access the commit bufferJeff King Tue, 10 Jun 2014 21:40:39 +0000 (17:40 -0400)

provide helpers to access the commit buffer

Many sites look at commit->buffer to get more detailed
information than what is in the parsed commit struct.
However, we sometimes drop commit->buffer to save memory,
in which case the caller would need to read the object
afresh. Some callers do this (leading to duplicated code),
and others do not (which opens the possibility of a segfault
if somebody else frees the buffer).

Let's provide a pair of helpers, "get" and "unuse", that let
callers easily get the buffer. They will use the cached
buffer when possible, and otherwise load from disk using
read_sha1_file.

Note that we also need to add a "get_cached" variant which
returns NULL when we do not have a cached buffer. At first
glance this seems to defeat the purpose of "get", which is
to always provide a return value. However, some log code
paths actually use the NULL-ness of commit->buffer as a
boolean flag to decide whether to try printing the
commit. At least for now, we want to continue supporting
that use.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

provide a helper to set the commit bufferJeff King Tue, 10 Jun 2014 21:40:14 +0000 (17:40 -0400)

provide a helper to set the commit buffer

Right now this is just a one-liner, but abstracting it will
make it easier to change later.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

provide a helper to free commit bufferJeff King Thu, 12 Jun 2014 22:05:37 +0000 (18:05 -0400)

provide a helper to free commit buffer

This converts two lines into one at each caller. But more
importantly, it abstracts the concept of freeing the buffer,
which will make it easier to change later.

Note that we also need to provide a "detach" mechanism for a
tricky case in index-pack. We are passed a buffer for the
object generated by processing the incoming pack. If we are
not using --strict, we just calculate the sha1 on that
buffer and return, leaving the caller to free it. But if we
are using --strict, we actually attach that buffer to an
object, pass the object to the fsck functions, and then
detach the buffer from the object again (so that the caller
can free it as usual). In this case, we don't want to free
the buffer ourselves, but just make sure it is no longer
associated with the commit.

Note that we are making the assumption here that the
attach/detach process does not impact the buffer at all
(e.g., it is never reallocated or modified). That holds true
now, and we have no plans to change that. However, as we
abstract the commit_buffer code, this dependency becomes
less obvious. So when we detach, let's also make sure that
we get back the same buffer that we gave to the
commit_buffer code.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: fix submit in non --prepare-p4-only modeMaxime Coste Wed, 11 Jun 2014 13:09:59 +0000 (14:09 +0100)

git-p4: fix submit in non --prepare-p4-only mode

b4073bb3 (git-p4: Do not include diff in spec file when just
preparing p4, 2014-05-24) broke git p4 submit, here is a proper
fix, including proper handling for windows end of lines.

Signed-off-by: Maxime Coste <frrrwww@gmail.com>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-gui: tolerate major version changes when comparing... Jens Lehmann Sat, 17 May 2014 19:49:05 +0000 (21:49 +0200)

git-gui: tolerate major version changes when comparing the git version

Since git 2.0.0 starting git gui in a submodule using a gitfile fails with
the following error:

No working directory ../../../<path>

couldn't change working directory
to "../../../<path>": no such file or
directory

This is because "git rev-parse --show-toplevel" is only run when git gui
sees a git version of at least 1.7.0 (which is the version in which the
--show-toplevel option was introduced). But "package vsatisfies" returns
false when the major version changes, which is not what we want here.

Fix that for both places where the git version is checked using vsatisfies
by appending a '-' to the version number. This tells vsatisfies that a
change of the major version is not considered to be a problem, as long as
the new major version is larger. This is done for both the place that
caused the reported bug and another spot where the git version is tested
for another feature.

Reported-by: Chris Packham <judge.packham@gmail.com>
Reported-by: Yann Dirson <ydirson@free.fr>
Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>

git-gui: show staged submodules regardless of ignore... Jens Lehmann Tue, 8 Apr 2014 19:30:51 +0000 (21:30 +0200)

git-gui: show staged submodules regardless of ignore config

Currently setting submodule.<name>.ignore and/or diff.ignoreSubmodules to
"all" suppresses all output of submodule changes for git-gui. This is
really confusing, as even when the user chooses to record a new commit for
an ignored submodule by adding it manually this change won't show up under
"Staged Changes (Will Commit)".

Fix that by using the '--ignore-submodules=dirty' option for both callers
of "git diff-index --cached" when the underlying git version supports that
option.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>

t7700: drop explicit --no-pack-kept-objects from .keep... Jeff King Wed, 11 Jun 2014 06:32:45 +0000 (02:32 -0400)

t7700: drop explicit --no-pack-kept-objects from .keep test

We want to make sure that the default behavior of git-repack,
without any options, continues to treat .keep files as it
always has. Adding an explicit --no-pack-kept-objects, as
ee34a2b did, is a much less interesting test, and prevented
us from noticing the bug fixed by 64d3dc9 (repack: do not
accidentally pack kept objects by default, 2014-06-10).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

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>

sequencer: use logmsg_reencode in get_messageJeff King Tue, 10 Jun 2014 21:39:35 +0000 (17:39 -0400)

sequencer: use logmsg_reencode in get_message

This simplifies the code, as logmsg_reencode handles the
reencoding for us in a single call. It also means we learn
logmsg_reencode's trick of pulling the buffer from disk when
commit->buffer is NULL (we currently just silently return!).
It is doubtful this matters in practice, though, as
sequencer operations would not generally turn off
save_commit_buffer.

Note that we may be fixing a bug here. The existing code
does:

if (same_encoding(to, from))
reencode_string(buf, to, from);

That probably should have been "!same_encoding".

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

logmsg_reencode: return const bufferJeff King Tue, 10 Jun 2014 21:39:30 +0000 (17:39 -0400)

logmsg_reencode: return const buffer

The return value from logmsg_reencode may be either a newly
allocated buffer or a pointer to the existing commit->buffer.
We would not want the caller to accidentally free() or
modify the latter, so let's mark it as const. We can cast
away the constness in logmsg_free, but only once we have
determined that it is a free-able buffer.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

do not create "struct commit" with xcallocJeff King Tue, 10 Jun 2014 21:39:11 +0000 (17:39 -0400)

do not create "struct commit" with xcalloc

In both blame and merge-recursive, we sometimes create a
"fake" commit struct for convenience (e.g., to represent the
HEAD state as if we would commit it). By allocating
ourselves rather than using alloc_commit_node, we do not
properly set the "index" field of the commit. This can
produce subtle bugs if we then use commit-slab on the
resulting commit, as we will share the "0" index with
another commit.

We can fix this by using alloc_commit_node() to allocate.
Note that we cannot free the result, as it is part of our
commit allocator. However, both cases were already leaking
the allocated commit anyway, so there's nothing to fix up.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

commit: push commit_index update into alloc_commit_nodeJeff King Tue, 10 Jun 2014 21:39:04 +0000 (17:39 -0400)

commit: push commit_index update into alloc_commit_node

Whenever we create a commit object via lookup_commit, we
give it a unique index to be used with the commit-slab API.
The theory is that any "struct commit" we create would
follow this code path, so any such struct would get an
index. However, callers could use alloc_commit_node()
directly (and get multiple commits with index 0).

Let's push the indexing into alloc_commit_node so that it's
hard for callers to get it wrong.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

alloc: include any-object allocations in alloc_reportJeff King Tue, 10 Jun 2014 21:38:47 +0000 (17:38 -0400)

alloc: include any-object allocations in alloc_report

When 2c1cbec (Use proper object allocators for unknown
object nodes too, 2007-04-16), added a special "any_object"
allocator, it never taught alloc_report to report on it. To
do so we need to add an extra type argument to the REPORT
macro, as that commit did for DEFINE_ALLOCATOR.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

replace dangerous uses of strbuf_attachJeff King Tue, 10 Jun 2014 21:38:38 +0000 (17:38 -0400)

replace dangerous uses of strbuf_attach

It is not a good idea to strbuf_attach an arbitrary pointer
just because a function you are calling wants a strbuf.
Attaching implies a transfer of memory ownership; if anyone
were to modify or release the resulting strbuf, we would
free() the pointer, leading to possible problems:

1. Other users of the original pointer might access freed
memory.

2. The pointer might not be the start of a malloc'd
area, so calling free() on it in the first place would
be wrong.

In the two cases modified here, we are fortunate that nobody
touches the strbuf once it is attached, but it is an
accident waiting to happen. Since the previous commit,
commit_tree and friends take a pointer/buf pair, so we can
just do away with the strbufs entirely.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

commit_tree: take a pointer/len pair rather than a... Jeff King Tue, 10 Jun 2014 21:36:52 +0000 (17:36 -0400)

commit_tree: take a pointer/len pair rather than a const strbuf

While strbufs are pretty common throughout our code, it is
more flexible for functions to take a pointer/len pair than
a strbuf. It's easy to turn a strbuf into such a pair (by
dereferencing its members), but less easy to go the other
way (you can strbuf_attach, but that has implications about
memory ownership).

This patch teaches commit_tree (and its associated callers
and sub-functions) to take such a pair for the commit
message rather than a strbuf. This makes passing the buffer
around slightly more verbose, but means we can get rid of
some dangerous strbuf_attach calls in the next patch.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

docs: Explain the purpose of fetch's and pull's <refspe... Marc Branchaud Wed, 11 Jun 2014 14:24:04 +0000 (10:24 -0400)

docs: Explain the purpose of fetch's and pull's <refspec> parameter.

Signed-off-by: Marc Branchaud <marcnarc@xiplink.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

repack: introduce repack.writeBitmaps config optionJeff King Tue, 10 Jun 2014 20:20:30 +0000 (16:20 -0400)

repack: introduce repack.writeBitmaps config option

We currently have pack.writeBitmaps, which originally
operated at the pack-objects level. This should really have
been a repack.* option from day one. Let's give it the more
sensible name, but keep the old version as a deprecated
synonym.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

repack: simplify handling of --write-bitmap-indexJeff King Tue, 10 Jun 2014 20:19:38 +0000 (16:19 -0400)

repack: simplify handling of --write-bitmap-index

We previously needed to pass --no-write-bitmap-index
explicitly to pack-objects to override its reading of
pack.writebitmaps from the config. Now that it no longer
does so, we can assume that bitmaps are off by default, and
only turn them on when necessary. This also lets us avoid a
confusing tri-state flag for write_bitmaps.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pack-objects: stop respecting pack.writebitmapsJeff King Tue, 10 Jun 2014 20:19:13 +0000 (16:19 -0400)

pack-objects: stop respecting pack.writebitmaps

The handling of the pack.writebitmaps config option
originally happened in pack-objects, which is quite
low-level. It would make more sense for drivers of
pack-objects to read the config, and then manipulate
pack-objects with command-line options.

Recently, repack learned to do so, making the low-level read
of pack.writebitmaps redundant here. Other callers, like
upload-pack, would not generally want to write bitmaps
anyway.

This could be considered a regression for somebody who is
driving pack-objects themselves outside of repack and
expects the config option to be used. However, such users
seem rather unlikely given how new the bitmap code is (and
the fact that they would basically be reimplementing repack
in the first place).

Note that we do not do anything with pack.writeBitmapHashCache
here. That option is not about "do we write bimaps", but
rather "when we are writing bitmaps, how do we do it?". You
would want that to kick in anytime you decide to write them,
similar to how pack.indexVersion is used.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

repack: s/write_bitmap/&s/ in codeJeff King Tue, 10 Jun 2014 20:10:07 +0000 (16:10 -0400)

repack: s/write_bitmap/&s/ in code

The config name is "writeBitmaps", so the internal variable
missing the plural is unnecessarily confusing to write.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

repack: respect pack.writebitmapsJeff King Tue, 10 Jun 2014 20:09:23 +0000 (16:09 -0400)

repack: respect pack.writebitmaps

The config option to turn on bitmaps is read all the way
down in the plumbing of pack-objects. This makes it hard for
other options in the porcelain of repack to make decisions
based on the bitmap setting. For example,
repack.packKeptObjects tries to kick in by default only when
bitmaps are turned on. But it can't do so reliably because
it doesn't yet know whether we are using bitmaps.

This patch teaches repack to respect pack.writebitmaps. It
means we pass a redundant command-line flag to pack-objects,
but that's OK; it shouldn't affect the outcome.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

repack: do not accidentally pack kept objects by defaultJeff King Tue, 10 Jun 2014 20:08:38 +0000 (16:08 -0400)

repack: do not accidentally pack kept objects by default

Commit ee34a2b (repack: add `repack.packKeptObjects` config
var, 2014-03-03) added a flag which could duplicate kept
objects, but did not mean to turn it on by default. Instead,
the option is tied by default to the decision to write
bitmaps, like:

if (pack_kept_objects < 0)
pack_kept_objects = write_bitmap;

after which we expect pack_kept_objects to be a boolean 0 or
1. However, that assignment neglects that write_bitmap is
_also_ a tri-state with "-1" as the default, and with
neither option given, we accidentally turn the option on.

This patch is the minimal fix to restore the desired
behavior for the default state. Further patches will fix the
more complicated cases.

Note the update to t7700. It failed to turn on bitmaps,
meaning we were actually confirming the wrong behavior!

Signed-off-by: Jeff King <peff@peff.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>

git potty: restore environments after alias expansionNguyễn Thái Ngọc Duy Sun, 8 Jun 2014 09:37:10 +0000 (16:37 +0700)

git potty: restore environments after alias expansion

Commit 4ad8332 (t0001: test git init when run via an alias -
2010-11-26) noted breakages when running init via alias. The problem
is for alias to be used, $GIT_DIR must be searched, but 'init' and
'clone' are not happy with that. So we start a new process like an
external command, with clean environment in this case. Env variables
that are set by command line (e.g. "git --git-dir=.. ") are kept.

This should also fix autocorrecting a command typo to "init" because
it's the same problem: aliases are read, then "init" is unhappy with
$GIT_DIR already set up because of that.

Reminded-by: David Turner <dturner@twopensource.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t9001: avoid non-portable '\n' with sedTorsten Bögershausen Tue, 10 Jun 2014 04:07:59 +0000 (06:07 +0200)

t9001: avoid non-portable '\n' with sed

t9001 used a '\n' in a sed expression to split one line into two
lines, but the usage of '\n' in the "replacement string" is not
portable.

The '\n' can be used to match a newline in the "pattern space",
but otherwise the meaning of '\n' is unspecified in POSIX.

- Gnu versions of sed will treat '\n' as a newline character.
- Other versions of sed (like /usr/bin/sed under Mac OS X)
simply ignore the '\' before the 'n', treating '\n' as 'n'.

For reference see:
pubs.opengroup.org/onlinepubs/9699919799/utilities/sed.html
http://www.gnu.org/software/sed/manual/sed.html

As the test already requires perl as a prerequisite, use perl
instead of sed.

Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t/test-lib-functions.sh: avoid "test <cond> -a/-o ... Elia Pinto Fri, 6 Jun 2014 14:56:02 +0000 (07:56 -0700)

t/test-lib-functions.sh: avoid "test <cond> -a/-o <cond>"

The construct is error-prone; "test" being built-in in most modern
shells, the reason to avoid "test <cond> && test <cond>" spawning
one extra process by using a single "test <cond> -a <cond>" no
longer exists.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t/t9814-git-p4-rename.sh: avoid "test <cond> -a/-o... Elia Pinto Fri, 6 Jun 2014 14:56:01 +0000 (07:56 -0700)

t/t9814-git-p4-rename.sh: avoid "test <cond> -a/-o <cond>"

The construct is error-prone; "test" being built-in in most modern
shells, the reason to avoid "test <cond> && test <cond>" spawning
one extra process by using a single "test <cond> -a <cond>" no
longer exists.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t/t5538-push-shallow.sh: avoid "test <cond> -a/-o ... Elia Pinto Fri, 6 Jun 2014 14:56:00 +0000 (07:56 -0700)

t/t5538-push-shallow.sh: avoid "test <cond> -a/-o <cond>"

The construct is error-prone; "test" being built-in in most modern
shells, the reason to avoid "test <cond> && test <cond>" spawning
one extra process by using a single "test <cond> -a <cond>" no
longer exists.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t/t5403-post-checkout-hook.sh: avoid "test <cond> ... Elia Pinto Fri, 6 Jun 2014 14:55:59 +0000 (07:55 -0700)

t/t5403-post-checkout-hook.sh: avoid "test <cond> -a/-o <cond>"

The construct is error-prone; "test" being built-in in most modern
shells, the reason to avoid "test <cond> && test <cond>" spawning
one extra process by using a single "test <cond> -a <cond>" no
longer exists.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t/t5000-tar-tree.sh: avoid "test <cond> -a/-o <cond>"Elia Pinto Fri, 6 Jun 2014 14:55:58 +0000 (07:55 -0700)

t/t5000-tar-tree.sh: avoid "test <cond> -a/-o <cond>"

The construct is error-prone; "test" being built-in in most modern
shells, the reason to avoid "test <cond> && test <cond>" spawning
one extra process by using a single "test <cond> -a <cond>" no
longer exists.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t/t4102-apply-rename.sh: avoid "test <cond> -a/-o ... Elia Pinto Fri, 6 Jun 2014 14:55:57 +0000 (07:55 -0700)

t/t4102-apply-rename.sh: avoid "test <cond> -a/-o <cond>"

The construct is error-prone; "test" being built-in in most modern
shells, the reason to avoid "test <cond> && test <cond>" spawning
one extra process by using a single "test <cond> -a <cond>" no
longer exists.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t/t0026-eol-config.sh: avoid "test <cond> -a/-o <cond>"Elia Pinto Fri, 6 Jun 2014 14:55:56 +0000 (07:55 -0700)

t/t0026-eol-config.sh: avoid "test <cond> -a/-o <cond>"

The construct is error-prone; "test" being built-in in most modern
shells, the reason to avoid "test <cond> && test <cond>" spawning
one extra process by using a single "test <cond> -a <cond>" no
longer exists.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t/t0025-crlf-auto.sh: avoid "test <cond> -a/-o <cond>"Elia Pinto Fri, 6 Jun 2014 14:55:55 +0000 (07:55 -0700)

t/t0025-crlf-auto.sh: avoid "test <cond> -a/-o <cond>"

The construct is error-prone; "test" being built-in in most modern
shells, the reason to avoid "test <cond> && test <cond>" spawning
one extra process by using a single "test <cond> -a <cond>" no
longer exists.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t/lib-httpd.sh: avoid "test <cond> -a/-o <cond>"Elia Pinto Fri, 6 Jun 2014 14:55:54 +0000 (07:55 -0700)

t/lib-httpd.sh: avoid "test <cond> -a/-o <cond>"

The construct is error-prone; "test" being built-in in most modern
shells, the reason to avoid "test <cond> && test <cond>" spawning
one extra process by using a single "test <cond> -a <cond>" no
longer exists.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sequencer: signal failed ff as an aborted, not a confli... Fabian Ruch Mon, 9 Jun 2014 15:04:36 +0000 (17:04 +0200)

sequencer: signal failed ff as an aborted, not a conflicted merge

`do_pick_commit` handles three situations if it is not fast-forwarding.
In order for `do_pick_commit` to identify the situation, it examines the
return value of the selected merge command.

1. return value 0 stands for a clean merge
2. 1 is passed in case of a failed merge due to conflict
3. any other return value means that the merge did not even start

So far, the sequencer returns 1 in case of a failed fast-forward, which
would mean "failed merge due to conflict". However, a fast-forward
either starts and succeeds or does not start at all. In particular, it
cannot fail in between like a merge with a dirty index due to conflicts.

In order to signal the three possible situations (not only success and
failure to complete) after a pick through porcelain commands such as
`cherry-pick`, exit with a return value that is neither 0 nor 1. 128 was
chosen in line with the other situations in which the sequencer
encounters an error. In such situations, the sequencer returns a
negative value and `cherry-pick` translates this into a call to `die`.
`die` then terminates the process with exit status 128.

Signed-off-by: Fabian Ruch <bafain@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

api-strbuf.txt minor typosJeremiah Mahler Mon, 9 Jun 2014 03:32:03 +0000 (20:32 -0700)

api-strbuf.txt minor typos

Fixed some minor typos in api-strbuf.txt: 'A' instead of 'An', 'have'
instead of 'has', a overlong line, and 'another' instead of 'an other'.

Signed-off-by: Jeremiah Mahler <jmmahler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

revision: parse "git log -<count>" more carefullyJunio C Hamano Fri, 6 Jun 2014 22:33:25 +0000 (15:33 -0700)

revision: parse "git log -<count>" more carefully

This mistyped command line simply ignores "master" and ends up
showing two commits from the current HEAD:

$ git log -2master

because we feed "2master" to atoi() without making sure that the
whole string is parsed as an integer.

Use the strtol_i() helper function instead.

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

git-rebase--interactive.sh: avoid "test <cond> -a/... Elia Pinto Fri, 6 Jun 2014 14:55:52 +0000 (07:55 -0700)

git-rebase--interactive.sh: avoid "test <cond> -a/-o <cond>"

The construct is error-prone; "test" being built-in in most modern
shells, the reason to avoid "test <cond> && test <cond>" spawning
one extra process by using a single "test <cond> -a <cond>" no
longer exists.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-mergetool.sh: avoid "test <cond> -a/-o <cond>"Elia Pinto Fri, 6 Jun 2014 14:55:51 +0000 (07:55 -0700)

git-mergetool.sh: avoid "test <cond> -a/-o <cond>"

The construct is error-prone; "test" being built-in in most modern
shells, the reason to avoid "test <cond> && test <cond>" spawning
one extra process by using a single "test <cond> -a <cond>" no
longer exists.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-bisect.sh: avoid "test <cond> -a/-o <cond>"Elia Pinto Fri, 6 Jun 2014 14:55:50 +0000 (07:55 -0700)

git-bisect.sh: avoid "test <cond> -a/-o <cond>"

The construct is error-prone; "test" being built-in in most modern
shells, the reason to avoid "test <cond> && test <cond>" spawning
one extra process by using a single "test <cond> -a <cond>" no
longer exists.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

contrib/examples/git-resolve.sh: avoid "test <cond... Elia Pinto Fri, 6 Jun 2014 14:55:49 +0000 (07:55 -0700)

contrib/examples/git-resolve.sh: avoid "test <cond> -a/-o <cond>"

The construct is error-prone; "test" being built-in in most modern
shells, the reason to avoid "test <cond> && test <cond>" spawning
one extra process by using a single "test <cond> -a <cond>" no
longer exists.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

contrib/examples/git-repack.sh: avoid "test <cond>... Elia Pinto Fri, 6 Jun 2014 14:55:48 +0000 (07:55 -0700)

contrib/examples/git-repack.sh: avoid "test <cond> -a/-o <cond>"

The construct is error-prone; "test" being built-in in most modern
shells, the reason to avoid "test <cond> && test <cond>" spawning
one extra process by using a single "test <cond> -a <cond>" no
longer exists.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

contrib/examples/git-merge.sh: avoid "test <cond> ... Elia Pinto Fri, 6 Jun 2014 14:55:47 +0000 (07:55 -0700)

contrib/examples/git-merge.sh: avoid "test <cond> -a/-o <cond>"

The construct is error-prone; "test" being built-in in most modern
shells, the reason to avoid "test <cond> && test <cond>" spawning
one extra process by using a single "test <cond> -a <cond>" no
longer exists.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

contrib/examples/git-commit.sh: avoid "test <cond>... Elia Pinto Fri, 6 Jun 2014 14:55:46 +0000 (07:55 -0700)

contrib/examples/git-commit.sh: avoid "test <cond> -a/-o <cond>"

The construct is error-prone; "test" being built-in in most modern
shells, the reason to avoid "test <cond> && test <cond>" spawning
one extra process by using a single "test <cond> -a <cond>" no
longer exists.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

contrib/examples/git-clone.sh: avoid "test <cond> ... Elia Pinto Fri, 6 Jun 2014 14:55:45 +0000 (07:55 -0700)

contrib/examples/git-clone.sh: avoid "test <cond> -a/-o <cond>"

The construct is error-prone; "test" being built-in in most modern
shells, the reason to avoid "test <cond> && test <cond>" spawning
one extra process by using a single "test <cond> -a <cond>" no
longer exists.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

check_bindir: avoid "test <cond> -a/-o <cond>"Elia Pinto Fri, 6 Jun 2014 14:55:44 +0000 (07:55 -0700)

check_bindir: avoid "test <cond> -a/-o <cond>"

The construct is error-prone; "test" being built-in in most modern
shells, the reason to avoid "test <cond> && test <cond>" spawning
one extra process by using a single "test <cond> -a <cond>" no
longer exists.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Use starts_with() for C strings instead of memcmp()René Scharfe Fri, 6 Jun 2014 17:24:48 +0000 (19:24 +0200)

Use starts_with() for C strings instead of memcmp()

Convert three cases of checking for a constant prefix using memcmp() to
starts_with(). This way there is no need for magic string length
constants and we avoid running over the end of the string should it be
shorter than the prefix.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t3419: drop unnecessary NOT_EXPENSIVE pseudo-prerequisiteJunio C Hamano Mon, 9 Jun 2014 21:03:10 +0000 (14:03 -0700)

t3419: drop unnecessary NOT_EXPENSIVE pseudo-prerequisite

This was only necessary because do_tests helper the script defines
took its parameters in a wrong order. Just pass an empty string (or
not passing the optional EXPENSIVE prerequisite) when running the
test with a light-weight set of parameters and have the shell do the
right thing when parsing test_expect_success helper.

Also update coding style while we are at it.

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

t3302: drop unnecessary NOT_EXPENSIVE pseudo-prerequisiteJunio C Hamano Mon, 9 Jun 2014 20:43:19 +0000 (13:43 -0700)

t3302: drop unnecessary NOT_EXPENSIVE pseudo-prerequisite

This was only necessary because do_tests helper the script defines
took its parameters in a wrong order. Just pass an empty string (or
not passing the optional EXPENSIVE prerequisite) when running the
test with a light-weight set of parameters and have the shell do the
right thing when parsing test_expect_success helper.

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

t3302: do not chdir around in the primary test processJunio C Hamano Mon, 9 Jun 2014 20:36:54 +0000 (13:36 -0700)

t3302: do not chdir around in the primary test process

These days^Wyears we strive to do stuff in subdirectories inside
subshells to avoid mistakes.

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

t3302: coding style updatesJunio C Hamano Mon, 9 Jun 2014 20:21:59 +0000 (13:21 -0700)

t3302: coding style updates

Use "<<-END_OF_HERE_TEXT" to push the contents of here-text to the
right in order to show the loop structure better.

Use write_script when writing a script to be run.

Use "test" (not "[ ... ]") and avoid unnecessary ";" in the middle
of a line.

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

test: turn USR_BIN_TIME into a lazy prerequisiteJunio C Hamano Mon, 9 Jun 2014 20:54:25 +0000 (13:54 -0700)

test: turn USR_BIN_TIME into a lazy prerequisite

Two test scripts (t3302 and t3419) had copy & paste code to set
USR_BIN_TIME prerequisite. Use the test_lazy_prereq helper to define
them in the common t/test-lib.sh.

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

test: turn EXPENSIVE into a lazy prerequisiteJunio C Hamano Mon, 9 Jun 2014 19:23:30 +0000 (12:23 -0700)

test: turn EXPENSIVE into a lazy prerequisite

Two test scripts (t0021 and t5551) had copy & paste code to set
EXPENSIVE prerequisite. Use the test_lazy_prereq helper to define
them in the common t/test-lib.sh.

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

t5551: fix the 50,000 tag testTorsten Bögershausen Thu, 5 Jun 2014 21:36:21 +0000 (23:36 +0200)

t5551: fix the 50,000 tag test

The first version of test 23 did simply check that no output was
sent to the standard error stream. With 5e2c7cd2 (t5551: do not use
unportable sed '\+', 2013-05-12), we started to also verify that the
expected tags were actually cloned.

Since 68b939b2 (clone: send diagnostic messages to stderr,
2013-09-18), "git clone" shows "Cloning into 'too-many-refs'" to the
standard error stream (it used to do so to the standard output),
causing the test to fail.

Signed-off-by: Torsten Bögershausen <tboegi@web.de>
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>