tests: Introduce test_seq

Jeff King wrote:

	The seq command is GNU-ism, and is missing at least in older BSD
	releases and their derivatives, not to mention antique
	commercial Unixes.

	We already purged it in b3431bc (Don't use seq in tests, not
	everyone has it, 2007-05-02), but a few new instances have crept
	in. They went unnoticed because they are in scripts that are not
	run by default.

Replace them with test_seq that is implemented with a Perl snippet
(proposed by Jeff).  This is better than inlining this snippet
everywhere it's needed because it's easier to read and it's easier
to change the implementation (e.g. to C) if we ever decide to remove
Perl from the test suite.

Note that test_seq is not a complete replacement for seq(1).  It
just has what we need now, in addition that it makes it possible for
us to do something like "test_seq a m" if we wanted to in the
future.

There are also many places that do `for i in 1 2 3 ...` but I'm not sure
if it's worth converting them to test_seq.  That would introduce running
more processes of Perl.

Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
read_index_from: remove bogus errno assignments

These assignments comes from the very first commit e83c516 (Initial
revision of "git", the information manager from hell - 2005-04-07).
Back then we did not die() when errors happened so correct errno was
required.

Since 5d1a5c0 ([PATCH] Better error reporting for "git status" -
2005-10-01), read_index_from() learned to die rather than just return
-1 and these assignments became irrelevant. Remove them.

While at it, move die_errno() next to xmmap() call because it's the
mmap's error code that we care about. Otherwise if close(fd); fails,
it could overwrite mmap's errno.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Merge branch 'nd/index-errno' into next

* nd/index-errno:
  read_index_from: remove bogus errno assignments
Merge branch 'mk/test-seq' into next

Add a compatibility/utility function to the test framework.

* mk/test-seq:
  tests: Introduce test_seq
Merge branch 'master' into next

* master:
  Drop 1.7.11.x items from 1.7.12 release notes
  Prepare for 1.7.11.5
  doc: A few minor copy edits.
  Makefile: use overridable $(FIND) instead of hard-coded 'find'
Merge branch 'jk/blame-tree' into HEAD

* jk/blame-tree:
  blame-tree wip
Merge branch 'jk/builtin-attr' into HEAD

* jk/builtin-attr:
  attr: map builtin userdiff drivers to well-known extensions
Merge branch 'jk/bundle-fetch' into HEAD

* jk/bundle-fetch:
  clone: give advice on how to resume a failed clone
  remote-curl: resume interrupted bundle transfers
  remote-curl: show progress for bundle downloads
  progress: allow pure-throughput progress meters
  remote-curl: try base $URL after $URL/info/refs
  remote-curl: auto-detect bundles when fetching refs
  remote-curl: free "discovery" object
  bundle: add is_bundle_buf helper
  transport: factor out bundle to ref list conversion
  remote-curl: use http callback for requesting refs
  http: add a public function for arbitrary-callback request
  http: refactor http_request function
  http: turn off curl signals
  t/lib-httpd: check for NO_CURL
Merge branch 'jk/cache-patch-id' into HEAD

* jk/cache-patch-id:
  cache patch ids on disk
  cherry: read default config
  implement metadata cache subsystem
  map: implement persistent maps
  decorate: use "map" for the underlying implementation
  fast-export: use object to uint32 map instead of "decorate"
  map: add helper functions for objects as keys
  implement generic key/value map
Merge branch 'jk/cache-renames' into HEAD

* jk/cache-renames:
  diff: optionally use rename cache
  implement rename cache

Conflicts:
	Makefile
	metadata-cache.c
	metadata-cache.h
Merge branch 'jk/child-cleanup' into HEAD

* jk/child-cleanup:
  send-pack: kill pack-objects helper on signal or exit
Merge branch 'jk/clone-file-local' into HEAD

* jk/clone-file-local:
  clone: send diagnostic messages to stderr
Merge branch 'jk/config-sources' into HEAD

* jk/config-sources:
  show sources of config options (WIP)
Merge branch 'jk/deleted-branch-reflogs' into HEAD

* jk/deleted-branch-reflogs:
  add tests for reflogs of deleted refs
  teach sha1_name to look in graveyard reflogs
  retain reflogs for deleted refs
Merge branch 'jk/describe' into HEAD

* jk/describe:
  describe WIP
Merge branch 'jk/diff-null-sha1' into HEAD

* jk/diff-null-sha1:
  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
Merge branch 'jk/dumpstat' into HEAD

* jk/dumpstat:
  zeromq dumpstat implementation
  dumpstat-ify upload-pack
  dumpstat to fd
  dumpstat
Merge branch 'jk/external-odb' into HEAD

* jk/external-odb:
  fetch-pack: advertise external odb blobs
  external odb foreach
  external odb work in progress
Merge branch 'jk/fast-commit-list' into HEAD

* jk/fast-commit-list:
  fetch-pack: use priority queue for mark_complete
  commit: add infrastructure for priority queues of commits
  basic priority queue implementation
Merge branch 'jk/fetch-tracking' into HEAD

* jk/fetch-tracking:
  fetch tracking wip