]> granicus.if.org Git - git/log
git
8 years agoMerge branch 'sb/submodule-helper-clone-regression-fix' into sb/submodule-init
Junio C Hamano [Thu, 14 Apr 2016 19:46:11 +0000 (12:46 -0700)]
Merge branch 'sb/submodule-helper-clone-regression-fix' into sb/submodule-init

* sb/submodule-helper-clone-regression-fix:
  submodule--helper, module_clone: catch fprintf failure
  submodule--helper: do not borrow absolute_path() result for too long
  submodule--helper, module_clone: always operate on absolute paths
  submodule--helper clone: create the submodule path just once
  submodule--helper: fix potential NULL-dereference
  recursive submodules: test for relative paths

8 years agosubmodule--helper, module_clone: catch fprintf failure
Stefan Beller [Fri, 1 Apr 2016 00:17:29 +0000 (17:17 -0700)]
submodule--helper, module_clone: catch fprintf failure

The return value of fprintf is unchecked, which may lead to
unreported errors. Use fprintf_or_die to report the error to the user.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agosubmodule--helper: do not borrow absolute_path() result for too long
Junio C Hamano [Fri, 1 Apr 2016 19:23:16 +0000 (12:23 -0700)]
submodule--helper: do not borrow absolute_path() result for too long

absolute_path() is designed to allow its callers to take a brief
peek of the result (typically, to be fed to functions like
strbuf_add() and relative_path() as a parameter) without having to
worry about freeing it, but the other side of the coin of that
memory model is that the caller shouldn't rely too much on the
result living forever--there may be a helper function the caller
subsequently calls that makes its own call to absolute_path(),
invalidating the earlier result.

Use xstrdup() to make our own copy, and free(3) it when we are done.
While at it, remove an unnecessary sm_gitdir_rel variable that was
only used to as a parameter to call absolute_path() and never used
again.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agosubmodule--helper, module_clone: always operate on absolute paths
Stefan Beller [Fri, 1 Apr 2016 00:17:28 +0000 (17:17 -0700)]
submodule--helper, module_clone: always operate on absolute paths

When giving relative paths to `relative_path` to compute a relative path
from one directory to another, this may fail in `relative_path`.
Make sure both arguments to `relative_path` are always absolute.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agosubmodule--helper clone: create the submodule path just once
Stefan Beller [Thu, 31 Mar 2016 21:04:38 +0000 (14:04 -0700)]
submodule--helper clone: create the submodule path just once

We make sure that the parent directory of path exists (or create it
otherwise) and then do the same for path + "/.git".

That is equivalent to just making sure that the parent directory of
path + "/.git" exists (or create it otherwise).

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agosubmodule--helper: fix potential NULL-dereference
Stefan Beller [Thu, 31 Mar 2016 21:04:37 +0000 (14:04 -0700)]
submodule--helper: fix potential NULL-dereference

Don't dereference NULL 'path' if it was never assigned.  Also
protect against an empty --path argument.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agorecursive submodules: test for relative paths
Stefan Beller [Thu, 31 Mar 2016 21:04:36 +0000 (14:04 -0700)]
recursive submodules: test for relative paths

"git submodule update --init --recursive" uses full path to refer to
the true location of the repository in the "gitdir:" pointer for
nested submodules; the command used to use relative paths.

This was reported by Norio Nomura in $gmane/290280.

The root cause for that bug is in using recursive submodules as
their relative path handling was broken in ee8838d (2015-09-08,
submodule: rewrite `module_clone` shell function in C).

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoclone: allow an explicit argument for parallel submodule clones
Stefan Beller [Tue, 1 Mar 2016 02:07:20 +0000 (18:07 -0800)]
clone: allow an explicit argument for parallel submodule clones

Just pass it along to "git submodule update", which may pick reasonable
defaults if you don't specify an explicit number.

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agosubmodule update: expose parallelism to the user
Stefan Beller [Tue, 1 Mar 2016 02:07:19 +0000 (18:07 -0800)]
submodule update: expose parallelism to the user

Expose possible parallelism either via the "--jobs" CLI parameter or
the "submodule.fetchJobs" setting.

By having the variable initialized to -1, we make sure 0 can be passed
into the parallel processing machine, which will then pick as many parallel
workers as there are CPUs.

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agosubmodule helper: remove double 'fatal: ' prefix
Stefan Beller [Tue, 1 Mar 2016 02:07:18 +0000 (18:07 -0800)]
submodule helper: remove double 'fatal: ' prefix

The prefix is added by die(...), so we don't have to do it.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agogit submodule update: have a dedicated helper for cloning
Stefan Beller [Tue, 1 Mar 2016 02:07:17 +0000 (18:07 -0800)]
git submodule update: have a dedicated helper for cloning

This introduces a new helper function in git submodule--helper
which takes care of cloning all submodules, which we want to
parallelize eventually.

Some tests (such as empty URL, update_mode=none) are required in the
helper to make the decision for cloning. These checks have been
moved into the C function as well (no need to repeat them in the
shell script).

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agorun_processes_parallel: rename parameters for the callbacks
Stefan Beller [Tue, 1 Mar 2016 02:07:16 +0000 (18:07 -0800)]
run_processes_parallel: rename parameters for the callbacks

The refs code has a similar pattern of passing around 'struct strbuf *err',
which is strictly used for error reporting. This is not the case here,
as the strbuf is used to accumulate all the output (whether it is error
or not) for the user. Rename it to 'out'.

Suggested-by: Jonathan Nieder <jrnieder@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agorun_processes_parallel: treat output of children as byte array
Stefan Beller [Tue, 1 Mar 2016 02:07:15 +0000 (18:07 -0800)]
run_processes_parallel: treat output of children as byte array

We do not want the output to be interrupted by a NUL byte, so we
cannot use raw fputs. Introduce strbuf_write to avoid having long
arguments in run-command.c.

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agosubmodule update: direct error message to stderr
Stefan Beller [Tue, 1 Mar 2016 02:07:14 +0000 (18:07 -0800)]
submodule update: direct error message to stderr

Reroute the error message for specified but initialized submodules
to stderr instead of stdout.

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agofetching submodules: respect `submodule.fetchJobs` config option
Stefan Beller [Tue, 1 Mar 2016 02:07:13 +0000 (18:07 -0800)]
fetching submodules: respect `submodule.fetchJobs` config option

This allows to configure fetching and updating in parallel
without having the command line option.

This moved the responsibility to determine how many parallel processes
to start from builtin/fetch to submodule.c as we need a way to communicate
"The user did not specify the number of parallel processes in the command
line options" in the builtin fetch. The submodule code takes care of
the precedence (CLI > config > default).

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agosubmodule-config: drop check against NULL
Stefan Beller [Tue, 1 Mar 2016 02:07:12 +0000 (18:07 -0800)]
submodule-config: drop check against NULL

Adhere to the common coding style of Git and not check explicitly
for NULL throughout the file. There are still other occurrences in the
code base but that is usually inside of conditions with side effects.

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agosubmodule-config: keep update strategy around
Stefan Beller [Tue, 1 Mar 2016 02:07:11 +0000 (18:07 -0800)]
submodule-config: keep update strategy around

Currently submodule.<name>.update is only handled by git-submodule.sh.
C code will start to need to make use of that value as more of the
functionality of git-submodule.sh moves into library code in C.

Add the update field to 'struct submodule' and populate it so it can
be read as sm->update or from sm->update_command.

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agorun-command: do not pass child process data into callbacks
Stefan Beller [Mon, 29 Feb 2016 21:57:06 +0000 (13:57 -0800)]
run-command: do not pass child process data into callbacks

The expected way to pass data into the callback is to pass them via
the customizable callback pointer. The error reporting in
default_{start_failure, task_finished} is not user friendly enough, that
we want to encourage using the child data for such purposes.

Furthermore the struct child data is cleaned by the run-command API,
before we access them in the callbacks, leading to use-after-free
situations.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agosubmodules: allow parallel fetching, add tests and documentation
Stefan Beller [Wed, 16 Dec 2015 00:04:12 +0000 (16:04 -0800)]
submodules: allow parallel fetching, add tests and documentation

This enables the work of the previous patches.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agofetch_populated_submodules: use new parallel job processing
Stefan Beller [Wed, 16 Dec 2015 00:04:11 +0000 (16:04 -0800)]
fetch_populated_submodules: use new parallel job processing

In a later patch we enable parallel processing of submodules, this
only adds the possibility for it. So this change should not change
any user facing behavior.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agorun-command: add an asynchronous parallel child processor
Stefan Beller [Wed, 16 Dec 2015 00:04:10 +0000 (16:04 -0800)]
run-command: add an asynchronous parallel child processor

This allows to run external commands in parallel with ordered output
on stderr.

If we run external commands in parallel we cannot pipe the output directly
to the our stdout/err as it would mix up. So each process's output will
flow through a pipe, which we buffer. One subprocess can be directly
piped to out stdout/err for a low latency feedback to the user.

Example:
Let's assume we have 5 submodules A,B,C,D,E and each fetch takes a
different amount of time as the different submodules vary in size, then
the output of fetches in sequential order might look like this:

 time -->
 output: |---A---| |-B-| |-------C-------| |-D-| |-E-|

When we schedule these submodules into maximal two parallel processes,
a schedule and sample output over time may look like this:

process 1: |---A---| |-D-| |-E-|

process 2: |-B-| |-------C-------|

output:    |---A---|B|---C-------|DE

So A will be perceived as it would run normally in the single child
version. As B has finished by the time A is done, we can dump its whole
progress buffer on stderr, such that it looks like it finished in no
time. Once that is done, C is determined to be the visible child and
its progress will be reported in real time.

So this way of output is really good for human consumption, as it only
changes the timing, not the actual output.

For machine consumption the output needs to be prepared in the tasks,
by either having a prefix per line or per block to indicate whose tasks
output is displayed, because the output order may not follow the
original sequential ordering:

 |----A----| |--B--| |-C-|

will be scheduled to be all parallel:

process 1: |----A----|
process 2: |--B--|
process 3: |-C-|
output:    |----A----|CB

This happens because C finished before B did, so it will be queued for
output before B.

To detect when a child has finished executing, we check interleaved
with other actions (such as checking the liveliness of children or
starting new processes) whether the stderr pipe still exists. Once a
child closed its stderr stream, we assume it is terminating very soon,
and use `finish_command()` from the single external process execution
interface to collect the exit status.

By maintaining the strong assumption of stderr being open until the
very end of a child process, we can avoid other hassle such as an
implementation using `waitpid(-1)`, which is not implemented in Windows.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agosigchain: add command to pop all common signals
Stefan Beller [Wed, 16 Dec 2015 00:04:09 +0000 (16:04 -0800)]
sigchain: add command to pop all common signals

The new method removes all common signal handlers that were installed
by sigchain_push.

CC: Jeff King <peff@peff.net>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agostrbuf: add strbuf_read_once to read without blocking
Stefan Beller [Wed, 16 Dec 2015 00:04:08 +0000 (16:04 -0800)]
strbuf: add strbuf_read_once to read without blocking

The new call will read from a file descriptor into a strbuf once. The
underlying call xread is just run once. xread only reattempts
reading in case of EINTR, which makes it suitable to use for a
nonblocking read.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoxread: poll on non blocking fds
Stefan Beller [Wed, 16 Dec 2015 00:04:07 +0000 (16:04 -0800)]
xread: poll on non blocking fds

The man page of read(2) says:

  EAGAIN The file descriptor fd refers to a file other than a socket
 and has been marked nonblocking (O_NONBLOCK), and the read
 would block.

  EAGAIN or EWOULDBLOCK
 The file descriptor fd refers to a socket and has been marked
 nonblocking (O_NONBLOCK), and the read would block.  POSIX.1-2001
 allows either error to be returned for this case, and does not
 require these constants to have the same value, so a portable
 application should check for both possibilities.

If we get an EAGAIN or EWOULDBLOCK the fd must have set O_NONBLOCK.
As the intent of xread is to read as much as possible either until the
fd is EOF or an actual error occurs, we can ease the feeder of the fd
by not spinning the whole time, but rather wait for it politely by not
busy waiting.

We should not care if the call to poll failed, as we're in an infinite
loop and can only get out with the correct read().

Signed-off-by: Stefan Beller <sbeller@google.com>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agosubmodule.c: write "Fetching submodule <foo>" to stderr
Jonathan Nieder [Wed, 16 Dec 2015 00:04:06 +0000 (16:04 -0800)]
submodule.c: write "Fetching submodule <foo>" to stderr

The "Pushing submodule <foo>" progress output correctly goes to
stderr, but "Fetching submodule <foo>" is going to stdout by
mistake.  Fix it to write to stderr.

Noticed while trying to implement a parallel submodule fetch.  When
this particular output line went to a different file descriptor, it
was buffered separately, resulting in wrongly interleaved output if
we copied it to the terminal naively.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoUpdate release notes to 2.7
Junio C Hamano [Fri, 11 Dec 2015 18:45:44 +0000 (10:45 -0800)]
Update release notes to 2.7

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoMerge branch 'maint'
Junio C Hamano [Fri, 11 Dec 2015 19:19:43 +0000 (11:19 -0800)]
Merge branch 'maint'

* maint:
  Prepare for 2.6.5

9 years agoPrepare for 2.6.5
Junio C Hamano [Fri, 11 Dec 2015 19:17:47 +0000 (11:17 -0800)]
Prepare for 2.6.5

This back-merges hopefully the last batch of trivially correct fixes
to the 2.6.x maintenance track from the master branch.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoMerge branch 'sn/null-pointer-arith-in-mark-tree-uninteresting' into maint
Junio C Hamano [Fri, 11 Dec 2015 19:14:38 +0000 (11:14 -0800)]
Merge branch 'sn/null-pointer-arith-in-mark-tree-uninteresting' into maint

mark_tree_uninteresting() has code to handle the case where it gets
passed a NULL pointer in its 'tree' parameter, but the function had
'object = &tree->object' assignment before checking if tree is
NULL.  This gives a compiler an excuse to declare that tree will
never be NULL and apply a wrong optimization.  Avoid it.

* sn/null-pointer-arith-in-mark-tree-uninteresting:
  revision.c: fix possible null pointer arithmetic

9 years agoMerge branch 'sg/lock-file-commit-error' into maint
Junio C Hamano [Fri, 11 Dec 2015 19:14:18 +0000 (11:14 -0800)]
Merge branch 'sg/lock-file-commit-error' into maint

Cosmetic improvement to lock-file error messages.

* sg/lock-file-commit-error:
  Make error message after failing commit_lock_file() less confusing

9 years agoMerge branch 'cb/t3404-shellquote' into maint
Junio C Hamano [Fri, 11 Dec 2015 19:14:18 +0000 (11:14 -0800)]
Merge branch 'cb/t3404-shellquote' into maint

* cb/t3404-shellquote:
  t3404: fix quoting of redirect for some versions of bash

9 years agoMerge branch 'sb/doc-submodule-sync-recursive' into maint
Junio C Hamano [Fri, 11 Dec 2015 19:14:17 +0000 (11:14 -0800)]
Merge branch 'sb/doc-submodule-sync-recursive' into maint

* sb/doc-submodule-sync-recursive:
  document submodule sync --recursive

9 years agoMerge branch 'nd/doc-check-ref-format-typo' into maint
Junio C Hamano [Fri, 11 Dec 2015 19:14:15 +0000 (11:14 -0800)]
Merge branch 'nd/doc-check-ref-format-typo' into maint

* nd/doc-check-ref-format-typo:
  git-check-ref-format.txt: typo, s/avoids/avoid/

9 years agoMerge branch 'rs/show-branch-argv-array' into maint
Junio C Hamano [Fri, 11 Dec 2015 19:14:13 +0000 (11:14 -0800)]
Merge branch 'rs/show-branch-argv-array' into maint

Code simplification.

* rs/show-branch-argv-array:
  show-branch: use argv_array for default arguments

9 years agoMerge branch 'rs/pop-commit' into maint
Junio C Hamano [Fri, 11 Dec 2015 19:14:12 +0000 (11:14 -0800)]
Merge branch 'rs/pop-commit' into maint

Code simplification.

* rs/pop-commit:
  use pop_commit() for consuming the first entry of a struct commit_list

9 years agoMerge branch 'as/subtree-with-spaces' into maint
Junio C Hamano [Fri, 11 Dec 2015 19:14:11 +0000 (11:14 -0800)]
Merge branch 'as/subtree-with-spaces' into maint

Update "git subtree" (in contrib/) so that it can take whitespaces
in the pathnames, not only in the in-tree pathname but the name of
the directory that the repository is in.

* as/subtree-with-spaces:
  contrib/subtree: respect spaces in a repository path
  t7900-subtree: test the "space in a subdirectory name" case

9 years agoMerge branch 'jk/test-lint-forbid-when-finished-in-subshell' into maint
Junio C Hamano [Fri, 11 Dec 2015 19:14:09 +0000 (11:14 -0800)]
Merge branch 'jk/test-lint-forbid-when-finished-in-subshell' into maint

Because "test_when_finished" in our test framework queues the
clean-up tasks to be done in a shell variable, it should not be
used inside a subshell.  Add a mechanism to allow 'bash' to catch
such uses, and fix the ones that were found.

* jk/test-lint-forbid-when-finished-in-subshell:
  test-lib-functions: detect test_when_finished in subshell
  t7800: don't use test_config in a subshell
  test-lib-functions: support "test_config -C <dir> ..."
  t5801: don't use test_when_finished in a subshell
  t7610: don't use test_config in a subshell

9 years agoMerge branch 'sn/null-pointer-arith-in-mark-tree-uninteresting'
Junio C Hamano [Fri, 11 Dec 2015 18:41:01 +0000 (10:41 -0800)]
Merge branch 'sn/null-pointer-arith-in-mark-tree-uninteresting'

mark_tree_uninteresting() has code to handle the case where it gets
passed a NULL pointer in its 'tree' parameter, but the function had
'object = &tree->object' assignment before checking if tree is
NULL.  This gives a compiler an excuse to declare that tree will
never be NULL and apply a wrong optimization.  Avoid it.

* sn/null-pointer-arith-in-mark-tree-uninteresting:
  revision.c: fix possible null pointer arithmetic

9 years agoMerge branch 'sb/doc-submodule-sync-recursive'
Junio C Hamano [Fri, 11 Dec 2015 18:40:59 +0000 (10:40 -0800)]
Merge branch 'sb/doc-submodule-sync-recursive'

* sb/doc-submodule-sync-recursive:
  document submodule sync --recursive

9 years agoMerge branch 'cb/t3404-shellquote'
Junio C Hamano [Fri, 11 Dec 2015 18:40:57 +0000 (10:40 -0800)]
Merge branch 'cb/t3404-shellquote'

* cb/t3404-shellquote:
  t3404: fix quoting of redirect for some versions of bash

9 years agoMerge branch 'sg/lock-file-commit-error'
Junio C Hamano [Fri, 11 Dec 2015 18:40:54 +0000 (10:40 -0800)]
Merge branch 'sg/lock-file-commit-error'

Cosmetic improvement to lock-file error messages.

* sg/lock-file-commit-error:
  Make error message after failing commit_lock_file() less confusing

9 years agoGit 2.7-rc0 v2.7.0-rc0
Junio C Hamano [Thu, 10 Dec 2015 20:59:37 +0000 (12:59 -0800)]
Git 2.7-rc0

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoSync with maint
Junio C Hamano [Thu, 10 Dec 2015 20:45:17 +0000 (12:45 -0800)]
Sync with maint

* maint:
  Documentation/git-update-index: add missing opts to synopsis

9 years agoUpdate release notes to 2.7
Junio C Hamano [Thu, 10 Dec 2015 20:43:52 +0000 (12:43 -0800)]
Update release notes to 2.7

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoMerge branch 'nd/doc-check-ref-format-typo'
Junio C Hamano [Thu, 10 Dec 2015 20:36:15 +0000 (12:36 -0800)]
Merge branch 'nd/doc-check-ref-format-typo'

* nd/doc-check-ref-format-typo:
  git-check-ref-format.txt: typo, s/avoids/avoid/

9 years agoMerge branch 'bc/object-id'
Junio C Hamano [Thu, 10 Dec 2015 20:36:13 +0000 (12:36 -0800)]
Merge branch 'bc/object-id'

More transition from "unsigned char[40]" to "struct object_id".

This needed a few merge fixups, but is mostly disentangled from other
topics.

* bc/object-id:
  remote: convert functions to struct object_id
  Remove get_object_hash.
  Convert struct object to object_id
  Add several uses of get_object_hash.
  object: introduce get_object_hash macro.
  ref_newer: convert to use struct object_id
  push_refs_with_export: convert to struct object_id
  get_remote_heads: convert to struct object_id
  parse_fetch: convert to use struct object_id
  add_sought_entry_mem: convert to struct object_id
  Convert struct ref to use object_id.
  sha1_file: introduce has_object_file helper.

9 years agoMerge branch 'dt/fsck-verify-pack-error'
Junio C Hamano [Thu, 10 Dec 2015 20:36:12 +0000 (12:36 -0800)]
Merge branch 'dt/fsck-verify-pack-error'

The exit code of git-fsck didnot reflect some types of errors found
in packed objects, which has been corrected.

* dt/fsck-verify-pack-error:
  verify_pack: do not ignore return value of verification function

9 years agoMerge branch 'ls/travis-yaml'
Junio C Hamano [Thu, 10 Dec 2015 20:36:12 +0000 (12:36 -0800)]
Merge branch 'ls/travis-yaml'

The necessary infrastructure to build topics using the free Travis
CI has been added. Developers forking from this topic (and enabling
Travis) can do their own builds, and we can turn on auto-builds for
git/git (including build-status for pull requests that people
open).

* ls/travis-yaml:
  Add Travis CI support

9 years agoDocumentation/git-update-index: add missing opts to synopsis
Christian Couder [Wed, 25 Nov 2015 09:30:02 +0000 (10:30 +0100)]
Documentation/git-update-index: add missing opts to synopsis

Split index related options should appear in the 'SYNOPSIS'
section.

These options are already documented in the 'OPTIONS' section.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoMerge branch 'ep/ident-with-getaddrinfo'
Junio C Hamano [Tue, 8 Dec 2015 22:14:50 +0000 (14:14 -0800)]
Merge branch 'ep/ident-with-getaddrinfo'

A build without NO_IPv6 used to use gethostbyname() when guessing
user's hostname, instead of getaddrinfo() that is used in other
codepaths in such a build.

* ep/ident-with-getaddrinfo:
  ident.c: add support for IPv6

9 years agoMerge branch 'ls/test-must-fail-sigpipe'
Junio C Hamano [Tue, 8 Dec 2015 22:14:49 +0000 (14:14 -0800)]
Merge branch 'ls/test-must-fail-sigpipe'

Fix some racy client/server tests by treating SIGPIPE the same as a
normal non-zero exit.

* ls/test-must-fail-sigpipe:
  add "ok=sigpipe" to test_must_fail and use it to fix flaky tests
  implement test_might_fail using a refactored test_must_fail

9 years agoMerge branch 'dt/refs-backend-pre-vtable'
Junio C Hamano [Tue, 8 Dec 2015 22:14:49 +0000 (14:14 -0800)]
Merge branch 'dt/refs-backend-pre-vtable'

Code preparation for pluggable ref backends.

* dt/refs-backend-pre-vtable:
  refs: break out ref conflict checks
  files_log_ref_write: new function
  initdb: make safe_create_dir public
  refs: split filesystem-based refs code into a new file
  refs/refs-internal.h: new header file
  refname_is_safe(): improve docstring
  pack_if_possible_fn(): use ref_type() instead of is_per_worktree_ref()
  copy_msg(): rename to copy_reflog_msg()
  verify_refname_available(): new function
  verify_refname_available(): rename function

9 years agoSync with 2.6.4
Junio C Hamano [Tue, 8 Dec 2015 22:13:52 +0000 (14:13 -0800)]
Sync with 2.6.4

9 years agoGit 2.6.4 v2.6.4
Junio C Hamano [Tue, 8 Dec 2015 22:07:30 +0000 (14:07 -0800)]
Git 2.6.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoMerge branch 'rs/status-detached-head-memcmp' into maint
Junio C Hamano [Tue, 8 Dec 2015 22:11:32 +0000 (14:11 -0800)]
Merge branch 'rs/status-detached-head-memcmp' into maint

Fix some string-matching corner cases when digging in the reflog for
"git status".

* rs/status-detached-head-memcmp:
  wt-status: correct and simplify check for detached HEAD

9 years agoMerge branch 'ad/sha1-update-chunked' into maint
Junio C Hamano [Tue, 8 Dec 2015 22:05:03 +0000 (14:05 -0800)]
Merge branch 'ad/sha1-update-chunked' into maint

Apple's common crypto implementation of SHA1_Update() does not take
more than 4GB at a time, and we now have a compile-time workaround
for it.

* ad/sha1-update-chunked:
  sha1: allow limiting the size of the data passed to SHA1_Update()
  sha1: provide another level of indirection for the SHA-1 functions

9 years agoMerge branch 'sg/bash-prompt-dirty-orphan' into maint
Junio C Hamano [Tue, 8 Dec 2015 22:05:02 +0000 (14:05 -0800)]
Merge branch 'sg/bash-prompt-dirty-orphan' into maint

Produce correct "dirty" marker for shell prompts, even when we
are on an orphan or an unborn branch.

* sg/bash-prompt-dirty-orphan:
  bash prompt: indicate dirty index even on orphan branches
  bash prompt: remove a redundant 'git diff' option
  bash prompt: test dirty index and worktree while on an orphan branch

9 years agoMerge branch 'jk/interpret-trailers-outside-a-repository' into maint
Junio C Hamano [Tue, 8 Dec 2015 22:05:02 +0000 (14:05 -0800)]
Merge branch 'jk/interpret-trailers-outside-a-repository' into maint

Allow "git interpret-trailers" to run outside of a Git repository.

* jk/interpret-trailers-outside-a-repository:
  interpret-trailers: allow running outside a repository

9 years agoMerge branch 'jk/rebase-no-autostash' into maint
Junio C Hamano [Tue, 8 Dec 2015 22:05:00 +0000 (14:05 -0800)]
Merge branch 'jk/rebase-no-autostash' into maint

There was no way to defeat a configured rebase.autostash variable
from the command line, as "git rebase --no-autostash" was missing.

* jk/rebase-no-autostash:
  Documentation/git-rebase: fix --no-autostash formatting
  rebase: support --no-autostash

9 years agorevision.c: fix possible null pointer arithmetic
Stefan Naewe [Sat, 5 Dec 2015 15:27:24 +0000 (16:27 +0100)]
revision.c: fix possible null pointer arithmetic

mark_tree_uninteresting() dereferences a tree pointer before
checking if the pointer is valid. Fix that by doing the check first.

Signed-off-by: Stefan Naewe <stefan.naewe@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agot3404: fix quoting of redirect for some versions of bash
Charles Bailey [Wed, 2 Dec 2015 20:50:07 +0000 (20:50 +0000)]
t3404: fix quoting of redirect for some versions of bash

As CodingGuidelines says, some versions of bash errors out when
$variable substitution is used as the target for redirection without
being quoted (even though POSIX may not require such a quote).

Signed-off-by: Charles Bailey <cbailey32@bloomberg.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agogit-check-ref-format.txt: typo, s/avoids/avoid/
Nguyễn Thái Ngọc Duy [Fri, 4 Dec 2015 18:09:32 +0000 (19:09 +0100)]
git-check-ref-format.txt: typo, s/avoids/avoid/

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agodocument submodule sync --recursive
Stefan Beller [Thu, 3 Dec 2015 20:41:02 +0000 (12:41 -0800)]
document submodule sync --recursive

The git-submodule(1) is inconsistent. In the synopsis, it says:

       git submodule [--quiet] sync [--recursive] [--] [<path>...]

The description of the sync does not mention --recursive, and the
description of --recursive says that it is only available for foreach,
update and status.

The option was introduced (82f49f294c, Teach --recursive to submodule
sync, 2012-10-26) a while ago, so let's document it, too.

Reported-by: Per Cederqvist <cederp@opera.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoSync with maint
Junio C Hamano [Fri, 4 Dec 2015 19:39:56 +0000 (11:39 -0800)]
Sync with maint

* maint:
  Prepare for 2.6.4

9 years agoPrepare for 2.6.4
Junio C Hamano [Fri, 4 Dec 2015 19:39:19 +0000 (11:39 -0800)]
Prepare for 2.6.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoMerge branch 'da/difftool' into maint
Junio C Hamano [Fri, 4 Dec 2015 19:34:24 +0000 (11:34 -0800)]
Merge branch 'da/difftool' into maint

The code to prepare the working tree side of temporary directory
for the "dir-diff" feature forgot that symbolic links need not be
copied (or symlinked) to the temporary area, as the code already
special cases and overwrites them.  Besides, it was wrong to try
computing the object name of the target of symbolic link, which may
not even exist or may be a directory.

* da/difftool:
  difftool: ignore symbolic links in use_wt_file

9 years agoMerge branch 'dk/gc-idx-wo-pack' into maint
Junio C Hamano [Fri, 4 Dec 2015 19:33:07 +0000 (11:33 -0800)]
Merge branch 'dk/gc-idx-wo-pack' into maint

Having a leftover .idx file without corresponding .pack file in
the repository hurts performance; "git gc" learned to prune them.

We may want to do the same for .bitmap (and notice but not prune
.keep) without corresponding .pack, but that can be a separate
topic.

* dk/gc-idx-wo-pack:
  gc: remove garbage .idx files from pack dir
  t5304: test cleaning pack garbage
  prepare_packed_git(): refactor garbage reporting in pack directory

9 years agoRelNotes update for 2.7
Junio C Hamano [Fri, 4 Dec 2015 19:31:28 +0000 (11:31 -0800)]
RelNotes update for 2.7

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoMerge branch 'sg/bash-prompt-dirty-orphan'
Junio C Hamano [Fri, 4 Dec 2015 19:19:12 +0000 (11:19 -0800)]
Merge branch 'sg/bash-prompt-dirty-orphan'

Produce correct "dirty" marker for shell prompts, even when we
are on an orphan or an unborn branch.

* sg/bash-prompt-dirty-orphan:
  bash prompt: indicate dirty index even on orphan branches
  bash prompt: remove a redundant 'git diff' option
  bash prompt: test dirty index and worktree while on an orphan branch

9 years agoMerge branch 'np/credential-cache-sighup'
Junio C Hamano [Fri, 4 Dec 2015 19:19:11 +0000 (11:19 -0800)]
Merge branch 'np/credential-cache-sighup'

Workaround for using credential-cache with emacs.

* np/credential-cache-sighup:
  credential-cache: new option to ignore sighup

9 years agoMerge branch 'rs/parseopt-short-help'
Junio C Hamano [Fri, 4 Dec 2015 19:19:11 +0000 (11:19 -0800)]
Merge branch 'rs/parseopt-short-help'

Make "-h" command line option work more consistently in all commands.

* rs/parseopt-short-help:
  show-ref: stop using PARSE_OPT_NO_INTERNAL_HELP
  grep: stop using PARSE_OPT_NO_INTERNAL_HELP
  parse-options: allow -h as a short option
  parse-options: inline parse_options_usage() at its only remaining caller
  parse-options: deduplicate parse_options_usage() calls

9 years agoMerge branch 'jk/send-email-complete-aliases'
Junio C Hamano [Fri, 4 Dec 2015 19:19:10 +0000 (11:19 -0800)]
Merge branch 'jk/send-email-complete-aliases'

Teach send-email to dump mail aliases, so that we can do tab completion
on the command line.

* jk/send-email-complete-aliases:
  completion: add support for completing email aliases
  sendemail: teach git-send-email to dump alias names

9 years agoMerge branch 'jk/filter-branch-no-index'
Junio C Hamano [Fri, 4 Dec 2015 19:19:10 +0000 (11:19 -0800)]
Merge branch 'jk/filter-branch-no-index'

Speed up filter-branch for cases where we only care about rewriting
commits, not tree data.

* jk/filter-branch-no-index:
  filter-branch: skip index read/write when possible

9 years agoMerge branch 'ad/sha1-update-chunked'
Junio C Hamano [Fri, 4 Dec 2015 19:19:09 +0000 (11:19 -0800)]
Merge branch 'ad/sha1-update-chunked'

Apple's common crypto implementation of SHA1_Update() does not take
more than 4GB at a time, and we now have a compile-time workaround
for it.

* ad/sha1-update-chunked:
  sha1: allow limiting the size of the data passed to SHA1_Update()
  sha1: provide another level of indirection for the SHA-1 functions

9 years agoMerge branch 'mk/blame-first-parent'
Jeff King [Tue, 1 Dec 2015 23:54:58 +0000 (18:54 -0500)]
Merge branch 'mk/blame-first-parent'

Regression fix for a topic already in master.

* mk/blame-first-parent:
  blame: fix object casting regression

9 years agoMerge branch 'jk/send-email-ca-path'
Jeff King [Tue, 1 Dec 2015 23:54:54 +0000 (18:54 -0500)]
Merge branch 'jk/send-email-ca-path'

Use a safer behavior when we hit errors verifying remote certificates.

* jk/send-email-ca-path:
  send-email: die if CA path doesn't exist

9 years agoMerge branch 'rs/fsck-nul-header'
Jeff King [Tue, 1 Dec 2015 23:54:47 +0000 (18:54 -0500)]
Merge branch 'rs/fsck-nul-header'

Fsck did not correctly detect a NUL-truncated header in a tag.

* rs/fsck-nul-header:
  fsck: treat a NUL in a tag header as an error
  t1450: add tests for NUL in headers of commits and tags

9 years agoMerge branch 'ls/p4-test-timeouts'
Jeff King [Tue, 1 Dec 2015 23:54:40 +0000 (18:54 -0500)]
Merge branch 'ls/p4-test-timeouts'

Work around some test flakiness with p4d.

* ls/p4-test-timeouts:
  git-p4: add trap to kill p4d on test exit
  git-p4: add p4d timeout in tests
  git-p4: retry kill/cleanup operations in tests with timeout

9 years agoMerge branch 'js/test-modernize-t9300'
Jeff King [Tue, 1 Dec 2015 23:54:37 +0000 (18:54 -0500)]
Merge branch 'js/test-modernize-t9300'

Clean up style in an ancient test.

* js/test-modernize-t9300:
  modernize t9300: move test preparations into test_expect_success
  modernize t9300: mark here-doc words to ignore tab indentation
  modernize t9300: use test_when_finished for clean-up
  modernize t9300: wrap lines after &&
  modernize t9300: use test_must_be_empty
  modernize t9300: use test_must_fail
  modernize t9300: single-quote placement and indentation

9 years agoMerge branch 'jk/send-email-expand-paths'
Jeff King [Tue, 1 Dec 2015 23:54:34 +0000 (18:54 -0500)]
Merge branch 'jk/send-email-expand-paths'

Expand paths in some send-email config variables.

* jk/send-email-expand-paths:
  send-email: expand path in sendemail.smtpsslcertpath config

9 years agoMerge branch 'dg/subtree-test-cleanup'
Jeff King [Tue, 1 Dec 2015 23:54:31 +0000 (18:54 -0500)]
Merge branch 'dg/subtree-test-cleanup'

Test cleanups for the subtree project.

* dg/subtree-test-cleanup:
  contrib/subtree: Handle '--prefix' argument with a slash appended
  contrib/subtree: Make each test self-contained
  contrib/subtree: Add split tests
  contrib/subtree: Add merge tests
  contrib/subtree: Add tests for subtree add
  contrib/subtree: Add test for missing subtree
  contrib/subtree: Clean and refactor test code

9 years agoMerge branch 'dt/http-range'
Jeff King [Tue, 1 Dec 2015 23:54:28 +0000 (18:54 -0500)]
Merge branch 'dt/http-range'

Portability fix for a topic already in 'master'.

* dt/http-range:
  http: fix some printf format warnings

9 years agoverify_pack: do not ignore return value of verification function
David Turner [Mon, 30 Nov 2015 22:47:42 +0000 (17:47 -0500)]
verify_pack: do not ignore return value of verification function

In verify_pack, a caller-supplied verification function is called.
The function returns an int.  If that return value is non-zero,
verify_pack should fail.

The only caller of verify_pack is in builtin/fsck.c, whose verify_fn
returns a meaningful error code (which was then ignored).  Now, fsck
might return a different error code (with more detail).  This would
happen in the unlikely event that a commit or tree that is a valid git
object but not a valid instance of its type gets into a pack.

Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Jeff King <peff@peff.net>
9 years agoMake error message after failing commit_lock_file() less confusing
SZEDER Gábor [Mon, 30 Nov 2015 11:40:53 +0000 (12:40 +0100)]
Make error message after failing commit_lock_file() less confusing

The error message after a failing commit_lock_file() call sometimes
looks like this, causing confusion:

  $ git remote add remote git@server.com/repo.git
  error: could not commit config file .git/config
  # Huh?!
  # I didn't want to commit anything, especially not my config file!

While in the narrow context of the lockfile module using the verb
'commit' in the error message makes perfect sense, in the broader
context of git the word 'commit' already has a very specific meaning,
hence the confusion.

Reword these error messages to say "could not write" instead of "could
not commit".

While at it, include strerror in the error messages after writing the
config file or the credential store fails to provide some information
about the cause of the failure, and update the style of the error
message after writing the reflog fails to match surrounding error
messages (i.e. no '' around the pathname and no () around the error
description).

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Jeff King <peff@peff.net>
9 years agoMerge branch 'maint'
Jeff King [Tue, 1 Dec 2015 22:32:38 +0000 (17:32 -0500)]
Merge branch 'maint'

* maint:
  http: treat config options sslCAPath and sslCAInfo as paths
  Documentation/diff: give --word-diff-regex=. example
  filter-branch: deal with object name vs. pathname ambiguity in tree-filter
  check-ignore: correct documentation about output
  git-p4: clean up after p4 submit failure
  git-p4: work with a detached head
  git-p4: add option to system() to return subshell status
  git-p4: add failing test for submit from detached head
  remote-http(s): support SOCKS proxies
  t5813: avoid creating urls that break on cygwin
  Escape Git's exec path in contrib/rerere-train.sh script
  allow hooks to ignore their standard input stream
  rebase-i-exec: Allow space in SHELL_PATH
  Documentation: make environment variable formatting more consistent

9 years agoMerge branch 'eg/p4-submit-catch-failure' into maint
Jeff King [Tue, 1 Dec 2015 22:24:20 +0000 (17:24 -0500)]
Merge branch 'eg/p4-submit-catch-failure' into maint

Just like the working tree is cleaned up when the user cancelled
submission in P4Submit.applyCommit(), clean up the mess if "p4
submit" fails.

* eg/p4-submit-catch-failure:
  git-p4: clean up after p4 submit failure

9 years agoMerge branch 'dk/check-ignore-docs' into maint
Jeff King [Tue, 1 Dec 2015 22:21:31 +0000 (17:21 -0500)]
Merge branch 'dk/check-ignore-docs' into maint

Documentation clarification for "check-ignore" without "--verbose".

* dk/check-ignore-docs:
  check-ignore: correct documentation about output

9 years agoMerge branch 'ld/p4-detached-head' into maint
Jeff King [Tue, 1 Dec 2015 22:21:29 +0000 (17:21 -0500)]
Merge branch 'ld/p4-detached-head' into maint

Make git-p4 work on a detached head.

* ld/p4-detached-head:
  git-p4: work with a detached head
  git-p4: add option to system() to return subshell status
  git-p4: add failing test for submit from detached head

9 years agoMerge branch 'sg/filter-branch-dwim-ambiguity' into maint
Jeff King [Tue, 1 Dec 2015 22:21:17 +0000 (17:21 -0500)]
Merge branch 'sg/filter-branch-dwim-ambiguity' into maint

Fix for a corner case in filter-branch.

* sg/filter-branch-dwim-ambiguity:
  filter-branch: deal with object name vs. pathname ambiguity in tree-filter

9 years agoMerge branch 'mg/doc-word-diff-example' into maint
Jeff King [Tue, 1 Dec 2015 22:21:11 +0000 (17:21 -0500)]
Merge branch 'mg/doc-word-diff-example' into maint

* mg/doc-word-diff-example:
  Documentation/diff: give --word-diff-regex=. example

9 years agoMerge branch 'cb/ssl-config-pathnames' into maint
Jeff King [Tue, 1 Dec 2015 22:21:01 +0000 (17:21 -0500)]
Merge branch 'cb/ssl-config-pathnames' into maint

Allow tilde-expansion in some http config variables.

* cb/ssl-config-pathnames:
  http: treat config options sslCAPath and sslCAInfo as paths

9 years agoMerge branch 'dk/t5813-unc-paths' into maint
Jeff King [Tue, 1 Dec 2015 22:20:52 +0000 (17:20 -0500)]
Merge branch 'dk/t5813-unc-paths' into maint

Test portability fix for a topic in v2.6.1.

* dk/t5813-unc-paths:
  t5813: avoid creating urls that break on cygwin

9 years agoMerge branch 'dk/rerere-train-quoting' into maint
Jeff King [Tue, 1 Dec 2015 22:20:46 +0000 (17:20 -0500)]
Merge branch 'dk/rerere-train-quoting' into maint

Fix shell quoting in contrib script.

* dk/rerere-train-quoting:
  Escape Git's exec path in contrib/rerere-train.sh script

9 years agoMerge branch 'cb/hook-sigpipe' into maint
Jeff King [Tue, 1 Dec 2015 22:19:52 +0000 (17:19 -0500)]
Merge branch 'cb/hook-sigpipe' into maint

We now consistently allow all hooks to ignore their standard input,
rather than having git complain of SIGPIPE.

* cb/hook-sigpipe:
  allow hooks to ignore their standard input stream

9 years agoMerge branch 'fm/shell-path-whitespace' into maint
Jeff King [Tue, 1 Dec 2015 22:19:37 +0000 (17:19 -0500)]
Merge branch 'fm/shell-path-whitespace' into maint

Portability fix for Windows, which may rewrite $SHELL variable using
non-POSIX paths.

* fm/shell-path-whitespace:
  rebase-i-exec: Allow space in SHELL_PATH

9 years agoMerge branch 'ar/doc-env-variable-format' into maint
Jeff King [Tue, 1 Dec 2015 22:19:33 +0000 (17:19 -0500)]
Merge branch 'ar/doc-env-variable-format' into maint

Minor documentation fixup.

* ar/doc-env-variable-format:
  Documentation: make environment variable formatting more consistent

9 years agoMerge branch 'pt/http-socks-proxy' into maint
Jeff King [Tue, 1 Dec 2015 22:19:12 +0000 (17:19 -0500)]
Merge branch 'pt/http-socks-proxy' into maint

Add support for talking http/https over socks proxy.

* pt/http-socks-proxy:
  remote-http(s): support SOCKS proxies

9 years agoMerge branch 'rc/configure-use-libs-when-checking-a-lib' into maint
Jeff King [Tue, 1 Dec 2015 22:19:06 +0000 (17:19 -0500)]
Merge branch 'rc/configure-use-libs-when-checking-a-lib' into maint

The "configure" script did not test for -lpthread correctly, which
upset some linkers.

* rc/configure-use-libs-when-checking-a-lib:
  configure.ac: use $LIBS not $CFLAGS when testing -lpthread

9 years agowt-status: correct and simplify check for detached HEAD
René Scharfe [Wed, 25 Nov 2015 14:10:18 +0000 (15:10 +0100)]
wt-status: correct and simplify check for detached HEAD

If a branch name is longer than four characters then memcmp() reads over
the end of the static string "HEAD".  This causes the following test
failures with AddressSanitizer:

t3203-branch-output.sh                           (Wstat: 256 Tests: 18 Failed: 4)
  Failed tests:  12, 15-17
  Non-zero exit status: 1
t3412-rebase-root.sh                             (Wstat: 256 Tests: 31 Failed: 3)
  Failed tests:  28-29, 31
  Non-zero exit status: 1
t3507-cherry-pick-conflict.sh                    (Wstat: 256 Tests: 31 Failed: 4)
  Failed tests:  14, 29-31
  Non-zero exit status: 1
t3510-cherry-pick-sequence.sh                    (Wstat: 256 Tests: 39 Failed: 14)
  Failed tests:  17, 22-26, 28-30, 34-35, 37-39
  Non-zero exit status: 1
t3420-rebase-autostash.sh                        (Wstat: 256 Tests: 28 Failed: 4)
  Failed tests:  24-27
  Non-zero exit status: 1
t3404-rebase-interactive.sh                      (Wstat: 256 Tests: 91 Failed: 57)
  Failed tests:  17, 19, 21-42, 44, 46-74, 77, 81-82
  Non-zero exit status: 1
t3900-i18n-commit.sh                             (Wstat: 256 Tests: 34 Failed: 1)
  Failed test:  34
  Non-zero exit status: 1
t5407-post-rewrite-hook.sh                       (Wstat: 256 Tests: 14 Failed: 6)
  Failed tests:  9-14
  Non-zero exit status: 1
t7001-mv.sh                                      (Wstat: 256 Tests: 46 Failed: 5)
  Failed tests:  39-43
  Non-zero exit status: 1
t7509-commit.sh                                  (Wstat: 256 Tests: 12 Failed: 2)
  Failed tests:  11-12
  Non-zero exit status: 1
t7512-status-help.sh                             (Wstat: 256 Tests: 39 Failed: 35)
  Failed tests:  5-39
  Non-zero exit status: 1
t6030-bisect-porcelain.sh                        (Wstat: 256 Tests: 70 Failed: 1)
  Failed test:  13
  Non-zero exit status: 1

And if a branch is named "H", "HE", or "HEA" then the current if clause
erroneously considers it as matching "HEAD" because it only compares
up to the end of the branch name.

Fix that by doing the comparison using strcmp() and only after the
branch name is extracted.  This way neither too less nor too many
characters are checked.  While at it call strchrnul() to find the end
of the branch name instead of open-coding it.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Jeff King <peff@peff.net>
9 years agoident.c: add support for IPv6
Elia Pinto [Fri, 27 Nov 2015 14:08:27 +0000 (14:08 +0000)]
ident.c: add support for IPv6

Add IPv6 support by implementing name resolution with the
protocol agnostic getaddrinfo(3) API. The old gethostbyname(3)
code is still available when git is compiled with NO_IPV6.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Helped-by: Jeff King <peff@peff.net>
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Jeff King <peff@peff.net>