rebase: allow "-" short-hand for the previous branch

Teach rebase the same shorthand as checkout and merge to name the
branch to rebase the current branch on; that is, that "-" means "the
branch we were previously on".

Requested-by: Tim Chase <git@tim.thechases.com>
Signed-off-by: Brian Gesiak <modocache@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff-no-index: rename read_directory()

In the next patch, we will replace a manual checking of "." or ".."
with a call to is_dot_or_dotdot() defined in dir.h.  The private
function read_directory() defined in this file will conflict with
the global function declared there when we do so.

As a preparatory step, rename the private read_directory() to avoid
the name collision.

Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Brian Bourn <ba.bourn@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff-no-index: replace manual "."/".." check with is_dot_or_dotdot()

Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Brian Bourn <ba.bourn@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
tests: use "env" to run commands with temporary env-var settings

Ordinarily, we would say "VAR=VAL command" to execute a tested
command with environment variable(s) set only for that command.
This however does not work if 'command' is a shell function (most
notably 'test_must_fail'); the result of the assignment is retained
and affects later commands.

To avoid this, we used to assign and export environment variables
and run such a test in a subshell, like so:

        (
                VAR=VAL && export VAR &&
                test_must_fail git command to be tested
        )

But with "env" utility, we should be able to say:

        test_must_fail env VAR=VAL git command to be tested

which is much shorter and easier to read.

Signed-off-by: David Tran <unsignedzero@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t5510: Do not use $(pwd) when fetching / pushing / pulling via rsync

On MINGW, "pwd" is defined as "pwd -W" in test-lib.sh. This usually is the
right thing, but the absolute Windows path with a colon confuses rsync. We
could use $PWD in this case to work around the issue, but in fact there is
no need to use an absolute path in the first place, so get rid of it.

This was discovered in the context of the mingwGitDevEnv project and only
did not surface before with msysgit because the latter does not ship
rsync.

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
remote-hg: do not fail on invalid bookmarks

Mercurial can have bookmarks pointing to "nullid" (the empty root
revision), while Git can not have references to it.
When cloning or fetching from a Mercurial repository that has such a
bookmark, the import will fail because git-remote-hg will not be able to
create the corresponding reference.

Warn the user about the invalid reference, and continue the import,
instead of stopping right away.

Also add some test cases for this issue.

Reported-by: Antoine Pelisse <apelisse@gmail.com>
Signed-off-by: Max Horn <max@quendi.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Enable index-pack threading in msysgit.

This adds a Windows implementation of pread.  Note that it is NOT
safe to intersperse calls to read() and pread() on a file
descriptor.  According to the ReadFile spec, using the 'overlapped'
argument should not affect the implicit position pointer of the
descriptor.  Experiments have shown that this is, in fact, a lie.

To accomodate that fact, this change also incorporates:

http://article.gmane.org/gmane.comp.version-control.git/196042

... which gives each index-pack thread its own file descriptor.

Signed-off-by: Stefan Zager <szager@chromium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
fsck.c:fsck_commit(): use skip_prefix() to verify and skip constant

fsck_commit() uses memcmp() to check if the buffer starts with a
certain prefix, and skips the prefix if it does.

This is exactly what skip_prefix() was designed for.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Merge branch 'ys/fsck-commit-parsing' into jch

* ys/fsck-commit-parsing:
  fsck.c:fsck_commit(): use skip_prefix() to verify and skip constant
  fsck.c:fsck_ident(): ident points at a const string

# Conflicts:
# 	fsck.c
Merge branch 'pw/branch-config-message' into jch

Among the many attempts to microproject #8, this seemed to be the
most "done" among the table based ones; I however tend to think
that the original with minimum refactoring would be easier to read.

* pw/branch-config-message:
  install_branch_config(): simplify verbose messages logic

# Conflicts:
# 	branch.c
Merge branch 'fr/add-interactive-argv-array' into jch

* fr/add-interactive-argv-array:
  add: use struct argv_array in run_add_interactive()
Merge branch 'us/printf-not-echo' into jch

* us/printf-not-echo:
  test-lib.sh: do not "echo" caller-supplied strings
  rebase -i: do not "echo" random user-supplied strings
Merge branch 'rr/doc-merge-strategies' into jch

* rr/doc-merge-strategies:
  Documentation/merge-strategies: avoid hyphenated commands
Merge branch 'jk/pack-bitmap' into jch

* jk/pack-bitmap:
  pack-objects: turn off bitmaps when skipping objects
Merge branch 'jk/pack-bitmap-progress' into jch

* jk/pack-bitmap-progress:
  pack-objects: show reused packfile objects in "Counting objects"
  pack-objects: show progress for reused packfiles
Merge branch 'jk/subtree-prefix' into jch

* jk/subtree-prefix:
  subtree: initialize "prefix" variable
Merge branch 'nd/index-pack-error-message' into jch

* nd/index-pack-error-message:
  index-pack: report error using the correct variable
Merge branch 'ah/doc-gitk-config' into jch

* ah/doc-gitk-config:
  Documentation/gitk: Document new config file location
Merge branch 'bb/diff-no-index-dotdot' into jch

* bb/diff-no-index-dotdot:
  diff-no-index: replace manual "."/".." check with is_dot_or_dotdot()
  diff-no-index: rename read_directory()
Merge branch 'bg/rebase-off-of-previous-branch' into jch

* bg/rebase-off-of-previous-branch:
  rebase: allow "-" short-hand for the previous branch