Provide branch name in error message when using @{u}

When using @{u} or @{upstream} it is common to omit the branch name,
implying current branch. If the upstream is not configured, the error
message was "No upstream branch found for ''".

When resolving '@{u}', branch_get() is called, which almost always
returns a description of a branch. This allows us to use a branch name
in the error message, even if the user said something like '@{u}'.

The only case when branch_get() returns NULL is when HEAD points to so
something which is not a branch. Of course this also means that no
upstream is configured, but it is better to directly say that HEAD
does not point to a branch.

Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Provide better message for barnhc_wiht_tpyo@{u}

Instead of just saying that no upstream exists for such branch,
which is true but not very helpful, check that there's no
refs/heads/barnhc_wiht_tpyo and tell it to the user.

Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Be more specific if upstream branch is not tracked

If the branch configured as upstream didn't have a local tracking
branch, git said "Upstream branch not found". We can be more helpful,
and separate the cases when upstream is not configured, and when it is
configured, but the upstream branch is not tracked in a local branch.

The following configuration leads to the second scenario:

    [remote "origin"]
    	    url = ...
            fetch = refs/heads/master
    [branch "master"]
            remote = origin
            merge = refs/heads/master

'git pull' will work on master, but master@{upstream} is not defined.

Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
i18n: mark @{upstream} error messages for translation

Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
merge overwrites unstaged changes in renamed file

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Merge branch 'nd/stream-more'

Use API to read blob data in smaller chunks in more places to reduce the
memory footprint.

By Nguyễn Thái Ngọc Duy (6) and Junio C Hamano (1)
* nd/stream-more:
  update-server-info: respect core.bigfilethreshold
  fsck: use streaming API for writing lost-found blobs
  show: use streaming API for showing blobs
  parse_object: avoid putting whole blob in core
  cat-file: use streaming API to print blobs
  Add more large blob test cases
  streaming: make streaming-write-entry to be more reusable
Merge branch 'jc/commit-hook-authorship'

"git commit --author=$name" did not tell the name that was being recorded
in the resulting commit to hooks, even though it does do so when the end
user overrode the authorship via the "GIT_AUTHOR_NAME" environment
variable.

* jc/commit-hook-authorship:
  commit: pass author/committer info to hooks
  t7503: does pre-commit-hook learn authorship?
  ident.c: add split_ident_line() to parse formatted ident line
Merge branch 'jc/diff-algo-cleanup'

Resurrects the preparatory clean-up patches from another topic that was
discarded, as this would give a saner foundation to build on diff.algo
configuration option series.

* jc/diff-algo-cleanup:
  xdiff: PATIENCE/HISTOGRAM are not independent option bits
  xdiff: remove XDL_PATCH_* macros
Merge branch 'jn/diffstat-tests'

Some tests checked the "diff --stat" output when they do not have to,
which unnecessarily made things harder to verify under GETTEXT_POISON.

By Jonathan Nieder
* jn/diffstat-tests:
  diffstat summary line varies by locale: miscellany
  test: use numstat instead of diffstat in binary-diff test
  test: use --numstat instead of --stat in "git stash show" tests
  test: test cherry-pick functionality and output separately
  test: modernize funny-names test style
  test: use numstat instead of diffstat in funny-names test
  test: use test_i18ncmp when checking --stat output
Merge branch 'tr/maint-word-diff-regex-sticky'

The regexp configured with wordregex was incorrectly reused across files.

By Thomas Rast (2) and Johannes Sixt (1)
* tr/maint-word-diff-regex-sticky:
  diff: tweak a _copy_ of diff_options with word-diff
  diff: refactor the word-diff setup from builtin_diff_cmd
  t4034: diff.*.wordregex should not be "sticky" in --word-diff
Merge branch 'jh/notes-merge-in-git-dir-worktree'

Running "notes merge --commit" failed to perform correctly when run
from any directory inside $GIT_DIR/.  When "notes merge" stops with
conflicts, $GIT_DIR/NOTES_MERGE_WORKTREE is the place a user edits
to resolve it.

By Johan Herland (3) and Junio C Hamano (1)
* jh/notes-merge-in-git-dir-worktree:
  notes-merge: Don't remove .git/NOTES_MERGE_WORKTREE; it may be the user's cwd
  notes-merge: use opendir/readdir instead of using read_directory()
  t3310: illustrate failure to "notes merge --commit" inside $GIT_DIR/
  remove_dir_recursively(): Add flag for skipping removal of toplevel dir
Merge branch 'zj/test-cred-helper-nicer-prove'

Minor improvement to t0303.

By Zbigniew Jędrzejewski-Szmek
* zj/test-cred-helper-nicer-prove:
  t0303: resurrect commit message as test documentation
  t0303: immediately bail out w/o GIT_TEST_CREDENTIAL_HELPER
Merge branch 'da/difftool-test'

Makes sure "difftool" options can be given in any order.

By David Aguilar
* da/difftool-test:
  t7800: Test difftool passing arguments to diff
RelNotes: the first batch of topics graduated to 'master'

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Merge branch 'nl/rebase-i-cheat-sheet'

* nl/rebase-i-cheat-sheet:
  rebase -i: remind that the lines are top-to-bottom
Merge branch 'rs/unpack-trees-leakfix'

By René Scharfe
* rs/unpack-trees-leakfix:
  unpack-trees: plug minor memory leak
  unpack-trees: don't perform any index operation if we're not merging
Merge branch 'jc/maint-clean-nested-worktree-in-subdir'

"git clean -d -f" (not "-d -f -f") is supposed to protect nested working
trees of independent git repositories that exist in the current project
working tree from getting removed, but the protection applied only to such
working trees that are at the top-level of the current project by mistake.

* jc/maint-clean-nested-worktree-in-subdir:
  clean: preserve nested git worktree in subdirectories
Merge branch 'jk/diff-no-rename-empty'

Forbids rename detection logic from matching two empty files as renames
during merge-recursive to prevent mismerges.

By Jeff King
* jk/diff-no-rename-empty:
  merge-recursive: don't detect renames of empty files
  teach diffcore-rename to optionally ignore empty content
  make is_empty_blob_sha1 available everywhere
  drop casts from users EMPTY_TREE_SHA1_BIN
Merge branch 'rs/combine-diff-zero-context-at-the-beginning'

Fixes an age old corner case bug in combine diff (only triggered with -U0
and the hunk at the beginning of the file needs to be shown).

By René Scharfe
* rs/combine-diff-zero-context-at-the-beginning:
  combine-diff: fix loop index underflow
Merge branch 'jk/branch-quiet'

Even with "-q"uiet option, "checkout" used to report setting up tracking.
Also "branch" learns "-q"uiet option to squelch informational message.

By Jeff King
* jk/branch-quiet:
  teach "git branch" a --quiet option
  checkout: suppress tracking message with "-q"