git
7 years agoMerge branch 'jk/archive-zip-userdiff-config' into next
Junio C Hamano [Tue, 10 Jan 2017 23:27:31 +0000 (15:27 -0800)] 
Merge branch 'jk/archive-zip-userdiff-config' into next

"git archive" did not read the standard configuration files, and
failed to notice a file that is marked as binary via the userdiff
driver configuration.

* jk/archive-zip-userdiff-config:
  archive-zip: load userdiff config

7 years agoMerge branch 'dt/disable-bitmap-in-auto-gc' into next
Junio C Hamano [Tue, 10 Jan 2017 23:27:30 +0000 (15:27 -0800)] 
Merge branch 'dt/disable-bitmap-in-auto-gc' into next

It is natural that "git gc --auto" may not attempt to pack
everything into a single pack, and there is no point in warning
when the user has configured the system to use the pack bitmap,
leading to disabling further "gc".

* dt/disable-bitmap-in-auto-gc:
  repack: die on incremental + write-bitmap-index
  auto gc: don't write bitmaps for incremental repacks

7 years agoMerge branch 'ls/p4-retry-thrice' into next
Junio C Hamano [Tue, 10 Jan 2017 23:27:30 +0000 (15:27 -0800)] 
Merge branch 'ls/p4-retry-thrice' into next

A recent updates to "git p4" was not usable for older p4 but it
could be made to work with minimum changes.  Do so.

* ls/p4-retry-thrice:
  git-p4: do not pass '-r 0' to p4 commands

7 years agoMerge branch 'sb/submodule-rm-absorb' into next
Junio C Hamano [Tue, 10 Jan 2017 23:27:30 +0000 (15:27 -0800)] 
Merge branch 'sb/submodule-rm-absorb' into next

"git rm" used to refuse to remove a submodule when it has its own
git repository embedded in its working tree.  It learned to move
the repository away to $GIT_DIR/modules/ of the superproject
instead, and allow the submodule to be deleted (as long as there
will be no loss of local modifications, that is).

* sb/submodule-rm-absorb:
  rm: absorb a submodules git dir before deletion
  submodule: rename and add flags to ok_to_remove_submodule
  submodule: modernize ok_to_remove_submodule to use argv_array
  submodule.h: add extern keyword to functions

7 years agoMerge branch 'bw/realpath-wo-chdir' into next
Junio C Hamano [Tue, 10 Jan 2017 23:27:27 +0000 (15:27 -0800)] 
Merge branch 'bw/realpath-wo-chdir' into next

The implementation of "real_path()" was to go there with chdir(2)
and call getcwd(3), but this obviously wouldn't be usable in a
threaded environment.  Rewrite it to manually resolve relative
paths including symbolic links in path components.

* bw/realpath-wo-chdir:
  real_path: set errno when max number of symlinks is exceeded
  real_path: prevent redefinition of MAXSYMLINKS

7 years agoSync with master
Junio C Hamano [Tue, 10 Jan 2017 23:26:58 +0000 (15:26 -0800)] 
Sync with master

* master:
  Fifth batch 2.12

7 years agoFifth batch 2.12
Junio C Hamano [Tue, 10 Jan 2017 23:25:46 +0000 (15:25 -0800)] 
Fifth batch 2.12

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoMerge branch 'sb/submodule-embed-gitdir'
Junio C Hamano [Tue, 10 Jan 2017 23:24:27 +0000 (15:24 -0800)] 
Merge branch 'sb/submodule-embed-gitdir'

A new submodule helper "git submodule embedgitdirs" to make it
easier to move embedded .git/ directory for submodules in a
superproject to .git/modules/ (and point the latter with the former
that is turned into a "gitdir:" file) has been added.

* sb/submodule-embed-gitdir:
  worktree: initialize return value for submodule_uses_worktrees
  submodule: add absorb-git-dir function
  move connect_work_tree_and_git_dir to dir.h
  worktree: check if a submodule uses worktrees
  test-lib-functions.sh: teach test_commit -C <dir>
  submodule helper: support super prefix
  submodule: use absolute path for computing relative path connecting

7 years agoMerge branch 'jc/retire-compaction-heuristics'
Junio C Hamano [Tue, 10 Jan 2017 23:24:27 +0000 (15:24 -0800)] 
Merge branch 'jc/retire-compaction-heuristics'

"git diff" and its family had two experimental heuristics to shift
the contents of a hunk to make the patch easier to read.  One of
them turns out to be better than the other, so leave only the
"--indent-heuristic" option and remove the other one.

* jc/retire-compaction-heuristics:
  diff: retire "compaction" heuristics

7 years agoMerge branch 'nd/config-misc-fixes'
Junio C Hamano [Tue, 10 Jan 2017 23:24:27 +0000 (15:24 -0800)] 
Merge branch 'nd/config-misc-fixes'

Leakage of lockfiles in the config subsystem has been fixed.

* nd/config-misc-fixes:
  config.c: handle lock file in error case in git_config_rename_...
  config.c: rename label unlock_and_out
  config.c: handle error case for fstat() calls

7 years agoMerge branch 'jc/abbrev-autoscale-config'
Junio C Hamano [Tue, 10 Jan 2017 23:24:26 +0000 (15:24 -0800)] 
Merge branch 'jc/abbrev-autoscale-config'

Recent update to the default abbreviation length that auto-scales
lacked documentation update, which has been corrected.

* jc/abbrev-autoscale-config:
  config.abbrev: document the new default that auto-scales

7 years agoMerge branch 'mh/fast-import-notes-fix-new'
Junio C Hamano [Tue, 10 Jan 2017 23:24:26 +0000 (15:24 -0800)] 
Merge branch 'mh/fast-import-notes-fix-new'

"git fast-import" sometimes mishandled while rebalancing notes
tree, which has been fixed.

* mh/fast-import-notes-fix-new:
  fast-import: properly fanout notes when tree is imported

7 years agoMerge branch 'jc/git-open-cloexec'
Junio C Hamano [Tue, 10 Jan 2017 23:24:26 +0000 (15:24 -0800)] 
Merge branch 'jc/git-open-cloexec'

The codeflow of setting NOATIME and CLOEXEC on file descriptors Git
opens has been simplified.
We may want to drop the tip one, but we'll see.

* jc/git-open-cloexec:
  sha1_file: stop opening files with O_NOATIME
  git_open_cloexec(): use fcntl(2) w/ FD_CLOEXEC fallback
  git_open(): untangle possible NOATIME and CLOEXEC interactions

7 years agoMerge branch 'jc/compression-config'
Junio C Hamano [Tue, 10 Jan 2017 23:24:25 +0000 (15:24 -0800)] 
Merge branch 'jc/compression-config'

Compression setting for producing packfiles were spread across
three codepaths, one of which did not honor any configuration.
Unify these so that all of them honor core.compression and
pack.compression variables the same way.

* jc/compression-config:
  compression: unify pack.compression configuration parsing

7 years agoMerge branch 'dt/smart-http-detect-server-going-away'
Junio C Hamano [Tue, 10 Jan 2017 23:24:25 +0000 (15:24 -0800)] 
Merge branch 'dt/smart-http-detect-server-going-away'

When the http server gives an incomplete response to a smart-http
rpc call, it could lead to client waiting for a full response that
will never come.  Teach the client side to notice this condition
and abort the transfer.

An improvement counterproposal has failed.
cf. <20161114194049.mktpsvgdhex2f4zv@sigill.intra.peff.net>

* dt/smart-http-detect-server-going-away:
  upload-pack: optionally allow fetching any sha1
  remote-curl: don't hang when a server dies before any output

7 years agoMerge branch 'mm/gc-safety-doc'
Junio C Hamano [Tue, 10 Jan 2017 23:24:25 +0000 (15:24 -0800)] 
Merge branch 'mm/gc-safety-doc'

Doc update.

* mm/gc-safety-doc:
  git-gc.txt: expand discussion of races with other processes

7 years agoMerge branch 'mm/push-social-engineering-attack-doc'
Junio C Hamano [Tue, 10 Jan 2017 23:24:24 +0000 (15:24 -0800)] 
Merge branch 'mm/push-social-engineering-attack-doc'

Doc update on fetching and pushing.

* mm/push-social-engineering-attack-doc:
  doc: mention transfer data leaks in more places

7 years agoMerge branch 'jt/fetch-no-redundant-tag-fetch-map'
Junio C Hamano [Tue, 10 Jan 2017 23:24:23 +0000 (15:24 -0800)] 
Merge branch 'jt/fetch-no-redundant-tag-fetch-map'

Code cleanup to avoid using redundant refspecs while fetching with
the --tags option.

* jt/fetch-no-redundant-tag-fetch-map:
  fetch: do not redundantly calculate tag refmap

7 years agoMerge branch 'jc/latin-1'
Junio C Hamano [Tue, 10 Jan 2017 23:24:22 +0000 (15:24 -0800)] 
Merge branch 'jc/latin-1'

Some platforms no longer understand "latin-1" that is still seen in
the wild in e-mail headers; replace them with "iso-8859-1" that is
more widely known when conversion fails from/to it.

* jc/latin-1:
  utf8: accept "latin-1" as ISO-8859-1
  utf8: refactor code to decide fallback encoding

7 years agoreal_path: set errno when max number of symlinks is exceeded
Brandon Williams [Mon, 9 Jan 2017 18:50:24 +0000 (10:50 -0800)] 
real_path: set errno when max number of symlinks is exceeded

Set errno to ELOOP when the maximum number of symlinks is exceeded, as
would be done by other symlink-resolving functions.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoreal_path: prevent redefinition of MAXSYMLINKS
Brandon Williams [Mon, 9 Jan 2017 18:50:23 +0000 (10:50 -0800)] 
real_path: prevent redefinition of MAXSYMLINKS

The macro 'MAXSYMLINKS' is already defined on macOS and Linux in
<sys/param.h>.  If 'MAXSYMLINKS' has already been defined, use the value
defined by the OS otherwise default to a value of 32 which is more
inline with what is allowed by many systems.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoarchive-zip: load userdiff config
Jeff King [Mon, 2 Jan 2017 22:25:09 +0000 (17:25 -0500)] 
archive-zip: load userdiff config

Since 4aff646d17 (archive-zip: mark text files in archives,
2015-03-05), the zip archiver will look at the userdiff
driver to decide whether a file is text or binary. This
usually doesn't need to look any further than the attributes
themselves (e.g., "-diff", etc). But if the user defines a
custom driver like "diff=foo", we need to look at
"diff.foo.binary" in the config. Prior to this patch, we
didn't actually load it.

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agogit-p4: do not pass '-r 0' to p4 commands
Igor Kushnir [Thu, 29 Dec 2016 10:22:23 +0000 (12:22 +0200)] 
git-p4: do not pass '-r 0' to p4 commands

git-p4 crashes when used with a very old p4 client version
that does not support the '-r <number>' option in its commands.

Allow making git-p4 work with old p4 clients by setting git-p4.retries to 0.

Alternatively git-p4.retries could be made opt-in.
But since only very old, barely maintained p4 versions don't support
the '-r' option, the setting-retries-to-0 workaround would do.

The "-r retries" option is present in Perforce 2012.2 Command Reference,
but absent from Perforce 2012.1 Command Reference.

Signed-off-by: Igor Kushnir <igorkuo@gmail.com>
Acked-by: Lars Schneider <larsxschneider@gmail.com>
Reviewed-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agorepack: die on incremental + write-bitmap-index
David Turner [Wed, 28 Dec 2016 22:45:42 +0000 (17:45 -0500)] 
repack: die on incremental + write-bitmap-index

The bitmap index only works for single packs, so requesting an
incremental repack with bitmap indexes makes no sense.

Signed-off-by: David Turner <dturner@twosigma.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoauto gc: don't write bitmaps for incremental repacks
David Turner [Wed, 28 Dec 2016 22:45:41 +0000 (17:45 -0500)] 
auto gc: don't write bitmaps for incremental repacks

When git gc --auto does an incremental repack of loose objects, we do
not expect to be able to write a bitmap; it is very likely that
objects in the new pack will have references to objects outside of the
pack.  So we shouldn't try to write a bitmap, because doing so will
likely issue a warning.

This warning was making its way into gc.log.  When the gc.log was
present, future auto gc runs would refuse to run.

Patch by Jeff King.
Bug report, test, and commit message by David Turner.

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 agoMerge branch 'jc/retire-compaction-heuristics' into next
Junio C Hamano [Tue, 27 Dec 2016 23:00:31 +0000 (15:00 -0800)] 
Merge branch 'jc/retire-compaction-heuristics' into next

"git diff" and its family had two experimental heuristics to shift
the contents of a hunk to make the patch easier to read.  One of
them turns out to be better than the other, so leave only the
"--indent-heuristic" option and remove the other one.

* jc/retire-compaction-heuristics:
  diff: retire "compaction" heuristics

7 years agoMerge branch 'nd/config-misc-fixes' into next
Junio C Hamano [Tue, 27 Dec 2016 23:00:31 +0000 (15:00 -0800)] 
Merge branch 'nd/config-misc-fixes' into next

Leakage of lockfiles in the config subsystem has been fixed.

* nd/config-misc-fixes:
  config.c: handle lock file in error case in git_config_rename_...
  config.c: rename label unlock_and_out
  config.c: handle error case for fstat() calls

7 years agoMerge branch 'jc/abbrev-autoscale-config' into next
Junio C Hamano [Tue, 27 Dec 2016 23:00:31 +0000 (15:00 -0800)] 
Merge branch 'jc/abbrev-autoscale-config' into next

Recent update to the default abbreviation length that auto-scales
lacked documentation update, which has been corrected.

* jc/abbrev-autoscale-config:
  config.abbrev: document the new default that auto-scales

7 years agoMerge branch 'mh/fast-import-notes-fix-new' into next
Junio C Hamano [Tue, 27 Dec 2016 23:00:30 +0000 (15:00 -0800)] 
Merge branch 'mh/fast-import-notes-fix-new' into next

"git fast-import" sometimes mishandled while rebalancing notes
tree, which has been fixed.

* mh/fast-import-notes-fix-new:
  fast-import: properly fanout notes when tree is imported

7 years agoMerge branch 'jc/git-open-cloexec' into next
Junio C Hamano [Tue, 27 Dec 2016 23:00:30 +0000 (15:00 -0800)] 
Merge branch 'jc/git-open-cloexec' into next

The codeflow of setting NOATIME and CLOEXEC on file descriptors Git
opens has been simplified.

* jc/git-open-cloexec:
  sha1_file: stop opening files with O_NOATIME
  git_open_cloexec(): use fcntl(2) w/ FD_CLOEXEC fallback
  git_open(): untangle possible NOATIME and CLOEXEC interactions

7 years agoSync with master
Junio C Hamano [Tue, 27 Dec 2016 22:25:16 +0000 (14:25 -0800)] 
Sync with master

* master:
  Fourth batch for 2.12

7 years agorm: absorb a submodules git dir before deletion
Stefan Beller [Tue, 27 Dec 2016 19:03:14 +0000 (11:03 -0800)] 
rm: absorb a submodules git dir before deletion

When deleting a submodule, we need to keep the actual git directory around,
such that we do not lose local changes in there and at a later checkout
of the submodule we don't need to clone it again.

Now that the functionality is available to absorb the git directory of a
submodule, rewrite the checking in git-rm to not complain, but rather
relocate the git directories inside the superproject.

An alternative solution was discussed to have a function
`depopulate_submodule`. That would couple the check for its git directory
and possible relocation before the the removal, such that it is less
likely to miss the check in the future.  But the indirection with such
a function added seemed also complex. The reason for that was that this
possible move of the git directory was also implemented in
`ok_to_remove_submodule`, such that this function could truthfully
answer whether it is ok to remove the submodule.

The solution proposed here defers all these checks to the caller.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agosubmodule: rename and add flags to ok_to_remove_submodule
Stefan Beller [Tue, 20 Dec 2016 23:20:11 +0000 (15:20 -0800)] 
submodule: rename and add flags to ok_to_remove_submodule

In different contexts the question "Is it ok to delete a submodule?"
may be answered differently.

In 293ab15eea (submodule: teach rm to remove submodules unless they
contain a git directory, 2012-09-26) a case was made that we can safely
ignore ignored untracked files for removal as we explicitely ask for the
removal of the submodule.

In a later patch we want to remove submodules even when the user doesn't
explicitly ask for it (e.g. checking out a tree-ish in which the submodule
doesn't exist).  In that case we want to be more careful when it comes
to deletion of untracked files. As of this patch it is unclear how this
will be implemented exactly, so we'll offer flags in which the caller
can specify how the different untracked files ought to be handled.

As the flags allow the function to not die on an error when spawning
a child process, we need to find an appropriate return code for the
case when the child process could not be started. As in that case we
cannot tell if the submodule is ok to remove, we'd want to return 'false'.

As only 0 is understood as false, rename the function to invert the
meaning, i.e. the return code of 0 signals the removal of the submodule
is fine, and other values can be used to return a more precise answer
what went wrong.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agosubmodule: modernize ok_to_remove_submodule to use argv_array
Stefan Beller [Tue, 20 Dec 2016 23:20:10 +0000 (15:20 -0800)] 
submodule: modernize ok_to_remove_submodule to use argv_array

Instead of constructing the NULL terminated array ourselves, we
should make use of the argv_array infrastructure.

While at it, adapt the error messages to reflect the actual invocation.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agosubmodule.h: add extern keyword to functions
Stefan Beller [Tue, 20 Dec 2016 23:20:09 +0000 (15:20 -0800)] 
submodule.h: add extern keyword to functions

As the upcoming series will add a lot of functions to the submodule
header, let's first make the header consistent to the rest of the project
by adding the extern keyword to functions.

As per the CodingGuidelines we try to stay below 80 characters per line,
so adapt all those functions to stay below 80 characters that are already
using more than one line.  Those function using just one line are better
kept in one line than breaking them up into multiple lines just for the
goal of staying below the character limit as it makes grepping
for functions easier if they are one liners.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoMerge branch 'sb/submodule-embed-gitdir' into next
Junio C Hamano [Tue, 27 Dec 2016 22:00:54 +0000 (14:00 -0800)] 
Merge branch 'sb/submodule-embed-gitdir' into next

A new submodule helper "git submodule embedgitdirs" to make it
easier to move embedded .git/ directory for submodules in a
superproject to .git/modules/ (and point the latter with the former
that is turned into a "gitdir:" file) has been added.

* sb/submodule-embed-gitdir:
  worktree: initialize return value for submodule_uses_worktrees

7 years agoworktree: initialize return value for submodule_uses_worktrees
Stefan Beller [Tue, 27 Dec 2016 17:50:13 +0000 (09:50 -0800)] 
worktree: initialize return value for submodule_uses_worktrees

When the worktrees directory is empty, the `ret` will be returned
uninitialized. Fix it by initializing the value.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoMerge branch 'jc/lock-report-on-error' into next
Junio C Hamano [Tue, 27 Dec 2016 21:41:06 +0000 (13:41 -0800)] 
Merge branch 'jc/lock-report-on-error' into next

Git 2.11 had a minor regression in "merge --ff-only" that competed
with another process that simultanously attempted to update the
index. We used to explain what went wrong with an error message,
but the new code silently failed.  The error message has been
resurrected.

* jc/lock-report-on-error:
  lockfile: move REPORT_ON_ERROR bit elsewhere

7 years agoFourth batch for 2.12
Junio C Hamano [Tue, 27 Dec 2016 17:17:51 +0000 (09:17 -0800)] 
Fourth batch for 2.12

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoMerge branch 'jc/lock-report-on-error'
Junio C Hamano [Tue, 27 Dec 2016 17:17:32 +0000 (09:17 -0800)] 
Merge branch 'jc/lock-report-on-error'

* jc/lock-report-on-error:
  lockfile: move REPORT_ON_ERROR bit elsewhere

7 years agolockfile: move REPORT_ON_ERROR bit elsewhere
Junio C Hamano [Tue, 27 Dec 2016 17:12:09 +0000 (09:12 -0800)] 
lockfile: move REPORT_ON_ERROR bit elsewhere

There was LOCK_NO_DEREF defined as 2 = 1<<1 with the same value,
which was missed due to a huge comment block.  Deconflict by moving
the new one to 4 = 1<<2 for now.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoMerge branch 'js/mingw-isatty'
Junio C Hamano [Tue, 27 Dec 2016 08:11:46 +0000 (00:11 -0800)] 
Merge branch 'js/mingw-isatty'

Update the isatty() emulation for Windows by updating the previous
hack that depended on internals of (older) MSVC runtime.

* js/mingw-isatty:
  mingw: replace isatty() hack
  mingw: fix colourization on Cygwin pseudo terminals
  mingw: adjust is_console() to work with stdin

7 years agoMerge branch 'ls/p4-lfs'
Junio C Hamano [Tue, 27 Dec 2016 08:11:46 +0000 (00:11 -0800)] 
Merge branch 'ls/p4-lfs'

Update GitLFS integration with "git p4".

* ls/p4-lfs:
  git-p4: add diff/merge properties to .gitattributes for GitLFS files

7 years agoMerge branch 'va/i18n-even-more'
Junio C Hamano [Tue, 27 Dec 2016 08:11:45 +0000 (00:11 -0800)] 
Merge branch 'va/i18n-even-more'

* va/i18n-even-more:
  i18n: fix misconversion in shell scripts

7 years agoMerge branch 'lt/shortlog-by-committer'
Junio C Hamano [Tue, 27 Dec 2016 08:11:44 +0000 (00:11 -0800)] 
Merge branch 'lt/shortlog-by-committer'

"git shortlog" learned "--committer" option to group commits by
committer, instead of author.

* lt/shortlog-by-committer:
  t4201: make tests work with and without the MINGW prerequiste
  shortlog: test and document --committer option
  shortlog: group by committer information

7 years agoMerge branch 'mk/mingw-winansi-ttyname-termination-fix'
Junio C Hamano [Tue, 27 Dec 2016 08:11:44 +0000 (00:11 -0800)] 
Merge branch 'mk/mingw-winansi-ttyname-termination-fix'

A potential but unlikely buffer overflow in Windows port has been
fixed.

* mk/mingw-winansi-ttyname-termination-fix:
  mingw: consider that UNICODE_STRING::Length counts bytes

7 years agoMerge branch 'gv/p4-multi-path-commit-fix'
Junio C Hamano [Tue, 27 Dec 2016 08:11:43 +0000 (00:11 -0800)] 
Merge branch 'gv/p4-multi-path-commit-fix'

"git p4" that tracks multile p4 paths imported a single changelist
that touches files in these multiple paths as one commit, followed
by many empty commits.  This has been fixed.

* gv/p4-multi-path-commit-fix:
  git-p4: fix multi-path changelist empty commits

7 years agoMerge branch 'jk/difftool-in-subdir'
Junio C Hamano [Tue, 27 Dec 2016 08:11:43 +0000 (00:11 -0800)] 
Merge branch 'jk/difftool-in-subdir'

Even though an fix was attempted in Git 2.9.3 days, but running
"git difftool --dir-diff" from a subdirectory never worked. This
has been fixed.

* jk/difftool-in-subdir:
  difftool: rename variables for consistency
  difftool: chdir as early as possible
  difftool: sanitize $workdir as early as possible
  difftool: fix dir-diff index creation when in a subdirectory

7 years agoMerge branch 'ld/p4-compare-dir-vs-symlink'
Junio C Hamano [Tue, 27 Dec 2016 08:11:42 +0000 (00:11 -0800)] 
Merge branch 'ld/p4-compare-dir-vs-symlink'

"git p4" misbehaved when swapping a directory and a symbolic link.

* ld/p4-compare-dir-vs-symlink:
  git-p4: avoid crash adding symlinked directory

7 years agoMerge branch 'ls/filter-process'
Junio C Hamano [Tue, 27 Dec 2016 08:11:42 +0000 (00:11 -0800)] 
Merge branch 'ls/filter-process'

Doc update.

* ls/filter-process:
  t0021: fix flaky test
  docs: warn about possible '=' in clean/smudge filter process values

7 years agoMerge branch 'bw/transport-protocol-policy'
Junio C Hamano [Tue, 27 Dec 2016 08:11:41 +0000 (00:11 -0800)] 
Merge branch 'bw/transport-protocol-policy'

Finer-grained control of what protocols are allowed for transports
during clone/fetch/push have been enabled via a new configuration
mechanism.

* bw/transport-protocol-policy:
  http: respect protocol.*.allow=user for http-alternates
  transport: add from_user parameter to is_transport_allowed
  http: create function to get curl allowed protocols
  transport: add protocol policy config option
  http: always warn if libcurl version is too old
  lib-proto-disable: variable name fix

7 years agoMerge branch 'cp/merge-continue'
Junio C Hamano [Tue, 27 Dec 2016 08:11:41 +0000 (00:11 -0800)] 
Merge branch 'cp/merge-continue'

"git merge --continue" has been added as a synonym to "git commit"
to conclude a merge that has stopped due to conflicts.

* cp/merge-continue:
  merge: mark usage error strings for translation
  merge: ensure '--abort' option takes no arguments
  completion: add --continue option for merge
  merge: add '--continue' option as a synonym for 'git commit'

7 years agoMerge branch 'va/i18n-perl-scripts'
Junio C Hamano [Tue, 27 Dec 2016 08:11:40 +0000 (00:11 -0800)] 
Merge branch 'va/i18n-perl-scripts'

Porcelain scripts written in Perl are getting internationalized.

* va/i18n-perl-scripts:
  i18n: difftool: mark warnings for translation
  i18n: send-email: mark composing message for translation
  i18n: send-email: mark string with interpolation for translation
  i18n: send-email: mark warnings and errors for translation
  i18n: send-email: mark strings for translation
  i18n: add--interactive: mark status words for translation
  i18n: add--interactive: remove %patch_modes entries
  i18n: add--interactive: mark edit_hunk_manually message for translation
  i18n: add--interactive: i18n of help_patch_cmd
  i18n: add--interactive: mark patch prompt for translation
  i18n: add--interactive: mark plural strings
  i18n: clean.c: match string with git-add--interactive.perl
  i18n: add--interactive: mark strings with interpolation for translation
  i18n: add--interactive: mark simple here-documents for translation
  i18n: add--interactive: mark strings for translation
  Git.pm: add subroutines for commenting lines

7 years agoMerge branch 'sb/submodule-config-cleanup'
Junio C Hamano [Tue, 27 Dec 2016 08:11:40 +0000 (00:11 -0800)] 
Merge branch 'sb/submodule-config-cleanup'

Minor code clean-up.

* sb/submodule-config-cleanup:
  submodule-config: clarify parsing of null_sha1 element
  submodule-config: rename commit_sha1 to treeish_name
  submodule config: inline config_from_{name, path}

7 years agoMerge branch 'jc/push-default-explicit'
Junio C Hamano [Tue, 27 Dec 2016 08:11:40 +0000 (00:11 -0800)] 
Merge branch 'jc/push-default-explicit'

A lazy "git push" without refspec did not internally use a fully
specified refspec to perform 'current', 'simple', or 'upstream'
push, causing unnecessary "ambiguous ref" errors.

* jc/push-default-explicit:
  push: test pushing ambiguously named branches
  push: do not use potentially ambiguous default refspec

7 years agodiff: retire "compaction" heuristics
Junio C Hamano [Fri, 23 Dec 2016 20:32:22 +0000 (12:32 -0800)] 
diff: retire "compaction" heuristics

When a patch inserts a block of lines, whose last lines are the
same as the existing lines that appear before the inserted block,
"git diff" can choose any place between these existing lines as the
boundary between the pre-context and the added lines (adjusting the
end of the inserted block as appropriate) to come up with variants
of the same patch, and some variants are easier to read than others.

We have been trying to improve the choice of this boundary, and Git
2.11 shipped with an experimental "compaction-heuristic".  Since
then another attempt to improve the logic further resulted in a new
"indent-heuristic" logic.  It is agreed that the latter gives better
result overall, and the former outlived its usefulness.

Retire "compaction", and keep "indent" as an experimental feature.
The latter hopefully will be turned on by default in a future
release, but that should be done as a separate step.

Suggested-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoconfig.abbrev: document the new default that auto-scales
Junio C Hamano [Wed, 2 Nov 2016 01:34:07 +0000 (18:34 -0700)] 
config.abbrev: document the new default that auto-scales

We somehow forgot to update the "default is 7" in the
documentation.  Also give a way to explicitly ask the auto-scaling
by setting config.abbrev to "auto".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoconfig.c: handle lock file in error case in git_config_rename_...
Nguyễn Thái Ngọc Duy [Tue, 20 Dec 2016 09:48:36 +0000 (16:48 +0700)] 
config.c: handle lock file in error case in git_config_rename_...

We could rely on atexit() to clean up everything, but let's be
explicit when we can. And it's good anyway because the function is
called the second time in the same process, we're in trouble.

This function should not affect the successful case because after
commit_lock_file() is called, rollback_lock_file() becomes no-op,
as long as it is initialized.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoMerge branch 'bw/grep-recurse-submodules' into next
Junio C Hamano [Thu, 22 Dec 2016 20:09:53 +0000 (12:09 -0800)] 
Merge branch 'bw/grep-recurse-submodules' into next

"git grep" learns to optionally recurse into submodules.

* bw/grep-recurse-submodules:
  grep: search history of moved submodules
  grep: enable recurse-submodules to work on <tree> objects
  grep: optionally recurse into submodules
  grep: add submodules as a grep source type
  submodules: load gitmodules file from commit sha1
  submodules: add helper to determine if a submodule is initialized
  submodules: add helper to determine if a submodule is populated

7 years agoMerge branch 'bw/realpath-wo-chdir' into next
Junio C Hamano [Thu, 22 Dec 2016 20:09:52 +0000 (12:09 -0800)] 
Merge branch 'bw/realpath-wo-chdir' into next

The implementation of "real_path()" was to go there with chdir(2)
and call getcwd(3), but this obviously wouldn't be usable in a
threaded environment.  Rewrite it to manually resolve relative
paths including symbolic links in path components.

* bw/realpath-wo-chdir:
  real_path: canonicalize directory separators in root parts
  real_path: have callers use real_pathdup and strbuf_realpath
  real_path: create real_pathdup
  real_path: convert real_path_internal to strbuf_realpath
  real_path: resolve symlinks by hand

7 years agoMerge branch 'va/i18n-even-more' into next
Junio C Hamano [Thu, 22 Dec 2016 20:09:52 +0000 (12:09 -0800)] 
Merge branch 'va/i18n-even-more' into next

* va/i18n-even-more:
  i18n: fix misconversion in shell scripts

7 years agoMerge branch 'ls/p4-lfs' into next
Junio C Hamano [Thu, 22 Dec 2016 20:09:50 +0000 (12:09 -0800)] 
Merge branch 'ls/p4-lfs' into next

Update GitLFS integration with "git p4".

* ls/p4-lfs:
  git-p4: add diff/merge properties to .gitattributes for GitLFS files

7 years agoMerge branch 'js/mingw-isatty' into next
Junio C Hamano [Thu, 22 Dec 2016 20:09:48 +0000 (12:09 -0800)] 
Merge branch 'js/mingw-isatty' into next

Update the isatty() emulation for Windows by updating the previous
hack that depended on internals of (older) MSVC runtime.

* js/mingw-isatty:
  mingw: replace isatty() hack
  mingw: fix colourization on Cygwin pseudo terminals
  mingw: adjust is_console() to work with stdin

7 years agogrep: search history of moved submodules
Brandon Williams [Fri, 16 Dec 2016 19:03:22 +0000 (11:03 -0800)] 
grep: search history of moved submodules

If a submodule was renamed at any point since it's inception then if you
were to try and grep on a commit prior to the submodule being moved, you
wouldn't be able to find a working directory for the submodule since the
path in the past is different from the current path.

This patch teaches grep to find the .git directory for a submodule in
the parents .git/modules/ directory in the event the path to the
submodule in the commit that is being searched differs from the state of
the currently checked out commit.  If found, the child process that is
spawned to grep the submodule will chdir into its gitdir instead of a
working directory.

In order to override the explicit setting of submodule child process's
gitdir environment variable (which was introduced in '10f5c526')
`GIT_DIR_ENVIORMENT` needs to be pushed onto child process's env_array.
This allows the searching of history from a submodule's gitdir, rather
than from a working directory.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agogrep: enable recurse-submodules to work on <tree> objects
Brandon Williams [Fri, 16 Dec 2016 19:03:21 +0000 (11:03 -0800)] 
grep: enable recurse-submodules to work on <tree> objects

Teach grep to recursively search in submodules when provided with a
<tree> object. This allows grep to search a submodule based on the state
of the submodule that is present in a commit of the super project.

When grep is provided with a <tree> object, the name of the object is
prefixed to all output.  In order to provide uniformity of output
between the parent and child processes the option `--parent-basename`
has been added so that the child can preface all of it's output with the
name of the parent's object instead of the name of the commit SHA1 of
the submodule. This changes output from the command
`git grep -e. -l --recurse-submodules HEAD` from:

      HEAD:file
      <commit sha1 of submodule>:sub/file

to:

      HEAD:file
      HEAD:sub/file

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agogrep: optionally recurse into submodules
Brandon Williams [Fri, 16 Dec 2016 19:03:20 +0000 (11:03 -0800)] 
grep: optionally recurse into submodules

Allow grep to recognize submodules and recursively search for patterns in
each submodule.  This is done by forking off a process to recursively
call grep on each submodule.  The top level --super-prefix option is
used to pass a path to the submodule which can in turn be used to
prepend to output or in pathspec matching logic.

Recursion only occurs for submodules which have been initialized and
checked out by the parent project.  If a submodule hasn't been
initialized and checked out it is simply skipped.

In order to support the existing multi-threading infrastructure in grep,
output from each child process is captured in a strbuf so that it can be
later printed to the console in an ordered fashion.

To limit the number of theads that are created, each child process has
half the number of threads as its parents (minimum of 1), otherwise we
potentailly have a fork-bomb.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agogrep: add submodules as a grep source type
Brandon Williams [Fri, 16 Dec 2016 19:03:19 +0000 (11:03 -0800)] 
grep: add submodules as a grep source type

Add `GREP_SOURCE_SUBMODULE` as a grep_source type and cases for this new
type in the various switch statements in grep.c.

When initializing a grep_source with type `GREP_SOURCE_SUBMODULE` the
identifier can either be NULL (to indicate that the working tree will be
used) or a SHA1 (the REV of the submodule to be grep'd).  If the
identifier is a SHA1 then we want to fall through to the
`GREP_SOURCE_SHA1` case to handle the copying of the SHA1.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agosubmodules: load gitmodules file from commit sha1
Brandon Williams [Fri, 16 Dec 2016 19:03:18 +0000 (11:03 -0800)] 
submodules: load gitmodules file from commit sha1

teach submodules to load a '.gitmodules' file from a commit sha1.  This
enables the population of the submodule_cache to be based on the state
of the '.gitmodules' file from a particular commit.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agosubmodules: add helper to determine if a submodule is initialized
Brandon Williams [Fri, 16 Dec 2016 19:03:17 +0000 (11:03 -0800)] 
submodules: add helper to determine if a submodule is initialized

Add the `is_submodule_initialized()` helper function to submodules.c.
`is_submodule_initialized()` performs a check to determine if the
submodule at the given path has been initialized.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agosubmodules: add helper to determine if a submodule is populated
Brandon Williams [Fri, 16 Dec 2016 19:03:16 +0000 (11:03 -0800)] 
submodules: add helper to determine if a submodule is populated

Add the `is_submodule_populated()` helper function to submodules.c.
`is_submodule_populated()` performes a check to see if a submodule has
been checkout out (and has a valid .git directory/file) at the given path.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoreal_path: canonicalize directory separators in root parts
Johannes Sixt [Wed, 21 Dec 2016 21:51:35 +0000 (22:51 +0100)] 
real_path: canonicalize directory separators in root parts

When an absolute path is resolved, resolution begins at the first path
component after the root part. The root part is just copied verbatim,
because it must not be inspected for symbolic links. For POSIX paths,
this is just the initial slash, but on Windows, the root part has the
forms c:\ or \\server\share. We do want to canonicalize the back-slashes
in the root part because these parts are compared to the result of
getcwd(), which does return a fully canonicalized path.

Factor out a helper that splits off the root part, and have it
canonicalize the copied part.

This change was prompted because t1504-ceiling-dirs.sh caught a breakage
in GIT_CEILING_DIRECTORIES handling on Windows.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Acked-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agomingw: replace isatty() hack
Jeff Hostetler [Thu, 22 Dec 2016 17:09:23 +0000 (18:09 +0100)] 
mingw: replace isatty() hack

Git for Windows has carried a patch that depended on internals
of MSVC runtime, but it does not work correctly with recent MSVC
runtime. A replacement was written originally for compiling
with VC++. The patch in this message is a backport of that
replacement, and it also fixes the previous attempt to make
isatty() tell that /dev/null is *not* an interactive terminal.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Tested-by: Beat Bolli <dev+git@drbeat.li>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agomingw: fix colourization on Cygwin pseudo terminals
Alan Davies [Thu, 22 Dec 2016 17:09:18 +0000 (18:09 +0100)] 
mingw: fix colourization on Cygwin pseudo terminals

Git only colours the output and uses pagination if isatty() returns 1.
MSYS2 and Cygwin emulate pseudo terminals via named pipes, meaning that
isatty() returns 0.

f7f90e0f4f (mingw: make isatty() recognize MSYS2's pseudo terminals
(/dev/pty*), 2016-04-27) fixed this for MSYS2 terminals, but not for
Cygwin.

The named pipes that Cygwin and MSYS2 use are very similar. MSYS2 PTY pipes
are called 'msys-*-pty*' and Cygwin uses 'cygwin-*-pty*'. This commit
modifies the existing check to allow both MSYS2 and Cygwin PTY pipes to be
identified as TTYs.

Note that pagination is still broken when running Git for Windows from
within Cygwin, as MSYS2's less.exe is spawned (and does not like to
interact with Cygwin's PTY).

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

Signed-off-by: Alan Davies <alan.n.davies@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agomingw: adjust is_console() to work with stdin
Johannes Schindelin [Thu, 22 Dec 2016 17:08:57 +0000 (18:08 +0100)] 
mingw: adjust is_console() to work with stdin

When determining whether a handle corresponds to a *real* Win32 Console
(as opposed to, say, a character device such as /dev/null), we use the
GetConsoleOutputBufferInfo() function as a tell-tale.

However, that does not work for *input* handles associated with a
console. Let's just use the GetConsoleMode() function for input handles,
and since it does not work on output handles fall back to the previous
method for those.

This patch prepares for using is_console() instead of my previous
misguided attempt in cbb3f3c9b1 (mingw: intercept isatty() to handle
/dev/null as Git expects it, 2016-12-11) that broke everything on
Windows.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoSync with master
Junio C Hamano [Wed, 21 Dec 2016 22:59:11 +0000 (14:59 -0800)] 
Sync with master

7 years agoThird batch for 2.12
Junio C Hamano [Wed, 21 Dec 2016 22:57:26 +0000 (14:57 -0800)] 
Third batch for 2.12

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoMerge branch 'jt/mailinfo-fold-in-body-headers'
Junio C Hamano [Wed, 21 Dec 2016 22:55:03 +0000 (14:55 -0800)] 
Merge branch 'jt/mailinfo-fold-in-body-headers'

Fix for NDEBUG builds.

* jt/mailinfo-fold-in-body-headers:
  mailinfo.c: move side-effects outside of assert

7 years agoMerge branch 'jk/index-pack-wo-repo-from-stdin'
Junio C Hamano [Wed, 21 Dec 2016 22:55:03 +0000 (14:55 -0800)] 
Merge branch 'jk/index-pack-wo-repo-from-stdin'

"git index-pack --stdin" needs an access to an existing repository,
but "git index-pack file.pack" to generate an .idx file that
corresponds to a packfile does not.

* jk/index-pack-wo-repo-from-stdin:
  index-pack: skip collision check when not in repository
  t: use nongit() function where applicable
  index-pack: complain when --stdin is used outside of a repo
  t5000: extract nongit function to test-lib-functions.sh

7 years agoMerge branch 'jk/parseopt-usage-msg-opt'
Junio C Hamano [Wed, 21 Dec 2016 22:55:03 +0000 (14:55 -0800)] 
Merge branch 'jk/parseopt-usage-msg-opt'

The function usage_msg_opt() has been updated to say "fatal:"
before the custom message programs give, when they want to die
with a message about wrong command line options followed by the
standard usage string.

* jk/parseopt-usage-msg-opt:
  parse-options: print "fatal:" before usage_msg_opt()

7 years agoMerge branch 'jk/quote-env-path-list-component'
Junio C Hamano [Wed, 21 Dec 2016 22:55:02 +0000 (14:55 -0800)] 
Merge branch 'jk/quote-env-path-list-component'

A recent update to receive-pack to make it easier to drop garbage
objects made it clear that GIT_ALTERNATE_OBJECT_DIRECTORIES cannot
have a pathname with a colon in it (no surprise!), and this in turn
made it impossible to push into a repository at such a path.  This
has been fixed by introducing a quoting mechanism used when
appending such a path to the colon-separated list.

* jk/quote-env-path-list-component:
  t5615-alternate-env: double-quotes in file names do not work on Windows
  t5547-push-quarantine: run the path separator test on Windows, too
  tmp-objdir: quote paths we add to alternates
  alternates: accept double-quoted paths

7 years agoMerge branch 'vs/submodule-clone-nested-submodules-alternates'
Junio C Hamano [Wed, 21 Dec 2016 22:55:02 +0000 (14:55 -0800)] 
Merge branch 'vs/submodule-clone-nested-submodules-alternates'

"git clone --reference $there --recurse-submodules $super" has been
taught to guess repositories usable as references for submodules of
$super that are embedded in $there while making a clone of the
superproject borrow objects from $there; extend the mechanism to
also allow submodules of these submodules to borrow repositories
embedded in these clones of the submodules embedded in the clone of
the superproject.

* vs/submodule-clone-nested-submodules-alternates:
  submodule--helper: set alternateLocation for cloned submodules

7 years agoMerge branch 'nd/shallow-fixup'
Junio C Hamano [Wed, 21 Dec 2016 22:55:01 +0000 (14:55 -0800)] 
Merge branch 'nd/shallow-fixup'

Code cleanup in shallow boundary computation.

* nd/shallow-fixup:
  shallow.c: remove useless code
  shallow.c: bit manipulation tweaks
  shallow.c: avoid theoretical pointer wrap-around
  shallow.c: make paint_alloc slightly more robust
  shallow.c: stop abusing COMMIT_SLAB_SIZE for paint_info's memory pools
  shallow.c: rename fields in paint_info to better express their purposes

7 years agoMerge branch 'sb/sequencer-abort-safety'
Junio C Hamano [Wed, 21 Dec 2016 22:55:01 +0000 (14:55 -0800)] 
Merge branch 'sb/sequencer-abort-safety'

Unlike "git am --abort", "git cherry-pick --abort" moved HEAD back
to where cherry-pick started while picking multiple changes, when
the cherry-pick stopped to ask for help from the user, and the user
did "git reset --hard" to a different commit in order to re-attempt
the operation.

* sb/sequencer-abort-safety:
  Revert "sequencer: remove useless get_dir() function"
  sequencer: remove useless get_dir() function
  sequencer: make sequencer abort safer
  t3510: test that cherry-pick --abort does not unsafely change HEAD
  am: change safe_to_abort()'s not rewinding error into a warning
  am: fix filename in safe_to_abort() error message

7 years agoMerge branch 'jk/difftool-in-subdir' into next
Junio C Hamano [Wed, 21 Dec 2016 22:39:25 +0000 (14:39 -0800)] 
Merge branch 'jk/difftool-in-subdir' into next

Even though an fix was attempted in Git 2.9.3 days, but running
"git difftool --dir-diff" from a subdirectory never worked. This
has been fixed.

* jk/difftool-in-subdir:
  difftool: rename variables for consistency
  difftool: chdir as early as possible
  difftool: sanitize $workdir as early as possible
  difftool: fix dir-diff index creation when in a subdirectory

7 years agoMerge branch 'gv/p4-multi-path-commit-fix' into next
Junio C Hamano [Wed, 21 Dec 2016 22:39:25 +0000 (14:39 -0800)] 
Merge branch 'gv/p4-multi-path-commit-fix' into next

"git p4" that tracks multile p4 paths imported a single changelist
that touches files in these multiple paths as one commit, followed
by many empty commits.  This has been fixed.

* gv/p4-multi-path-commit-fix:
  git-p4: fix multi-path changelist empty commits

7 years agoMerge branch 'sb/submodule-embed-gitdir' into next
Junio C Hamano [Wed, 21 Dec 2016 22:39:24 +0000 (14:39 -0800)] 
Merge branch 'sb/submodule-embed-gitdir' into next

A new submodule helper "git submodule embedgitdirs" to make it
easier to move embedded .git/ directory for submodules in a
superproject to .git/modules/ (and point the latter with the former
that is turned into a "gitdir:" file) has been added.

* sb/submodule-embed-gitdir:
  submodule: add absorb-git-dir function
  move connect_work_tree_and_git_dir to dir.h
  worktree: check if a submodule uses worktrees
  test-lib-functions.sh: teach test_commit -C <dir>
  submodule helper: support super prefix
  submodule: use absolute path for computing relative path connecting

7 years agoMerge branch 'mk/mingw-winansi-ttyname-termination-fix' into next
Junio C Hamano [Wed, 21 Dec 2016 22:39:24 +0000 (14:39 -0800)] 
Merge branch 'mk/mingw-winansi-ttyname-termination-fix' into next

A potential but unlikely buffer overflow in Windows port has been
fixed.

* mk/mingw-winansi-ttyname-termination-fix:
  mingw: consider that UNICODE_STRING::Length counts bytes

7 years agoMerge branch 'lt/shortlog-by-committer' into next
Junio C Hamano [Wed, 21 Dec 2016 22:39:23 +0000 (14:39 -0800)] 
Merge branch 'lt/shortlog-by-committer' into next

"git shortlog" learned "--committer" option to group commits by
committer, instead of author.

* lt/shortlog-by-committer:
  t4201: make tests work with and without the MINGW prerequiste

7 years agoMerge branch 'jk/quote-env-path-list-component' into next
Junio C Hamano [Wed, 21 Dec 2016 22:39:21 +0000 (14:39 -0800)] 
Merge branch 'jk/quote-env-path-list-component' into next

A recent update to receive-pack to make it easier to drop garbage
objects made it clear that GIT_ALTERNATE_OBJECT_DIRECTORIES cannot
have a pathname with a colon in it (no surprise!), and this in turn
made it impossible to push into a repository at such a path.  This
has been fixed by introducing a quoting mechanism used when
appending such a path to the colon-separated list.

* jk/quote-env-path-list-component:
  t5615-alternate-env: double-quotes in file names do not work on Windows

7 years agot5615-alternate-env: double-quotes in file names do not work on Windows
Johannes Sixt [Wed, 21 Dec 2016 21:33:43 +0000 (22:33 +0100)] 
t5615-alternate-env: double-quotes in file names do not work on Windows

Protect a recently added test case with !MINGW.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agofast-import: properly fanout notes when tree is imported
Mike Hommey [Tue, 20 Dec 2016 21:04:48 +0000 (06:04 +0900)] 
fast-import: properly fanout notes when tree is imported

In typical uses of fast-import, trees are inherited from a parent
commit. In that case, the tree_entry for the branch looks like:

  .versions[1].sha1 = $some_sha1
  .tree = <tree structure loaded from $some_sha1>

However, when trees are imported, rather than inherited, that is not the
case. One can import a tree with a filemodify command, replacing the
root tree object.

e.g.
  "M 040000 $some_sha1 \n"

In this case, the tree_entry for the branch looks like:

  .versions[1].sha1 = $some_sha1
  .tree = NULL

When adding new notes with the notemodify command, do_change_note_fanout
is called to get a notes count, and to do so, it loops over the
tree_entry->tree, but doesn't do anything when the tree is NULL.

In the latter case above, it means do_change_note_fanout thinks the tree
contains no notes, and new notes are added with no fanout.

Interestingly, do_change_note_fanout does check whether subdirectories
have a NULL .tree, in which case it uses load_tree(). Which means the
right behaviour happens when using the filemodify command to import
subdirectories.

This change makes do_change_note_fanount call load_tree() whenever the
tree_entry it is given has no tree loaded, making all cases handled
equally.

Signed-off-by: Mike Hommey <mh@glandium.org>
Reviewed-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agot4201: make tests work with and without the MINGW prerequiste
Junio C Hamano [Tue, 20 Dec 2016 18:35:54 +0000 (10:35 -0800)] 
t4201: make tests work with and without the MINGW prerequiste

Make sure the tests do not depend on the result of the previous
tests.  With MINGW prerequisite satisfied, a "reset to original and
rebuild" in an earlier test was skipped, resulting in different
history being tested with this and the next tests.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoconfig.c: rename label unlock_and_out
Nguyễn Thái Ngọc Duy [Tue, 20 Dec 2016 09:48:35 +0000 (16:48 +0700)] 
config.c: rename label unlock_and_out

There are two ways to unlock a file: commit, or revert. Rename it to
commit_and_out to avoid confusion.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoconfig.c: handle error case for fstat() calls
Nguyễn Thái Ngọc Duy [Mon, 19 Dec 2016 09:21:55 +0000 (16:21 +0700)] 
config.c: handle error case for fstat() calls

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoMerge branch 'ld/p4-compare-dir-vs-symlink' into next
Junio C Hamano [Tue, 20 Dec 2016 19:37:50 +0000 (11:37 -0800)] 
Merge branch 'ld/p4-compare-dir-vs-symlink' into next

"git p4" misbehaved when swapping a directory and a symbolic link.

* ld/p4-compare-dir-vs-symlink:
  git-p4: avoid crash adding symlinked directory

7 years agoMerge branch 'jt/mailinfo-fold-in-body-headers' into next
Junio C Hamano [Tue, 20 Dec 2016 19:37:49 +0000 (11:37 -0800)] 
Merge branch 'jt/mailinfo-fold-in-body-headers' into next

Fix for NDEBUG builds.

* jt/mailinfo-fold-in-body-headers:
  mailinfo.c: move side-effects outside of assert

7 years agogit-p4: add diff/merge properties to .gitattributes for GitLFS files
Lars Schneider [Sun, 18 Dec 2016 19:01:40 +0000 (20:01 +0100)] 
git-p4: add diff/merge properties to .gitattributes for GitLFS files

The `git lfs track` command generates a .gitattributes file with diff
and merge properties [1]. Set the same .gitattributes format for files
tracked with GitLFS in git-p4.

[1] https://github.com/git-lfs/git-lfs/blob/v1.5.3/commands/command_track.go#L121

Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
Reviewed-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoi18n: fix misconversion in shell scripts
Junio C Hamano [Tue, 20 Dec 2016 17:36:23 +0000 (09:36 -0800)] 
i18n: fix misconversion in shell scripts

An earlier series that was merged at 2703572b3a ("Merge branch
'va/i18n-even-more'", 2016-07-13) failed to use $(eval_gettext
"string with \$variable interpolation") and instead used gettext in
a few places, and ended up showing the variable names in the
message, e.g.

    $ git submodule
    fatal: $program_name cannot be used without a working tree.

Catch these mistakes with

    $ git grep -n '[^_]gettext .*\\\$'

and fix them all to use eval_gettext instead.

Reported-by: Josh Bleecher Snyder
Acked-by: Vasco Almeida <vascomalmeida@sapo.pt>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agomailinfo.c: move side-effects outside of assert
Kyle J. McKay [Mon, 19 Dec 2016 23:13:00 +0000 (15:13 -0800)] 
mailinfo.c: move side-effects outside of assert

Since 6b4b013f18 (mailinfo: handle in-body header continuations,
2016-09-20, v2.11.0) mailinfo.c has contained new code with an
assert of the form:

assert(call_a_function(...))

The function in question, check_header, has side effects.  This
means that when NDEBUG is defined during a release build the
function call is omitted entirely, the side effects do not
take place and tests (fortunately) start failing.

Since the only time that mi->inbody_header_accum is appended to is
in check_inbody_header, and appending onto a blank
mi->inbody_header_accum always happens when is_inbody_header is
true, this guarantees a prefix that causes check_header to always
return true.

Therefore replace the assert with an if !check_header + DIE
combination to reflect this.

Helped-by: Jonathan Tan <jonathantanmy@google.com>
Helped-by: Jeff King <peff@peff.net>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agomingw: consider that UNICODE_STRING::Length counts bytes
Max Kirillov [Mon, 19 Dec 2016 21:32:00 +0000 (23:32 +0200)] 
mingw: consider that UNICODE_STRING::Length counts bytes

UNICODE_STRING::Length field means size of buffer in bytes[1],
despite of buffer itself being array of wchar_t. Because of that
terminating zero is placed twice as far. Fix it.

[1] https://msdn.microsoft.com/en-us/library/windows/desktop/aa380518.aspx

Signed-off-by: Max Kirillov <max@max630.net>
Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>