[PATCH v4 03/44] builtin-am: implement skeletal builtin am

2015-06-28 Thread Paul Tan
= 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 gits...@pobox.com Signed-off-by: Paul Tan pyoka...@gmail.com --- Notes: v4

[PATCH v4 01/44] wrapper: implement xopen()

2015-06-28 Thread Paul Tan
that we can save a few lines of code, and make the die() messages consistent. Helped-by: Torsten Bögershausen tbo...@web.de Helped-by: Jeff King p...@peff.net Signed-off-by: Paul Tan pyoka...@gmail.com --- git-compat-util.h | 1 + wrapper.c | 25 + 2 files changed

[PATCH v4 05/44] builtin-am: split out mbox/maildir patches with git-mailsplit

2015-06-28 Thread Paul Tan
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 gits...@pobox.com Signed-off-by: Paul Tan pyoka...@gmail.com --- Notes: v4 * The term patch was overloaded to mean the RFC2822 mail

[PATCH v4 07/44] builtin-am: extract patch and commit info with git-mailinfo

2015-06-28 Thread Paul Tan
directly without spawning a new process. Helped-by: Junio C Hamano gits...@pobox.com Helped-by: Jeff King p...@peff.net Helped-by: Johannes Schindelin johannes.schinde...@gmx.de Signed-off-by: Paul Tan pyoka...@gmail.com --- Notes: v4 * The word patch was overloaded to mean the RFC2822

[PATCH v4 06/44] builtin-am: auto-detect mbox patches

2015-06-28 Thread Paul Tan
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 gits...@pobox.com Helped-by: Eric Sunshine sunsh...@sunshineco.com Helped-by: Johannes Schindelin johannes.schinde...@gmx.de Signed-off-by: Paul Tan

[PATCH v4 00/44] Make git-am a builtin

2015-06-28 Thread Paul Tan
of git's internal caches. This WIP patch series rewrites git-am.sh into optimized C builtin/am.c, and is part of my GSoC project to rewrite git-pull and git-am into C builtins[1]. [1] https://gist.github.com/pyokagan/1b7b0d1f4dab6ba3cef1 Paul Tan (44): wrapper: implement xopen() wrapper: implement

Re: [PATCH/WIP v3 06/31] am: detect mbox patches

2015-06-26 Thread Paul Tan
On Thu, Jun 25, 2015 at 9:40 PM, Paul Tan pyoka...@gmail.com wrote: On Wed, Jun 24, 2015 at 11:10 PM, Johannes Schindelin johannes.schinde...@gmx.de wrote: + else if (l1.len l2.len l3.len is_email(paths-items-string)) + ret = PATCH_FORMAT_MBOX; Maybe we can do better than

Re: [PATCH/WIP v3 07/31] am: extract patch, message and authorship with git-mailinfo

2015-06-26 Thread Paul Tan
On Thu, Jun 25, 2015 at 12:36 AM, Johannes Schindelin johannes.schinde...@gmx.de wrote: On 2015-06-18 13:25, Paul Tan wrote: diff --git a/builtin/am.c b/builtin/am.c index 7b97ea8..d6434e4 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -94,6 +126,105 @@ static int read_state_file(struct

Re: [PATCH/WIP v3 06/31] am: detect mbox patches

2015-06-25 Thread Paul Tan
On Wed, Jun 24, 2015 at 11:10 PM, Johannes Schindelin johannes.schinde...@gmx.de wrote: Hi Paul, On 2015-06-18 13:25, Paul Tan wrote: diff --git a/builtin/am.c b/builtin/am.c index e9a3687..7b97ea8 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -121,6 +121,96 @@ static void am_destroy

Re: [PATCH/WIP v3 07/31] am: extract patch, message and authorship with git-mailinfo

2015-06-25 Thread Paul Tan
On Wed, Jun 24, 2015 at 11:59 PM, Junio C Hamano gits...@pobox.com wrote: Paul Tan pyoka...@gmail.com writes: 3. I'm over-thinking this and you just want the struct strbufs in the struct am_state to be switched to char*s? Yes, everybody interacts with am_state, and these fields

Re: [PATCH/WIP v3 04/31] am: implement patch queue mechanism

2015-06-25 Thread Paul Tan
On Wed, Jun 24, 2015 at 10:59 PM, Johannes Schindelin johannes.schinde...@gmx.de wrote: diff --git a/builtin/am.c b/builtin/am.c index dbc8836..af68c51 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -6,6 +6,158 @@ #include cache.h #include builtin.h #include exec_cmd.h +#include

Re: [PATCH/WIP v3 07/31] am: extract patch, message and authorship with git-mailinfo

2015-06-24 Thread Paul Tan
C Hamano wrote: Paul Tan pyoka...@gmail.com writes: With the above fields, it is clear that the above fields are per-message thing. So the loop to process multiple messages is conceptually: set up the entire am_state (for things like cur=1, last=N) for each message

Re: [PATCH/WIP v3 06/31] am: detect mbox patches

2015-06-24 Thread Paul Tan
On Fri, Jun 19, 2015 at 5:02 AM, Junio C Hamano gits...@pobox.com wrote: Paul Tan pyoka...@gmail.com writes: +static int is_email(const char *filename) +{ + struct strbuf sb = STRBUF_INIT; + FILE *fp = xfopen(filename, r); + int ret = 1; + + while (!strbuf_getline(sb, fp

Re: [PATCH/RFC] Revert git am/mailinfo: Don't look at in-body headers when rebasing

2015-06-24 Thread Paul Tan
Hi Junio, On Tue, Jun 16, 2015 at 5:03 PM, Paul Tan pyoka...@gmail.com wrote: This reverts commit d25e51596be9271ad833805a3d6f9012dc24ee79, removing git-mailsplit's --no-inbody-headers option. While --no-inbody-headers was introduced to prevent commit messages from being munged by git

Re: [PATCH/WIP v3 03/31] am: implement skeletal builtin am

2015-06-19 Thread Paul Tan
On Fri, Jun 19, 2015 at 4:26 AM, Junio C Hamano gits...@pobox.com wrote: Paul Tan pyoka...@gmail.com writes: @@ -0,0 +1,28 @@ +/* + * Builtin git am + * + * Based on git-am.sh by Junio C Hamano. + */ +#include cache.h +#include builtin.h +#include exec_cmd.h + +int cmd_am(int argc

Re: [PATCH v4 00/19] Make git-pull a builtin

2015-06-19 Thread Paul Tan
On Fri, Jun 19, 2015 at 4:13 AM, Junio C Hamano gits...@pobox.com wrote: I didn't look carefully, but does that mean 04/19 has the what if you start from a subdirectory and are still using the scripted one? issue we discussed recently for am? It does, but git-pull.sh does not care about the

Re: [PATCH/WIP v3 04/31] am: implement patch queue mechanism

2015-06-19 Thread Paul Tan
On Fri, Jun 19, 2015 at 4:43 AM, Junio C Hamano gits...@pobox.com wrote: Paul Tan pyoka...@gmail.com writes: diff --git a/builtin/am.c b/builtin/am.c index dbc8836..af68c51 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -6,6 +6,158 @@ #include cache.h #include builtin.h #include

Re: [PATCH/WIP v3 10/31] am: refresh the index at start

2015-06-19 Thread Paul Tan
On Fri, Jun 19, 2015 at 5:28 AM, Junio C Hamano gits...@pobox.com wrote: Paul Tan pyoka...@gmail.com writes: 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

Re: [PATCH/WIP v3 07/31] am: extract patch, message and authorship with git-mailinfo

2015-06-19 Thread Paul Tan
On Fri, Jun 19, 2015 at 5:10 AM, Junio C Hamano gits...@pobox.com wrote: Paul Tan pyoka...@gmail.com writes: + /* commit message and metadata */ + struct strbuf author_name; + struct strbuf author_email; + struct strbuf author_date; + struct strbuf msg; Same comment

Re: [PATCH/WIP v3 07/31] am: extract patch, message and authorship with git-mailinfo

2015-06-19 Thread Paul Tan
On Fri, Jun 19, 2015 at 11:09 PM, Junio C Hamano gits...@pobox.com wrote: You do realize that strbuf internally does alloc/free so as a solution to fragmentation issue you are at the mercy of the same alloc/free, don't you? Yes, of course, but it has the alloc variable to keep track of the size

[PATCH/WIP v3 09/31] am: commit applied patch

2015-06-18 Thread Paul Tan
Implement do_commit(), which commits the index which contains the results of applying the patch, along with the extracted commit message and authorship information. Signed-off-by: Paul Tan pyoka...@gmail.com --- builtin/am.c | 51 +++ 1 file

[PATCH/WIP v3 08/31] am: apply patch with git-apply

2015-06-18 Thread Paul Tan
Implement applying the patch to the index using git-apply. Signed-off-by: Paul Tan pyoka...@gmail.com --- builtin/am.c | 57 - 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/builtin/am.c b/builtin/am.c index d6434e4..296a5fc

[PATCH/WIP v3 02/31] wrapper: implement xfopen()

2015-06-18 Thread Paul Tan
of code and make the die() messages consistent. Signed-off-by: Paul Tan pyoka...@gmail.com --- git-compat-util.h | 1 + wrapper.c | 18 ++ 2 files changed, 19 insertions(+) diff --git a/git-compat-util.h b/git-compat-util.h index bc77d77..4e69110 100644 --- a/git-compat

[PATCH/WIP v3 03/31] am: implement skeletal builtin am

2015-06-18 Thread Paul Tan
(); 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 gits...@pobox.com Signed-off-by: Paul Tan pyoka...@gmail.com --- Notes: v3 * Style

[PATCH/WIP v3 01/31] wrapper: implement xopen()

2015-06-18 Thread Paul Tan
that we can save a few lines of code, and make the die() messages consistent. Helped-by: Torsten Bögershausen tbo...@web.de Helped-by: Jeff King p...@peff.net Signed-off-by: Paul Tan pyoka...@gmail.com --- git-compat-util.h | 1 + wrapper.c | 25 + 2 files changed

[PATCH/WIP v3 05/31] am: split out mbox/maildir patches with git-mailsplit

2015-06-18 Thread Paul Tan
foreign patch support: introduce patch_format, 2009-05-27)) to allow the user to choose between the different patch formats. Signed-off-by: Paul Tan pyoka...@gmail.com --- Notes: v3 * Moved the TODO comment to the previous patch builtin/am.c | 104

[PATCH v4 19/19] pull: remove redirection to git-pull.sh

2015-06-18 Thread Paul Tan
-implemented in builtin/pull.c, remove this redirection, and retire the old git-pull.sh into contrib/examples/. Signed-off-by: Paul Tan pyoka...@gmail.com --- Makefile| 1 - builtin/pull.c | 7 --- git-pull.sh = contrib/examples/git

[PATCH v4 14/19] pull: set reflog message

2015-06-18 Thread Paul Tan
-by: Junio C Hamano gits...@pobox.com Signed-off-by: Paul Tan pyoka...@gmail.com --- builtin/pull.c | 22 ++ 1 file changed, 22 insertions(+) diff --git a/builtin/pull.c b/builtin/pull.c index 492bb0e..98caffe 100644 --- a/builtin/pull.c +++ b/builtin/pull.c @@ -169,6 +169,25

[PATCH v4 17/19] pull --rebase: exit early when the working directory is dirty

2015-06-18 Thread Paul Tan
Re-implement the behavior introduced by f9189cf (pull --rebase: exit early when the working directory is dirty, 2008-05-21). Signed-off-by: Paul Tan pyoka...@gmail.com --- builtin/pull.c | 77 +- 1 file changed, 76 insertions(+), 1 deletion

[PATCH/WIP v3 31/31] am: implement -S/--gpg-sign, commit.gpgsign

2015-06-18 Thread Paul Tan
setting is true. Since we do not run commit-tree, we re-implement this behavior by handling the commit.gpgsign setting ourselves. Signed-off-by: Paul Tan pyoka...@gmail.com --- builtin/am.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/builtin/am.c b/builtin/am.c

[PATCH/WIP v3 18/31] am: implement am --signoff

2015-06-18 Thread Paul Tan
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 by calling append_signoff() if the option is set. Signed-off-by: Paul Tan pyoka...@gmail.com --- builtin

[PATCH/WIP v3 07/31] am: extract patch, message and authorship with git-mailinfo

2015-06-18 Thread Paul Tan
directly without spawning a new process. Helped-by: Junio C Hamano gits...@pobox.com Helped-by: Jeff King p...@peff.net Signed-off-by: Paul Tan pyoka...@gmail.com --- Notes: v3 * Style fixes builtin/am.c | 232 +++ 1 file changed

[PATCH/WIP v3 00/31] Make git-am a builtin

2015-06-18 Thread Paul Tan
to rewrite git-pull and git-am into C builtins[1]. [1] https://gist.github.com/pyokagan/1b7b0d1f4dab6ba3cef1 Paul Tan (31): wrapper: implement xopen() wrapper: implement xfopen() am: implement skeletal builtin am am: implement patch queue mechanism am: split out mbox/maildir patches with git

[PATCH/WIP v3 06/31] am: detect mbox patches

2015-06-18 Thread Paul Tan
-by: Paul Tan pyoka...@gmail.com --- builtin/am.c | 98 1 file changed, 98 insertions(+) diff --git a/builtin/am.c b/builtin/am.c index e9a3687..7b97ea8 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -121,6 +121,96 @@ static void

[PATCH/WIP v3 04/31] am: implement patch queue mechanism

2015-06-18 Thread Paul Tan
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. Signed-off-by: Paul Tan pyoka...@gmail.com --- builtin/am.c | 168

[PATCH/WIP v3 28/31] am: pass git-apply's options to git-apply

2015-06-18 Thread Paul Tan
, 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) Re-implement support for these options in builtin/am.c. Signed-off-by: Paul Tan pyoka...@gmail.com --- builtin/am.c | 46

[PATCH/WIP v3 30/31] am: implement --committer-date-is-author-date

2015-06-18 Thread Paul Tan
-off-by: Paul Tan pyoka...@gmail.com --- builtin/am.c | 9 + 1 file changed, 9 insertions(+) diff --git a/builtin/am.c b/builtin/am.c index 6623b49..608a2da 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -130,6 +130,8 @@ struct am_state { /* override error message when patch

[PATCH/WIP v3 19/31] cache-tree: introduce write_index_as_tree()

2015-06-18 Thread Paul Tan
file path. Signed-off-by: Paul Tan pyoka...@gmail.com --- cache-tree.c | 29 + cache-tree.h | 1 + 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/cache-tree.c b/cache-tree.c index 32772b9..feace8b 100644 --- a/cache-tree.c +++ b/cache-tree.c

[PATCH/WIP v3 20/31] am: implement 3-way merge

2015-06-18 Thread Paul Tan
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 pyoka...@gmail.com --- builtin/am.c | 147 +-- 1 file changed

[PATCH/WIP v3 27/31] am: implement --[no-]scissors

2015-06-18 Thread Paul Tan
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. Signed-off-by: Paul Tan pyoka...@gmail.com --- Notes: There are tests for mailinfo --scissors

[PATCH/WIP v3 14/31] am: implement --abort

2015-06-18 Thread Paul Tan
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(). Signed-off-by: Paul Tan pyoka...@gmail.com --- builtin/am.c | 95

[PATCH/WIP v3 15/31] am: don't accept patches when there's a session in progress

2015-06-18 Thread Paul Tan
, 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 pyoka...@gmail.com --- Notes: NOTE: there's no test for this builtin/am.c | 19 +-- 1 file changed, 17 insertions(+), 2 deletions

[PATCH/WIP v3 21/31] am: --rebasing

2015-06-18 Thread Paul Tan
-rebase.sh. Re-implement the above in builtin/am.c. Signed-off-by: Paul Tan pyoka...@gmail.com --- builtin/am.c | 24 +--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/builtin/am.c b/builtin/am.c index e154c87..9afa3bb 100644 --- a/builtin/am.c +++ b/builtin

[PATCH/WIP v3 10/31] am: refresh the index at start

2015-06-18 Thread Paul Tan
this behavior. Signed-off-by: Paul Tan pyoka...@gmail.com --- builtin/am.c | 20 1 file changed, 20 insertions(+) diff --git a/builtin/am.c b/builtin/am.c index dfb6f7e..a7efe85 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -13,6 +13,7 @@ #include cache-tree.h #include

[PATCH/WIP v3 26/31] am: support --keep-cr, am.keepcr

2015-06-18 Thread Paul Tan
config setting, which controls whether --keep-cr is on by default. Re-implement the above in builtin/am.c. Signed-off-by: Paul Tan pyoka...@gmail.com --- builtin/am.c | 30 -- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/builtin/am.c b/builtin/am.c

[PATCH/WIP v3 24/31] am: implement -k/--keep, --keep-non-patch

2015-06-18 Thread Paul Tan
. Re-implement these two options in builtin/am.c. Signed-off-by: Paul Tan pyoka...@gmail.com --- builtin/am.c | 51 +++ 1 file changed, 51 insertions(+) diff --git a/builtin/am.c b/builtin/am.c index bbef91f..b73549f 100644 --- a/builtin/am.c +++ b

[PATCH/WIP v3 16/31] am: implement quiet option

2015-06-18 Thread Paul Tan
to the stream when state-quiet is false. Signed-off-by: Paul Tan pyoka...@gmail.com --- builtin/am.c | 36 +--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/builtin/am.c b/builtin/am.c index 4adc487..5f38264 100644 --- a/builtin/am.c +++ b/builtin/am.c

[PATCH/WIP v3 12/31] am: implement --resolved/--continue

2015-06-18 Thread Paul Tan
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 pyoka...@gmail.com --- builtin/am.c | 55 ++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/builtin

[PATCH/WIP v3 22/31] am: don't use git-mailinfo if --rebasing

2015-06-18 Thread Paul Tan
. The above 3 commits introduced a separate parse_patch() code path in git-am.sh's --rebasing mode that bypasses git-mailinfo. Re-implement this code path in builtin/am.c as parse_patch_rebase(). Signed-off-by: Paul Tan pyoka...@gmail.com --- builtin/am.c | 155

[PATCH/WIP v3 29/31] am: implement --ignore-date

2015-06-18 Thread Paul Tan
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 pyoka...@gmail.com

[PATCH/WIP v3 25/31] am: implement --[no-]message-id, am.messageid

2015-06-18 Thread Paul Tan
this option in builtin/am.c. Signed-off-by: Paul Tan pyoka...@gmail.com --- Notes: No test for am.messageid builtin/am.c | 15 +++ 1 file changed, 15 insertions(+) diff --git a/builtin/am.c b/builtin/am.c index b73549f..4cec380 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -113,6

[PATCH/WIP v3 13/31] am: implement --skip

2015-06-18 Thread Paul Tan
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(). Signed-off-by: Paul Tan pyoka...@gmail.com --- builtin/am.c | 121

[PATCH/WIP v3 11/31] am: refuse to apply patches if index is dirty

2015-06-18 Thread Paul Tan
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. Signed-off-by: Paul Tan pyoka...@gmail.com --- Notes: Note: no tests for this builtin/am.c | 46

[PATCH/WIP v3 23/31] am: handle stray state directory

2015-06-18 Thread Paul Tan
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 pyoka...@gmail.com --- builtin/am.c | 15 +++ 1 file changed, 15 insertions(+) diff --git a/builtin/am.c b/builtin/am.c index 0d7e37c..bbef91f

[PATCH/WIP v3 17/31] am: exit with user friendly message on patch failure

2015-06-18 Thread Paul Tan
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 pyoka

[PATCH v4 15/19] pull: teach git pull about --rebase

2015-06-18 Thread Paul Tan
of the merge head and the current branch. This is re-implemented in run_rebase() where fork_point is not used if it is the merge base returned by get_octopus_merge_base(). Helped-by: Stefan Beller sbel...@google.com Helped-by: Johannes Schindelin johannes.schinde...@gmx.de Signed-off-by: Paul Tan pyoka

[PATCH v4 18/19] pull --rebase: error on no merge candidate cases

2015-06-18 Thread Paul Tan
Tweak the error messages printed by die_no_merge_candidates() to take into account that we may be rebasing against rather than merging with. Signed-off-by: Paul Tan pyoka...@gmail.com --- builtin/pull.c | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/builtin

[PATCH v4 16/19] pull: configure --rebase via branch.name.rebase or pull.rebase

2015-06-18 Thread Paul Tan
sbel...@google.com Helped-by: Duy Nguyen pclo...@gmail.com Signed-off-by: Paul Tan pyoka...@gmail.com --- Notes: v4 * Fixed the use-after-free. Thanks Duy for catching it. builtin/pull.c | 35 ++- 1 file changed, 34 insertions(+), 1 deletion(-) diff

[PATCH v4 11/19] pull: check if in unresolved merge state

2015-06-18 Thread Paul Tan
by die_resolve_conflict(), we introduce a new function die_conclude_merge() for printing a different error message for when there are no unmerged files but the merge has not been finished. Signed-off-by: Paul Tan pyoka...@gmail.com --- advice.c | 8 advice.h | 1 + builtin/pull.c

Re: [PATCH/WIP v2 03/19] am: implement skeletal builtin am

2015-06-18 Thread Paul Tan
On Tue, Jun 16, 2015 at 1:54 AM, Junio C Hamano gits...@pobox.com wrote: Paul Tan pyoka...@gmail.com writes: The scripted Porcelain is spawned after applying patches 1-3 from here, when you do not have _GIT_USE_BUILTIN_AM exported. Haven't RUN_SETUP code did its thing by that time? Ah

[PATCH v4 05/19] pull: implement fetch + merge

2015-06-18 Thread Paul Tan
Implement the fetch + merge functionality of git-pull, by first running git-fetch with the repo and refspecs provided on the command line, then running git-merge on FETCH_HEAD to merge the fetched refs into the current branch. Helped-by: Junio C Hamano gits...@pobox.com Signed-off-by: Paul Tan

[PATCH v4 02/19] parse-options-cb: implement parse_opt_passthru_argv()

2015-06-18 Thread Paul Tan
callback, which will reconstruct all the provided command-line options into an argv_array, such that it can be passed to another git command. This is useful for passing command-line options that can be specified multiple times. Helped-by: Stefan Beller sbel...@google.com Signed-off-by: Paul Tan

[PATCH v4 03/19] argv-array: implement argv_array_pushv()

2015-06-18 Thread Paul Tan
When we have a null-terminated array, it would be useful to convert it or append it to an argv_array for further manipulation. Implement argv_array_pushv() which will push a null-terminated array of strings on to an argv_array. Signed-off-by: Paul Tan pyoka...@gmail.com --- Documentation

[PATCH v4 01/19] parse-options-cb: implement parse_opt_passthru()

2015-06-18 Thread Paul Tan
callback, which will reconstruct the command-line option into an char* string, such that it can be passed to another git command. Helped-by: Johannes Schindelin johannes.schinde...@gmx.de Helped-by: Junio C Hamano gits...@pobox.com Helped-by: Stefan Beller sbel...@google.com Signed-off-by: Paul Tan

[PATCH v4 00/19] Make git-pull a builtin

2015-06-18 Thread Paul Tan
. This series rewrites git-pull.sh into a C builtin, thus improving its performance and portability. It is part of my GSoC project to rewrite git-pull and git-am into builtins[1]. [1] https://gist.github.com/pyokagan/1b7b0d1f4dab6ba3cef1 Paul Tan (19): parse-options-cb: implement

[PATCH v4 09/19] pull: error on no merge candidates

2015-06-18 Thread Paul Tan
, and implementing die_no_merge_candidates(), which will be called when FETCH_HEAD has no heads for merging. Helped-by: Johannes Schindelin johannes.schinde...@gmx.de Helped-by: Junio C Hamano gits...@pobox.com Signed-off-by: Paul Tan pyoka...@gmail.com --- builtin/pull.c | 113

[PATCH v4 04/19] pull: implement skeletal builtin pull

2015-06-18 Thread Paul Tan
for tests that depend on a working git-pull implementation. This redirection should be removed when all the features of git-pull.sh have been re-implemented in builtin/pull.c. Helped-by: Junio C Hamano gits...@pobox.com Signed-off-by: Paul Tan pyoka...@gmail.com --- Makefile | 1 + builtin.h

[PATCH v4 07/19] pull: pass git-merge's options to git-merge

2015-06-18 Thread Paul Tan
to pass -Xoption to git-merge, 2009-11-25) * -S, --gpg-sign: since ea230d8 (pull: add the --gpg-sign option., 2014-02-10) Signed-off-by: Paul Tan pyoka...@gmail.com --- builtin/pull.c | 75 ++ 1 file changed, 75 insertions(+) diff --git

[PATCH v4 12/19] pull: fast-forward working tree if head is updated

2015-06-18 Thread Paul Tan
Since b10ac50 (Fix pulling into the same branch., 2005-08-25), git-pull, upon detecting that git-fetch updated the current head, will fast-forward the working tree to the updated head commit. Re-implement this behavior. Signed-off-by: Paul Tan pyoka...@gmail.com --- builtin/pull.c | 30

[PATCH v4 13/19] pull: implement pulling into an unborn branch

2015-06-18 Thread Paul Tan
by introducing pull_into_void() which will be called instead of run_merge() if HEAD is invalid. Helped-by: Stephen Robin stephen.ro...@gmail.com Signed-off-by: Paul Tan pyoka...@gmail.com --- builtin/pull.c | 29 - 1 file changed, 28 insertions(+), 1 deletion(-) diff --git

[PATCH v4 08/19] pull: pass git-fetch's options to git-fetch

2015-06-18 Thread Paul Tan
-fetch if --dry-run is set. Re-implement this behavior. Signed-off-by: Ramsay Jones ram...@ramsay1.demon.co.uk Signed-off-by: Paul Tan pyoka...@gmail.com --- builtin/pull.c | 95 ++ 1 file changed, 95 insertions(+) diff --git a/builtin/pull.c

[PATCH v4 06/19] pull: pass verbosity, --progress flags to fetch and merge

2015-06-18 Thread Paul Tan
to pass the --[no-]progress command line options to git-fetch and git-merge. Helped-by: Junio C Hamano gits...@pobox.com Signed-off-by: Paul Tan pyoka...@gmail.com --- builtin/pull.c | 36 1 file changed, 36 insertions(+) diff --git a/builtin/pull.c b/builtin

[PATCH v4 10/19] pull: support pull.ff config

2015-06-18 Thread Paul Tan
Since b814da8 (pull: add pull.ff configuration, 2014-01-15), git-pull.sh would lookup the configuration value of pull.ff, and set the flag --ff if its value is true, --no-ff if its value is false and --ff-only if its value is only. Re-implement this behavior. Signed-off-by: Paul Tan pyoka

Re: [PATCH] pull.c: fix some sparse warnings

2015-06-17 Thread Paul Tan
On Wed, Jun 17, 2015 at 7:18 AM, Ramsay Jones ram...@ramsay1.demon.co.uk wrote: Hi Paul, If you need to re-roll your patches on the 'pt/pull-builtin' branch, could you please squash this into the patch which corresponds to commit 191241e5. Thanks. I must have been half-asleep because the

Re: New Defects reported by Coverity Scan for git

2015-06-17 Thread Paul Tan
On Wed, Jun 17, 2015 at 9:54 PM, Duy Nguyen pclo...@gmail.com wrote: I think Coverity caught this correctly. ** CID 1306846: Memory - illegal accesses (USE_AFTER_FREE) /builtin/pull.c: 287 in config_get_rebase()

[PATCH/RFC] Revert git am/mailinfo: Don't look at in-body headers when rebasing

2015-06-16 Thread Paul Tan
not munge commit log message, 2008-04-16), as git-am bypasses git-mailinfo and gets the commit message directly from the commit ID in the patch. git-am is the only user of --no-inbody-headers, and this option is not documented. As such, it should be removed. Signed-off-by: Paul Tan pyoka

[PATCH v2 4/5] am: use gmtime() to parse mercurial patch date

2015-06-15 Thread Paul Tan
in the patch, the resulting commit will have the wrong author date. Fix this by using gmtime() instead, which uses UTC instead of the user's time zone. Signed-off-by: Paul Tan pyoka...@gmail.com --- git-am.sh | 6 +++--- t/t4150-am.sh | 23 +++ 2 files changed, 26

[PATCH v2 2/5] am: teach StGit patch parser how to read from stdin

2015-06-15 Thread Paul Tan
. Based-on-patch-by: Chris Packham judge.pack...@gmail.com Helped-by: Junio C Hamano gits...@pobox.com Signed-off-by: Paul Tan pyoka...@gmail.com --- Notes: v2 * Just pass the filename directly to perl. Hmm, I think we should add a -- in front so that filenames that start

Re: [PATCH/WIP v2 05/19] am: split out mbox/maildir patches with git-mailsplit

2015-06-15 Thread Paul Tan
On Fri, Jun 12, 2015 at 1:45 AM, Stefan Beller sbel...@google.com wrote: On Thu, Jun 11, 2015 at 3:21 AM, Paul Tan pyoka...@gmail.com wrote: @@ -138,13 +202,33 @@ static void am_next(struct am_state *state) */ static void am_run(struct am_state *state) { - while (state-cur = state

Re: [PATCH/WIP v2 04/19] am: implement patch queue mechanism

2015-06-15 Thread Paul Tan
On Fri, Jun 12, 2015 at 1:39 AM, Stefan Beller sbel...@google.com wrote: On Thu, Jun 11, 2015 at 3:21 AM, Paul Tan pyoka...@gmail.com wrote: Notes: v2 * Declare struct am_state as static builtin/am.c | 164 +++ 1 file

[PATCH v2 5/5] am: teach mercurial patch parser how to read from stdin

2015-06-15 Thread Paul Tan
-line. Based-on-patch-by: Chris Packham judge.pack...@gmail.com Helped-by: Junio C Hamano gits...@pobox.com Signed-off-by: Paul Tan pyoka...@gmail.com --- Notes: v2 * Pass the filename directly to perl instead. git-am.sh | 3 ++- t/t4150-am.sh | 10 ++ 2 files changed, 12

[PATCH v2 1/5] t4150: test applying StGit patch

2015-06-15 Thread Paul Tan
to be able to extract the commit author, date and message from such a patch. Based-on-patch-by: Chris Packham judge.pack...@gmail.com Signed-off-by: Paul Tan pyoka...@gmail.com --- t/t4150-am.sh | 22 ++ 1 file changed, 22 insertions(+) diff --git a/t/t4150-am.sh b/t/t4150-am.sh index

[PATCH v2 3/5] t4150: test applying StGit series

2015-06-15 Thread Paul Tan
this series file, is able to detect it as an StGit series and apply all the patches in the series. Signed-off-by: Paul Tan pyoka...@gmail.com --- t/t4150-am.sh | 17 + 1 file changed, 17 insertions(+) diff --git a/t/t4150-am.sh b/t/t4150-am.sh index 51962e4..7aad8f8 100755 --- a/t

[PATCH v2 0/5] am: improve test coverage and touch up foreign patch parsing

2015-06-15 Thread Paul Tan
://thread.gmane.org/gmane.comp.version-control.git/256502 Paul Tan (5): t4150: test applying StGit patch am: teach StGit patch parser how to read from stdin t4150: test applying StGit series am: use gmtime() to parse mercurial patch date am: teach mercurial patch parser how to read from stdin git

Re: [PATCH/WIP v2 03/19] am: implement skeletal builtin am

2015-06-15 Thread Paul Tan
On Mon, Jun 15, 2015 at 6:08 AM, Junio C Hamano gits...@pobox.com wrote: Paul Tan pyoka...@gmail.com writes: diff --git a/git.c b/git.c index 44374b1..42328ed 100644 --- a/git.c +++ b/git.c @@ -370,6 +370,7 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv

Re: [PATCH/WIP v2 03/19] am: implement skeletal builtin am

2015-06-15 Thread Paul Tan
On Tue, Jun 16, 2015 at 1:14 AM, Junio C Hamano gits...@pobox.com wrote: Paul Tan pyoka...@gmail.com writes: On Mon, Jun 15, 2015 at 6:08 AM, Junio C Hamano gits...@pobox.com wrote: Paul Tan pyoka...@gmail.com writes: diff --git a/git.c b/git.c index 44374b1..42328ed 100644 --- a/git.c

[PATCH v3 01/19] parse-options-cb: implement parse_opt_passthru()

2015-06-14 Thread Paul Tan
callback, which will reconstruct the command-line option into an char* string, such that it can be passed to another git command. Helped-by: Johannes Schindelin johannes.schinde...@gmx.de Helped-by: Junio C Hamano gits...@pobox.com Helped-by: Stefan Beller sbel...@google.com Signed-off-by: Paul Tan

[PATCH v3 09/19] pull: error on no merge candidates

2015-06-14 Thread Paul Tan
, and implementing die_no_merge_candidates(), which will be called when FETCH_HEAD has no heads for merging. Helped-by: Johannes Schindelin johannes.schinde...@gmx.de Helped-by: Junio C Hamano gits...@pobox.com Signed-off-by: Paul Tan pyoka...@gmail.com --- Notes: v3 * Tightening up of FETCH_HEAD

[PATCH v3 03/19] argv-array: implement argv_array_pushv()

2015-06-14 Thread Paul Tan
When we have a null-terminated array, it would be useful to convert it or append it to an argv_array for further manipulation. Implement argv_array_pushv() which will push a null-terminated array of strings on to an argv_array. Signed-off-by: Paul Tan pyoka...@gmail.com --- Documentation

[PATCH v3 02/19] parse-options-cb: implement parse_opt_passthru_argv()

2015-06-14 Thread Paul Tan
callback, which will reconstruct all the provided command-line options into an argv_array, such that it can be passed to another git command. This is useful for passing command-line options that can be specified multiple times. Helped-by: Stefan Beller sbel...@google.com Signed-off-by: Paul Tan

[PATCH v3 04/19] pull: implement skeletal builtin pull

2015-06-14 Thread Paul Tan
for tests that depend on a working git-pull implementation. This redirection should be removed when all the features of git-pull.sh have been re-implemented in builtin/pull.c. Helped-by: Junio C Hamano gits...@pobox.com Signed-off-by: Paul Tan pyoka...@gmail.com --- Notes: v3 * style fixes

[PATCH v3 06/19] pull: pass verbosity, --progress flags to fetch and merge

2015-06-14 Thread Paul Tan
to pass the --[no-]progress command line options to git-fetch and git-merge. Helped-by: Junio C Hamano gits...@pobox.com Signed-off-by: Paul Tan pyoka...@gmail.com --- Notes: v3 * Re-worded commit message. builtin/pull.c | 36 1 file changed, 36

[PATCH v3 00/19] Make git-pull a builtin

2015-06-14 Thread Paul Tan
and cannot take advantage of git's internal caches. This series rewrites git-pull.sh into a C builtin, thus improving its performance and portability. It is part of my GSoC project to rewrite git-pull and git-am into builtins[1]. [1] https://gist.github.com/pyokagan/1b7b0d1f4dab6ba3cef1 Paul Tan (19

[PATCH v3 11/19] pull: check if in unresolved merge state

2015-06-14 Thread Paul Tan
by die_resolve_conflict(), we introduce a new function die_conclude_merge() for printing a different error message for when there are no unmerged files but the merge has not been finished. Signed-off-by: Paul Tan pyoka...@gmail.com --- advice.c | 8 advice.h | 1 + builtin/pull.c

[PATCH v3 08/19] pull: pass git-fetch's options to git-fetch

2015-06-14 Thread Paul Tan
-fetch if --dry-run is set. Re-implement this behavior. Signed-off-by: Paul Tan pyoka...@gmail.com --- builtin/pull.c | 95 ++ 1 file changed, 95 insertions(+) diff --git a/builtin/pull.c b/builtin/pull.c index 0442da9..731e2a6 100644

[PATCH v3 10/19] pull: support pull.ff config

2015-06-14 Thread Paul Tan
Since b814da8 (pull: add pull.ff configuration, 2014-01-15), git-pull.sh would lookup the configuration value of pull.ff, and set the flag --ff if its value is true, --no-ff if its value is false and --ff-only if its value is only. Re-implement this behavior. Signed-off-by: Paul Tan pyoka

[PATCH v3 05/19] pull: implement fetch + merge

2015-06-14 Thread Paul Tan
Implement the fetch + merge functionality of git-pull, by first running git-fetch with the repo and refspecs provided on the command line, then running git-merge on FETCH_HEAD to merge the fetched refs into the current branch. Helped-by: Junio C Hamano gits...@pobox.com Signed-off-by: Paul Tan

[PATCH v3 14/19] pull: set reflog message

2015-06-14 Thread Paul Tan
-by: Junio C Hamano gits...@pobox.com Signed-off-by: Paul Tan pyoka...@gmail.com --- builtin/pull.c | 22 ++ 1 file changed, 22 insertions(+) diff --git a/builtin/pull.c b/builtin/pull.c index a2dd0ba..a2c900e 100644 --- a/builtin/pull.c +++ b/builtin/pull.c @@ -169,6 +169,25

[PATCH v3 18/19] pull --rebase: error on no merge candidate cases

2015-06-14 Thread Paul Tan
Tweak the error messages printed by die_no_merge_candidates() to take into account that we may be rebasing against rather than merging with. Signed-off-by: Paul Tan pyoka...@gmail.com --- builtin/pull.c | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/builtin

[PATCH v3 15/19] pull: teach git pull about --rebase

2015-06-14 Thread Paul Tan
of the merge head and the current branch. This is re-implemented in run_rebase() where fork_point is not used if it is the merge base returned by get_octopus_merge_base(). Helped-by: Stefan Beller sbel...@google.com Helped-by: Johannes Schindelin johannes.schinde...@gmx.de Signed-off-by: Paul Tan pyoka

<    1   2   3   4   5   6   7   >