Git.pm: revert _temp_cache use of temp_is_locked

When the temp_is_locked function was introduced, there was
a desire to make _temp_cache use it.  Unfortunately due to the
various tests and logic flow involved changing the _temp_cache
function to use the new temp_is_locked function is problematic
as _temp_cache needs a slightly different test than is provided
by the temp_is_locked function.

This change reverts use of temp_is_locked in the _temp_cache
function and restores the original code that existed there
before the temp_is_locked function was added.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Add the LAST_ARG_MUST_BE_NULL macro

The sentinel function attribute is not understood by versions of
the gcc compiler prior to v4.0. At present, for earlier versions
of gcc, the build issues 108 warnings related to the unknown
attribute. In order to suppress the warnings, we conditionally
define the LAST_ARG_MUST_BE_NULL macro to provide the sentinel attribute
for gcc v4.0 and newer.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git add -e: Explicitly specify that patch should have no color

After 4c7f1819 (make color.ui default to 'auto', 2013-06-10), the
patch file to be edited during 'git add -e' receives all the color
codes.  This is because diffopt.use_color defaults to -1, which
causes want_color to now return 'auto'.

By explicitly setting use_color to 0, we can ensure the diff output
has no color codes in it.

Signed-off-by: Andrew Wong <andrew.kw.w@gmail.com>
Acked-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
pull: require choice between rebase/merge on non-fast-forward pull

Because it is so easy to let Git handle automatically a trivial
merge with "git pull", a person who is new to Git may not realize
that the project s/he is interacting with may prefer a "rebase"
workflow.

Add a safety valve to fail "git pull" that does not explicitly
specify what branch from which repository to integrate your history
with, when it is neither a fast-forward or "already up-to-date",
until/unless the user expressed her preference between the two ways
of integration.

This can be an irritating backward incompatible change for old
timers, but it can be a one time irritation by doing:

    git config --global pull.rebase false

once to say "I will always --merge", and they'd not even notice.

    http://thread.gmane.org/gmane.comp.version-control.git/225146/focus=225326

for a full discussion.

Helped-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff: deprecate -q option to diff-files

This reimplements the ancient "-q" option to "git diff-files" that
was inherited from "show-diff -q" in terms of "--diff-filter=d".  We
will be deprecating the "-q" option, so let's issue a warning when
we do so.

Incidentally this also tentatively fixes "git diff --no-index" to
honor "-q" and hide deletions; the use will get the same warning.

We should remove the support for "-q" in a future version but it is
not that urgent.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff: remove "diff-files -q" in a version of Git in a distant future

This was inherited from "show-diff -q" that was invented to tell
comparison between the index and the working tree to ignore only
removals in 2005.

These days, it is spelled as "--diff-filter=d".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
t2202: make sure "git add" (no args) stays a no-op

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Merge branch 'jc/simple-add-must-be-a-no-op' into jch

* jc/simple-add-must-be-a-no-op:
  t2202: make sure "git add" (no args) stays a no-op
Merge branch 'mm/color-auto-default' into jch

A finishing touch to fix breakage to "add -e" caused by defaulting
ui.color to "auto".

* mm/color-auto-default:
  git add -e: Explicitly specify that patch should have no color
Merge branch 'jc/name-rev-exact-ref' into jch

Corrects the longstanding sloppiness in the implementation of
name-rev that conflated "we take commit-ish" and "differences
between tags and commits do not matter".

* jc/name-rev-exact-ref:
  describe: fix --contains when a tag is given as input
  name-rev: differentiate between tags and commits they point at
  describe: use argv-array
  name-rev: allow converting the exact object name at the tip of a ref
  name-ref: factor out name shortening logic from name_ref()
Merge branch 'tr/fd-gotcha-fixes' into jch

Two places we did not check return value (expected to be a file
descriptor) correctly.

* tr/fd-gotcha-fixes:
  run-command: dup_devnull(): guard against syscalls failing
  git_mkstemps: correctly test return value of open()
Merge branch 'jc/mailmap-case-insensitivity' into jch

The mailmap mechanism unnecessarily downcased the e-mail addresses
in the output, and also ignored the human name when it is a single
character name.

This now has become Eric Sunshine's series, even though it still is
under jc/ hierarchy.

* jc/mailmap-case-insensitivity:
  mailmap: style fixes
  mailmap: debug: avoid passing NULL to fprintf() '%s' conversion specification
  mailmap: debug: eliminate -Wformat field precision type warning
  mailmap: debug: fix malformed fprintf() format conversion specification
  mailmap: debug: fix out-of-order fprintf() arguments
  mailmap: do not downcase mailmap entries
  t4203: demonstrate loss of uppercase characters in canonical email
  mailmap: do not lose single-letter names
  t4203: demonstrate loss of single-character name in mailmap entry
Merge branch 'dw/request-pull-diag' into jch

* dw/request-pull-diag:
  request-pull: improve error message for invalid revision args
Merge branch 'mm/diff-no-patch-synonym-to-s' into jch

"git show -s" was less discoverable than it should be.

* mm/diff-no-patch-synonym-to-s:
  Documentation/git-log.txt: capitalize section names
  Documentation: move description of -s, --no-patch to diff-options.txt
  Documentation/git-show.txt: include common diff options, like git-log.txt
  diff: allow --patch & cie to override -s/--no-patch
  diff: allow --no-patch as synonym for -s
  t4000-diff-format.sh: modernize style
Merge branch 'tr/do-not-call-submodules-subprojects' into jch

* tr/do-not-call-submodules-subprojects:
  show-branch: fix description of --date-order
  apply, entry: speak of submodules instead of subprojects

# Conflicts:
# 	builtin/show-branch.c
Merge branch 'sb/parse-object-buffer-eaten' into jch

* sb/parse-object-buffer-eaten:
  parse_object_buffer: correct freeing the buffer
Merge branch 'tr/protect-low-3-fds' into jch

When "git" is spawned in such a way that any of the low 3 file
descriptors is closed, our first open() may yield file descriptor 2,
and writing error message to it would screw things up in a big way.

* tr/protect-low-3-fds:
  git: ensure 0/1/2 are open in main()
  daemon/shell: refactor redirection of 0/1/2 from /dev/null
Merge branch 'jx/clean-interactive' into jch

Add "interactive" mode to "git clean".

The early part to refactor relative path related helper functions
looked sensible.

* jx/clean-interactive:
  test: run testcases with POSIX absolute paths on Windows
  test: add t7301 for git-clean--interactive
  git-clean: add documentation for interactive git-clean
  git-clean: add ask each interactive action
  git-clean: add select by numbers interactive action
  git-clean: add filter by pattern interactive action
  git-clean: use a git-add-interactive compatible UI
  git-clean: add colors to interactive git-clean
  git-clean: show items of del_list in columns
  git-clean: add support for -i/--interactive
  git-clean: refactor git-clean into two phases
  write_name{_quoted_relative,}(): remove redundant parameters
  quote_path_relative(): remove redundant parameter
  quote.c: substitute path_relative with relative_path
  path.c: refactor relative_path(), not only strip prefix
  test: add test cases for relative_path
Merge branch 'es/blame-L-breakage' into jch

The refactoring made for parsing "-L" option recently to support
"git log -L" seems to have broken "git blame -L X,-5" to show 5
lines leading to X.

* es/blame-L-breakage:
  blame-options.txt: explain that -L <start> and <end> are optional
  blame-options.txt: place each -L option variation on its own line
  t8001/t8002 (blame): add blame -L :funcname tests
  t8001/t8002 (blame): add blame -L tests
  t8001/t8002 (blame): modernize style
  line-range: fix "blame -L X,-N" regression
Merge branch 'db/show-ref-head' into jch

The "--head" option to "git show-ref" was only to add "HEAD" to the
list of candidate refs to be filtered by the usual rules
(e.g. "--heads" that only show refs under refs/heads).  Change the
meaning of the option to always show "HEAD" regardless of what
filtering will be applied to any other ref (this is a backward
incompatible change, so I may need to add an entry to the Release
Notes).

* db/show-ref-head:
  show-ref: make --head always show the HEAD ref