]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
7 years agoMerge branch 'rs/notes-merge-no-toctou' into maint
Junio C Hamano [Mon, 8 Aug 2016 21:21:35 +0000 (14:21 -0700)] 
Merge branch 'rs/notes-merge-no-toctou' into maint

"git notes merge" had a code to see if a path exists (and fails if
it does) and then open the path for writing (when it doesn't).
Replace it with open with O_EXCL.

* rs/notes-merge-no-toctou:
  notes-merge: use O_EXCL to avoid overwriting existing files

7 years agoMerge branch 'js/ignore-space-at-eol' into maint
Junio C Hamano [Mon, 8 Aug 2016 21:21:35 +0000 (14:21 -0700)] 
Merge branch 'js/ignore-space-at-eol' into maint

An age old bug that caused "git diff --ignore-space-at-eol"
misbehave has been fixed.

* js/ignore-space-at-eol:
  diff: fix a double off-by-one with --ignore-space-at-eol
  diff: demonstrate a bug with --patience and --ignore-space-at-eol

7 years agoMerge branch 'jk/push-scrub-url' into maint
Junio C Hamano [Mon, 8 Aug 2016 21:21:34 +0000 (14:21 -0700)] 
Merge branch 'jk/push-scrub-url' into maint

"git fetch http://user:pass@host/repo..." scrubbed the userinfo
part, but "git push" didn't.

* jk/push-scrub-url:
  t5541: fix url scrubbing test when GPG is not set
  push: anonymize URL in status output

7 years agoMerge branch 'nd/cache-tree-ita' into maint
Junio C Hamano [Mon, 8 Aug 2016 21:21:32 +0000 (14:21 -0700)] 
Merge branch 'nd/cache-tree-ita' into maint

"git add -N dir/file && git write-tree" produced an incorrect tree
when there are other paths in the same directory that sorts after
"file".

* nd/cache-tree-ita:
  cache-tree: do not generate empty trees as a result of all i-t-a subentries
  cache-tree.c: fix i-t-a entry skipping directory updates sometimes
  test-lib.sh: introduce and use $EMPTY_BLOB
  test-lib.sh: introduce and use $EMPTY_TREE

7 years agoMerge branch 'mh/blame-worktree' into maint
Junio C Hamano [Mon, 8 Aug 2016 21:21:32 +0000 (14:21 -0700)] 
Merge branch 'mh/blame-worktree' into maint

"git blame file" allowed the lineage of lines in the uncommitted,
unadded contents of "file" to be inspected, but it refused when
"file" did not appear in the current commit.  When "file" was
created by renaming an existing file (but the change has not been
committed), this restriction was unnecessarily tight.

* mh/blame-worktree:
  t/t8003-blame-corner-cases.sh: Use here documents
  blame: allow to blame paths freshly added to the index

7 years agoSome fixes for 2.9.3
Junio C Hamano [Thu, 28 Jul 2016 18:28:32 +0000 (11:28 -0700)] 
Some fixes for 2.9.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoMerge branch 'ak/lazy-prereq-mktemp' into maint
Junio C Hamano [Thu, 28 Jul 2016 18:26:03 +0000 (11:26 -0700)] 
Merge branch 'ak/lazy-prereq-mktemp' into maint

A test that unconditionally used "mktemp" learned that the command
is not necessarily available everywhere.

* ak/lazy-prereq-mktemp:
  t7610: test for mktemp before test execution

7 years agoMerge branch 'nd/icase' into maint
Junio C Hamano [Thu, 28 Jul 2016 18:26:03 +0000 (11:26 -0700)] 
Merge branch 'nd/icase' into maint

"git grep -i" has been taught to fold case in non-ascii locales
correctly.

* nd/icase:
  grep.c: reuse "icase" variable
  diffcore-pickaxe: support case insensitive match on non-ascii
  diffcore-pickaxe: Add regcomp_or_die()
  grep/pcre: support utf-8
  gettext: add is_utf8_locale()
  grep/pcre: prepare locale-dependent tables for icase matching
  grep: rewrite an if/else condition to avoid duplicate expression
  grep/icase: avoid kwsset when -F is specified
  grep/icase: avoid kwsset on literal non-ascii strings
  test-regex: expose full regcomp() to the command line
  test-regex: isolate the bug test code
  grep: break down an "if" stmt in preparation for next changes

7 years agoMerge branch 'sb/submodule-parallel-fetch' into maint
Junio C Hamano [Thu, 28 Jul 2016 18:26:02 +0000 (11:26 -0700)] 
Merge branch 'sb/submodule-parallel-fetch' into maint

Fix recently introduced codepaths that are involved in parallel
submodule operations, which gave up on reading too early, and
could have wasted CPU while attempting to write under a corner
case condition.

* sb/submodule-parallel-fetch:
  hoist out handle_nonblock function for xread and xwrite
  xwrite: poll on non-blocking FDs
  xread: retry after poll on EAGAIN/EWOULDBLOCK

7 years agoMerge branch 'dk/blame-move-no-reason-for-1-line-context' into maint
Junio C Hamano [Thu, 28 Jul 2016 18:26:01 +0000 (11:26 -0700)] 
Merge branch 'dk/blame-move-no-reason-for-1-line-context' into maint

"git blame -M" missed a single line that was moved within the file.

* dk/blame-move-no-reason-for-1-line-context:
  blame: require 0 context lines while finding moved lines with -M

7 years agoMerge branch 'jk/test-match-signal' into maint
Junio C Hamano [Thu, 28 Jul 2016 18:26:00 +0000 (11:26 -0700)] 
Merge branch 'jk/test-match-signal' into maint

The test framework learned a new helper test_match_signal to
check an exit code from getting killed by an expected signal.

* jk/test-match-signal:
  t/lib-git-daemon: use test_match_signal
  test_must_fail: use test_match_signal
  t0005: use test_match_signal as appropriate
  tests: factor portable signal check out of t0005

7 years agoMerge branch 'js/am-call-theirs-theirs-in-fallback-3way' into maint
Junio C Hamano [Thu, 28 Jul 2016 18:25:59 +0000 (11:25 -0700)] 
Merge branch 'js/am-call-theirs-theirs-in-fallback-3way' into maint

One part of "git am" had an oddball helper function that called
stuff from outside "his" as opposed to calling what we have "ours",
which was not gender-neutral and also inconsistent with the rest of
the system where outside stuff is usuall called "theirs" in
contrast to "ours".

* js/am-call-theirs-theirs-in-fallback-3way:
  am: counteract gender bias

7 years agoMerge branch 'js/t3404-grammo-fix' into maint
Junio C Hamano [Thu, 28 Jul 2016 18:25:58 +0000 (11:25 -0700)] 
Merge branch 'js/t3404-grammo-fix' into maint

Grammofix.

* js/t3404-grammo-fix:
  t3404: fix a grammo (commands are ran -> commands are run)

7 years agoMerge branch 'nd/doc-new-command' into maint
Junio C Hamano [Thu, 28 Jul 2016 18:25:57 +0000 (11:25 -0700)] 
Merge branch 'nd/doc-new-command' into maint

Typofix in a doc.

* nd/doc-new-command:
  new-command.txt: correct the command description file

7 years agoMerge branch 'ew/gc-auto-pack-limit-fix' into maint
Junio C Hamano [Thu, 28 Jul 2016 18:25:56 +0000 (11:25 -0700)] 
Merge branch 'ew/gc-auto-pack-limit-fix' into maint

"gc.autoPackLimit" when set to 1 should not trigger a repacking
when there is only one pack, but the code counted poorly and did
so.

* ew/gc-auto-pack-limit-fix:
  gc: fix off-by-one error with gc.autoPackLimit

7 years agoMerge branch 'js/color-on-windows-comment' into maint
Junio C Hamano [Thu, 28 Jul 2016 18:25:55 +0000 (11:25 -0700)] 
Merge branch 'js/color-on-windows-comment' into maint

For a long time, we carried an in-code comment that said our
colored output would work only when we use fprintf/fputs on
Windows, which no longer is the case for the past few years.

* js/color-on-windows-comment:
  color.h: remove obsolete comment about limitations on Windows

7 years agoMerge branch 'mm/doc-tt' into maint
Junio C Hamano [Thu, 28 Jul 2016 18:25:54 +0000 (11:25 -0700)] 
Merge branch 'mm/doc-tt' into maint

More mark-up updates to typeset strings that are expected to
literally typed by the end user in fixed-width font.

* mm/doc-tt:
  doc: typeset HEAD and variants as literal
  CodingGuidelines: formatting HEAD in documentation
  doc: typeset long options with argument as literal
  doc: typeset '--' as literal
  doc: typeset long command-line options as literal
  doc: typeset short command-line options as literal
  Documentation/git-mv.txt: fix whitespace indentation

7 years agoMerge branch 'js/sign-empty-commit-fix' into maint
Junio C Hamano [Thu, 28 Jul 2016 18:25:53 +0000 (11:25 -0700)] 
Merge branch 'js/sign-empty-commit-fix' into maint

"git commit --amend --allow-empty-message -S" for a commit without
any message body could have misidentified where the header of the
commit object ends.

* js/sign-empty-commit-fix:
  commit -S: avoid invalid pointer with empty message

7 years agoMerge branch 'ps/rebase-i-auto-unstash-upon-abort' into maint
Junio C Hamano [Thu, 28 Jul 2016 18:25:52 +0000 (11:25 -0700)] 
Merge branch 'ps/rebase-i-auto-unstash-upon-abort' into maint

"git rebase -i --autostash" did not restore the auto-stashed change
when the operation was aborted.

* ps/rebase-i-auto-unstash-upon-abort:
  rebase -i: restore autostash on abort

7 years agoMerge branch 'nd/ita-cleanup' into maint
Junio C Hamano [Thu, 28 Jul 2016 18:25:51 +0000 (11:25 -0700)] 
Merge branch 'nd/ita-cleanup' into maint

Git does not know what the contents in the index should be for a
path added with "git add -N" yet, so "git grep --cached" should not
show hits (or show lack of hits, with -L) in such a path, but that
logic does not apply to "git grep", i.e. searching in the working
tree files.  But we did so by mistake, which has been corrected.

* nd/ita-cleanup:
  grep: fix grepping for "intent to add" files
  t7810-grep.sh: fix a whitespace inconsistency
  t7810-grep.sh: fix duplicated test name

7 years agoMerge branch 'js/find-commit-subject-ignore-leading-blanks' into maint
Junio C Hamano [Thu, 28 Jul 2016 18:25:50 +0000 (11:25 -0700)] 
Merge branch 'js/find-commit-subject-ignore-leading-blanks' into maint

A helper function that takes the contents of a commit object and
finds its subject line did not ignore leading blank lines, as is
commonly done by other codepaths.  Make it ignore leading blank
lines to match.

* js/find-commit-subject-ignore-leading-blanks:
  reset --hard: skip blank lines when reporting the commit subject
  sequencer: use skip_blank_lines() to find the commit subject
  commit -C: skip blank lines at the beginning of the message
  commit.c: make find_commit_subject() more robust
  pretty: make the skip_blank_lines() function public

7 years agoMerge branch 'dg/subtree-rebase-test' into maint
Junio C Hamano [Thu, 28 Jul 2016 18:25:49 +0000 (11:25 -0700)] 
Merge branch 'dg/subtree-rebase-test' into maint

Add a test to specify the desired behaviour that currently is not
available in "git rebase -Xsubtree=...".

* dg/subtree-rebase-test:
  contrib/subtree: Add a test for subtree rebase that loses commits

7 years agot5541: fix url scrubbing test when GPG is not set
Jeff King [Wed, 20 Jul 2016 11:32:26 +0000 (05:32 -0600)] 
t5541: fix url scrubbing test when GPG is not set

When the GPG prereq is not set, we do not run test 34. That
test changes the directory of the test script as a side
effect (something we usually frown on, but which matches the
style of the rest of this script). When test 35 (the
url-scrubbing test) runs, it expects to be in the directory
from test 34. If it's not, the test fails; we are in a
different sub-repo, our test-commit is built on a different
history, and the push becomes a non-fast-forward.

We can fix this by unconditionally moving to the directory
we expect (again, against our usual style but matching how
the rest of the script operates).

As an additional protection, let's also switch from "make a
new commit and push to master" to just "push to a new
branch". We don't care about the branch name; we just want
_some_ ref update to trigger the status output. Pushing to a
new branch is less likely to run into problems with
force-updates, changing the checked-out branch, etc.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agot/t8003-blame-corner-cases.sh: Use here documents
Mike Hommey [Fri, 15 Jul 2016 23:23:46 +0000 (08:23 +0900)] 
t/t8003-blame-corner-cases.sh: Use here documents

Somehow, this test was using:

{
echo A
echo B
} > file

block to feed file contents. This changes those to the form most common
in git test scripts:

cat >file <<-\EOF
A
B
EOF

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoblame: allow to blame paths freshly added to the index
Mike Hommey [Fri, 15 Jul 2016 23:23:45 +0000 (08:23 +0900)] 
blame: allow to blame paths freshly added to the index

When blaming files, changes in the work tree are taken into account
and displayed as being "Not Committed Yet".

However, when blaming a file that is not known to the current HEAD,
git blame fails with `no such path 'foo' in HEAD`, even when the file
was git add'ed.

Allowing such a blame is useful when the new file added to the index
(not yet committed) was created by renaming an existing file.  It
also is useful when the new file was created from pieces already in
HEAD, moved or copied from other files and blaming with copy
detection (i.e. "-C").

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agocache-tree: do not generate empty trees as a result of all i-t-a subentries
Nguyễn Thái Ngọc Duy [Sat, 16 Jul 2016 05:06:27 +0000 (07:06 +0200)] 
cache-tree: do not generate empty trees as a result of all i-t-a subentries

If a subdirectory contains nothing but i-t-a entries, we generate an
empty tree object and add it to its parent tree. Which is wrong. Such
a subdirectory should not be added.

Note that this has a cascading effect. If subdir 'a/b/c' contains
nothing but i-t-a entries, we ignore it. But then if 'a/b' contains
only (the non-existing) 'a/b/c', then we should ignore 'a/b' while
building 'a' too. And it goes all the way up to top directory.

Noticed-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agocache-tree.c: fix i-t-a entry skipping directory updates sometimes
Nguyễn Thái Ngọc Duy [Sat, 16 Jul 2016 05:06:26 +0000 (07:06 +0200)] 
cache-tree.c: fix i-t-a entry skipping directory updates sometimes

Commit 3cf773e (cache-tree: fix writing cache-tree when CE_REMOVE is
present - 2012-12-16) skips i-t-a entries when building trees objects
from the index. Unfortunately it may skip too much.

The code in question checks if an entry is an i-t-a one, then no tree
entry will be written. But it does not take into account that
directories can also be written with the same code. Suppose we have
this in the index.

    a-file
    subdir/file1
    subdir/file2
    subdir/file3
    the-last-file

We write an entry for a-file as normal and move on to subdir/file1,
where we realize the entry name for this level is simply just
"subdir", write down an entry for "subdir" then jump three items ahead
to the-last-file.

That is what happens normally when the first file in subdir is not an
i-t-a entry. If subdir/file1 is an i-t-a, because of the broken
condition in this code, we still think "subdir" is an i-t-a file and
not writing "subdir" down and jump to the-last-file. The result tree
now only has two items: a-file and the-last-file. subdir should be
there too (even though it only records two sub-entries, file2 and
file3).

If the i-t-a entry is subdir/file2 or subdir/file3, this is not a
problem because we jump over them anyway. Which may explain why the
bug is hidden for nearly four years.

Fix it by making sure we only skip i-t-a entries when the entry in
question is actual an index entry, not a directory.

Reported-by: Yuri Kanivetsky <yuri.kanivetsky@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agotest-lib.sh: introduce and use $EMPTY_BLOB
Nguyễn Thái Ngọc Duy [Sat, 16 Jul 2016 05:06:25 +0000 (07:06 +0200)] 
test-lib.sh: introduce and use $EMPTY_BLOB

Similar to $EMPTY_TREE this makes it easier to recognize this special
SHA-1 and change hash later.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agotest-lib.sh: introduce and use $EMPTY_TREE
Nguyễn Thái Ngọc Duy [Sat, 16 Jul 2016 05:06:24 +0000 (07:06 +0200)] 
test-lib.sh: introduce and use $EMPTY_TREE

This is a special SHA1. Let's keep it at one place, easier to replace
later when the hash change comes, easier to recognize.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoGit 2.9.2 v2.9.2
Junio C Hamano [Fri, 15 Jul 2016 17:48:16 +0000 (10:48 -0700)] 
Git 2.9.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoMerge branch 'jk/tzoffset-fix' into maint
Junio C Hamano [Fri, 15 Jul 2016 16:43:42 +0000 (09:43 -0700)] 
Merge branch 'jk/tzoffset-fix' into maint

Skip tests that are unrunnable on platforms without 64-bit long
to avoid unnecessary test failures.

* jk/tzoffset-fix:
  t0006: skip "far in the future" test when unsigned long is not long enough

7 years agot0006: skip "far in the future" test when unsigned long is not long enough
Jeff King [Mon, 11 Jul 2016 23:54:18 +0000 (19:54 -0400)] 
t0006: skip "far in the future" test when unsigned long is not long enough

Git's source code refers to timestamps as unsigned longs.  On 32-bit
platforms, as well as on Windows, unsigned long is not large enough
to capture dates that are "absurdly far in the future".

While we can fix this issue properly by replacing unsigned long with
a larger type, we want to be a bit more conservative and just skip
those tests on the maint track.

Signed-off-by: Jeff King <peff@peff.net>
Helped-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agopush: anonymize URL in status output
Jeff King [Wed, 13 Jul 2016 23:36:53 +0000 (19:36 -0400)] 
push: anonymize URL in status output

Commit 47abd85 (fetch: Strip usernames from url's before
storing them, 2009-04-17) taught fetch to anonymize URLs.
The primary purpose there was to avoid sticking passwords in
merge-commit messages, but as a side effect, we also avoid
printing them to stderr.

The push side does not have the merge-commit problem, but it
probably should avoid printing them to stderr. We can reuse
the same anonymizing function.

Note that for this to come up, the credentials would have to
appear either on the command line or in a git config file,
neither of which is particularly secure. So people _should_
be switching to using credential helpers instead, which
makes this problem go away. But that's no excuse not to
improve the situation for people who for whatever reason end
up using credentials embedded in the URL.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agodiff: fix a double off-by-one with --ignore-space-at-eol
Johannes Schindelin [Sat, 9 Jul 2016 07:23:55 +0000 (09:23 +0200)] 
diff: fix a double off-by-one with --ignore-space-at-eol

When comparing two lines, ignoring any whitespace at the end, we first
try to match as many bytes as possible and break out of the loop only
upon mismatch, to let the remainder be handled by the code shared with
the other whitespace-ignoring code paths.

When comparing the bytes, however, we incremented the counters always,
even if the bytes did not match. And because we fall through to  the
space-at-eol handling at that point, it is as if that mismatch never
happened.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agodiff: demonstrate a bug with --patience and --ignore-space-at-eol
Johannes Schindelin [Sat, 9 Jul 2016 07:23:50 +0000 (09:23 +0200)] 
diff: demonstrate a bug with --patience and --ignore-space-at-eol

When a single character is added to a line, the combination of these
two options results in an empty diff.

This bug was noticed and reported by Naja Melan.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoGit 2.9.1 v2.9.1
Junio C Hamano [Mon, 11 Jul 2016 17:45:50 +0000 (10:45 -0700)] 
Git 2.9.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoMerge branch 'jc/t2300-setup' into maint
Junio C Hamano [Mon, 11 Jul 2016 17:44:19 +0000 (10:44 -0700)] 
Merge branch 'jc/t2300-setup' into maint

Portability fix for Windows.

* jc/t2300-setup:
  t2300: "git --exec-path" is not usable in $PATH on Windows as-is

7 years agoMerge branch 'cb/t7810-test-label-fix' into maint
Junio C Hamano [Mon, 11 Jul 2016 17:44:18 +0000 (10:44 -0700)] 
Merge branch 'cb/t7810-test-label-fix' into maint

Test clean-up.

* cb/t7810-test-label-fix:
  t7810: fix duplicated test title

7 years agoMerge branch 'sb/t5614-modernize' into maint
Junio C Hamano [Mon, 11 Jul 2016 17:44:17 +0000 (10:44 -0700)] 
Merge branch 'sb/t5614-modernize' into maint

Test clean-up.

* sb/t5614-modernize:
  t5614: don't use subshells

7 years agoMerge branch 'jn/preformatted-doc-url' into maint
Junio C Hamano [Mon, 11 Jul 2016 17:44:16 +0000 (10:44 -0700)] 
Merge branch 'jn/preformatted-doc-url' into maint

The top level documentation "git help git" still pointed at the
documentation set hosted at now-defunct google-code repository.
Update it to point to https://git.github.io/htmldocs/git.html
instead.

* jn/preformatted-doc-url:
  doc: git-htmldocs.googlecode.com is no more

7 years agoMerge branch 'ao/p4-has-branch-prefix-fix' into maint
Junio C Hamano [Mon, 11 Jul 2016 17:44:16 +0000 (10:44 -0700)] 
Merge branch 'ao/p4-has-branch-prefix-fix' into maint

A bug, which caused "git p4" while running under verbose mode to
report paths that are omitted due to branch prefix incorrectly, has
been fixed; the command said "Ignoring file outside of prefix" for
paths that are _inside_.

* ao/p4-has-branch-prefix-fix:
  git-p4: correct hasBranchPrefix verbose output

7 years agoMerge branch 'js/perf-on-apple' into maint
Junio C Hamano [Mon, 11 Jul 2016 17:44:15 +0000 (10:44 -0700)] 
Merge branch 'js/perf-on-apple' into maint

t/perf needs /usr/bin/time with GNU extension; the invocation of it
is updated to "gtime" on Darwin.

* js/perf-on-apple:
  perf: accommodate for MacOSX

7 years agoMerge branch 'ak/t7800-wo-readlink' into maint
Junio C Hamano [Mon, 11 Jul 2016 17:44:15 +0000 (10:44 -0700)] 
Merge branch 'ak/t7800-wo-readlink' into maint

One among four invocations of readlink(1) in our test suite has
been rewritten so that the test can run on systems without the
command (others are in valgrind test framework and t9802).

* ak/t7800-wo-readlink:
  t7800: readlink may not be available

7 years agoMerge branch 'jk/tzoffset-fix' into maint
Junio C Hamano [Mon, 11 Jul 2016 17:44:14 +0000 (10:44 -0700)] 
Merge branch 'jk/tzoffset-fix' into maint

The internal code used to show local timezone offset is not
prepared to handle timestamps beyond year 2100, and gave a
bogus offset value to the caller.  Use a more benign looking
+0000 instead and let "git log" going in such a case, instead
of aborting.

* jk/tzoffset-fix:
  local_tzoffset: detect errors from tm_to_time_t
  t0006: test various date formats
  t0006: rename test-date's "show" to "relative"

7 years agoMerge branch 'js/mingw-parameter-less-c-functions' into maint
Junio C Hamano [Mon, 11 Jul 2016 17:44:13 +0000 (10:44 -0700)] 
Merge branch 'js/mingw-parameter-less-c-functions' into maint

Some platform-specific code had non-ANSI strict declarations of C
functions that do not take any parameters, which has been
corrected.

* js/mingw-parameter-less-c-functions:
  mingw: let the build succeed with DEVELOPER=1

7 years agoMerge branch 'lc/shell-default-value-noexpand' into maint
Junio C Hamano [Mon, 11 Jul 2016 17:44:13 +0000 (10:44 -0700)] 
Merge branch 'lc/shell-default-value-noexpand' into maint

Fix unnecessarily waste in the idiomatic use of ': ${VAR=default}'
to set the default value, without enclosing it in double quotes.

* lc/shell-default-value-noexpand:
  sh-setup: enclose setting of ${VAR=default} in double-quotes

7 years agoMerge branch 'sb/clone-shallow-passthru' into maint
Junio C Hamano [Mon, 11 Jul 2016 17:44:12 +0000 (10:44 -0700)] 
Merge branch 'sb/clone-shallow-passthru' into maint

Fix an unintended regression in v2.9 that breaks "clone --depth"
that recurses down to submodules by forcing the submodules to also
be cloned shallowly, which many server instances that host upstream
of the submodules are not prepared for.

* sb/clone-shallow-passthru:
  clone: do not let --depth imply --shallow-submodules

7 years agoMerge branch 'mg/signature-doc' into maint
Junio C Hamano [Mon, 11 Jul 2016 17:44:11 +0000 (10:44 -0700)] 
Merge branch 'mg/signature-doc' into maint

Formats of the various data (and how to validate them) where we use
GPG signature have been documented.

* mg/signature-doc:
  Documentation/technical: signed merge tag format
  Documentation/technical: signed commit format
  Documentation/technical: signed tag format
  Documentation/technical: describe signature formats

7 years agoMerge branch 'jk/bisect-show-tree' into maint
Junio C Hamano [Mon, 11 Jul 2016 17:44:11 +0000 (10:44 -0700)] 
Merge branch 'jk/bisect-show-tree' into maint

"git bisect" makes an internal call to "git diff-tree" when
bisection finds the culprit, but this call did not initialize the
data structure to pass to the diff-tree API correctly.

* jk/bisect-show-tree:
  bisect: always call setup_revisions after init_revisions

7 years agoMerge branch 'km/fetch-do-not-free-remote-name' into maint
Junio C Hamano [Mon, 11 Jul 2016 17:44:10 +0000 (10:44 -0700)] 
Merge branch 'km/fetch-do-not-free-remote-name' into maint

The ownership rule for the piece of memory that hold references to
be fetched in "git fetch" was screwy, which has been cleaned up.

* km/fetch-do-not-free-remote-name:
  builtin/fetch.c: don't free remote->name after fetch

7 years agoMerge branch 'nd/graph-width-padded' into maint
Junio C Hamano [Mon, 11 Jul 2016 17:44:09 +0000 (10:44 -0700)] 
Merge branch 'nd/graph-width-padded' into maint

"log --graph --format=" learned that "%>|(N)" specifies the width
relative to the terminal's left edge, not relative to the area to
draw text that is to the right of the ancestry-graph section.  It
also now accepts negative N that means the column limit is relative
to the right border.

* nd/graph-width-padded:
  pretty.c: support <direction>|(<negative number>) forms
  pretty: pass graph width to pretty formatting for use in '%>|(N)'

7 years agoMerge branch 'jk/add-i-diff-compact-heuristics' into maint
Junio C Hamano [Mon, 11 Jul 2016 17:44:09 +0000 (10:44 -0700)] 
Merge branch 'jk/add-i-diff-compact-heuristics' into maint

"git add -i/-p" learned to honor diff.compactionHeuristic
experimental knob, so that the user can work on the same hunk split
as "git diff" output.

* jk/add-i-diff-compact-heuristics:
  add--interactive: respect diff.compactionHeuristic

7 years agohoist out handle_nonblock function for xread and xwrite
Eric Wong [Sun, 10 Jul 2016 08:20:46 +0000 (08:20 +0000)] 
hoist out handle_nonblock function for xread and xwrite

At least for me, this improves the readability of xread and
xwrite; hopefully allowing missing "continue" statements to
be spotted more easily.

Signed-off-by: Eric Wong <e@80x24.org>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoam: counteract gender bias
Johannes Schindelin [Fri, 8 Jul 2016 07:17:34 +0000 (09:17 +0200)] 
am: counteract gender bias

Since 47f0b6d5 (Fall back to three-way merge when applying a patch.,
2005-10-06), i.e. for almost 11 years already, we used a male form
to describe "the other tree".

While it was unintended, this gave the erroneous impression as if
the Git developers thought of users as male, and were unaware of the
important role in software development played by female actors such
as Ada Lovelace, Grace Hopper and Margaret Hamilton. In fact, the
first professional software developers were all female.

Let's change those unfortunate references to the gender neutral
"their tree".  Doing so also makes the fallback_merge_recursive(),
which is an oddball, more in line with the other parts of the system
where we contrast what we have vs what we obtain from others by
saying "ours" vs "theirs".  This inconsistency was also unintended.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agonotes-merge: use O_EXCL to avoid overwriting existing files
René Scharfe [Thu, 7 Jul 2016 20:08:30 +0000 (22:08 +0200)] 
notes-merge: use O_EXCL to avoid overwriting existing files

Use the open(2) flag O_EXCL to ensure the file doesn't already exist
instead of (racily) calling stat(2) through file_exists().  While at it
switch to xopen() to reduce code duplication and get more consistent
error messages.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoMore fixes for 2.9.1
Junio C Hamano [Wed, 6 Jul 2016 20:08:02 +0000 (13:08 -0700)] 
More fixes for 2.9.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoMerge branch 'jc/deref-tag' into maint
Junio C Hamano [Wed, 6 Jul 2016 20:06:46 +0000 (13:06 -0700)] 
Merge branch 'jc/deref-tag' into maint

Code clean-up.

* jc/deref-tag:
  blame, line-log: do not loop around deref_tag()

7 years agoMerge branch 'pb/strbuf-read-file-doc' into maint
Junio C Hamano [Wed, 6 Jul 2016 20:06:45 +0000 (13:06 -0700)] 
Merge branch 'pb/strbuf-read-file-doc' into maint

Minor doc update.

* pb/strbuf-read-file-doc:
  strbuf: describe the return value of strbuf_read_file

7 years agoMerge branch 'jk/fetch-prune-doc' into maint
Junio C Hamano [Wed, 6 Jul 2016 20:06:44 +0000 (13:06 -0700)] 
Merge branch 'jk/fetch-prune-doc' into maint

Minor doc update.

* jk/fetch-prune-doc:
  fetch: document that pruning happens before fetching

7 years agoMerge branch 'pc/occurred' into maint
Junio C Hamano [Wed, 6 Jul 2016 20:06:43 +0000 (13:06 -0700)] 
Merge branch 'pc/occurred' into maint

Typofix.

* pc/occurred:
  config.c: fix misspelt "occurred" in an error message
  refs.h: fix misspelt "occurred" in a comment

7 years agoMerge branch 'mg/cherry-pick-multi-on-unborn' into maint
Junio C Hamano [Wed, 6 Jul 2016 20:06:42 +0000 (13:06 -0700)] 
Merge branch 'mg/cherry-pick-multi-on-unborn' into maint

"git cherry-pick A" worked on an unborn branch, but "git
cherry-pick A..B" didn't.

* mg/cherry-pick-multi-on-unborn:
  cherry-pick: allow to pick to unborn branches

7 years agoMerge branch 'em/newer-freebsd-shells-are-fine-with-returns' into maint
Junio C Hamano [Wed, 6 Jul 2016 20:06:41 +0000 (13:06 -0700)] 
Merge branch 'em/newer-freebsd-shells-are-fine-with-returns' into maint

Comments about misbehaving FreeBSD shells have been clarified with
the version number (9.x and before are broken, newer ones are OK).

* em/newer-freebsd-shells-are-fine-with-returns:
  rebase: update comment about FreeBSD /bin/sh

7 years agoMerge branch 'lv/status-say-working-tree-not-directory' into maint
Junio C Hamano [Wed, 6 Jul 2016 20:06:40 +0000 (13:06 -0700)] 
Merge branch 'lv/status-say-working-tree-not-directory' into maint

"git status" used to say "working directory" when it meant "working
tree".

* lv/status-say-working-tree-not-directory:
  Use "working tree" instead of "working directory" for git status

7 years agoMerge branch 'nb/gnome-keyring-build' into maint
Junio C Hamano [Wed, 6 Jul 2016 20:06:40 +0000 (13:06 -0700)] 
Merge branch 'nb/gnome-keyring-build' into maint

Build improvements for gnome-keyring (in contrib/)

* nb/gnome-keyring-build:
  gnome-keyring: Don't hard-code pkg-config executable

7 years agoMerge branch 'et/add-chmod-x' into maint
Junio C Hamano [Wed, 6 Jul 2016 20:06:39 +0000 (13:06 -0700)] 
Merge branch 'et/add-chmod-x' into maint

"git update-index --add --chmod=+x file" may be usable as an escape
hatch, but not a friendly thing to force for people who do need to
use it regularly.  "git add --chmod=+x file" can be used instead.

* et/add-chmod-x:
  add: add --chmod=+x / --chmod=-x options

7 years agoMerge branch 'jk/avoid-unbounded-alloca' into maint
Junio C Hamano [Wed, 6 Jul 2016 20:06:39 +0000 (13:06 -0700)] 
Merge branch 'jk/avoid-unbounded-alloca' into maint

A codepath that used alloca(3) to place an unbounded amount of data
on the stack has been updated to avoid doing so.

* jk/avoid-unbounded-alloca:
  tree-diff: avoid alloca for large allocations

7 years agoMerge branch 'rj/compat-regex-size-max-fix' into maint
Junio C Hamano [Wed, 6 Jul 2016 20:06:38 +0000 (13:06 -0700)] 
Merge branch 'rj/compat-regex-size-max-fix' into maint

A compilation fix.

* rj/compat-regex-size-max-fix:
  regex: fix a SIZE_MAX macro redefinition warning

7 years agoMerge branch 'vs/prompt-avoid-unset-variable' into maint
Junio C Hamano [Wed, 6 Jul 2016 20:06:38 +0000 (13:06 -0700)] 
Merge branch 'vs/prompt-avoid-unset-variable' into maint

The git-prompt scriptlet (in contrib/) was not friendly with those
who uses "set -u", which has been fixed.

* vs/prompt-avoid-unset-variable:
  git-prompt.sh: Don't error on null ${ZSH,BASH}_VERSION, $short_sha

7 years agoMerge branch 'sg/reflog-past-root' into maint
Junio C Hamano [Wed, 6 Jul 2016 20:06:37 +0000 (13:06 -0700)] 
Merge branch 'sg/reflog-past-root' into maint

"git reflog" stopped upon seeing an entry that denotes a branch
creation event (aka "unborn"), which made it appear as if the
reflog was truncated.

* sg/reflog-past-root:
  reflog: continue walking the reflog past root commits

7 years agoMerge branch 'dn/gpg-doc' into maint
Junio C Hamano [Wed, 6 Jul 2016 20:06:36 +0000 (13:06 -0700)] 
Merge branch 'dn/gpg-doc' into maint

The documentation tries to consistently spell "GPG"; when
referring to the specific program name, "gpg" is used.

* dn/gpg-doc:
  Documentation: GPG capitalization

7 years agoMerge branch 'ap/git-svn-propset-doc' into maint
Junio C Hamano [Wed, 6 Jul 2016 20:06:35 +0000 (13:06 -0700)] 
Merge branch 'ap/git-svn-propset-doc' into maint

"git svn propset" subcommand that was added in 2.3 days is
documented now.

* ap/git-svn-propset-doc:
  git-svn: document the 'git svn propset' command

7 years agoMerge branch 'tr/doc-tt' into maint
Junio C Hamano [Wed, 6 Jul 2016 20:06:34 +0000 (13:06 -0700)] 
Merge branch 'tr/doc-tt' into maint

The documentation set has been updated so that literal commands,
configuration variables and environment variables are consistently
typeset in fixed-width font and bold in manpages.

* tr/doc-tt:
  doc: change configuration variables format
  doc: more consistency in environment variables format
  doc: change environment variables format
  doc: clearer rule about formatting literals

7 years agot7610: test for mktemp before test execution
Armin Kunaschik [Sat, 2 Jul 2016 19:01:51 +0000 (21:01 +0200)] 
t7610: test for mktemp before test execution

mktemp is not available on all platforms, so the test
'temporary filenames are used with mergetool.writeToTemp'
fails there.
This patch does not replace mktemp but just disables
the test that otherwise would fail.
mergetool checks itself before executing mktemp and
reports an error.

Signed-off-by: Armin Kunaschik <megabreit@googlemail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agomailmap: use main email address for dturner
David Turner [Mon, 4 Jul 2016 06:05:24 +0000 (02:05 -0400)] 
mailmap: use main email address for dturner

Signed-off-by: David Turner <novalis@novalis.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agot/lib-git-daemon: use test_match_signal
Jeff King [Fri, 24 Jun 2016 19:45:12 +0000 (15:45 -0400)] 
t/lib-git-daemon: use test_match_signal

When git-daemon exits, we expect it to be with the SIGTERM
we just sent it. If we see anything else, we'll complain.
But our check against exit code "143" is not portable. For
example:

  $ ksh93 t5570-git-daemon.sh
  [...]
  error: git daemon exited with status: 271

We can fix this by using test_match_signal.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agotest_must_fail: use test_match_signal
Jeff King [Fri, 24 Jun 2016 19:45:04 +0000 (15:45 -0400)] 
test_must_fail: use test_match_signal

In 8bf4bec (add "ok=sigpipe" to test_must_fail and use it to
fix flaky tests, 2015-11-27), test_must_fail learned to
recognize "141" as a sigpipe failure. However, testing for
a signal is more complicated than that; we should use
test_match_signal to implement more portable checking.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agot0005: use test_match_signal as appropriate
Jeff King [Fri, 24 Jun 2016 19:44:50 +0000 (15:44 -0400)] 
t0005: use test_match_signal as appropriate

The first test already uses this more portable construct
(that was where it was factored from initially), but the
later tests do a raw comparison against 141 to look for
SIGPIPE, which can fail on some shells and platforms.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agotests: factor portable signal check out of t0005
Jeff King [Thu, 30 Jun 2016 08:16:18 +0000 (04:16 -0400)] 
tests: factor portable signal check out of t0005

In POSIX shells, a program which exits due to a signal
generally has an exit code of 128 plus the signal number.
However, ksh uses 256 plus the signal number.  We've
accounted for that in t0005, but not in other tests.  Let's
pull out the logic so we can use it elsewhere.

It would be nice for debugging if this additionally printed
errors to stderr, like our other test_* helpers. But we're
going to need to use it in other places besides the innards
of a test_expect block. So let's leave it as generic as
possible.

Note that we also leave the magic "3" for Windows out of the
generic helper. This is an artifact of the way we use
raise() to kill ourselves in test-sigchain.c, and will not
necessarily apply to all programs. So it's better to keep it
out of the helper, to reduce the chance of confusing it with
a real call to exit(3).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agogrep: fix grepping for "intent to add" files
Charles Bailey [Thu, 30 Jun 2016 10:13:48 +0000 (11:13 +0100)] 
grep: fix grepping for "intent to add" files

This reverts commit 4d5520053 (grep: make it clear i-t-a entries are
ignored, 2015-12-27) and adds an alternative fix to maintain the -L
--cached behavior.

4d5520053 caused 'git grep' to no longer find matches in new files in
the working tree where the corresponding index entry had the "intent to
add" bit set, despite the fact that these files are tracked.

The content in the index of a file for which the "intent to add" bit is
set is considered indeterminate and not empty. For most grep queries we
want these to behave the same, however for -L --cached (files without a
match) we don't want to respond positively for "intent to add" files as
their contents are indeterminate. This is in contrast to files with
empty contents in the index (no lines implies no matches for any grep
query expression) which should be reported in the output of a grep -L
--cached invocation.

Add tests to cover this case and a few related cases which previously
lacked coverage.

Helped-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Charles Bailey <cbailey32@bloomberg.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agot7810-grep.sh: fix a whitespace inconsistency
Charles Bailey [Thu, 30 Jun 2016 10:13:47 +0000 (11:13 +0100)] 
t7810-grep.sh: fix a whitespace inconsistency

Signed-off-by: Charles Bailey <charles@hashpling.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agot7810-grep.sh: fix duplicated test name
Charles Bailey [Thu, 30 Jun 2016 10:13:46 +0000 (11:13 +0100)] 
t7810-grep.sh: fix duplicated test name

Signed-off-by: Charles Bailey <charles@hashpling.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agogrep.c: reuse "icase" variable
Nguyễn Thái Ngọc Duy [Sat, 25 Jun 2016 05:22:38 +0000 (07:22 +0200)] 
grep.c: reuse "icase" variable

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agodiffcore-pickaxe: support case insensitive match on non-ascii
Nguyễn Thái Ngọc Duy [Sat, 25 Jun 2016 05:22:37 +0000 (07:22 +0200)] 
diffcore-pickaxe: support case insensitive match on non-ascii

Similar to the "grep -F -i" case, we can't use kws on icase search
outside ascii range, so we quote the string and pass it to regcomp as
a basic regexp and let regex engine deal with case sensitivity.

The new test is put in t7812 instead of t4209-log-pickaxe because
lib-gettext.sh might cause problems elsewhere, probably.

Noticed-by: Plamen Totev <plamen.totev@abv.bg>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agodiffcore-pickaxe: Add regcomp_or_die()
Nguyễn Thái Ngọc Duy [Sat, 25 Jun 2016 05:22:36 +0000 (07:22 +0200)] 
diffcore-pickaxe: Add regcomp_or_die()

There's another regcomp code block coming in this function that needs
the same error handling. This function can help avoid duplicating
error handling code.

Helped-by: Jeff King <peff@peff.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agogrep/pcre: support utf-8
Nguyễn Thái Ngọc Duy [Sat, 25 Jun 2016 05:22:35 +0000 (07:22 +0200)] 
grep/pcre: support utf-8

In the previous change in this function, we add locale support for
single-byte encodings only. It looks like pcre only supports utf-* as
multibyte encodings, the others are left in the cold (which is
fine).

We need to enable PCRE_UTF8 so pcre can find character boundary
correctly. It's needed for case folding (when --ignore-case is used)
or '*', '+' or similar syntax is used.

The "has_non_ascii()" check is to be on the conservative side. If
there's non-ascii in the pattern, the searched content could still be
in utf-8, but we can treat it just like a byte stream and everything
should work. If we force utf-8 based on locale only and pcre validates
utf-8 and the file content is in non-utf8 encoding, things break.

Noticed-by: Plamen Totev <plamen.totev@abv.bg>
Helped-by: Plamen Totev <plamen.totev@abv.bg>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agogettext: add is_utf8_locale()
Nguyễn Thái Ngọc Duy [Sat, 25 Jun 2016 05:22:34 +0000 (07:22 +0200)] 
gettext: add is_utf8_locale()

This function returns true if git is running under an UTF-8
locale. pcre in the next patch will need this.

is_encoding_utf8() is used instead of strcmp() to catch both "utf-8"
and "utf8" suffixes.

When built with no gettext support, we peek in several env variables
to detect UTF-8. pcre library might support utf-8 even if libc is
built without locale support.. The peeking code is a copy from
compat/regex/regcomp.c

Helped-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agogrep/pcre: prepare locale-dependent tables for icase matching
Nguyễn Thái Ngọc Duy [Sat, 25 Jun 2016 05:22:33 +0000 (07:22 +0200)] 
grep/pcre: prepare locale-dependent tables for icase matching

The default tables are usually built with C locale and only suitable
for LANG=C or similar.  This should make case insensitive search work
correctly for all single-byte charsets.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agogrep: rewrite an if/else condition to avoid duplicate expression
Nguyễn Thái Ngọc Duy [Sat, 25 Jun 2016 05:22:32 +0000 (07:22 +0200)] 
grep: rewrite an if/else condition to avoid duplicate expression

"!icase || ascii_only" is repeated twice in this if/else chain as this
series evolves. Rewrite it (and basically revert the first if
condition back to before the "grep: break down an "if" stmt..." commit).

Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agogrep/icase: avoid kwsset when -F is specified
Nguyễn Thái Ngọc Duy [Sat, 25 Jun 2016 05:22:31 +0000 (07:22 +0200)] 
grep/icase: avoid kwsset when -F is specified

Similar to the previous commit, we can't use kws on icase search
outside ascii range. But we can't simply pass the pattern to
regcomp/pcre like the previous commit because it may contain regex
special characters, so we need to quote the regex first.

To avoid misquote traps that could lead to undefined behavior, we
always stick to basic regex engine in this case. We don't need fancy
features for grepping a literal string anyway.

basic_regex_quote_buf() assumes that if the pattern is in a multibyte
encoding, ascii chars must be unambiguously encoded as single
bytes. This is true at least for UTF-8. For others, let's wait until
people yell up. Chances are nobody uses multibyte, non utf-8 charsets
anymore.

Noticed-by: Plamen Totev <plamen.totev@abv.bg>
Helped-by: René Scharfe <l.s.r@web.de>
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agocommit -S: avoid invalid pointer with empty message
Johannes Schindelin [Wed, 29 Jun 2016 14:14:54 +0000 (16:14 +0200)] 
commit -S: avoid invalid pointer with empty message

While it is not recommended, fsck.c says:

Not having a body is not a crime [...]

... which means that we cannot assume that the commit buffer
contains an empty line to separate header from body.  A commit
object with only a header without any body, not even without
a blank line after the header, is valid.

So let's tread carefully here.  strstr("\n\n") may find nothing
and return NULL.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoreset --hard: skip blank lines when reporting the commit subject
Johannes Schindelin [Wed, 29 Jun 2016 14:14:50 +0000 (16:14 +0200)] 
reset --hard: skip blank lines when reporting the commit subject

When there are blank lines at the beginning of a commit message, the
pretty printing machinery already skips them when showing a commit
subject (or the complete commit message). We shall henceforth do the
same when reporting the commit subject after the user called

git reset --hard <commit>

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agosequencer: use skip_blank_lines() to find the commit subject
Johannes Schindelin [Wed, 29 Jun 2016 14:14:46 +0000 (16:14 +0200)] 
sequencer: use skip_blank_lines() to find the commit subject

Just like we already taught the find_commit_subject() function (to make
it consistent with the code in pretty.c), we now simply skip leading
blank lines of the commit message.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agocommit -C: skip blank lines at the beginning of the message
Johannes Schindelin [Wed, 29 Jun 2016 14:14:42 +0000 (16:14 +0200)] 
commit -C: skip blank lines at the beginning of the message

Consistent with the pretty-printing machinery, we skip leading blank
lines (if any) of existing commit messages.

While Git itself only produces commit objects with a single empty line
between commit header and commit message, it is legal to have more than
one blank line (i.e. lines containing only white space, or no
characters) at the beginning of the commit message, and the
pretty-printing code already handles that.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agot3404: fix a grammo (commands are ran -> commands are run)
Johannes Schindelin [Wed, 29 Jun 2016 14:31:03 +0000 (16:31 +0200)] 
t3404: fix a grammo (commands are ran -> commands are run)

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agorebase -i: restore autostash on abort
Patrick Steinhardt [Wed, 29 Jun 2016 06:21:27 +0000 (08:21 +0200)] 
rebase -i: restore autostash on abort

When we abort an interactive rebase we do so by calling
`die_abort`, which cleans up after us by removing the rebase
state directory. If the user has requested to use the autostash
feature, though, the state directory may also contain a reference
to the autostash, which will now be deleted.

Fix the issue by trying to re-apply the autostash in `die_abort`.
This will also handle the case where the autostash does not apply
cleanly anymore by recording it in a user-visible stash.

Reported-by: Daniel Hahler <git@thequod.de>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agocontrib/subtree: Add a test for subtree rebase that loses commits
David A. Greene [Tue, 28 Jun 2016 10:54:02 +0000 (05:54 -0500)] 
contrib/subtree: Add a test for subtree rebase that loses commits

This test merges an external tree in as a subtree, makes some commits
on top of it and splits it back out.  In the process the added commits
are lost or the rebase aborts with an internal error.  The tests are
marked to expect failure so that we don't forget to fix it.

Signed-off-by: David A. Greene <greened@obbligato.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agocolor.h: remove obsolete comment about limitations on Windows
Johannes Schindelin [Tue, 28 Jun 2016 10:02:49 +0000 (12:02 +0200)] 
color.h: remove obsolete comment about limitations on Windows

Originally, ANSI color sequences were supported on Windows only by
overriding the printf() and fprintf() functions, as mentioned in e7821d7
(Add a notice that only certain functions can print color escape codes,
2009-11-27).

As of eac14f8 (Win32: Thread-safe windows console output, 2012-01-14),
however, this is no longer the case, as the ANSI color sequence support
code needed to be replaced with a thread-safe version, one side effect
being that stdout and stderr handled no matter which function is used to
write to it.

So let's just remove the comment that is now obsolete.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agodoc: typeset HEAD and variants as literal
Matthieu Moy [Tue, 28 Jun 2016 11:40:15 +0000 (13:40 +0200)] 
doc: typeset HEAD and variants as literal

This is an application of the newly added CodingGuidelines to HEAD and
variants like FETCH_HEAD. It was obtained with:

  perl -pi -e "s/'([A-Z_]*HEAD)'/\`\$1\`/g" *.txt

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoCodingGuidelines: formatting HEAD in documentation
Matthieu Moy [Tue, 28 Jun 2016 11:40:14 +0000 (13:40 +0200)] 
CodingGuidelines: formatting HEAD in documentation

The current practice is:

git/Documentation$ git grep "'HEAD'" | wc -l
24
git/Documentation$ git grep "\`HEAD\`" | wc -l
66

Let's adopt the majority as a guideline.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agodoc: typeset long options with argument as literal
Matthieu Moy [Tue, 28 Jun 2016 11:40:13 +0000 (13:40 +0200)] 
doc: typeset long options with argument as literal

We previously reformatted '--option' to `--option`. This patch reformats
'--option <arg>' to `--option <arg>`. Obtained with:

  perl -pi -e "s/'(--[a-z][a-z=<>-]* <[^>]*>)'/\`\$1\`/g" *.txt

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>