git/git.git
3 years agobisect run: die if no command is given
Stephan Beyer [Sun, 12 Nov 2017 20:55:33 +0000 (21:55 +0100)]
bisect run: die if no command is given

It was possible to invoke "git bisect run" without any command.
This considers all commits as good commits since "$@"'s return
value for empty $@ is 0.

This is most probably not what a user wants (otherwise she would
invoke "git bisect run true"), so not providing a command now
results in an error.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoRelNotes: the third batch for 2.16
Junio C Hamano [Thu, 9 Nov 2017 05:36:39 +0000 (14:36 +0900)]
RelNotes: the third batch for 2.16

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'js/mingw-redirect-std-handles'
Junio C Hamano [Thu, 9 Nov 2017 05:31:31 +0000 (14:31 +0900)]
Merge branch 'js/mingw-redirect-std-handles'

MinGW updates.

* js/mingw-redirect-std-handles:
  mingw: document the standard handle redirection
  mingw: optionally redirect stderr/stdout via the same handle
  mingw: add experimental feature to redirect standard handles

3 years agoMerge branch 'js/wincred-empty-cred'
Junio C Hamano [Thu, 9 Nov 2017 05:31:31 +0000 (14:31 +0900)]
Merge branch 'js/wincred-empty-cred'

MinGW updates.

* js/wincred-empty-cred:
  wincred: handle empty username/password correctly
  t0302: check helper can handle empty credentials

3 years agoMerge branch 'js/mingw-full-version-in-resources'
Junio C Hamano [Thu, 9 Nov 2017 05:31:31 +0000 (14:31 +0900)]
Merge branch 'js/mingw-full-version-in-resources'

MinGW updates.

* js/mingw-full-version-in-resources:
  mingw: include the full version information in the resources

3 years agoMerge branch 'dk/libsecret-unlock-to-load-fix'
Junio C Hamano [Thu, 9 Nov 2017 05:31:30 +0000 (14:31 +0900)]
Merge branch 'dk/libsecret-unlock-to-load-fix'

The credential helper for libsecret (in contrib/) has been improved
to allow possibly prompting the end user to unlock secrets that are
currently locked (otherwise the secrets may not be loaded).

* dk/libsecret-unlock-to-load-fix:
  credential-libsecret: unlock locked secrets

3 years agoMerge branch 'ks/mailmap'
Junio C Hamano [Thu, 9 Nov 2017 05:31:29 +0000 (14:31 +0900)]
Merge branch 'ks/mailmap'

* ks/mailmap:
  mailmap: use Kaartic Sivaraam's new address

3 years agoMerge branch 'js/early-config'
Junio C Hamano [Thu, 9 Nov 2017 05:31:29 +0000 (14:31 +0900)]
Merge branch 'js/early-config'

Correct start-up sequence so that a repository could be placed
immediately under the root directory again (which was broken at
around Git 2.13).

* js/early-config:
  setup: avoid double slashes when looking for HEAD

3 years agoMerge branch 'sg/travis-fixes'
Junio C Hamano [Thu, 9 Nov 2017 05:31:28 +0000 (14:31 +0900)]
Merge branch 'sg/travis-fixes'

TravisCI build updates.

* sg/travis-fixes:
  travis-ci: don't build Git for the static analysis job
  travis-ci: fix running P4 and Git LFS tests in Linux build jobs

3 years agoMerge branch 'bw/diff-opt-impl-to-bitfields'
Junio C Hamano [Thu, 9 Nov 2017 05:31:27 +0000 (14:31 +0900)]
Merge branch 'bw/diff-opt-impl-to-bitfields'

A single-word "unsigned flags" in the diff options is being split
into a structure with many bitfields.

* bw/diff-opt-impl-to-bitfields:
  diff: make struct diff_flags members lowercase
  diff: remove DIFF_OPT_CLR macro
  diff: remove DIFF_OPT_SET macro
  diff: remove DIFF_OPT_TST macro
  diff: remove touched flags
  diff: add flag to indicate textconv was set via cmdline
  diff: convert flags to be stored in bitfields
  add, reset: use DIFF_OPT_SET macro to set a diff flag

3 years agoMerge branch 'rs/hex-to-bytes-cleanup'
Junio C Hamano [Thu, 9 Nov 2017 05:31:27 +0000 (14:31 +0900)]
Merge branch 'rs/hex-to-bytes-cleanup'

Code cleanup.

* rs/hex-to-bytes-cleanup:
  sha1_file: use hex_to_bytes()
  http-push: use hex_to_bytes()
  notes: move hex_to_bytes() to hex.c and export it

3 years agoMerge branch 'ad/5580-unc-tests-on-cygwin'
Junio C Hamano [Thu, 9 Nov 2017 05:31:27 +0000 (14:31 +0900)]
Merge branch 'ad/5580-unc-tests-on-cygwin'

UNC paths are also relevant in Cygwin builds and they are now
tested just like Mingw builds.

* ad/5580-unc-tests-on-cygwin:
  t5580: add Cygwin support

3 years agoMerge branch 'ao/diff-populate-filespec-lstat-errorpath-fix'
Junio C Hamano [Thu, 9 Nov 2017 05:31:26 +0000 (14:31 +0900)]
Merge branch 'ao/diff-populate-filespec-lstat-errorpath-fix'

After an error from lstat(), diff_populate_filespec() function
sometimes still went ahead and used invalid data in struct stat,
which has been fixed.

* ao/diff-populate-filespec-lstat-errorpath-fix:
  diff: fix lstat() error handling in diff_populate_filespec()

3 years agoMerge branch 'sb/blame-config-doc'
Junio C Hamano [Thu, 9 Nov 2017 05:31:25 +0000 (14:31 +0900)]
Merge branch 'sb/blame-config-doc'

Description of blame.{showroot,blankboundary,showemail,date}
configuration variables have been added to "git config --help".

* sb/blame-config-doc:
  config: document blame configuration

3 years agoMerge branch 'jm/relnotes-2.15-typofix'
Junio C Hamano [Thu, 9 Nov 2017 05:31:25 +0000 (14:31 +0900)]
Merge branch 'jm/relnotes-2.15-typofix'

Typofix.

* jm/relnotes-2.15-typofix:
  fix typos in 2.15.0 release notes

3 years agoRelNotes: the second batch post 2.15 comes
Junio C Hamano [Mon, 6 Nov 2017 05:31:16 +0000 (14:31 +0900)]
RelNotes: the second batch post 2.15 comes

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'tg/deprecate-stash-save'
Junio C Hamano [Mon, 6 Nov 2017 05:24:32 +0000 (14:24 +0900)]
Merge branch 'tg/deprecate-stash-save'

"git stash save" has been deprecated in favour of "git stash push".

* tg/deprecate-stash-save:
  stash: remove now superfluos help for "stash push"
  stash: mark "git stash save" deprecated in the man page
  stash: replace "git stash save" with "git stash push" in the documentation

3 years agoMerge branch 'tb/complete-checkout'
Junio C Hamano [Mon, 6 Nov 2017 05:24:31 +0000 (14:24 +0900)]
Merge branch 'tb/complete-checkout'

Command line completion (in contrib/) update.

* tb/complete-checkout:
  completion: add remaining flags to checkout

3 years agoMerge branch 'gc/gitweb-filetest-acl'
Junio C Hamano [Mon, 6 Nov 2017 05:24:30 +0000 (14:24 +0900)]
Merge branch 'gc/gitweb-filetest-acl'

"gitweb" checks if a directory is searchable with Perl's "-x"
operator, which can be enhanced by using "filetest 'access'"
pragma, which now we do.

* gc/gitweb-filetest-acl:
  gitweb: use filetest to allow ACLs

3 years agoMerge branch 'mp/push-pushoption-config'
Junio C Hamano [Mon, 6 Nov 2017 05:24:30 +0000 (14:24 +0900)]
Merge branch 'mp/push-pushoption-config'

The "--push-option=<string>" option to "git push" now defaults to a
list of strings configured via push.pushOption variable.

* mp/push-pushoption-config:
  builtin/push.c: add push.pushOption config

3 years agoMerge branch 'hv/fetch-moved-submodules-on-demand'
Junio C Hamano [Mon, 6 Nov 2017 05:24:29 +0000 (14:24 +0900)]
Merge branch 'hv/fetch-moved-submodules-on-demand'

"git fetch --recurse-submodules" now knows that submodules can be
moved around in the superproject in addition to getting updated,
and finds the ones that need to be fetched accordingly.

* hv/fetch-moved-submodules-on-demand:
  submodule: simplify decision tree whether to or not to fetch
  implement fetching of moved submodules
  fetch: add test to make sure we stay backwards compatible

3 years agoMerge branch 'jc/check-ref-format-oor'
Junio C Hamano [Mon, 6 Nov 2017 05:24:28 +0000 (14:24 +0900)]
Merge branch 'jc/check-ref-format-oor'

"git check-ref-format --branch @{-1}" bit a "BUG()" when run
outside a repository for obvious reasons; clarify the documentation
and make sure we do not even try to expand the at-mark magic in
such a case, but still call the validation logic for branch names.

* jc/check-ref-format-oor:
  check-ref-format doc: --branch validates and expands <branch>
  check-ref-format --branch: strip refs/heads/ using skip_prefix
  check-ref-format --branch: do not expand @{...} outside repository

3 years agoMerge branch 'jc/t5601-copy-workaround'
Junio C Hamano [Mon, 6 Nov 2017 05:24:27 +0000 (14:24 +0900)]
Merge branch 'jc/t5601-copy-workaround'

A (possibly flakey) test fix.

* jc/t5601-copy-workaround:
  t5601: rm the target file of cp that could still be executing

3 years agoMerge branch 'bc/object-id'
Junio C Hamano [Mon, 6 Nov 2017 05:24:27 +0000 (14:24 +0900)]
Merge branch 'bc/object-id'

Conversion from uchar[20] to struct object_id continues.

* bc/object-id: (25 commits)
  refs/files-backend: convert static functions to object_id
  refs: convert read_raw_ref backends to struct object_id
  refs: convert peel_object to struct object_id
  refs: convert resolve_ref_unsafe to struct object_id
  worktree: convert struct worktree to object_id
  refs: convert resolve_gitlink_ref to struct object_id
  Convert remaining callers of resolve_gitlink_ref to object_id
  sha1_file: convert index_path and index_fd to struct object_id
  refs: convert reflog_expire parameter to struct object_id
  refs: convert read_ref_at to struct object_id
  refs: convert peel_ref to struct object_id
  builtin/pack-objects: convert to struct object_id
  pack-bitmap: convert traverse_bitmap_commit_list to object_id
  refs: convert dwim_log to struct object_id
  builtin/reflog: convert remaining unsigned char uses to object_id
  refs: convert dwim_ref and expand_ref to struct object_id
  refs: convert read_ref and read_ref_full to object_id
  refs: convert resolve_refdup and refs_resolve_refdup to struct object_id
  Convert check_connected to use struct object_id
  refs: update ref transactions to use struct object_id
  ...

3 years agoMerge branch 'jk/revision-pruning-optim'
Junio C Hamano [Mon, 6 Nov 2017 05:24:26 +0000 (14:24 +0900)]
Merge branch 'jk/revision-pruning-optim'

Pathspec-limited revision traversal was taught not to keep finding
unneeded differences once it knows two trees are different inside
given pathspec.

* jk/revision-pruning-optim:
  revision: quit pruning diff more quickly when possible

3 years agoMerge branch 'ds/find-unique-abbrev-optim'
Junio C Hamano [Mon, 6 Nov 2017 05:24:25 +0000 (14:24 +0900)]
Merge branch 'ds/find-unique-abbrev-optim'

Optimize the code to find shortest unique prefix of object names.

* ds/find-unique-abbrev-optim:
  sha1_name: minimize OID comparisons during disambiguation
  sha1_name: parse less while finding common prefix
  sha1_name: unroll len loop in find_unique_abbrev_r()
  p4211-line-log.sh: add log --online --raw --parents perf test

3 years agoMerge branch 'wk/pull-signoff'
Junio C Hamano [Mon, 6 Nov 2017 05:24:24 +0000 (14:24 +0900)]
Merge branch 'wk/pull-signoff'

"git pull" has been taught to accept "--[no-]signoff" option and
pass it down to "git merge".

* wk/pull-signoff:
  pull: pass --signoff/--no-signoff to "git merge"

3 years agoMerge branch 'pc/submodule-helper'
Junio C Hamano [Mon, 6 Nov 2017 05:24:23 +0000 (14:24 +0900)]
Merge branch 'pc/submodule-helper'

GSoC.

* pc/submodule-helper:
  submodule: port submodule subcommand 'status' from shell to C
  submodule--helper: introduce for_each_listed_submodule()
  submodule--helper: introduce get_submodule_displaypath()

3 years agoMerge branch 'pb/bisect-helper'
Junio C Hamano [Mon, 6 Nov 2017 05:24:23 +0000 (14:24 +0900)]
Merge branch 'pb/bisect-helper'

An early part of piece-by-piece rewrite of "git bisect".

* pb/bisect-helper:
  bisect--helper: `is_expected_rev` & `check_expected_revs` shell function in C
  t6030: explicitly test for bisection cleanup
  bisect--helper: `bisect_clean_state` shell function in C
  bisect--helper: `write_terms` shell function in C
  bisect--helper: rewrite `check_term_format` shell function in C
  bisect--helper: use OPT_CMDMODE instead of OPT_BOOL

3 years agoMerge branch 'dm/run-command-ignored-hook-advise'
Junio C Hamano [Mon, 6 Nov 2017 05:24:22 +0000 (14:24 +0900)]
Merge branch 'dm/run-command-ignored-hook-advise'

A hook script that is set unexecutable is simply ignored.  Git
notifies when such a file is ignored, unless the message is
squelched via advice.ignoredHook configuration.

* dm/run-command-ignored-hook-advise:
  run-command: add hint when a hook is ignored

3 years agoThe first batch for 2.16
Junio C Hamano [Mon, 6 Nov 2017 04:18:22 +0000 (13:18 +0900)]
The first batch for 2.16

The most notable change is that we no longer take "git add ''" and
add everything.  An empty string is now an error when used as a
pathspec element.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'ex/deprecate-empty-pathspec-as-match-all'
Junio C Hamano [Mon, 6 Nov 2017 04:11:29 +0000 (13:11 +0900)]
Merge branch 'ex/deprecate-empty-pathspec-as-match-all'

The final step to make an empty string as a pathspec element
illegal.  We started this by first deprecating and warning a
pathspec that has such an element in 2.11 (Nov 2016).

Hopefully we can merge this down to the 'master' by the end of the
year?  A deprecation warning period that is about 1 year does not
sound too bad.

* ex/deprecate-empty-pathspec-as-match-all:
  pathspec: die on empty strings as pathspec
  t0027: do not use an empty string as a pathspec element

3 years agoMerge branch 'jk/rebase-i-exec-gitdir-fix'
Junio C Hamano [Mon, 6 Nov 2017 04:11:28 +0000 (13:11 +0900)]
Merge branch 'jk/rebase-i-exec-gitdir-fix'

A recent regression in "git rebase -i" that broke execution of git
commands from subdirectories via "exec" insn has been fixed.

* jk/rebase-i-exec-gitdir-fix:
  sequencer: pass absolute GIT_DIR to exec commands

3 years agoMerge branch 'cn/diff-indent-no-longer-is-experimental'
Junio C Hamano [Mon, 6 Nov 2017 04:11:27 +0000 (13:11 +0900)]
Merge branch 'cn/diff-indent-no-longer-is-experimental'

Doc update.

* cn/diff-indent-no-longer-is-experimental:
  diff: --indent-heuristic is no longer experimental

3 years agoMerge branch 'bw/grep-recurse-submodules'
Junio C Hamano [Mon, 6 Nov 2017 04:11:27 +0000 (13:11 +0900)]
Merge branch 'bw/grep-recurse-submodules'

A broken access to object databases in recent update to "git grep
--recurse-submodules" has been fixed.

* bw/grep-recurse-submodules:
  grep: take the read-lock when adding a submodule

3 years agoMerge branch 'mh/test-local-canary'
Junio C Hamano [Mon, 6 Nov 2017 04:11:26 +0000 (13:11 +0900)]
Merge branch 'mh/test-local-canary'

We try to see if somebody runs our test suite with a shell that
does not support "local" like bash/dash does.

* mh/test-local-canary:
  t0000: check whether the shell supports the "local" keyword

3 years agoMerge branch 'js/submodule-in-excluded'
Junio C Hamano [Mon, 6 Nov 2017 04:11:26 +0000 (13:11 +0900)]
Merge branch 'js/submodule-in-excluded'

"git status --ignored -u" did not stop at a working tree of a
separate project that is embedded in an ignored directory and
listed files in that other project, instead of just showing the
directory itself as ignored.

* js/submodule-in-excluded:
  status: do not get confused by submodules in excluded directories

3 years agoMerge branch 'ao/check-resolve-ref-unsafe-result'
Junio C Hamano [Mon, 6 Nov 2017 04:11:25 +0000 (13:11 +0900)]
Merge branch 'ao/check-resolve-ref-unsafe-result'

"git commit", after making a commit, did not check for errors when
asking on what branch it made the commit, which has been correted.

* ao/check-resolve-ref-unsafe-result:
  commit: check result of resolve_ref_unsafe

3 years agoMerge branch 'jk/misc-resolve-ref-unsafe-fixes'
Junio C Hamano [Mon, 6 Nov 2017 04:11:24 +0000 (13:11 +0900)]
Merge branch 'jk/misc-resolve-ref-unsafe-fixes'

Some codepaths did not check for errors when asking what branch the
HEAD points at, which have been fixed.

* jk/misc-resolve-ref-unsafe-fixes:
  worktree: handle broken symrefs in find_shared_symref()
  log: handle broken HEAD in decoration check
  remote: handle broken symrefs
  test-ref-store: avoid passing NULL to printf

3 years agoMerge branch 'sb/diff-color-moved-use-xdl-recmatch'
Junio C Hamano [Mon, 6 Nov 2017 04:11:24 +0000 (13:11 +0900)]
Merge branch 'sb/diff-color-moved-use-xdl-recmatch'

Instead of using custom line comparison and hashing functions to
implement "moved lines" coloring in the diff output, use the pair
of these functions from lower-layer xdiff/ code.

* sb/diff-color-moved-use-xdl-recmatch:
  diff.c: get rid of duplicate implementation
  xdiff-interface: export comparing and hashing strings

3 years agoMerge branch 'jk/diff-color-moved-fix'
Junio C Hamano [Mon, 6 Nov 2017 04:11:23 +0000 (13:11 +0900)]
Merge branch 'jk/diff-color-moved-fix'

The experimental "color moved lines differently in diff output"
feature was buggy around "ignore whitespace changes" edges, whihch
has been corrected.

* jk/diff-color-moved-fix:
  diff: handle NULs in get_string_hash()
  diff: fix whitespace-skipping with --color-moved
  t4015: test the output of "diff --color-moved -b"
  t4015: check "negative" case for "-w --color-moved"
  t4015: refactor --color-moved whitespace test

3 years agoMerge branch 'kd/auto-col-with-pager-fix'
Junio C Hamano [Mon, 6 Nov 2017 04:11:22 +0000 (13:11 +0900)]
Merge branch 'kd/auto-col-with-pager-fix'

"auto" as a value for the columnar output configuration ought to
judge "is the output consumed by humans?" with the same criteria as
"auto" for coloured output configuration, i.e. either the standard
output stream is going to tty, or a pager is in use.  We forgot the
latter, which has been fixed.

* kd/auto-col-with-pager-fix:
  column: do not include pager.c
  column: show auto columns when pager is active

3 years agoMerge branch 'jc/no-cmd-as-subroutine'
Junio C Hamano [Mon, 6 Nov 2017 04:11:21 +0000 (13:11 +0900)]
Merge branch 'jc/no-cmd-as-subroutine'

Calling cmd_foo() as if it is a general purpose helper function is
a no-no.  Correct two instances of such to set an example.

* jc/no-cmd-as-subroutine:
  merge-ours: do not use cmd_*() as a subroutine
  describe: do not use cmd_*() as a subroutine

3 years agoMerge branch 'ma/lockfile-fixes'
Junio C Hamano [Mon, 6 Nov 2017 04:11:21 +0000 (13:11 +0900)]
Merge branch 'ma/lockfile-fixes'

An earlier update made it possible to use an on-stack in-core
lockfile structure (as opposed to having to deliberately leak an
on-heap one).  Many codepaths have been updated to take advantage
of this new facility.

* ma/lockfile-fixes:
  read_cache: roll back lock in `update_index_if_able()`
  read-cache: leave lock in right state in `write_locked_index()`
  read-cache: drop explicit `CLOSE_LOCK`-flag
  cache.h: document `write_locked_index()`
  apply: remove `newfd` from `struct apply_state`
  apply: move lockfile into `apply_state`
  cache-tree: simplify locking logic
  checkout-index: simplify locking logic
  tempfile: fix documentation on `delete_tempfile()`
  lockfile: fix documentation on `close_lock_file_gently()`
  treewide: prefer lockfiles on the stack
  sha1_file: do not leak `lock_file`

3 years agofix typos in 2.15.0 release notes
Jean Carlo Machado [Sat, 4 Nov 2017 12:16:16 +0000 (10:16 -0200)]
fix typos in 2.15.0 release notes

Signed-off-by: Jean Carlo Machado <contato@jeancarlomachado.com.br>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoconfig: document blame configuration
Stefan Beller [Fri, 3 Nov 2017 19:21:58 +0000 (12:21 -0700)]
config: document blame configuration

The options are currently only referenced by the git-blame man page,
also explain them in git-config, which is the canonical page to
contain all config options.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocredential-libsecret: unlock locked secrets
Dennis Kaarsemaker [Fri, 3 Nov 2017 20:44:49 +0000 (21:44 +0100)]
credential-libsecret: unlock locked secrets

Credentials exposed by the secret service DBUS interface may be locked.
Setting the SECRET_SEARCH_UNLOCK flag will make the secret service
unlock these secrets, possibly prompting the user for credentials to do
so. Without this flag, the secret is simply not loaded.

Signed-off-by: Dennis Kaarsemaker <dennis@kaarsemaker.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agosetup: avoid double slashes when looking for HEAD
Jeff King [Fri, 3 Nov 2017 12:58:02 +0000 (13:58 +0100)]
setup: avoid double slashes when looking for HEAD

Andrew Baumann reported that when called outside of any Git worktree,
`git rev-parse --is-inside-work-tree` eventually tries to access
`//HEAD`, i.e.  any `HEAD` file in the root directory, but with a double
slash.

This double slash is not only unintentional, but is allowed by the POSIX
standard to have a special meaning. And most notably on Windows, it
does, where it refers to a UNC path of the form `//server/share/`.

As a consequence, afore-mentioned `rev-parse` call not only looks for
the wrong thing, but it also causes serious delays, as Windows will try
to access a server called `HEAD`.  Let's simply avoid the unintended
double slash.

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agomailmap: use Kaartic Sivaraam's new address
Kaartic Sivaraam [Fri, 3 Nov 2017 05:43:41 +0000 (11:13 +0530)]
mailmap: use Kaartic Sivaraam's new address

Map the old address to the new, hopefully more permanent one.

Signed-off-by: Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agodiff: --indent-heuristic is no longer experimental
Carlos Martín Nieto [Sun, 29 Oct 2017 15:12:28 +0000 (16:12 +0100)]
diff: --indent-heuristic is no longer experimental

This heuristic has been the default since 2.14 so we should not confuse our
users by saying that it's experimental and off by default.

Signed-off-by: Carlos Martín Nieto <cmn@dwim.me>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agomingw: document the standard handle redirection
Johannes Schindelin [Wed, 1 Nov 2017 17:10:33 +0000 (18:10 +0100)]
mingw: document the standard handle redirection

This feature has been in Git for Windows since v2.11.0(2), as an
experimental option. Now it is considered mature, and it is high time to
document it properly.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agomingw: optionally redirect stderr/stdout via the same handle
Johannes Schindelin [Wed, 1 Nov 2017 17:10:30 +0000 (18:10 +0100)]
mingw: optionally redirect stderr/stdout via the same handle

The "2>&1" notation in Powershell and in Unix shells implies that stderr
is redirected to the same handle into which stdout is already written.

Let's use this special value to allow the same trick with
GIT_REDIRECT_STDERR and GIT_REDIRECT_STDOUT: if the former's value is
`2>&1`, then stderr will simply be written to the same handle as stdout.

The functionality was suggested by Jeff Hostetler.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agomingw: add experimental feature to redirect standard handles
Johannes Schindelin [Wed, 1 Nov 2017 17:10:25 +0000 (18:10 +0100)]
mingw: add experimental feature to redirect standard handles

Particularly when calling Git from applications, such as Visual Studio's
Team Explorer, it is important that stdin/stdout/stderr are closed
properly. However, when spawning processes on Windows, those handles
must be marked as inheritable if we want to use them, but that flag is a
global flag and may very well be used by other spawned processes which
then do not know to close those handles.

Let's introduce a set of environment variables (GIT_REDIRECT_STDIN and
friends) that specify paths to files, or even better, named pipes (which
are similar to Unix sockets) and that are used by the spawned Git
process.  This helps work around above-mentioned issue: those named
pipes will be opened in a non-inheritable way upon startup, and no
handles are passed around (and therefore no inherited handles need to be
closed by any spawned child).

This feature shipped with Git for Windows (marked as experimental) since
v2.11.0(2), so it has seen some serious testing in the meantime.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agotravis-ci: don't build Git for the static analysis job
SZEDER Gábor [Wed, 1 Nov 2017 11:56:44 +0000 (12:56 +0100)]
travis-ci: don't build Git for the static analysis job

The static analysis job on Travis CI builds Git ever since it was
introduced in d8245bb3f (travis-ci: add static analysis build job to
run coccicheck, 2017-04-11).  However, Coccinelle, the only static
analysis tool in use, only needs Git's source code to work and it
doesn't care about built Git binaries at all.

Spare some of Travis CI's resources and don't build Git for the static
analysis job unnecessarily.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agotravis-ci: fix running P4 and Git LFS tests in Linux build jobs
SZEDER Gábor [Wed, 1 Nov 2017 11:55:35 +0000 (12:55 +0100)]
travis-ci: fix running P4 and Git LFS tests in Linux build jobs

Linux build jobs on Travis CI skip the P4 and Git LFS tests since
commit 657343a60 (travis-ci: move Travis CI code into dedicated
scripts, 2017-09-10), claiming there are no P4 or Git LFS installed.

The reason is that P4 and Git LFS binaries are not installed to a
directory in the default $PATH, but their directories are prepended to
$PATH.  This worked just fine before said commit, because $PATH was
set in a scriptlet embedded in our '.travis.yml', thus its new value
was visible during the rest of the build job.  However, after these
embedded scriptlets were moved into dedicated scripts executed in
separate shell processes, any variable set in one of those scripts is
only visible in that single script but not in any of the others.  In
this case, 'ci/install-dependencies.sh' downloads P4 and Git LFS and
modifies $PATH, but to no effect, because 'ci/run-tests.sh' only sees
Travis CI's default $PATH.

Move adjusting $PATH to 'ci/lib-travisci.sh', which is sourced in all
other 'ci/' scripts, so all those scripts will see the updated $PATH
value.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agogrep: take the read-lock when adding a submodule
Martin Ågren [Wed, 1 Nov 2017 20:45:06 +0000 (21:45 +0100)]
grep: take the read-lock when adding a submodule

With --recurse-submodules, we add each submodule that we encounter to
the list of alternate object databases. With threading, our changes to
the list are not protected against races. Indeed, ThreadSanitizer
reports a race when we call `add_to_alternates_memory()` around the same
time that another thread is reading in the list through
`read_sha1_file()`.

Take the grep read-lock while adding the submodule. The lock is used to
serialize uses of non-thread-safe parts of Git's API, including
`read_sha1_file()`.

Helped-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Acked-by: Brandon Williams <bmwill@google.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agosequencer: pass absolute GIT_DIR to exec commands
Jacob Keller [Tue, 31 Oct 2017 23:07:33 +0000 (16:07 -0700)]
sequencer: pass absolute GIT_DIR to exec commands

When we replaced the old shell script based interactive rebase in
commmit 18633e1a22a6 ("rebase -i: use the rebase--helper builtin",
2017-02-09) we introduced a regression of functionality in that the
GIT_DIR would be sent to the environment of the exec command as-is.

This generally meant that it would be passed as "GIT_DIR=.git", which
causes problems for any exec command that wants to run git commands in
a subdirectory.

This isn't a very large regression, since it is not that likely that the
exec command will run a git command, and even less likely that it will
need to do so in a subdir. This regression was discovered by a build
system which uses git-describe to find the current version of the build
system, and happened to do so from the src/ sub directory of the
project.

Fix this by passing in the absolute path of the git directory into the
child environment.

Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agowincred: handle empty username/password correctly
Jakub Bereżański [Mon, 30 Oct 2017 17:20:44 +0000 (18:20 +0100)]
wincred: handle empty username/password correctly

Empty (length 0) usernames and/or passwords, when saved in the Windows
Credential Manager, come back as null when reading the credential.

One use case for such empty credentials is with NTLM authentication, where
empty username and password instruct libcurl to authenticate using the
credentials of the currently logged-on user (single sign-on).

When locating the relevant credentials, make empty username match null.
When outputting the credentials, handle nulls correctly.

Signed-off-by: Jakub Bereżański <kuba@berezanscy.pl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot0302: check helper can handle empty credentials
Jakub Bereżański [Mon, 30 Oct 2017 17:20:12 +0000 (18:20 +0100)]
t0302: check helper can handle empty credentials

Make sure the helper does not crash when blank username and password is
provided. If the helper can save such credentials, it should be able to
read them back.

Signed-off-by: Jakub Bereżański <kuba@berezanscy.pl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agomingw: include the full version information in the resources
Johannes Schindelin [Mon, 30 Oct 2017 17:19:42 +0000 (18:19 +0100)]
mingw: include the full version information in the resources

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

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agodiff: make struct diff_flags members lowercase
Brandon Williams [Tue, 31 Oct 2017 18:19:11 +0000 (11:19 -0700)]
diff: make struct diff_flags members lowercase

Now that the flags stored in struct diff_flags are being accessed
directly and not through macros, change all struct members from being
uppercase to lowercase.
This conversion is done using the following semantic patch:

@@
expression E;
@@
- E.RECURSIVE
+ E.recursive

@@
expression E;
@@
- E.TREE_IN_RECURSIVE
+ E.tree_in_recursive

@@
expression E;
@@
- E.BINARY
+ E.binary

@@
expression E;
@@
- E.TEXT
+ E.text

@@
expression E;
@@
- E.FULL_INDEX
+ E.full_index

@@
expression E;
@@
- E.SILENT_ON_REMOVE
+ E.silent_on_remove

@@
expression E;
@@
- E.FIND_COPIES_HARDER
+ E.find_copies_harder

@@
expression E;
@@
- E.FOLLOW_RENAMES
+ E.follow_renames

@@
expression E;
@@
- E.RENAME_EMPTY
+ E.rename_empty

@@
expression E;
@@
- E.HAS_CHANGES
+ E.has_changes

@@
expression E;
@@
- E.QUICK
+ E.quick

@@
expression E;
@@
- E.NO_INDEX
+ E.no_index

@@
expression E;
@@
- E.ALLOW_EXTERNAL
+ E.allow_external

@@
expression E;
@@
- E.EXIT_WITH_STATUS
+ E.exit_with_status

@@
expression E;
@@
- E.REVERSE_DIFF
+ E.reverse_diff

@@
expression E;
@@
- E.CHECK_FAILED
+ E.check_failed

@@
expression E;
@@
- E.RELATIVE_NAME
+ E.relative_name

@@
expression E;
@@
- E.IGNORE_SUBMODULES
+ E.ignore_submodules

@@
expression E;
@@
- E.DIRSTAT_CUMULATIVE
+ E.dirstat_cumulative

@@
expression E;
@@
- E.DIRSTAT_BY_FILE
+ E.dirstat_by_file

@@
expression E;
@@
- E.ALLOW_TEXTCONV
+ E.allow_textconv

@@
expression E;
@@
- E.TEXTCONV_SET_VIA_CMDLINE
+ E.textconv_set_via_cmdline

@@
expression E;
@@
- E.DIFF_FROM_CONTENTS
+ E.diff_from_contents

@@
expression E;
@@
- E.DIRTY_SUBMODULES
+ E.dirty_submodules

@@
expression E;
@@
- E.IGNORE_UNTRACKED_IN_SUBMODULES
+ E.ignore_untracked_in_submodules

@@
expression E;
@@
- E.IGNORE_DIRTY_SUBMODULES
+ E.ignore_dirty_submodules

@@
expression E;
@@
- E.OVERRIDE_SUBMODULE_CONFIG
+ E.override_submodule_config

@@
expression E;
@@
- E.DIRSTAT_BY_LINE
+ E.dirstat_by_line

@@
expression E;
@@
- E.FUNCCONTEXT
+ E.funccontext

@@
expression E;
@@
- E.PICKAXE_IGNORE_CASE
+ E.pickaxe_ignore_case

@@
expression E;
@@
- E.DEFAULT_FOLLOW_RENAMES
+ E.default_follow_renames

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agodiff: remove DIFF_OPT_CLR macro
Brandon Williams [Tue, 31 Oct 2017 18:19:10 +0000 (11:19 -0700)]
diff: remove DIFF_OPT_CLR macro

Remove the `DIFF_OPT_CLR` macro and instead set the flags directly.
This conversion is done using the following semantic patch:

@@
expression E;
identifier fld;
@@
- DIFF_OPT_CLR(&E, fld)
+ E.flags.fld = 0

@@
type T;
T *ptr;
identifier fld;
@@
- DIFF_OPT_CLR(ptr, fld)
+ ptr->flags.fld = 0

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agodiff: remove DIFF_OPT_SET macro
Brandon Williams [Tue, 31 Oct 2017 18:19:09 +0000 (11:19 -0700)]
diff: remove DIFF_OPT_SET macro

Remove the `DIFF_OPT_SET` macro and instead set the flags directly.
This conversion is done using the following semantic patch:

@@
expression E;
identifier fld;
@@
- DIFF_OPT_SET(&E, fld)
+ E.flags.fld = 1

@@
type T;
T *ptr;
identifier fld;
@@
- DIFF_OPT_SET(ptr, fld)
+ ptr->flags.fld = 1

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agodiff: remove DIFF_OPT_TST macro
Brandon Williams [Tue, 31 Oct 2017 18:19:08 +0000 (11:19 -0700)]
diff: remove DIFF_OPT_TST macro

Remove the `DIFF_OPT_TST` macro and instead access the flags directly.
This conversion is done using the following semantic patch:

@@
expression E;
identifier fld;
@@
- DIFF_OPT_TST(&E, fld)
+ E.flags.fld

@@
type T;
T *ptr;
identifier fld;
@@
- DIFF_OPT_TST(ptr, fld)
+ ptr->flags.fld

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agodiff: remove touched flags
Brandon Williams [Tue, 31 Oct 2017 18:19:07 +0000 (11:19 -0700)]
diff: remove touched flags

Now that the set of parallel touched flags are no longer being used,
remove them.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agodiff: add flag to indicate textconv was set via cmdline
Brandon Williams [Tue, 31 Oct 2017 18:19:06 +0000 (11:19 -0700)]
diff: add flag to indicate textconv was set via cmdline

git-show is unique in that it wants to use textconv by default except
for when it is showing blobs.  When asked to show a blob, show doesn't
want to use textconv unless the user explicitly requested that it be
used by providing the command line flag '--textconv'.

Currently this is done by using a parallel set of 'touched' flags which
get set every time a particular flag is set or cleared.  In a future
patch we want to eliminate this parallel set of flags so instead of
relying on if the textconv flag has been touched, add a new flag
'TEXTCONV_SET_VIA_CMDLINE' which is only set if textconv is set to true
via the command line.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agodiff: convert flags to be stored in bitfields
Brandon Williams [Tue, 31 Oct 2017 18:19:05 +0000 (11:19 -0700)]
diff: convert flags to be stored in bitfields

We cannot add many more flags to the diff machinery due to the
limitations of the number of flags that can be stored in a single
unsigned int.  In order to allow for more flags to be added to the diff
machinery in the future this patch converts the flags to be stored in
bitfields in 'struct diff_flags'.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot5580: add Cygwin support
Adam Dinwoodie [Tue, 31 Oct 2017 13:19:03 +0000 (13:19 +0000)]
t5580: add Cygwin support

t5580 tests that specifying Windows UNC paths works with Git.  Cygwin
supports UNC paths, albeit only using forward slashes, not backslashes,
so run the compatible tests on Cygwin as well as MinGW.

The only complication is Cygwin's `pwd`, which returns a *nix-style
path, and that's not suitable for calculating the UNC path to the
current directory.  Instead use Cygwin's `cygpath` utility to get the
Windows-style path.

Signed-off-by: Adam Dinwoodie <adam@dinwoodie.org>
Reviewed-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agosha1_file: use hex_to_bytes()
René Scharfe [Tue, 31 Oct 2017 13:50:06 +0000 (14:50 +0100)]
sha1_file: use hex_to_bytes()

The path of a loose object contains its hash value encoded into two
substrings of 2 and 38 hexadecimal digits separated by a slash.  The
first part is handed to for_each_file_in_obj_subdir() in decoded form as
subdir_nr.  The current code builds a full hexadecimal representation of
the hash in a temporary buffer, then uses get_oid_hex() to decode it.

Avoid the intermediate step by taking subdir_nr as-is and using
hex_to_bytes() directly on the second substring.  That's shorter and
easier.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agohttp-push: use hex_to_bytes()
René Scharfe [Tue, 31 Oct 2017 13:49:56 +0000 (14:49 +0100)]
http-push: use hex_to_bytes()

The path of a loose object contains its hash value encoded into two
substrings of hexadecimal digits, separated by a slash.  The current
code copies the pieces into a temporary buffer to get rid of the slash
and then uses get_oid_hex() to decode the hash value.

Avoid the copy by using hex_to_bytes() directly on the substrings.
That's shorter and easier.

While at it correct the length of the second substring in a comment.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agonotes: move hex_to_bytes() to hex.c and export it
René Scharfe [Tue, 31 Oct 2017 13:46:49 +0000 (14:46 +0100)]
notes: move hex_to_bytes() to hex.c and export it

Make the function for converting pairs of hexadecimal digits to binary
available to other call sites.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoadd, reset: use DIFF_OPT_SET macro to set a diff flag
Brandon Williams [Mon, 30 Oct 2017 19:46:43 +0000 (12:46 -0700)]
add, reset: use DIFF_OPT_SET macro to set a diff flag

Instead of explicitly setting the 'DIFF_OPT_OVERRIDE_SUBMODULE_CONFIG'
flag, use the 'DIFF_OPT_SET' macro.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot0000: check whether the shell supports the "local" keyword
Michael Haggerty [Thu, 26 Oct 2017 08:18:53 +0000 (10:18 +0200)]
t0000: check whether the shell supports the "local" keyword

Add a test balloon to see if we get complaints from anybody who is
using a shell that doesn't support the "local" keyword. If so, this
test can be reverted. If not, we might want to consider using "local"
in shell code throughout the git code base.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoGit 2.15 v2.15.0
Junio C Hamano [Mon, 30 Oct 2017 05:00:44 +0000 (14:00 +0900)]
Git 2.15

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge tag 'l10n-2.15.0-rnd2.1' of git://github.com/git-l10n/git-po
Junio C Hamano [Mon, 30 Oct 2017 00:32:54 +0000 (09:32 +0900)]
Merge tag 'l10n-2.15.0-rnd2.1' of git://github.com/git-l10n/git-po

l10n for Git 2.15.0 round 2 with Catalan updates

* tag 'l10n-2.15.0-rnd2.1' of git://github.com/git-l10n/git-po:
  l10n: Update Catalan translation

3 years agol10n: Update Catalan translation
Jordi Mas [Wed, 25 Oct 2017 17:50:59 +0000 (19:50 +0200)]
l10n: Update Catalan translation

Signed-off-by: Jordi Mas <jmas@softcatala.org>
3 years agodiff: fix lstat() error handling in diff_populate_filespec()
Andrey Okoshkin [Fri, 27 Oct 2017 09:33:25 +0000 (12:33 +0300)]
diff: fix lstat() error handling in diff_populate_filespec()

Add lstat() error handling not only for ENOENT case.
Otherwise uninitialised 'struct stat st' variable is used later in case of
lstat() non-ENOENT failure which leads to processing of rubbish values of
file mode ('S_ISLNK(st.st_mode)' check) or size ('xsize_t(st.st_size)').

Signed-off-by: Andrey Okoshkin <a.okoshkin@samsung.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoHopefully final batch before 2.15
Junio C Hamano [Sat, 28 Oct 2017 01:20:30 +0000 (10:20 +0900)]
Hopefully final batch before 2.15

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'sg/rev-list-doc-reorder-fix'
Junio C Hamano [Sat, 28 Oct 2017 01:18:42 +0000 (10:18 +0900)]
Merge branch 'sg/rev-list-doc-reorder-fix'

Doc flow fix.

* sg/rev-list-doc-reorder-fix:
  rev-list-options.txt: use correct directional reference

3 years agoMerge branch 'sb/rev-parse-show-superproject-root'
Junio C Hamano [Sat, 28 Oct 2017 01:18:40 +0000 (10:18 +0900)]
Merge branch 'sb/rev-parse-show-superproject-root'

Doc markup fix.

* sb/rev-parse-show-superproject-root:
  docs: fix formatting of rev-parse's --show-superproject-working-tree

3 years agoMerge branch 'ao/path-use-xmalloc'
Junio C Hamano [Sat, 28 Oct 2017 01:18:39 +0000 (10:18 +0900)]
Merge branch 'ao/path-use-xmalloc'

A possible oom error is now caught as a fatal error, instead of
continuing and dereferencing NULL.

* ao/path-use-xmalloc:
  path.c: use xmalloc() in add_to_trie()

3 years agoMerge branch 'np/config-path-doc'
Junio C Hamano [Sat, 28 Oct 2017 01:18:39 +0000 (10:18 +0900)]
Merge branch 'np/config-path-doc'

Doc update.

* np/config-path-doc:
  config doc: clarify "git config --path" example

3 years agodocs: fix formatting of rev-parse's --show-superproject-working-tree
Sebastian Schuberth [Thu, 26 Oct 2017 11:53:37 +0000 (11:53 +0000)]
docs: fix formatting of rev-parse's --show-superproject-working-tree

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agorev-list-options.txt: use correct directional reference
SZEDER Gábor [Thu, 26 Oct 2017 15:26:37 +0000 (17:26 +0200)]
rev-list-options.txt: use correct directional reference

The descriptions of the options '--parents', '--children' and
'--graph' say "see 'History Simplification' below", although the
referred section is in fact above the description of these options.

Send readers in the right direction by saying "above" instead of
"below".

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agostash: remove now superfluos help for "stash push"
Thomas Gummerer [Sun, 22 Oct 2017 17:04:09 +0000 (18:04 +0100)]
stash: remove now superfluos help for "stash push"

With the 'git stash save' interface, it was easily possible for users to
try to add a message which would start with "-", which 'git stash save'
would interpret as a command line argument, and fail.  For this case we
added some extra help on how to create a stash with a message starting
with "-".

For 'stash push', messages are passed with the -m flag, avoiding this
potential pitfall.  Now only pathspecs starting with "-" would have to
be distinguished from command line parameters by using
"-- --<pathspec>".  This is fairly common in the git command line
interface, and we don't try to guess what the users wanted in the other
cases.

Because this way of passing pathspecs is quite common in other git
commands, and we don't provide any extra help there, do the same in the
error message for 'git stash push'.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agostash: mark "git stash save" deprecated in the man page
Thomas Gummerer [Sun, 22 Oct 2017 17:04:08 +0000 (18:04 +0100)]
stash: mark "git stash save" deprecated in the man page

'git stash push' fixes a historical wart in the interface of 'git stash
save'.  As 'git stash push' has all functionality of 'git stash save',
with a nicer, more consistent user interface deprecate 'git stash
save'.  To do this, remove it from the synopsis of the man page, and
move it to a separate section, stating that it is deprecated.

Helped-by: Robert P. J. Day <rpjday@crashcourse.ca>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agostash: replace "git stash save" with "git stash push" in the documentation
Thomas Gummerer [Sun, 22 Oct 2017 17:04:07 +0000 (18:04 +0100)]
stash: replace "git stash save" with "git stash push" in the documentation

"git stash push" is the newer interface for creating a stash.  While we
are still keeping "git stash save" around for the time being, it's better
to point new users of "git stash" to the more modern (and more feature
rich) interface, instead of teaching them the older version that we
might want to phase out in the future.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'mh/ref-locking-fix'
Junio C Hamano [Thu, 26 Oct 2017 03:29:23 +0000 (12:29 +0900)]
Merge branch 'mh/ref-locking-fix'

Transactions to update multiple references that involves a deletion
was quite broken in an error codepath and did not abort everything
correctly.

* mh/ref-locking-fix:
  files_transaction_prepare(): fix handling of ref lock failure
  t1404: add a bunch of tests of D/F conflicts

3 years agostatus: do not get confused by submodules in excluded directories
Johannes Schindelin [Wed, 25 Oct 2017 20:40:40 +0000 (22:40 +0200)]
status: do not get confused by submodules in excluded directories

We meticulously pass the `exclude` flag to the `treat_directory()`
function so that we can indicate that files in it are excluded rather
than untracked when recursing.

But we did not yet treat submodules the same way.

Because of that, `git status --ignored --untracked` with a submodule
`submodule` in a gitignored `tracked/` would show the submodule in the
"Untracked files" section, e.g.

On branch master
Untracked files:
  (use "git add <file>..." to include in what will be committed)

tracked/submodule/

Ignored files:
  (use "git add -f <file>..." to include in what will be committed)

tracked/submodule/initial.t

Instead, we would want it to show the submodule in the "Ignored files"
section:

On branch master
Ignored files:
  (use "git add -f <file>..." to include in what will be committed)

tracked/submodule/

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agodiff.c: get rid of duplicate implementation
Stefan Beller [Wed, 25 Oct 2017 18:49:12 +0000 (11:49 -0700)]
diff.c: get rid of duplicate implementation

The implementations in diff.c to detect moved lines needs to compare
strings and hash strings, which is implemented in that file, as well
as in the xdiff library.

Remove the rather recent implementation in diff.c and rely on the well
exercised code in the xdiff lib.

With this change the hash used for bucketing the strings for the moved
line detection changes from FNV32 (that is provided via the hashmaps
memhash) to DJB2 (which is used internally in xdiff).  Benchmarks found
on the web[1] do not indicate that these hashes are different in
performance for readable strings.

[1] https://softwareengineering.stackexchange.com/questions/49550/which-hashing-algorithm-is-best-for-uniqueness-and-speed

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoxdiff-interface: export comparing and hashing strings
Stefan Beller [Wed, 25 Oct 2017 18:49:11 +0000 (11:49 -0700)]
xdiff-interface: export comparing and hashing strings

This will turn out to be useful in a later patch.

xdl_recmatch is exported in xdiff/xutils.h, to be used by various
xdiff/*.c files, but not outside of xdiff/. This one makes it available
to the outside, too.

While at it, add documentation.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agopath.c: use xmalloc() in add_to_trie()
Andrey Okoshkin [Tue, 24 Oct 2017 15:15:05 +0000 (18:15 +0300)]
path.c: use xmalloc() in add_to_trie()

Add usage of xmalloc() instead of malloc() in add_to_trie() as xmalloc wraps
and checks memory allocation result.

Signed-off-by: Andrey Okoshkin <a.okoshkin@samsung.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocompletion: add remaining flags to checkout
Thomas Braun [Tue, 24 Oct 2017 13:19:31 +0000 (15:19 +0200)]
completion: add remaining flags to checkout

In the commits 1fc458d9 (builtin/checkout: add --recurse-submodules
switch, 2017-03-14), 08d595dc (checkout: add --ignore-skip-worktree-bits
in sparse checkout mode, 2013-04-13) and 32669671 (checkout: introduce
--detach synonym for "git checkout foo^{commit}", 2011-02-08) checkout
gained new flags but the completion was not updated, although these flags
are useful completions. Add them.

The flags --force and --ignore-other-worktrees are not added as they are
potentially dangerous.

The flags --progress and --no-progress are only useful for scripting and are
therefore also not included.

Signed-off-by: Thomas Braun <thomas.braun@virtuell-zuhause.de>
Reviewed-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agofiles_transaction_prepare(): fix handling of ref lock failure
Michael Haggerty [Tue, 24 Oct 2017 15:16:25 +0000 (17:16 +0200)]
files_transaction_prepare(): fix handling of ref lock failure

Since dc39e09942 (files_ref_store: use a transaction to update packed
refs, 2017-09-08), failure to lock a reference has been handled
incorrectly by `files_transaction_prepare()`. If
`lock_ref_for_update()` fails in the lock-acquisition loop of that
function, it sets `ret` then breaks out of that loop. Prior to
dc39e09942, that was OK, because the only thing following the loop was
the cleanup code. But dc39e09942 added another blurb of code between
the loop and the cleanup. That blurb sometimes resets `ret` to zero,
making the cleanup code think that the locking was successful.

Specifically, whenever

* One or more reference deletions have been processed successfully in
  the lock-acquisition loop. (Processing the first such reference
  causes a packed-ref transaction to be initialized.)

* Then `lock_ref_for_update()` fails for a subsequent reference. Such
  a failure can happen for a number of reasons, such as the old SHA-1
  not being correct, lock contention, etc. This causes a `break` out
  of the lock-acquisition loop.

* The `packed-refs` lock is acquired successfully and
  `ref_transaction_prepare()` succeeds for the packed-ref transaction.
  This has the effect of resetting `ret` back to 0, and making the
  cleanup code think that lock acquisition was successful.

In that case, any reference updates that were processed prior to
breaking out of the loop would be carried out (loose and packed), but
the reference that couldn't be locked and any subsequent references
would silently be ignored.

This can easily cause data loss if, for example, the user was trying
to push a new name for an existing branch while deleting the old name.
After the push, the branch could be left unreachable, and could even
subsequently be garbage-collected.

This problem was noticed in the context of deleting one reference and
creating another in a single transaction, when the two references D/F
conflict with each other, like

    git update-ref --stdin <<EOF
    delete refs/foo
    create refs/foo/bar HEAD
    EOF

This triggers the above bug because the deletion is processed
successfully for `refs/foo`, then the D/F conflict causes
`lock_ref_for_update()` to fail when `refs/foo/bar` is processed. In
this case the transaction *should* fail, but instead it causes
`refs/foo` to be deleted without creating `refs/foo`. This could
easily result in data loss.

The fix is simple: instead of just breaking out of the loop, jump
directly to the cleanup code. This fixes some tests in t1404 that were
added in the previous commit.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot1404: add a bunch of tests of D/F conflicts
Michael Haggerty [Tue, 24 Oct 2017 15:16:24 +0000 (17:16 +0200)]
t1404: add a bunch of tests of D/F conflicts

It is currently not allowed, in a single transaction, to add one
reference and delete another reference if the two reference names D/F
conflict with each other (e.g., like `refs/foo/bar` and `refs/foo`).
The reason is that the code would need to take locks

    $GIT_DIR/refs/foo.lock
    $GIT_DIR/refs/foo/bar.lock

But the latter lock couldn't coexist with the loose reference file

    $GIT_DIR/refs/foo

, because `$GIT_DIR/refs/foo` cannot be both a directory and a file at
the same time (hence the name "D/F conflict).

Add a bunch of tests that we cleanly reject such transactions.

In fact, many of the new tests currently fail. They will be fixed in
the next commit along with an explanation.

Reported-by: Jeff King <peff@peff.net>
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge tag 'l10n-2.15.0-rnd2' of git://github.com/git-l10n/git-po
Junio C Hamano [Tue, 24 Oct 2017 02:44:52 +0000 (11:44 +0900)]
Merge tag 'l10n-2.15.0-rnd2' of git://github.com/git-l10n/git-po

l10n for Git 2.15.0 round 2

* tag 'l10n-2.15.0-rnd2' of git://github.com/git-l10n/git-po: (22 commits)
  l10n: zh_CN: review for git v2.15.0 l10n round 2
  l10n: zh_CN: for git v2.15.0 l10n round 2
  l10n: de.po: fix typos
  l10n: de.po: translate 70 new messages
  l10n: ru.po: update Russian translation
  l10n: vi.po(3245t): Updated Vietnamese translation for v2.15.0 round 2
  l10n: sv.po: Update Swedish translation (3245t0f0u)
  l10n: fr.po: v2.15.0 round 2
  l10n: fr.po change translation of "First, rewinding"
  l10n: fr.po fix some mistakes
  l10n: Update Catalan translation
  l10n: ko.po: Update Korean translation
  l10n: es.po: v2.15.0 round 2
  l10n: git.pot: v2.15.0 round 2 (2 new, 2 removed)
  l10n: ru.po: update Russian translation
  l10n: bg.po: Updated Bulgarian translation (3245t)
  l10n: sv.po: Update Swedish translation (3245t0f0u)
  l10n: vi.po(3245t): Updated Vietnamese translation for v2.15.0
  l10n: es.po: Update translation v2.15.0 round 1
  l10n: git.pot: v2.15.0 round 1 (68 new, 36 removed)
  ...

3 years agoMerge branch 'jx/zh_CN-proposed' of github.com:jiangxin/git
Jiang Xin [Tue, 24 Oct 2017 02:11:48 +0000 (10:11 +0800)]
Merge branch 'jx/zh_CN-proposed' of github.com:jiangxin/git

* 'jx/zh_CN-proposed' of github.com:jiangxin/git:
  l10n: zh_CN: review for git v2.15.0 l10n round 2
  l10n: zh_CN: for git v2.15.0 l10n round 2

3 years agol10n: zh_CN: review for git v2.15.0 l10n round 2
Ray Chen [Mon, 23 Oct 2017 16:17:59 +0000 (00:17 +0800)]
l10n: zh_CN: review for git v2.15.0 l10n round 2

Signed-off-by: Ray Chen <oldsharp@gmail.com>
3 years agol10n: zh_CN: for git v2.15.0 l10n round 2
Jiang Xin [Sun, 8 Oct 2017 07:29:11 +0000 (15:29 +0800)]
l10n: zh_CN: for git v2.15.0 l10n round 2

Translate 69 messages (3245t0f0u) for git v2.15.0-rc2.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Reviewed-by: 依云 <lilydjwg@gmail.com>
3 years agoMerge branch 'master' of https://github.com/ralfth/git-po-de
Jiang Xin [Tue, 24 Oct 2017 01:56:09 +0000 (09:56 +0800)]
Merge branch 'master' of https://github.com/ralfth/git-po-de

* 'master' of https://github.com/ralfth/git-po-de:
  l10n: de.po: fix typos
  l10n: de.po: translate 70 new messages