gitweb.git
Merge branch 'ak/curl-imap-send-explicit-scheme'Junio C Hamano Mon, 10 Oct 2016 21:03:47 +0000 (14:03 -0700)

Merge branch 'ak/curl-imap-send-explicit-scheme'

When we started cURL to talk to imap server when a new enough
version of cURL library is available, we forgot to explicitly add
imap(s):// before the destination. To some folks, that didn't work
and the library tried to make HTTP(s) requests instead.

* ak/curl-imap-send-explicit-scheme:
imap-send: Tell cURL to use imap:// or imaps://

Merge branch 'jk/pack-objects-optim-mru'Junio C Hamano Mon, 10 Oct 2016 21:03:46 +0000 (14:03 -0700)

Merge branch 'jk/pack-objects-optim-mru'

"git pack-objects" in a repository with many packfiles used to
spend a lot of time looking for/at objects in them; the accesses to
the packfiles are now optimized by checking the most-recently-used
packfile first.

* jk/pack-objects-optim-mru:
pack-objects: use mru list when iterating over packs
pack-objects: break delta cycles before delta-search phase
sha1_file: make packed_object_info public
provide an initializer for "struct object_info"

Merge branch 'rs/qsort'Junio C Hamano Mon, 10 Oct 2016 21:03:46 +0000 (14:03 -0700)

Merge branch 'rs/qsort'

We call "qsort(array, nelem, sizeof(array[0]), fn)", and most of
the time third parameter is redundant. A new QSORT() macro lets us
omit it.

* rs/qsort:
show-branch: use QSORT
use QSORT, part 2
coccicheck: use --all-includes by default
remove unnecessary check before QSORT
use QSORT
add QSORT

tmp-objdir: do not migrate files starting with '.'Jeff King Mon, 3 Oct 2016 20:49:22 +0000 (16:49 -0400)

tmp-objdir: do not migrate files starting with '.'

This avoids "." and "..", as we already do, but also leaves
room for index-pack to store extra data in the quarantine
area (e.g., for passing back any analysis to be read by the
pre-receive hook).

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

tmp-objdir: put quarantine information in the environmentJeff King Mon, 3 Oct 2016 20:49:18 +0000 (16:49 -0400)

tmp-objdir: put quarantine information in the environment

The presence of the GIT_QUARANTINE_PATH variable lets any
called programs know that they're operating in a temporary
object directory (and where that directory is).

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

receive-pack: quarantine objects until pre-receive... Jeff King Mon, 3 Oct 2016 20:49:14 +0000 (16:49 -0400)

receive-pack: quarantine objects until pre-receive accepts

When a client pushes objects to us, index-pack checks the
objects themselves and then installs them into place. If we
then reject the push due to a pre-receive hook, we cannot
just delete the packfile; other processes may be depending
on it. We have to do a normal reachability check at this
point via `git gc`.

But such objects may hang around for weeks due to the
gc.pruneExpire grace period. And worse, during that time
they may be exploded from the pack into inefficient loose
objects.

Instead, this patch teaches receive-pack to put the new
objects into a "quarantine" temporary directory. We make
these objects available to the connectivity check and to the
pre-receive hook, and then install them into place only if
it is successful (and otherwise remove them as tempfiles).

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

tmp-objdir: introduce API for temporary object directoriesJeff 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>

check_connected: accept an env argumentJeff 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>

alternates: use fspathcmp to detect duplicatesJeff 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>

sha1_file: always allow relative paths to alternatesJeff 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>

count-objects: report alternates via verbose modeJeff 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>

fill_sha1_file: write into a strbufJeff 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>

alternates: store scratch buffer as strbufJeff 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>

fill_sha1_file: write "boring" charactersJeff 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>

alternates: use a separate scratch spaceJeff 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>

alternates: encapsulate alt->base mungingJeff 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>

alternates: provide helper for allocating alternateJeff 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>

alternates: provide helper for adding to alternates... 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>

link_alt_odb_entry: refactor string handlingJeff 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>

link_alt_odb_entry: handle normalize_path errorsJeff 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>

t5613: clarify "too deep" recursion testsJeff 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>

ls-files: add pathspec matching for submodulesBrandon Williams Fri, 7 Oct 2016 18:18:51 +0000 (11:18 -0700)

ls-files: add pathspec matching for submodules

Pathspecs can be a bit tricky when trying to apply them to submodules.
The main challenge is that the pathspecs will be with respect to the
superproject and not with respect to paths in the submodule. The
approach this patch takes is to pass in the identical pathspec from the
superproject to the submodule in addition to the submodule-prefix, which
is the path from the root of the superproject to the submodule, and then
we can compare an entry in the submodule prepended with the
submodule-prefix to the pathspec in order to determine if there is a
match.

This patch also permits the pathspec logic to perform a prefix match against
submodules since a pathspec could refer to a file inside of a submodule.
Due to limitations in the wildmatch logic, a prefix match is only done
literally. If any wildcard character is encountered we'll simply punt
and produce a false positive match. More accurate matching will be done
once inside the submodule. This is due to the superproject not knowing
what files could exist in the submodule.

Signed-off-by: Brandon Williams <bmwill@google.com>
Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

ls-files: pass through safe options for --recurse-submo... Brandon Williams Fri, 7 Oct 2016 18:18:50 +0000 (11:18 -0700)

ls-files: pass through safe options for --recurse-submodules

Pass through some known-safe options when recursing into submodules.
(--cached, -v, -t, -z, --debug, --eol)

Signed-off-by: Brandon Williams <bmwill@google.com>
Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

ls-files: optionally recurse into submodulesBrandon Williams Fri, 7 Oct 2016 18:18:49 +0000 (11:18 -0700)

ls-files: optionally recurse into submodules

Allow ls-files to recognize submodules in order to retrieve a list of
files from a repository's submodules. This is done by forking off a
process to recursively call ls-files on all submodules. Use top-level
--super-prefix option to pass a path to the submodule which it can
use to prepend to output or pathspec matching logic.

Signed-off-by: Brandon Williams <bmwill@google.com>
Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git: make super-prefix optionBrandon Williams Fri, 7 Oct 2016 18:18:48 +0000 (11:18 -0700)

git: make super-prefix option

Add a super-prefix environment variable 'GIT_INTERNAL_SUPER_PREFIX'
which can be used to specify a path from above a repository down to its
root. When such a super-prefix is specified, the paths reported by Git
are prefixed with it to make them relative to that directory "above".
The paths given by the user on the command line
(e.g. "git subcmd --output-file=path/to/a/file" and pathspecs) are taken
relative to the directory "above" to match.

The immediate use of this option is by commands which have a
--recurse-submodule option in order to give context to submodules about
how they were invoked. This option is currently only allowed for
builtins which support a super-prefix.

Signed-off-by: Brandon Williams <bmwill@google.com>
Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

use strbuf_add_unique_abbrev() for adding short hashes... René Scharfe Sat, 8 Oct 2016 15:38:47 +0000 (17:38 +0200)

use strbuf_add_unique_abbrev() for adding short hashes, part 3

Call strbuf_add_unique_abbrev() to add abbreviated hashes to strbufs
instead of taking detours through find_unique_abbrev() and its static
buffer. This is shorter in most cases and a bit more efficient.

The changes here are not easily handled by a semantic patch because
they involve removing temporary variables and deconstructing format
strings for strbuf_addf().

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

remove unnecessary NULL check before free(3)René Scharfe Sat, 8 Oct 2016 14:14:57 +0000 (16:14 +0200)

remove unnecessary NULL check before free(3)

free(3) handles NULL pointers just fine. Add a semantic patch for
removing unnecessary NULL checks before calling this function, and
apply it on the code base.

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

files_read_raw_ref: prevent infinite retry loops in... Jeff King Thu, 6 Oct 2016 16:48:42 +0000 (12:48 -0400)

files_read_raw_ref: prevent infinite retry loops in general

Limit the number of retries to 3. That should be adequate to
prevent any races, while preventing the possibility of
infinite loops if the logic fails to handle any other
possible error modes correctly.

After the fix in the previous commit, there's no known way
to trigger an infinite loop, but I did manually verify that
this fixes the test in that commit even when the code change
is not applied.

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

files_read_raw_ref: avoid infinite loop on broken symlinksJeff King Thu, 6 Oct 2016 19:41:08 +0000 (15:41 -0400)

files_read_raw_ref: avoid infinite loop on broken symlinks

Our ref resolution first runs lstat() on any path we try to
look up, because we want to treat symlinks specially (by
resolving them manually and considering them symrefs). But
if the results of `readlink` do _not_ look like a ref, we
fall through to treating it like a normal file, and just
read the contents of the linked path.

Since fcb7c76 (resolve_ref_unsafe(): close race condition
reading loose refs, 2013-06-19), that "normal file" code
path will stat() the file and if we see ENOENT, will jump
back to the lstat(), thinking we've seen inconsistent
results between the two calls. But for a symbolic ref, this
isn't a race: the lstat() found the symlink, and the stat()
is looking at the path it points to. We end up in an
infinite loop calling lstat() and stat().

We can fix this by avoiding the retry-on-inconsistent jump
when we know that we found a symlink. While we're at it,
let's add a comment explaining why the symlink case gets to
this code in the first place; without that, it is not
obvious that the correct solution isn't to avoid the stat()
code path entirely.

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

wt-status: begin error messages with lower-caseJohannes Schindelin Fri, 7 Oct 2016 16:09:04 +0000 (18:09 +0200)

wt-status: begin error messages with lower-case

The previous code still followed the old git-pull.sh code which did not
adhere to our new convention.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

wt-status: teach has_{unstaged,uncommitted}_changes... Johannes Schindelin Fri, 7 Oct 2016 16:09:00 +0000 (18:09 +0200)

wt-status: teach has_{unstaged,uncommitted}_changes() about submodules

Sometimes we are *actually* interested in those changes... For
example when an interactive rebase wants to continue with a staged
submodule update.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

wt-status: export also the has_un{staged,committed... Johannes Schindelin Fri, 7 Oct 2016 16:08:56 +0000 (18:08 +0200)

wt-status: export also the has_un{staged,committed}_changes() functions

They will be used in the upcoming rebase helper.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

wt-status: make the require_clean_work_tree() function... Johannes Schindelin Fri, 7 Oct 2016 16:08:38 +0000 (18:08 +0200)

wt-status: make the require_clean_work_tree() function reusable

The function used by "git pull" to stop the user when the working
tree has changes is useful in other places.

Let's move it into a more prominent (and into an actually reusable)
spot: wt-status.[ch].

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pull: make code more similar to the shell script againJohannes Schindelin Fri, 7 Oct 2016 16:08:34 +0000 (18:08 +0200)

pull: make code more similar to the shell script again

When converting the pull command to a builtin, the
require_clean_work_tree() function was renamed and the pull-specific
parts hard-coded.

This makes it impossible to reuse the code, so let's modify the code to
make it more similar to the original shell script again.

Note: when the hint "Please commit or stash them" was introduced first,
Git did not have the convention of continuing error messages in lower
case, but now we do have that convention, therefore we reintroduce this
hint down-cased, obeying said convention.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pull: drop confusing prefix parameter of die_on_unclean... Johannes Schindelin Fri, 7 Oct 2016 16:08:30 +0000 (18:08 +0200)

pull: drop confusing prefix parameter of die_on_unclean_work_tree()

In cmd_pull(), when verifying that there are no changes preventing a
rebasing pull, we diligently pass the prefix parameter to the
die_on_unclean_work_tree() function which in turn diligently passes it
to the has_unstaged_changes() and has_uncommitted_changes() functions.

The casual reader might now be curious (as this developer was) whether
that means that calling `git pull --rebase` in a subdirectory will
ignore unstaged changes in other parts of the working directory. And be
puzzled that `git pull --rebase` (correctly) complains about those
changes outside of the current directory.

The puzzle is easily resolved: while we take pains to pass around the
prefix and even pass it to init_revisions(), the fact that no paths are
passed to init_revisions() ensures that the prefix is simply ignored.

That, combined with the fact that we will *always* want a *full* working
directory check before running a rebasing pull, is reason enough to
simply do away with the actual prefix parameter and to pass NULL
instead, as if we were running this from the top-level working directory
anyway.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Eighth batch for 2.11Junio C Hamano Thu, 6 Oct 2016 21:55:18 +0000 (14:55 -0700)

Eighth batch for 2.11

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

Merge branch 'sg/ref-filter-parse-optim'Junio C Hamano Thu, 6 Oct 2016 21:53:12 +0000 (14:53 -0700)

Merge branch 'sg/ref-filter-parse-optim'

The code that parses the format parameter of for-each-ref command
has seen a micro-optimization.

* sg/ref-filter-parse-optim:
ref-filter: strip format option after a field name only once while parsing

Merge branch 'rs/cocci'Junio C Hamano Thu, 6 Oct 2016 21:53:12 +0000 (14:53 -0700)

Merge branch 'rs/cocci'

Code clean-up with help from coccinelle tool continues.

* rs/cocci:
coccicheck: make transformation for strbuf_addf(sb, "...") more precise
use strbuf_add_unique_abbrev() for adding short hashes, part 2
use strbuf_addstr() instead of strbuf_addf() with "%s", part 2
gitignore: ignore output files of coccicheck make target

Merge branch 'rs/c-auto-resets-attributes'Junio C Hamano Thu, 6 Oct 2016 21:53:12 +0000 (14:53 -0700)

Merge branch 'rs/c-auto-resets-attributes'

When "%C(auto)" appears at the very beginning of the pretty format
string, it did not need to issue the reset sequence, but it did.

* rs/c-auto-resets-attributes:
pretty: avoid adding reset for %C(auto) if output is empty

Merge branch 'ps/http-gssapi-cred-delegation'Junio C Hamano Thu, 6 Oct 2016 21:53:11 +0000 (14:53 -0700)

Merge branch 'ps/http-gssapi-cred-delegation'

In recent versions of cURL, GSSAPI credential delegation is
disabled by default due to CVE-2011-2192; introduce a configuration
to selectively allow enabling this.

* ps/http-gssapi-cred-delegation:
http: control GSSAPI credential delegation

Merge branch 'jk/graph-padding-fix'Junio C Hamano Thu, 6 Oct 2016 21:53:11 +0000 (14:53 -0700)

Merge branch 'jk/graph-padding-fix'

The "graph" API used in "git log --graph" miscounted the number of
output columns consumed so far when drawing a padding line, which
has been fixed; this did not affect any existing code as nobody
tried to write anything after the padding on such a line, though.

* jk/graph-padding-fix:
graph: fix extra spaces in graph_padding_line

Merge branch 'jc/blame-abbrev'Junio C Hamano Thu, 6 Oct 2016 21:53:10 +0000 (14:53 -0700)

Merge branch 'jc/blame-abbrev'

Almost everybody uses DEFAULT_ABBREV to refer to the default
setting for the abbreviation, but "git blame" peeked into
underlying variable bypassing the macro for no good reason.

* jc/blame-abbrev:
blame: use DEFAULT_ABBREV macro

Merge branch 'vn/revision-shorthand-for-side-branch... Junio C Hamano Thu, 6 Oct 2016 21:53:10 +0000 (14:53 -0700)

Merge branch 'vn/revision-shorthand-for-side-branch-log'

"git log rev^..rev" is an often-used revision range specification
to show what was done on a side branch merged at rev. This has
gained a short-hand "rev^-1". In general "rev^-$n" is the same as
"^rev^$n rev", i.e. what has happened on other branches while the
history leading to nth parent was looking the other way.

* vn/revision-shorthand-for-side-branch-log:
revision: new rev^-n shorthand for rev^n..rev

Merge branch 'jk/ambiguous-short-object-names'Junio C Hamano Thu, 6 Oct 2016 21:53:10 +0000 (14:53 -0700)

Merge branch 'jk/ambiguous-short-object-names'

When given an abbreviated object name that is not (or more
realistically, "no longer") unique, we gave a fatal error
"ambiguous argument". This error is now accompanied by hints that
lists the objects that begins with the given prefix. During the
course of development of this new feature, numerous minor bugs were
uncovered and corrected, the most notable one of which is that we
gave "short SHA1 xxxx is ambiguous." twice without good reason.

* jk/ambiguous-short-object-names:
get_short_sha1: make default disambiguation configurable
get_short_sha1: list ambiguous objects on error
for_each_abbrev: drop duplicate objects
sha1_array: let callbacks interrupt iteration
get_short_sha1: mark ambiguity error for translation
get_short_sha1: NUL-terminate hex prefix
get_short_sha1: refactor init of disambiguation code
get_short_sha1: parse tags when looking for treeish
get_sha1: propagate flags to child functions
get_sha1: avoid repeating ourselves via ONLY_TO_DIE
get_sha1: detect buggy calls with multiple disambiguators

git-gui: avoid persisting modified author identityPat Thoyts Thu, 6 Oct 2016 13:04:42 +0000 (14:04 +0100)

git-gui: avoid persisting modified author identity

Commit 7e71adc77f fixes a problem with git-gui failing to pick up the
original author identity during a commit --amend operation. However, the
new author details then become persistent for the remainder of the session.
This commit fixes this by ensuring the environment variables are reset
and the author information reset once the commit is completed.
The relevant changes were reworked to reduce global variables.

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>

git-gui: handle the encoding of Git's output correctlyKarsten Blees Thu, 26 Feb 2015 09:19:45 +0000 (17:19 +0800)

git-gui: handle the encoding of Git's output correctly

If we use 'eval exec $opt $cmdp $args' to execute git command,
tcl engine will convert the output of the git comand with the rule
system default code page to unicode.

But cp936 -> unicode conversion implicitly done by exec is not reversible.
So we have to use git_read instead.

Bug report and an original reproducer by Cloud Chou:
https://github.com/msysgit/git/issues/302

Cloud Chou find the reason of the bug.

Thanks-to: Johannes Schindelin <johannes.schindelin@gmx.de>
Thanks-to: Pat Thoyts <patthoyts@users.sourceforge.net>
Reported-by: Cloud Chou <515312382@qq.com>
Original-test-by: Cloud Chou <515312382@qq.com>
Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Cloud Chou <515312382@qq.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>

git-gui: unicode file name support on windowsKarsten Blees Sat, 4 Feb 2012 20:54:36 +0000 (21:54 +0100)

git-gui: unicode file name support on windows

Assumes file names in git tree objects are UTF-8 encoded.

On most unix systems, the system encoding (and thus the TCL system
encoding) will be UTF-8, so file names will be displayed correctly.

On Windows, it is impossible to set the system encoding to UTF-8. Changing
the TCL system encoding (via 'encoding system ...', e.g. in the startup
code) is explicitly discouraged by the TCL docs.

Change git-gui functions dealing with file names to always convert
from and to UTF-8.

Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>

clone: detect errors in normalize_path_copyJeff King Wed, 5 Oct 2016 14:29:29 +0000 (10:29 -0400)

clone: detect errors in normalize_path_copy

When we are copying the alternates from the source
repository, if we find a relative path that is too deep for
the source (e.g., "../../../objects" from "/repo.git/objects"),
then normalize_path_copy will report an error and leave
trash in the buffer, which we will add to our new alternates
file. Instead, let's detect the error, print a warning, and
skip copying that alternate.

There's no need to die. The relative path is probably just
broken cruft in the source repo. If it turns out to have
been important for accessing some objects, we rely on other
parts of the clone to detect that, just as they would with a
missing object in the source repo itself (though note that
clones with "-s" are inherently local, which may do fewer
object-quality checks in the first place).

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

git-commit.txt: clarify --patch mode with pathspecDuy Nguyen Wed, 5 Oct 2016 10:26:33 +0000 (17:26 +0700)

git-commit.txt: clarify --patch mode with pathspec

How pathspec is used, with and without --interactive/--patch, is
different. But this is not clear from the document. These changes hint
the user to keep reading (to option #5) instead of stopping at #2 and
assuming --patch/--interactive behaves the same way.

And since all the options listed here always mention how the index is
involved (or not) in the final commit, add that bit for #5 as well. This
"on top of the index" is implied when you head over git-add(1), but if
you just go straight to the "Interactive mode" and not read what git-add
is for, you may miss it.

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

diff: introduce diff.wsErrorHighlight optionJunio C Hamano Tue, 4 Oct 2016 22:26:27 +0000 (15:26 -0700)

diff: introduce diff.wsErrorHighlight option

With the preparatory steps, it has become trivial to teach the
system a new diff.wsErrorHighlight configuration that gives the
default value for --ws-error-highlight command line option.

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

diff.c: move ws-error-highlight parsing helpers upJunio C Hamano Tue, 4 Oct 2016 22:09:18 +0000 (15:09 -0700)

diff.c: move ws-error-highlight parsing helpers up

These need to be usable from git_diff_ui_config() code to help
parsing a configuration variable, so move them up.

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

diff.c: refactor parse_ws_error_highlight()Junio C Hamano Tue, 4 Oct 2016 22:03:33 +0000 (15:03 -0700)

diff.c: refactor parse_ws_error_highlight()

Rename the function to parse_ws_error_highlight_opt(), because it is
meant to parse a command line option, and then refactor the meat of
the function into a helper function that reports the parsed result
which is typically a small unsigned int (these are OR'ed bitmask
after all), or a negative offset that indicates where in the input
string a parse error happened.

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

t4015: split out the "setup" part of ws-error-highlight... Junio C Hamano Tue, 4 Oct 2016 22:21:38 +0000 (15:21 -0700)

t4015: split out the "setup" part of ws-error-highlight test

We'd want to run this same set of test twice, once with the option
and another time with an equivalent configuration setting. Split
out the step that prepares the test data and expected output and
move the test for the command line option into a separate test.

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

Merge branch 'dr/ru' into puPat Thoyts Tue, 4 Oct 2016 22:29:40 +0000 (23:29 +0100)

Merge branch 'dr/ru' into pu

git-gui: Update Russian translationDimitriy Ryazantcev Tue, 4 Oct 2016 15:15:16 +0000 (18:15 +0300)

git-gui: Update Russian translation

Signed-off-by: Dimitriy Ryazantcev <dimitriy.ryazantcev@gmail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>

git-gui: maintain backwards compatibility for merge... Pat Thoyts Tue, 4 Oct 2016 11:49:05 +0000 (12:49 +0100)

git-gui: maintain backwards compatibility for merge syntax

Commit b5f325c updated to use the newer merge syntax but continue to
support older versions of git.

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>

http: http.emptyauth should allow empty (not just NULL... David Turner Tue, 4 Oct 2016 14:53:52 +0000 (10:53 -0400)

http: http.emptyauth should allow empty (not just NULL) usernames

When using Kerberos authentication with newer versions of libcurl,
CURLOPT_USERPWD must be set to a value, even if it is an empty value.
The value is never sent to the server. Previous versions of libcurl
did not require this variable to be set. One way that some users
express the empty username/password is http://:@gitserver.example.com,
which http.emptyauth was designed to support. Another, equivalent,
URL is http://@gitserver.example.com. The latter leads to a username
of zero-length, rather than a NULL username, but CURLOPT_USERPWD still
needs to be set (if http.emptyauth is set). Do so.

Signed-off-by: David Turner <dturner@twosigma.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'va/i18n_2' into puPat Thoyts Mon, 3 Oct 2016 22:40:50 +0000 (23:40 +0100)

Merge branch 'va/i18n_2' into pu

git-gui i18n: mark string in lib/error.tcl for translationVasco Almeida Sun, 8 May 2016 10:52:58 +0000 (10:52 +0000)

git-gui i18n: mark string in lib/error.tcl for translation

Mark string "$hook hook failed:" in lib/error.tcl for translation.

Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>

git-gui: fix incorrect use of Tcl append commandVasco Almeida Sun, 8 May 2016 10:52:57 +0000 (10:52 +0000)

git-gui: fix incorrect use of Tcl append command

Fix wrong use of append command in strings marked for translation.
According to Tcl/Tk Documentation [1],
append varName ?value value value ...?
appends all value arguments to the current value of variable varName.
This means that
append "[appname] ([reponame]): " [mc "File Viewer"]
is setting a variable named "[appname] ([reponame]): " to the output of
[mc "File Viewer"], rather than returning the concatenation of both
expressions as one might expect.

The format for some strings enables, for instance, a French translator
to translate like "%s (%s) : Create Branch" (space before colon).
Conversely, strings already translated will be marked as fuzzy and the
translator must update them herself.

For some cases, use alternative way for concatenation instead of using
strcat procedure defined in git-gui.sh.

Reference: 31bb1d1 ("git-gui: Paper bag fix missing translated strings",
2007-09-14) fixes the same issue slightly differently.

[1] http://www.tcl.tk/man/tcl/TclCmd/append.htm

Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>

git-gui i18n: mark "usage:" strings for translationVasco Almeida Sun, 8 May 2016 10:52:56 +0000 (10:52 +0000)

git-gui i18n: mark "usage:" strings for translation

Mark command-line "usage:" string for translation in git-gui.sh.

Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>

git-gui i18n: internationalize use of colon punctuationVasco Almeida Sun, 8 May 2016 10:52:55 +0000 (10:52 +0000)

git-gui i18n: internationalize use of colon punctuation

Internationalize use of colon punctuation ':' in options window, windows
titles, database statistics window. Some languages might use a different
style, for instance French uses "User Name :" (space before colon).

Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>

Merge branch 'pt/non-mouse-usage' into puPat Thoyts Mon, 3 Oct 2016 22:30:44 +0000 (23:30 +0100)

Merge branch 'pt/non-mouse-usage' into pu

Merge branch 'pt/git4win-mods' into puPat Thoyts Mon, 3 Oct 2016 22:30:32 +0000 (23:30 +0100)

Merge branch 'pt/git4win-mods' into pu

Merge branch 'patches' into puPat Thoyts Mon, 3 Oct 2016 22:28:57 +0000 (23:28 +0100)

Merge branch 'patches' into pu

git-gui: ensure the file in the diff pane is in the... Alex Riesen Tue, 28 Jun 2016 08:59:25 +0000 (10:59 +0200)

git-gui: ensure the file in the diff pane is in the list of selected files

It is very confusing that the file which diff is displayed is marked as
selected, but it is not in fact selected (that means the array of selected
files does not include the file in question).

Fixing this also improves the use of $FILENAMES in custom defined tools: one
does not have to click the file in the list to make it selected.

Signed-off-by: Alex Riesen <alexander.riesen@cetitec.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>

git-gui: support for $FILENAMES in tool definitionsAlex Riesen Tue, 28 Jun 2016 08:57:42 +0000 (10:57 +0200)

git-gui: support for $FILENAMES in tool definitions

This adds a FILENAMES environment variable, which contains the repository
pathnames of all selected files the list.
The variable contains the names separated by LF (\n, \x0a).

If the file names contain LF characters, the tool command might be unable to
unambiguously split the value of $FILENAME into the separate names.

Note that the file marked and diffed immediately after starting the GUI up,
is not actually selected. One must click on it once to really select it.

Signed-off-by: Alex Riesen <alexander.riesen@cetitec.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>

git-gui: fix initial git gui message encodingyaras Tue, 23 Feb 2016 11:55:46 +0000 (11:55 +0000)

git-gui: fix initial git gui message encoding

This fix refers https://github.com/git-for-windows/git/issues/664

After `git merge --squash` git creates .git/SQUASH_MSG (UTF-8 encoded)
which contains squashed commits. When run `git gui` it copies SQUASH_MSG
to PREPARE_COMMIT_MSG, but without honoring UTF-8. This leads to encoding
problems on `git gui` commit prompt.

The same applies on git cherry-pick conflict, where MERGE_MSG is created
and then is copied to PREPARE_COMMIT_MSG.

In both cases PREPARE_COMMIT_MSG must be configured to store data in UTF-8.

Signed-off-by: yaras <yaras6@gmail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>

git-gui/po/glossary/txt-to-pot.sh: use the $( ... ... Elia Pinto Tue, 22 Dec 2015 14:10:29 +0000 (15:10 +0100)

git-gui/po/glossary/txt-to-pot.sh: use the $( ... ) construct for command substitution

The Git CodingGuidelines prefer the $(...) construct for command
substitution instead of using the backquotes `...`.

The backquoted form is the traditional method for command
substitution, and is supported by POSIX. However, all but the
simplest uses become complicated quickly. In particular, embedded
command substitutions and/or the use of double quotes require
careful escaping with the backslash character.

The patch was generated by:

for _f in $(find . -name "*.sh")
do
perl -i -pe 'BEGIN{undef $/;} s/`(.+?)`/\$(\1)/smg' "${_f}"
done

and then carefully proof-read.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>

Merge branch 'va/i18n' into puPat Thoyts Mon, 3 Oct 2016 22:23:27 +0000 (23:23 +0100)

Merge branch 'va/i18n' into pu

Merge branch 'rs/use-modern-git-merge-syntax' into puPat Thoyts Mon, 3 Oct 2016 22:23:19 +0000 (23:23 +0100)

Merge branch 'rs/use-modern-git-merge-syntax' into pu

Merge branch 'js/commit-gpgsign' into puPat Thoyts Mon, 3 Oct 2016 22:23:05 +0000 (23:23 +0100)

Merge branch 'js/commit-gpgsign' into pu

Merge branch 'sy/i18n' into puPat Thoyts Mon, 3 Oct 2016 22:22:46 +0000 (23:22 +0100)

Merge branch 'sy/i18n' into pu

t5613: do not chdir in main processJeff 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>

t5613: whitespace/style cleanupsJeff 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>

t5613: use test_must_failJeff 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>

t5613: drop test_valid_repo functionJeff 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>

t5613: drop reachable_via functionJeff 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>

Sync with 2.10.1Junio C Hamano Mon, 3 Oct 2016 20:32:41 +0000 (13:32 -0700)

Sync with 2.10.1

* maint:
Git 2.10.1

Seventh batch for 2.11Junio 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>

Merge 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

Merge 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

Merge 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

Merge 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"

Merge 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

Merge 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

Merge 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

Merge 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

Merge branch 'nd/init-core-worktree-in-multi-worktree... 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

Merge 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

Merge 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

Git 2.10.1 v2.10.1Junio 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>

Merge branch 'jk/ident-ai-canonname-could-be-null'... 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

Merge branch 'jk/doc-cvs-update' into maintJunio 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

Merge branch 'jk/pack-tag-of-tag' into maintJunio 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

ref-filter: strip format option after a field name... SZEDER Gábor Sun, 2 Oct 2016 16:35:11 +0000 (18:35 +0200)

ref-filter: strip format option after a field name only once while parsing

When parse_ref_filter_atom() iterates over a list of valid atoms to
check that a field name is one of them, it has to strip the optional
colon-separated format option suffix that might follow the field name.
However, it does so inside the loop, i.e. it performs the exact same
stripping over and over again.

Move stripping the format option suffix out of that loop, so it's only
performed once for each parsed field name.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

show-branch: use QSORTRené Scharfe Sat, 1 Oct 2016 16:19:48 +0000 (18:19 +0200)

show-branch: use QSORT

Shorten the code by using QSORT instead of calling qsort(3) directly,
as the former determines the element size automatically and checks if
there are at least two elements to sort already.

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

coccicheck: make transformation for strbuf_addf(sb... René Scharfe Sun, 2 Oct 2016 22:58:21 +0000 (00:58 +0200)

coccicheck: make transformation for strbuf_addf(sb, "...") more precise

We can replace strbuf_addf() calls that just add a simple string with
calls to strbuf_addstr() to make the intent clearer. We need to be
careful if that string contains printf format specifications like %%,
though, as a simple replacement would change the output.

Add checks to the semantic patch to make sure we only perform the
transformation if the second argument is a string constant (possibly
translated) that doesn't contain any percent signs.

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

git-gui (Windows): use git-gui.exe in `Create Desktop... Pat Thoyts Sun, 2 Oct 2016 21:19:47 +0000 (22:19 +0100)

git-gui (Windows): use git-gui.exe in `Create Desktop Shortcut`

When calling `Repository>Create Desktop Shortcut`, Git GUI assumes
that it is okay to call `wish.exe` directly on Windows. However, in
Git for Windows 2.x' context, that leaves several crucial environment
variables uninitialized, resulting in a shortcut that does not work.

To fix those environment variable woes, Git for Windows comes with a
convenient `git-gui.exe`, so let's just use it when it is available.

This fixes https://github.com/git-for-windows/git/issues/448

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>

git-gui: fix detection of CygwinPat Thoyts Sun, 2 Oct 2016 10:51:29 +0000 (11:51 +0100)

git-gui: fix detection of Cygwin

MSys2 might *look* like Cygwin, but it is *not* Cygwin... Unless it
is run with `MSYSTEM=MSYS`, that is.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>