git p4 test: move client_view() function to library

This code will be useful in --detect-branches --use-client-spec tests.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git p4 test: add broken --use-client-spec --detect-branches tests

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git p4: set self.branchPrefixes in initialization

This instance variable is needed during commit() to map
files from p4 to their relative locations in git.  Set
it when initializing P4Sync to avoid passing it to every
commit() call.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git p4: do wildcard decoding in stripRepoPath

Instead of having to remember to do it after each call to
stripRepoPath, make it part of that function.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git p4: make branch detection work with --use-client-spec

The bug report in http://stackoverflow.com/questions/11893688
observes that files are mapped into the wrong locations in
git when both --use-client-spec and --branch-detection are enabled.

Fix this by changing the relative path prefix to match discovered
branches when using a client spec.

The problem was likely introduced with ecb7cf9 (git-p4: rewrite view
handling, 2012-01-02).

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git add: notice removal of tracked paths by default

When run without "-u" or "-A" option,

    $ edit subdir/x
    $ create subdir/y
    $ rm subdir/z
    $ git add subdir/

does not notice removal of paths (e.g. subdir/z) from the working tree.
Make "git add" to pretend as if "-A" is given when there is a pathspec on
the command line.  "git add" without any argument continues to be a no-op.

When resolving a conflict to remove a path, the current code tells you to
"git rm $path", but now with this patch you can say "git add $path".  Of
course you can do "git add -A $path" without this patch.

In either case, the operation "git add" is about "adding the state of the
path in the working tree to the index".  The state may happen to be "path
removed", not "path has an updated content".

The semantic change can be seen by a breakage in t2200, test #15.  There,
a merge has conflicts in path4 and path6 (which are removed from the
working tree), and test checks "git add path4" to resolve it must fail,
and makes sure "add -u" needs to be used.  We do not have to do this
anymore.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
rev-list docs: clarify --topo-order description

We said "--date-order" still does not violate the topology, but it
was still not clear enough.

Reword the description for both "--date-order" and "--topo-order",
and add an illustration to it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
parse_feature_request: make it easier to see feature values

We already take care to parse key/value capabilities like
"foo=bar", but the code does not provide a good way of
actually finding out what is on the right-hand side of the
"=".

A server using "parse_feature_request" could accomplish this
with some extra parsing. You must skip past the "key"
portion manually, check for "=" versus NUL or space, and
then find the length by searching for the next space (or
NUL).  But clients can't even do that, since the
"server_supports" interface does not even return the
pointer.

Instead, let's have our parser share more information by
providing a pointer to the value and its length. The
"parse_feature_value" function returns a pointer to the
feature's value portion, along with the length of the value.
If the feature is missing, NULL is returned. If it does not
have an "=", then a zero-length value is returned.

Similarly, "server_feature_value" behaves in the same way,
but always checks the static server_feature_list variable.

We can then implement "server_supports" in terms of
"server_feature_value". We cannot implement the original
"parse_feature_request" in terms of our new function,
because it returned a pointer to the beginning of the
feature. However, no callers actually cared about the value
of the returned pointer, so we can simplify it to a boolean
just as we do for "server_supports".

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
fetch-pack: mention server version with verbose output

Fetch-pack's verbose mode is more of a debugging mode (and
in fact takes two "-v" arguments to trigger via the
porcelain layer). Let's mention the server version as
another possible item of interest.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Let submodule command exit with error status if path does not exist

Various subcommands of the "git submodule" command exited with 0
status even though the path given by the user did not exist.

The reason behind that was that they all pipe the output of
module_list into the while loop which then does the action on the
paths specified by the commandline. Since the exit code of the
command on the upstream side of the pipe is ignored by the shell,
the status code of "ls-files --error-unmatch" nor "module_list" was
not propagated.

In case ls-files returns with an error code, we write a special
string that is not possible in non error situations, and no other
output, so that the downstream can detect the error and die with an
error code.

The error message that there is an unmatched pathspec comes through
stderr directly from ls-files. So the user still gets a hint whats going
on.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Merge branch 'jc/maint-push-refs-all' into pu

Allows pushing and fetching refs/stash.

* jc/maint-push-refs-all:
  get_fetch_map(): tighten checks on dest refs
  fetch/push: allow refs/*:refs/*
Merge branch 'mz/cherry-code-cleanup' into pu

Minor code clean-up on the cherry-pick codepath.
Not urgent (non regression).

* mz/cherry-code-cleanup:
  cherry: remove redundant check for merge commit
  cherry: don't set ignored rev_info options
  remove unnecessary parameter from get_patch_ids()
Merge branch 'bc/prune-info' into pu

Teach "git prune" without "-v" to be silent about leftover temporary files.

Not urgent (non regression).

* bc/prune-info:
  prune.c: only print informational message in show_only or verbose mode
Merge branch 'jc/tag-doc' into pu

Our documentation used to assume having files in .git/refs/*
directories was the only to have branches and tags, but that is not
true for quite some time.

Not urgent (non regression).

* jc/tag-doc:
  Documentation: do not mention .git/refs/* directories
Merge branch 'jc/capabilities' (early part) into pu

* 'jc/capabilities' (early part):
  fetch-pack: do not ask for unadvertised capabilities
Merge branch 'ms/git-svn-1.7' into pu

A series by Michael Schwern via Eric to update git-svn to revamp the
way URLs are internally passed around, to make it work with SVN 1.7.

* ms/git-svn-1.7:
  git-svn: remove ad-hoc canonicalizations
  git-svn: canonicalize newly-minted URLs
  git-svn: introduce add_path_to_url function
  git-svn: canonicalize earlier
  git-svn: replace URL escapes with canonicalization
  git-svn: attempt to mimic SVN 1.7 URL canonicalization
  t9107: fix typo
  t9118: workaround inconsistency between SVN versions
  Git::SVN{,::Ra}: canonicalize earlier
  git-svn: path canonicalization uses SVN API
  Git::SVN::Utils: remove irrelevant comment
  git-svn: add join_paths() to safely concatenate paths
  git-svn: factor out _collapse_dotdot function
  git-svn: use SVN 1.7 to canonicalize when possible
  git-svn: move canonicalization to Git::SVN::Utils
  use Git::SVN{,::RA}->url accessor globally
  use Git::SVN->path accessor globally
  Git::SVN::Ra: use accessor for URLs
  Git::SVN: use accessor for URLs internally
  Git::SVN: use accessors internally for path
Merge branch 'jc/maint-protect-sh-from-ifs' into pu

When the user exports a non-default IFS without HT, scripts that
rely on being able to parse "ls-files -s | while read a b c..."
start to fail.  Protect them from such a misconfiguration.

* jc/maint-protect-sh-from-ifs:
  sh-setup: protect from exported IFS
Merge branch 'jk/docs-docbook-monospace-display' into pu

The documentation in the TeXinfo format was using indented output
for materials meant to be examples that are better typeset in
monospace.

Not urgent (non regression).

* jk/docs-docbook-monospace-display:
  docs: monospace listings in docbook output
Merge branch 'jk/check-docs-update' into pu

Simplify "make check-docs" implementation and update its coverage.

* jk/check-docs-update:
  check-docs: get documented command list from Makefile
  check-docs: drop git-help special-case
  check-docs: list git-gui as a command
  check-docs: factor out command-list
  command-list: mention git-credential-* helpers
  command-list: add git-sh-i18n
  check-docs: update non-command documentation list
  check-docs: mention gitweb specially
Merge branch 'mz/empty-rebase-test' into pu

* mz/empty-rebase-test:
  add tests for 'git rebase --keep-empty'