1
0
mirror of https://github.com/git/git.git synced 2024-10-22 17:09:18 +02:00
Commit Graph

45387 Commits

Author SHA1 Message Date
Junio C Hamano
8d7a455ed5 Start post 2.11 cycle
For now, let's call it 2.12 tentatively.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-12-05 11:31:47 -08:00
Junio C Hamano
a274e0a036 Sync with maint-2.10
* maint-2.10:
  preparing for 2.10.3
2016-12-05 11:25:47 -08:00
Junio C Hamano
c3808ca698 preparing for 2.10.3
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-12-05 11:25:02 -08:00
Junio C Hamano
cd1c2e7301 Merge branch 'jk/common-main' into maint-2.10
* jk/common-main:
  common-main: stop munging argv[0] path
  git-compat-util: move content inside ifdef/endif guards
2016-12-05 11:24:28 -08:00
Torsten Bögershausen
1c25d2d8ed convert: git cherry-pick -Xrenormalize did not work
Working with a repo that used to be all CRLF. At some point it
was changed to all LF, with `text=auto` in .gitattributes.
Trying to cherry-pick a commit from before the switchover fails:

    $ git cherry-pick -Xrenormalize <commit>
    fatal: CRLF would be replaced by LF in [path]

Commit 65237284 "unify the "auto" handling of CRLF" introduced
a regression:

Whenever crlf_action is CRLF_TEXT_XXX and not CRLF_AUTO_XXX,
SAFE_CRLF_RENORMALIZE was feed into check_safe_crlf().  This is
wrong because here everything else than SAFE_CRLF_WARN is treated as
SAFE_CRLF_FAIL.

Call check_safe_crlf() only if checksafe is SAFE_CRLF_WARN or
SAFE_CRLF_FAIL.

Reported-by: Eevee (Lexy Munroe) <eevee@veekun.com>
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-12-01 11:27:08 -08:00
Junio C Hamano
b365dafe23 Merge branch 'tb/t0027-raciness-fix' into jc/renormalize-merge-kill-safer-crlf
* tb/t0027-raciness-fix:
  convert: Correct NNO tests and missing `LF will be replaced by CRLF`
2016-12-01 10:34:42 -08:00
Junio C Hamano
33b842a1e9 pull: fast-forward "pull --rebase=true"
"git pull --rebase" always runs "git rebase" after fetching the
commit to serve as the new base, even when the new base is a
descendant of the current HEAD, i.e. we haven't done any work.

In such a case, we can instead fast-forward to the new base without
invoking the rebase process.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-11-29 14:40:16 -08:00
Jonathan Tan
967dfd4d56 sequencer: use trailer's trailer layout
Make sequencer use trailer.c's trailer layout definition, as opposed to
parsing the footer by itself. This makes "commit -s", "cherry-pick -x",
and "format-patch --signoff" consistent with trailer, allowing
non-trailer lines and multiple-line trailers in trailer blocks under
certain conditions, and therefore suppressing the extra newline in those
cases.

Consistency with trailer extends to respecting trailer configs.  Tests
have been included to show that.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-11-29 14:22:18 -08:00
Jonathan Tan
e8c352c316 trailer: have function to describe trailer layout
Create a function that, taking a string, describes the position of its
trailer block (if available) and the contents thereof, and make trailer
use it. This makes it easier for other Git components, in the future, to
interpret trailer blocks in the same way as trailer.

In a subsequent patch, another component will be made to use this.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-11-29 14:22:18 -08:00
Jonathan Tan
022349c3b0 trailer: avoid unnecessary splitting on lines
trailer.c currently splits lines while processing a buffer (and also
rejoins lines when needing to invoke ignore_non_trailer).

Avoid such line splitting, except when generating the strings
corresponding to trailers (for ease of use by clients - a subsequent
patch will allow other components to obtain the layout of a trailer
block in a buffer, including the trailers themselves). The main purpose
of this is to make it easy to return pointers into the original buffer
(for a subsequent patch), but this also significantly reduces the number
of memory allocations required.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-11-29 14:22:18 -08:00
Jonathan Tan
710714aaa8 commit: make ignore_non_trailer take buf/len
Make ignore_non_trailer take a buf/len pair instead of struct strbuf.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-11-29 14:22:18 -08:00
Jonathan Tan
e4319562bc trailer: be stricter in parsing separators
Currently, a line is interpreted to be a trailer line if it contains a
separator. Make parsing stricter by requiring the text on the left of
the separator, if not the empty string, to be of the "<token><optional
whitespace>" form.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-11-29 14:22:08 -08:00
Junio C Hamano
0a79ccaac7 Merge branch 'tk/diffcore-delta-remove-unused' into maint
Code cleanup.

* tk/diffcore-delta-remove-unused:
  diffcore-delta: remove unused parameter to diffcore_count_changes()
2016-11-29 13:28:03 -08:00
Junio C Hamano
af8d6a9821 Merge branch 'jk/create-branch-remove-unused-param' into maint
Code clean-up.

* jk/create-branch-remove-unused-param:
  create_branch: drop unused "head" parameter
2016-11-29 13:28:02 -08:00
Junio C Hamano
797d1a4672 Merge branch 'nd/worktree-lock' into maint
Typofix.

* nd/worktree-lock:
  git-worktree.txt: fix typo "to"/"two", and add comma
2016-11-29 13:28:02 -08:00
Junio C Hamano
d92466ee25 Merge branch 'ps/common-info-doc' into maint
Doc fix.

* ps/common-info-doc:
  doc: fix location of 'info/' with $GIT_COMMON_DIR
2016-11-29 13:28:01 -08:00
Junio C Hamano
e3c4323e23 Merge branch 'rs/cocci' into maint
Improve the rule to convert "unsigned char [20]" into "struct
object_id *" in contrib/coccinelle/

* rs/cocci:
  cocci: avoid self-references in object_id transformations
2016-11-29 13:28:00 -08:00
Junio C Hamano
91207f3784 Merge branch 'nd/test-helpers' into maint
Update to the test framework made in 2.9 timeframe broke running
the tests under valgrind, which has been fixed.

* nd/test-helpers:
  valgrind: support test helpers
2016-11-29 13:28:00 -08:00
Junio C Hamano
6afadbd5ee Merge branch 'sc/fmt-merge-msg-doc-markup-fix' into maint
Documentation fix.

* sc/fmt-merge-msg-doc-markup-fix:
  Documentation/fmt-merge-msg: fix markup in example
2016-11-29 13:28:00 -08:00
Junio C Hamano
c8a3ec37ab Merge branch 'rs/commit-pptr-simplify' into maint
Code simplification.

* rs/commit-pptr-simplify:
  commit: simplify building parents list
2016-11-29 13:27:59 -08:00
Junio C Hamano
50b8276ab9 Merge branch 'jk/rebase-config-insn-fmt-docfix' into maint
Documentation fix.

* jk/rebase-config-insn-fmt-docfix:
  doc: fix missing "::" in config list
2016-11-29 13:27:58 -08:00
Junio C Hamano
e9f74313e7 Merge branch 'ak/pre-receive-hook-template-modefix' into maint
A trivial clean-up to a recently graduated topic.

* ak/pre-receive-hook-template-modefix:
  pre-receive.sample: mark it executable
2016-11-29 13:27:57 -08:00
Junio C Hamano
729fb9ad34 Merge branch 'ls/macos-update' into maint
Portability update and workaround for builds on recent Mac OS X.

* ls/macos-update:
  travis-ci: disable GIT_TEST_HTTPD for macOS
  Makefile: set NO_OPENSSL on macOS by default
2016-11-29 13:27:56 -08:00
Junio C Hamano
25e298d2c9 Merge branch 'as/merge-attr-sleep' into maint
Fix for a racy false-positive test failure.

* as/merge-attr-sleep:
  t6026: clarify the point of "kill $(cat sleep.pid)"
  t6026: ensure that long-running script really is
  Revert "t6026-merge-attr: don't fail if sleep exits early"
  Revert "t6026-merge-attr: ensure that the merge driver was called"
  t6026-merge-attr: ensure that the merge driver was called
  t6026-merge-attr: don't fail if sleep exits early
2016-11-29 13:27:56 -08:00
Junio C Hamano
bb6bc68d22 Merge branch 'ak/sh-setup-dot-source-i18n-fix' into maint
Recent update to git-sh-setup (a library of shell functions that
are used by our in-tree scripted Porcelain commands) included
another shell library git-sh-i18n without specifying where it is,
relying on the $PATH.  This has been fixed to be more explicit by
prefixing $(git --exec-path) output in front.

* ak/sh-setup-dot-source-i18n-fix:
  git-sh-setup: be explicit where to dot-source git-sh-i18n from.
2016-11-29 13:27:56 -08:00
Junio C Hamano
aa22ef8a80 Merge branch 'jk/daemon-path-ok-check-truncation' into maint
"git daemon" used fixed-length buffers to turn URL to the
repository the client asked for into the server side directory
path, using snprintf() to avoid overflowing these buffers, but
allowed possibly truncated paths to the directory.  This has been
tightened to reject such a request that causes overlong path to be
required to serve.

* jk/daemon-path-ok-check-truncation:
  daemon: detect and reject too-long paths
2016-11-29 13:27:56 -08:00
Junio C Hamano
f2ad912f99 Merge branch 'rs/ring-buffer-wraparound' into maint
The code that we have used for the past 10+ years to cycle
4-element ring buffers turns out to be not quite portable in
theoretical world.

* rs/ring-buffer-wraparound:
  hex: make wraparound of the index into ring-buffer explicit
2016-11-29 13:27:55 -08:00
Junio C Hamano
a3f2781dd0 Merge branch 'mm/send-email-cc-cruft-after-address' into maint
"git send-email" attempts to pick up valid e-mails from the
trailers, but people in real world write non-addresses there, like
"Cc: Stable <add@re.ss> # 4.8+", which broke the output depending
on the availability and vintage of Mail::Address perl module.

* mm/send-email-cc-cruft-after-address:
  Git.pm: add comment pointing to t9000
  t9000-addresses: update expected results after fix
  parse_mailboxes: accept extra text after <...> address
2016-11-29 13:27:55 -08:00
Junio C Hamano
fa308cd848 Merge branch 'cp/completion-negative-refs' into maint
The command-line completion script (in contrib/) learned to
complete "git cmd ^mas<HT>" to complete the negative end of
reference to "git cmd ^master".

* cp/completion-negative-refs:
  completion: support excluding refs
2016-11-29 13:27:53 -08:00
Junio C Hamano
bab32da385 Merge branch 'jc/am-read-author-file' into maint
Extract a small helper out of the function that reads the authors
script file "git am" internally uses.
This by itself is not useful until a second caller appears in the
future for "rebase -i" helper.

* jc/am-read-author-file:
  am: refactor read_author_script()
2016-11-29 13:27:53 -08:00
Junio C Hamano
454cb6bd52 Git 2.11
Signed-off-by: Junio C Hamano <gitster@pobox.com>
v2.11.0
2016-11-29 12:23:07 -08:00
Junio C Hamano
95c2b13a5f Merge branch 'jk/common-main'
Fix for a small regression in a topic already in 'master'.

* jk/common-main:
  common-main: stop munging argv[0] path
2016-11-29 12:22:13 -08:00
Junio C Hamano
061eeff104 l10n-2.11.0-rnd3.1: update ru and ca translations
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJYPYGEAAoJEMek6Rt1RHooL5gQALq7rZbGpTpdl46wm3cvgsBt
 ZjnoJ/cxy9aps0zwFjG+hAE+/Mo4bt2dQvUOcrEmvIA1fNrlttT5TejK1kn7tUzJ
 KxWFgAV5J0LfMU6DH3MIMzYhGNsmFtVH+tpUjntDdZW3ozCQdtH1rg4h2nXt56vk
 z7UJ1LLW9Anf6963khcLX/OUqbX7uKxhFEbXBvdccshbydH0jRQSHFLbIPYIpUU2
 QvudFR2RTBZmotQyRmF2gOytkdJTSY7vMw8SowR4N0YMumfa7L93WJgs+zTnvweI
 9SBvuhRiaJlbRkBZ87IOwPYjXDjfTYdj4dKnlpUqWJjFKa1LGt4w4e3VKODjAfrr
 ohxg2BXqT9NOT3nA5dxsNJY4xkQKlrBFGNLthoee2gqeIpP6/D+FtDoePfqVJa08
 kg5EwSw1N61ZIX76XBW4gQvqfhre3XYnrLkf2F1Hf5640gI86XzHpRBaztmESLSh
 2/kbksAzdIVe5s57BFThyATsJ1ZxWWrFdb15+ibaafvo8YSMeRiWNL7KF5ZLijPE
 9GdbXOTT7Pt4L3c0g++CfUCRmH6TJWpHukxrv8Px2gM5yyKiHceudiag51CK4835
 QXebqVh26snKdC0KXZUDKj7t3JvtYTi/KCf8bfwJrx931sHDezKLijoPMSwM+tdz
 VLWJZlXVtRc+fvtU+ZYN
 =sktY
 -----END PGP SIGNATURE-----

Merge tag 'l10n-2.11.0-rnd3.1' of git://github.com/git-l10n/git-po

l10n-2.11.0-rnd3.1: update ru and ca translations

* tag 'l10n-2.11.0-rnd3.1' of git://github.com/git-l10n/git-po:
  l10n: ru.po: update Russian translation
  l10n: ca.po: update translation
2016-11-29 11:36:11 -08:00
Jeff King
6854a8f5c9 common-main: stop munging argv[0] path
Since 650c44925 (common-main: call git_extract_argv0_path(),
2016-07-01), the argv[0] that is seen in cmd_main() of
individual programs is always the basename of the
executable, as common-main strips off the full path. This
can produce confusing results for git-daemon, which wants to
re-exec itself.

For instance, if the program was originally run as
"/usr/lib/git/git-daemon", it will try just re-execing
"git-daemon", which will find the first instance in $PATH.
If git's exec-path has not been prepended to $PATH, we may
find the git-daemon from a different version (or no
git-daemon at all).

Normally this isn't a problem. Git commands are run as "git
daemon", the git wrapper puts the exec-path at the front of
$PATH, and argv[0] is already "daemon" anyway. But running
git-daemon via its full exec-path, while not really a
recommended method, did work prior to 650c44925. Let's make
it work again.

The real goal of 650c44925 was not to munge argv[0], but to
reliably set the argv0_path global. The only reason it
munges at all is that one caller, the git.c wrapper,
piggy-backed on that computation to find the command
basename.  Instead, let's leave argv[0] untouched in
common-main, and have git.c do its own basename computation.

While we're at it, let's drop the return value from
git_extract_argv0_path(). It was only ever used in this one
callsite, and its dual purposes is what led to this
confusion in the first place.

Note that by changing the interface, the compiler can
confirm for us that there are no other callers storing the
return value. But the compiler can't tell us whether any of
the cmd_main() functions (besides git.c) were relying on the
basename munging. However, we can observe that prior to
650c44925, no other cmd_main() functions did that munging,
and no new cmd_main() functions have been introduced since
then. So we can't be regressing any of those cases.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-11-29 11:01:48 -08:00
Jeff King
fa3142c919 t7610: clean up foo.XXXXXX tmpdir
The lazy prereq for MKTEMP uses "mktemp -t" to see if
mergetool's internal mktemp call will be able to run. But
unlike the call inside mergetool, we do not ever bother to
clean up the result, and the /tmp of git developers will
slowly fill up with "foo.XXXXXX" directories as they run the
test suite over and over.  Let's clean up the directory
after we've verified its creation.

Note that we don't use test_when_finished here, and instead
just make rmdir part of the &&-chain. We should only remove
something that we're confident we just created. A failure in
the middle of the chain either means there's nothing to
clean up, or we are very confused and should err on the side
of caution.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-11-29 11:00:38 -08:00
Vinicius Kursancew
b34fa5777d git-p4: allow submit to create shelved changelists.
Add a --shelve command line argument which invokes p4 shelve instead
of submitting changes. After shelving the changes are reverted from the
p4 workspace.

Signed-off-by: Vinicius Kursancew <viniciusalexandre@gmail.com>
Reviewed-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-11-29 10:59:01 -08:00
David Aguilar
2967284456 mergetools/vimdiff: trust Vim's exit code
Allow vimdiff users to signal that they do not want to use the
result of a merge by exiting with ":cquit", which tells Vim to
exit with an error code.

This is better than the current behavior because it allows users
to directly flag that the merge is bad, using a standard Vim
feature, rather than relying on a timestamp heuristic that is
unforgiving to users that save in-progress merge files.

The original behavior can be restored by configuring
mergetool.vimdiff.trustExitCode to false.

Reported-by: Dun Peal <dunpealer@gmail.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-11-29 10:57:41 -08:00
David Aguilar
7c10605d2c mergetool: honor mergetool.$tool.trustExitCode for built-in tools
Built-in merge tools contain a hard-coded assumption about
whether or not a tool's exit code can be trusted to determine
the success or failure of a merge.  Tools whose exit codes are
not trusted contain calls to check_unchanged() in their
merge_cmd() functions.

A problem with this is that the trustExitCode configuration is
not honored for built-in tools.

Teach built-in tools to honor the trustExitCode configuration.
Extend run_merge_cmd() so that it is responsible for calling
check_unchanged() when a tool's exit code cannot be trusted.
Remove check_unchanged() calls from scriptlets since they are no
longer responsible for calling it.

When no configuration is present, exit_code_trustable() is
checked to see whether the exit code should be trusted.
The default implementation returns false.

Tools whose exit codes can be trusted override
exit_code_trustable() to true.

Reported-by: Dun Peal <dunpealer@gmail.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-11-29 10:54:03 -08:00
Jiang Xin
082ed8f870 Merge branch 'russian-l10n' of https://github.com/DJm00n/git-po-ru
* 'russian-l10n' of https://github.com/DJm00n/git-po-ru:
  l10n: ru.po: update Russian translation
2016-11-29 21:19:43 +08:00
Dimitriy Ryazantcev
f8f8b45d88 l10n: ru.po: update Russian translation
Signed-off-by: Dimitriy Ryazantcev <dimitriy.ryazantcev@gmail.com>
2016-11-29 11:33:07 +02:00
Alex Henrie
43a970d78b l10n: ca.po: update translation
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
2016-11-28 20:06:25 -07:00
Marc Branchaud
aeddbfdfa4 RelNotes: spelling and phrasing fixups
Signed-off-by: Marc Branchaud <marcnarc@xiplink.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-11-28 15:58:48 -08:00
Nguyễn Thái Ngọc Duy
fa6ca11105 merge-recursive.c: use string_list_sort instead of qsort
Merge-recursive sorts a string list using a raw qsort(), where it
feeds the "items" from one struct but the "nr" and size fields from
another struct. This isn't a bug because one list is a copy of the
other, but it's unnecessarily confusing (and also caused our recent
QSORT() cleanups via coccinelle to miss this call site).

Let's use string_list_sort() instead, which is more concise and harder
to get wrong. Note that we need to adjust our comparison function,
which gets fed only the strings now, not the string_list_items. That's
OK because we don't use the "util" field as part of our sort.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-11-28 15:30:17 -08:00
Junio C Hamano
6516e54fc5 l10n-2.11.0-rnd3
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJYPKZwAAoJEMek6Rt1RHoo9zIP/jG3J1lvw0QM7L0SIrnujrY6
 vYAwF7rbekaZRe8A61uKS9M+x9nb9L+ly7GFtddMPrhHH6VXk8fMDVxgIuDBT5Ku
 EtpDfw5WD7WtsAvPSkGEkJmzVGe9gmBnN1omUC73q/bWaIjQdPotEvjv++OsWXJY
 q9C7Amlf6oDlyjHgCU0Lw0nU74SVYSCaVYX9JeymS/Rx4TxZ8oP2+gdjnwA9Cw3D
 mdpz4XVwrxDyugpfBXU1kWZE7XhHoz7OQAdbGpahj748eSHCLOg9hT42dHMpxdQO
 v6jeKzN6iBDxKHQfA/ecVB9uZciM7P6BMZNjwKzok/V+ndU9Nb/eK66Fhopgg2jL
 Mef8brpN4mYcbzVLq+vmBvA8fO59w0Z4VZe9F02aejlahtWDNf1guij2inE1EOqX
 zPyIAwKfBWxb8WG0etX1+UBEarZVe1SZfS+upWmVTciAVXMpcXBB6gG3xV7WgxYX
 fB2TOXdLWIqBUf2paRZ0uBw256AnMGHLRpn3FSGSZs+G0YBvWxunIoduxu1Goe7x
 B1qiX03J0sdQJMYMP4Ti0KU6Y1H91yqlb3WiUBl8/L34bp6nAcA1nm/4+roTBwsD
 X/6meWQbkAYT4Wzk+gmN8AFB1C8IuGm4KJBOdgB74EPipRJT1XdWJOSQvB4jG98O
 JVytsTTVUA271YOu/caJ
 =VIBl
 -----END PGP SIGNATURE-----

Merge tag 'l10n-2.11.0-rnd3' of git://github.com/git-l10n/git-po

l10n-2.11.0-rnd3

* tag 'l10n-2.11.0-rnd3' of git://github.com/git-l10n/git-po:
  l10n: de.po: translate 210 new messages
  l10n: fix unmatched single quote in error message
2016-11-28 15:28:04 -08:00
Nguyễn Thái Ngọc Duy
4df1d4d466 worktree list: keep the list sorted
It makes it easier to write tests for. But it should also be good for
the user since locating a worktree by eye would be easier once they
notice this.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-11-28 13:18:51 -08:00
Nguyễn Thái Ngọc Duy
4fff1ef7ff worktree.c: get_worktrees() takes a new flag argument
This is another no-op patch, in preparation for get_worktrees() to do
optional things, like sorting.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-11-28 13:18:51 -08:00
Nguyễn Thái Ngọc Duy
a234563a3b get_worktrees() must return main worktree as first item even on error
This is required by git-worktree.txt, stating that the main worktree is
the first line (especially in --porcelain mode when we can't just change
behavior at will).

There's only one case when get_worktrees() may skip main worktree, when
parse_ref() fails. Update the code so that we keep first item as main
worktree and return something sensible in this case:

 - In user-friendly mode, since we're not constraint by anything,
   returning "(error)" should do the job (we already show "(detached
   HEAD)" which is not machine-friendly). Actually errors should be
   printed on stderr by parse_ref() (*)

 - In plumbing mode, we do not show neither 'bare', 'detached' or
   'branch ...', which is possible by the format description if I read
   it right.

Careful readers may realize that when the local variable "head_ref" in
get_main_worktree() is emptied, add_head_info() will do nothing to
wt->head_sha1. But that's ok because head_sha1 is zero-ized in the
previous patch.

(*) Well, it does not. But it's supposed to be a stop gap implementation
    until we can reuse refs code to parse "ref: " stuff in HEAD, from
    resolve_refs_unsafe(). Now may be the time since refs refactoring is
    mostly done.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-11-28 13:18:51 -08:00
Nguyễn Thái Ngọc Duy
96f09e2a11 worktree: reorder an if statement
This is no-op. But it helps reduce diff noise in the next patch.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-11-28 13:18:51 -08:00
Johannes Schindelin
55e9f0e5c9 merge-recursive: handle NULL in add_cacheinfo() correctly
1335d76e45 ("merge: avoid "safer crlf" during recording of merge
results", 2016-07-08) tried to split make_cache_entry() call made
with CE_MATCH_REFRESH into a call to make_cache_entry() without one,
followed by a call to add_cache_entry(), refresh_cache() and another
add_cache_entry() as needed.  However the conversion was botched in
that it forgot that refresh_cache() can return NULL, which was
handled correctly in make_cache_entry() but in the updated code.

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

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-11-28 11:00:04 -08:00
Johannes Schindelin
05f2dfb965 cherry-pick: demonstrate a segmentation fault
In https://github.com/git-for-windows/git/issues/952, a complicated
scenario was described that leads to a segmentation fault in
cherry-pick.

It boils down to a certain code path involving a renamed file that is
dirty, for which `refresh_cache_entry()` returns `NULL`, and that
`NULL` not being handled properly.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-11-28 10:46:28 -08:00