Commit graph

49832 commits

Author SHA1 Message Date
Ann T Ropea a2cd709de3 print_sha1_ellipsis: introduce helper
Introduce a helper print_sha1_ellipsis() that pays attention to the
GIT_PRINT_SHA1_ELLIPSIS environment variable, and prepare the tests to
unconditionally set it for the test pieces that will be broken once the code
stops showing the extra dots by default.

The removal of these dots is merely a plan at this step and has not happened
yet but soon will.

Document GIT_PRINT_SHA1_ELLIPSIS.

Signed-off-by: Ann T Ropea <bedhanger@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-12-04 08:25:35 -08:00
Ann T Ropea f61d89e100 Documentation: user-manual: limit usage of ellipsis
There is no need to use full 40-hex to identify the object names like
the examples hint at by omitting the tail part of an object name as if
that has to be spelled out but the example omits them only for brevity.
Give examples using abbreviated object names without ellipses just like
how people do in real life.

Signed-off-by: Ann T Ropea <bedhanger@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-12-04 08:25:06 -08:00
Ann T Ropea 9fe923886f Documentation: revisions: fix typo: "three dot" ---> "three-dot" (in line with "two-dot").
Signed-off-by: Ann T Ropea <bedhanger@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-12-04 08:25:06 -08:00
Jonathan Tan 89973554b5 diffcore-rename: make diff-tree -l0 mean -l<large>
In the documentation of diff-tree, it is stated that the -l option
"prevents rename/copy detection from running if the number of
rename/copy targets exceeds the specified number". The documentation
does not mention any special handling for the number 0, but the
implementation before commit 9f7e4bfa3b ("diff: remove silent clamp of
renameLimit", 2017-11-13) treated 0 as a special value indicating that
the rename limit is to be a very large number instead.

The commit 9f7e4bfa3b changed that behavior, treating 0 as 0. Revert
this behavior to what it was previously. This allows existing scripts
and tools that use "-l0" to continue working. The alternative (to have
"-l0" suppress rename detection) is probably much less useful, since
users can just refrain from specifying -M and/or -C to have the same
effect.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-12-02 22:16:57 -08:00
Junio C Hamano 1a4e40aa5d Git 2.15.1
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABCAAGBQJaHOh5AAoJELC16IaWr+bL8ooP/R1tt9+KTvKj+ml/GS0gLQMN
 GQ5WiR5XuZCBvXRyX/p6ZtOZ9SwmDA79yqKPNUdarErhUnJ1gX4ogyXTfD9lwr2S
 E2s4qPHACoAT9Gzo1PV6UsN9EvHRYtbkswZlN4Q8Dad1QFmbGdCh/vyUsj3BxRbc
 Eq0Uz+JMOr7LimsTuDzMgAMUutmGaC2PW8hHaVhnhNe/I+XdAiM9oDtcXxT0qDBM
 aE7sMclHUOrPn59xw2xkcrMwCpWCsQT4reA9AsimD2zkAMCd7Tfjg15S1Ef7MmT7
 WCgFSKhhD412TPafpb3W7z7vDDgMg2DataCeg5nnxlK0PQ8UPqJB2AuC3qEdFQZY
 RHD1gA5STgsbFqkJSL3QcrHKUHDddb5EJoY9LL9AmQD+FMPYOB+Tlwv+9vzevsPP
 x7/el7QCIc8k6z/QpSO6tjyXrrh936MJT4HM8kG44WItehXvINwzT2nG5KD44uJq
 K9/Bjj4qGpzlK5g8CAkckiDwSMpHkSYaOCw7bO8ATdxxqCQOI48sLOTeJgIY/kSv
 v51dzdYV5aBbU6CLA4ii4f4KI6hiCZ1ZTfEndfNB/YfDgl9GvYnz/W3hNFG65Crx
 Zb9mNCcVe/a3/R/AgxPBlsg2sP6P8+ztpT1239IhO7LZjx5vZWX4aS540HnHygVs
 7B7NCfzFMAYfLmZDYouD
 =3qq4
 -----END PGP SIGNATURE-----

Sync with v2.15.1
2017-11-28 13:44:21 +09:00
Junio C Hamano afc63cb6c6 RelNotes: the seventh batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-11-28 13:43:32 +09:00
Junio C Hamano f034901648 Merge branch 'rs/include-comments-before-the-function-header'
"git grep -W", "git diff -W" and their friends learned a heuristic
to extend a pre-context beyond the line that matches the "function
pattern" (aka "diff.*.xfuncname") to include a comment block, if
exists, that immediately precedes it.

* rs/include-comments-before-the-function-header:
  grep: show non-empty lines before functions with -W
  grep: update boundary variable for pre-context
  t7810: improve check of -W with user-defined function lines
  xdiff: show non-empty lines before functions with -W
  xdiff: factor out is_func_rec()
  t4051: add test for comments preceding function lines
2017-11-28 13:41:50 +09:00
Junio C Hamano 3b49e1b0e9 Merge branch 'ma/branch-list-paginate'
"git branch --list" learned to show its output through the pager by
default when the output is going to a terminal, which is controlled
by the pager.branch configuration variable.  This is similar to a
recent change to "git tag --list".

* ma/branch-list-paginate:
  branch: change default of `pager.branch` to "on"
  branch: respect `pager.branch` in list-mode only
  t7006: add tests for how git branch paginates
2017-11-28 13:41:50 +09:00
Junio C Hamano 16169285f1 Merge branch 'jc/branch-name-sanity'
"git branch" and "git checkout -b" are now forbidden from creating
a branch whose name is "HEAD".

* jc/branch-name-sanity:
  builtin/branch: remove redundant check for HEAD
  branch: correctly reject refs/heads/{-dash,HEAD}
  branch: split validate_new_branchname() into two
  branch: streamline "attr_only" handling in validate_new_branchname()
2017-11-28 13:41:49 +09:00
Junio C Hamano 9b185bef0c Git 2.15.1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-11-28 13:39:14 +09:00
Junio C Hamano b201e96f94 Merge branch 'rs/config-write-section-fix' into maint
There was a recent semantic mismerge in the codepath to write out a
section of a configuration section, which has been corrected.

* rs/config-write-section-fix:
  config: flip return value of write_section()
2017-11-28 13:38:33 +09:00
Ramsay Jones c250e02e2c repository: fix a sparse 'using integer as NULL pointer' warning
Commit 78a6766802 ("Integrate hash algorithm support with repo setup",
2017-11-12) added a 'const struct git_hash_algo *hash_algo' field to the
repository structure, without modifying the initializer of the 'the_repo'
variable. This does not actually introduce a bug, since the '0' initializer
for the 'ignore_env:1' bit-field is interpreted as a NULL pointer (hence
the warning), and the final field (now with no initializer) receives a
default '0'.

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-11-28 12:37:37 +09:00
Kaartic Sivaraam 75ce149575 Doc/checkout: checking out using @{-N} can lead to detached state
@{-N} is a syntax for the N-th last "checkout" and not the N-th
last "branch". Therefore, in some cases using `git checkout @{-$N}`
DOES lead to a "detached HEAD" state. This can also be ensured by
the commit message of 75d6e552a (Documentation: @{-N} can refer to
a commit, 2014-01-19) which clearly specifies how @{-N} can be used
to refer not only to a branch but also to a commit.

Correct the misleading sentence which states that @{-N} doesn't
detach HEAD.

Signed-off-by: Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-11-28 11:33:12 +09:00
Jonathan Tan 2477ab2ea8 diff: support anchoring line(s)
Teach diff a new algorithm, one that attempts to prevent user-specified
lines from appearing as a deletion or addition in the end result. The
end user can use this by specifying "--anchored=<text>" one or more
times when using Git commands like "diff" and "show".

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-11-28 10:40:04 +09:00
Florian Klink 1ab2fd4f39 git-send-email: honor $PATH for sendmail binary
This extends git-send-email to also consider sendmail binaries in $PATH
after checking the (fixed) list of /usr/sbin and /usr/lib, and before
falling back to localhost.

Signed-off-by: Florian Klink <flokli@flokli.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-11-28 10:14:30 +09:00
Jeff King 5e83cca0b8 git-status.txt: mention --no-optional-locks
If you come to the documentation thinking "I do not want Git
to take any locks for my background processes", then you may
easily run across "--no-optional-locks" in git.txt.

But it's quite reasonable to hit a specific instance of the
problem: you have "git status" running in the background,
and you notice that it causes lock contention with other
processes. So you look in git-status.txt to see if there is
a way to disable it, but there's no mention of the flag.

Let's add a short note mentioning that status does indeed
touch the index (and why), with a pointer to the global
option. That can point users in the right direction and help
them make a more informed decision about what they're
disabling.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-11-27 15:09:56 +09:00
Junio C Hamano 5f9953d2c3 RelNotes: the sixth batch for 2.16
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-11-27 11:16:50 +09:00
Junio C Hamano 0c24fdc256 Sync with maint
* maint:
  A bit more fixes for 2.15.1
  RelNotes: minor typo fixes in 2.15.1 draft
2017-11-27 11:15:09 +09:00
Junio C Hamano c2b6135a1b Merge branch 'sw/pull-ipv46-passthru'
Contrary to the documentation, "git pull -4/-6 other-args" did not
ask the underlying "git fetch" to go over IPv4/IPv6, which has been
corrected.

* sw/pull-ipv46-passthru:
  pull: pass -4/-6 option to 'git fetch'
2017-11-27 11:06:40 +09:00
Junio C Hamano 88e2efcbc4 Merge branch 'ks/rebase-no-git-foo'
Mentions of "git-rebase" and "git-am" (dashed form) still remained
in end-user visible strings emitted by the "git rebase" command;
they have been corrected.

* ks/rebase-no-git-foo:
  git-rebase: clean up dashed-usages in messages
2017-11-27 11:06:39 +09:00
Junio C Hamano 51affbd52d Merge branch 'rs/config-write-section-fix'
There was a recent semantic mismerge in the codepath to write out a
section of a configuration section, which has been corrected.

* rs/config-write-section-fix:
  config: flip return value of write_section()
2017-11-27 11:06:38 +09:00
Junio C Hamano 12e87e29ce Merge branch 'ew/rebase-mboxrd'
When "git rebase" prepared an mailbox of changes and fed it to "git
am" to replay them, it was confused when a stray "From " happened
to be in the log message of one of the replayed changes.  This has
been corrected.

* ew/rebase-mboxrd:
  rebase: use mboxrd format to avoid split errors
2017-11-27 11:06:38 +09:00
Junio C Hamano af6e0fe3a5 Merge branch 'tb/add-renormalize'
"git add --renormalize ." is a new and safer way to record the fact
that you are correcting the end-of-line convention and other
"convert_to_git()" glitches in the in-repository data.

* tb/add-renormalize:
  add: introduce "--renormalize"
2017-11-27 11:06:37 +09:00
Junio C Hamano 93bfe62ae3 Merge branch 'tz/complete-branch-copy'
Command line completion (in contrib/) has been taught about the
"--copy" option of "git branch".

* tz/complete-branch-copy:
  completion: add '--copy' option to 'git branch'
2017-11-27 11:06:37 +09:00
Junio C Hamano d78a122e9c Merge branch 'rs/apply-inaccurate-eof-with-incomplete-line'
"git apply --inaccurate-eof" when used with "--ignore-space-change"
triggered an internal sanity check, which has been fixed.

* rs/apply-inaccurate-eof-with-incomplete-line:
  apply: update line lengths for --inaccurate-eof
2017-11-27 11:06:36 +09:00
Junio C Hamano c2ed68342b Merge branch 'pw/sequencer-recover-from-unlockable-index'
The sequencer machinery (used by "git cherry-pick A..B", and "git
rebase -i", among other things) would have lost a commit if stopped
due to an unlockable index file, which has been fixed.

* pw/sequencer-recover-from-unlockable-index:
  sequencer: reschedule pick if index can't be locked
2017-11-27 11:06:35 +09:00
Junio C Hamano 6254330e4d Merge branch 'sd/branch-copy'
Code clean-up.

* sd/branch-copy:
  config: avoid "write_in_full(fd, buf, len) != len" pattern
2017-11-27 11:06:35 +09:00
Junio C Hamano f70a50fc48 Merge branch 'sb/test-cherry-pick-submodule-getting-in-a-way'
The three-way merge performed by "git cherry-pick" was confused
when a new submodule was added in the meantime, which has been
fixed (or "papered over").

* sb/test-cherry-pick-submodule-getting-in-a-way:
  merge-recursive: handle addition of submodule on our side of history
  t/3512: demonstrate unrelated submodule/file conflict as cherry-pick failure
2017-11-27 11:06:34 +09:00
Junio C Hamano c5e763083f Merge branch 'tz/notes-error-to-stderr'
"git notes" sent its error message to its standard output stream,
which was corrected.

* tz/notes-error-to-stderr:
  notes: send "Automatic notes merge failed" messages to stderr
2017-11-27 11:06:34 +09:00
Junio C Hamano dec01eee45 Merge branch 'tz/redirect-fix'
A few scripts (both in production and tests) incorrectly redirected
their error output.  These have been corrected.

* tz/redirect-fix:
  rebase: fix stderr redirect in apply_autostash()
  t/lib-gpg: fix gpgconf stderr redirect to /dev/null
2017-11-27 11:06:33 +09:00
Junio C Hamano f3f671b928 Merge branch 'rv/sendemail-tocmd-in-config-and-completion'
Teach "sendemail.tocmd" to places that know about "sendemail.to",
like documentation and shell completion (in contrib/).

* rv/sendemail-tocmd-in-config-and-completion:
  completion: add git config sendemail.tocmd
  Documentation/config: add sendemail.tocmd to list preceding "See git-send-email(1)"
2017-11-27 11:06:32 +09:00
Junio C Hamano 022dd4a0d3 Merge branch 'jc/merge-base-fork-point-doc'
Clarify and enhance documentation for "merge-base --fork-point", as
it was clear what it computed but not why/what for.

* jc/merge-base-fork-point-doc:
  merge-base --fork-point doc: clarify the example and failure modes
2017-11-27 11:06:32 +09:00
Junio C Hamano 10f65c239a Merge branch 'jc/ignore-cr-at-eol'
The "diff" family of commands learned to ignore differences in
carriage return at the end of line.

* jc/ignore-cr-at-eol:
  diff: --ignore-cr-at-eol
  xdiff: reassign xpparm_t.flags bits
2017-11-27 11:06:31 +09:00
Junio C Hamano 7bc77766e1 A bit more fixes for 2.15.1
We've been waiting long enough, a few more would not hurt ;-)

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-11-27 10:58:31 +09:00
Junio C Hamano 80a0e0fdd6 Merge branch 'ma/reduce-heads-leakfix' into maint
Leak fixes.

* ma/reduce-heads-leakfix:
  reduce_heads: fix memory leaks
  builtin/merge-base: free commit lists
2017-11-27 10:57:02 +09:00
Junio C Hamano 03e8004f06 Merge branch 'ma/bisect-leakfix' into maint
Leak fixes.

* ma/bisect-leakfix:
  bisect: fix memory leak when returning best element
  bisect: fix off-by-one error in `best_bisection_sorted()`
  bisect: fix memory leak in `find_bisection()`
  bisect: change calling-convention of `find_bisection()`
2017-11-27 10:57:02 +09:00
Junio C Hamano df481b99ef Merge branch 'rs/apply-fuzzy-match-fix' into maint
A fix for an ancient bug in "git apply --ignore-space-change" codepath.

* rs/apply-fuzzy-match-fix:
  apply: avoid out-of-bounds access in fuzzy_matchlines()
2017-11-27 10:57:02 +09:00
Junio C Hamano b51df7d306 Merge branch 'ad/submitting-patches-title-decoration' into maint
Doc update around use of "format-patch --subject-prefix" etc.

* ad/submitting-patches-title-decoration:
  doc/SubmittingPatches: correct subject guidance
2017-11-27 10:57:01 +09:00
Junio C Hamano 95bf6151dc Merge branch 'rs/imap-send-next-arg-fix' into maint
Error checking in "git imap-send" for empty response has been
improved.

* rs/imap-send-next-arg-fix:
  imap-send: handle missing response codes gracefully
  imap-send: handle NULL return of next_arg()
2017-11-27 10:57:00 +09:00
Thomas Gummerer 5a0526264b t/README: document test_cmp_rev
test_cmp_rev is a useful function that's used in quite a few test
scripts.  It is however not documented in t/README.  Document it.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-11-27 10:36:58 +09:00
Thomas Gummerer 51b7a52522 t/README: remove mention of adding copyright notices
We generally no longer include copyright notices in new test scripts.
However t/README still mentions it as something to include at the top of
every new script.

Remove that mention as it's outdated.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-11-27 10:36:57 +09:00
Gennady Kupava 406102a731 trace: remove trace key normalization
Trace key normalization is not used, not strictly necessary,
complicates the code and would negatively affect compilation speed if
moved to header.

New trace_default_key key or existing separate marco could be used
instead of passing NULL as a key.

Signed-off-by: Gennady Kupava <gkupava@bloomberg.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-11-27 10:19:08 +09:00
Torsten Bögershausen 86ff70a0f0 convert: tighten the safe autocrlf handling
When a text file had been commited with CRLF and the file is commited
again, the CRLF are kept if .gitattributs has "text=auto".
This is done by analyzing the content of the blob stored in the index:
If a '\r' is found, Git assumes that the blob was commited with CRLF.

The simple search for a '\r' does not always work as expected:
A file is encoded in UTF-16 with CRLF and commited. Git treats it as binary.
Now the content is converted into UTF-8. At the next commit Git treats the
file as text, the CRLF should be converted into LF, but isn't.

Replace has_cr_in_index() with has_crlf_in_index(). When no '\r' is found,
0 is returned directly, this is the most common case.
If a '\r' is found, the content is analyzed more deeply.

Reported-By: Ashish Negi <ashishnegi33@gmail.com>
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-11-27 10:17:24 +09:00
Elijah Newren 4cba2b0108 merge-recursive: ignore_case shouldn't reject intentional removals
In commit ae352c7f3 (merge-recursive.c: fix case-changing merge bug,
2014-05-01), it was observed that removing files could be problematic on
case insensitive file systems, because we could end up removing files
that differed in case only rather than deleting the intended file --
something that happened when files were renamed on one branch in a way
that differed only in case.  To avoid that problem, that commit added
logic to avoid removing files other than the one intended, rejecting the
removal if the files differed only in case.

Unfortunately, the logic it used didn't fully implement that condition as
stated above; instead it merely checked that a case-insensitive lookup of
the file that was requested resulted in finding a file in the index at
stage 0, not that the file found in the index actually differed in case.
Alternatively, one could view the implementation as making an implicit
assumption that the file we actually wanted to remove would never appear
in the index with a stage of 0, and thus that if we found a file with our
lookup, that it had to be a different file (but different in case only).

The net result of this implementation is that it can ignore more requests
than it should, leaving a file around in the working copy that should
have been removed.  Make sure that the file found in the index actually
differs in case before silently ignoring the request to remove the file.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-11-27 09:51:05 +09:00
Thomas Gummerer 4e85333197 worktree: make add <path> <branch> dwim
Currently 'git worktree add <path> <branch>', errors out when 'branch'
is not a local branch.  It has no additional dwim'ing features that one
might expect.

Make it behave more like 'git checkout <branch>' when the branch doesn't
exist locally, but a remote tracking branch uniquely matches the desired
branch name, i.e. create a new branch from the remote tracking branch
and set the upstream to the remote tracking branch.

As 'git worktree add' currently just dies in this situation, there are
no backwards compatibility worries when introducing this feature.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-11-27 09:48:06 +09:00
Thomas Gummerer e284e892ca worktree: add --[no-]track option to the add subcommand
Currently 'git worktree add' sets up tracking branches if '<branch>' is
a remote tracking branch, and doesn't set them up otherwise, as is the
default for 'git branch'.

This may or may not be what the user wants.  Allow overriding this
behaviour with a --[no-]track flag that gets passed through to 'git
branch'.

We already respect branch.autoSetupMerge, as 'git worktree' just calls
'git branch' internally.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-11-27 09:48:06 +09:00
Thomas Gummerer c4738aedc0 worktree: add can be created from any commit-ish
Currently 'git worktree add' is documented to take an optional <branch>
argument, which is checked out in the new worktree.  However it is more
generally possible to use a commit-ish as the optional argument, and
check that out into the new worktree.

Document that this is a possibility, as new users of git worktree add
might find it helpful.

Reported-by: Randall S. Becker <rsbecker@nexbridge.com>
Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-11-27 09:48:06 +09:00
Thomas Gummerer 7c85a87c54 checkout: factor out functions to new lib file
Factor the functions out, so they can be re-used from other places.  In
particular these functions will be re-used in builtin/worktree.c to make
git worktree add dwim more.

While there add some docs to the function.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-11-27 09:48:06 +09:00
Jean-Noel Avila ed5bdd5bab submodule--helper.c: i18n: add a missing space in message
The message spans over 2 lines but the C concatenation does not add
the needed space between the two lines.

Signed-off-by: Jean-Noel Avila <jn.avila@free.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-11-26 12:52:17 +09:00
Todd Zullinger 7d22aec681 RelNotes: minor typo fixes in 2.15.1 draft
Signed-off-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-11-26 12:49:23 +09:00