OSDN Git Service

git-core/git.git
8 years agoGit 2.4.8 v2.4.8
Junio C Hamano [Mon, 3 Aug 2015 17:40:37 +0000 (10:40 -0700)]
Git 2.4.8

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoMerge branch 'js/rebase-i-clean-up-upon-continue-to-skip' into maint
Junio C Hamano [Mon, 3 Aug 2015 17:41:34 +0000 (10:41 -0700)]
Merge branch 'js/rebase-i-clean-up-upon-continue-to-skip' into maint

Abandoning an already applied change in "git rebase -i" with
"--continue" left CHERRY_PICK_HEAD and confused later steps.

* js/rebase-i-clean-up-upon-continue-to-skip:
  rebase -i: do not leave a CHERRY_PICK_HEAD file behind
  t3404: demonstrate CHERRY_PICK_HEAD bug

8 years agoMerge branch 'ss/clone-guess-dir-name-simplify' into maint
Junio C Hamano [Mon, 3 Aug 2015 17:41:33 +0000 (10:41 -0700)]
Merge branch 'ss/clone-guess-dir-name-simplify' into maint

Code simplification.

* ss/clone-guess-dir-name-simplify:
  clone: simplify string handling in guess_dir_name()

8 years agoMerge branch 'sg/completion-commit-cleanup' into maint
Junio C Hamano [Mon, 3 Aug 2015 17:41:33 +0000 (10:41 -0700)]
Merge branch 'sg/completion-commit-cleanup' into maint

* sg/completion-commit-cleanup:
  completion: teach 'scissors' mode to 'git commit --cleanup='

8 years agoMerge branch 'pt/am-abort-fix' into maint
Junio C Hamano [Mon, 3 Aug 2015 17:41:32 +0000 (10:41 -0700)]
Merge branch 'pt/am-abort-fix' into maint

Various fixes around "git am" that applies a patch to a history
that is not there yet.

* pt/am-abort-fix:
  am --abort: keep unrelated commits on unborn branch
  am --abort: support aborting to unborn branch
  am --abort: revert changes introduced by failed 3way merge
  am --skip: support skipping while on unborn branch
  am -3: support 3way merge on unborn branch
  am --skip: revert changes introduced by failed 3way merge

8 years agoMerge branch 'mh/reporting-broken-refs-from-for-each-ref' into maint
Junio C Hamano [Mon, 3 Aug 2015 17:41:31 +0000 (10:41 -0700)]
Merge branch 'mh/reporting-broken-refs-from-for-each-ref' into maint

"git for-each-ref" reported "missing object" for 0{40} when it
encounters a broken ref.  The lack of object whose name is 0{40} is
not the problem; the ref being broken is.

* mh/reporting-broken-refs-from-for-each-ref:
  read_loose_refs(): treat NULL_SHA1 loose references as broken
  read_loose_refs(): simplify function logic
  for-each-ref: report broken references correctly
  t6301: new tests of for-each-ref error handling

8 years agoMerge branch 'sg/commit-cleanup-scissors' into maint
Junio C Hamano [Mon, 3 Aug 2015 17:41:30 +0000 (10:41 -0700)]
Merge branch 'sg/commit-cleanup-scissors' into maint

"git commit --cleanup=scissors" was not careful enough to protect
against getting fooled by a line that looked like scissors.

* sg/commit-cleanup-scissors:
  commit: cope with scissors lines in commit message

8 years agoGit 2.4.7 v2.4.7
Junio C Hamano [Mon, 27 Jul 2015 19:25:42 +0000 (12:25 -0700)]
Git 2.4.7

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoMerge branch 'jk/pretty-encoding-doc' into maint
Junio C Hamano [Mon, 27 Jul 2015 19:21:48 +0000 (12:21 -0700)]
Merge branch 'jk/pretty-encoding-doc' into maint

Doc update.

* jk/pretty-encoding-doc:
  docs: clarify that --encoding can produce invalid sequences

8 years agoMerge branch 'tb/checkout-doc' into maint
Junio C Hamano [Mon, 27 Jul 2015 19:21:47 +0000 (12:21 -0700)]
Merge branch 'tb/checkout-doc' into maint

Doc update.

* tb/checkout-doc:
  git-checkout.txt: document "git checkout <pathspec>" better

8 years agoMerge branch 'ls/hint-rev-list-count' into maint
Junio C Hamano [Mon, 27 Jul 2015 19:21:47 +0000 (12:21 -0700)]
Merge branch 'ls/hint-rev-list-count' into maint

* ls/hint-rev-list-count:
  rev-list: add --count to usage guide

8 years agoMerge branch 'mm/branch-doc-updates' into maint
Junio C Hamano [Mon, 27 Jul 2015 19:21:46 +0000 (12:21 -0700)]
Merge branch 'mm/branch-doc-updates' into maint

* mm/branch-doc-updates:
  Documentation/branch: document -M and -D in terms of --force
  Documentation/branch: document -d --force and -m --force

8 years agoMerge branch 'jc/fsck-retire-require-eoh' into maint
Junio C Hamano [Mon, 27 Jul 2015 19:21:45 +0000 (12:21 -0700)]
Merge branch 'jc/fsck-retire-require-eoh' into maint

A fix to a minor regression to "git fsck" in v2.2 era that started
complaining about a body-less tag object when it lacks a separator
empty line after its header to separate it with a non-existent body.

* jc/fsck-retire-require-eoh:
  fsck: it is OK for a tag and a commit to lack the body

8 years agoMerge branch 'et/http-proxyauth' into maint
Junio C Hamano [Mon, 27 Jul 2015 19:21:44 +0000 (12:21 -0700)]
Merge branch 'et/http-proxyauth' into maint

We used to ask libCURL to use the most secure authentication method
available when talking to an HTTP proxy only when we were told to
talk to one via configuration variables.  We now ask libCURL to
always use the most secure authentication method, because the user
can tell libCURL to use an HTTP proxy via an environment variable
without using configuration variables.

* et/http-proxyauth:
  http: always use any proxy auth method available

8 years agoMerge branch 'jc/unexport-git-pager-in-use-in-pager' into maint
Junio C Hamano [Mon, 27 Jul 2015 19:21:43 +0000 (12:21 -0700)]
Merge branch 'jc/unexport-git-pager-in-use-in-pager' into maint

When you say "!<ENTER>" while running say "git log", you'd confuse
yourself in the resulting shell, that may look as if you took
control back to the original shell you spawned "git log" from but
that isn't what is happening.  To that new shell, we leaked
GIT_PAGER_IN_USE environment variable that was meant as a local
communication between the original "Git" and subprocesses that was
spawned by it after we launched the pager, which caused many
"interesting" things to happen, e.g. "git diff | cat" still paints
its output in color by default.

Stop leaking that environment variable to the pager's half of the
fork; we only need it on "Git" side when we spawn the pager.

* jc/unexport-git-pager-in-use-in-pager:
  pager: do not leak "GIT_PAGER_IN_USE" to the pager

8 years agoMerge branch 'mh/strbuf-read-file-returns-ssize-t' into maint
Junio C Hamano [Mon, 27 Jul 2015 19:21:43 +0000 (12:21 -0700)]
Merge branch 'mh/strbuf-read-file-returns-ssize-t' into maint

Avoid possible ssize_t to int truncation.

* mh/strbuf-read-file-returns-ssize-t:
  strbuf: strbuf_read_file() should return ssize_t

8 years agoMerge branch 'kb/config-unmap-before-renaming' into maint
Junio C Hamano [Mon, 27 Jul 2015 19:21:42 +0000 (12:21 -0700)]
Merge branch 'kb/config-unmap-before-renaming' into maint

"git config" failed to update the configuration file when the
underlying filesystem is incapable of renaming a file that is still
open.

* kb/config-unmap-before-renaming:
  config.c: fix writing config files on Windows network shares

8 years agoMerge branch 'jk/rev-list-no-bitmap-while-pruning' into maint
Junio C Hamano [Mon, 27 Jul 2015 19:21:42 +0000 (12:21 -0700)]
Merge branch 'jk/rev-list-no-bitmap-while-pruning' into maint

A minor bugfix when pack bitmap is used with "rev-list --count".

* jk/rev-list-no-bitmap-while-pruning:
  rev-list: disable --use-bitmap-index when pruning commits

8 years agoMerge branch 'rh/test-color-avoid-terminfo-in-original-home' into maint
Junio C Hamano [Mon, 27 Jul 2015 19:21:41 +0000 (12:21 -0700)]
Merge branch 'rh/test-color-avoid-terminfo-in-original-home' into maint

An ancient test framework enhancement to allow color was not
entirely correct; this makes it work even when tput needs to read
from the ~/.terminfo under the user's real HOME directory.

* rh/test-color-avoid-terminfo-in-original-home:
  test-lib.sh: fix color support when tput needs ~/.terminfo
  Revert "test-lib.sh: do tests for color support after changing HOME"

8 years agoMerge branch 'jk/fix-refresh-utime' into maint
Junio C Hamano [Mon, 27 Jul 2015 19:21:40 +0000 (12:21 -0700)]
Merge branch 'jk/fix-refresh-utime' into maint

Fix a small bug in our use of umask() return value.

* jk/fix-refresh-utime:
  check_and_freshen_file: fix reversed success-check

8 years agoMerge branch 'cb/rebase-am-exit-code' into maint
Junio C Hamano [Mon, 27 Jul 2015 19:21:39 +0000 (12:21 -0700)]
Merge branch 'cb/rebase-am-exit-code' into maint

"git rebase" did not exit with failure when format-patch it invoked
failed for whatever reason.

* cb/rebase-am-exit-code:
  rebase: return non-zero error code if format-patch fails

8 years agoMerge branch 'jk/index-pack-reduce-recheck' into maint
Junio C Hamano [Mon, 27 Jul 2015 19:21:38 +0000 (12:21 -0700)]
Merge branch 'jk/index-pack-reduce-recheck' into maint

Disable "have we lost a race with competing repack?" check while
receiving a huge object transfer that runs index-pack.

* jk/index-pack-reduce-recheck:
  index-pack: avoid excessive re-reading of pack directory

8 years agoGit 2.4.6 v2.4.6
Junio C Hamano [Wed, 15 Jul 2015 18:45:42 +0000 (11:45 -0700)]
Git 2.4.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoMerge branch 'mm/describe-doc' into maint
Junio C Hamano [Wed, 15 Jul 2015 18:41:26 +0000 (11:41 -0700)]
Merge branch 'mm/describe-doc' into maint

Docfix.

* mm/describe-doc:
  Documentation/describe: improve one-line summary

8 years agoMerge branch 'jc/prompt-document-ps1-state-separator' into maint
Junio C Hamano [Wed, 15 Jul 2015 18:41:26 +0000 (11:41 -0700)]
Merge branch 'jc/prompt-document-ps1-state-separator' into maint

Docfix.

* jc/prompt-document-ps1-state-separator:
  git-prompt.sh: document GIT_PS1_STATESEPARATOR

8 years agoMerge branch 'es/osx-header-pollutes-mask-macro' into maint
Junio C Hamano [Wed, 15 Jul 2015 18:41:24 +0000 (11:41 -0700)]
Merge branch 'es/osx-header-pollutes-mask-macro' into maint

* es/osx-header-pollutes-mask-macro:
  ewah: use less generic macro name
  ewah/bitmap: silence warning about MASK macro redefinition

8 years agoMerge branch 'es/utf8-stupid-compiler-workaround' into maint
Junio C Hamano [Wed, 15 Jul 2015 18:41:23 +0000 (11:41 -0700)]
Merge branch 'es/utf8-stupid-compiler-workaround' into maint

A compilation workaround.

* es/utf8-stupid-compiler-workaround:
  utf8: NO_ICONV: silence uninitialized variable warning

8 years agoMerge branch 'fk/doc-format-patch-vn' into maint
Junio C Hamano [Wed, 15 Jul 2015 18:41:22 +0000 (11:41 -0700)]
Merge branch 'fk/doc-format-patch-vn' into maint

Docfix.

* fk/doc-format-patch-vn:
  doc: format-patch: fix typo

8 years agoMerge branch 'pt/t0302-needs-sanity' into maint
Junio C Hamano [Wed, 15 Jul 2015 18:41:21 +0000 (11:41 -0700)]
Merge branch 'pt/t0302-needs-sanity' into maint

* pt/t0302-needs-sanity:
  t0302: "unreadable" test needs SANITY prereq

8 years agoMerge branch 'me/fetch-into-shallow-safety' into maint
Junio C Hamano [Wed, 15 Jul 2015 18:41:20 +0000 (11:41 -0700)]
Merge branch 'me/fetch-into-shallow-safety' into maint

"git fetch --depth=<depth>" and "git clone --depth=<depth>" issued
a shallow transfer request even to an upload-pack that does not
support the capability.

* me/fetch-into-shallow-safety:
  fetch-pack: check for shallow if depth given

8 years agoMerge branch 'mh/fsck-reflog-entries' into maint
Junio C Hamano [Wed, 15 Jul 2015 18:41:19 +0000 (11:41 -0700)]
Merge branch 'mh/fsck-reflog-entries' into maint

"git fsck" used to ignore missing or invalid objects recorded in reflog.

* mh/fsck-reflog-entries:
  fsck: report errors if reflog entries point at invalid objects
  fsck_handle_reflog_sha1(): new function

8 years agoMerge branch 'af/tcsh-completion-noclobber' into maint
Junio C Hamano [Wed, 15 Jul 2015 18:41:18 +0000 (11:41 -0700)]
Merge branch 'af/tcsh-completion-noclobber' into maint

The tcsh completion writes a bash scriptlet but that would have
failed for users with noclobber set.

* af/tcsh-completion-noclobber:
  git-completion.tcsh: fix redirect with noclobber

8 years agoMerge branch 'pa/auto-gc-mac-osx' into maint
Junio C Hamano [Wed, 15 Jul 2015 18:41:17 +0000 (11:41 -0700)]
Merge branch 'pa/auto-gc-mac-osx' into maint

Recent Mac OS X updates breaks the logic to detect that the machine
is on the AC power in the sample pre-auto-gc script.

* pa/auto-gc-mac-osx:
  hooks/pre-auto-gc: adjust power checking for newer OS X

8 years agoMerge branch 'jc/do-not-feed-tags-to-clear-commit-marks' into maint
Junio C Hamano [Wed, 15 Jul 2015 18:41:16 +0000 (11:41 -0700)]
Merge branch 'jc/do-not-feed-tags-to-clear-commit-marks' into maint

"git format-patch --ignore-if-upstream A..B" did not like to be fed
tags as boundary commits.

* jc/do-not-feed-tags-to-clear-commit-marks:
  format-patch: do not feed tags to clear_commit_marks()

8 years agoclone: simplify string handling in guess_dir_name()
Sebastian Schuberth [Thu, 9 Jul 2015 18:24:08 +0000 (18:24 +0000)]
clone: simplify string handling in guess_dir_name()

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agocheck_and_freshen_file: fix reversed success-check
Jeff King [Wed, 8 Jul 2015 20:33:52 +0000 (16:33 -0400)]
check_and_freshen_file: fix reversed success-check

When we want to write out a loose object file, we have
always first made sure we don't already have the object
somewhere. Since 33d4221 (write_sha1_file: freshen existing
objects, 2014-10-15), we also update the timestamp on the
file, so that a simultaneous prune knows somebody is
likely to reference it soon.

If our utime() call fails, we treat this the same as not
having the object in the first place; the safe thing to do
is write out another copy. However, the loose-object check
accidentally inverts the utime() check; it returns failure
_only_ when the utime() call actually succeeded. Thus it was
failing to protect us there, and in the normal case where
utime() succeeds, it caused us to pointlessly write out and
link the object.

This passed our freshening tests, because writing out the
new object is certainly _one_ way of updating its utime. So
the normal case was inefficient, but not wrong.

While we're here, let's also drop a comment in front of the
check_and_freshen functions, making a note of their return
type (since it is not our usual "0 for success, -1 for
error").

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agorebase: return non-zero error code if format-patch fails
Clemens Buchacher [Thu, 2 Jul 2015 09:11:33 +0000 (11:11 +0200)]
rebase: return non-zero error code if format-patch fails

Since e481af06 (rebase: Handle cases where format-patch fails) we
notice if format-patch fails and return immediately from
git-rebase--am. We save the return value with ret=$?, but then we
return $?, which is usually zero in this case.

Fix this by returning $ret instead.

Cc: Andrew Wong <andrew.kw.w@gmail.com>
Signed-off-by: Clemens Buchacher <clemens.buchacher@intel.com>
Helped-by: Jorge Nunes <jorge.nunes@intel.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoDocumentation/branch: document -M and -D in terms of --force
Matthieu Moy [Thu, 2 Jul 2015 14:07:21 +0000 (16:07 +0200)]
Documentation/branch: document -M and -D in terms of --force

Now that we have proper documentation for --force's interaction with -d
and -m, we can avoid duplication and consider -M and -D as convenience
aliases for -m --force and -d --force.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoDocumentation/branch: document -d --force and -m --force
Matthieu Moy [Thu, 2 Jul 2015 14:07:20 +0000 (16:07 +0200)]
Documentation/branch: document -d --force and -m --force

The --force option was modified in 356e91f (branch: allow -f with -m and
-d, 2014-12-08), but the documentation was not updated.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agostrbuf: strbuf_read_file() should return ssize_t
Michael Haggerty [Fri, 3 Jul 2015 13:59:32 +0000 (15:59 +0200)]
strbuf: strbuf_read_file() should return ssize_t

It is currently declared to return int, which could overflow for
large files.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agopager: do not leak "GIT_PAGER_IN_USE" to the pager
Junio C Hamano [Fri, 3 Jul 2015 17:18:45 +0000 (10:18 -0700)]
pager: do not leak "GIT_PAGER_IN_USE" to the pager

Since 2e6c012e (setup_pager: set GIT_PAGER_IN_USE, 2011-08-17), we
export GIT_PAGER_IN_USE so that a process that becomes the upstream
of the spawned pager can still tell that we have spawned the pager
and decide to do colored output even when its output no longer goes
to a terminal (i.e. isatty(1)).

But we forgot to clear it from the enviornment of the spawned pager.

This is not a problem in a sane world, but if you have a handful of
thousands Git users in your organization, somebody is bound to do
strange things, e.g. typing "!<ENTER>" instead of 'q' to get control
back from $LESS.  GIT_PAGER_IN_USE is still set in that subshell
spawned by "less", and all sorts of interesting things starts
happening, e.g. "git diff | cat" starts coloring its output.

We can clear the environment variable in the half of the fork that
runs the pager to avoid the confusion.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agorev-list: disable --use-bitmap-index when pruning commits
Jeff King [Wed, 1 Jul 2015 18:42:17 +0000 (14:42 -0400)]
rev-list: disable --use-bitmap-index when pruning commits

The reachability bitmaps do not have enough information to
tell us which commits might have changed path "foo", so the
current code produces wrong answers for:

  git rev-list --use-bitmap-index --count HEAD -- foo

(it silently ignores the "foo" limiter). Instead, we should
fall back to doing a normal traversal (it is OK to fall
back rather than complain, because --use-bitmap-index is a
pure optimization, and might not kick in for other reasons,
such as there being no bitmaps in the repository).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agorev-list: add --count to usage guide
Lawrence Siebert [Wed, 1 Jul 2015 09:24:11 +0000 (02:24 -0700)]
rev-list: add --count to usage guide

--count should be mentioned in the usage guide, this updates code and
documentation.

Signed-off-by: Lawrence Siebert <lawrencesiebert@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoconfig.c: fix writing config files on Windows network shares
Karsten Blees [Tue, 30 Jun 2015 14:34:13 +0000 (16:34 +0200)]
config.c: fix writing config files on Windows network shares

Renaming to an existing file doesn't work on Windows network shares if the
target file is open.

munmap() the old config file before commit_lock_file.

Signed-off-by: Karsten Blees <blees@dcon.de>
Acked-by: Jeff King <peff@peff.net>
Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agorebase -i: do not leave a CHERRY_PICK_HEAD file behind
Johannes Schindelin [Thu, 18 Jun 2015 16:38:53 +0000 (18:38 +0200)]
rebase -i: do not leave a CHERRY_PICK_HEAD file behind

When skipping commits whose changes were already applied via `git rebase
--continue`, we need to clean up said file explicitly.

The same is not true for `git rebase --skip` because that will execute
`git reset --hard` as part of the "skip" handling in git-rebase.sh, even
before git-rebase--interactive.sh is called.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agot3404: demonstrate CHERRY_PICK_HEAD bug
Johannes Schindelin [Thu, 18 Jun 2015 16:38:44 +0000 (18:38 +0200)]
t3404: demonstrate CHERRY_PICK_HEAD bug

When rev-list's --cherry option does not detect that a patch has already
been applied upstream, an interactive rebase would offer to reapply it and
consequently stop at that patch with a failure, mentioning that the diff
is empty.

Traditionally, a `git rebase --continue` simply skips the commit in such a
situation.

However, as pointed out by Gábor Szeder, this leaves a CHERRY_PICK_HEAD
behind, making the Git prompt believe that a cherry pick is still going
on. This commit adds a test case demonstrating this bug.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agohttp: always use any proxy auth method available
Enrique Tobis [Fri, 26 Jun 2015 18:19:04 +0000 (18:19 +0000)]
http: always use any proxy auth method available

We set CURLOPT_PROXYAUTH to use the most secure authentication
method available only when the user has set configuration variables
to specify a proxy.  However, libcurl also supports specifying a
proxy through environment variables.  In that case libcurl defaults
to only using the Basic proxy authentication method, because we do
not use CURLOPT_PROXYAUTH.

Set CURLOPT_PROXYAUTH to always use the most secure authentication
method available, even when there is no git configuration telling us
to use a proxy. This allows the user to use environment variables to
configure a proxy that requires an authentication method different
from Basic.

Signed-off-by: Enrique A. Tobis <etobis@twosigma.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agofsck: it is OK for a tag and a commit to lack the body
Junio C Hamano [Sun, 28 Jun 2015 18:18:31 +0000 (11:18 -0700)]
fsck: it is OK for a tag and a commit to lack the body

When fsck validates a commit or a tag, it scans each line in the
header of the object using helper functions such as "start_with()",
etc. that work on a NUL terminated buffer, but before a1e920a0
(index-pack: terminate object buffers with NUL, 2014-12-08), the
validation functions were fed the object data in a piece of memory
that is not necessarily terminated with a NUL.

We added a helper function require_end_of_header() to be called at
the beginning of these validation functions to insist that the
object data contains an empty line before its end.  The theory is
that the validating functions will notice and stop when it hits an
empty line as a normal end of header (or a required header line that
is missing) without scanning past the end of potentially not
NUL-terminated buffer.

But the theory forgot that in the older days, Git itself happily
created objects with only the header lines without a body. This
caused Git 2.2 and later to issue an unnecessary warning in some
existing repositories.

With a1e920a0, we do not need to require an empty line (or the body)
in these objects to safely parse and validate them.  Drop the
offending "must have an empty line" check from this helper function,
while keeping the other check to make sure that there is no NUL in
the header part of the object, and adjust the name of the helper to
what it does accordingly.

Noticed-by: Wolfgang Denk <wd@denx.de>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoMerge branch 'jk/stash-require-clean-index' into maint
Junio C Hamano [Fri, 26 Jun 2015 06:03:26 +0000 (23:03 -0700)]
Merge branch 'jk/stash-require-clean-index' into maint

A hotfix for the topic already in 'master'.

* jk/stash-require-clean-index:
  Revert "stash: require a clean index to apply"

8 years agoMerge branch 'cb/array-size' into maint
Junio C Hamano [Fri, 26 Jun 2015 06:03:25 +0000 (23:03 -0700)]
Merge branch 'cb/array-size' into maint

* cb/array-size:
  Fix definition of ARRAY_SIZE for non-gcc builds

8 years agoGit 2.4.5 v2.4.5
Junio C Hamano [Thu, 25 Jun 2015 18:03:05 +0000 (11:03 -0700)]
Git 2.4.5

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoMerge branch 'sg/merge-summary-config' into maint
Junio C Hamano [Thu, 25 Jun 2015 18:02:16 +0000 (11:02 -0700)]
Merge branch 'sg/merge-summary-config' into maint

Doc updates.

* sg/merge-summary-config:
  Documentation: include 'merge.branchdesc' for merge and config as well

8 years agoMerge branch 'jk/make-fix-dependencies' into maint
Junio C Hamano [Thu, 25 Jun 2015 18:02:15 +0000 (11:02 -0700)]
Merge branch 'jk/make-fix-dependencies' into maint

Build clean-up.

* jk/make-fix-dependencies:
  Makefile: silence perl/PM.stamp recipe
  Makefile: avoid timestamp updates to GIT-BUILD-OPTIONS
  Makefile: drop dependency between git-instaweb and gitweb

8 years agoMerge branch 'sb/pack-protocol-mention-smart-http' into maint
Junio C Hamano [Thu, 25 Jun 2015 18:02:14 +0000 (11:02 -0700)]
Merge branch 'sb/pack-protocol-mention-smart-http' into maint

Doc updates.

* sb/pack-protocol-mention-smart-http:
  Documentation/technical/pack-protocol: mention http as possible protocol

8 years agoMerge branch 'jk/die-on-bogus-worktree-late' into maint
Junio C Hamano [Thu, 25 Jun 2015 18:02:13 +0000 (11:02 -0700)]
Merge branch 'jk/die-on-bogus-worktree-late' into maint

The setup code used to die when core.bare and core.worktree are set
inconsistently, even for commands that do not need working tree.

* jk/die-on-bogus-worktree-late:
  setup_git_directory: delay core.bare/core.worktree errors

8 years agoMerge branch 'pt/pull-tags-error-diag' into maint
Junio C Hamano [Thu, 25 Jun 2015 18:02:12 +0000 (11:02 -0700)]
Merge branch 'pt/pull-tags-error-diag' into maint

There was a dead code that used to handle "git pull --tags" and
show special-cased error message, which was made irrelevant when
the semantics of the option changed back in Git 1.9 days.

* pt/pull-tags-error-diag:
  pull: remove --tags error in no merge candidates case

8 years agoMerge branch 'jk/color-diff-plain-is-context' into maint
Junio C Hamano [Thu, 25 Jun 2015 18:02:11 +0000 (11:02 -0700)]
Merge branch 'jk/color-diff-plain-is-context' into maint

"color.diff.plain" was a misnomer; give it 'color.diff.context' as
a more logical synonym.

* jk/color-diff-plain-is-context:
  diff.h: rename DIFF_PLAIN color slot to DIFF_CONTEXT
  diff: accept color.diff.context as a synonym for "plain"

8 years agoMerge branch 'jk/diagnose-config-mmap-failure' into maint
Junio C Hamano [Thu, 25 Jun 2015 18:02:10 +0000 (11:02 -0700)]
Merge branch 'jk/diagnose-config-mmap-failure' into maint

The configuration reader/writer uses mmap(2) interface to access
the files; when we find a directory, it barfed with "Out of memory?".

* jk/diagnose-config-mmap-failure:
  xmmap(): drop "Out of memory?"
  config.c: rewrite ENODEV into EISDIR when mmap fails
  config.c: avoid xmmap error messages
  config.c: fix mmap leak when writing config
  read-cache.c: drop PROT_WRITE from mmap of index

8 years agoMerge branch 'jk/squelch-missing-link-warning-for-unreachable' into maint
Junio C Hamano [Thu, 25 Jun 2015 18:02:09 +0000 (11:02 -0700)]
Merge branch 'jk/squelch-missing-link-warning-for-unreachable' into maint

Recent "git prune" traverses young unreachable objects to safekeep
old objects in the reachability chain from them, which sometimes
caused error messages that are unnecessarily alarming.

* jk/squelch-missing-link-warning-for-unreachable:
  suppress errors on missing UNINTERESTING links
  silence broken link warnings with revs->ignore_missing_links
  add quieter versions of parse_{tree,commit}

8 years agoMerge branch 'mm/rebase-i-post-rewrite-exec' into maint
Junio C Hamano [Thu, 25 Jun 2015 18:02:09 +0000 (11:02 -0700)]
Merge branch 'mm/rebase-i-post-rewrite-exec' into maint

"git rebase -i" fired post-rewrite hook when it shouldn't (namely,
when it was told to stop sequencing with 'exec' insn).

* mm/rebase-i-post-rewrite-exec:
  t5407: use <<- to align the expected output
  rebase -i: fix post-rewrite hook with failed exec command
  rebase -i: demonstrate incorrect behavior of post-rewrite

8 years agoFix definition of ARRAY_SIZE for non-gcc builds
Charles Bailey [Wed, 24 Jun 2015 22:12:07 +0000 (23:12 +0100)]
Fix definition of ARRAY_SIZE for non-gcc builds

The improved ARRAY_SIZE macro uses BARF_UNLESS_AN_ARRAY which expands
to a valid check for recent gcc versions and to 0 for older gcc
versions but is not defined on non-gcc builds.

Non-gcc builds need this macro to expand to 0 as well. The current outer
test (defined(__GNUC__) && (__GNUC__ >= 3)) is a strictly weaker
condition than the inner test (GIT_GNUC_PREREQ(3, 1)) so we can omit the
outer test and cause the BARF_UNLESS_AN_ARRAY macro to be defined
correctly on non-gcc builds as well as gcc builds with older versions.

Signed-off-by: Charles Bailey <cbailey32@bloomberg.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agotest-lib.sh: fix color support when tput needs ~/.terminfo
Richard Hansen [Wed, 17 Jun 2015 21:11:21 +0000 (17:11 -0400)]
test-lib.sh: fix color support when tput needs ~/.terminfo

If tput needs ~/.terminfo for the current $TERM, then tput will
succeed before HOME is changed to $TRASH_DIRECTORY (causing color to
be set to 't') but fail afterward.

One possible way to fix this is to treat HOME like TERM: back up the
original value and temporarily restore it before say_color() runs
tput.

Instead, pre-compute and save the color control sequences before
changing either TERM or HOME.  Use the saved control sequences in
say_color() rather than call tput each time.  This avoids the need to
back up and restore the TERM and HOME variables, and it avoids the
overhead of a subshell and two invocations of tput per call to
say_color().

Signed-off-by: Richard Hansen <rhansen@bbn.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agodocs: clarify that --encoding can produce invalid sequences
Jeff King [Wed, 17 Jun 2015 18:46:08 +0000 (14:46 -0400)]
docs: clarify that --encoding can produce invalid sequences

In the common case that the commit encoding matches the
output encoding, we do not touch the buffer at all, which
makes things much more efficient. But it might be unclear to
a consumer that we will pass through bogus sequences.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agogit-checkout.txt: document "git checkout <pathspec>" better
Torsten Bögershausen [Wed, 17 Jun 2015 07:54:51 +0000 (09:54 +0200)]
git-checkout.txt: document "git checkout <pathspec>" better

git checkout <pathspec> can be used to reset changes in the working tree.

Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoRevert "test-lib.sh: do tests for color support after changing HOME"
Richard Hansen [Wed, 17 Jun 2015 19:06:25 +0000 (15:06 -0400)]
Revert "test-lib.sh: do tests for color support after changing HOME"

This reverts commit 102fc80d32094ad6598b17ab9d607516ee8edc4a.

There are two issues with that commit:

  * It is buggy.  In pseudocode, it is doing:

       color is set || TERM != dumb && color works && color=t

    when it should be doing:

       color is set || { TERM != dumb && color works && color=t }

  * It unnecessarily disables color when tput needs to read
    ~/.terminfo to get the control sequences.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agofetch-pack: check for shallow if depth given
Mike Edgar [Wed, 17 Jun 2015 11:48:14 +0000 (07:48 -0400)]
fetch-pack: check for shallow if depth given

When a repository is first fetched as a shallow clone, either by
git-clone or by fetching into an empty repo, the server's capabilities
are not currently consulted. The client will send shallow requests even
if the server does not understand them, and the resulting error may be
unhelpful to the user. This change pre-emptively checks so we can exit
with a helpful error if necessary.

Signed-off-by: Mike Edgar <adgar@google.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoGit 2.4.4 v2.4.4
Junio C Hamano [Tue, 16 Jun 2015 21:38:01 +0000 (14:38 -0700)]
Git 2.4.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoMerge branch 'jk/clone-dissociate' into maint
Junio C Hamano [Tue, 16 Jun 2015 21:33:52 +0000 (14:33 -0700)]
Merge branch 'jk/clone-dissociate' into maint

Code clean-up.

* jk/clone-dissociate:
  clone: reorder --dissociate and --reference options
  clone: use OPT_STRING_LIST for --reference

8 years agoMerge branch 'sb/submodule-doc-intro' into maint
Junio C Hamano [Tue, 16 Jun 2015 21:33:52 +0000 (14:33 -0700)]
Merge branch 'sb/submodule-doc-intro' into maint

* sb/submodule-doc-intro:
  submodule doc: reorder introductory paragraphs

8 years agoMerge branch 'sb/glossary-submodule' into maint
Junio C Hamano [Tue, 16 Jun 2015 21:33:51 +0000 (14:33 -0700)]
Merge branch 'sb/glossary-submodule' into maint

* sb/glossary-submodule:
  glossary: add "remote", "submodule", "superproject"

8 years agoMerge branch 'ah/usage-strings' into maint
Junio C Hamano [Tue, 16 Jun 2015 21:33:50 +0000 (14:33 -0700)]
Merge branch 'ah/usage-strings' into maint

A few usage string updates.

* ah/usage-strings:
  blame, log: format usage strings similarly to those in documentation

8 years agoMerge branch 'mc/commit-doc-grammofix' into maint
Junio C Hamano [Tue, 16 Jun 2015 21:33:49 +0000 (14:33 -0700)]
Merge branch 'mc/commit-doc-grammofix' into maint

Doc grammar fix.

* mc/commit-doc-grammofix:
  Documentation/git-commit: grammofix

8 years agoMerge branch 'rs/janitorial' into maint
Junio C Hamano [Tue, 16 Jun 2015 21:33:47 +0000 (14:33 -0700)]
Merge branch 'rs/janitorial' into maint

Code clean-up.

* rs/janitorial:
  dir: remove unused variable sb
  clean: remove unused variable buf
  use file_exists() to check if a file exists in the worktree

8 years agoMerge branch 'sb/test-bitmap-free-at-end' into maint
Junio C Hamano [Tue, 16 Jun 2015 21:33:47 +0000 (14:33 -0700)]
Merge branch 'sb/test-bitmap-free-at-end' into maint

An earlier leakfix to bitmap testing code was incomplete.

* sb/test-bitmap-free-at-end:
  test_bitmap_walk: free bitmap with bitmap_free

8 years agoMerge branch 'dt/clean-pathspec-filter-then-lstat' into maint
Junio C Hamano [Tue, 16 Jun 2015 21:33:46 +0000 (14:33 -0700)]
Merge branch 'dt/clean-pathspec-filter-then-lstat' into maint

"git clean pathspec..." tried to lstat(2) and complain even for
paths outside the given pathspec.

* dt/clean-pathspec-filter-then-lstat:
  clean: only lstat files in pathspec

8 years agoMerge branch 'jk/http-backend-deadlock' into maint
Junio C Hamano [Tue, 16 Jun 2015 21:33:45 +0000 (14:33 -0700)]
Merge branch 'jk/http-backend-deadlock' into maint

Communication between the HTTP server and http_backend process can
lead to a dead-lock when relaying a large ref negotiation request.
Diagnose the situation better, and mitigate it by reading such a
request first into core (to a reasonable limit).

* jk/http-backend-deadlock:
  http-backend: spool ref negotiation requests to buffer
  t5551: factor out tag creation
  http-backend: fix die recursion with custom handler

8 years agoMerge branch 'jh/filter-empty-contents' into maint
Junio C Hamano [Tue, 16 Jun 2015 21:33:44 +0000 (14:33 -0700)]
Merge branch 'jh/filter-empty-contents' into maint

The clean/smudge interface did not work well when filtering an
empty contents (failed and then passed the empty input through).
It can be argued that a filter that produces anything but empty for
an empty input is nonsense, but if the user wants to do strange
things, then why not?

* jh/filter-empty-contents:
  sha1_file: pass empty buffer to index empty file

8 years agoMerge branch 'jk/stash-options' into maint
Junio C Hamano [Tue, 16 Jun 2015 21:33:43 +0000 (14:33 -0700)]
Merge branch 'jk/stash-options' into maint

Make "git stash something --help" error out, so that users can
safely say "git stash drop --help".

* jk/stash-options:
  stash: recognize "--help" for subcommands
  stash: complain about unknown flags

8 years agoMerge branch 'mm/log-format-raw-doc' into maint
Junio C Hamano [Tue, 16 Jun 2015 21:33:42 +0000 (14:33 -0700)]
Merge branch 'mm/log-format-raw-doc' into maint

Clarify that "log --raw" and "log --format=raw" are unrelated
concepts.

* mm/log-format-raw-doc:
  Documentation/log: clarify sha1 non-abbreviation in log --raw
  Documentation/log: clarify what --raw means

8 years agoMerge branch 'ep/do-not-feed-a-pointer-to-array-size' into maint
Junio C Hamano [Tue, 16 Jun 2015 21:33:41 +0000 (14:33 -0700)]
Merge branch 'ep/do-not-feed-a-pointer-to-array-size' into maint

Catch a programmer mistake to feed a pointer not an array to
ARRAY_SIZE() macro, by using a couple of GCC extensions.

* ep/do-not-feed-a-pointer-to-array-size:
  git-compat-util.h: implement a different ARRAY_SIZE macro for for safely deriving the size of array

8 years agoDocumentation/describe: improve one-line summary
Matthieu Moy [Tue, 16 Jun 2015 13:16:38 +0000 (15:16 +0200)]
Documentation/describe: improve one-line summary

git describe does not show 'the most recent tag that is reachable from a
commit', but a descriptive name based on this tag. Fix the description to
reflect that.

Suggested-by: Albert Netymk <albertnetymk@gmail.com>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoRevert "stash: require a clean index to apply"
Jeff King [Mon, 15 Jun 2015 18:27:22 +0000 (14:27 -0400)]
Revert "stash: require a clean index to apply"

This reverts commit ed178ef13a26136d86ff4e33bb7b1afb5033f908.

That commit was an attempt to improve the safety of applying
a stash, because the application process may create
conflicted index entries, after which it is hard to restore
the original index state.

Unfortunately, this hurts some common workflows around "git
stash -k", like:

    git add -p       ;# (1) stage set of proposed changes
    git stash -k     ;# (2) get rid of everything else
    make test        ;# (3) make sure proposal is reasonable
    git stash apply  ;# (4) restore original working tree

If you "git commit" between steps (3) and (4), then this
just works. However, if these steps are part of a pre-commit
hook, you don't have that opportunity (you have to restore
the original state regardless of whether the tests passed or
failed).

It's possible that we could provide better tools for this
sort of workflow. In particular, even before ed178ef, it
could fail with a conflict if there were conflicting hunks
in the working tree and index (since the "stash -k" puts the
index version into the working tree, and we then attempt to
apply the differences between HEAD and the old working tree
on top of that). But the fact remains that people have been
using it happily for a while, and the safety provided by
ed178ef is simply not that great. Let's revert it for now.
In the long run, people can work on improving stash for this
sort of workflow, but the safety tradeoff is not worth it in
the meantime.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoMerge tag 'l10n-2.4-maint-de-updates' of git://github.com/git-l10n/git-po into maint
Junio C Hamano [Sun, 14 Jun 2015 21:24:49 +0000 (14:24 -0700)]
Merge tag 'l10n-2.4-maint-de-updates' of git://github.com/git-l10n/git-po into maint

l10n-2.4-maint-de-updates

* tag 'l10n-2.4-maint-de-updates' of git://github.com/git-l10n/git-po:
  l10n: de.po: translation fix for fall-back to 3way merge
  l10n: de.po: punctuation fixes
  l10n: de.po: grammar fix
  l10n: de.po: change error message from "sagen" to "Meinten Sie"

8 years agohooks/pre-auto-gc: adjust power checking for newer OS X
Panagiotis Astithas [Thu, 11 Jun 2015 14:37:25 +0000 (17:37 +0300)]
hooks/pre-auto-gc: adjust power checking for newer OS X

The output of "pmset -g batt" changed at some point from "Currently
drawing from 'AC Power'" to the slightly different "Now drawing from
'AC Power'". Starting the match from "drawing" makes the check work
in both old and new versions of OS X.

Signed-off-by: Panagiotis Astithas <pastith@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agot0302: "unreadable" test needs SANITY prereq
Paul Tan [Fri, 12 Jun 2015 13:29:58 +0000 (21:29 +0800)]
t0302: "unreadable" test needs SANITY prereq

The test expects that "chmod -r ~/.git-credentials" would make it
unreadable to the user, and thus needs the SANITY prerequisite.

Reported-by: Jean-Yves LENHOF <jean-yves@lenhof.eu.org>
Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agol10n: de.po: translation fix for fall-back to 3way merge
Michael J Gruber [Tue, 19 May 2015 08:51:34 +0000 (10:51 +0200)]
l10n: de.po: translation fix for fall-back to 3way merge

The English version is correct, but misleading: It is not the 3way merge
that is being patched also, but that is being fallen back to also.

The German version translates the former meaning. Make it translate the
latter.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
8 years agol10n: de.po: punctuation fixes
Michael J Gruber [Tue, 19 May 2015 08:51:33 +0000 (10:51 +0200)]
l10n: de.po: punctuation fixes

This respects the ellipsis style used in de.po.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
8 years agol10n: de.po: grammar fix
Michael J Gruber [Tue, 19 May 2015 08:51:32 +0000 (10:51 +0200)]
l10n: de.po: grammar fix

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
8 years agol10n: de.po: change error message from "sagen" to "Meinten Sie"
Phillip Sz [Sat, 9 May 2015 11:28:55 +0000 (13:28 +0200)]
l10n: de.po: change error message from "sagen" to "Meinten Sie"

We should not use "sagen" if someone has written something wrong.
Although it's "say" in English, we should not use it in German
and instead use our normal error message.

Signed-off-by: Phillip Sz <phillip.szelat@gmail.com>
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
8 years agogit-prompt.sh: document GIT_PS1_STATESEPARATOR
Joe Cridge [Wed, 10 Jun 2015 17:19:24 +0000 (18:19 +0100)]
git-prompt.sh: document GIT_PS1_STATESEPARATOR

The environment variable GIT_PS1_STATESEPARATOR can be used to set the
separator between the branch name and the state symbols in the prompt.

At present the variable is not mentioned in the inline documentation which
makes it difficult for the casual user to identify.

Signed-off-by: Joe Cridge <joe.cridge@me.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agodoc: format-patch: fix typo
Frans Klaver [Wed, 10 Jun 2015 21:01:14 +0000 (23:01 +0200)]
doc: format-patch: fix typo

reroll count documentation states that v<n> will be pretended to the
filename. Judging by the examples that should have been 'prepended'.

Signed-off-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoindex-pack: avoid excessive re-reading of pack directory
Jeff King [Tue, 9 Jun 2015 17:24:37 +0000 (13:24 -0400)]
index-pack: avoid excessive re-reading of pack directory

Since 45e8a74 (has_sha1_file: re-check pack directory before
giving up, 2013-08-30), we spend extra effort for
has_sha1_file to give the right answer when somebody else is
repacking. Usually this effort does not matter, because
after finding that the object does not exist, the next step
is usually to die().

However, some code paths make a large number of
has_sha1_file checks which are _not_ expected to return 1.
The collision test in index-pack.c is such a case. On a
local system, this can cause a performance slowdown of
around 5%. But on a system with high-latency system calls
(like NFS), it can be much worse.

This patch introduces a "quick" flag to has_sha1_file which
callers can use when they would prefer high performance at
the cost of false negatives during repacks. There may be
other code paths that can use this, but the index-pack one
is the most obviously critical, so we'll start with
switching that one.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agocommit: cope with scissors lines in commit message
SZEDER Gábor [Tue, 9 Jun 2015 00:28:34 +0000 (02:28 +0200)]
commit: cope with scissors lines in commit message

The diff and submodule shortlog appended to the commit message template
by 'git commit --verbose' are not stripped when the commit message
contains an indented scissors line.

When cleaning up a commit message with 'git commit --verbose' or
'--cleanup=scissors' the code is careful and triggers only on a pure
scissors line, i.e. a line containing nothing but a comment character, a
space, and the scissors cut.  This is good, because people can embed
scissors lines in the commit message while using 'git commit --verbose',
and the text they write after their indented scissors line doesn't get
deleted.

While doing so, however, the cleanup function only looks at the first
line matching the scissors pattern and if it doesn't start at the
beginning of the line, then the function just returns without performing
any cleanup.  This is wrong, because a "real" scissors line added by
'git commit --verbose' might follow, and in that case the diff and
submodule shortlog get included in the commit message.

Fix this by changing the scissors pattern to match only at the beginning
of the line, yet be careful to catch scissors on the first line as well.

Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agogit-completion.tcsh: fix redirect with noclobber
Ariel Faigon [Tue, 9 Jun 2015 17:25:15 +0000 (10:25 -0700)]
git-completion.tcsh: fix redirect with noclobber

tcsh users who happen to have 'set noclobber' elsewhere in their
~/.tcshrc or ~/.cshrc startup files get a 'File exist' error, and
the tcsh completion file doesn't get generated/updated.

Adding a `!` in the redirect works correctly for both clobber (default)
and 'set noclobber' users.

Reviewed-by: Christian Couder <christian.couder@gmail.com>
Signed-off-by: Ariel Faigon <github.2009@yendor.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoam --abort: keep unrelated commits on unborn branch
Paul Tan [Sat, 6 Jun 2015 11:46:12 +0000 (19:46 +0800)]
am --abort: keep unrelated commits on unborn branch

Since 7b3b7e3 (am --abort: keep unrelated commits since the last failure
and warn, 2010-12-21), git-am would refuse to rewind HEAD if commits
were made since the last git-am failure. This check was implemented in
safe_to_abort(), which checked to see if HEAD's hash matched the
abort-safety file.

However, this check was skipped if the abort-safety file was empty,
which can happen if git-am failed while on an unborn branch. As such, if
any commits were made since then, they would be discarded. Fix this by
carrying on the abort safety check even if the abort-safety file is
empty.

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoam --abort: support aborting to unborn branch
Paul Tan [Sat, 6 Jun 2015 11:46:11 +0000 (19:46 +0800)]
am --abort: support aborting to unborn branch

When git-am is first run on an unborn branch, no ORIG_HEAD is created.
As such, any applied commits will remain even after a git am --abort.

To be consistent with the behavior of git am --abort when it is not run
from an unborn branch, we empty the index, and then destroy the branch
pointed to by HEAD if there is no ORIG_HEAD.

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoam --abort: revert changes introduced by failed 3way merge
Paul Tan [Sat, 6 Jun 2015 11:46:10 +0000 (19:46 +0800)]
am --abort: revert changes introduced by failed 3way merge

Even when a merge conflict occurs with am --3way, the index will be
modified with the results of any successfully merged files. These
changes to the index will not be reverted with a
"git read-tree --reset -u HEAD ORIG_HEAD", as git read-tree will not be
aware of how the current index differs from HEAD or ORIG_HEAD.

To fix this, we first reset any conflicting entries in the index. The
resulting index will contain the results of successfully merged files
introduced by the failed merge. We write this index to a tree, and then
use git read-tree to fast-forward this "index tree" back to ORIG_HEAD,
thus undoing all the changes from the failed merge.

When we are on an unborn branch, HEAD and ORIG_HEAD will not point to
valid trees. In this case, use an empty tree.

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoam --skip: support skipping while on unborn branch
Paul Tan [Sat, 6 Jun 2015 11:46:09 +0000 (19:46 +0800)]
am --skip: support skipping while on unborn branch

When git am --skip is run, git am will copy HEAD's tree entries to the
index with "git reset HEAD". However, on an unborn branch, HEAD does not
point to a tree, so "git reset HEAD" will fail.

Fix this by treating HEAD as en empty tree when we are on an unborn
branch.

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoam -3: support 3way merge on unborn branch
Paul Tan [Sat, 6 Jun 2015 11:46:08 +0000 (19:46 +0800)]
am -3: support 3way merge on unborn branch

While on an unborn branch, git am -3 will fail to do a threeway merge as
it references HEAD as "our tree", but HEAD does not point to a valid
tree.

Fix this by using an empty tree as "our tree" when we are on an unborn
branch.

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoam --skip: revert changes introduced by failed 3way merge
Paul Tan [Sat, 6 Jun 2015 11:46:07 +0000 (19:46 +0800)]
am --skip: revert changes introduced by failed 3way merge

Even when a merge conflict occurs with am --3way, the index will be
modified with the results of any succesfully merged files (such as a new
file). These changes to the index will not be reverted with a
"git read-tree --reset -u HEAD HEAD", as git read-tree will not be aware
of how the current index differs from HEAD.

To fix this, we first reset any conflicting entries from the index. The
resulting index will contain the results of successfully merged files.
We write the index to a tree, then use git read-tree -m to fast-forward
the "index tree" back to HEAD, thus undoing all the changes from the
failed merge.

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>