git
9 years agoMerge branch 'mn/sideband-no-ansi' into maint
Junio C Hamano [Wed, 25 Jun 2014 18:43:43 +0000 (11:43 -0700)] 
Merge branch 'mn/sideband-no-ansi' into maint

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

9 years agoMerge branch 'je/pager-do-not-recurse' into maint
Junio C Hamano [Wed, 25 Jun 2014 18:43:07 +0000 (11:43 -0700)] 
Merge branch 'je/pager-do-not-recurse' into maint

We used to unconditionally disable the pager in the pager process
we spawn to feed out output, but that prevented people who want to
run "less" within "less" from doing so.

* je/pager-do-not-recurse:
  pager: do allow spawning pager recursively

9 years agosetup_git_env(): introduce git_path_from_env() helper
Jeff King [Tue, 24 Jun 2014 20:58:15 +0000 (16:58 -0400)] 
setup_git_env(): introduce git_path_from_env() helper

"Check the value of an environment and fall back to a known path
inside $GIT_DIR" is repeated a few times to determine the location
of the data store, the index and the graft file, but the return
value of getenv is not guaranteed to survive across further
invocations of setenv or even getenv.

Make sure to xstrdup() the value we receive from getenv(3), and
encapsulate the pattern into a helper function.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agot7510: test verify-commit
Michael J Gruber [Mon, 23 Jun 2014 07:05:51 +0000 (09:05 +0200)] 
t7510: test verify-commit

This mixes the "git verify-commit" tests in with the "git show
--show-signature" tests, to keep the tests more readable.

The tests already mix in the "call show" tests with the "verify" tests.
So in case of a test beakage, a '-v' run would be needed to reveal the
exact point of breakage anyway.

Additionally, test the actual output of "git verify-commit" and "git
show --show-signature" and compare to "git cat-file".

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agot7510: exit for loop with test result
Michael J Gruber [Mon, 23 Jun 2014 07:05:50 +0000 (09:05 +0200)] 
t7510: exit for loop with test result

t7510 uses for loops in a subshell, which need to make sure that the test
returns with the appropriate error code from within the loop.

Restructure the loops as the usual && chains with a single point of
"exit 1" at the end of the loop to make this clearer.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoverify-commit: scriptable commit signature verification
Michael J Gruber [Mon, 23 Jun 2014 07:05:49 +0000 (09:05 +0200)] 
verify-commit: scriptable commit signature verification

Commit signatures can be verified using "git show -s --show-signature"
or the "%G?" pretty format and parsing the output, which is well suited
for user inspection, but not for scripting.

Provide a command "verify-commit" which is analogous to "verify-tag": It
returns 0 for good signatures and non-zero otherwise, has the gpg output
on stderr and (optionally) the commit object on stdout, sans the
signature, just like "verify-tag" does.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agogpg-interface: provide access to the payload
Michael J Gruber [Mon, 23 Jun 2014 07:05:48 +0000 (09:05 +0200)] 
gpg-interface: provide access to the payload

In contrast to tag signatures, commit signatures are put into the
header, that is between the other header parts and commit messages.

Provide access to the commit content sans the signature, which is the
payload that is actually signed. Commit signature verification does the
parsing anyways, and callers may wish to act on or display the commit
object sans the signature.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agogpg-interface: provide clear helper for struct signature_check
Michael J Gruber [Mon, 23 Jun 2014 07:05:47 +0000 (09:05 +0200)] 
gpg-interface: provide clear helper for struct signature_check

The struct has been growing members whose malloced memory needs to be
freed. Do this with one helper function so that no malloced memory shall
be left unfreed.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoMerge branch 'jk/xstrfmt' into next
Junio C Hamano [Mon, 23 Jun 2014 22:45:07 +0000 (15:45 -0700)] 
Merge branch 'jk/xstrfmt' into next

* jk/xstrfmt:
  unique_path: fix unlikely heap overflow
  walker_fetch: fix minor memory leak
  merge: use argv_array when spawning merge strategy
  sequencer: use argv_array_pushf
  setup_git_env: use git_pathdup instead of xmalloc + sprintf
  use xstrfmt to replace xmalloc + strcpy/strcat
  use xstrfmt to replace xmalloc + sprintf
  use xstrdup instead of xmalloc + strcpy
  use xstrfmt in favor of manual size calculations
  strbuf: add xstrfmt helper

9 years agoMerge branch 'jk/skip-prefix' into next
Junio C Hamano [Mon, 23 Jun 2014 22:45:02 +0000 (15:45 -0700)] 
Merge branch 'jk/skip-prefix' into next

* jk/skip-prefix:
  http-push: refactor parsing of remote object names
  imap-send: use skip_prefix instead of using magic numbers
  use skip_prefix to avoid repeated calculations
  git: avoid magic number with skip_prefix
  fetch-pack: refactor parsing in get_ack
  fast-import: refactor parsing of spaces
  stat_opt: check extra strlen call
  daemon: use skip_prefix to avoid magic numbers
  fast-import: use skip_prefix for parsing input
  use skip_prefix to avoid repeating strings
  use skip_prefix to avoid magic numbers
  transport-helper: avoid reading past end-of-string
  fast-import: fix read of uninitialized argv memory
  apply: use skip_prefix instead of raw addition
  refactor skip_prefix to return a boolean
  avoid using skip_prefix as a boolean
  daemon: mark some strings as const
  parse_diff_color_slot: drop ofs parameter

9 years agoMerge branch 'jm/dedup-name-compare' into next
Junio C Hamano [Mon, 23 Jun 2014 22:44:39 +0000 (15:44 -0700)] 
Merge branch 'jm/dedup-name-compare' into next

Unify three independent implementations to compare two counted
strings into one.

* jm/dedup-name-compare:
  cleanup duplicate name_compare() functions
  name-hash.c: replace cache_name_compare() with memcmp(3)

9 years agobuiltin/clone.c: detect a clone starting at a tag correctly
Junio C Hamano [Mon, 23 Jun 2014 21:27:36 +0000 (14:27 -0700)] 
builtin/clone.c: detect a clone starting at a tag correctly

31b808a0 (clone --single: limit the fetch refspec to fetched branch,
2012-09-20) tried to see if the given "branch" to follow is actually
a tag at the remote repository by checking with "refs/tags/" but it
incorrectly used strstr(3); it is actively wrong to treat a "branch"
"refs/heads/refs/tags/foo" and use the logic for the "refs/tags/"
ref hierarchy.  What the code really wanted to do is to see if it
starts with "refs/tags/".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoSync with master
Junio C Hamano [Fri, 20 Jun 2014 20:42:41 +0000 (13:42 -0700)] 
Sync with master

* master:
  Fourth batch for 2.1

9 years agoMerge branch 'ep/avoid-test-a-o' into next
Junio C Hamano [Fri, 20 Jun 2014 20:40:00 +0000 (13:40 -0700)] 
Merge branch 'ep/avoid-test-a-o' into next

Update tests and scripts to avoid "test ... -a ...", which is often
more error-prone than "test ... && test ...".

Squashed misconversion fix-up into git-submodule.sh updates.

* ep/avoid-test-a-o:
  git-submodule.sh: avoid "echo" path-like values
  git-submodule.sh: avoid "test <cond> -a/-o <cond>"
  t/test-lib-functions.sh: avoid "test <cond> -a/-o <cond>"
  t/t9814-git-p4-rename.sh: avoid "test <cond> -a/-o <cond>"
  t/t5538-push-shallow.sh: avoid "test <cond> -a/-o <cond>"
  t/t5403-post-checkout-hook.sh: avoid "test <cond> -a/-o <cond>"
  t/t5000-tar-tree.sh: avoid "test <cond> -a/-o <cond>"
  t/t4102-apply-rename.sh: avoid "test <cond> -a/-o <cond>"
  t/t0026-eol-config.sh: avoid "test <cond> -a/-o <cond>"
  t/t0025-crlf-auto.sh: avoid "test <cond> -a/-o <cond>"
  t/lib-httpd.sh: avoid "test <cond> -a/-o <cond>"
  git-rebase--interactive.sh: avoid "test <cond> -a/-o <cond>"
  git-mergetool.sh: avoid "test <cond> -a/-o <cond>"
  git-bisect.sh: avoid "test <cond> -a/-o <cond>"
  contrib/examples/git-resolve.sh: avoid "test <cond> -a/-o <cond>"
  contrib/examples/git-repack.sh: avoid "test <cond> -a/-o <cond>"
  contrib/examples/git-merge.sh: avoid "test <cond> -a/-o <cond>"
  contrib/examples/git-commit.sh: avoid "test <cond> -a/-o <cond>"
  contrib/examples/git-clone.sh: avoid "test <cond> -a/-o <cond>"
  check_bindir: avoid "test <cond> -a/-o <cond>"

9 years agoMerge branch 'tb/unicode-7.0-display-width' into next
Junio C Hamano [Fri, 20 Jun 2014 20:39:58 +0000 (13:39 -0700)] 
Merge branch 'tb/unicode-7.0-display-width' into next

* tb/unicode-7.0-display-width:
  Update of unicode_width.h to Unicode Version 7.0

9 years agoMerge branch 'dt/refs-check-refname-component-sse' into next
Junio C Hamano [Fri, 20 Jun 2014 20:39:51 +0000 (13:39 -0700)] 
Merge branch 'dt/refs-check-refname-component-sse' into next

Further micro-optimization of a leaf-function.

* dt/refs-check-refname-component-sse:
  refs.c: SSE2 optimizations for check_refname_component

9 years agoMerge branch 'jk/pretty-G-format-fixes' into next
Junio C Hamano [Fri, 20 Jun 2014 20:39:49 +0000 (13:39 -0700)] 
Merge branch 'jk/pretty-G-format-fixes' into next

* jk/pretty-G-format-fixes:
  pretty: avoid reading past end-of-string with "%G"
  t7510: check %G* pretty-format output
  t7510: test a commit signed by an unknown key
  t7510: use consistent &&-chains in loop
  t7510: stop referring to master in later tests

9 years agoMerge branch 'ye/http-extract-charset' into next
Junio C Hamano [Fri, 20 Jun 2014 20:39:32 +0000 (13:39 -0700)] 
Merge branch 'ye/http-extract-charset' into next

* ye/http-extract-charset:
  http: fix charset detection of extract_content_type()

9 years agoMerge branch 'ye/doc-http-proto' into next
Junio C Hamano [Fri, 20 Jun 2014 20:39:29 +0000 (13:39 -0700)] 
Merge branch 'ye/doc-http-proto' into next

* ye/doc-http-proto:
  http-protocol.txt: Basic Auth is defined in RFC 2617, not RFC 2616

9 years agoMerge branch 'bc/fix-rebase-merge-skip' into next
Junio C Hamano [Fri, 20 Jun 2014 20:37:39 +0000 (13:37 -0700)] 
Merge branch 'bc/fix-rebase-merge-skip' into next

"git rebase --skip" did not work well when it stopped due to a
conflict twice in a row.

* bc/fix-rebase-merge-skip:
  rebase--merge: fix --skip with two conflicts in a row

9 years agoMerge branch 'rs/blame-refactor' into next
Junio C Hamano [Fri, 20 Jun 2014 20:36:47 +0000 (13:36 -0700)] 
Merge branch 'rs/blame-refactor' into next

* rs/blame-refactor:
  blame: simplify prepare_lines()
  blame: factor out get_next_line()

9 years agoMerge branch 'pb/trim-trailing-spaces' into next
Junio C Hamano [Fri, 20 Jun 2014 20:36:32 +0000 (13:36 -0700)] 
Merge branch 'pb/trim-trailing-spaces' into next

* pb/trim-trailing-spaces:
  t0008: do not depend on 'echo' handling backslashes specially

9 years agoMerge branch 'mc/doc-submodule-sync-recurse' into next
Junio C Hamano [Fri, 20 Jun 2014 20:35:32 +0000 (13:35 -0700)] 
Merge branch 'mc/doc-submodule-sync-recurse' into next

* mc/doc-submodule-sync-recurse:
  submodule: document "sync --recursive"

9 years agoFourth batch for 2.1
Junio C Hamano [Fri, 20 Jun 2014 20:22:55 +0000 (13:22 -0700)] 
Fourth batch for 2.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoMerge branch 'jc/test-lazy-prereq' (early part)
Junio C Hamano [Fri, 20 Jun 2014 20:21:26 +0000 (13:21 -0700)] 
Merge branch 'jc/test-lazy-prereq' (early part)

* 'jc/test-lazy-prereq' (early part):
  t3419: drop unnecessary NOT_EXPENSIVE pseudo-prerequisite
  t3302: drop unnecessary NOT_EXPENSIVE pseudo-prerequisite
  t3302: do not chdir around in the primary test process
  t3302: coding style updates
  test: turn USR_BIN_TIME into a lazy prerequisite
  test: turn EXPENSIVE into a lazy prerequisite

9 years agoMerge branch 'jc/fetch-pull-refmap'
Junio C Hamano [Fri, 20 Jun 2014 20:14:10 +0000 (13:14 -0700)] 
Merge branch 'jc/fetch-pull-refmap'

* jc/fetch-pull-refmap:
  docs: Explain the purpose of fetch's and pull's <refspec> parameter.
  fetch: allow explicit --refmap to override configuration
  fetch doc: add a section on configured remote-tracking branches
  fetch doc: remove "short-cut" section
  fetch doc: update refspec format description
  fetch doc: on pulling multiple refspecs
  fetch doc: remove notes on outdated "mixed layout"
  fetch doc: update note on '+' in front of the refspec
  fetch doc: move FETCH_HEAD material lower and add an example
  fetch doc: update introductory part for clarity

9 years agoMerge branch 'mt/send-email-cover-to-cc'
Junio C Hamano [Fri, 20 Jun 2014 20:12:19 +0000 (13:12 -0700)] 
Merge branch 'mt/send-email-cover-to-cc'

* mt/send-email-cover-to-cc:
  t9001: avoid non-portable '\n' with sed
  test/send-email: to-cover, cc-cover tests
  git-send-email: two new options: to-cover, cc-cover

9 years agoMerge branch 'tb/t5551-clone-notice-to-stderr'
Junio C Hamano [Fri, 20 Jun 2014 20:12:17 +0000 (13:12 -0700)] 
Merge branch 'tb/t5551-clone-notice-to-stderr'

* tb/t5551-clone-notice-to-stderr:
  t5551: fix the 50,000 tag test

9 years agoMerge branch 'rs/more-starts-with'
Junio C Hamano [Fri, 20 Jun 2014 20:12:13 +0000 (13:12 -0700)] 
Merge branch 'rs/more-starts-with'

* rs/more-starts-with:
  Use starts_with() for C strings instead of memcmp()

9 years agoMerge branch 'jm/api-strbuf-doc'
Junio C Hamano [Fri, 20 Jun 2014 20:12:10 +0000 (13:12 -0700)] 
Merge branch 'jm/api-strbuf-doc'

* jm/api-strbuf-doc:
  api-strbuf.txt minor typos

9 years agoMerge branch 'jc/revision-dash-count-parsing'
Junio C Hamano [Fri, 20 Jun 2014 20:10:25 +0000 (13:10 -0700)] 
Merge branch 'jc/revision-dash-count-parsing'

"git log -2master" is a common typo that shows two commits starting
from whichever random branch that is not 'master' that happens to
be checked out currently.

* jc/revision-dash-count-parsing:
  revision: parse "git log -<count>" more carefully

9 years agohttp-push: refactor parsing of remote object names
Jeff King [Thu, 19 Jun 2014 21:58:10 +0000 (17:58 -0400)] 
http-push: refactor parsing of remote object names

We get loose object names like "objects/??/..." from the
remote side, and need to convert them to their hex
representation.

The code to do so is rather hard to follow, as it uses some
calculated lengths whose origins are hard to understand and
verify (e.g., the path must be exactly 49 characters long.
why? Why doesn't the strcpy overflow obj_hex, which is the
same length as path?).

We can simplify this a bit by using skip_prefix, using standard
40- and 20-character buffers for hex and binary sha1s, and
adding some comments.

We also drop a totally bogus comment that claims strlcpy
cannot be used because "path" is not NUL-terminated. Right
between a call to strlen(path) and strcpy(path).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoimap-send: use skip_prefix instead of using magic numbers
Tanay Abhra [Thu, 19 Jun 2014 05:22:46 +0000 (05:22 +0000)] 
imap-send: use skip_prefix instead of using magic numbers

Signed-off-by: Tanay Abhra <tanayabh@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agouse skip_prefix to avoid repeated calculations
Jeff King [Wed, 18 Jun 2014 19:57:17 +0000 (15:57 -0400)] 
use skip_prefix to avoid repeated calculations

In some cases, we use starts_with to check for a prefix, and
then use an already-calculated prefix length to advance a
pointer past the prefix. There are no magic numbers or
duplicated strings here, but we can still make the code
simpler and more obvious by using skip_prefix.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agogit: avoid magic number with skip_prefix
Jeff King [Wed, 18 Jun 2014 19:56:48 +0000 (15:56 -0400)] 
git: avoid magic number with skip_prefix

After handling options, any leftover arguments should be
commands. However, we pass through "--help" and "--version",
so that we convert them into "git help" and "git version"
respectively.

This is a straightforward use of skip_prefix to avoid a
magic number, but while we are there, it is worth adding a
comment to explain this otherwise confusing behavior.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agofetch-pack: refactor parsing in get_ack
Jeff King [Wed, 18 Jun 2014 19:56:03 +0000 (15:56 -0400)] 
fetch-pack: refactor parsing in get_ack

There are several uses of the magic number "line+45" when
parsing ACK lines from the server, and it's rather unclear
why 45 is the correct number. We can make this more clear by
keeping a running pointer as we parse, using skip_prefix to
jump past the first "ACK ", then adding 40 to jump past
get_sha1_hex (which is still magical, but hopefully 40 is
less magical to readers of git code).

Note that this actually puts us at line+44. The original
required some character between the sha1 and further ACK
flags (it is supposed to be a space, but we never enforced
that). We start our search for flags at line+44, which
meanas we are slightly more liberal than the old code.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agofast-import: refactor parsing of spaces
Jeff King [Wed, 18 Jun 2014 19:51:57 +0000 (15:51 -0400)] 
fast-import: refactor parsing of spaces

When we see a file change in a commit, we expect one of:

  1. A mark.

  2. An "inline" keyword.

  3. An object sha1.

The handling of spaces is inconsistent between the three
options. Option 1 calls a sub-function which checks for the
space, but doesn't parse past it. Option 2 parses the space,
then deliberately avoids moving the pointer past it. Option
3 detects the space locally but doesn't move past it.

This is confusing, because it looks like option 1 forgets to
check for the space (it's just buried). And option 2 checks
for "inline ", but only moves strlen("inline") characters
forward, which looks like a bug but isn't.

We can make this more clear by just having each branch move
past the space as it is checked (and we can replace the
doubled use of "inline" with a call to skip_prefix).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agostat_opt: check extra strlen call
Jeff King [Wed, 18 Jun 2014 19:51:17 +0000 (15:51 -0400)] 
stat_opt: check extra strlen call

As in earlier commits, the diff option parser uses
starts_with to find that an argument starts with "--stat-",
and then adds strlen("stat-") to find the rest of the
option.

However, in this case the starts_with and the strlen are
separated across functions, making it easy to call the
latter without the former. Let's use skip_prefix instead of
raw pointer arithmetic to catch such a case.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agodaemon: use skip_prefix to avoid magic numbers
Jeff King [Wed, 18 Jun 2014 19:49:44 +0000 (15:49 -0400)] 
daemon: use skip_prefix to avoid magic numbers

Like earlier cases, we can use skip_prefix to avoid magic
numbers that must match the length of starts_with prefixes.
However, the numbers are a little more complicated here, as
we keep parsing past the prefix. We can solve it by keeping
a running pointer as we parse; its final value is the
location we want.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agofast-import: use skip_prefix for parsing input
Jeff King [Wed, 18 Jun 2014 19:49:12 +0000 (15:49 -0400)] 
fast-import: use skip_prefix for parsing input

Fast-import does a lot of parsing of commands and
dispatching to sub-functions. For example, given "option
foo", we might recognize "option " using starts_with, and
then hand it off to parse_option() to do the rest.

However, we do not let parse_option know that we have parsed
the first part already. It gets the full buffer, and has to
skip past the uninteresting bits. Some functions simply add
a magic constant:

  char *option = command_buf.buf + 7;

Others use strlen:

  char *option = command_buf.buf + strlen("option ");

And others use strchr:

  char *option = strchr(command_buf.buf, ' ') + 1;

All of these are brittle and easy to get wrong (especially
given that the starts_with call and the code that assumes
the presence of the prefix are far apart). Instead, we can
use skip_prefix, and just pass each handler a pointer to its
arguments.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agouse skip_prefix to avoid repeating strings
Jeff King [Wed, 18 Jun 2014 19:48:29 +0000 (15:48 -0400)] 
use skip_prefix to avoid repeating strings

It's a common idiom to match a prefix and then skip past it
with strlen, like:

  if (starts_with(foo, "bar"))
  foo += strlen("bar");

This avoids magic numbers, but means we have to repeat the
string (and there is no compiler check that we didn't make a
typo in one of the strings).

We can use skip_prefix to handle this case without repeating
ourselves.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agouse skip_prefix to avoid magic numbers
Jeff King [Wed, 18 Jun 2014 19:47:50 +0000 (15:47 -0400)] 
use skip_prefix to avoid magic numbers

It's a common idiom to match a prefix and then skip past it
with a magic number, like:

  if (starts_with(foo, "bar"))
  foo += 3;

This is easy to get wrong, since you have to count the
prefix string yourself, and there's no compiler check if the
string changes.  We can use skip_prefix to avoid the magic
numbers here.

Note that some of these conversions could be much shorter.
For example:

  if (starts_with(arg, "--foo=")) {
  bar = arg + 6;
  continue;
  }

could become:

  if (skip_prefix(arg, "--foo=", &bar))
  continue;

However, I have left it as:

  if (skip_prefix(arg, "--foo=", &v)) {
  bar = v;
  continue;
  }

to visually match nearby cases which need to actually
process the string. Like:

  if (skip_prefix(arg, "--foo=", &v)) {
  bar = atoi(v);
  continue;
  }

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agotransport-helper: avoid reading past end-of-string
Jeff King [Wed, 18 Jun 2014 19:47:17 +0000 (15:47 -0400)] 
transport-helper: avoid reading past end-of-string

We detect the "import-marks" capability by looking for that
string, but _without_ a trailing space. Then we skip past it
using strlen("import-marks "), with a space. So if a remote
helper gives us exactly "import-marks", we will read past
the end-of-string by one character.

This is unlikely to be a problem in practice, because such
input is malformed in the first place, and because there is
a good chance that the string has an extra NUL terminator
one character after the original (because it formerly had a
newline in it that we parsed off).

We can fix it by using skip_prefix with "import-marks ",
with the space. The other form appears to be a typo from
a515ebe (transport-helper: implement marks location as
capability, 2011-07-16); "import-marks" has never existed
without an argument, and it should match the "export-marks"
definition above.

Speaking of which, we can also use skip_prefix in a few
other places while we are in the function.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agofast-import: fix read of uninitialized argv memory
Jeff King [Wed, 18 Jun 2014 19:46:15 +0000 (15:46 -0400)] 
fast-import: fix read of uninitialized argv memory

Fast-import shares code between its command-line parser and
the "option" command. To do so, it strips the "--" from any
command-line options and passes them to the option parser.
However, it does not confirm that the option even begins
with "--" before blindly passing "arg + 2".

It does confirm that the option starts with "-", so the only
affected case was:

  git fast-import -

which would read uninitialized memory after the argument. We
can fix it by using skip_prefix and checking the result. As
a bonus, this gets rid of some magic numbers.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoapply: use skip_prefix instead of raw addition
Jeff King [Wed, 18 Jun 2014 19:45:34 +0000 (15:45 -0400)] 
apply: use skip_prefix instead of raw addition

A submodule diff generally has content like:

  -Subproject commit [0-9a-f]{40}
  +Subproject commit [0-9a-f]{40}

When we are using "git apply --index" with a submodule, we
first apply the textual diff, and then parse that result to
figure out the new sha1.

If the diff has bogus input like:

  -Subproject commit 1234567890123456789012345678901234567890
  +bogus

we will parse the "bogus" portion. Our parser assumes that
the buffer starts with "Subproject commit", and blindly
skips past it using strlen(). This can cause us to read
random memory after the buffer.

This problem was unlikely to have come up in practice (since
it requires a malformed diff), and even when it did, we
likely noticed the problem anyway as the next operation was
to call get_sha1_hex on the random memory.

However, we can easily fix it by using skip_prefix to notice
the parsing error.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agorefactor skip_prefix to return a boolean
Jeff King [Wed, 18 Jun 2014 19:44:19 +0000 (15:44 -0400)] 
refactor skip_prefix to return a boolean

The skip_prefix() function returns a pointer to the content
past the prefix, or NULL if the prefix was not found. While
this is nice and simple, in practice it makes it hard to use
for two reasons:

  1. When you want to conditionally skip or keep the string
     as-is, you have to introduce a temporary variable.
     For example:

       tmp = skip_prefix(buf, "foo");
       if (tmp)
       buf = tmp;

  2. It is verbose to check the outcome in a conditional, as
     you need extra parentheses to silence compiler
     warnings. For example:

       if ((cp = skip_prefix(buf, "foo"))
       /* do something with cp */

Both of these make it harder to use for long if-chains, and
we tend to use starts_with() instead. However, the first line
of "do something" is often to then skip forward in buf past
the prefix, either using a magic constant or with an extra
strlen(3) (which is generally computed at compile time, but
means we are repeating ourselves).

This patch refactors skip_prefix() to return a simple boolean,
and to provide the pointer value as an out-parameter. If the
prefix is not found, the out-parameter is untouched. This
lets you write:

  if (skip_prefix(arg, "foo ", &arg))
  do_foo(arg);
  else if (skip_prefix(arg, "bar ", &arg))
  do_bar(arg);

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agocleanup duplicate name_compare() functions
Jeremiah Mahler [Fri, 20 Jun 2014 02:06:44 +0000 (19:06 -0700)] 
cleanup duplicate name_compare() functions

We often represent our strings as a counted string, i.e. a pair of
the pointer to the beginning of the string and its length, and the
string may not be NUL terminated to that length.

To compare a pair of such counted strings, unpack-trees.c and
read-cache.c implement their own name_compare() functions
identically.  In addition, the cache_name_compare() function in
read-cache.c is nearly identical.  The only difference is when one
string is the prefix of the other string, in which case
name_compare() returns -1/+1 to show which one is longer, and
cache_name_compare() returns the difference of the lengths to show
the same information.

Unify these three functions by using the implementation from
cache_name_compare().  This does not make any difference to the
existing and future callers, as they must be paying attention only
to the sign of the returned value (and not the magnitude) because
the original implementations of these two functions return values
returned by memcmp(3) when the one string is not a prefix of the
other string, and the only thing memcmp(3) guarantees its callers is
the sign of the returned value, not the magnitude.

Signed-off-by: Jeremiah Mahler <jmmahler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoname-hash.c: replace cache_name_compare() with memcmp(3)
Jeremiah Mahler [Fri, 20 Jun 2014 02:06:43 +0000 (19:06 -0700)] 
name-hash.c: replace cache_name_compare() with memcmp(3)

The same_name() private function wants a quick-and-exact check to
see if they two names are byte-for-byte identical first and then
fall back to the slow path.  Use memcmp(3) for the former to make it
clear that we do not want any "name" specific comparison.

Signed-off-by: Jeremiah Mahler <jmmahler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agounique_path: fix unlikely heap overflow
Jeff King [Thu, 19 Jun 2014 21:30:26 +0000 (17:30 -0400)] 
unique_path: fix unlikely heap overflow

When merge-recursive creates a unique filename, it uses a
template like:

  path~branch_%d

where the final "_%d" is filled by an incrementing counter
until we find a unique name. We allocate 8 characters for
the counter, but there is no logic to limit the size of the
integer.

Of course, this is extremely unlikely, as you would need a
hundred million collisions to trigger the problem.  Even if
an attacker constructed a specialized repo, it is unlikely
that the victim would have the patience to run the merge.

However, we can make it trivially correct (and hopefully
more readable) by using a strbuf.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agowalker_fetch: fix minor memory leak
Jeff King [Thu, 19 Jun 2014 21:29:48 +0000 (17:29 -0400)] 
walker_fetch: fix minor memory leak

We sometimes allocate "msg" on the heap, but will fail to
free it if we hit the failure code path. We can instead keep
a separate variable that is safe to be freed no matter how
we get to the failure code path.

While we're here, we can also do two readability
improvements:

  1. Use xstrfmt instead of a manual malloc/sprintf

  2. Due to the "maybe we allocate msg, maybe we don't"
     strategy, the logic for deciding which message to show
     was split into two parts. Since the deallocation is now
     pushed onto a separate variable, this is no longer a
     concern, and we can keep all of the logic in the same
     place.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agomerge: use argv_array when spawning merge strategy
Jeff King [Thu, 19 Jun 2014 21:29:31 +0000 (17:29 -0400)] 
merge: use argv_array when spawning merge strategy

This is shorter, and avoids a rather complicated set of
allocation and free steps.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agosequencer: use argv_array_pushf
Jeff King [Thu, 19 Jun 2014 21:28:20 +0000 (17:28 -0400)] 
sequencer: use argv_array_pushf

This avoids a manual allocation calculation, and is shorter
to boot.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agosetup_git_env: use git_pathdup instead of xmalloc + sprintf
Jeff King [Thu, 19 Jun 2014 21:28:00 +0000 (17:28 -0400)] 
setup_git_env: use git_pathdup instead of xmalloc + sprintf

This is shorter, harder to get wrong, and more clearly
captures the intent.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agouse xstrfmt to replace xmalloc + strcpy/strcat
Jeff King [Thu, 19 Jun 2014 21:26:56 +0000 (17:26 -0400)] 
use xstrfmt to replace xmalloc + strcpy/strcat

It's easy to get manual allocation calculations wrong, and
the use of strcpy/strcat raise red flags for people looking
for buffer overflows (though in this case each site was
fine).

It's also shorter to use xstrfmt, and the printf-format
tends to be easier for a reader to see what the final string
will look like.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agouse xstrfmt to replace xmalloc + sprintf
Jeff King [Thu, 19 Jun 2014 21:24:33 +0000 (17:24 -0400)] 
use xstrfmt to replace xmalloc + sprintf

This is one line shorter, and makes sure the length in the
malloc and sprintf steps match.

These conversions are very straightforward; we can drop the
malloc entirely, and replace the sprintf with xstrfmt.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agouse xstrdup instead of xmalloc + strcpy
Jeff King [Thu, 19 Jun 2014 21:19:43 +0000 (17:19 -0400)] 
use xstrdup instead of xmalloc + strcpy

This is one line shorter, and makes sure the length in the
malloc and copy steps match.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agogit-submodule.sh: avoid "echo" path-like values
Junio C Hamano [Tue, 10 Jun 2014 15:33:39 +0000 (08:33 -0700)] 
git-submodule.sh: avoid "echo" path-like values

SysV-derived implementation of "echo" interprets some backslash
sequences as special instruction, e.g. "echo 'ab\c'" shows an
incomplete line with 'a' and 'b' on it.  Avoid using it when showing
a path-like values in the script.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agogit-submodule.sh: avoid "test <cond> -a/-o <cond>"
Elia Pinto [Tue, 10 Jun 2014 12:28:33 +0000 (05:28 -0700)] 
git-submodule.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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agouse xstrfmt in favor of manual size calculations
Jeff King [Wed, 18 Jun 2014 20:02:13 +0000 (16:02 -0400)] 
use xstrfmt in favor of manual size calculations

In many parts of the code, we do an ugly and error-prone
malloc like:

  const char *fmt = "something %s";
  buf = xmalloc(strlen(foo) + 10 + 1);
  sprintf(buf, fmt, foo);

This makes the code brittle, and if we ever get the
allocation wrong, is a potential heap overflow. Let's
instead favor xstrfmt, which handles the allocation
automatically, and makes the code shorter and more readable.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agostrbuf: add xstrfmt helper
Jeff King [Wed, 18 Jun 2014 20:01:34 +0000 (16:01 -0400)] 
strbuf: add xstrfmt helper

You can use a strbuf to build up a string from parts, and
then detach it. In the general case, you might use multiple
strbuf_add* functions to do the building. However, in many
cases, a single strbuf_addf is sufficient, and we end up
with:

  struct strbuf buf = STRBUF_INIT;
  ...
  strbuf_addf(&buf, fmt, some, args);
  str = strbuf_detach(&buf, NULL);

We can make this much more readable (and avoid introducing
an extra variable, which can clutter the code) by
introducing a convenience function:

  str = xstrfmt(fmt, some, args);

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoavoid using skip_prefix as a boolean
Jeff King [Wed, 18 Jun 2014 19:42:14 +0000 (15:42 -0400)] 
avoid using skip_prefix as a boolean

There's no point in using:

  if (skip_prefix(buf, "foo"))

over

  if (starts_with(buf, "foo"))

as the point of skip_prefix is to return a pointer to the
data after the prefix. Using starts_with is more readable,
and will make refactoring skip_prefix easier.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agodaemon: mark some strings as const
Jeff King [Wed, 18 Jun 2014 19:41:58 +0000 (15:41 -0400)] 
daemon: mark some strings as const

None of these strings is modified; marking them as const
will help later refactoring.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoparse_diff_color_slot: drop ofs parameter
Jeff King [Wed, 18 Jun 2014 19:41:50 +0000 (15:41 -0400)] 
parse_diff_color_slot: drop ofs parameter

This function originally took a whole config variable name
("var") and an offset ("ofs"). It checked "var+ofs" against
each color slot, but reported errors using the whole "var".

However, since 8b8e862 (ignore unknown color configuration,
2009-12-12), it returns -1 rather than printing its own
error, and therefore only cares about var+ofs. We can drop
the ofs parameter and teach its sole caller to derive the
pointer itself.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agorefs.c: SSE2 optimizations for check_refname_component
David Turner [Wed, 18 Jun 2014 05:54:42 +0000 (01:54 -0400)] 
refs.c: SSE2 optimizations for check_refname_component

Optimize check_refname_component using SSE2 on x86_64.

git rev-parse HEAD is a good test-case for this, since it does almost
nothing except parse refs.  For one particular repo with about 60k
refs, almost all packed, the timings are:

Look up table: 29 ms
SSE2:          23 ms

This cuts about 20% off of the runtime.

Ondřej Bílka <neleai@seznam.cz> suggested an SSE2 approach to the
substring searches, which netted a speed boost over the SSE4.2 code I
had initially written.

Signed-off-by: David Turner <dturner@twitter.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoUpdate of unicode_width.h to Unicode Version 7.0
Torsten Bögershausen [Tue, 17 Jun 2014 19:56:08 +0000 (21:56 +0200)] 
Update of unicode_width.h to Unicode Version 7.0

Unicode Version 7.0 was released yesterday.
Run ./update_unicode.sh to update the zero_width table.
Note: the double_width is unchanged.

Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agohttp: fix charset detection of extract_content_type()
Yi EungJun [Tue, 17 Jun 2014 22:11:53 +0000 (07:11 +0900)] 
http: fix charset detection of extract_content_type()

extract_content_type() could not extract a charset parameter if the
parameter is not the first one and there is a whitespace and a following
semicolon just before the parameter. For example:

    text/plain; format=fixed ;charset=utf-8

And it also could not handle correctly some other cases, such as:

    text/plain; charset=utf-8; format=fixed
    text/plain; some-param="a long value with ;semicolons;"; charset=utf-8

Thanks-to: Jeff King <peff@peff.net>
Signed-off-by: Yi EungJun <eungjun.yi@navercorp.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agopretty: avoid reading past end-of-string with "%G"
Jeff King [Tue, 17 Jun 2014 00:07:07 +0000 (20:07 -0400)] 
pretty: avoid reading past end-of-string with "%G"

If the user asks for --format=%G with nothing else, we
correctly realize that "%G" is not a valid placeholder (it
should be "%G?", "%GK", etc). But we still tell the
strbuf_expand code that we consumed 2 characters, causing it
to jump over the trailing NUL and output garbage.

This also fixes the case where "%GX" would be consumed (and
produce no output). In other cases, we pass unrecognized
placeholders through to the final string.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agot7510: check %G* pretty-format output
Jeff King [Tue, 17 Jun 2014 00:06:24 +0000 (20:06 -0400)] 
t7510: check %G* pretty-format output

We do not check these along with the other pretty-format
placeholders in t6006, because we need signed commits to
make them interesting. t7510 has such commits, and can
easily exercise them in addition to the regular
--show-signature code path.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agot7510: test a commit signed by an unknown key
Jeff King [Tue, 17 Jun 2014 00:05:54 +0000 (20:05 -0400)] 
t7510: test a commit signed by an unknown key

We tested both good and bad signatures, but not ones made
correctly but with a key for which we have no trust.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agot7510: use consistent &&-chains in loop
Michael J Gruber [Tue, 17 Jun 2014 00:03:43 +0000 (20:03 -0400)] 
t7510: use consistent &&-chains in loop

We check multiple commits in a loop. Because we want to
break out of the loop if any single iteration fails, we use
a subshell/exit like:

  (
for i in $stuff
do
do-something $i || exit 1
done
  )

However, we are inconsistent in our loop body. Some commands
get their own "|| exit 1", and others try to chain to the
next command with "&&", like:

  X &&
  Y || exit 1
  Z || exit 1

This is a little hard to read and follow, because X and Y
are treated differently for no good reason. But much worse,
the second loop follows a similar pattern and gets it wrong.
"Y" is expected to fail, so we use "&& exit 1", giving us:

  X &&
  Y && exit 1
  Z || exit 1

That gets the test for X wrong (we do not exit unless both X
fails and Y unexpectedly succeeds, but we would want to exit
if _either_ is wrong). We can write this clearly and
correctly by consistently using "&&", followed by a single
"|| exit 1", and negating Y with "!" (as we would in a
normal &&-chain). Like:

  X &&
  ! Y &&
  Z || exit 1

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agot7510: stop referring to master in later tests
Jeff King [Mon, 16 Jun 2014 23:59:59 +0000 (19:59 -0400)] 
t7510: stop referring to master in later tests

Our setup creates a sequence of commits, each with its own
tag. However, we sometimes refer to "seventh-signed" as
"master". This works, since it is at the tip of the created
branch, but is brittle if new tests need to add more
commits. Let's use its tag name to be unambiguous.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agorebase--merge: fix --skip with two conflicts in a row
brian m. carlson [Mon, 16 Jun 2014 00:01:25 +0000 (00:01 +0000)] 
rebase--merge: fix --skip with two conflicts in a row

If git rebase --merge encountered a conflict, --skip would not work if the
next commit also conflicted.  The msgnum file would never be updated with
the new patch number, so no patch would actually be skipped, resulting in an
inescapable loop.

Update the msgnum file's value as the first thing in call_merge.  This also
avoids an "Already applied" message when skipping a commit.  There is no
visible change for the other contexts in which call_merge is invoked, as the
msgnum file's value remains unchanged in those situations.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoSync with master
Junio C Hamano [Mon, 16 Jun 2014 19:52:17 +0000 (12:52 -0700)] 
Sync with master

* master:
  Third batch for 2.1

9 years agoMerge branch 'jk/commit-buffer-length' into next
Junio C Hamano [Mon, 16 Jun 2014 19:52:06 +0000 (12:52 -0700)] 
Merge branch 'jk/commit-buffer-length' into next

* jk/commit-buffer-length:
  reuse cached commit buffer when parsing signatures
  commit: record buffer length in cache
  commit: convert commit->buffer to a slab
  commit-slab: provide a static initializer
  use get_commit_buffer everywhere
  convert logmsg_reencode to get_commit_buffer
  use get_commit_buffer to avoid duplicate code
  use get_cached_commit_buffer where appropriate
  provide helpers to access the commit buffer
  provide a helper to set the commit buffer
  provide a helper to free commit buffer
  sequencer: use logmsg_reencode in get_message
  logmsg_reencode: return const buffer
  do not create "struct commit" with xcalloc
  commit: push commit_index update into alloc_commit_node
  alloc: include any-object allocations in alloc_report
  replace dangerous uses of strbuf_attach
  commit_tree: take a pointer/len pair rather than a const strbuf

9 years agoMerge branch 'sp/complete-ext-alias' into next
Junio C Hamano [Mon, 16 Jun 2014 19:52:05 +0000 (12:52 -0700)] 
Merge branch 'sp/complete-ext-alias' into next

* sp/complete-ext-alias:
  completion: handle '!f() { ... }; f' and "!sh -c '...' -" aliases

9 years agoMerge branch 'mc/git-p4-prepare-p4-only' into next
Junio C Hamano [Mon, 16 Jun 2014 19:52:04 +0000 (12:52 -0700)] 
Merge branch 'mc/git-p4-prepare-p4-only' into next

* mc/git-p4-prepare-p4-only:
  git-p4: fix submit in non --prepare-p4-only mode

9 years agoMerge branch 'jk/repack-pack-writebitmaps-config' into next
Junio C Hamano [Mon, 16 Jun 2014 19:52:02 +0000 (12:52 -0700)] 
Merge branch 'jk/repack-pack-writebitmaps-config' into next

* jk/repack-pack-writebitmaps-config:
  t7700: drop explicit --no-pack-kept-objects from .keep test
  repack: introduce repack.writeBitmaps config option
  repack: simplify handling of --write-bitmap-index
  pack-objects: stop respecting pack.writebitmaps

9 years agoMerge branch 'nd/init-restore-env' into next
Junio C Hamano [Mon, 16 Jun 2014 19:51:59 +0000 (12:51 -0700)] 
Merge branch 'nd/init-restore-env' into next

* nd/init-restore-env:
  git potty: restore environments after alias expansion

9 years agoMerge branch 'jk/repack-pack-keep-objects' into next
Junio C Hamano [Mon, 16 Jun 2014 19:51:51 +0000 (12:51 -0700)] 
Merge branch 'jk/repack-pack-keep-objects' into next

* jk/repack-pack-keep-objects:
  repack: s/write_bitmap/&s/ in code
  repack: respect pack.writebitmaps
  repack: do not accidentally pack kept objects by default

9 years agoMerge branch 'fr/sequencer-fail-with-not-one-upon-no-ff' into next
Junio C Hamano [Mon, 16 Jun 2014 19:51:45 +0000 (12:51 -0700)] 
Merge branch 'fr/sequencer-fail-with-not-one-upon-no-ff' into next

* fr/sequencer-fail-with-not-one-upon-no-ff:
  sequencer: signal failed ff as an aborted, not a conflicted merge

9 years agoThird batch for 2.1
Junio 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>
9 years agoMerge 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

9 years agoMerge 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

9 years agoMerge 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()

9 years agoMerge 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()

9 years agoMerge 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

9 years agoMerge 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

9 years agoMerge 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

9 years agoMerge 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

9 years agoMerge 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()

9 years agoMerge 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

9 years agoMerge 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

9 years agoMerge 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

9 years agoMerge 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

9 years agoMerge 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

9 years agoMerge 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

9 years agoMerge 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

9 years agoMerge 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

9 years agoMerge 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

9 years agoMerge 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