git p4: add support for 'p4 move' in P4Submit

For -M option (detectRenames) in P4Submit, use 'p4 move' rather
than 'p4 integrate'.  Check Perforce server for exisitence of
'p4 move' and use it if present, otherwise revert to 'p4 integrate'.

[pw: wildcard-encode src/dest, add/update tests, tweak code]

Signed-off-by: Gary Gibbons <ggibbons@perforce.com>
Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
revision: avoid work after --max-count is reached

During a revision traversal in which --max-count has been
specified, we decrement a counter for each revision returned
by get_revision. When it hits 0, we typically return NULL
(the exception being if we still have boundary commits to
show).

However, before we check the counter, we call get_revision_1
to get the next commit. This might involve looking at a
large number of commits if we have restricted the traversal
(e.g., we might traverse until we find the next commit whose
diff actually matches a pathspec).

There's no need to make this get_revision_1 call when our
counter runs out. If we are not in --boundary mode, we will
just throw away the result and immediately return NULL. If
we are in --boundary mode, then we will still throw away the
result, and then start showing the boundary commits.
However, as git_revision_1 does not impact the boundary
list, it should not have an impact.

In most cases, avoiding this work will not be especially
noticeable. However, in some cases, it can make a big
difference:

  [before]
  $ time git rev-list -1 origin Documentation/RelNotes/1.7.11.2.txt
  8d141a1d562abb31f27f599dbf6e10a6c06ed73e

  real    0m0.301s
  user    0m0.280s
  sys     0m0.016s

  [after]
  $ time git rev-list -1 origin Documentation/RelNotes/1.7.11.2.txt
  8d141a1d562abb31f27f599dbf6e10a6c06ed73e

  real    0m0.010s
  user    0m0.008s
  sys     0m0.000s

Note that the output is produced almost instantaneously in
the first case, and then git uselessly spends a long time
looking for the next commit to touch that file (but there
isn't one, and we traverse all the way down to the roots).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Merge branch 'mm/push-default-switch-warning' into jch

Will defer for another cycle.

# By Matthieu Moy
* mm/push-default-switch-warning:
  push: start warning upcoming default change for push.default
Merge branch 'cw/rebase-i-root' into jch

"git rebase [-i] --root $tip" can now be used to rewrite all the
history down to the root.

* cw/rebase-i-root:
  t3404: make test 57 work with dash and others
  Add tests for rebase -i --root without --onto
  rebase -i: support --root without --onto

Conflicts:
	Documentation/git-rebase.txt
	git-rebase.sh
	t/t3404-rebase-interactive.sh
	t/t3412-rebase-root.sh
Merge branch 'jk/push-delete-ref-error-message' into jch

The error message from "git push $there :bogo" mentioned we tried
and failed to guess what ref is being deleted based on the LHS of
the refspec, which we don't.

# By Jeff King
* jk/push-delete-ref-error-message:
  push: don't guess at qualifying remote refs on deletion
Merge branch 'pw/git-p4-jobs' into jch

Teach "git p4" to notice "Jobs:" in the log message and relay it to
Perforce to trigger its "jobs" support.

# By Pete Wyckoff
* pw/git-p4-jobs:
  git p4: notice Jobs lines in git commit messages
  git p4 test: refactor marshal_dump
  git p4: remove unused P4Submit interactive setting
Merge branch 'jc/apply-3way' into jch

"git apply" learns to wiggle the base version and perform three-way merge
when a patch does not exactly apply to the version you have.

* jc/apply-3way:
  apply: tests for the --3way option
  apply: document --3way option
  apply: allow rerere() to work on --3way results
  apply: register conflicted stages to the index
  apply: --3way with add/add conflict
  apply: move verify_index_match() higher
  apply: plug the three-way merge logic in
  apply: fall back on three-way merge
  apply: accept -3/--3way command line option
  apply: move "already exists" logic to check_to_create()
  apply: move check_to_create_blob() closer to its sole caller
  apply: further split load_preimage()
  apply: refactor "previous patch" logic
  apply: split load_preimage() helper function out
  apply: factor out checkout_target() helper function
  apply: refactor read_file_or_gitlink()
  apply: clear_image() clears things a bit more
  apply: a bit more comments on PATH_TO_BE_DELETED
  apply: fix an incomplete comment in check_patch()

Conflicts:
	builtin/apply.c
Merge branch 'jc/maint-filter-branch-epoch-date' into jch

* jc/maint-filter-branch-epoch-date:
  t7003: add test to filter a branch with a commit at epoch
  date.c: Fix off by one error in object-header date parsing
  filter-branch: do not forget the '@' prefix to force git-timestamp
Merge branch 'jk/maint-commit-amend-only-no-paths' into jch

"git commit --amend --only --" was meant to allow "Clever" people to
rewrite the commit message without making any change even when they
have already changes for the next commit added to their index, but
it never worked as advertised since it was introduced in 1.3.0 era.

* jk/maint-commit-amend-only-no-paths:
  commit: fix "--amend --only" with no pathspec

Conflicts:
	t/t7501-commit.sh
Merge branch 'ar/clone-honor-umask-at-top' into jch

A handful of files and directories we create had tighter than
necessary permission bits when the user wanted to have group
writability (e.g. by setting "umask 002").

# By Alex Riesen (1) and others
* ar/clone-honor-umask-at-top:
  add: create ADD_EDIT.patch with mode 0666
  rerere: make rr-cache fanout directory honor umask
  Restore umasks influence on the permissions of work tree created by clone
Merge branch 'jn/makefile-cleanup' into jch

Tightens dependency rules to avoid unnecessary recompilation.

# By Jeff King (11) and Jonathan Nieder (3)
* jn/makefile-cleanup:
  Makefile: document ground rules for target-specific dependencies
  Makefile: move GIT-VERSION-FILE dependencies closer to use
  Makefile: build instaweb similar to other scripts
  Makefile: update scripts when build-time parameters change
  Makefile: do not replace @@GIT_VERSION@@ in shell scripts
  Makefile: split prefix flags from GIT-CFLAGS
  Makefile: be silent when only GIT_USER_AGENT changes
  Makefile: split GIT_USER_AGENT from GIT-CFLAGS
  Makefile: do not replace @@GIT_USER_AGENT@@ in scripts
  Makefile: apply dependencies consistently to sparse/asm targets
  Makefile: do not have git.o depend on common-cmds.h
  Makefile: fold XDIFF_H and VCSSVN_H into LIB_H
  Makefile: fold MISC_H into LIB_H
  Makefile: sort LIB_H list
Merge branch 'cw/amend-commit-without-message' into jch

"commit --amend" used to refuse amending a commit with an empty log
message, with or without "--allow-empty-message".

# By Chris Webb
* cw/amend-commit-without-message:
  Allow edit of empty message with commit --amend
Merge branch 'jc/sha1-name-more' into jch

<<
>>

Teaches the object name parser things like a "git describe" output
is always a commit object, "A" in "git log A" must be a committish,
and "A" and "B" in "git log A...B" both must be committish, etc., to
prolong the lifetime of abbreviated object names.

* jc/sha1-name-more: (27 commits)
  t1512: match the "other" object names
  t1512: ignore whitespaces in wc -l output
  rev-parse --disambiguate=<prefix>
  rev-parse: A and B in "rev-parse A..B" refer to committish
  reset: the command takes committish
  commit-tree: the command wants a tree and commits
  apply: --build-fake-ancestor expects blobs
  sha1_name.c: add support for disambiguating other types
  revision.c: the "log" family, except for "show", takes committish
  revision.c: allow handle_revision_arg() to take other flags
  sha1_name.c: introduce get_sha1_committish()
  sha1_name.c: teach lookup context to get_sha1_with_context()
  sha1_name.c: many short names can only be committish
  sha1_name.c: get_sha1_1() takes lookup flags
  sha1_name.c: get_describe_name() by definition groks only commits
  sha1_name.c: teach get_short_sha1() a commit-only option
  sha1_name.c: allow get_short_sha1() to take other flags
  get_sha1(): fix error status regression
  sha1_name.c: restructure disambiguation of short names
  sha1_name.c: correct misnamed "canonical" and "res"
  ...

Conflicts:
	revision.h
	setup.c
am: indicate where a failed patch is to be found

If "git am" fails to apply something, the end user may need to know
where to find the patch that failed to apply, so that the user can
do other things (e.g. trying "GNU patch" on it, running "diffstat"
to see what it tried to change, etc.)  The input to "am" may have
contained more than one patch, or the message may have been MIME
encoded, and knowing what the user fed to "am" does not help very
much for this purpose.

Also introduce advice.amworkdir configuration to allow people who
learned where to look to squelch this message.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Merge branch 'jc/test-lib-source-build-options-early' into pu

Reorders t/test-lib.sh so that we dot-source GIT-BUILD-OPTIONS that
records the shell and Perl the user told us to use with Git a lot
early, so that test-lib.sh script itself can use "$PERL_PATH" in
one of its early operations.

Needs to be eyeballed by people who run tests with exotic options
like valgrind, --root=/dev/shm/somewhere, etc.

* jc/test-lib-source-build-options-early:
  test-lib: reorder and include GIT-BUILD-OPTIONS a lot earlier
Merge branch 'nk/maint-gitweb-log-by-lines' into pu

Is the use of esc_html() in the tip one correct?

# By Namhyung Kim
* nk/maint-gitweb-log-by-lines:
  gitweb: Add support to Link: tag
  gitweb: Handle other types of tag in git_print_log
  gitweb: Cleanup git_print_log()
Merge branch 'ph/stash-rerere' into pu

Will be rerolled but is going in the right direction.

# By Phil Hord
* ph/stash-rerere:
  stash: invoke rerere in case of conflict
  test: git-stash conflict sets up rerere
Merge branch 'pw/git-p4-move' into pu

Will be rerolled.

# By Gary Gibbons
* pw/git-p4-move:
  git p4: add support for 'p4 move' in P4Submit
  git p4: refactor diffOpts calculation
Merge branch 'jk/no-more-pre-exec-callback' into pu

Will defer for 6 months until ancient "less" goes extinct.

# By Jeff King
* jk/no-more-pre-exec-callback:
  pager: drop "wait for output to run less" hack
Merge branch 'jc/split-blob' into pu

Not ready.

I finished the streaming checkout codepath, but as explained in
127b177 (bulk-checkin: support chunked-object encoding, 2011-11-30),
these are still early steps of a long and painful journey. At least
pack-objects and fsck need to learn the new encoding for the series
to be usable locally, and then index-pack/unpack-objects needs to
learn it to be used remotely.

Given that I heard a lot of noise that people want large files, and
that I was asked by somebody at GitTogether'11 privately for an
advice on how to pay developers (not me) to help adding necessary
support, I am somewhat dissapointed that the original patch series
that was sent almost two months ago still remains here without much
comments and updates from the developer community. I even made the
interface to the logic that decides where to split chunks easily
replaceable, and I deliberately made the logic in the original patch
extremely stupid to entice others, especially the "bup" fanboys, to
come up with a better logic, thinking that giving people an easy
target to shoot for, they may be encouraged to help out. The plan is
not working :-(.

* jc/split-blob:
  chunked-object: streaming checkout
  chunked-object: fallback checkout codepaths
  bulk-checkin: support chunked-object encoding
  bulk-checkin: allow the same data to be multiply hashed
  new representation types in the packstream
  packfile: use varint functions

Conflicts:
	builtin/pack-objects.c
	streaming.c
	t/t1050-large.sh