t4011: modernise style

Match the style to more modern test scripts, namely:

 - The first line of each test has prereq, title and opening sq for the
   script body.  This makes the test shorter while reducing the need for
   backslashes.

 - Be prepared for the case in which the previous test may have failed.
   If a test wants to start from not having "frotz" that the previous test
   may have created, write "rm -f frotz", not "rm frotz".

 - Prepare the expected output inside your own test.

 - The order of comparison to check the result is "diff expected actual",
   so that the output will show how the output from the git you just broke
   is different from what is expected.

 - Write no SP between redirection '>' (or '<' for that matter) and the
   filename.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
t4011: illustrate "diff-index -p" on stat-dirty paths

The plumbing that looks at the working tree, i.e. "diff-index" and
"diff-files", always emit the "diff --git a/path b/path" header lines
without anything else for paths that are only stat-dirty (i.e. different
only because the cached stat information in the index no longer matches
that of the working tree, but the real contents are the same), when
these commands are run with "-p" option to produce patches.

Illustrate this current behaviour.  Also demonstrate that with the "-w"
option, we (correctly) hold off showing a "diff --git" header until actual
differences have been found.  This also suppresses the header for merely
stat-dirty files, which is inconsistent.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff -p: squelch "diff --git" header for stat-dirty paths

The plumbing "diff" commands look at the working tree files without
refreshing the index themselves for performance reasons (the calling
script is expected to do that upfront just once, before calling one or
more of them).  In the early days of git, they showed the "diff --git"
header before they actually ask the xdiff machinery to produce patches,
and ended up showing only these headers if the real contents are the same
and the difference they noticed was only because the stat info cached in
the index did not match that of the working tree. It was too late for the
implementation to take the header that it already emitted back.

But 3e97c7c (No diff -b/-w output for all-whitespace changes, 2009-11-19)
introduced necessary logic to keep the meta-information headers in a
strbuf and delay their output until the xdiff machinery noticed actual
changes. This was primarily in order to generate patches that ignore
whitespaces. When operating under "-w" mode, we wouldn't know if the
header is needed until we actually look at the resulting patch, so it was
a sensible thing to do, but we did not realize that the same reasoning
applies to stat-dirty paths.

Later, 296c6bb (diff: fix "git show -C -C" output when renaming a binary
file, 2010-05-26) generalized this machinery and added must_show_header
toggle.  This is turned on when the header must be shown even when there
is no patch to be produced, e.g. only the mode was changed, or the path
was renamed, without changing the contents.  However, when it did so, it
still kept the special case for the "-w" mode, which meant that the
plumbing would keep showing these phantom changes.

This corrects this historical inconsistency by allowing the plumbing to
omit paths that are only stat-dirty from its output in the same way as it
handles whitespace only changes under "-w" option.

The change in the behaviour can be seen in the updated test.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
t5510: refactor bundle->pack conversion

It's not so much a conversion as a "strip everything up to and
including the first blank line", but it will come in handy again.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t5510: ensure we stay in the toplevel test dir

The last test descended into a subdir without ever re-emerging, which
is not so nice to the next test writer.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
bundle: keep around names passed to add_pending_object()

The 'name' field passed to add_pending_object() is used to later
deduplicate in object_array_remove_duplicates().

git-bundle had a bug in this area since 18449ab (git-bundle: avoid
packing objects which are in the prerequisites, 2007-03-08): it passed
the name of each boundary object in a static buffer.  In other words,
all that object_array_remove_duplicates() saw was the name of the
*last* added boundary object.

The recent switch to a strbuf in bc2fed4 (bundle: use a strbuf to scan
the log for boundary commits, 2012-02-22) made this slightly worse: we
now free the buffer at the end, so it is not even guaranteed that it
still points into addressable memory by the time object_array_remove_
duplicates looks at it.  On the plus side however, it was now
detectable by valgrind.

The fix is easy: pass a copy of the string to add_pending_object.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Merge branch 'cn/maint-branch-with-bad'

* cn/maint-branch-with-bad:
  branch: don't assume the merge filter ref exists

Conflicts:
	t/t3200-branch.sh
Merge branch 'cn/maint-rev-list-doc'

* cn/maint-rev-list-doc:
  Documentation: use {asterisk} in rev-list-options.txt when needed
Merge branch 'jn/maint-gitweb-invalid-regexp'

* jn/maint-gitweb-invalid-regexp:
  gitweb: Handle invalid regexp in regexp search
Merge branch 'nd/maint-verify-objects'

* nd/maint-verify-objects:
  rev-list: fix --verify-objects --quiet becoming --objects
  rev-list: remove BISECT_SHOW_TRIED flag
Merge branch 'maint'

* maint:
  Documentation fixes in git-config
Update l10n guide: change the repository URL, etc

Host the l10n coordinator repository in a dedicated github organization
account "git-l10n", so that the team may have a more permanent home.
Also add a hint about reference of TEAMS file for l10n contributors.

Update TEAMS file with new zh_CN l10n team members and a repository URL.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Merge branch 'master' of https://github.com/git-l10n/git-po into l10n

* 'master' of https://github.com/git-l10n/git-po:
  l10n: leave leading space unchanged for zh_CN.po
Merge the initial l10n effort in

* l10n:
  Update l10n guide: change the repository URL, etc
  l10n: leave leading space unchanged for zh_CN.po
  Update l10n guide
  l10n: update Chinese translation to the new git.po
  l10n: Update git.pot (12 new messages)
  l10n: fast-forward here is ff-only merge, not push
  l10n: update zh_CN translation for "Fetching %s"
  l10n: po for zh_CN
  l10n: initial git.pot for 1.7.10 upcoming release
Merge branch 'th/git-diffall'

* th/git-diffall:
  contrib: add git-diffall script
Merge branch 'rs/no-no-no-parseopt'

* rs/no-no-no-parseopt:
  parse-options: remove PARSE_OPT_NEGHELP
  parse-options: allow positivation of options starting, with no-
  test-parse-options: convert to OPT_BOOL()

Conflicts:
	builtin/grep.c
Merge branch 'cb/fsck-squelch-dangling'

* cb/fsck-squelch-dangling:
  fsck: --no-dangling omits "dangling object" information
l10n: Improve zh_CN translation for lines insertion and deletion.

Signed-off-by: Thynson <lanxingcan@gmail.com>
l10n: Improve zh_CN translation for msg about branch deletion deny

Signed-off-by: Thynson <lanxingcan@gmail.com>
Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
l10n: Improve zh_CN translation for empty cherry-pick msg.

Signed-off-by: Thynson <lanxingcan@gmail.com>
Signed-off-by: Jiang Xin <worldhello.net@gmail.com>