git
8 years agoMerge branch 'ps/t1509-chroot-test-fixup'
Junio C Hamano [Wed, 19 Aug 2015 21:48:52 +0000 (14:48 -0700)] 
Merge branch 'ps/t1509-chroot-test-fixup'

t1509 test that requires a dedicated VM environment had some
bitrot, which has been corrected.

* ps/t1509-chroot-test-fixup:
  tests: fix cleanup after tests in t1509-root-worktree
  tests: fix broken && chains in t1509-root-worktree

8 years agoMerge branch 'sb/check-return-from-read-ref'
Junio C Hamano [Wed, 19 Aug 2015 21:48:52 +0000 (14:48 -0700)] 
Merge branch 'sb/check-return-from-read-ref'

* sb/check-return-from-read-ref:
  transport-helper: die on errors reading refs.

8 years agoMerge branch 'mm/pull-upload-pack'
Junio C Hamano [Wed, 19 Aug 2015 21:48:51 +0000 (14:48 -0700)] 
Merge branch 'mm/pull-upload-pack'

"git pull" in recent releases of Git has a regression in the code
that allows custom path to the --upload-pack=<program>.  This has
been corrected.

Note that this is irrelevant for 'master' with "git pull" rewritten
in C.

* mm/pull-upload-pack:
  pull.sh: quote $upload_pack when passing it to git-fetch

8 years agoThird batch for 2.6
Junio C Hamano [Mon, 17 Aug 2015 22:09:25 +0000 (15:09 -0700)] 
Third batch for 2.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoMerge branch 'dt/untracked-sparse'
Junio C Hamano [Mon, 17 Aug 2015 22:07:52 +0000 (15:07 -0700)] 
Merge branch 'dt/untracked-sparse'

Allow untracked cache (experimental) to be used when sparse
checkout (experimental) is also in use.

* dt/untracked-sparse:
  untracked-cache: support sparse checkout

8 years agoMerge branch 'ta/docfix-index-format-tech'
Junio C Hamano [Mon, 17 Aug 2015 22:07:52 +0000 (15:07 -0700)] 
Merge branch 'ta/docfix-index-format-tech'

* ta/docfix-index-format-tech:
  typofix for index-format.txt

8 years agoMerge branch 'mh/get-remote-group-fix'
Junio C Hamano [Mon, 17 Aug 2015 22:07:51 +0000 (15:07 -0700)] 
Merge branch 'mh/get-remote-group-fix'

An off-by-one error made "git remote" to mishandle a remote with a
single letter nickname.

* mh/get-remote-group-fix:
  get_remote_group(): use skip_prefix()
  get_remote_group(): eliminate superfluous call to strcspn()
  get_remote_group(): rename local variable "space" to "wordlen"
  get_remote_group(): handle remotes with single-character names

8 years agoMerge branch 'kd/pull-rebase-autostash'
Junio C Hamano [Mon, 17 Aug 2015 22:07:50 +0000 (15:07 -0700)] 
Merge branch 'kd/pull-rebase-autostash'

"git pull --rebase" has been taught to pay attention to
rebase.autostash configuration.

* kd/pull-rebase-autostash:
  pull: allow dirty tree when rebase.autostash enabled

8 years agoSecond batch for 2.6
Junio C Hamano [Wed, 12 Aug 2015 21:16:31 +0000 (14:16 -0700)] 
Second batch for 2.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoMerge branch 'sb/remove-unused-var-from-builtin-add'
Junio C Hamano [Wed, 12 Aug 2015 21:09:58 +0000 (14:09 -0700)] 
Merge branch 'sb/remove-unused-var-from-builtin-add'

* sb/remove-unused-var-from-builtin-add:
  add: remove dead code

8 years agoMerge branch 'sb/parse-options-codeformat'
Junio C Hamano [Wed, 12 Aug 2015 21:09:57 +0000 (14:09 -0700)] 
Merge branch 'sb/parse-options-codeformat'

* sb/parse-options-codeformat:
  parse-options: align curly braces for all options

8 years agoMerge branch 'dt/unpack-trees-cache-tree-revalidate'
Junio C Hamano [Wed, 12 Aug 2015 21:09:57 +0000 (14:09 -0700)] 
Merge branch 'dt/unpack-trees-cache-tree-revalidate'

The code to perform multi-tree merges has been taught to repopulate
the cache-tree upon a successful merge into the index, so that
subsequent "diff-index --cached" (hence "status") and "write-tree"
(hence "commit") will go faster.

The same logic in "git checkout" may now be removed, but that is a
separate issue.

* dt/unpack-trees-cache-tree-revalidate:
  unpack-trees: populate cache-tree on successful merge

8 years agoMerge branch 'dt/reflog-tests'
Junio C Hamano [Wed, 12 Aug 2015 21:09:56 +0000 (14:09 -0700)] 
Merge branch 'dt/reflog-tests'

Tests that assume how reflogs are represented on the filesystem too
much have been corrected.

* dt/reflog-tests:
  tests: remove some direct access to .git/logs
  t/t7509: remove unnecessary manipulation of reflog

8 years agoMerge branch 'es/worktree-add-cleanup'
Junio C Hamano [Wed, 12 Aug 2015 21:09:56 +0000 (14:09 -0700)] 
Merge branch 'es/worktree-add-cleanup'

The "new-worktree-mode" hack in "checkout" that was added in
nd/multiple-work-trees topic has been removed by updating the
implementation of new "worktree add".

* es/worktree-add-cleanup: (25 commits)
  Documentation/git-worktree: fix duplicated 'from'
  Documentation/config: mention "now" and "never" for 'expire' settings
  Documentation/git-worktree: fix broken 'linkgit' invocation
  checkout: drop intimate knowledge of newly created worktree
  worktree: populate via "git reset --hard" rather than "git checkout"
  worktree: avoid resolving HEAD unnecessarily
  worktree: make setup of new HEAD distinct from worktree population
  worktree: detect branch-name/detached and error conditions locally
  worktree: add_worktree: construct worktree-population command locally
  worktree: elucidate environment variables intended for child processes
  worktree: make branch creation distinct from worktree population
  worktree: add: suppress auto-vivication with --detach and no <branch>
  worktree: make --detach mutually exclusive with -b/-B
  worktree: introduce options container
  worktree: simplify new branch (-b/-B) option checking
  worktree: improve worktree setup message
  branch: publish die_if_checked_out()
  checkout: teach check_linked_checkout() about symbolic link HEAD
  checkout: check_linked_checkout: simplify symref parsing
  checkout: check_linked_checkout: improve "already checked out" aesthetic
  ...

8 years agoMerge branch 'pt/am-builtin'
Junio C Hamano [Wed, 12 Aug 2015 21:09:55 +0000 (14:09 -0700)] 
Merge branch 'pt/am-builtin'

Rewrite "am" in "C".

* pt/am-builtin: (46 commits)
  git-am: add am.threeWay config variable
  builtin-am: remove redirection to git-am.sh
  builtin-am: check for valid committer ident
  builtin-am: implement legacy -b/--binary option
  builtin-am: implement -i/--interactive
  builtin-am: support and auto-detect mercurial patches
  builtin-am: support and auto-detect StGit series files
  builtin-am: support and auto-detect StGit patches
  builtin-am: rerere support
  builtin-am: invoke post-applypatch hook
  builtin-am: invoke pre-applypatch hook
  builtin-am: invoke applypatch-msg hook
  builtin-am: support automatic notes copying
  builtin-am: invoke post-rewrite hook
  builtin-am: implement -S/--gpg-sign, commit.gpgsign
  builtin-am: implement --committer-date-is-author-date
  builtin-am: implement --ignore-date
  builtin-am: pass git-apply's options to git-apply
  builtin-am: implement --[no-]scissors
  builtin-am: support --keep-cr, am.keepcr
  ...

8 years agoMerge branch 'es/worktree-add'
Junio C Hamano [Wed, 12 Aug 2015 21:09:54 +0000 (14:09 -0700)] 
Merge branch 'es/worktree-add'

Remove remaining cruft from  "git checkout --to", which
transitioned to "git worktree add".

* es/worktree-add:
  config: rename "gc.pruneWorktreesExpire" to "gc.worktreePruneExpire"
  Documentation/git-worktree: wordsmith worktree-related manpages
  Documentation/config: fix stale "git prune --worktree" reference
  Documentation/git-worktree: fix incorrect reference to file "locked"
  Documentation/git-worktree: consistently use term "linked working tree"

8 years agoMerge branch 'ad/bisect-cleanup'
Junio C Hamano [Wed, 12 Aug 2015 21:09:53 +0000 (14:09 -0700)] 
Merge branch 'ad/bisect-cleanup'

Code and documentation clean-up to "git bisect".

* ad/bisect-cleanup:
  bisect: don't mix option parsing and non-trivial code
  bisect: simplify the addition of new bisect terms
  bisect: replace hardcoded "bad|good" by variables
  Documentation/bisect: revise overall content
  Documentation/bisect: move getting help section to the end
  bisect: correction of typo

8 years agotests: fix cleanup after tests in t1509-root-worktree
Patrick Steinhardt [Wed, 5 Aug 2015 09:43:51 +0000 (11:43 +0200)] 
tests: fix cleanup after tests in t1509-root-worktree

During cleanup we do a simple 'rm /*' to remove leftover files
from previous tests. As 'rm' errors out when there is anything it
cannot delete and there are directories present at '/' it will
throw an error, causing the '&&' chain to fail.

Fix this by explicitly removing the files.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agotests: fix broken && chains in t1509-root-worktree
Patrick Steinhardt [Wed, 5 Aug 2015 09:43:50 +0000 (11:43 +0200)] 
tests: fix broken && chains in t1509-root-worktree

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoDocumentation/git-worktree: fix duplicated 'from'
Patrick Steinhardt [Tue, 4 Aug 2015 12:27:57 +0000 (14:27 +0200)] 
Documentation/git-worktree: fix duplicated 'from'

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Acked-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agogit-am: add am.threeWay config variable
Remi Lespinet [Tue, 4 Aug 2015 14:19:26 +0000 (22:19 +0800)] 
git-am: add am.threeWay config variable

Add the am.threeWay configuration variable to use the -3 or --3way
option of git am by default. When am.threeway is set and not desired
for a specific git am command, the --no-3way option can be used to
override it.

Signed-off-by: Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr>
Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobuiltin-am: remove redirection to git-am.sh
Paul Tan [Tue, 4 Aug 2015 13:52:06 +0000 (21:52 +0800)] 
builtin-am: remove redirection to git-am.sh

At the beginning of the rewrite of git-am.sh to C, in order to not break
existing test scripts that depended on a functional git-am, a
redirection to git-am.sh was introduced that would activate if the
environment variable _GIT_USE_BUILTIN_AM was not defined.

Now that all of git-am.sh's functionality has been re-implemented in
builtin/am.c, remove this redirection, and retire git-am.sh into
contrib/examples/.

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobuiltin-am: check for valid committer ident
Paul Tan [Tue, 4 Aug 2015 13:52:05 +0000 (21:52 +0800)] 
builtin-am: check for valid committer ident

When commit_tree() is called, if the user does not have an explicit
committer ident configured, it will attempt to construct a default
committer ident based on the user's and system's info (e.g. gecos field,
hostname etc.) However, if a default committer ident is unable to be
constructed, commit_tree() will die(), but at this point of git-am's
execution, there will already be changes made to the index and work
tree.

This can be confusing to new users, and as such since d64e6b0 (Keep
Porcelainish from failing by broken ident after making changes.,
2006-02-18) git-am.sh will check to see if the committer ident has been
configured, or a default one can be constructed, before even starting to
apply patches.

Re-implement this in builtin/am.c.

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobuiltin-am: implement legacy -b/--binary option
Paul Tan [Tue, 4 Aug 2015 13:52:04 +0000 (21:52 +0800)] 
builtin-am: implement legacy -b/--binary option

The -b/--binary option was initially implemented in 087b674 (git-am:
--binary; document --resume and --binary., 2005-11-16). The option will
pass the --binary flag to git-apply to allow it to apply binary patches.

However, in 2b6eef9 (Make apply --binary a no-op., 2006-09-06), --binary
was been made a no-op in git-apply. Following that, since cb3a160
(git-am: ignore --binary option, 2008-08-09), the --binary option in
git-am is ignored as well.

In 6c15a1c (am: officially deprecate -b/--binary option, 2012-03-13),
the --binary option was tweaked to its present behavior: when set, the
message:

The -b/--binary option has been a no-op for long time, and it
will be removed. Please do not use it anymore.

will be printed.

Re-implement this in builtin/am.c.

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobuiltin-am: implement -i/--interactive
Paul Tan [Tue, 4 Aug 2015 13:52:03 +0000 (21:52 +0800)] 
builtin-am: implement -i/--interactive

Since d1c5f2a (Add git-am, applymbox replacement., 2005-10-07),
git-am.sh supported the --interactive mode. After parsing the patch mail
and extracting the patch, commit message and authorship info, an
interactive session will begin that allows the user to choose between:

* applying the patch

* applying the patch and all subsequent patches (by disabling
  interactive mode in subsequent patches)

* skipping the patch

* editing the commit message

Since f89ad67 (Add [v]iew patch in git-am interactive., 2005-10-25),
git-am.sh --interactive also supported viewing the patch to be applied.

When --resolved-ing in --interactive mode, we need to take care to
update the patch with the contents of the index, such that the correct
patch will be displayed when the patch is viewed in interactive mode.

Re-implement the above in builtin/am.c

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobuiltin-am: support and auto-detect mercurial patches
Paul Tan [Tue, 4 Aug 2015 13:52:02 +0000 (21:52 +0800)] 
builtin-am: support and auto-detect mercurial patches

Since 0cfd112 (am: preliminary support for hg patches, 2011-08-29),
git-am.sh could convert mercurial patches to an RFC2822 mail patch
suitable for parsing with git-mailinfo, and queue them in the state
directory for application.

Since 15ced75 (git-am foreign patch support: autodetect some patch
formats, 2009-05-27), git-am.sh was able to auto-detect mercurial
patches by checking if the file begins with the line:

# HG changeset patch

Re-implement the above in builtin/am.c.

Helped-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobuiltin-am: support and auto-detect StGit series files
Paul Tan [Tue, 4 Aug 2015 13:52:01 +0000 (21:52 +0800)] 
builtin-am: support and auto-detect StGit series files

Since c574e68 (git-am foreign patch support: StGIT support, 2009-05-27),
git-am.sh is able to read a single StGit series file and, for each StGit
patch listed in the file, convert the StGit patch into a RFC2822 mail
patch suitable for parsing with git-mailinfo, and queue them in the
state directory for applying.

Since 15ced75 (git-am foreign patch support: autodetect some patch
formats, 2009-05-27), git-am.sh is able to auto-detect StGit series
files by checking to see if the file starts with the string:

# This series applies on GIT commit

Re-implement the above in builtin/am.c.

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobuiltin-am: support and auto-detect StGit patches
Paul Tan [Tue, 4 Aug 2015 13:52:00 +0000 (21:52 +0800)] 
builtin-am: support and auto-detect StGit patches

Since c574e68 (git-am foreign patch support: StGIT support, 2009-05-27),
git-am.sh supported converting StGit patches into RFC2822 mail patches
that can be parsed with git-mailinfo.

Implement this by introducing two functions in builtin/am.c:
stgit_patch_to_mail() and split_mail_conv().

stgit_patch_to_mail() is a callback function for split_mail_conv(), and
contains the logic for converting an StGit patch into an RFC2822 mail
patch.

split_mail_conv() implements the logic to go through each file in the
`paths` list, reading from stdin where specified, and calls the callback
function to write the converted patch to the corresponding output file
in the state directory. This interface should be generic enough to
support other foreign patch formats in the future.

Since 15ced75 (git-am foreign patch support: autodetect some patch
formats, 2009-05-27), git-am.sh is able to auto-detect StGit patches.
Re-implement this in builtin/am.c.

Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobuiltin-am: rerere support
Paul Tan [Tue, 4 Aug 2015 13:51:59 +0000 (21:51 +0800)] 
builtin-am: rerere support

git-am.sh will call git-rerere at the following events:

* "git rerere" when a three-way merge fails to record the conflicted
  automerge results. Since 8389b52 (git-rerere: reuse recorded resolve.,
  2006-01-28)

  * Since cb6020b (Teach --[no-]rerere-autoupdate option to merge,
    revert and friends, 2009-12-04), git-am.sh supports the
    --[no-]rerere-autoupdate option as well, and would pass it to
    git-rerere.

* "git rerere" when --resolved, to record the hand resolution. Since
  f131dd4 (rerere: record (or avoid misrecording) resolved, skipped or
  aborted rebase/am, 2006-12-08)

* "git rerere clear" when --skip-ing. Since f131dd4 (rerere: record (or
  avoid misrecording) resolved, skipped or aborted rebase/am,
  2006-12-08)

* "git rerere clear" when --abort-ing. Since 3e5057a (git am --abort,
  2008-07-16)

Re-implement the above in builtin/am.c.

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobuiltin-am: invoke post-applypatch hook
Paul Tan [Tue, 4 Aug 2015 13:51:58 +0000 (21:51 +0800)] 
builtin-am: invoke post-applypatch hook

Since d1c5f2a (Add git-am, applymbox replacement., 2005-10-07),
git-am.sh will invoke the post-applypatch hook after the patch is
applied and a commit is made. The exit code of the hook is ignored.

Re-implement this in builtin/am.c.

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobuiltin-am: invoke pre-applypatch hook
Paul Tan [Tue, 4 Aug 2015 13:51:57 +0000 (21:51 +0800)] 
builtin-am: invoke pre-applypatch hook

Since d1c5f2a (Add git-am, applymbox replacement., 2005-10-07),
git-am.sg will invoke the pre-applypatch hook after applying the patch
to the index, but before a commit is made. Should the hook exit with a
non-zero status, git am will exit.

Re-implement this in builtin/am.c.

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobuiltin-am: invoke applypatch-msg hook
Paul Tan [Tue, 4 Aug 2015 13:51:56 +0000 (21:51 +0800)] 
builtin-am: invoke applypatch-msg hook

Since d1c5f2a (Add git-am, applymbox replacement., 2005-10-07),
git-am.sh will invoke the applypatch-msg hooks just after extracting the
patch message. If the applypatch-msg hook exits with a non-zero status,
git-am.sh abort before even applying the patch to the index.

Re-implement this in builtin/am.c.

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobuiltin-am: support automatic notes copying
Paul Tan [Tue, 4 Aug 2015 13:51:55 +0000 (21:51 +0800)] 
builtin-am: support automatic notes copying

Since eb2151b (rebase: support automatic notes copying, 2010-03-12),
git-am.sh supported automatic notes copying in --rebasing mode by
invoking "git notes copy" once it has finished applying all the patches.

Re-implement this feature in builtin/am.c.

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobuiltin-am: invoke post-rewrite hook
Paul Tan [Tue, 4 Aug 2015 13:51:54 +0000 (21:51 +0800)] 
builtin-am: invoke post-rewrite hook

Since 96e1948 (rebase: invoke post-rewrite hook, 2010-03-12), git-am.sh
will invoke the post-rewrite hook after it successfully finishes
applying all the queued patches.

To do this, when parsing a mail to extract its patch and metadata, in
--rebasing mode git-am.sh will also store the original commit ID in the
$state_dir/original-commit file. Once it applies and commits the patch,
the original commit ID, and the new commit ID, will be appended to the
$state_dir/rewritten file.

Once all of the queued mail have been processed, git-am.sh will then
invoke the post-rewrite hook with the contents of the
$state_dir/rewritten file.

Re-implement this in builtin/am.c.

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobuiltin-am: implement -S/--gpg-sign, commit.gpgsign
Paul Tan [Tue, 4 Aug 2015 13:51:53 +0000 (21:51 +0800)] 
builtin-am: implement -S/--gpg-sign, commit.gpgsign

Since 3b4e395 (am: add the --gpg-sign option, 2014-02-01), git-am.sh
supported the --gpg-sign option, and would pass it to git-commit-tree,
thus GPG-signing the commit object.

Re-implement this option in builtin/am.c.

git-commit-tree would also sign the commit by default if the
commit.gpgsign setting is true. Since we do not run commit-tree, we
re-implement this behavior by handling the commit.gpgsign setting
ourselves.

Helped-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobuiltin-am: implement --committer-date-is-author-date
Paul Tan [Tue, 4 Aug 2015 13:51:52 +0000 (21:51 +0800)] 
builtin-am: implement --committer-date-is-author-date

Since 3f01ad6 (am: Add --committer-date-is-author-date option,
2009-01-22), git-am.sh implemented the --committer-date-is-author-date
option, which tells git-am to use the timestamp recorded in the email
message as both author and committer date.

Re-implement this option in builtin/am.c.

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobuiltin-am: implement --ignore-date
Paul Tan [Tue, 4 Aug 2015 13:51:51 +0000 (21:51 +0800)] 
builtin-am: implement --ignore-date

Since a79ec62 (git-am: Add --ignore-date option, 2009-01-24), git-am.sh
supported the --ignore-date option, and would use the current timestamp
instead of the one provided in the patch if the option was set.

Re-implement this option in builtin/am.c.

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobuiltin-am: pass git-apply's options to git-apply
Paul Tan [Tue, 4 Aug 2015 13:51:50 +0000 (21:51 +0800)] 
builtin-am: pass git-apply's options to git-apply

git-am.sh recognizes some of git-apply's options, and would pass them to
git-apply:

* --whitespace, since 8c31cb8 (git-am: --whitespace=x option.,
  2006-02-28)

* -C, since 67dad68 (add -C[NUM] to git-am, 2007-02-08)

* -p, since 2092a1f (Teach git-am to pass -p option down to git-apply,
  2007-02-11)

* --directory, since b47dfe9 (git-am: add --directory=<dir> option,
  2009-01-11)

* --reject, since b80da42 (git-am: implement --reject option passed to
  git-apply, 2009-01-23)

* --ignore-space-change, --ignore-whitespace, since 86c91f9 (git apply:
  option to ignore whitespace differences, 2009-08-04)

* --exclude, since 77e9e49 (am: pass exclude down to apply, 2011-08-03)

* --include, since 58725ef (am: support --include option, 2012-03-28)

* --reject, since b80da42 (git-am: implement --reject option passed to
  git-apply, 2009-01-23)

Re-implement support for these options in builtin/am.c.

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobuiltin-am: implement --[no-]scissors
Paul Tan [Tue, 4 Aug 2015 13:51:49 +0000 (21:51 +0800)] 
builtin-am: implement --[no-]scissors

Since 017678b (am/mailinfo: Disable scissors processing by default,
2009-08-26), git-am supported the --[no-]scissors option, passing it to
git-mailinfo.

Re-implement support for this option in builtin/am.c.

Since the default setting of --scissors in git-mailinfo can be
configured with mailinfo.scissors (and perhaps through other settings in
the future), to be safe we make an explicit distinction between
SCISSORS_UNSET, SCISSORS_TRUE and SCISSORS_FALSE.

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobuiltin-am: support --keep-cr, am.keepcr
Paul Tan [Tue, 4 Aug 2015 13:51:48 +0000 (21:51 +0800)] 
builtin-am: support --keep-cr, am.keepcr

Since ad2c928 (git-am: Add command line parameter `--keep-cr` passing it
to git-mailsplit, 2010-02-27), git-am.sh supported the --keep-cr option
and would pass it to git-mailsplit.

Since e80d4cb (git-am: Add am.keepcr and --no-keep-cr to override it,
2010-02-27), git-am.sh supported the am.keepcr config setting, which
controls whether --keep-cr is on by default.

Re-implement the above in builtin/am.c.

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobuiltin-am: implement --[no-]message-id, am.messageid
Paul Tan [Tue, 4 Aug 2015 13:51:47 +0000 (21:51 +0800)] 
builtin-am: implement --[no-]message-id, am.messageid

Since a078f73 (git-am: add --message-id/--no-message-id, 2014-11-25),
git-am.sh supported the --[no-]message-id options, and the
"am.messageid" setting which specifies the default option.

--[no-]message-id tells git-am whether or not the -m option should be
passed to git-mailinfo.

Re-implement this option in builtin/am.c.

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobuiltin-am: implement -k/--keep, --keep-non-patch
Paul Tan [Tue, 4 Aug 2015 13:51:46 +0000 (21:51 +0800)] 
builtin-am: implement -k/--keep, --keep-non-patch

Since d1c5f2a (Add git-am, applymbox replacement., 2005-10-07),
git-am.sh supported the -k/--keep option to pass the -k option to
git-mailsplit.

Since f7e5ea1 (am: learn passing -b to mailinfo, 2012-01-16), git-am.sh
supported the --keep-non-patch option to pass the -b option to
git-mailsplit.

Re-implement these two options in builtin/am.c.

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobuiltin-am: implement -u/--utf8
Paul Tan [Tue, 4 Aug 2015 13:51:45 +0000 (21:51 +0800)] 
builtin-am: implement -u/--utf8

Since d1c5f2a (Add git-am, applymbox replacement., 2005-10-07),
git-am.sh supported the -u,--utf8 option. If set, the -u option will be
passed to git-mailinfo to re-code the commit log message and authorship
in the charset specified by i18n.commitencoding. If unset, the -n option
will be passed to git-mailinfo, which disables the re-encoding.

Since d84029b (--utf8 is now default for 'git-am', 2007-01-08), --utf8
is specified by default in git-am.sh.

Re-implement the above in builtin/am.c.

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobuiltin-am: handle stray state directory
Paul Tan [Tue, 4 Aug 2015 13:51:44 +0000 (21:51 +0800)] 
builtin-am: handle stray state directory

Should git-am terminate unexpectedly between the point where the state
directory is created, but the "next" and "last" files are not written
yet, a stray state directory will be left behind.

As such, since b141f3c (am: handle stray $dotest directory, 2013-06-15),
git-am.sh explicitly recognizes such a stray directory, and allows the
user to remove it with am --abort.

Re-implement this feature in builtin/am.c.

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobuiltin-am: bypass git-mailinfo when --rebasing
Paul Tan [Tue, 4 Aug 2015 13:51:43 +0000 (21:51 +0800)] 
builtin-am: bypass git-mailinfo when --rebasing

Since 5e835ca (rebase: do not munge commit log message, 2008-04-16),
git am --rebasing no longer gets the commit log message from the patch,
but reads it directly from the commit identified by the "From " header
line.

Since 43c2325 (am: use get_author_ident_from_commit instead of mailinfo
when rebasing, 2010-06-16), git am --rebasing also gets the author name,
email and date directly from the commit.

Since 0fbb95d (am: don't call mailinfo if $rebasing, 2012-06-26), git am
--rebasing does not use git-mailinfo to get the patch body, but rather
generates it directly from the commit itself.

The above 3 commits introduced a separate parse_mail() code path in
git-am.sh's --rebasing mode that bypasses git-mailinfo. Re-implement
this code path in builtin/am.c as parse_mail_rebase().

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobuiltin-am: implement --rebasing mode
Paul Tan [Tue, 4 Aug 2015 13:51:42 +0000 (21:51 +0800)] 
builtin-am: implement --rebasing mode

Since 3041c32 (am: --rebasing, 2008-03-04), git-am.sh supported the
--rebasing option, which is used internally by git-rebase to tell git-am
that it is being used for its purpose. It would create the empty file
$state_dir/rebasing to help "completion" scripts tell if the ongoing
operation is am or rebase.

As of 0fbb95d (am: don't call mailinfo if $rebasing, 2012-06-26),
--rebasing also implies --3way as well.

Since a1549e1 (am: return control to caller, for housekeeping,
2013-05-12), git-am.sh would only clean up the state directory when it
is not --rebasing, instead deferring cleanup to git-rebase.sh.

Re-implement the above in builtin/am.c.

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobuiltin-am: implement --3way
Paul Tan [Tue, 4 Aug 2015 13:51:41 +0000 (21:51 +0800)] 
builtin-am: implement --3way

Since d1c5f2a (Add git-am, applymbox replacement., 2005-10-07),
git-am.sh supported the --3way option, and if set, would attempt to do a
3-way merge if the initial patch application fails.

Since 5d86861 (am -3: list the paths that needed 3-way fallback,
2012-03-28), in a 3-way merge git-am.sh would list the paths that needed
3-way fallback, so that the user can review them more carefully to spot
mismerges.

Re-implement the above in builtin/am.c.

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agocache-tree: introduce write_index_as_tree()
Paul Tan [Tue, 4 Aug 2015 13:51:40 +0000 (21:51 +0800)] 
cache-tree: introduce write_index_as_tree()

A caller may wish to write a temporary index as a tree. However,
write_cache_as_tree() assumes that the index was read from, and will
write to, the default index file path. Introduce write_index_as_tree()
which removes this limitation by allowing the caller to specify its own
index_state and index file path.

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobuiltin-am: implement -s/--signoff
Paul Tan [Tue, 4 Aug 2015 13:51:39 +0000 (21:51 +0800)] 
builtin-am: implement -s/--signoff

Since d1c5f2a (Add git-am, applymbox replacement., 2005-10-07), git-am
supported the --signoff option which will append a signoff at the end of
the commit messsage. Re-implement this feature in parse_mail() by
calling append_signoff() if the option is set.

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobuiltin-am: exit with user friendly message on failure
Paul Tan [Tue, 4 Aug 2015 13:51:38 +0000 (21:51 +0800)] 
builtin-am: exit with user friendly message on failure

Since ced9456 (Give the user a hint for how to continue in the case that
git-am fails because it requires user intervention, 2006-05-02), git-am
prints additional information on how the user can re-invoke git-am to
resume patch application after resolving the failure. Re-implement this
through the die_user_resolve() function.

Since cc12005 (Make git rebase interactive help match documentation.,
2006-05-13), git-am supports the --resolvemsg option which is used by
git-rebase to override the message printed out when git-am fails.
Re-implement this option.

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobuiltin-am: implement -q/--quiet
Paul Tan [Tue, 4 Aug 2015 13:51:37 +0000 (21:51 +0800)] 
builtin-am: implement -q/--quiet

Since 0e987a1 (am, rebase: teach quiet option, 2009-06-16), git-am
supported the --quiet option, and when told to be quiet, would only
speak on failure. Re-implement this by introducing the say() function,
which works like fprintf_ln(), but would only write to the stream when
state->quiet is false.

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobuiltin-am: reject patches when there's a session in progress
Paul Tan [Tue, 4 Aug 2015 13:51:36 +0000 (21:51 +0800)] 
builtin-am: reject patches when there's a session in progress

Since d1c5f2a (Add git-am, applymbox replacement., 2005-10-07), git-am
would error out if the user gave it mbox(s) on the command-line, but
there was a session in progress.

Since c95b138 (Fix git-am safety checks, 2006-09-15), git-am would
detect if the user attempted to feed it a mbox via stdin, by checking if
stdin is not a tty and there is no resume command given.

Re-implement the above two safety checks.

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobuiltin-am: implement --abort
Paul Tan [Tue, 4 Aug 2015 13:51:35 +0000 (21:51 +0800)] 
builtin-am: implement --abort

Since 3e5057a (git am --abort, 2008-07-16), git-am supported the --abort
option that will rewind HEAD back to the original commit. Re-implement
this through am_abort().

Since 7b3b7e3 (am --abort: keep unrelated commits since the last failure
and warn, 2010-12-21), to prevent commits made since the last failure
from being lost, git-am will not rewind HEAD back to the original
commit if HEAD moved since the last failure. Re-implement this through
safe_to_abort().

Helped-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobuiltin-am: implement --skip
Paul Tan [Tue, 4 Aug 2015 13:51:34 +0000 (21:51 +0800)] 
builtin-am: implement --skip

Since d1c5f2a (Add git-am, applymbox replacement., 2005-10-07), git-am
supported resuming from a failed patch application by skipping the
current patch. Re-implement this feature by introducing am_skip().

Helped-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobuiltin-am: don't parse mail when resuming
Paul Tan [Tue, 4 Aug 2015 13:51:33 +0000 (21:51 +0800)] 
builtin-am: don't parse mail when resuming

Since 271440e (git-am: make it easier after fixing up an unapplicable
patch., 2005-10-25), when "git am" is run again after being paused, the
current mail message will not be re-parsed, but instead the contents of
the state directory's patch, msg and author-script files will be used
as-is instead.

Re-implement this in builtin/am.c.

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobuiltin-am: implement --resolved/--continue
Paul Tan [Tue, 4 Aug 2015 13:51:32 +0000 (21:51 +0800)] 
builtin-am: implement --resolved/--continue

Since 0c15cc9 (git-am: --resolved., 2005-11-16), git-am supported
resuming from a failed patch application. The user will manually apply
the patch, and the run git am --resolved which will then commit the
resulting index. Re-implement this feature by introducing am_resolve().

Since it makes no sense for the user to run am --resolved when there is
no session in progress, we error out in this case.

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobuiltin-am: refuse to apply patches if index is dirty
Paul Tan [Tue, 4 Aug 2015 13:51:31 +0000 (21:51 +0800)] 
builtin-am: refuse to apply patches if index is dirty

Since d1c5f2a (Add git-am, applymbox replacement., 2005-10-07), git-am
will refuse to apply patches if the index is dirty. Re-implement this
behavior in builtin/am.c.

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobuiltin-am: implement committing applied patch
Paul Tan [Tue, 4 Aug 2015 13:51:30 +0000 (21:51 +0800)] 
builtin-am: implement committing applied patch

Implement do_commit(), which commits the index which contains the
results of applying the patch, along with the extracted commit message
and authorship information.

Since 29b6754 (am: remove rebase-apply directory before gc, 2010-02-22),
git gc --auto is also invoked to pack the loose objects that are created
from making the commits.

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobuiltin-am: apply patch with git-apply
Paul Tan [Tue, 4 Aug 2015 13:51:29 +0000 (21:51 +0800)] 
builtin-am: apply patch with git-apply

Implement applying the patch to the index using git-apply.

If a file is unchanged but stat-dirty, git-apply may erroneously fail to
apply patches, thinking that they conflict with a dirty working tree.

As such, since 2a6f08a (am: refresh the index at start and --resolved,
2011-08-15), git-am will refresh the index before applying patches.
Re-implement this behavior.

Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobuiltin-am: extract patch and commit info with git-mailinfo
Paul Tan [Tue, 4 Aug 2015 13:51:28 +0000 (21:51 +0800)] 
builtin-am: extract patch and commit info with git-mailinfo

For the purpose of applying the patch and committing the results,
implement extracting the patch data, commit message and authorship from
an e-mail message using git-mailinfo.

git-mailinfo is run as a separate process, but ideally in the future,
we should be be able to access its functionality directly without
spawning a new process.

Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Jeff King <peff@peff.net>
Helped-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobuiltin-am: auto-detect mbox patches
Paul Tan [Tue, 4 Aug 2015 13:51:27 +0000 (21:51 +0800)] 
builtin-am: auto-detect mbox patches

Since 15ced75 (git-am foreign patch support: autodetect some patch
formats, 2009-05-27), git-am.sh is able to autodetect mbox, stgit and
mercurial patches through heuristics.

Re-implement support for autodetecting mbox/maildir files in
builtin/am.c.

RFC 2822 requires that lines are terminated by "\r\n". To support this,
implement strbuf_getline_crlf(), which will remove both '\n' and "\r\n"
from the end of the line.

Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Helped-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobuiltin-am: split out mbox/maildir patches with git-mailsplit
Paul Tan [Tue, 4 Aug 2015 13:51:26 +0000 (21:51 +0800)] 
builtin-am: split out mbox/maildir patches with git-mailsplit

git-am.sh supports mbox, stgit and mercurial patches. Re-implement
support for splitting out mbox/maildirs using git-mailsplit, while also
implementing the framework required to support other patch formats in
the future.

Re-implement support for the --patch-format option (since a5a6755
(git-am foreign patch support: introduce patch_format, 2009-05-27)) to
allow the user to choose between the different patch formats.

Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobuiltin-am: implement patch queue mechanism
Paul Tan [Tue, 4 Aug 2015 13:51:25 +0000 (21:51 +0800)] 
builtin-am: implement patch queue mechanism

git-am applies a series of patches. If the process terminates
abnormally, we want to be able to resume applying the series of patches.
This requires the session state to be saved in a persistent location.

Implement the mechanism of a "patch queue", represented by 2 integers --
the index of the current patch we are applying and the index of the last
patch, as well as its lifecycle through the following functions:

* am_setup(), which will set up the state directory
  $GIT_DIR/rebase-apply. As such, even if the process exits abnormally,
  the last-known state will still persist.

* am_load(), which is called if there is an am session in
  progress, to load the last known state from the state directory so we
  can resume applying patches.

* am_run(), which will do the actual patch application. After applying a
  patch, it calls am_next() to increment the current patch index. The
  logic for applying and committing a patch is not implemented yet.

* am_destroy(), which is finally called when we successfully applied all
  the patches in the queue, to clean up by removing the state directory
  and its contents.

Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Stefan Beller <sbeller@google.com>
Helped-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobuiltin-am: implement skeletal builtin am
Paul Tan [Tue, 4 Aug 2015 13:51:24 +0000 (21:51 +0800)] 
builtin-am: implement skeletal builtin am

For the purpose of rewriting git-am.sh into a C builtin, implement a
skeletal builtin/am.c that redirects to $GIT_EXEC_PATH/git-am if the
environment variable _GIT_USE_BUILTIN_AM is not defined. Since in the
Makefile git-am.sh takes precedence over builtin/am.c,
$GIT_EXEC_PATH/git-am will contain the shell script git-am.sh, and thus
this allows us to fall back on the functional git-am.sh when running the
test suite for tests that depend on a working git-am implementation.

Since git-am.sh cannot handle any environment modifications by
setup_git_directory(), "am" is declared with no setup flags in git.c. On
the other hand, to re-implement git-am.sh in builtin/am.c, we need to
run all the git dir and work tree setup logic that git.c typically does
for us. As such, we work around this temporarily by copying the logic in
git.c's run_builtin(), which is roughly:

prefix = setup_git_directory();
trace_repo_setup(prefix);
setup_work_tree();

This redirection should be removed when all the features of git-am.sh
have been re-implemented in builtin/am.c.

Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agowrapper: implement xfopen()
Paul Tan [Tue, 4 Aug 2015 13:51:23 +0000 (21:51 +0800)] 
wrapper: implement xfopen()

A common usage pattern of fopen() is to check if it succeeded, and die()
if it failed:

FILE *fp = fopen(path, "w");
if (!fp)
die_errno(_("could not open '%s' for writing"), path);

Implement a wrapper function xfopen() for the above, so that we can save
a few lines of code and make the die() messages consistent.

Helped-by: Jeff King <peff@peff.net>
Helped-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agowrapper: implement xopen()
Paul Tan [Tue, 4 Aug 2015 13:51:22 +0000 (21:51 +0800)] 
wrapper: implement xopen()

A common usage pattern of open() is to check if it was successful, and
die() if it was not:

int fd = open(path, O_WRONLY | O_CREAT, 0777);
if (fd < 0)
die_errno(_("Could not open '%s' for writing."), path);

Implement a wrapper function xopen() that does the above so that we can
save a few lines of code, and make the die() messages consistent.

Helped-by: Torsten Bögershausen <tboegi@web.de>
Helped-by: Jeff King <peff@peff.net>
Helped-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agotransport-helper: die on errors reading refs.
Stefan Beller [Fri, 31 Jul 2015 23:57:57 +0000 (16:57 -0700)] 
transport-helper: die on errors reading refs.

We check the return value of read_ref in 19 out of 21 cases.
This adds checks to the missing cases.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobisect: don't mix option parsing and non-trivial code
Matthieu Moy [Mon, 29 Jun 2015 15:40:31 +0000 (17:40 +0200)] 
bisect: don't mix option parsing and non-trivial code

As-is, the revisions that appear on the command-line are processed in
order. This would mix badly with code that changes the configuration
(e.g. change $TERM_GOOD and $TERM_BAD) while processing the options.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agobisect: simplify the addition of new bisect terms
Antoine Delaite [Mon, 29 Jun 2015 15:40:30 +0000 (17:40 +0200)] 
bisect: simplify the addition of new bisect terms

We create a file BISECT_TERMS in the repository .git to be read during a
bisection. There's no user-interface yet, but "git bisect" works if terms
other than old/new or bad/good are set in .git/BISECT_TERMS. The
fonctions to be changed if we add new terms are quite few.

In git-bisect.sh:
check_and_set_terms
bisect_voc

Co-authored-by: Louis Stuber <stuberl@ensimag.grenoble-inp.fr>
Tweaked-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Antoine Delaite <antoine.delaite@ensimag.grenoble-inp.fr>
Signed-off-by: Louis Stuber <stuberl@ensimag.grenoble-inp.fr>
Signed-off-by: Valentin Duperray <Valentin.Duperray@ensimag.imag.fr>
Signed-off-by: Franck Jonas <Franck.Jonas@ensimag.imag.fr>
Signed-off-by: Lucien Kong <Lucien.Kong@ensimag.imag.fr>
Signed-off-by: Thomas Nguy <Thomas.Nguy@ensimag.imag.fr>
Signed-off-by: Huynh Khoi Nguyen Nguyen <Huynh-Khoi-Nguyen.Nguyen@ensimag.imag.fr>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoSync with maint
Junio C Hamano [Mon, 3 Aug 2015 18:20:07 +0000 (11:20 -0700)] 
Sync with maint

* maint:
  Git 2.4.8

8 years agoFirst batch for 2.6
Junio C Hamano [Mon, 3 Aug 2015 18:19:36 +0000 (11:19 -0700)] 
First batch for 2.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoMerge branch 'es/doc-clean-outdated-tools'
Junio C Hamano [Mon, 3 Aug 2015 18:01:32 +0000 (11:01 -0700)] 
Merge branch 'es/doc-clean-outdated-tools'

* es/doc-clean-outdated-tools:
  Documentation/git-tools: retire manually-maintained list
  Documentation/git-tools: drop references to defunct tools
  Documentation/git-tools: fix item text formatting
  Documentation/git-tools: improve discoverability of Git wiki
  Documentation/git: drop outdated Cogito reference

8 years agoMerge branch 'jk/refspec-parse-wildcard'
Junio C Hamano [Mon, 3 Aug 2015 18:01:31 +0000 (11:01 -0700)] 
Merge branch 'jk/refspec-parse-wildcard'

Allow an asterisk as a substring (as opposed to the entirety) of
a path component for both side of a refspec, e.g.
"refs/heads/o*:refs/remotes/heads/i*".

* jk/refspec-parse-wildcard:
  refs: loosen restriction on wildcard "*" refspecs
  refs: cleanup comments regarding check_refname_component()

8 years agoMerge branch 'da/subtree-date-confusion'
Junio C Hamano [Mon, 3 Aug 2015 18:01:31 +0000 (11:01 -0700)] 
Merge branch 'da/subtree-date-confusion'

"git subtree" (in contrib/) depended on "git log" output to be
stable, which was a no-no.  Apply a workaround to force a
particular date format.

* da/subtree-date-confusion:
  contrib/subtree: ignore log.date configuration

8 years agoMerge branch 'jx/do-not-crash-receive-pack-wo-head'
Junio C Hamano [Mon, 3 Aug 2015 18:01:31 +0000 (11:01 -0700)] 
Merge branch 'jx/do-not-crash-receive-pack-wo-head'

An attempt to delete a ref by pushing into a repositorywhose HEAD
symbolic reference points at an unborn branch that cannot be
created due to ref D/F conflict (e.g. refs/heads/a/b exists, HEAD
points at refs/heads/a) failed.

* jx/do-not-crash-receive-pack-wo-head:
  receive-pack: crash when checking with non-exist HEAD

8 years agoMerge branch 'db/send-pack-user-signingkey'
Junio C Hamano [Mon, 3 Aug 2015 18:01:30 +0000 (11:01 -0700)] 
Merge branch 'db/send-pack-user-signingkey'

The low-level "git send-pack" did not honor 'user.signingkey'
configuration variable when sending a signed-push.

* db/send-pack-user-signingkey:
  builtin/send-pack.c: respect user.signingkey

8 years agoMerge branch 'zb/userdiff-fountain'
Junio C Hamano [Mon, 3 Aug 2015 18:01:29 +0000 (11:01 -0700)] 
Merge branch 'zb/userdiff-fountain'

New userdiff pattern definition for fountain screenwriting markup
format.

* zb/userdiff-fountain:
  userdiff: add support for Fountain documents

8 years agoMerge branch 'dt/refs-backend-preamble'
Junio C Hamano [Mon, 3 Aug 2015 18:01:29 +0000 (11:01 -0700)] 
Merge branch 'dt/refs-backend-preamble'

In preparation for allowing different "backends" to store the refs
in a way different from the traditional "one ref per file in $GIT_DIR
or in a $GIT_DIR/packed-refs file" filesystem storage, reduce
direct filesystem access to ref-like things like CHERRY_PICK_HEAD
from scripts and programs.

* dt/refs-backend-preamble:
  git-stash: use update-ref --create-reflog instead of creating files
  update-ref and tag: add --create-reflog arg
  refs: add REF_FORCE_CREATE_REFLOG flag
  git-reflog: add exists command
  refs: new public ref function: safe_create_reflog
  refs: break out check for reflog autocreation
  refs.c: add err arguments to reflog functions

8 years agoMerge branch 'as/sparse-checkout-removal'
Junio C Hamano [Mon, 3 Aug 2015 18:01:28 +0000 (11:01 -0700)] 
Merge branch 'as/sparse-checkout-removal'

"sparse checkout" misbehaved for a path that is excluded from the
checkout when switching between branches that differ at the path.

* as/sparse-checkout-removal:
  unpack-trees: don't update files with CE_WT_REMOVE set

8 years agoMerge branch 'jk/date-mode-format'
Junio C Hamano [Mon, 3 Aug 2015 18:01:27 +0000 (11:01 -0700)] 
Merge branch 'jk/date-mode-format'

Teach "git log" and friends a new "--date=format:..." option to
format timestamps using system's strftime(3).

* jk/date-mode-format:
  strbuf: make strbuf_addftime more robust
  introduce "format" date-mode
  convert "enum date_mode" into a struct
  show-branch: use DATE_RELATIVE instead of magic number

8 years agoMerge branch 'pt/am-tests'
Junio C Hamano [Mon, 3 Aug 2015 18:01:26 +0000 (11:01 -0700)] 
Merge branch 'pt/am-tests'

* pt/am-tests:
  t3901: test git-am encoding conversion
  t3418: non-interactive rebase --continue with rerere enabled
  t4150: tests for am --[no-]scissors
  t4150: am with post-applypatch hook
  t4150: am with pre-applypatch hook
  t4150: am with applypatch-msg hook
  t4150: am --resolved fails if index has unmerged entries
  t4150: am --resolved fails if index has no changes
  t4150: am refuses patches when paused
  t4151: am --abort will keep dirty index intact
  t4150: am fails if index is dirty
  t4150: am.messageid really adds the message id

8 years agoMerge branch 'sg/bash-prompt-untracked-optim'
Junio C Hamano [Mon, 3 Aug 2015 18:01:26 +0000 (11:01 -0700)] 
Merge branch 'sg/bash-prompt-untracked-optim'

Optimize computation of untracked status indicator by bash prompt
script (in contrib/).

* sg/bash-prompt-untracked-optim:
  bash prompt: faster untracked status indicator with untracked directories
  bash prompt: test untracked files status indicator with untracked dirs

8 years agoMerge branch 'cb/uname-in-untracked'
Junio C Hamano [Mon, 3 Aug 2015 18:01:26 +0000 (11:01 -0700)] 
Merge branch 'cb/uname-in-untracked'

An experimental "untracked cache" feature used uname(2) in a
slightly unportable way.

* cb/uname-in-untracked:
  untracked: fix detection of uname(2) failure

8 years agoMerge branch 'se/doc-checkout-ours-theirs'
Junio C Hamano [Mon, 3 Aug 2015 18:01:25 +0000 (11:01 -0700)] 
Merge branch 'se/doc-checkout-ours-theirs'

A "rebase" replays changes of the local branch on top of something
else, as such they are placed in stage #3 and referred to as
"theirs", while the changes in the new base, typically a foreign
work, are placed in stage #2 and referred to as "ours".  Clarify
the "checkout --ours/--theirs".

* se/doc-checkout-ours-theirs:
  checkout: document subtlety around --ours/--theirs

8 years agoMerge branch 'ib/scripted-parse-opt-better-hint-string'
Junio C Hamano [Mon, 3 Aug 2015 18:01:24 +0000 (11:01 -0700)] 
Merge branch 'ib/scripted-parse-opt-better-hint-string'

The "rev-parse --parseopt" mode parsed the option specification
and the argument hint in a strange way to allow '=' and other
special characters in the option name while forbidding them from
the argument hint.  This made it impossible to define an option
like "--pair <key>=<value>" with "pair=key=value" specification,
which instead would have defined a "--pair=key <value>" option.

* ib/scripted-parse-opt-better-hint-string:
  rev-parse --parseopt: allow [*=?!] in argument hints

8 years agoMerge branch 'mh/fast-import-optimize-current-from'
Junio C Hamano [Mon, 3 Aug 2015 18:01:24 +0000 (11:01 -0700)] 
Merge branch 'mh/fast-import-optimize-current-from'

Often a fast-import stream builds a new commit on top of the
previous commit it built, and it often unconditionally emits a
"from" command to specify the first parent, which can be omitted in
such a case.  This caused fast-import to forget the tree of the
previous commit and then re-read it from scratch, which was
inefficient.  Optimize for this common case.

* mh/fast-import-optimize-current-from:
  fast-import: do less work when given "from" matches current branch head

8 years agoMerge branch 'kn/tag-doc-fix'
Junio C Hamano [Mon, 3 Aug 2015 18:01:23 +0000 (11:01 -0700)] 
Merge branch 'kn/tag-doc-fix'

* kn/tag-doc-fix:
  Documentation/tag: remove double occurance of "<pattern>"

8 years agoMerge branch 'mh/fast-import-get-mark'
Junio C Hamano [Mon, 3 Aug 2015 18:01:23 +0000 (11:01 -0700)] 
Merge branch 'mh/fast-import-get-mark'

"git fast-import" learned to respond to the get-mark command via
its cat-blob-fd interface.

* mh/fast-import-get-mark:
  fast-import: add a get-mark command

8 years agoMerge branch 'gr/rebase-i-drop-warn'
Junio C Hamano [Mon, 3 Aug 2015 18:01:22 +0000 (11:01 -0700)] 
Merge branch 'gr/rebase-i-drop-warn'

Add "drop commit-object-name subject" command as another way to
skip replaying of a commit in "rebase -i", and then punish those
who do not use it (and instead just remove the lines) by throwing
a warning.

* gr/rebase-i-drop-warn:
  git rebase -i: add static check for commands and SHA-1
  git rebase -i: warn about removed commits
  git-rebase -i: add command "drop" to remove a commit

8 years agoMerge branch 'jc/commit-slab'
Junio C Hamano [Mon, 3 Aug 2015 18:01:21 +0000 (11:01 -0700)] 
Merge branch 'jc/commit-slab'

Memory use reduction when commit-slab facility is used to annotate
sparsely (which is not recommended in the first place).

* jc/commit-slab:
  commit-slab: introduce slabname##_peek() function

8 years agoMerge branch 'dt/log-follow-config'
Junio C Hamano [Mon, 3 Aug 2015 18:01:20 +0000 (11:01 -0700)] 
Merge branch 'dt/log-follow-config'

Add a new configuration variable to enable "--follow" automatically
when "git log" is run with one pathspec argument.

* dt/log-follow-config:
  log: add "log.follow" configuration variable

8 years agoMerge branch 'gp/status-rebase-i-info'
Junio C Hamano [Mon, 3 Aug 2015 18:01:19 +0000 (11:01 -0700)] 
Merge branch 'gp/status-rebase-i-info'

Teach "git status" to show a more detailed information regarding
the "rebase -i" session in progress.

* gp/status-rebase-i-info:
  status: add new tests for status during rebase -i
  status: give more information during rebase -i
  status: differentiate interactive from non-interactive rebases
  status: factor two rebase-related messages together

8 years agoMerge branch 'jk/cat-file-batch-all'
Junio C Hamano [Mon, 3 Aug 2015 18:01:19 +0000 (11:01 -0700)] 
Merge branch 'jk/cat-file-batch-all'

"cat-file" learned "--batch-all-objects" option to enumerate all
available objects in the repository more quickly than "rev-list
--all --objects" (the output includes unreachable objects, though).

* jk/cat-file-batch-all:
  cat-file: sort and de-dup output of --batch-all-objects
  cat-file: add --batch-all-objects option
  cat-file: split batch_one_object into two stages
  cat-file: stop returning value from batch_one_object
  cat-file: add --buffer option
  cat-file: move batch_options definition to top of file
  cat-file: minor style fix in options list

8 years agoMerge branch 'js/fsck-opt'
Junio C Hamano [Mon, 3 Aug 2015 18:01:18 +0000 (11:01 -0700)] 
Merge branch 'js/fsck-opt'

Allow ignoring fsck errors on specific set of known-to-be-bad
objects, and also tweaking warning level of various kinds of non
critical breakages reported.

* js/fsck-opt:
  fsck: support ignoring objects in `git fsck` via fsck.skiplist
  fsck: git receive-pack: support excluding objects from fsck'ing
  fsck: introduce `git fsck --connectivity-only`
  fsck: support demoting errors to warnings
  fsck: document the new receive.fsck.<msg-id> options
  fsck: allow upgrading fsck warnings to errors
  fsck: optionally ignore specific fsck issues completely
  fsck: disallow demoting grave fsck errors to warnings
  fsck: add a simple test for receive.fsck.<msg-id>
  fsck: make fsck_tag() warn-friendly
  fsck: handle multiple authors in commits specially
  fsck: make fsck_commit() warn-friendly
  fsck: make fsck_ident() warn-friendly
  fsck: report the ID of the error/warning
  fsck (receive-pack): allow demoting errors to warnings
  fsck: offer a function to demote fsck errors to warnings
  fsck: provide a function to parse fsck message IDs
  fsck: introduce identifiers for fsck messages
  fsck: introduce fsck options

8 years agoMerge branch 'mh/init-delete-refs-api'
Junio C Hamano [Mon, 3 Aug 2015 18:01:17 +0000 (11:01 -0700)] 
Merge branch 'mh/init-delete-refs-api'

Clean up refs API and make "git clone" less intimate with the
implementation detail.

* mh/init-delete-refs-api:
  delete_ref(): use the usual convention for old_sha1
  cmd_update_ref(): make logic more straightforward
  update_ref(): don't read old reference value before delete
  check_branch_commit(): make first parameter const
  refs.h: add some parameter names to function declarations
  refs: move the remaining ref module declarations to refs.h
  initial_ref_transaction_commit(): check for ref D/F conflicts
  initial_ref_transaction_commit(): check for duplicate refs
  refs: remove some functions from the module's public interface
  initial_ref_transaction_commit(): function for initial ref creation
  repack_without_refs(): make function private
  prune_refs(): use delete_refs()
  prune_remote(): use delete_refs()
  delete_refs(): bail early if the packed-refs file cannot be rewritten
  delete_refs(): make error message more generic
  delete_refs(): new function for the refs API
  delete_ref(): handle special case more explicitly
  remove_branches(): remove temporary
  delete_ref(): move declaration to refs.h

8 years agoMerge branch 'pt/pull-builtin'
Junio C Hamano [Mon, 3 Aug 2015 18:01:17 +0000 (11:01 -0700)] 
Merge branch 'pt/pull-builtin'

Reimplement 'git pull' in C.

* pt/pull-builtin:
  pull: remove redirection to git-pull.sh
  pull --rebase: error on no merge candidate cases
  pull --rebase: exit early when the working directory is dirty
  pull: configure --rebase via branch.<name>.rebase or pull.rebase
  pull: teach git pull about --rebase
  pull: set reflog message
  pull: implement pulling into an unborn branch
  pull: fast-forward working tree if head is updated
  pull: check if in unresolved merge state
  pull: support pull.ff config
  pull: error on no merge candidates
  pull: pass git-fetch's options to git-fetch
  pull: pass git-merge's options to git-merge
  pull: pass verbosity, --progress flags to fetch and merge
  pull: implement fetch + merge
  pull: implement skeletal builtin pull
  argv-array: implement argv_array_pushv()
  parse-options-cb: implement parse_opt_passthru_argv()
  parse-options-cb: implement parse_opt_passthru()

8 years agoMerge branch 'jk/pkt-log-pack'
Junio C Hamano [Mon, 3 Aug 2015 18:01:16 +0000 (11:01 -0700)] 
Merge branch 'jk/pkt-log-pack'

Enhance packet tracing machinery to allow capturing an incoming
pack data to a file for debugging.

* jk/pkt-log-pack:
  pkt-line: support tracing verbatim pack contents
  pkt-line: tighten sideband PACK check when tracing
  pkt-line: simplify starts_with checks in packet tracing

8 years agoMerge branch 'mr/rebase-i-customize-insn-sheet'
Junio C Hamano [Mon, 3 Aug 2015 18:01:16 +0000 (11:01 -0700)] 
Merge branch 'mr/rebase-i-customize-insn-sheet'

"git rebase -i"'s list of todo is made configurable.

* mr/rebase-i-customize-insn-sheet:
  git-rebase--interactive.sh: add config option for custom instruction format

8 years agoMerge branch 'rl/send-email-aliases'
Junio C Hamano [Mon, 3 Aug 2015 18:01:15 +0000 (11:01 -0700)] 
Merge branch 'rl/send-email-aliases'

"git send-email" now performs alias-expansion on names that are
given via --cccmd, etc.

This round comes with a lot more enhanced e-mail address parser,
which makes it a bit scary, but as long as it works as designed, it
makes it wonderful ;-).

* rl/send-email-aliases:
  send-email: suppress meaningless whitespaces in from field
  send-email: allow multiple emails using --cc, --to and --bcc
  send-email: consider quote as delimiter instead of character
  send-email: reduce dependencies impact on parse_address_line
  send-email: minor code refactoring
  send-email: allow use of aliases in the From field of --compose mode
  send-email: refactor address list process
  t9001-send-email: refactor header variable fields replacement
  send-email: allow aliases in patch header and command script outputs
  t9001-send-email: move script creation in a setup test

8 years agoMerge branch 'kb/i18n-doc'
Junio C Hamano [Mon, 3 Aug 2015 18:01:15 +0000 (11:01 -0700)] 
Merge branch 'kb/i18n-doc'

* kb/i18n-doc:
  Documentation/i18n.txt: clarify character encoding support