]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
7 years agotmp-objdir: introduce API for temporary object directories
Jeff King [Mon, 3 Oct 2016 20:49:11 +0000 (16:49 -0400)] 
tmp-objdir: introduce API for temporary object directories

Once objects are added to the object database by a process,
they cannot easily be deleted, as we don't know what other
processes may have started referencing them. We have to
clean them up with git-gc, which will apply the usual
reachability and grace-period checks.

This patch provides an alternative: it helps callers create
a temporary directory inside the object directory, and a
temporary environment which can be passed to sub-programs to
ask them to write there (the original object directory
remains accessible as an alternate of the temporary one).

See tmp-objdir.h for details on the API.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agocheck_connected: accept an env argument
Jeff King [Mon, 3 Oct 2016 20:49:08 +0000 (16:49 -0400)] 
check_connected: accept an env argument

This lets callers influence the environment seen by
rev-list, which will be useful when we start providing
quarantined objects.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoalternates: use fspathcmp to detect duplicates
Jeff King [Mon, 3 Oct 2016 20:36:26 +0000 (16:36 -0400)] 
alternates: use fspathcmp to detect duplicates

On a case-insensitive filesystem, we should realize that
"a/objects" and "A/objects" are the same path. We already
use fspathcmp() to check against the main object directory,
but until recently we couldn't use it for comparing against
other alternates (because their paths were not
NUL-terminated strings). But now we can, so let's do so.

Note that we also need to adjust count-objects to load the
config, so that it can see the setting of core.ignorecase
(this is required by the test, but is also a general bugfix
for users of count-objects).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agosha1_file: always allow relative paths to alternates
Jeff King [Mon, 3 Oct 2016 20:36:22 +0000 (16:36 -0400)] 
sha1_file: always allow relative paths to alternates

We recursively expand alternates repositories, so that if A
borrows from B which borrows from C, A can see all objects.

For the root object database, we allow relative paths, so A
can point to B as "../B/objects". However, we currently do
not allow relative paths when recursing, so B must use an
absolute path to reach C.

That is an ancient protection from c2f493a (Transitively
read alternatives, 2006-05-07) that tries to avoid adding
the same alternate through two different paths. Since
5bdf0a8 (sha1_file: normalize alt_odb path before comparing
and storing, 2011-09-07), we use a normalized absolute path
for each alt_odb entry.

This means that in most cases the protection is no longer
necessary; we will detect the duplicate no matter how we got
there (but see below).  And it's a good idea to get rid of
it, as it creates an unnecessary complication when setting
up recursive alternates (B has to know that A is going to
borrow from it and make sure to use an absolute path).

Note that our normalization doesn't actually look at the
filesystem, so it can still be fooled by crossing symbolic
links. But that's also true of absolute paths, so it's not a
good reason to disallow only relative paths (it's
potentially a reason to switch to real_path(), but that's a
separate and non-trivial change).

We adjust the test script here to demonstrate that this now
works, and add new tests to show that the normalization does
indeed suppress duplicates.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agocount-objects: report alternates via verbose mode
Jeff King [Mon, 3 Oct 2016 20:36:18 +0000 (16:36 -0400)] 
count-objects: report alternates via verbose mode

There's no way to get the list of alternates that git
computes internally; our tests only infer it based on which
objects are available. In addition to testing, knowing this
list may be helpful for somebody debugging their alternates
setup.

Let's add it to the "count-objects -v" output. We could give
it a separate flag, but there's not really any need.
"count-objects -v" is already a debugging catch-all for the
object database, its output is easily extensible to new data
items, and printing the alternates is not expensive (we
already had to find them to count the objects).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agofill_sha1_file: write into a strbuf
Jeff King [Mon, 3 Oct 2016 20:36:09 +0000 (16:36 -0400)] 
fill_sha1_file: write into a strbuf

It's currently the responsibility of the caller to give
fill_sha1_file() enough bytes to write into, leading them to
manually compute the required lengths. Instead, let's just
write into a strbuf so that it's impossible to get this
wrong.

The alt_odb caller already has a strbuf, so this makes
things strictly simpler. The other caller, sha1_file_name(),
uses a static PATH_MAX buffer and dies when it would
overflow. We can convert this to a static strbuf, which
means our allocation cost is amortized (and as a bonus, we
no longer have to worry about PATH_MAX being too short for
normal use).

This does introduce some small overhead in fill_sha1_file(),
as each strbuf_addchar() will check whether it needs to
grow. However, between the optimization in fec501d
(strbuf_addch: avoid calling strbuf_grow, 2015-04-16) and
the fact that this is not generally called in a tight loop
(after all, the next step is typically to access the file!)
this probably doesn't matter. And even if it did, the right
place to micro-optimize is inside fill_sha1_file(), by
calling a single strbuf_grow() there.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoalternates: store scratch buffer as strbuf
Jeff King [Mon, 3 Oct 2016 20:36:04 +0000 (16:36 -0400)] 
alternates: store scratch buffer as strbuf

We pre-size the scratch buffer to hold a loose object
filename of the form "xx/yyyy...", which leads to allocation
code that is hard to verify. We have to use some magic
numbers during the initial allocation, and then writers must
blindly assume that the buffer is big enough. Using a strbuf
makes it more clear that we cannot overflow.

Unfortunately, we do still need some magic numbers to grow
our strbuf before calling fill_sha1_path(), but the strbuf
growth is much closer to the point of use. This makes it
easier to see that it's correct, and opens the possibility
of pushing it even further down if fill_sha1_path() learns
to work on strbufs.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agofill_sha1_file: write "boring" characters
Jeff King [Mon, 3 Oct 2016 20:35:55 +0000 (16:35 -0400)] 
fill_sha1_file: write "boring" characters

This function forms a sha1 as "xx/yyyy...", but skips over
the slot for the slash rather than writing it, leaving it to
the caller to do so. It also does not bother to put in a
trailing NUL, even though every caller would want it (we're
forming a path which by definition is not a directory, so
the only thing to do with it is feed it to a system call).

Let's make the lives of our callers easier by just writing
out the internal "/" and the NUL.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoalternates: use a separate scratch space
Jeff King [Mon, 3 Oct 2016 20:35:51 +0000 (16:35 -0400)] 
alternates: use a separate scratch space

The alternate_object_database struct uses a single buffer
both for storing the path to the alternate, and as a scratch
buffer for forming object names. This is efficient (since
otherwise we'd end up storing the path twice), but it makes
life hard for callers who just want to know the path to the
alternate. They have to remember to stop reading after
"alt->name - alt->base" bytes, and to subtract one for the
trailing '/'.

It would be much simpler if they could simply access a
NUL-terminated path string. We could encapsulate this in a
function which puts a NUL in the scratch buffer and returns
the string, but that opens up questions about the lifetime
of the result. The first time another caller uses the
alternate, the scratch buffer may get other data tacked onto
it.

Let's instead just store the root path separately from the
scratch buffer. There aren't enough alternates being stored
for the duplicated data to matter for performance, and this
keeps things simple and safe for the callers.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoalternates: encapsulate alt->base munging
Jeff King [Mon, 3 Oct 2016 20:35:43 +0000 (16:35 -0400)] 
alternates: encapsulate alt->base munging

The alternate_object_database struct holds a path to the
alternate objects, but we also use that buffer as scratch
space for forming loose object filenames. Let's pull that
logic into a helper function so that we can more easily
modify it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoalternates: provide helper for allocating alternate
Jeff King [Mon, 3 Oct 2016 20:35:31 +0000 (16:35 -0400)] 
alternates: provide helper for allocating alternate

Allocating a struct alternate_object_database is tricky, as
we must over-allocate the buffer to provide scratch space,
and then put in particular '/' and NUL markers.

Let's encapsulate this in a function so that the complexity
doesn't leak into callers (and so that we can modify it
later).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoalternates: provide helper for adding to alternates list
Jeff King [Mon, 3 Oct 2016 20:35:03 +0000 (16:35 -0400)] 
alternates: provide helper for adding to alternates list

The submodule code wants to temporarily add an alternate
object store to our in-memory alt_odb list, but does it
manually. Let's provide a helper so it can reuse the code in
link_alt_odb_entry().

While we're adding our new add_to_alternates_memory(), let's
document add_to_alternates_file(), as the two are related.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agolink_alt_odb_entry: refactor string handling
Jeff King [Mon, 3 Oct 2016 20:34:48 +0000 (16:34 -0400)] 
link_alt_odb_entry: refactor string handling

The string handling in link_alt_odb_entry() is mostly an
artifact of the original version, which took the path as a
ptr/len combo, and did not have a NUL-terminated string
until we created one in the alternate_object_database
struct.  But since 5bdf0a8 (sha1_file: normalize alt_odb
path before comparing and storing, 2011-09-07), the first
thing we do is put the path into a strbuf, which gives us
some easy opportunities for cleanup.

In particular:

  - we call strlen(pathbuf.buf), which is silly; we can look
    at pathbuf.len.

  - even though we have a strbuf, we don't maintain its
    "len" field when chomping extra slashes from the
    end, and instead keep a separate "pfxlen" variable. We
    can fix this and then drop "pfxlen" entirely.

  - we don't check whether the path is usable until after we
    allocate the new struct, making extra cleanup work for
    ourselves. Since we have a NUL-terminated string, we can
    bump the "is it usable" checks higher in the function.
    While we're at it, we can move that logic to its own
    helper, which makes the flow of link_alt_odb_entry()
    easier to follow.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agolink_alt_odb_entry: handle normalize_path errors
Jeff King [Mon, 3 Oct 2016 20:34:17 +0000 (16:34 -0400)] 
link_alt_odb_entry: handle normalize_path errors

When we add a new alternate to the list, we try to normalize
out any redundant "..", etc. However, we do not look at the
return value of normalize_path_copy(), and will happily
continue with a path that could not be normalized. Worse,
the normalizing process is done in-place, so we are left
with whatever half-finished working state the normalizing
function was in.

Fortunately, this cannot cause us to read past the end of
our buffer, as that working state will always leave the
NUL from the original path in place. And we do tend to
notice problems when we check is_directory() on the path.
But you can see the nonsense that we feed to is_directory
with an entry like:

  this/../../is/../../way/../../too/../../deep/../../to/../../resolve

in your objects/info/alternates, which yields:

  error: object directory
  /to/e/deep/too/way//ects/this/../../is/../../way/../../too/../../deep/../../to/../../resolve
  does not exist; check .git/objects/info/alternates.

We can easily fix this just by checking the return value.
But that makes it hard to generate a good error message,
since we're normalizing in-place and our input value has
been overwritten by cruft.

Instead, let's provide a strbuf helper that does an in-place
normalize, but restores the original contents on error. This
uses a second buffer under the hood, which is slightly less
efficient, but this is not a performance-critical code path.

The strbuf helper can also properly set the "len" parameter
of the strbuf before returning. Just doing:

  normalize_path_copy(buf.buf, buf.buf);

will shorten the string, but leave buf.len at the original
length. That may be confusing to later code which uses the
strbuf.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agot5613: clarify "too deep" recursion tests
Jeff King [Mon, 3 Oct 2016 20:34:12 +0000 (16:34 -0400)] 
t5613: clarify "too deep" recursion tests

These tests are just trying to show that we allow recursion
up to a certain depth, but not past it. But the counting is
a bit non-intuitive, and rather than test at the edge of the
breakage, we test "OK" cases in the middle of the chain.
Let's explain what's going on, and explicitly test the
switch between "OK" and "too deep".

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agot5613: do not chdir in main process
Jeff King [Mon, 3 Oct 2016 20:34:08 +0000 (16:34 -0400)] 
t5613: do not chdir in main process

Our usual style when working with subdirectories is to chdir
inside a subshell or to use "git -C", which means we do not
have to constantly return to the main test directory. Let's
convert this old test, which does not follow that style.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agot5613: whitespace/style cleanups
Jeff King [Mon, 3 Oct 2016 20:34:05 +0000 (16:34 -0400)] 
t5613: whitespace/style cleanups

Our normal test style these days puts the opening quote of
the body on the description line, and indents the body with
a single tab. This ancient test did not follow this.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agot5613: use test_must_fail
Jeff King [Mon, 3 Oct 2016 20:34:01 +0000 (16:34 -0400)] 
t5613: use test_must_fail

Besides being our normal style, this correctly checks for an
error exit() versus signal death.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agot5613: drop test_valid_repo function
Jeff King [Mon, 3 Oct 2016 20:33:58 +0000 (16:33 -0400)] 
t5613: drop test_valid_repo function

This function makes sure that "git fsck" does not report any
errors. But "--full" has been the default since f29cd39
(fsck: default to "git fsck --full", 2009-10-20), and we can
use the exit code (instead of counting the lines) since
e2b4f63 (fsck: exit with non-zero status upon errors,
2007-03-05).

So we can just use "git fsck", which is shorter and more
flexible (e.g., we can use "git -C").

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agot5613: drop reachable_via function
Jeff King [Mon, 3 Oct 2016 20:33:51 +0000 (16:33 -0400)] 
t5613: drop reachable_via function

This function was never used since its inception in dd05ea1
(test case for transitive info/alternates, 2006-05-07).
Which is just as well, since it mutates the repo state in a
way that would invalidate further tests, without cleaning up
after itself. Let's get rid of it so that nobody is tempted
to use it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoSync with 2.10.1
Junio C Hamano [Mon, 3 Oct 2016 20:32:41 +0000 (13:32 -0700)] 
Sync with 2.10.1

* maint:
  Git 2.10.1

7 years agoSeventh batch for 2.11
Junio C Hamano [Mon, 3 Oct 2016 20:32:19 +0000 (13:32 -0700)] 
Seventh batch for 2.11

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoMerge branch 'pb/rev-list-reverse-with-count'
Junio C Hamano [Mon, 3 Oct 2016 20:30:39 +0000 (13:30 -0700)] 
Merge branch 'pb/rev-list-reverse-with-count'

Doc update to clarify what "log -3 --reverse" does.

* pb/rev-list-reverse-with-count:
  rev-list-options: clarify the usage of --reverse

7 years agoMerge branch 'dt/tree-fsck'
Junio C Hamano [Mon, 3 Oct 2016 20:30:38 +0000 (13:30 -0700)] 
Merge branch 'dt/tree-fsck'

The codepath in "git fsck" to detect malformed tree objects has
been updated not to die but keep going after detecting them.

* dt/tree-fsck:
  fsck: handle bad trees like other errors
  tree-walk: be more specific about corrupt tree errors

7 years agoMerge branch 'kd/mailinfo-quoted-string'
Junio C Hamano [Mon, 3 Oct 2016 20:30:38 +0000 (13:30 -0700)] 
Merge branch 'kd/mailinfo-quoted-string'

An author name, that spelled a backslash-quoted double quote in the
human readable part "My \"double quoted\" name", was not unquoted
correctly while applying a patch from a piece of e-mail.

* kd/mailinfo-quoted-string:
  mailinfo: unescape quoted-pair in header fields
  t5100-mailinfo: replace common path prefix with variable

7 years agoMerge branch 'mh/diff-indent-heuristic'
Junio C Hamano [Mon, 3 Oct 2016 20:30:38 +0000 (13:30 -0700)] 
Merge branch 'mh/diff-indent-heuristic'

Clean-up for a recently graduated topic.

* mh/diff-indent-heuristic:
  xdiff: rename "struct group" to "struct xdlgroup"

7 years agoMerge branch 'dt/mailinfo'
Junio C Hamano [Mon, 3 Oct 2016 20:30:37 +0000 (13:30 -0700)] 
Merge branch 'dt/mailinfo'

* dt/mailinfo:
  add David Turner's Two Sigma address

7 years agoMerge branch 'va/git-gui-i18n'
Junio C Hamano [Mon, 3 Oct 2016 20:30:37 +0000 (13:30 -0700)] 
Merge branch 'va/git-gui-i18n'

"git gui" l10n to Portuguese.

* va/git-gui-i18n:
  git-gui: l10n: add Portuguese translation
  git-gui i18n: mark strings for translation

7 years agoMerge branch 'rs/git-gui-use-modern-git-merge-syntax'
Junio C Hamano [Mon, 3 Oct 2016 20:30:36 +0000 (13:30 -0700)] 
Merge branch 'rs/git-gui-use-modern-git-merge-syntax'

The original command line syntax for "git merge", which was "git
merge <msg> HEAD <parent>...", has been deprecated for quite some
time, and "git gui" was the last in-tree user of the syntax.  This
is finally fixed, so that we can move forward with the deprecation.

* rs/git-gui-use-modern-git-merge-syntax:
  git-gui: stop using deprecated merge syntax

7 years agoMerge branch 'jc/verify-loose-object-header'
Junio C Hamano [Mon, 3 Oct 2016 20:30:36 +0000 (13:30 -0700)] 
Merge branch 'jc/verify-loose-object-header'

Codepaths that read from an on-disk loose object were too loose in
validating what they are reading is a proper object file and
sometimes read past the data they read from the disk, which has
been corrected.  H/t to Gustavo Grieco for reporting.

* jc/verify-loose-object-header:
  unpack_sha1_header(): detect malformed object header
  streaming: make sure to notice corrupt object

7 years agoMerge branch 'nd/init-core-worktree-in-multi-worktree-world'
Junio C Hamano [Mon, 3 Oct 2016 20:30:34 +0000 (13:30 -0700)] 
Merge branch 'nd/init-core-worktree-in-multi-worktree-world'

"git init" tried to record core.worktree in the repository's
'config' file when GIT_WORK_TREE environment variable was set and
it was different from where GIT_DIR appears as ".git" at its top,
but the logic was faulty when .git is a "gitdir:" file that points
at the real place, causing trouble in working trees that are
managed by "git worktree".  This has been corrected.

* nd/init-core-worktree-in-multi-worktree-world:
  init: kill git_link variable
  init: do not set unnecessary core.worktree
  init: kill set_git_dir_init()
  init: call set_git_dir_init() from within init_db()
  init: correct re-initialization from a linked worktree

7 years agoMerge branch 'ik/gitweb-force-highlight'
Junio C Hamano [Mon, 3 Oct 2016 20:30:33 +0000 (13:30 -0700)] 
Merge branch 'ik/gitweb-force-highlight'

"gitweb" can spawn "highlight" to show blob contents with
(programming) language-specific syntax highlighting, but only
when the language is known.  "highlight" can however be told
to make the guess itself by giving it "--force" option, which
has been enabled.

* ik/gitweb-force-highlight:
  gitweb: use highlight's shebang detection
  gitweb: remove unused guess_file_syntax() parameter

7 years agoMerge branch 'rs/copy-array'
Junio C Hamano [Mon, 3 Oct 2016 20:30:33 +0000 (13:30 -0700)] 
Merge branch 'rs/copy-array'

Code cleanup.

* rs/copy-array:
  use COPY_ARRAY
  add COPY_ARRAY

7 years agoGit 2.10.1 v2.10.1
Junio C Hamano [Mon, 3 Oct 2016 20:24:18 +0000 (13:24 -0700)] 
Git 2.10.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoMerge branch 'jk/ident-ai-canonname-could-be-null' into maint
Junio C Hamano [Mon, 3 Oct 2016 20:22:32 +0000 (13:22 -0700)] 
Merge branch 'jk/ident-ai-canonname-could-be-null' into maint

In the codepath that comes up with the hostname to be used in an
e-mail when the user didn't tell us, we looked at ai_canonname
field in struct addrinfo without making sure it is not NULL first.

* jk/ident-ai-canonname-could-be-null:
  ident: handle NULL ai_canonname

7 years agoMerge branch 'jk/doc-cvs-update' into maint
Junio C Hamano [Mon, 3 Oct 2016 20:22:25 +0000 (13:22 -0700)] 
Merge branch 'jk/doc-cvs-update' into maint

Documentation around tools to import from CVS was fairly outdated.

* jk/doc-cvs-update:
  docs/cvs-migration: mention cvsimport caveats
  docs/cvs-migration: update link to cvsps homepage
  docs/cvsimport: prefer cvs-fast-export to parsecvs

7 years agoMerge branch 'jk/pack-tag-of-tag' into maint
Junio C Hamano [Mon, 3 Oct 2016 20:22:13 +0000 (13:22 -0700)] 
Merge branch 'jk/pack-tag-of-tag' into maint

"git pack-objects --include-tag" was taught that when we know that
we are sending an object C, we want a tag B that directly points at
C but also a tag A that points at the tag B.  We used to miss the
intermediate tag B in some cases.

* jk/pack-tag-of-tag:
  pack-objects: walk tag chains for --include-tag
  t5305: simplify packname handling
  t5305: use "git -C"
  t5305: drop "dry-run" of unpack-objects
  t5305: move cleanup into test block

7 years agoSync with maint
Junio C Hamano [Thu, 29 Sep 2016 23:58:29 +0000 (16:58 -0700)] 
Sync with maint

* maint:
  Prepare for 2.10.1

7 years agoSixth batch for 2.11
Junio C Hamano [Thu, 29 Sep 2016 23:58:20 +0000 (16:58 -0700)] 
Sixth batch for 2.11

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoMerge branch 'jc/worktree-config'
Junio C Hamano [Thu, 29 Sep 2016 23:57:14 +0000 (16:57 -0700)] 
Merge branch 'jc/worktree-config'

"git worktree", even though it used the default_abbrev setting that
ought to be affected by core.abbrev configuration variable, ignored
the variable setting.  The command has been taught to read the
default set of configuration variables to correct this.

* jc/worktree-config:
  worktree: honor configuration variables

7 years agoMerge branch 'jk/ident-ai-canonname-could-be-null'
Junio C Hamano [Thu, 29 Sep 2016 23:57:14 +0000 (16:57 -0700)] 
Merge branch 'jk/ident-ai-canonname-could-be-null'

In the codepath that comes up with the hostname to be used in an
e-mail when the user didn't tell us, we looked at ai_canonname
field in struct addrinfo without making sure it is not NULL first.

* jk/ident-ai-canonname-could-be-null:
  ident: handle NULL ai_canonname

7 years agoMerge branch 'jt/fetch-pack-in-vain-count-with-stateless'
Junio C Hamano [Thu, 29 Sep 2016 23:57:13 +0000 (16:57 -0700)] 
Merge branch 'jt/fetch-pack-in-vain-count-with-stateless'

When "git fetch" tries to find where the history of the repository
it runs in has diverged from what the other side has, it has a
mechanism to avoid digging too deep into irrelevant side branches.
This however did not work well over the "smart-http" transport due
to a design bug, which has been fixed.

* jt/fetch-pack-in-vain-count-with-stateless:
  fetch-pack: do not reset in_vain on non-novel acks

7 years agoMerge branch 'jk/verify-packfile-gently'
Junio C Hamano [Thu, 29 Sep 2016 23:57:13 +0000 (16:57 -0700)] 
Merge branch 'jk/verify-packfile-gently'

A low-level function verify_packfile() was meant to show errors
that were detected without dying itself, but under some conditions
it didn't and died instead, which has been fixed.

* jk/verify-packfile-gently:
  verify_packfile: check pack validity before accessing data

7 years agoMerge branch 'jt/mailinfo-fold-in-body-headers'
Junio C Hamano [Thu, 29 Sep 2016 23:57:12 +0000 (16:57 -0700)] 
Merge branch 'jt/mailinfo-fold-in-body-headers'

When "git format-patch --stdout" output is placed as an in-body
header and it uses the RFC2822 header folding, "git am" failed to
put the header line back into a single logical line.  The
underlying "git mailinfo" was taught to handle this properly.

* jt/mailinfo-fold-in-body-headers:
  mailinfo: handle in-body header continuations
  mailinfo: make is_scissors_line take plain char *
  mailinfo: separate in-body header processing

7 years agoPrepare for 2.10.1
Junio C Hamano [Thu, 29 Sep 2016 23:51:09 +0000 (16:51 -0700)] 
Prepare for 2.10.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoMerge branch 'tg/add-chmod+x-fix' into maint
Junio C Hamano [Thu, 29 Sep 2016 23:49:47 +0000 (16:49 -0700)] 
Merge branch 'tg/add-chmod+x-fix' into maint

"git add --chmod=+x <pathspec>" added recently only toggled the
executable bit for paths that are either new or modified. This has
been corrected to flip the executable bit for all paths that match
the given pathspec.

* tg/add-chmod+x-fix:
  t3700-add: do not check working tree file mode without POSIXPERM
  t3700-add: create subdirectory gently
  add: modify already added files when --chmod is given
  read-cache: introduce chmod_index_entry
  update-index: add test for chmod flags

7 years agoMerge branch 'et/add-chmod-x' into maint
Junio C Hamano [Thu, 29 Sep 2016 23:49:46 +0000 (16:49 -0700)] 
Merge branch 'et/add-chmod-x' into maint

"git add --chmod=+x" added recently lacked documentation, which has
been corrected.

* et/add-chmod-x:
  add: document the chmod option

7 years agoMerge branch 'rt/rebase-i-broken-insn-advise' into maint
Junio C Hamano [Thu, 29 Sep 2016 23:49:46 +0000 (16:49 -0700)] 
Merge branch 'rt/rebase-i-broken-insn-advise' into maint

When "git rebase -i" is given a broken instruction, it told the
user to fix it with "--edit-todo", but didn't say what the step
after that was (i.e. "--continue").

* rt/rebase-i-broken-insn-advise:
  rebase -i: improve advice on bad instruction lines

7 years agoMerge branch 'ls/travis-homebrew-path-fix' into maint
Junio C Hamano [Thu, 29 Sep 2016 23:49:45 +0000 (16:49 -0700)] 
Merge branch 'ls/travis-homebrew-path-fix' into maint

The procedure to build Git on Mac OS X for Travis CI hardcoded the
internal directory structure we assumed HomeBrew uses, which was a
no-no.  The procedure has been updated to ask HomeBrew things we
need to know to fix this.

* ls/travis-homebrew-path-fix:
  travis-ci: ask homebrew for its path instead of hardcoding it

7 years agoMerge branch 'js/regexec-buf' into maint
Junio C Hamano [Thu, 29 Sep 2016 23:49:44 +0000 (16:49 -0700)] 
Merge branch 'js/regexec-buf' into maint

Some codepaths in "git diff" used regexec(3) on a buffer that was
mmap(2)ed, which may not have a terminating NUL, leading to a read
beyond the end of the mapped region.  This was fixed by introducing
a regexec_buf() helper that takes a <ptr,len> pair with REG_STARTEND
extension.

* js/regexec-buf:
  regex: use regexec_buf()
  regex: add regexec_buf() that can work on a non NUL-terminated string
  regex: -G<pattern> feeds a non NUL-terminated string to regexec() and fails

7 years agoMerge branch 'nd/checkout-disambiguation' into maint
Junio C Hamano [Thu, 29 Sep 2016 23:49:43 +0000 (16:49 -0700)] 
Merge branch 'nd/checkout-disambiguation' into maint

"git checkout <word>" does not follow the usual disambiguation
rules when the <word> can be both a rev and a path, to allow
checking out a branch 'foo' in a project that happens to have a
file 'foo' in the working tree without having to disambiguate.
This was poorly documented and the check was incorrect when the
command was run from a subdirectory.

* nd/checkout-disambiguation:
  checkout: fix ambiguity check in subdir
  checkout.txt: document a common case that ignores ambiguation rules
  checkout: add some spaces between code and comment

7 years agoMerge branch 'ep/doc-check-ref-format-example' into maint
Junio C Hamano [Thu, 29 Sep 2016 23:49:43 +0000 (16:49 -0700)] 
Merge branch 'ep/doc-check-ref-format-example' into maint

A shell script example in check-ref-format documentation has been
fixed.

* ep/doc-check-ref-format-example:
  git-check-ref-format.txt: fixup documentation

7 years agoMerge branch 'mm/config-color-ui-default-to-auto' into maint
Junio C Hamano [Thu, 29 Sep 2016 23:49:42 +0000 (16:49 -0700)] 
Merge branch 'mm/config-color-ui-default-to-auto' into maint

Documentation for individual configuration variables to control use
of color (like `color.grep`) said that their default value is
'false', instead of saying their default is taken from `color.ui`.
When we updated the default value for color.ui from 'false' to
'auto' quite a while ago, all of them broke.  This has been
corrected.

* mm/config-color-ui-default-to-auto:
  Documentation/config: default for color.* is color.ui

7 years agoMerge branch 'jk/reduce-gc-aggressive-depth' into maint
Junio C Hamano [Thu, 29 Sep 2016 23:49:42 +0000 (16:49 -0700)] 
Merge branch 'jk/reduce-gc-aggressive-depth' into maint

"git gc --aggressive" used to limit the delta-chain length to 250,
which is way too deep for gaining additional space savings and is
detrimental for runtime performance.  The limit has been reduced to
50.

* jk/reduce-gc-aggressive-depth:
  gc: default aggressive depth to 50

7 years agoMerge branch 'jk/rebase-i-drop-ident-check' into maint
Junio C Hamano [Thu, 29 Sep 2016 23:49:41 +0000 (16:49 -0700)] 
Merge branch 'jk/rebase-i-drop-ident-check' into maint

Even when "git pull --rebase=preserve" (and the underlying "git
rebase --preserve") can complete without creating any new commit
(i.e. fast-forwards), it still insisted on having a usable ident
information (read: user.email is set correctly), which was less
than nice.  As the underlying commands used inside "git rebase"
would fail with a more meaningful error message and advice text
when the bogus ident matters, this extra check was removed.

* jk/rebase-i-drop-ident-check:
  rebase-interactive: drop early check for valid ident

7 years agoMerge branch 'jt/format-patch-base-info-above-sig' into maint
Junio C Hamano [Thu, 29 Sep 2016 23:49:40 +0000 (16:49 -0700)] 
Merge branch 'jt/format-patch-base-info-above-sig' into maint

"git format-patch --base=..." feature that was recently added
showed the base commit information after "-- " e-mail signature
line, which turned out to be inconvenient.  The base information
has been moved above the signature line.

* jt/format-patch-base-info-above-sig:
  format-patch: show base info before email signature

7 years agoMerge branch 'ks/perf-build-with-autoconf' into maint
Junio C Hamano [Thu, 29 Sep 2016 23:49:40 +0000 (16:49 -0700)] 
Merge branch 'ks/perf-build-with-autoconf' into maint

Performance tests done via "t/perf" did not use the same set of
build configuration if the user relied on autoconf generated
configuration.

* ks/perf-build-with-autoconf:
  t/perf/run: copy config.mak.autogen & friends to build area

7 years agoMerge branch 'rs/xdiff-merge-overlapping-hunks-for-W-context' into maint
Junio C Hamano [Thu, 29 Sep 2016 23:49:39 +0000 (16:49 -0700)] 
Merge branch 'rs/xdiff-merge-overlapping-hunks-for-W-context' into maint

"git diff -W" output needs to extend the context backward to
include the header line of the current function and also forward to
include the body of the entire current function up to the header
line of the next one.  This process may have to merge to adjacent
hunks, but the code forgot to do so in some cases.

* rs/xdiff-merge-overlapping-hunks-for-W-context:
  xdiff: fix merging of hunks with -W context and -u context

7 years agoMerge branch 'ew/http-do-not-forget-to-call-curl-multi-remove-handle' into maint
Junio C Hamano [Thu, 29 Sep 2016 23:49:39 +0000 (16:49 -0700)] 
Merge branch 'ew/http-do-not-forget-to-call-curl-multi-remove-handle' into maint

The http transport (with curl-multi option, which is the default
these days) failed to remove curl-easy handle from a curlm session,
which led to unnecessary API failures.

* ew/http-do-not-forget-to-call-curl-multi-remove-handle:
  http: always remove curl easy from curlm session on release
  http: consolidate #ifdefs for curl_multi_remove_handle
  http: warn on curl_multi_add_handle failures

7 years agoMerge branch 'jk/patch-ids-no-merges' into maint
Junio C Hamano [Thu, 29 Sep 2016 23:49:38 +0000 (16:49 -0700)] 
Merge branch 'jk/patch-ids-no-merges' into maint

"git log --cherry-pick" used to include merge commits as candidates
to be matched up with other commits, resulting a lot of wasted time.
The patch-id generation logic has been updated to ignore merges to
avoid the wastage.

* jk/patch-ids-no-merges:
  patch-ids: refuse to compute patch-id for merge commit
  patch-ids: turn off rename detection

7 years agoMerge branch 'js/git-gui-commit-gpgsign' into maint
Junio C Hamano [Thu, 29 Sep 2016 23:49:38 +0000 (16:49 -0700)] 
Merge branch 'js/git-gui-commit-gpgsign' into maint

"git commit-tree" stopped reading commit.gpgsign configuration
variable that was meant for Porcelain "git commit" in Git 2.9; we
forgot to update "git gui" to look at the configuration to match
this change.

* js/git-gui-commit-gpgsign:
  git-gui: respect commit.gpgsign again

7 years agoMerge branch 'jk/fix-remote-curl-url-wo-proto' into maint
Junio C Hamano [Thu, 29 Sep 2016 23:49:38 +0000 (16:49 -0700)] 
Merge branch 'jk/fix-remote-curl-url-wo-proto' into maint

"git fetch http::/site/path" did not die correctly and segfaulted
instead.

* jk/fix-remote-curl-url-wo-proto:
  remote-curl: handle URLs without protocol

7 years agoMerge branch 'sy/git-gui-i18n-ja' into maint
Junio C Hamano [Thu, 29 Sep 2016 23:49:37 +0000 (16:49 -0700)] 
Merge branch 'sy/git-gui-i18n-ja' into maint

Update Japanese translation for "git-gui".

* sy/git-gui-i18n-ja:
  git-gui: update Japanese information
  git-gui: update Japanese translation
  git-gui: add Japanese language code
  git-gui: apply po template to Japanese translation
  git-gui: consistently use the same word for "blame" in Japanese
  git-gui: consistently use the same word for "remote" in Japanese

7 years agoMerge branch 'mr/vcs-svn-printf-ulong' into maint
Junio C Hamano [Thu, 29 Sep 2016 23:49:37 +0000 (16:49 -0700)] 
Merge branch 'mr/vcs-svn-printf-ulong' into maint

Code cleanup.

* mr/vcs-svn-printf-ulong:
  vcs-svn/fast_export: fix timestamp fmt specifiers

7 years agoMerge branch 'rs/unpack-trees-reduce-file-scope-global' into maint
Junio C Hamano [Thu, 29 Sep 2016 23:49:36 +0000 (16:49 -0700)] 
Merge branch 'rs/unpack-trees-reduce-file-scope-global' into maint

Code cleanup.

* rs/unpack-trees-reduce-file-scope-global:
  unpack-trees: pass checkout state explicitly to check_updates()

7 years agoMerge branch 'rs/strbuf-remove-fix' into maint
Junio C Hamano [Thu, 29 Sep 2016 23:49:35 +0000 (16:49 -0700)] 
Merge branch 'rs/strbuf-remove-fix' into maint

Code cleanup.

* rs/strbuf-remove-fix:
  strbuf: use valid pointer in strbuf_remove()

7 years agoMerge branch 'rs/checkout-some-states-are-const' into maint
Junio C Hamano [Thu, 29 Sep 2016 23:49:35 +0000 (16:49 -0700)] 
Merge branch 'rs/checkout-some-states-are-const' into maint

Code cleanup.

* rs/checkout-some-states-are-const:
  checkout: constify parameters of checkout_stage() and checkout_merged()

7 years agoMerge branch 'bw/pathspec-remove-unused-extern-decl' into maint
Junio C Hamano [Thu, 29 Sep 2016 23:49:34 +0000 (16:49 -0700)] 
Merge branch 'bw/pathspec-remove-unused-extern-decl' into maint

Code cleanup.

* bw/pathspec-remove-unused-extern-decl:
  pathspec: remove unnecessary function prototypes

7 years agomailinfo: unescape quoted-pair in header fields
Kevin Daudt [Wed, 28 Sep 2016 19:52:32 +0000 (21:52 +0200)] 
mailinfo: unescape quoted-pair in header fields

rfc2822 has provisions for quoted strings in structured header fields,
but also allows for escaping these with so-called quoted-pairs.

The only thing git currently does is removing exterior quotes, but
quotes within are left alone.

Remove exterior quotes and remove escape characters so that they don't
show up in the author field.

Signed-off-by: Kevin Daudt <me@ikke.info>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agot5100-mailinfo: replace common path prefix with variable
Kevin Daudt [Wed, 28 Sep 2016 19:52:31 +0000 (21:52 +0200)] 
t5100-mailinfo: replace common path prefix with variable

Many tests need to store data in a file, and repeat the same pattern to
refer to that path:

    "$TEST_DIRECTORY"/t5100/

Create a variable that contains this path, and use that instead.

While we're making this change, make sure the quotes are not just around
the variable, but around the entire string to not give the impression
we want shell splitting to affect the other variables.

Signed-off-by: Kevin Daudt <me@ikke.info>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agorev-list-options: clarify the usage of --reverse
Pranit Bauva [Tue, 27 Sep 2016 20:44:09 +0000 (20:44 +0000)] 
rev-list-options: clarify the usage of --reverse

Users often wonder if the oldest or the newest n commits are shown
by `log -n --reverse`.  Clarify that --reverse kicks in only after
deciding which commits are to be shown to unconfuse them.

Reported-by: Ruediger Meier <sweet_f_a@gmx.de>
Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agofsck: handle bad trees like other errors
David Turner [Tue, 27 Sep 2016 20:59:51 +0000 (16:59 -0400)] 
fsck: handle bad trees like other errors

Instead of dying when fsck hits a malformed tree object, log the error
like any other and continue.  Now fsck can tell the user which tree is
bad, too.

Signed-off-by: David Turner <dturner@twosigma.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agotree-walk: be more specific about corrupt tree errors
Jeff King [Tue, 27 Sep 2016 20:59:50 +0000 (16:59 -0400)] 
tree-walk: be more specific about corrupt tree errors

When the tree-walker runs into an error, it just calls
die(), and the message is always "corrupt tree file".
However, we are actually covering several cases here; let's
give the user a hint about what happened.

Let's also avoid using the word "corrupt", which makes it
seem like the data bit-rotted on disk. Our sha1 check would
already have found that. These errors are ones of data that
is malformed in the first place.

Signed-off-by: David Turner <dturner@twosigma.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoworktree: honor configuration variables
Junio C Hamano [Tue, 27 Sep 2016 06:49:39 +0000 (23:49 -0700)] 
worktree: honor configuration variables

The command accesses default_abbrev (defined in environment.c and is
updated via core.abbrev configuration), but never makes any call to
git_config().  The output from "worktree list" ignores the abbrev
setting for this reason.

Make a call to git_config() to read the default set of configuration
variables at the beginning of the command.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoxdiff: rename "struct group" to "struct xdlgroup"
Jeff King [Tue, 27 Sep 2016 04:37:33 +0000 (00:37 -0400)] 
xdiff: rename "struct group" to "struct xdlgroup"

Commit e8adf23 (xdl_change_compact(): introduce the concept
of a change group, 2016-08-22) added a "struct group" type
to xdiff/xdiffi.c. But the POSIX system header "grp.h"
already defines "struct group" (it is part of the getgrnam
interface). This happens to work because the new type is
local to xdiffi.c, and the xdiff code includes a relatively
small set of system headers. But it will break compilation
if xdiff ever switches to using git-compat-util.h.  It can
also probably cause confusion with tools that look at the
whole code base, like coccinelle or ctags.

Let's resolve by giving the xdiff variant a scoped name,
which is closer to other xdiff types anyway (e.g.,
xdlfile_t, though note that xdiff is fond if typedefs when
Git usually is not).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoadd David Turner's Two Sigma address
David Turner [Tue, 27 Sep 2016 00:11:33 +0000 (20:11 -0400)] 
add David Turner's Two Sigma address

Signed-off-by: David Turner <novalis@novalis.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoFifth batch for 2.11
Junio C Hamano [Mon, 26 Sep 2016 23:11:46 +0000 (16:11 -0700)] 
Fifth batch for 2.11

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoMerge branch 'jk/clone-recursive-progress'
Junio C Hamano [Mon, 26 Sep 2016 23:09:22 +0000 (16:09 -0700)] 
Merge branch 'jk/clone-recursive-progress'

"git clone --recurse-submodules" lost the progress eye-candy in
recent update, which has been corrected.

* jk/clone-recursive-progress:
  clone: pass --progress decision to recursive submodules

7 years agoMerge branch 'jk/doc-cvs-update'
Junio C Hamano [Mon, 26 Sep 2016 23:09:22 +0000 (16:09 -0700)] 
Merge branch 'jk/doc-cvs-update'

Documentation around tools to import from CVS was fairly outdated.

* jk/doc-cvs-update:
  docs/cvs-migration: mention cvsimport caveats
  docs/cvs-migration: update link to cvsps homepage
  docs/cvsimport: prefer cvs-fast-export to parsecvs

7 years agoMerge branch 'rt/rebase-i-broken-insn-advise'
Junio C Hamano [Mon, 26 Sep 2016 23:09:21 +0000 (16:09 -0700)] 
Merge branch 'rt/rebase-i-broken-insn-advise'

When "git rebase -i" is given a broken instruction, it told the
user to fix it with "--edit-todo", but didn't say what the step
after that was (i.e. "--continue").

* rt/rebase-i-broken-insn-advise:
  rebase -i: improve advice on bad instruction lines

7 years agoMerge branch 'rs/checkout-init-macro'
Junio C Hamano [Mon, 26 Sep 2016 23:09:21 +0000 (16:09 -0700)] 
Merge branch 'rs/checkout-init-macro'

Code cleanup.

* rs/checkout-init-macro:
  introduce CHECKOUT_INIT

7 years agoMerge branch 'ls/travis-homebrew-path-fix'
Junio C Hamano [Mon, 26 Sep 2016 23:09:20 +0000 (16:09 -0700)] 
Merge branch 'ls/travis-homebrew-path-fix'

The procedure to build Git on Mac OS X for Travis CI hardcoded the
internal directory structure we assumed HomeBrew uses, which was a
no-no.  The procedure has been updated to ask HomeBrew things we
need to know to fix this.

* ls/travis-homebrew-path-fix:
  travis-ci: ask homebrew for its path instead of hardcoding it

7 years agoMerge branch 'tg/add-chmod+x-fix'
Junio C Hamano [Mon, 26 Sep 2016 23:09:20 +0000 (16:09 -0700)] 
Merge branch 'tg/add-chmod+x-fix'

"git add --chmod=+x <pathspec>" added recently only toggled the
executable bit for paths that are either new or modified. This has
been corrected to flip the executable bit for all paths that match
the given pathspec.

* tg/add-chmod+x-fix:
  t3700-add: do not check working tree file mode without POSIXPERM
  t3700-add: create subdirectory gently
  add: modify already added files when --chmod is given
  read-cache: introduce chmod_index_entry
  update-index: add test for chmod flags

7 years agoMerge branch 'js/regexec-buf'
Junio C Hamano [Mon, 26 Sep 2016 23:09:19 +0000 (16:09 -0700)] 
Merge branch 'js/regexec-buf'

Some codepaths in "git diff" used regexec(3) on a buffer that was
mmap(2)ed, which may not have a terminating NUL, leading to a read
beyond the end of the mapped region.  This was fixed by introducing
a regexec_buf() helper that takes a <ptr,len> pair with REG_STARTEND
extension.

* js/regexec-buf:
  regex: use regexec_buf()
  regex: add regexec_buf() that can work on a non NUL-terminated string
  regex: -G<pattern> feeds a non NUL-terminated string to regexec() and fails

7 years agoMerge branch 'nd/checkout-disambiguation'
Junio C Hamano [Mon, 26 Sep 2016 23:09:18 +0000 (16:09 -0700)] 
Merge branch 'nd/checkout-disambiguation'

"git checkout <word>" does not follow the usual disambiguation
rules when the <word> can be both a rev and a path, to allow
checking out a branch 'foo' in a project that happens to have a
file 'foo' in the working tree without having to disambiguate.
This was poorly documented and the check was incorrect when the
command was run from a subdirectory.

* nd/checkout-disambiguation:
  checkout: fix ambiguity check in subdir
  checkout.txt: document a common case that ignores ambiguation rules
  checkout: add some spaces between code and comment

7 years agoMerge branch 'va/i18n-more'
Junio C Hamano [Mon, 26 Sep 2016 23:09:17 +0000 (16:09 -0700)] 
Merge branch 'va/i18n-more'

Even more i18n.

* va/i18n-more:
  i18n: stash: mark messages for translation
  i18n: notes-merge: mark die messages for translation
  i18n: ident: mark hint for translation
  i18n: i18n: diff: mark die messages for translation
  i18n: connect: mark die messages for translation
  i18n: commit: mark message for translation

7 years agoMerge branch 'jt/format-patch-rfc'
Junio C Hamano [Mon, 26 Sep 2016 23:09:17 +0000 (16:09 -0700)] 
Merge branch 'jt/format-patch-rfc'

In some projects, it is common to use "[RFC PATCH]" as the subject
prefix for a patch meant for discussion rather than application.  A
new option "--rfc" was a short-hand for "--subject-prefix=RFC PATCH"
to help the participants of such projects.

* jt/format-patch-rfc:
  format-patch: add "--rfc" for the common case of [RFC PATCH]

7 years agoMerge branch 'ep/doc-check-ref-format-example'
Junio C Hamano [Mon, 26 Sep 2016 23:09:17 +0000 (16:09 -0700)] 
Merge branch 'ep/doc-check-ref-format-example'

A shell script example in check-ref-format documentation has been
fixed.

* ep/doc-check-ref-format-example:
  git-check-ref-format.txt: fixup documentation

7 years agoMerge branch 'mh/diff-indent-heuristic'
Junio C Hamano [Mon, 26 Sep 2016 23:09:16 +0000 (16:09 -0700)] 
Merge branch 'mh/diff-indent-heuristic'

Output from "git diff" can be made easier to read by selecting
which lines are common and which lines are added/deleted
intelligently when the lines before and after the changed section
are the same.  A command line option is added to help with the
experiment to find a good heuristics.

* mh/diff-indent-heuristic:
  blame: honor the diff heuristic options and config
  parse-options: add parse_opt_unknown_cb()
  diff: improve positioning of add/delete blocks in diffs
  xdl_change_compact(): introduce the concept of a change group
  recs_match(): take two xrecord_t pointers as arguments
  is_blank_line(): take a single xrecord_t as argument
  xdl_change_compact(): only use heuristic if group can't be matched
  xdl_change_compact(): fix compaction heuristic to adjust ixo

7 years agoMerge branch 'rs/c-auto-resets-attributes'
Junio C Hamano [Mon, 26 Sep 2016 23:09:15 +0000 (16:09 -0700)] 
Merge branch 'rs/c-auto-resets-attributes'

The pretty-format specifier "%C(auto)" used by the "log" family of
commands to enable coloring of the output is taught to also issue a
color-reset sequence to the output.

* rs/c-auto-resets-attributes:
  pretty: let %C(auto) reset all attributes

7 years agoMerge branch 'mm/config-color-ui-default-to-auto'
Junio C Hamano [Mon, 26 Sep 2016 23:09:14 +0000 (16:09 -0700)] 
Merge branch 'mm/config-color-ui-default-to-auto'

Documentation for individual configuration variables to control use
of color (like `color.grep`) said that their default value is
'false', instead of saying their default is taken from `color.ui`.
When we updated the default value for color.ui from 'false' to
'auto' quite a while ago, all of them broke.  This has been
corrected.

* mm/config-color-ui-default-to-auto:
  Documentation/config: default for color.* is color.ui

7 years agoMerge branch 'rs/cocci'
Junio C Hamano [Mon, 26 Sep 2016 23:09:14 +0000 (16:09 -0700)] 
Merge branch 'rs/cocci'

Code cleanup.

* rs/cocci:
  use strbuf_addstr() for adding constant strings to a strbuf, part 2
  add coccicheck make target
  contrib/coccinelle: fix semantic patch for oid_to_hex_r()

7 years agounpack_sha1_header(): detect malformed object header
Junio C Hamano [Mon, 26 Sep 2016 04:29:04 +0000 (21:29 -0700)] 
unpack_sha1_header(): detect malformed object header

When opening a loose object file, we often do this sequence:

 - prepare a short buffer for the object header (on stack)

 - call unpack_sha1_header() and have early part of the object data
   inflated, enough to fill the buffer

 - parse that data in the short buffer, assuming that the first part
   of the object is <typename> SP <length> NUL

Because the parsing function parse_sha1_header_extended() is not
given the number of bytes inflated into the header buffer, it you
craft a file whose early part inflates a garbage sequence without SP
or NUL, and replace a loose object with it, it will end up reading
past the end of the inflated data.

To correct this, do the following four things:

 - rename unpack_sha1_header() to unpack_sha1_short_header() and
   have unpack_sha1_header_to_strbuf() keep calling that as its
   helper function.  This will detect and report zlib errors, but is
   not aware of the format of a loose object (as before).

 - introduce unpack_sha1_header() that calls the same helper
   function, and when zlib reports it inflated OK into the buffer,
   check if the inflated data has NUL.  This would ensure that
   parsing function will terminate within the buffer that holds the
   inflated header.

 - update unpack_sha1_header_to_strbuf() to check if the resulting
   buffer has NUL for the same effect.

 - update parse_sha1_header_extended() to make sure that its loop to
   find the SP that terminates the <typename> stops at NUL.

Essentially, this makes unpack_*() functions that are asked to
unpack a loose object header to be a bit more strict and detect an
input that cannot possibly be a valid object header, even before the
parsing function kicks in.

Reported-by: Gustavo Grieco <gustavo.grieco@imag.fr>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agostreaming: make sure to notice corrupt object
Junio C Hamano [Mon, 26 Sep 2016 16:23:41 +0000 (09:23 -0700)] 
streaming: make sure to notice corrupt object

The streaming read interface from a loose object called
parse_sha1_header() but discarded its return value, without noticing
a potential error.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoMerge branch 'va/i18n' of ../git-gui into va/git-gui-i18n
Junio C Hamano [Mon, 26 Sep 2016 14:19:57 +0000 (07:19 -0700)] 
Merge branch 'va/i18n' of ../git-gui into va/git-gui-i18n

* 'va/i18n' of ../git-gui:
  git-gui: l10n: add Portuguese translation
  git-gui i18n: mark strings for translation

7 years agogit-gui: l10n: add Portuguese translation
Vasco Almeida [Fri, 6 May 2016 16:06:42 +0000 (16:06 +0000)] 
git-gui: l10n: add Portuguese translation

Add Portuguese glossary.

Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agogit-gui i18n: mark strings for translation
Vasco Almeida [Sun, 8 May 2016 10:52:54 +0000 (10:52 +0000)] 
git-gui i18n: mark strings for translation

Mark strings for translation in lib/index.tcl that were seemingly
left behind by 700e560 ("git-gui: Mark forgotten strings for
translation.", 2008-09-04) which marks string in do_revert_selection
procedure.
These strings are passed to unstage_help and add_helper procedures.

Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoMerge branch 'rs/use-modern-git-merge-syntax' of git-gui into rs/git-gui-use-modern...
Junio C Hamano [Mon, 26 Sep 2016 14:16:29 +0000 (07:16 -0700)] 
Merge branch 'rs/use-modern-git-merge-syntax' of git-gui into rs/git-gui-use-modern-git-merge-syntax

* 'rs/use-modern-git-merge-syntax' of git-gui:
  git-gui: stop using deprecated merge syntax

7 years agogit-gui: stop using deprecated merge syntax
René Scharfe [Sat, 24 Sep 2016 11:30:22 +0000 (13:30 +0200)] 
git-gui: stop using deprecated merge syntax

Starting with v2.5.0 git merge can handle FETCH_HEAD internally and
warns when it's called like 'git merge <message> HEAD <commit>' because
that syntax is deprecated.  Use this feature in git-gui and get rid of
that warning.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Tested-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agouse COPY_ARRAY
René Scharfe [Sun, 25 Sep 2016 07:24:03 +0000 (09:24 +0200)] 
use COPY_ARRAY

Add a semantic patch for converting certain calls of memcpy(3) to
COPY_ARRAY() and apply that transformation to the code base.  The result
is
 shorter and safer code.  For now only consider calls where source and
destination have the same type, or in other words: easy cases.

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