Commit graph

6877 commits

Author SHA1 Message Date
Jeff King 74eb32d3a4 receive-pack: drop "n/a" on unpacker errors
The output from git push currently looks like this:

  $ git push dest HEAD
  fatal: [some message from index-pack]
  error: unpack failed: index-pack abnormal exit
  To dest
   ! [remote rejected] HEAD -> master (n/a (unpacker error))

That n/a is meant to be "the per-ref status is not
available" but the nested parentheses just make it look
ugly. Let's turn the final line into just:

   ! [remote rejected] HEAD -> master (unpacker error)

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-21 09:50:13 -07:00
Junio C Hamano f9c2d2b14e Merge branch 'nd/maint-remote-remove' into maint
* nd/maint-remote-remove:
  remote: prefer subcommand name 'remove' to 'rm'
2012-09-20 15:53:31 -07:00
Ralf Thielow 31b808a032 clone --single: limit the fetch refspec to fetched branch
After running "git clone --single", the resulting repository has the
usual default "+refs/heads/*:refs/remotes/origin/*" wildcard fetch
refspec installed, which means that a subsequent "git fetch" will
end up grabbing all the other branches.

Update the fetch refspec to cover only the singly cloned ref instead
to correct this.

That means:
If "--single" is used without "--branch" or "--mirror", the
fetch refspec covers the branch on which remote's HEAD points to.
If "--single" is used with "--branch", it'll cover only the branch
specified in the "--branch" option.
If "--single" is combined with "--mirror", then it'll cover all
refs of the cloned repository.
If "--single" is used with "--branch" that specifies a tag, then
it'll cover only the ref for this tag.

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-20 14:15:35 -07:00
Shawn O. Pearce aa90b9697f Enable info/refs gzip decompression in HTTP client
Some HTTP servers try to use gzip compression on the /info/refs
request to save transfer bandwidth. Repositories with many tags
may find the /info/refs request can be gzipped to be 50% of the
original size due to the few but often repeated bytes used (hex
SHA-1 and commonly digits in tag names).

For most HTTP requests enable "Accept-Encoding: gzip" ensuring
the /info/refs payload can use this encoding format.

Only request gzip encoding from servers. Although deflate is
supported by libcurl, most servers have standardized on gzip
encoding for compression as that is what most browsers support.
Asking for deflate increases request sizes by a few bytes, but is
unlikely to ever be used by a server.

Disable the Accept-Encoding header on probe RPCs as response bodies
are supposed to be exactly 4 bytes long, "0000". The HTTP headers
requesting and indicating compression use more space than the data
transferred in the body.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-20 10:26:50 -07:00
Junio C Hamano 3d7535e424 Merge branch 'jc/maint-log-grep-all-match'
Fix a long-standing bug in "git log --grep" when multiple "--grep"
are used together with "--all-match" and "--author" or "--committer".

* jc/maint-log-grep-all-match:
  t7810-grep: test --all-match with multiple --grep and --author options
  t7810-grep: test interaction of multiple --grep and --author options
  t7810-grep: test multiple --author with --all-match
  t7810-grep: test multiple --grep with and without --all-match
  t7810-grep: bring log --grep tests in common form
  grep.c: mark private file-scope symbols as static
  log: document use of multiple commit limiting options
  log --grep/--author: honor --all-match honored for multiple --grep patterns
  grep: show --debug output only once
  grep: teach --debug option to dump the parse tree
2012-09-18 14:37:54 -07:00
Junio C Hamano 8db3865936 Merge branch 'pw/p4-submit-conflicts'
Add '--conflict' option to git-p4 subcommand to specify what action
to take when conflicts are found during 'p4 submit'.

* pw/p4-submit-conflicts:
  git-p4: add submit --conflict option and config varaiable
  git p4: add submit --prepare-p4-only option
  git p4: add submit --dry-run option
  git p4: accept -v for --verbose
  git p4: revert deleted files after submit cancel
  git p4: rearrange submit template construction
  git p4: test clean-up after failed submit, fix added files
  git p4: standardize submit cancel due to unchanged template
  git p4: move conflict prompt into run, add [q]uit input
  git p4: remove submit failure options [a]pply and [w]rite
  git p4: gracefully fail if some commits could not be applied
  git p4 test: remove bash-ism of combined export/assignment
2012-09-18 14:36:17 -07:00
Junio C Hamano 3387423870 Merge branch 'mv/cherry-pick-s'
After "git cherry-pick -s" gave control back to the user asking
help to resolve conflicts, concluding "git commit" needs to be run
with "-s" if the user wants to sign it off, but the command should
be able to remember that.

* mv/cherry-pick-s:
  cherry-pick: don't forget -s on failure
2012-09-18 14:36:00 -07:00
Ramkumar Ramachandra 2006f0adae t/test-lib: make sure Git has already been built
When tests were run without building git, they stopped with:

    .: 54: Can't open /path/to/git/source/t/../GIT-BUILD-OPTIONS

Move the check that makes sure that git has already been built from
t0000 to test-lib, so that any test will do so before it runs.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-18 14:22:19 -07:00
Johannes Sixt ecfe1ea96f rebase -i: fix misleading error message after 'exec no-such' instruction
When the todo sheet of interactive rebase instructs to run a non-existing
command, the operation stops with the following error:

  Execution failed: no-such
  You can fix the problem, and then run

          git rebase --continue

  fatal: 'rebase' appears to be a git command, but we were not
  able to execute it. Maybe git-rebase is broken?

The reason is that the shell that attempted to run the command exits with
code 127. rebase--interactive just forwards this code to the caller (the
git wrapper). But our smart run-command infrastructure detects this
special exit code and turns it into ENOENT, which in turn is interpreted
by the git wrapper as if the external command that it just executed did
not exist. This is finally translated to the misleading last two lines in
error message cited above.

Fix it by translating the error code before it is forwarded.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-18 13:27:45 -07:00
Junio C Hamano 1b3185fc2b MALLOC_CHECK: various clean-ups
The most important in this change is to avoid affecting anything
when test-lib is used from perf-lib.  It also limits the effect of
the MALLOC_CHECK only to what is run inside the actual test, and
uses a fixed MALLOC_PERTURB_ in order to avoid hurting repeatability
of the tests.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-17 22:00:27 -07:00
Andrew Wong 9f4981bac6 rebase -i: Add tests for "--edit-todo"
Signed-off-by: Andrew Wong <andrew.kw.w@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-17 20:59:18 -07:00
Junio C Hamano b61f55be00 Merge branch 'maint'
* maint:
  t/perf: add "trash directory" to .gitignore
  Add missing -z to git check-attr usage text for consistency with man page
  git-jump: ignore (custom) prefix in diff mode
  Documentation: indent-with-non-tab uses "equivalent tabs" not 8
  completion: add --no-edit to git-commit
2012-09-17 15:59:34 -07:00
Junio C Hamano 26f4f2c74e Merge branch 'mh/fetch-filter-refs'
Code simplification and clarification.

* mh/fetch-filter-refs:
  test-string-list.c: Fix some sparse warnings
  fetch-pack: eliminate spurious error messages
  cmd_fetch_pack(): simplify computation of return value
  fetch-pack: report missing refs even if no existing refs were received
  cmd_fetch_pack(): return early if finish_connect() fails
  filter_refs(): simplify logic
  filter_refs(): build refs list as we go
  filter_refs(): delete matched refs from sought list
  fetch_pack(): update sought->nr to reflect number of unique entries
  filter_refs(): do not check the same sought_pos twice
  Change fetch_pack() and friends to take string_list arguments
  fetch_pack(): reindent function decl and defn
  Rename static function fetch_pack() to http_fetch_pack()
  t5500: add tests of fetch-pack --all --depth=N $URL $REF
  t5500: add tests of error output for missing refs
2012-09-17 15:58:49 -07:00
Junio C Hamano 3b0b6b53d5 Merge branch 'mh/string-list'
* mh/string-list:
  api-string-list.txt: initialize the string_list the easy way
  string_list: add a function string_list_longest_prefix()
  string_list: add a new function, string_list_remove_duplicates()
  string_list: add a new function, filter_string_list()
  string_list: add two new functions for splitting strings
  string_list: add function string_list_append_nodup()
2012-09-17 15:53:31 -07:00
Junio C Hamano 992311cf86 Merge branch 'jc/maint-blame-no-such-path'
"git blame MAKEFILE" run in a history that has "Makefile" but not
"MAKEFILE" should say "No such file MAKEFILE in HEAD", but got
confused on a case insensitive filesystem and failed to do so.

Even during a conflicted merge, "git blame $path" always meant to
blame uncommitted changes to the "working tree" version; make it
more useful by showing cleanly merged parts as coming from the other
branch that is being merged.

* jc/maint-blame-no-such-path:
  blame: allow "blame file" in the middle of a conflicted merge
  blame $path: avoid getting fooled by case insensitive filesystems
2012-09-17 15:52:32 -07:00
Junio C Hamano 176943b965 mailinfo: do not concatenate charset= attribute values from mime headers
"Content-type: text/plain; charset=UTF-8" header should not appear
twice in the input, but it is always better to gracefully deal with
such a case.  The current code concatenates the value to the values
we have seen previously, producing nonsense such as "utf8UTF-8".

Instead of concatenating, forget the previous value and use the last
value we see.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-17 15:24:52 -07:00
Ramkumar Ramachandra 5805853f22 t/perf: add "trash directory" to .gitignore
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-17 14:27:55 -07:00
Adrian Johnson e90d065e64 Add userdiff patterns for Ada
Add Ada xfuncname and wordRegex patterns to the list of builtin
patterns.

Signed-off-by: Adrian Johnson <ajohnson@redneon.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-16 21:54:47 -07:00
Pete Wyckoff 6bbfd1372d git-p4: add submit --conflict option and config varaiable
This allows specifying what to do when a conflict
happens when applying a commit to p4, automating the
interactive prompt.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Acked-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-16 21:52:53 -07:00
Pete Wyckoff 728b7ad8bb git p4: add submit --prepare-p4-only option
This option can be used to prepare the client workspace for
submission, only.  It does not invoke the final "p4 submit".
A message describes how to proceed, either submitting the
changes or reverting.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Acked-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-16 21:52:52 -07:00
Pete Wyckoff ef739f0829 git p4: add submit --dry-run option
A new option, "git p4 submit --dry-run" can be used to verify
what commits and labels would be moved into p4.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Acked-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-16 21:52:52 -07:00
Pete Wyckoff df9c5453b2 git p4: revert deleted files after submit cancel
The user can decide not to continue with a submission,
by not saving the p4 submit template, then answering "no" to
the "Submit anyway?" prompt.  In this case, be sure to
return the p4 client to its initial state.

Deleted files were not reverted; fix this and test all cases.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Acked-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-16 21:52:52 -07:00
Pete Wyckoff f7fbc981a4 git p4: test clean-up after failed submit, fix added files
Test a variety of cases where a patch failed to apply to
p4 and had to be cleaned up.

If the patch failed to apply cleanly, do not try to remove
to-be-added files, as they have not really been added yet.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Acked-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-16 21:52:52 -07:00
Pete Wyckoff 5a41c16a81 git p4: standardize submit cancel due to unchanged template
When editing the submit template, if no change was made to it,
git p4 offers a prompt "Submit anyway?".  Answering "no" cancels
the submit.

Previously, a "no" answer behaves like a "[s]kip" answer to the
failed-patch prompt, in that it proceeded to try to apply the
rest of the commits.  Instead, put users back into the new
"[s]kip / [c]ontinue" loop so that they can decide.  This makes
both cases of patch failure behave identically.

The return code of git p4 after a "no" answer is now the same
as that for a "skip" due to failed patch; update a test to
understand this.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Acked-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-16 21:52:52 -07:00
Pete Wyckoff 7e5dd9f2cc git p4: move conflict prompt into run, add [q]uit input
When applying a commit to the p4 workspace fails, a prompt
asks what to do next.  This belongs up in run() instead
of in applyCommit(), where run() can notice, for instance,
that the prompt is unnecessary because this is the last commit.

Offer two options about how to continue at conflict: [s]kip or
[q]uit.  Having an explicit "quit" option gives git p4 a chance
to clean up, show the applied-commit summary, and do tag export.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Acked-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-16 21:52:52 -07:00
Pete Wyckoff 67b0fe2eb6 git p4: gracefully fail if some commits could not be applied
If a commit fails to apply cleanly to the p4 tree, an interactive
prompt asks what to do next.  In all cases (skip, apply, write),
the behavior after the prompt had a few problems.

Change it so that it does not claim erroneously that all commits
were applied.  Instead list the set of the patches under
consideration, and mark with an asterisk those that were
applied successfully.  Like this example:

    Applying 592f1f9 line5 in file1 will conflict
    ...
    Unfortunately applying the change failed!
    What do you want to do?
    [s]kip this patch / [a]pply the patch forcibly and with .rej files / [w]rite the patch to a file (patch.txt) s
    Skipping! Good luck with the next patches...
    //depot/file1#4 - was edit, reverted
    Applying b8db1c6 okay_commit_after_skip
    ...
    Change 6 submitted.
    Applied only the commits marked with '*':
      592f1f9 line5 in file1 will conflict
    * b8db1c6 okay_commit_after_skip

Do not try to sync and rebase unless all patches were applied.
If there was a conflict during the submit, there is sure to be one
at the rebase.  Let the user to do the sync and rebase manually.

This changes how a couple tets in t9810-git-p4-rcs.sh behave:

    - git p4 now does not leave files open and edited in the
      client

    - If a git commit contains a change to a file that was
      deleted in p4, the test used to check that the sync/rebase
      loop happened after the failure to apply the change.  Since
      now sync/rebase does not happen after failure, do not test
      this.  Normal rebase machinery, outside of git p4, will let
      rebase --skip work.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Acked-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-16 21:52:52 -07:00
Pete Wyckoff 8c29135086 git p4 test: remove bash-ism of combined export/assignment
Signed-off-by: Pete Wyckoff <pw@padd.com>
Acked-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-16 21:52:52 -07:00
Michael J Gruber 39f2e01720 t7810-grep: test --all-match with multiple --grep and --author options
The code used to have a bug that ignores "--all-match", that requires
all "--grep" to have matched, when "--author" or "--committer" was used.

Make sure the bug will not be reintroduced.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-15 23:35:40 -07:00
Michael J Gruber 2cb03e76a0 t7810-grep: test interaction of multiple --grep and --author options
There are tests for this interaction already. Restructure slightly and
avoid any claims about --all-match.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-15 23:35:40 -07:00
Michael J Gruber 00f62a64d4 t7810-grep: test multiple --author with --all-match
The "--all-match" option is about "--grep", and does not affect how
"--author" or "--committer" limitation is applied.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-15 23:35:40 -07:00
Michael J Gruber dfe3642515 t7810-grep: test multiple --grep with and without --all-match
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-15 23:35:40 -07:00
Michael J Gruber b327bf74bd t7810-grep: bring log --grep tests in common form
The log --grep tests generate the expected out in different ways.
Make them all use command blocks so that subshells are avoided and the
expected output is easier to grasp visually.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-15 23:35:39 -07:00
Junio C Hamano e6d29a4b47 Merge branch 'jc/ll-merge-binary-ours'
"git merge -Xtheirs" did not help content-level merge of binary
files; it should just take their version.  Also "*.jpg binary" in
the attributes did not imply they should use the binary ll-merge
driver.

* jc/ll-merge-binary-ours:
  ll-merge: warn about inability to merge binary files only when we can't
  attr: "binary" attribute should choose built-in "binary" merge driver
  merge: teach -Xours/-Xtheirs to binary ll-merge driver
2012-09-14 21:39:56 -07:00
Junio C Hamano 78ed88d80a Merge branch 'mz/cherry-pick-cmdline-order' into maint
* mz/cherry-pick-cmdline-order:
  cherry-pick/revert: respect order of revisions to pick
  demonstrate broken 'git cherry-pick three one two'
  teach log --no-walk=unsorted, which avoids sorting
2012-09-14 21:24:18 -07:00
Junio C Hamano c336bc104c Sync with 1.7.11.7 2012-09-14 21:20:40 -07:00
Junio C Hamano 19ece726e1 Merge branch 'jk/maint-quiet-is-synonym-to-s-in-log' into maint-1.7.11
* jk/maint-quiet-is-synonym-to-s-in-log:
  log: fix --quiet synonym for -s
2012-09-14 20:48:31 -07:00
Junio C Hamano dabdc0178e Merge branch 'rj/test-regex' into maint-1.7.11
* rj/test-regex:
  test-regex: Add a test to check for a bug in the regex routines
2012-09-14 20:46:39 -07:00
Elia Pinto a731fa916e Add MALLOC_CHECK_ and MALLOC_PERTURB_ libc env to the test suite for detecting heap corruption
Recent versions of Linux libc (later than 5.4.23) and glibc (2.x)
include a malloc() implementation which is tunable via environment
variables. When MALLOC_CHECK_ is set, a special (less efficient)
implementation is used which is designed to be tolerant against
simple errors, such as double calls of free() with the same argument,
or overruns of a single byte (off-by-one bugs). When MALLOC_CHECK_
is set to 3, a diagnostic message is printed on stderr
and the program is aborted.

Setting the MALLOC_PERTURB_ environment variable causes the malloc
functions in libc to return memory which has been wiped and clear
memory when it is returned.
Of course this does not affect calloc which always does clear the memory.

The reason for this exercise is, of course, to find code which uses
memory returned by malloc without initializing it and code which uses
code after it is freed. valgrind can do this but it's costly to run.
The MALLOC_PERTURB_ exchanges the ability to detect problems in 100%
of the cases with speed.

The byte value used to initialize values returned by malloc is the byte
value of the environment value. The value used to clear memory is the
bitwise inverse. Setting MALLOC_PERTURB_ to zero disables the feature.

This technique can find hard to detect bugs.
It is therefore suggested to always use this flag (at least temporarily)
when testing out code or a new distribution.

But the test suite can use also valgrind(memcheck) via 'make valgrind'
or 'make GIT_TEST_OPTS="--valgrind"'.

Memcheck wraps client calls to malloc(), and puts a "red zone" on
each end of each block in order to detect access overruns.
Memcheck already detects double free() (up to the limit of the buffer
which remembers pending free()). Thus memcheck subsumes all the
documented coverage of MALLOC_CHECK_.

If MALLOC_CHECK_ is set non-zero when running memcheck, then the
overruns that might be detected by MALLOC_CHECK_ would be overruns
on the wrapped blocks which include the red zones.  Thus MALLOC_CHECK_
would be checking memcheck, and not the client.  This is not useful,
and actually is wasteful.  The only possible [documented] advantage
of using MALLOC_CHECK_ and memcheck together, would be if MALLOC_CHECK_
detected duplicate free() in more cases than memcheck because memcheck's
buffer is too small.

Therefore we don't use MALLOC_CHECK_ and valgrind(memcheck) at the
same time.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-14 16:05:52 -07:00
Junio C Hamano 22ce37d27f Merge branch 'mh/abspath'
* mh/abspath:
  t0060: split absolute path test in two to exercise some of it on Windows
  t0060: verify that real_path() removes extra slashes
  real_path(): properly handle nonexistent top-level paths
  t0060: verify that real_path() works correctly with absolute paths
  real_path(): reject the empty string
  t0060: verify that real_path() fails if passed the empty string
  absolute_path(): reject the empty string
  t0060: verify that absolute_path() fails if passed the empty string
  t0060: move tests of real_path() from t0000 to here
2012-09-14 11:54:28 -07:00
Junio C Hamano 0f80d8943f Merge branch 'dj/fetch-all-tags'
"git fetch --all", when passed "--no-tags", did not honor the
"--no-tags" option while fetching from individual remotes (the same
issue existed with "--tags", but combination "--all --tags" makes
much less sense than "--all --no-tags").

* dj/fetch-all-tags:
  fetch --all: pass --tags/--no-tags through to each remote
2012-09-14 11:54:19 -07:00
Junio C Hamano 0ca416f166 Merge branch 'rj/tap-fix'
* rj/tap-fix:
  test-lib.sh: Suppress the "passed all ..." message if no tests run
  test-lib.sh: Add check for invalid use of 'skip_all' facility
  test-lib.sh: Fix some shell coding style violations
  t4016-*.sh: Skip all tests rather than each test
  t3902-*.sh: Skip all tests rather than each test
  t3300-*.sh: Fix a TAP parse error
2012-09-14 11:53:45 -07:00
Miklos Vajna 5ed75e2a3f cherry-pick: don't forget -s on failure
In case 'git cherry-pick -s <commit>' failed, the user had to use 'git
commit -s' (i.e. state the -s option again), which is easy to forget
about.  Instead, write the signed-off-by line early, so plain 'git
commit' will have the same result.

Also update 'git commit -s', so that in case there is already a relevant
Signed-off-by line before the Conflicts: line, it won't add one more at
the end of the message. If there is no such line, then add it before the
the Conflicts: line.

Signed-off-by: Miklos Vajna <vmiklos@suse.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-14 10:04:29 -07:00
Junio C Hamano 90585604a7 Merge branch 'nd/maint-remote-remove'
* nd/maint-remote-remove:
  remote: prefer subcommand name 'remove' to 'rm'
2012-09-12 14:21:58 -07:00
Junio C Hamano 3503e9ab32 Merge branch 'maint-1.7.11' into maint 2012-09-12 14:08:05 -07:00
Junio C Hamano 1403db49b8 Merge branch 'jc/apply-binary-p0' into maint-1.7.11
"git apply -p0" did not parse pathnames on "diff --git" line
correctly.  This caused patches that had pathnames in no other
places to be mistakenly rejected (most notably, binary patch that
does not rename nor change mode).  Textual patches, renames or mode
changes have preimage and postimage pathnames in different places in
a form that can be parsed unambiguously and did not suffer from this
problem.

* jc/apply-binary-p0:
  apply: compute patch->def_name correctly under -p0
2012-09-12 14:00:53 -07:00
Junio C Hamano eaff724bbc Merge branch 'jc/dotdot-is-parent-directory' into maint-1.7.11
"git log .." errored out saying it is both rev range and a path when
there is no disambiguating "--" is on the command line.  Update the
command line parser to interpret ".." as a path in such a case.

* jc/dotdot-is-parent-directory:
  specifying ranges: we did not mean to make ".." an empty set
2012-09-12 14:00:34 -07:00
Junio C Hamano 7d9483c299 Merge branch 'jk/maint-http-half-auth-push' into maint-1.7.11
Pushing to smart HTTP server with recent Git fails without having
the username in the URL to force authentication, if the server is
configured to allow GET anonymously, while requiring authentication
for POST.

* jk/maint-http-half-auth-push:
  http: prompt for credentials on failed POST
  http: factor out http error code handling
  t: test http access to "half-auth" repositories
  t: test basic smart-http authentication
  t/lib-httpd: recognize */smart/* repos as smart-http
  t/lib-httpd: only route auth/dumb to dumb repos
  t5550: factor out http auth setup
  t5550: put auth-required repo in auth/dumb
2012-09-12 13:58:23 -07:00
Junio C Hamano 92c830dd35 Merge branch 'kk/maint-for-each-ref-multi-sort' into maint-1.7.11
"git for-each-ref" did not honor multiple "--sort=<key>" arguments
correctly.

* kk/maint-for-each-ref-multi-sort:
  for-each-ref: Fix sort with multiple keys
  t6300: test sort with multiple keys
2012-09-12 13:57:43 -07:00
Michael Haggerty 5f0fc64513 fetch-pack: eliminate spurious error messages
It used to be that if "--all", "--depth", and also explicit references
were sought, then the explicit references were not handled correctly
in filter_refs() because the "--all --depth" code took precedence over
the explicit reference handling, and the explicit references were
never noted as having been found.  So check for explicitly sought
references before proceeding to the "--all --depth" logic.

This fixes two test cases in t5500.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-12 11:46:32 -07:00
Michael Haggerty 778e7543d2 fetch-pack: report missing refs even if no existing refs were received
This fixes a test in t5500.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-12 11:46:32 -07:00
Michael Haggerty 4c58f13ba6 fetch_pack(): update sought->nr to reflect number of unique entries
fetch_pack() removes duplicates from the "sought" list, thereby
shrinking the list.  But previously, the caller was not informed about
the shrinkage.  This would cause a spurious error message to be
emitted by cmd_fetch_pack() if "git fetch-pack" is called with
duplicate refnames.

Instead, remove duplicates using string_list_remove_duplicates(),
which adjusts sought->nr to reflect the new length of the list.

The last test of t5500 inexplicably *required* "git fetch-pack" to
fail when fetching a list of references that contains duplicates;
i.e., it insisted on the buggy behavior.  So change the test to expect
the correct behavior.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-12 11:46:31 -07:00
Michael Haggerty 8db43d2935 t5500: add tests of fetch-pack --all --depth=N $URL $REF
Document some bugs in "git fetch-pack":

1. If "git fetch-pack" is called with "--all", "--depth", and an
explicit existing non-tag reference to fetch, then it falsely reports
that the reference was not found, even though it was fetched
correctly.

2. If "git fetch-pack" is called with "--all", "--depth", and an
explicit existing tag reference to fetch, then it segfaults in
filter_refs() because return_refs is used without having been
initialized.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-12 11:46:31 -07:00
Michael Haggerty 3b0820045a t5500: add tests of error output for missing refs
If "git fetch-pack" is called with reference names that do not exist
on the remote, then it should emit an error message

    error: no such remote ref refs/heads/xyzzy

This is currently broken if *only* missing references are passed to
"git fetch-pack".

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-12 11:46:31 -07:00
Michael Haggerty f103f95b11 string_list: add a function string_list_longest_prefix()
Add a function that finds the longest string from a string_list that
is a prefix of a given string.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-12 11:43:25 -07:00
Michael Haggerty 31d5451eed string_list: add a new function, string_list_remove_duplicates()
Add a function that deletes duplicate entries from a sorted
string_list.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-12 11:43:25 -07:00
Michael Haggerty eb5f0c7a61 string_list: add a new function, filter_string_list()
This function allows entries that don't match a specified criterion to
be discarded from a string_list while preserving the order of the
remaining entries.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-12 11:43:25 -07:00
Michael Haggerty ff919f965d string_list: add two new functions for splitting strings
Add two new functions, string_list_split() and
string_list_split_in_place().  These split a string into a string_list
on a separator character.  The first makes copies of the substrings
(leaving the input string untouched) and the second splits the
original string in place, overwriting the separator characters with
NULs and referring to the original string's memory.

These functions are similar to the strbuf_split_*() functions except
that they work with the more powerful string_list interface.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-12 11:43:24 -07:00
Junio C Hamano 9aeaab6811 blame: allow "blame file" in the middle of a conflicted merge
"git blame file" has always meant "find the origin of each line of
the file in the history leading to HEAD, oh by the way, blame the
lines that are modified locally to the working tree".

This teaches "git blame" that during a conflicted merge, some
uncommitted changes may have come from the other history that is
being merged.

The verify_working_tree_path() function introduced in the previous
patch to notice a typo in the filename (primarily on case insensitive
filesystems) has been updated to allow a filename that does not exist
in HEAD (i.e. the tip of our history) as long as it exists one of the
commits being merged, so that a "we deleted, the other side modified"
case tracks the history of the file in the history of the other side.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-11 14:30:03 -07:00
Junio C Hamano efe0a206a2 Merge branch 'rj/test-regex'
Git ships with a fall-back regexp implementation for platforms with
buggy regexp library; give people a tool to see if they should be
using it on their platform.

* rj/test-regex:
  test-regex: Add a test to check for a bug in the regex routines
2012-09-11 11:36:25 -07:00
Junio C Hamano 1c88a6d174 Sync with 1.7.11.6
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-11 11:23:54 -07:00
Junio C Hamano ee7a83f631 Merge branch 'sz/submodule-force-update' into maint-1.7.11
* sz/submodule-force-update:
  Make 'git submodule update --force' always check out submodules.
2012-09-11 11:10:17 -07:00
Junio C Hamano ef92392b6c Merge branch 'ph/stash-rerere' into maint-1.7.11
* ph/stash-rerere:
  stash: invoke rerere in case of conflict
  test: git-stash conflict sets up rerere
2012-09-11 11:10:12 -07:00
Junio C Hamano fe31b2afac Merge branch 'hv/submodule-path-unmatch' into maint-1.7.11
* hv/submodule-path-unmatch:
  Let submodule command exit with error status if path does not exist
2012-09-11 11:08:55 -07:00
Junio C Hamano ef66ac3ead Merge branch 'mz/empty-rebase-test' into maint-1.7.11
* mz/empty-rebase-test:
  add tests for 'git rebase --keep-empty'
2012-09-11 11:08:48 -07:00
Junio C Hamano d9b983fc26 Merge branch 'ab/diff-write-incomplete-line' into maint-1.7.11
* ab/diff-write-incomplete-line:
  Fix '\ No newline...' annotation in rewrite diffs
2012-09-11 11:08:30 -07:00
Junio C Hamano ffb13460cd Merge branch 'jc/maint-t7406-rev-parse-max-count-huh' into maint-1.7.11
* jc/maint-t7406-rev-parse-max-count-huh:
  t7406: fix misleading "rev-parse --max-count=1 HEAD"
2012-09-11 11:08:18 -07:00
Junio C Hamano 6508d0358d Merge branch 'jc/test-prereq' into maint
* jc/test-prereq:
  t3910: use the UTF8_NFD_TO_NFC test prereq
  test-lib: provide UTF8 behaviour as a prerequisite
  t0050: use the SYMLINKS test prereq
  t0050: use the CASE_INSENSITIVE_FS test prereq
  test-lib: provide case insensitivity as a prerequisite
  test: allow prerequisite to be evaluated lazily
  test: rename $satisfied to $satisfied_prereq
2012-09-11 10:51:58 -07:00
Junio C Hamano ffcabccf5d blame $path: avoid getting fooled by case insensitive filesystems
"git blame MAKEFILE" run in a history that has "Makefile" but not
MAKEFILE can get confused on a case insensitive filesystem, because
the check we run to see if there is a corresponding file in the
working tree with lstat("MAKEFILE") succeeds.  In addition to that
check, we have to make sure that the given path also exists in the
commit we start digging history from (i.e. "HEAD").

Note that this reveals the breakage in a test added in cd8ae20
(git-blame shouldn't crash if run in an unmerged tree, 2007-10-18),
which expects the entire merge-in-progress path to be blamed to the
working tree when it did not exist in our tree.  As it is clear in
the log message of that commit, the old breakage was that it was
causing an internal error and the fix was about avoiding it.

Just check that the command does not die an uncontrolled death.  For
this particular case, the blame should fail, as the history for the
file in that contents has not been committed yet at the point in the
test.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-10 18:42:30 -07:00
Junio C Hamano 83ce176449 Merge branch 'cn/branch-set-upstream-to'
"git branch --set-upstream origin/master" is a common mistake to
create a local branch 'origin/master' and set it to integrate with
the current branch.  With a plan to deprecate this option, introduce
"git branch (-u|--set-upstream-to) origin/master" that sets the
current branch to integrate with 'origin/master' remote tracking
branch.

* cn/branch-set-upstream-to:
  branch: deprecate --set-upstream and show help if we detect possible mistaken use
  branch: add --unset-upstream option
  branch: introduce --set-upstream-to
2012-09-10 15:43:07 -07:00
Junio C Hamano c2b927932d Merge branch 'mz/cherry-pick-cmdline-order'
"git cherry-pick A C B" used to replay changes in A and then B and
then C if these three commits had committer timestamps in that
order, which is not what the user who said "A C B" naturally expects.

* mz/cherry-pick-cmdline-order:
  cherry-pick/revert: respect order of revisions to pick
  demonstrate broken 'git cherry-pick three one two'
  teach log --no-walk=unsorted, which avoids sorting
2012-09-10 15:42:55 -07:00
Junio C Hamano 1c0712dea8 Merge branch 'jk/maint-quiet-is-synonym-to-s-in-log'
We tried to bend backwards to allow "--quiet" to be a synonym as
"-s" when given as e.g. "git show --quiet", but did not quite
succeed.

* jk/maint-quiet-is-synonym-to-s-in-log:
  log: fix --quiet synonym for -s
2012-09-10 15:42:48 -07:00
Junio C Hamano e3f26752b5 Merge branch 'maint-1.7.11' into maint
* maint-1.7.11:
  Almost 1.7.11.6
  gitweb: URL-decode $my_url/$my_uri when stripping PATH_INFO
  rebase -i: use full onto sha1 in reflog
  sh-setup: protect from exported IFS
  receive-pack: do not leak output from auto-gc to standard output
  t/t5400: demonstrate breakage caused by informational message from prune
  setup: clarify error messages for file/revisions ambiguity
  send-email: improve RFC2047 quote parsing
  fsck: detect null sha1 in tree entries
  do not write null sha1s to on-disk index
  diff: do not use null sha1 as a sentinel value
2012-09-10 15:31:06 -07:00
Junio C Hamano 3f664638e5 Merge branch 'bc/receive-pack-stdout-protection' into maint-1.7.11
When "git push" triggered the automatic gc on the receiving end, a
message from "git prune" that said it was removing cruft leaked to
the standard output, breaking the communication protocol.

* bc/receive-pack-stdout-protection:
  receive-pack: do not leak output from auto-gc to standard output
  t/t5400: demonstrate breakage caused by informational message from prune
2012-09-10 15:25:09 -07:00
Junio C Hamano 03adeeaad6 Merge branch 'jk/maint-null-in-trees' into maint-1.7.11
"git diff" had a confusion between taking data from a path in the
working tree and taking data from an object that happens to have
name 0{40} recorded in a tree.

* jk/maint-null-in-trees:
  fsck: detect null sha1 in tree entries
  do not write null sha1s to on-disk index
  diff: do not use null sha1 as a sentinel value
2012-09-10 15:24:54 -07:00
Junio C Hamano 423a9e28fc Merge branch 'tr/maint-send-email-2047' into maint-1.7.11
"git send-email" did not unquote encoded words that appear on the
header correctly, and lost "_" from strings.

* tr/maint-send-email-2047:
  send-email: improve RFC2047 quote parsing
2012-09-10 15:24:41 -07:00
Johannes Sixt bacca7852f t0060: split absolute path test in two to exercise some of it on Windows
Only the first half of the test works only on POSIX, the second half
passes on Windows as well.

A later test "real path removes other extra slashes" looks very similar,
but it does not make sense to split it in the same way: When two slashes
are prepended in front of an absolute DOS-style path on Windows, the
meaning of the path is changed (//server/share style), so that the test
cannot pass on Windows.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Acked-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-10 09:31:44 -07:00
Junio C Hamano 155a4b712e attr: "binary" attribute should choose built-in "binary" merge driver
The built-in "binary" attribute macro expands to "-diff -text", so
that textual diff is not produced, and the contents will not go
through any CR/LF conversion ever.  During a merge, it should also
choose the "binary" low-level merge driver, but it didn't.

Make it expand to "-diff -merge -text".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-08 21:28:55 -07:00
Junio C Hamano a944af1d86 merge: teach -Xours/-Xtheirs to binary ll-merge driver
The (discouraged) -Xours/-Xtheirs modes of merge are supposed to
give a quick and dirty way to come up with a random mixture of
cleanly merged parts and punted conflict resolution to take contents
from one side in conflicting parts.  These options however were only
passed down to the low level merge driver for text.

Teach the built-in binary merge driver to notice them as well.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-08 21:27:19 -07:00
Junio C Hamano e6dd70e9bf Merge branch 'jk/maint-http-half-auth-push'
Pushing to smart HTTP server with recent Git fails without having
the username in the URL to force authentication, if the server is
configured to allow GET anonymously, while requiring authentication
for POST.

* jk/maint-http-half-auth-push:
  http: prompt for credentials on failed POST
  http: factor out http error code handling
  t: test http access to "half-auth" repositories
  t: test basic smart-http authentication
  t/lib-httpd: recognize */smart/* repos as smart-http
  t/lib-httpd: only route auth/dumb to dumb repos
  t5550: factor out http auth setup
  t5550: put auth-required repo in auth/dumb
2012-09-07 11:09:50 -07:00
Junio C Hamano 757bf26c85 Merge branch 'jc/apply-binary-p0'
"git apply -p0" did not parse pathnames on "diff --git" line
correctly.  This caused patches that had pathnames in no other
places to be mistakenly rejected (most notably, binary patch that
does not rename nor change mode).  Textual patches, renames or
mode changes have preimage and postimage pathnames in different
places in a form that can be parsed unambiguously and did not suffer
from this problem.

* jc/apply-binary-p0:
  apply: compute patch->def_name correctly under -p0
2012-09-07 11:09:26 -07:00
Junio C Hamano 7764a3b35c Merge branch 'jc/dotdot-is-parent-directory'
"git log .." errored out saying it is both rev range and a path when
there is no disambiguating "--" is on the command line.  Update the
command line parser to interpret ".." as a path in such a case.

* jc/dotdot-is-parent-directory:
  specifying ranges: we did not mean to make ".." an empty set
2012-09-07 11:09:18 -07:00
Junio C Hamano 09827f2a55 Merge branch 'kk/maint-for-each-ref-multi-sort'
"git for-each-ref" did not currectly support more than one --sort
option.

* kk/maint-for-each-ref-multi-sort:
  for-each-ref: Fix sort with multiple keys
  t6300: test sort with multiple keys
2012-09-07 11:08:51 -07:00
Junio C Hamano 7c88ec0576 Merge branch 'pw/p4-use-client-spec-branch-detection'
Fix "git p4" when "--use-client-spec" and "--detect-branches" are
used together (the command used to misdetect branches).

* pw/p4-use-client-spec-branch-detection:
  git p4: make branch detection work with --use-client-spec
  git p4: do wildcard decoding in stripRepoPath
  git p4: set self.branchPrefixes in initialization
  git p4 test: add broken --use-client-spec --detect-branches tests
  git p4 test: move client_view() function to library
2012-09-07 11:08:27 -07:00
Junio C Hamano bdac578482 Merge branch 'nd/i18n-poison-test-updates'
Update tests that can be broken with gettext-poison builds.

* nd/i18n-poison-test-updates:
  Fix tests under GETTEXT_POISON on parseopt
  Fix tests under GETTEXT_POISON on git-remote
  Fix tests under GETTEXT_POISON on pack-object
  Fix tests under GETTEXT_POISON on git-apply
  Fix tests under GETTEXT_POISON on diffstat
  Fix tests under GETTEXT_POISON on git-stash
  Fix tests under GETTEXT_POISON on relative dates
2012-09-07 11:07:59 -07:00
Dan Johnson 8556646089 fetch --all: pass --tags/--no-tags through to each remote
When fetch is invoked with --all, we need to pass the tag-following
preference to each individual fetch; without this, we will always
auto-follow tags, preventing us from fetching the remote tags into a
remote-specific namespace, for example.

Reported-by: Oswald Buddenhagen <ossi@kde.org>
Signed-off-by: Dan Johnson <ComputerDruid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-07 10:01:35 -07:00
Michael Haggerty 379a03ad81 t0060: verify that real_path() removes extra slashes
Adjusted for Windows by: Johannes Sixt <j6t@kdbg.org>

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-06 16:19:58 -07:00
Michael Haggerty f4c21e89d7 real_path(): properly handle nonexistent top-level paths
The change has two points:

1. Do not strip off a leading slash, because that erroneously turns an
   absolute path into a relative path.

2. Do not remove slashes from groups of multiple slashes; instead let
   chdir() handle them.  It could be, for example, that it wants to
   leave leading double-slashes alone.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-06 16:19:58 -07:00
Michael Haggerty 7bcf48dad8 t0060: verify that real_path() works correctly with absolute paths
There is currently a bug: if passed an absolute top-level path that
doesn't exist (e.g., "/foo") it incorrectly interprets the path as a
relative path (e.g., returns "$(pwd)/foo").  So mark the test as
failing.

These tests are skipped on Windows because test-path-utils operates on
a DOS-style absolute path even if a POSIX style absolute path is
passed as argument.

Adjusted for Windows by: Johannes Sixt <j6t@kdbg.org>

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-06 16:19:58 -07:00
Michael Haggerty 3efe5d1d32 real_path(): reject the empty string
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-06 16:19:58 -07:00
Michael Haggerty a5c45218b6 t0060: verify that real_path() fails if passed the empty string
It doesn't, so mark the test as failing.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-06 16:19:58 -07:00
Michael Haggerty a0601dc11f absolute_path(): reject the empty string
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-06 16:19:58 -07:00
Michael Haggerty 17264bcc4f t0060: verify that absolute_path() fails if passed the empty string
It doesn't, so mark the test as failing.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-06 16:19:58 -07:00
Michael Haggerty 8da650b456 t0060: move tests of real_path() from t0000 to here
Suggested by: Johannes Sixt <j6t@kdbg.org>

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-06 16:19:57 -07:00
Nguyễn Thái Ngọc Duy e17dba8fe1 remote: prefer subcommand name 'remove' to 'rm'
All remote subcommands are spelled out words except 'rm'. 'rm', being a
popular UNIX command name, may mislead users that there are also 'ls' or
'mv'. Use 'remove' to fit with the rest of subcommands.

'rm' is still supported and used in the test suite. It's just not
widely advertised.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-06 13:23:22 -07:00
Junio C Hamano 81dbbf7240 Merge branch 'sz/submodule-force-update'
"git submodule update --force" used to leave the working tree of the
submodule intact when there were local changes.  It is more intiutive
to make "--force" a sign to run "checkout -f" to overwrite them.

* sz/submodule-force-update:
  Make 'git submodule update --force' always check out submodules.
2012-09-03 15:54:18 -07:00
Junio C Hamano 799beac153 Merge branch 'ph/stash-rerere'
"git stash" internally used "git merge-recursive" backend, which did
not trigger "rerere" upon conflicts unlike other mergy operations.

* ph/stash-rerere:
  stash: invoke rerere in case of conflict
  test: git-stash conflict sets up rerere
2012-09-03 15:54:12 -07:00
Junio C Hamano 831287d37c Merge branch 'cw/cherry-pick-allow-empty-message'
"git cherry-pick" by default stops when it sees a commit without any
log message.  The "--allow-empty-message" option can be used to
silently proceed.

* cw/cherry-pick-allow-empty-message:
  cherry-pick: add --allow-empty-message option
2012-09-03 15:53:37 -07:00
Ramsay Jones d87bd7c15b test-lib.sh: Suppress the "passed all ..." message if no tests run
If a test script issues a test_done without executing any tests, for
example when using the 'skip_all' facility, the output looks something
like this:

    $ ./t9159-git-svn-no-parent-mergeinfo.sh
    # passed all 0 test(s)
    1..0 # SKIP skipping git svn tests, svn not found
    $

The "passed all 0 test(s)" comment line, while correct, looks a little
strange. Add a check to suppress this message if no tests have actually
been run.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-02 19:32:31 -07:00
Ramsay Jones bf4b721932 test-lib.sh: Add check for invalid use of 'skip_all' facility
The 'skip_all' facility cannot be used after one or more tests
have been executed using (for example) 'test_expect_success'.
To do so results in invalid TAP output, which leads to 'prove'
complaining of "Parse errors: No plan found in TAP output".

Add a check for such invalid usage and abort the test with an
error message to alert the test author.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-02 19:32:31 -07:00
Ramsay Jones 1c0cc7563b test-lib.sh: Fix some shell coding style violations
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-02 19:32:31 -07:00