git-svn: branch: avoid systematic prompt for cert/pass

Commands such as "git svn init/fetch/dcommit" do not prompt for client
certificate/password if they are stored in SVN config file.  Make
"git svn branch" consistent with the other commands, as SVN::Client is
capable of building its own authentication baton from information in the
SVN config directory.

Signed-off-by: Monard Vong <travelingsoul86@gmail.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
git svn: info: correctly handle absolute path args

Calling "git svn info $(pwd)" would hit:
  "Reading from filehandle failed at ..."
errors due to improper prefixing and canonicalization.

Strip the toplevel path from absolute filesystem paths to ensure
downstream canonicalization routines are only exposed to paths
tracked in git (or SVN).

v2:
  Thanks to Andrej Manduch for originally noticing the issue
  and fixing my original version of this to handle
  more corner cases such as "/path/to/top/../top" and
  "/path/to/top/../top/file" as shown in the new test cases.

v3:
  Fix pathname portability problems pointed out by Johannes Sixt
  with a hint from brian m. carlson.

Cc: Johannes Sixt <j6t@kdbg.org>
Cc: "brian m. carlson" <sandals@crustytoothpaste.net>
Signed-off-by: Andrej Manduch <amanduch@gmail.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
git-svn.txt: Remove mentions of repack options

Git no longer seems to use these flags or their associated config keys;
when they are present, git-svn outputs a message indicating that they
are being ignored.

Signed-off-by: Lawrence Velázquez <vq@larryv.me>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
git svn: find-rev allows short switches for near matches

Allow -B and -A to act as short aliases for --before and --after
options respectively.  This reduces typing and hopefully allows
reuse of muscle memory for grep(1) users.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
git-svn: delay term initialization

On my Debian 7 system, this fixes annoying warnings when the output
of "git svn" commands are redirected:

    Unable to get Terminal Size. The TIOCGWINSZ ioctl didn't work.
    The COLUMNS and LINES environment variables didn't work. The
    resize program didn't work.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
pager: save the original stderr when redirecting to pager

When we redirect stdout to the pager, we also redirect
stderr (if it would otherwise go to the terminal) so that
error messages do not get overwritten by the pager.

However, some stderr output may still want to go to the
terminal, because they are time-sensitive (like progress
reports) and should be overwritten by the pager.

This patch stashes away the original stderr descriptor and
creates a new stdio buffer for it.
progress: use pager's original_stderr if available

If we are outputting to a pager, stderr is redirected to the
pager. However, progress messages should not be part of that
stream, as they are time-sensitive and should end up being
hidden once we actually have output.
show: turn on rename detection progress reporting

For large commits, it is nice to have some eye candy for the
rename detection.

However, because show can display multiple commits, we have
to be careful not to clutter existing output. We show the
progress report only before we have generated any actual
output; once we have sent output to the terminal or pager,
we turn off progress reporting.

This also makes it safe to use with "git log", though it
will only be useful if the first commit is the slow one.
So this patch actually enables it for all of the
log/whatchanged/show/reflog family.

We also handle the usual --{no-}progress option and check
that stderr goes to a terminal before turning on progress.
diff: turn on rename detection progress reporting

Since all of the progress happens before we generate any
output, this looks OK, even when output goes to a pager.
We do the usual --progress/--no-progress options and check
isatty(2) to enable the feature.

The argument parsing is a little ad-hoc, but we currently
have no parse-options infrastructure here at all.  However,
it should be safe to parse like this, because the prior
call to setup_revisions will have removed any options that
take an argument, and our parsing removes --progress from
argv for later parsers. The one exception is diff_no_index,
which may get called early, and needs to learn to ignore
--progress.