git/git.git
4 years agoref-filter: allow porcelain to translate messages in the output
Karthik Nayak [Tue, 10 Jan 2017 08:49:50 +0000 (14:19 +0530)]
ref-filter: allow porcelain to translate messages in the output

Introduce setup_ref_filter_porcelain_msg() so that the messages used in
the atom %(upstream:track) can be translated if needed. By default, keep
the messages untranslated, which is the right behavior for plumbing
commands. This is needed as we port branch.c to use ref-filter's
printing API's.

Written-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoref-filter: add an 'rstrip=<N>' option to atoms which deal with refnames
Karthik Nayak [Tue, 10 Jan 2017 08:49:49 +0000 (14:19 +0530)]
ref-filter: add an 'rstrip=<N>' option to atoms which deal with refnames

Complimenting the existing 'lstrip=<N>' option, add an 'rstrip=<N>'
option which strips `<N>` slash-separated path components from the end
of the refname (e.g., `%(refname:rstrip=2)` turns `refs/tags/foo` into
`refs`).

Signed-off-by: Karthik Nayak <Karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoref-filter: modify the 'lstrip=<N>' option to work with negative '<N>'
Karthik Nayak [Tue, 10 Jan 2017 08:49:48 +0000 (14:19 +0530)]
ref-filter: modify the 'lstrip=<N>' option to work with negative '<N>'

Currently the 'lstrip=<N>' option only takes a positive value '<N>'
and strips '<N>' slash-separated path components from the left. Modify
the 'lstrip' option to also take a negative number '<N>' which would
strip from the left as necessary and _leave_ behind only 'N'
slash-separated path components from the right-most end.

For e.g. %(refname:lstrip=-1) would make 'foo/goo/abc' into 'abc'.

Add documentation and tests for the same.

Signed-off-by: Karthik Nayak <Karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoref-filter: Do not abruptly die when using the 'lstrip=<N>' option
Karthik Nayak [Tue, 10 Jan 2017 08:49:47 +0000 (14:19 +0530)]
ref-filter: Do not abruptly die when using the 'lstrip=<N>' option

Currently when we use the 'lstrip=<N>' option, if 'N' is greater than
the number of components available in the refname, we abruptly end
program execution by calling die().

This behavior is undesired since a single refname with few components
could end program execution. To avoid this, return an empty string
whenever the value 'N' is greater than the number of components
available, instead of calling die().

Signed-off-by: Karthik Nayak <Karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoref-filter: rename the 'strip' option to 'lstrip'
Karthik Nayak [Tue, 10 Jan 2017 08:49:46 +0000 (14:19 +0530)]
ref-filter: rename the 'strip' option to 'lstrip'

In preparation for the upcoming patch, where we introduce the 'rstrip'
option. Rename the 'strip' option to 'lstrip' to remove ambiguity.

Signed-off-by: Karthik Nayak <Karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoref-filter: make remote_ref_atom_parser() use refname_atom_parser_internal()
Karthik Nayak [Tue, 10 Jan 2017 08:49:45 +0000 (14:19 +0530)]
ref-filter: make remote_ref_atom_parser() use refname_atom_parser_internal()

Use the recently introduced refname_atom_parser_internal() within
remote_ref_atom_parser(), this provides a common base for all the ref
printing atoms, allowing %(upstream) and %(push) to also use the
':strip' option.

The atoms '%(push)' and '%(upstream)' will retain the ':track' and
':trackshort' atom modifiers to themselves as they have no meaning in
context to the '%(refname)' and '%(symref)' atoms.

Update the documentation and tests to reflect the same.

Signed-off-by: Karthik Nayak <Karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoref-filter: introduce refname_atom_parser()
Karthik Nayak [Tue, 10 Jan 2017 08:49:44 +0000 (14:19 +0530)]
ref-filter: introduce refname_atom_parser()

Using refname_atom_parser_internal(), introduce refname_atom_parser()
which will parse the %(symref) and %(refname) atoms. Store the parsed
information into the 'used_atom' structure based on the modifiers used
along with the atoms.

Now the '%(symref)' atom supports the ':strip' atom modifier. Update the
Documentation and tests to reflect this.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Karthik Nayak <Karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoref-filter: introduce refname_atom_parser_internal()
Karthik Nayak [Tue, 10 Jan 2017 08:49:43 +0000 (14:19 +0530)]
ref-filter: introduce refname_atom_parser_internal()

Since there are multiple atoms which print refs ('%(refname)',
'%(symref)', '%(push)', '%(upstream)'), it makes sense to have a common
ground for parsing them. This would allow us to share implementations of
the atom modifiers between these atoms.

Introduce refname_atom_parser_internal() to act as a common parsing
function for ref printing atoms. This would eventually be used to
introduce refname_atom_parser() and symref_atom_parser() and also be
internally used in remote_ref_atom_parser().

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Karthik Nayak <Karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoref-filter: make "%(symref)" atom work with the ':short' modifier
Karthik Nayak [Tue, 10 Jan 2017 08:49:42 +0000 (14:19 +0530)]
ref-filter: make "%(symref)" atom work with the ':short' modifier

The "%(symref)" atom doesn't work when used with the ':short' modifier
because we strictly match only 'symref' for setting the 'need_symref'
indicator. Fix this by comparing with the valid_atom rather than the
used_atom.

Add tests for %(symref) and %(symref:short) while we're here.

Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Karthik Nayak <Karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoref-filter: add support for %(upstream:track,nobracket)
Karthik Nayak [Tue, 10 Jan 2017 08:49:41 +0000 (14:19 +0530)]
ref-filter: add support for %(upstream:track,nobracket)

Add support for %(upstream:track,nobracket) which will print the
tracking information without the brackets (i.e. "ahead N, behind M").
This is needed when we port branch.c to use ref-filter's printing APIs.

Add test and documentation for the same.

Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoref-filter: make %(upstream:track) prints "[gone]" for invalid upstreams
Karthik Nayak [Tue, 10 Jan 2017 08:49:40 +0000 (14:19 +0530)]
ref-filter: make %(upstream:track) prints "[gone]" for invalid upstreams

Borrowing from branch.c's implementation print "[gone]" whenever an
unknown upstream ref is encountered instead of just ignoring it.

This makes sure that when branch.c is ported over to using ref-filter
APIs for printing, this feature is not lost.

Make changes to t/t6300-for-each-ref.sh and
Documentation/git-for-each-ref.txt to reflect this change.

Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Helped-by : Jacob Keller <jacob.keller@gmail.com>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoref-filter: introduce format_ref_array_item()
Karthik Nayak [Tue, 10 Jan 2017 08:49:39 +0000 (14:19 +0530)]
ref-filter: introduce format_ref_array_item()

To allow column display, we will need to first render the output in a
string list to allow print_columns() to compute the proper size of
each column before starting the actual output. Introduce the function
format_ref_array_item() that does the formatting of a ref_array_item
to an strbuf.

show_ref_array_item() is kept as a convenience wrapper around it which
obtains the strbuf and prints it the standard output.

Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoref-filter: move get_head_description() from branch.c
Karthik Nayak [Tue, 10 Jan 2017 08:49:38 +0000 (14:19 +0530)]
ref-filter: move get_head_description() from branch.c

Move the implementation of get_head_description() from branch.c to
ref-filter.  This gives a description of the HEAD ref if called. This
is used as the refname for the HEAD ref whenever the
FILTER_REFS_DETACHED_HEAD option is used. Make it public because we
need it to calculate the length of the HEAD refs description in
branch.c:calc_maxwidth() when we port branch.c to use ref-filter
APIs.

Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoref-filter: modify "%(objectname:short)" to take length
Karthik Nayak [Tue, 10 Jan 2017 08:49:37 +0000 (14:19 +0530)]
ref-filter: modify "%(objectname:short)" to take length

Add support for %(objectname:short=<length>) which would print the
abbreviated unique objectname of given length. When no length is
specified, the length is 'DEFAULT_ABBREV'. The minimum length is
'MINIMUM_ABBREV'. The length may be exceeded to ensure that the
provided object name is unique.

Add tests and documentation for the same.

Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Helped-by: Jacob Keller <jacob.keller@gmail.com>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoref-filter: implement %(if:equals=<string>) and %(if:notequals=<string>)
Karthik Nayak [Tue, 10 Jan 2017 08:49:36 +0000 (14:19 +0530)]
ref-filter: implement %(if:equals=<string>) and %(if:notequals=<string>)

Implement %(if:equals=<string>) wherein the if condition is only
satisfied if the value obtained between the %(if:...) and %(then) atom
is the same as the given '<string>'.

Similarly, implement (if:notequals=<string>) wherein the if condition
is only satisfied if the value obtained between the %(if:...) and
%(then) atom is different from the given '<string>'.

This is done by introducing 'if_atom_parser()' which parses the given
%(if) atom and then stores the data in used_atom which is later passed
on to the used_atom of the %(then) atom, so that it can do the required
comparisons.

Add tests and documentation for the same.

Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoref-filter: include reference to 'used_atom' within 'atom_value'
Karthik Nayak [Tue, 10 Jan 2017 08:49:35 +0000 (14:19 +0530)]
ref-filter: include reference to 'used_atom' within 'atom_value'

Ensure that each 'atom_value' has a reference to its corresponding
'used_atom'. This lets us use values within 'used_atom' in the
'handler' function.

Hence we can get the %(align) atom's parameters directly from the
'used_atom' therefore removing the necessity of passing %(align) atom's
parameters to 'atom_value'.

This also acts as a preparatory patch for the upcoming patch where we
introduce %(if:equals=) and %(if:notequals=).

Signed-off-by: Karthik Nayak <Karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoref-filter: implement %(if), %(then), and %(else) atoms
Karthik Nayak [Tue, 10 Jan 2017 08:49:34 +0000 (14:19 +0530)]
ref-filter: implement %(if), %(then), and %(else) atoms

Implement %(if), %(then) and %(else) atoms. Used as
%(if)...%(then)...%(end) or %(if)...%(then)...%(else)...%(end). If the
format string between %(if) and %(then) expands to an empty string, or
to only whitespaces, then the whole %(if)...%(end) expands to the string
following %(then). Otherwise, it expands to the string following
%(else), if any. Nesting of this construct is possible.

This is in preparation for porting over `git branch -l` to use
ref-filter APIs for printing.

Add documentation and tests regarding the same.

Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 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>
4 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

4 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

4 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()

4 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

4 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

4 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

4 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

4 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>
4 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>
4 years agoSecond batch for 2.12
Junio C Hamano [Mon, 19 Dec 2016 22:50:31 +0000 (14:50 -0800)]
Second batch for 2.12

Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoMerge branch 'kh/tutorial-grammofix'
Junio C Hamano [Mon, 19 Dec 2016 22:45:41 +0000 (14:45 -0800)]
Merge branch 'kh/tutorial-grammofix'

* kh/tutorial-grammofix:
  doc: omit needless "for"
  doc: make the intent of sentence clearer
  doc: add verb in front of command to run
  doc: add articles (grammar)

4 years agoMerge branch 'da/mergetool-xxdiff-hotkey'
Junio C Hamano [Mon, 19 Dec 2016 22:45:41 +0000 (14:45 -0800)]
Merge branch 'da/mergetool-xxdiff-hotkey'

The way to specify hotkeys to "xxdiff" that is used by "git
mergetool" has been modernized to match recent versions of xxdiff.

* da/mergetool-xxdiff-hotkey:
  mergetools: fix xxdiff hotkeys

4 years agoMerge branch 'lr/doc-fix-cet'
Junio C Hamano [Mon, 19 Dec 2016 22:45:41 +0000 (14:45 -0800)]
Merge branch 'lr/doc-fix-cet'

* lr/doc-fix-cet:
  date-formats.txt: Typo fix

4 years agoMerge branch 'sb/t3600-cleanup'
Junio C Hamano [Mon, 19 Dec 2016 22:45:39 +0000 (14:45 -0800)]
Merge branch 'sb/t3600-cleanup'

Code cleanup.

* sb/t3600-cleanup:
  t3600: slightly modernize style
  t3600: remove useless redirect

4 years agoMerge branch 'jc/pull-rebase-ff'
Junio C Hamano [Mon, 19 Dec 2016 22:45:38 +0000 (14:45 -0800)]
Merge branch 'jc/pull-rebase-ff'

"git pull --rebase", when there is no new commits on our side since
we forked from the upstream, should be able to fast-forward without
invoking "git rebase", but it didn't.

* jc/pull-rebase-ff:
  pull: fast-forward "pull --rebase=true"

4 years agoMerge branch 'ld/p4-worktree'
Junio C Hamano [Mon, 19 Dec 2016 22:45:37 +0000 (14:45 -0800)]
Merge branch 'ld/p4-worktree'

"git p4" didn't interact with the internal of .git directory
correctly in the modern "git-worktree"-enabled world.

* ld/p4-worktree:
  git-p4: support git worktrees

4 years agoMerge branch 'jk/make-tags-find-sources-tweak'
Junio C Hamano [Mon, 19 Dec 2016 22:45:37 +0000 (14:45 -0800)]
Merge branch 'jk/make-tags-find-sources-tweak'

Update the procedure to generate "tags" for developer support.

* jk/make-tags-find-sources-tweak:
  Makefile: exclude contrib from FIND_SOURCE_FILES
  Makefile: match shell scripts in FIND_SOURCE_FILES
  Makefile: exclude test cruft from FIND_SOURCE_FILES
  Makefile: reformat FIND_SOURCE_FILES

4 years agoMerge branch 'js/normalize-path-copy-ceil'
Junio C Hamano [Mon, 19 Dec 2016 22:45:37 +0000 (14:45 -0800)]
Merge branch 'js/normalize-path-copy-ceil'

A pathname that begins with "//" or "\\" on Windows is special but
path normalization logic was unaware of it.

* js/normalize-path-copy-ceil:
  normalize_path_copy(): fix pushing to //server/share/dir on Windows

4 years agoMerge branch 'bb/unicode-9.0'
Junio C Hamano [Mon, 19 Dec 2016 22:45:36 +0000 (14:45 -0800)]
Merge branch 'bb/unicode-9.0'

The character width table has been updated to match Unicode 9.0

* bb/unicode-9.0:
  unicode_width.h: update the width tables to Unicode 9.0
  update_unicode.sh: remove the plane filter
  update_unicode.sh: automatically download newer definition files
  update_unicode.sh: pin the uniset repo to a known good commit
  update_unicode.sh: remove an unnecessary subshell level
  update_unicode.sh: move it into contrib/update-unicode

4 years agoMerge branch 'jk/readme-gmane-is-no-more'
Junio C Hamano [Mon, 19 Dec 2016 22:45:35 +0000 (14:45 -0800)]
Merge branch 'jk/readme-gmane-is-no-more'

* jk/readme-gmane-is-no-more:
  README: replace gmane link with public-inbox

4 years agoMerge branch 'jc/lock-report-on-error'
Junio C Hamano [Mon, 19 Dec 2016 22:45:35 +0000 (14:45 -0800)]
Merge branch 'jc/lock-report-on-error'

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: LOCK_REPORT_ON_ERROR
  hold_locked_index(): align error handling with hold_lockfile_for_update()
  wt-status: implement opportunisitc index update correctly

4 years agoMerge branch 'jk/xdiff-drop-xdl-fast-hash'
Junio C Hamano [Mon, 19 Dec 2016 22:45:35 +0000 (14:45 -0800)]
Merge branch 'jk/xdiff-drop-xdl-fast-hash'

Retire the "fast hash" that had disastrous performance issues in
some corner cases.

* jk/xdiff-drop-xdl-fast-hash:
  xdiff: drop XDL_FAST_HASH

4 years agoMerge branch 'nd/rebase-forget'
Junio C Hamano [Mon, 19 Dec 2016 22:45:35 +0000 (14:45 -0800)]
Merge branch 'nd/rebase-forget'

"git rebase" learned "--quit" option, which allows a user to
remove the metadata left by an earlier "git rebase" that was
manually aborted without using "git rebase --abort".

* nd/rebase-forget:
  rebase: add --quit to cleanup rebase, leave everything else untouched

4 years agoMerge branch 'jk/trailers-placeholder-in-pretty'
Junio C Hamano [Mon, 19 Dec 2016 22:45:34 +0000 (14:45 -0800)]
Merge branch 'jk/trailers-placeholder-in-pretty'

In addition to %(subject), %(body), "log --pretty=format:..."
learned a new placeholder %(trailers).

* jk/trailers-placeholder-in-pretty:
  ref-filter: add support to display trailers as part of contents
  pretty: add %(trailers) format for displaying trailers of a commit message

4 years agoMerge branch 'ak/commit-only-allow-empty'
Junio C Hamano [Mon, 19 Dec 2016 22:45:34 +0000 (14:45 -0800)]
Merge branch 'ak/commit-only-allow-empty'

"git commit --allow-empty --only" (no pathspec) with dirty index
ought to be an acceptable way to create a new commit that does not
change any paths, but it was forbidden, perhaps because nobody
needed it so far.

* ak/commit-only-allow-empty:
  commit: remove 'Clever' message for --only --amend
  commit: make --only --allow-empty work without paths

4 years agoMerge branch 'da/difftool-dir-diff-fix'
Junio C Hamano [Mon, 19 Dec 2016 22:45:33 +0000 (14:45 -0800)]
Merge branch 'da/difftool-dir-diff-fix'

"git difftool --dir-diff" had a minor regression when started from
a subdirectory, which has been fixed.

* da/difftool-dir-diff-fix:
  difftool: fix dir-diff index creation when in a subdirectory

4 years agoMerge branch 'jb/diff-no-index-no-abbrev'
Junio C Hamano [Mon, 19 Dec 2016 22:45:33 +0000 (14:45 -0800)]
Merge branch 'jb/diff-no-index-no-abbrev'

"git diff --no-index" did not take "--no-abbrev" option.

* jb/diff-no-index-no-abbrev:
  diff: handle --no-abbrev in no-index case

4 years agoMerge branch 'rj/git-version-gen-do-not-force-abbrev'
Junio C Hamano [Mon, 19 Dec 2016 22:45:33 +0000 (14:45 -0800)]
Merge branch 'rj/git-version-gen-do-not-force-abbrev'

A minor build update.

* rj/git-version-gen-do-not-force-abbrev:
  GIT-VERSION-GEN: do not force abbreviation length used by 'describe'

4 years agoMerge branch 'jk/stash-disable-renames-internally'
Junio C Hamano [Mon, 19 Dec 2016 22:45:33 +0000 (14:45 -0800)]
Merge branch 'jk/stash-disable-renames-internally'

When diff.renames configuration is on (and with Git 2.9 and later,
it is enabled by default, which made it worse), "git stash"
misbehaved if a file is removed and another file with a very
similar content is added.

* jk/stash-disable-renames-internally:
  stash: prefer plumbing over git-diff

4 years agoMerge branch 'jk/http-walker-limit-redirect'
Junio C Hamano [Mon, 19 Dec 2016 22:45:32 +0000 (14:45 -0800)]
Merge branch 'jk/http-walker-limit-redirect'

Update the error messages from the dumb-http client when it fails
to obtain loose objects; we used to give sensible error message
only upon 404 but we now forbid unexpected redirects that needs to
be reported with something sensible.

* jk/http-walker-limit-redirect:
  http-walker: complain about non-404 loose object errors

4 years agoMerge branch 'jk/http-walker-limit-redirect-2.9'
Junio C Hamano [Mon, 19 Dec 2016 22:45:31 +0000 (14:45 -0800)]
Merge branch 'jk/http-walker-limit-redirect-2.9'

Transport with dumb http can be fooled into following foreign URLs
that the end user does not intend to, especially with the server
side redirects and http-alternates mechanism, which can lead to
security issues.  Tighten the redirection and make it more obvious
to the end user when it happens.

* jk/http-walker-limit-redirect-2.9:
  http: treat http-alternates like redirects
  http: make redirects more obvious
  remote-curl: rename shadowed options variable
  http: always update the base URL for redirects
  http: simplify update_url_from_redirect

4 years agoMerge branch 'nd/for-each-ref-ignore-case'
Junio C Hamano [Mon, 19 Dec 2016 22:45:31 +0000 (14:45 -0800)]
Merge branch 'nd/for-each-ref-ignore-case'

"git branch --list" and friends learned "--ignore-case" option to
optionally sort branches and tags case insensitively.

* nd/for-each-ref-ignore-case:
  tag, branch, for-each-ref: add --ignore-case for sorting and filtering

4 years agoMerge branch 'sb/unpack-trees-grammofix'
Junio C Hamano [Mon, 19 Dec 2016 22:45:31 +0000 (14:45 -0800)]
Merge branch 'sb/unpack-trees-grammofix'

* sb/unpack-trees-grammofix:
  unpack-trees: fix grammar for untracked files in directories

4 years agoMerge branch 'ls/travis-update-p4-and-lfs'
Junio C Hamano [Mon, 19 Dec 2016 22:45:30 +0000 (14:45 -0800)]
Merge branch 'ls/travis-update-p4-and-lfs'

The default Travis-CI configuration specifies newer P4 and GitLFS.

* ls/travis-update-p4-and-lfs:
  travis-ci: update P4 to 16.2 and GitLFS to 1.5.2 in Linux build

4 years agoMerge branch 'ls/t0021-fixup'
Junio C Hamano [Mon, 19 Dec 2016 22:45:30 +0000 (14:45 -0800)]
Merge branch 'ls/t0021-fixup'

* ls/t0021-fixup:
  t0021: minor filter process test cleanup

4 years agoMerge branch 'ah/grammos'
Junio C Hamano [Mon, 19 Dec 2016 22:45:30 +0000 (14:45 -0800)]
Merge branch 'ah/grammos'

A few messages have been fixed for their grammatical errors.

* ah/grammos:
  clone,fetch: explain the shallow-clone option a little more clearly
  receive-pack: improve English grammar of denyCurrentBranch message
  bisect: improve English grammar of not-ancestors message

4 years agoMerge branch 'jc/renormalize-merge-kill-safer-crlf'
Junio C Hamano [Mon, 19 Dec 2016 22:45:30 +0000 (14:45 -0800)]
Merge branch 'jc/renormalize-merge-kill-safer-crlf'

Fix a corner case in merge-recursive regression that crept in
during 2.10 development cycle.

* jc/renormalize-merge-kill-safer-crlf:
  convert: git cherry-pick -Xrenormalize did not work
  merge-recursive: handle NULL in add_cacheinfo() correctly
  cherry-pick: demonstrate a segmentation fault

4 years agoMerge branch 'jt/use-trailer-api-in-commands'
Junio C Hamano [Mon, 19 Dec 2016 22:45:29 +0000 (14:45 -0800)]
Merge branch 'jt/use-trailer-api-in-commands'

Commands that operate on a log message and add lines to the trailer
blocks, such as "format-patch -s", "cherry-pick (-x|-s)", and
"commit -s", have been taught to use the logic of and share the
code with "git interpret-trailer".

* jt/use-trailer-api-in-commands:
  sequencer: use trailer's trailer layout
  trailer: have function to describe trailer layout
  trailer: avoid unnecessary splitting on lines
  commit: make ignore_non_trailer take buf/len
  trailer: be stricter in parsing separators

4 years agoFirst batch for 2.12
Junio C Hamano [Fri, 16 Dec 2016 23:30:13 +0000 (15:30 -0800)]
First batch for 2.12

Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoMerge branch 'ls/p4-retry-thrice'
Junio C Hamano [Fri, 16 Dec 2016 23:27:50 +0000 (15:27 -0800)]
Merge branch 'ls/p4-retry-thrice'

* ls/p4-retry-thrice:
  git-p4: add config to retry p4 commands; retry 3 times by default

4 years agoMerge branch 'ls/p4-empty-file-on-lfs'
Junio C Hamano [Fri, 16 Dec 2016 23:27:49 +0000 (15:27 -0800)]
Merge branch 'ls/p4-empty-file-on-lfs'

"git p4" LFS support was broken when LFS stores an empty blob.

* ls/p4-empty-file-on-lfs:
  git-p4: fix empty file processing for large file system backend GitLFS

4 years agoMerge branch 'ld/p4-update-shelve'
Junio C Hamano [Fri, 16 Dec 2016 23:27:49 +0000 (15:27 -0800)]
Merge branch 'ld/p4-update-shelve'

* ld/p4-update-shelve:
  git-p4: support updating an existing shelved changelist

4 years agoMerge branch 'vk/p4-submit-shelve'
Junio C Hamano [Fri, 16 Dec 2016 23:27:49 +0000 (15:27 -0800)]
Merge branch 'vk/p4-submit-shelve'

* vk/p4-submit-shelve:
  git-p4: allow submit to create shelved changelists.

4 years agoMerge branch 'da/mergetool-trust-exit-code'
Junio C Hamano [Fri, 16 Dec 2016 23:27:49 +0000 (15:27 -0800)]
Merge branch 'da/mergetool-trust-exit-code'

mergetool.<tool>.trustExitCode configuration variable did not apply
to built-in tools, but now it does.

* da/mergetool-trust-exit-code:
  mergetools/vimdiff: trust Vim's exit code
  mergetool: honor mergetool.$tool.trustExitCode for built-in tools

4 years agoMerge branch 'ak/lazy-prereq-mktemp'
Junio C Hamano [Fri, 16 Dec 2016 23:27:49 +0000 (15:27 -0800)]
Merge branch 'ak/lazy-prereq-mktemp'

Test code clean-up.

* ak/lazy-prereq-mktemp:
  t7610: clean up foo.XXXXXX tmpdir

4 years agoMerge branch 'nd/worktree-list-fixup'
Junio C Hamano [Fri, 16 Dec 2016 23:27:48 +0000 (15:27 -0800)]
Merge branch 'nd/worktree-list-fixup'

The output from "git worktree list" was made in readdir() order,
and was unstable.

* nd/worktree-list-fixup:
  worktree list: keep the list sorted
  worktree.c: get_worktrees() takes a new flag argument
  get_worktrees() must return main worktree as first item even on error
  worktree: reorder an if statement
  worktree.c: zero new 'struct worktree' on allocation

4 years agoMerge branch 'nd/qsort-in-merge-recursive'
Junio C Hamano [Fri, 16 Dec 2016 23:27:48 +0000 (15:27 -0800)]
Merge branch 'nd/qsort-in-merge-recursive'

Code simplification.

* nd/qsort-in-merge-recursive:
  merge-recursive.c: use string_list_sort instead of qsort

4 years agoMerge branch 'bw/push-dry-run'
Junio C Hamano [Fri, 16 Dec 2016 23:27:48 +0000 (15:27 -0800)]
Merge branch 'bw/push-dry-run'

"git push --dry-run --recurse-submodule=on-demand" wasn't
"--dry-run" in the submodules.

* bw/push-dry-run:
  push: fix --dry-run to not push submodules
  push: --dry-run updates submodules when --recurse-submodules=on-demand

4 years agoMerge branch 'hv/submodule-not-yet-pushed-fix'
Junio C Hamano [Fri, 16 Dec 2016 23:27:47 +0000 (15:27 -0800)]
Merge branch 'hv/submodule-not-yet-pushed-fix'

The code in "git push" to compute if any commit being pushed in the
superproject binds a commit in a submodule that hasn't been pushed
out was overly inefficient, making it unusable even for a small
project that does not have any submodule but have a reasonable
number of refs.

* hv/submodule-not-yet-pushed-fix:
  submodule_needs_pushing(): explain the behaviour when we cannot answer
  batch check whether submodule needs pushing into one call
  serialize collection of refs that contain submodule changes
  serialize collection of changed submodules

4 years agoMerge branch 'dt/empty-submodule-in-merge'
Junio C Hamano [Fri, 16 Dec 2016 23:27:47 +0000 (15:27 -0800)]
Merge branch 'dt/empty-submodule-in-merge'

An empty directory in a working tree that can simply be nuked used
to interfere while merging or cherry-picking a change to create a
submodule directory there, which has been fixed..

* dt/empty-submodule-in-merge:
  submodules: allow empty working-tree dirs in merge/cherry-pick

4 years agoMerge branch 'jk/rev-parse-symbolic-parents-fix'
Junio C Hamano [Fri, 16 Dec 2016 23:27:47 +0000 (15:27 -0800)]
Merge branch 'jk/rev-parse-symbolic-parents-fix'

"git rev-parse --symbolic" failed with a more recent notation like
"HEAD^-1" and "HEAD^!".

* jk/rev-parse-symbolic-parents-fix:
  rev-parse: fix parent shorthands with --symbolic

4 years agoindex-pack: skip collision check when not in repository
Jeff King [Fri, 16 Dec 2016 21:43:22 +0000 (16:43 -0500)]
index-pack: skip collision check when not in repository

You can run "git index-pack path/to/foo.pack" outside of a
repository to generate an index file, or just to verify the
contents. There's no point in doing a collision check, since
we obviously do not have any objects to collide with.

The current code will blindly look in .git/objects based on
the result of setup_git_env(). That effectively gives us the
right answer (since we won't find any objects), but it's a
waste of time, and it conflicts with our desire to
eventually get rid of the "fallback to .git" behavior of
setup_git_env().

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agonormalize_path_copy(): fix pushing to //server/share/dir on Windows
Johannes Sixt [Wed, 14 Dec 2016 19:37:38 +0000 (20:37 +0100)]
normalize_path_copy(): fix pushing to //server/share/dir on Windows

normalize_path_copy() is not prepared to keep the double-slash of a
//server/share/dir kind of path, but treats it like a regular POSIX
style path and transforms it to /server/share/dir.

The bug manifests when 'git push //server/share/dir master' is run,
because tmp_objdir_add_as_alternate() uses the path in normalized
form when it registers the quarantine object database via
link_alt_odb_entries(). Needless to say that the directory cannot be
accessed using the wrongly normalized path.

Fix it by skipping all of the root part, not just a potential drive
prefix. offset_1st_component takes care of this, see the
implementation in compat/mingw.c::mingw_offset_1st_component().

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot: use nongit() function where applicable
Jeff King [Fri, 16 Dec 2016 02:31:59 +0000 (21:31 -0500)]
t: use nongit() function where applicable

Many tests want to run a command outside of any git repo;
with the nongit() function this is now a one-liner. It saves
a few lines, but more importantly, it's immediately obvious
what the code is trying to accomplish.

This doesn't convert every such case in the test suite; it
just covers those that want to do a one-off command. Other
cases, such as the ones in t4035, are part of a larger
scheme of outside-repo files, and it's less confusing for
them to stay consistent with the surrounding tests.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoindex-pack: complain when --stdin is used outside of a repo
Jeff King [Fri, 16 Dec 2016 02:30:59 +0000 (21:30 -0500)]
index-pack: complain when --stdin is used outside of a repo

The index-pack builtin is marked as RUN_SETUP_GENTLY,
because it's perfectly fine to index a pack in the
filesystem outside of any repository. However, --stdin mode
will write the result to the object database, which does not
make sense outside of a repository. Doing so creates a bogus
".git" directory with nothing in it except the newly-created
pack and its index.

Instead, let's flag this as an error and abort.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot5000: extract nongit function to test-lib-functions.sh
Jeff King [Fri, 16 Dec 2016 02:30:12 +0000 (21:30 -0500)]
t5000: extract nongit function to test-lib-functions.sh

This function abstracts the idea of running a command
outside of any repository (which is slightly awkward to do
because even if you make a non-repo directory, git may keep
walking up outside of the trash directory). There are
several scripts that use the same technique, so let's make
the function available for everyone.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoREADME: replace gmane link with public-inbox
Jeff King [Thu, 15 Dec 2016 14:17:19 +0000 (09:17 -0500)]
README: replace gmane link with public-inbox

The general status and future of gmane is unclear at this
point, but certainly it does not seem to be carrying
gmane.comp.version-control.git at all anymore. Let's point
to public-inbox.org, which seems to be the favored archive
on the list these days (and which uses message-ids in its
URLs, making the links somewhat future-proof).

Reported-by: Chiel ten Brinke <ctenbrinke@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoRevert "sequencer: remove useless get_dir() function"
Junio C Hamano [Wed, 14 Dec 2016 22:56:46 +0000 (14:56 -0800)]
Revert "sequencer: remove useless get_dir() function"

This reverts commit 39784cd3620cc47415c9010ec58a9616f040125c.

The function had only one caller when the "remove useless" was
written, but another topic will soon make heavy use of it and more
importantly the function will return different paths depending on
the value in opts.

4 years agoparse-options: print "fatal:" before usage_msg_opt()
Jeff King [Wed, 14 Dec 2016 15:10:10 +0000 (10:10 -0500)]
parse-options: print "fatal:" before usage_msg_opt()

Programs may use usage_msg_opt() to print a brief message
followed by the program usage, and then exit. The message
isn't prefixed at all, though, so it doesn't match our usual
error output and is easy to overlook:

    $ git clone 1 2 3
    Too many arguments.

    usage: git clone [<options>] [--] <repo> [<dir>]

    -v, --verbose         be more verbose
    -q, --quiet           be more quiet
    --progress            force progress reporting
    -n, --no-checkout     don't create a checkout
    --bare                create a bare repository
    [...and so on for another 31 lines...]

It looks especially bad when the message starts with an
option, like:

    $ git replace -e
    -e needs exactly one argument

    usage: git replace [-f] <object> <replacement>
       or: git replace [-f] --edit <object>
    [...etc...]

Let's put our usual "fatal:" prefix in front of it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoMakefile: exclude contrib from FIND_SOURCE_FILES
Jeff King [Wed, 14 Dec 2016 14:32:35 +0000 (09:32 -0500)]
Makefile: exclude contrib from FIND_SOURCE_FILES

When you're working on the git project, you're unlikely to
care about random bits in contrib/ (e.g., you would not want
to jump to the copy of xmalloc in the wincred credential
helper). Nobody has really complained because there are
relatively few C files in contrib.

Now that we're matching shell scripts, too, we get quite a
few more hits, especially in the obsolete contrib/examples
directory. Looking for usage() should turn up the one in
git-sh-setup, not in some long-dead version of git-clone.

Let's just exclude all of contrib. Any specific projects
there which are big enough to want tags can generate them
separately.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoMakefile: match shell scripts in FIND_SOURCE_FILES
Jeff King [Wed, 14 Dec 2016 14:29:44 +0000 (09:29 -0500)]
Makefile: match shell scripts in FIND_SOURCE_FILES

We feed FIND_SOURCE_FILES to ctags to help developers
navigate to particular functions, but we only feed C source
code. The same feature can be helpful when working with
shell scripts (especially the test suite). Modern versions
of ctags know how to parse shell scripts; we just need to
feed the filenames to it.

This patch specifically avoids including the individual test
scripts themselves. Those are unlikely to be of interest,
and there are a lot of them to process. It does pick up
test-lib.sh and test-lib-functions.sh.

Note that our negative pathspec already excludes the
individual scripts for the ls-files case, but we need to
loosen the `find` rule to match it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoMakefile: exclude test cruft from FIND_SOURCE_FILES
Jeff King [Wed, 14 Dec 2016 14:28:04 +0000 (09:28 -0500)]
Makefile: exclude test cruft from FIND_SOURCE_FILES

The test directory may contain three types of files that
match our patterns:

  1. Helper programs in t/helper.

  2. Sample data files (e.g., t/t4051/hello.c).

  3. Untracked cruft in trash directories and t/perf/build.

We want to match (1), but not the other two, as they just
clutter up the list.

For the ls-files method, we can drop (2) with a negative
pathspec. We do not have to care about (3), since ls-files
will not list untracked files.

For `find`, we can match both cases with `-prune` patterns.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoMakefile: reformat FIND_SOURCE_FILES
Jeff King [Wed, 14 Dec 2016 14:26:55 +0000 (09:26 -0500)]
Makefile: reformat FIND_SOURCE_FILES

As we add to this in future commits, the formatting is going
to make it harder and harder to read. Let's write it more as
we would in a shell script, putting each logical block on
its own line.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agounicode_width.h: update the width tables to Unicode 9.0
Beat Bolli [Tue, 13 Dec 2016 23:31:44 +0000 (00:31 +0100)]
unicode_width.h: update the width tables to Unicode 9.0

Rerunning update-unicode.sh that we fixed in the previous commits
produces these new tables.

Signed-off-by: Beat Bolli <dev+git@drbeat.li>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoupdate_unicode.sh: remove the plane filter
Beat Bolli [Tue, 13 Dec 2016 23:31:43 +0000 (00:31 +0100)]
update_unicode.sh: remove the plane filter

The uniset upstream has accepted my patches that eliminate the Unicode
plane offsets from the output in '--32' mode.

Remove the corresponding filter in update_unicode.sh.

This also fixes the issue that the plane offsets were not removed from
the second uniset call.

Signed-off-by: Beat Bolli <dev+git@drbeat.li>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoupdate_unicode.sh: automatically download newer definition files
Beat Bolli [Tue, 13 Dec 2016 23:31:42 +0000 (00:31 +0100)]
update_unicode.sh: automatically download newer definition files

Checking just for the unicode data files' existence is not sufficient;
we should also download them if a newer version exists on the Unicode
consortium's servers. Option -N of wget does this nicely for us.

Reviewed-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Beat Bolli <dev+git@drbeat.li>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoupdate_unicode.sh: pin the uniset repo to a known good commit
Beat Bolli [Tue, 13 Dec 2016 23:31:41 +0000 (00:31 +0100)]
update_unicode.sh: pin the uniset repo to a known good commit

The uniset upstream has added more commits that for example change the
hexadecimal output in '--32' mode to decimal. Let's pin the repo to a
commit that still outputs the width tables in the format we want.

Signed-off-by: Beat Bolli <dev+git@drbeat.li>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoupdate_unicode.sh: remove an unnecessary subshell level
Beat Bolli [Tue, 13 Dec 2016 23:31:40 +0000 (00:31 +0100)]
update_unicode.sh: remove an unnecessary subshell level

After the move into contrib/update-unicode, we no longer create the
unicode directory to have a clean working folder. Instead, the directory
of the script is used. This means that the subshell can be removed.

Signed-off-by: Beat Bolli <dev+git@drbeat.li>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoupdate_unicode.sh: move it into contrib/update-unicode
Beat Bolli [Tue, 13 Dec 2016 23:31:39 +0000 (00:31 +0100)]
update_unicode.sh: move it into contrib/update-unicode

As it's used only by a tiny minority of the Git developer population,
this script does not belong into the main Git source directory.

Move it into contrib/ and adjust the paths to account for the new
location.

Signed-off-by: Beat Bolli <dev+git@drbeat.li>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agogit-p4: support git worktrees
Luke Diamand [Tue, 13 Dec 2016 21:51:28 +0000 (21:51 +0000)]
git-p4: support git worktrees

git-p4 would attempt to find the git directory using
its own specific code, which did not know about git
worktrees.

Rework it to use "git rev-parse --git-dir" instead.

Add test cases for worktree usage and specifying
git directory via --git-dir and $GIT_DIR.

Signed-off-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoEarly fixes for 2.11.x series
Junio C Hamano [Tue, 13 Dec 2016 22:13:17 +0000 (14:13 -0800)]
Early fixes for 2.11.x series

Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoMerge branch 'ew/svn-fixes'
Junio C Hamano [Tue, 13 Dec 2016 22:09:27 +0000 (14:09 -0800)]
Merge branch 'ew/svn-fixes'

* ew/svn-fixes:
  git-svn: document useLogAuthor and addAuthorFrom config keys
  git-svn: allow "0" in SVN path components

4 years agoMerge branch 'js/mingw-isatty'
Junio C Hamano [Tue, 13 Dec 2016 22:09:27 +0000 (14:09 -0800)]
Merge branch 'js/mingw-isatty'

We often decide if a session is interactive by checking if the
standard I/O streams are connected to a TTY, but isatty() emulation
on Windows incorrectly returned true if it is used on NUL (i.e. an
equivalent to /dev/null). This has been fixed.

* js/mingw-isatty:
  mingw: intercept isatty() to handle /dev/null as Git expects it

4 years agot5547-push-quarantine: run the path separator test on Windows, too
Johannes Sixt [Tue, 13 Dec 2016 19:09:31 +0000 (20:09 +0100)]
t5547-push-quarantine: run the path separator test on Windows, too

To perform the test case on Windows in a way that corresponds to the
POSIX version, inject the semicolon in a directory name.

Typically, an absolute POSIX style path, such as the one in $PWD, is
translated into a Windows style path by bash when it invokes git.exe.
However, the presence of the semicolon suppresses this translation;
but the untranslated POSIX style path is useless for git.exe.
Therefore, instead of $PWD pass the Windows style path that $(pwd)
produces.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agot3600: slightly modernize style
Stefan Beller [Mon, 12 Dec 2016 23:54:55 +0000 (15:54 -0800)]
t3600: slightly modernize style

Remove the space between redirection and file name.
Also remove unnecessary invocations of subshells, such as

(cd submod &&
echo X >untracked
) &&

as there is no point of having the shell for functional purposes.
In case of a single Git command use the `-C` option to let Git cd into
the directory.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agotmp-objdir: quote paths we add to alternates
Jeff King [Mon, 12 Dec 2016 19:53:55 +0000 (14:53 -0500)]
tmp-objdir: quote paths we add to alternates

Commit 722ff7f87 (receive-pack: quarantine objects until
pre-receive accepts, 2016-10-03) regressed pushes to
repositories with colon (or semi-colon in Windows in them)
because it adds the repository's main object directory to
GIT_ALTERNATE_OBJECT_DIRECTORIES. The receiver interprets
the colon as a delimiter, not as part of the path, and
index-pack is unable to find objects which it needs to
resolve deltas.

The previous commit introduced a quoting mechanism for the
alternates list; let's use it here to cover this case. We'll
avoid quoting when we can, though. This alternate setup is
also used when calling hooks, so it's possible that the user
may call older git implementations which don't understand
the quoting mechanism. By quoting only when necessary, this
setup will continue to work unless the user _also_ has a
repository whose path contains the delimiter.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoalternates: accept double-quoted paths
Jeff King [Mon, 12 Dec 2016 19:52:22 +0000 (14:52 -0500)]
alternates: accept double-quoted paths

We read lists of alternates from objects/info/alternates
files (delimited by newline), as well as from the
GIT_ALTERNATE_OBJECT_DIRECTORIES environment variable
(delimited by colon or semi-colon, depending on the
platform).

There's no mechanism for quoting the delimiters, so it's
impossible to specify an alternate path that contains a
colon in the environment, or one that contains a newline in
a file. We've lived with that restriction for ages because
both alternates and filenames with colons are relatively
rare, and it's only a problem when the two meet. But since
722ff7f87 (receive-pack: quarantine objects until
pre-receive accepts, 2016-10-03), which builds on the
alternates system, every push causes the receiver to set
GIT_ALTERNATE_OBJECT_DIRECTORIES internally.

It would be convenient to have some way to quote the
delimiter so that we can represent arbitrary paths.

The simplest thing would be an escape character before a
quoted delimiter (e.g., "\:" as a literal colon). But that
creates a backwards compatibility problem: any path which
uses that escape character is now broken, and we've just
shifted the problem. We could choose an unlikely escape
character (e.g., something from the non-printable ASCII
range), but that's awkward to use.

Instead, let's treat names as unquoted unless they begin
with a double-quote, in which case they are interpreted via
our usual C-stylke quoting rules. This also breaks
backwards-compatibility, but in a smaller way: it only
matters if your file has a double-quote as the very _first_
character in the path (whereas an escape character is a
problem anywhere in the path).  It's also consistent with
many other parts of git, which accept either a bare pathname
or a double-quoted one, and the sender can choose to quote
or not as required.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoMerge branch 'jk/alt-odb-cleanup' into jk/quote-env-path-list-component
Junio C Hamano [Mon, 12 Dec 2016 23:09:57 +0000 (15:09 -0800)]
Merge branch 'jk/alt-odb-cleanup' into jk/quote-env-path-list-component

* jk/alt-odb-cleanup:
  alternates: re-allow relative paths from environment

4 years agodate-formats.txt: Typo fix
Luis Ressel [Mon, 12 Dec 2016 16:45:02 +0000 (17:45 +0100)]
date-formats.txt: Typo fix

Last time I checked, I was living in the UTC+01:00 time zone. UTC+02:00
would be Central European _Summer_ Time.

Signed-off-by: Luis Ressel <aranea@aixah.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agogit-svn: document useLogAuthor and addAuthorFrom config keys
Eric Wong [Sun, 11 Dec 2016 00:06:46 +0000 (00:06 +0000)]
git-svn: document useLogAuthor and addAuthorFrom config keys

We've always supported these config keys in git-svn,
so document them so users won't have to respecify them
on every invocation.

Reported-by: Juergen Kosel <juergen.kosel@gmx.de>
Signed-off-by: Eric Wong <e@80x24.org>
4 years agogit-svn: allow "0" in SVN path components
Eric Wong [Wed, 30 Nov 2016 00:45:41 +0000 (00:45 +0000)]
git-svn: allow "0" in SVN path components

Blindly checking a path component for falsiness is unwise, as
"0" is false to Perl, but a valid pathname component for SVN
(or any filesystem).

Found via random code reading.

Signed-off-by: Eric Wong <e@80x24.org>
4 years agosubmodule--helper: set alternateLocation for cloned submodules
Vitaly "_Vi" Shukela [Thu, 8 Dec 2016 01:38:14 +0000 (04:38 +0300)]
submodule--helper: set alternateLocation for cloned submodules

In 31224cbdc7 (clone: recursive and reference option triggers
submodule alternates, 2016-08-17) a mechanism was added to
have submodules referenced.  It did not address _nested_
submodules, however.

This patch makes all not just the root repository, but also
all submodules (recursively) have submodule.alternateLocation
and submodule.alternateErrorStrategy configured, making Git
search for possible alternates for nested submodules as well.

As submodule's alternate target does not end in .git/objects
(rather .git/modules/qqqqqq/objects), this alternate target
path restriction for in add_possible_reference_from_superproject
relates from "*.git/objects" to just */objects".

New tests have been added to t7408-submodule-reference.

Signed-off-by: Vitaly _Vi Shukela <vi0oss@gmail.com>
Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>