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

2015-06-14 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 v3 16/19] pull: configure --rebase via branch.name.rebase or pull.rebase

2015-06-14 Thread Paul Tan
sbel...@google.com Signed-off-by: Paul Tan pyoka...@gmail.com --- Notes: v3 * Now that parse_config_rebase() takes care of the die()-ing and error()-ing, we only need one function again. Yay! * The free()s is ugly though. Ideally, I would like to have a xstrfmt

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

2015-06-14 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 --- Notes: v3 * style fixes builtin/pull.c | 29 - 1 file changed, 28

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

2015-06-14 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 v3 17/19] pull --rebase: exit early when the working directory is dirty

2015-06-14 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 v3 19/19] pull: remove redirection to git-pull.sh

2015-06-14 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

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

2015-06-14 Thread Paul Tan
On Thu, Jun 11, 2015 at 1:14 AM, Junio C Hamano gits...@pobox.com wrote: I (or at least some part of me) actually view git_config_get_*() as if you are only going to peek a few variables, you do not have to do the looping yourself convenience, which leads me (or at least that part of me) to

Re: Bug when doing make test using root user

2015-06-12 Thread Paul Tan
On Fri, Jun 12, 2015 at 5:43 PM, Jean-Yves LENHOF jean-y...@lenhof.eu.org wrote: Hi, I tried to compile git 2.4.3 using root on a server. It failed on test 41 of t0302-credential-store.sh In fact even if we remove read access on a directory, root still can acces this directory. Using a not

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

2015-06-12 Thread Paul Tan
On Wed, Jun 10, 2015 at 7:56 AM, Junio C Hamano gits...@pobox.com wrote: Paul Tan pyoka...@gmail.com writes: /** + * Appends merge candidates from FETCH_HEAD that are not marked not-for-merge + * into merge_heads. + */ Hmph, I vaguely recall doing that in C elsewhere already, even

[PATCH] t0302: unreadable test needs SANITY prereq

2015-06-12 Thread Paul Tan
The test expects that chmod -r ~/.git-credentials would make it unreadable to the user, and thus needs the SANITY prerequisite. Reported-by: Jean-Yves LENHOF jean-y...@lenhof.eu.org Signed-off-by: Paul Tan pyoka...@gmail.com --- t/t0302-credential-store.sh | 2 +- 1 file changed, 1 insertion

[PATCH v2 00/19] Make git-am a builtin

2015-06-11 Thread Paul Tan
/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 (19): wrapper: implement xopen() wrapper: implement xfopen() am: implement skeletal builtin am am: implement patch queue mechanism

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

2015-06-11 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: v2 * use die_errno() * use '%*d' as the format specifier for msgnum() builtin/am.c | 228

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

2015-06-11 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: v2 * Declare int opt_patchformat as static. * Fix up indentation style for the switch() builtin

[PATCH/WIP v2 00/19] Make git-am a builtin

2015-06-11 Thread Paul Tan
/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 (19): wrapper: implement xopen() wrapper: implement xfopen() am: implement skeletal builtin am am: implement patch queue mechanism am

[PATCH/WIP v2 13/19] am: implement --skip

2015-06-11 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 v2 18/19] cache-tree: introduce write_index_as_tree()

2015-06-11 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 v2 19/19] am: implement 3-way merge

2015-06-11 Thread Paul Tan
Since d1c5f2a (Add git-am, applymbox replacement., 2005-10-07), git-am supported the --3way option, and if set, would attempt to do a 3-way merge if the initial patch application fails. Re-implement this feature through the fall_back_threeway() function. Signed-off-by: Paul Tan pyoka...@gmail.com

[PATCH/WIP v2 08/19] am: apply patch with git-apply

2015-06-11 Thread Paul Tan
Implement applying the patch to the index using git-apply. Signed-off-by: Paul Tan pyoka...@gmail.com --- builtin/am.c | 55 ++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/builtin/am.c b/builtin/am.c index a1db474..b725a74

[PATCH/WIP v2 06/19] am: detect mbox patches

2015-06-11 Thread Paul Tan
-by: Paul Tan pyoka...@gmail.com --- Notes: v2 * Various small code tweaks suggested by Eric. builtin/am.c | 98 1 file changed, 98 insertions(+) diff --git a/builtin/am.c b/builtin/am.c index 5198a8e..7379b97 100644

[PATCH/WIP v2 01/19] wrapper: implement xopen()

2015-06-11 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 --- Notes: v2 * retry on EINTR * mode is now an optional argument in xopen

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

2015-06-11 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 --- Notes: v2

[PATCH/WIP v2 17/19] am: implement am --signoff

2015-06-11 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 v2 11/19] am: refuse to apply patches if index is dirty

2015-06-11 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 --- builtin/am.c | 46 ++ 1 file changed, 46 insertions

[PATCH/WIP v2 12/19] am: implement --resolved/--continue

2015-06-11 Thread Paul Tan
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(). Signed-off-by: Paul

[PATCH/WIP v2 09/19] am: commit applied patch

2015-06-11 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 | 50 ++ 1 file changed

[PATCH/WIP v2 16/19] am: exit with user friendly message on patch failure

2015-06-11 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/WIP v2 15/19] am: implement quiet option

2015-06-11 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 cdc07ab..795b672 100644 --- a/builtin/am.c +++ b/builtin/am.c

[PATCH/WIP v2 10/19] am: refresh the index at start

2015-06-11 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 ecc6d29..417bfde 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -13,6 +13,7 @@ #include cache-tree.h #include

[PATCH/WIP v2 02/19] wrapper: implement xfopen()

2015-06-11 Thread Paul Tan
of code and make the die() messages consistent. Signed-off-by: Paul Tan pyoka...@gmail.com --- Notes: v2 * Removed the error message distinction between reading and writing. * Handle EINTR. git-compat-util.h | 1 + wrapper.c | 18 ++ 2 files changed

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

2015-06-11 Thread Paul Tan
-off-by: Paul Tan pyoka...@gmail.com --- Notes: v2 * Declare struct am_state state as static. Makefile | 1 + builtin.h| 1 + builtin/am.c | 20 git.c| 1 + 4 files changed, 23 insertions(+) create mode 100644 builtin/am.c diff --git a/Makefile

[PATCH/WIP v2 14/19] am: implement --abort

2015-06-11 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

Re: [PATCH v2 1/2] t5520-pull: Simplify --rebase with dirty tree test

2015-06-11 Thread Paul Tan
On Sun, Jun 7, 2015 at 5:12 AM, Kevin Daudt m...@ikke.info wrote: @@ -278,25 +291,6 @@ test_expect_success 'rebased upstream + fetch + pull --rebase' ' ' -test_expect_success 'pull --rebase dies early with dirty working directory' ' - - git checkout to-rebase - git

Re: [PATCH v2 2/2] pull: allow dirty tree when rebase.autostash enabled

2015-06-11 Thread Paul Tan
. Signed-off-by: Kevin Daudt m...@ikke.info Ehh? The sign-off does not match the author of the patch. Helped-by: Paul Tan pyoka...@gmail.com --- git-pull.sh | 5 - t/t5520-pull.sh | 12 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/git-pull.sh b/git-pull.sh

Re: [PATCH v2 02/19] parse-options-cb: implement parse_opt_pass_argv_array()

2015-06-10 Thread Paul Tan
On Wed, Jun 10, 2015 at 7:16 AM, Junio C Hamano gits...@pobox.com wrote: Almost the same comment as 01/19 applies to this comment. I think it makes good sense to have two variants, one that lets the last one win and pass only that last one (i.e. 01/19) and the other that accumulates them into

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

2015-06-10 Thread Paul Tan
On Wed, Jun 10, 2015 at 9:56 AM, Junio C Hamano gits...@pobox.com wrote: Paul Tan pyoka...@gmail.com writes: +enum rebase_type { + REBASE_INVALID = -1, + REBASE_FALSE = 0, + REBASE_TRUE, + REBASE_PRESERVE +}; + +/** + * Parses the value of --rebase, branch.*.rebase

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

2015-06-10 Thread Paul Tan
On Wed, Jun 10, 2015 at 10:44 PM, Junio C Hamano gits...@pobox.com wrote: Paul Tan pyoka...@gmail.com writes: Hmph, it is somewhat surprising that we do not have such a helper already. Wouldn't we need this logic to implement $branch@{upstream} syntax? Right, the @{upstream} syntax

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

2015-06-10 Thread Paul Tan
On Wed, Jun 10, 2015 at 10:38 PM, Junio C Hamano gits...@pobox.com wrote: Junio C Hamano gits...@pobox.com writes: Paul Tan pyoka...@gmail.com writes: @@ -422,6 +423,14 @@ int cmd_pull(int argc, const char **argv, const char *prefix) parse_repo_refspecs(argc, argv, repo, refspecs

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

2015-06-09 Thread Paul Tan
On Tue, Jun 9, 2015 at 3:57 AM, Junio C Hamano gits...@pobox.com wrote: Paul Tan pyoka...@gmail.com writes: git-mailsplit, which splits mbox patches, will read the patch from stdin when the filename is - or there are no files listed on the command-line. To be consistent with this behavior

Re: [PATCH 5/6] am --abort: support aborting to unborn branch

2015-06-09 Thread Paul Tan
On Tue, Jun 9, 2015 at 4:10 AM, Junio C Hamano gits...@pobox.com wrote: Paul Tan pyoka...@gmail.com writes: When git-am is first run on an unborn branch, no ORIG_HEAD is created. As such, any applied commits will remain even after a git am --abort. I think this answered my question on 4/6

Re: [PATCH 6/6] am --abort: keep unrelated commits on unborn branch

2015-06-09 Thread Paul Tan
On Tue, Jun 9, 2015 at 4:13 AM, Junio C Hamano gits...@pobox.com wrote: Paul Tan pyoka...@gmail.com writes: Since 7b3b7e3 (am --abort: keep unrelated commits since the last failure and warn, 2010-12-21), git-am would refuse to rewind HEAD if commits were made since the last git-am failure

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

2015-06-08 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 2/5] am: teach StGit patch parser how to read from stdin

2015-06-08 Thread Paul Tan
. Based-on-patch-by: Chris Packham judge.pack...@gmail.com Signed-off-by: Paul Tan pyoka...@gmail.com --- git-am.sh | 5 +++-- t/t4150-am.sh | 10 ++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/git-am.sh b/git-am.sh index 761befb..83f2ea6 100755 --- a/git-am.sh +++ b

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

2015-06-08 Thread Paul Tan
date wrongly and git-am is thus unable to reconstruct the exact commit. Most patches are based on Chris' patch series[1], which I've credited accordingly. [1] http://thread.gmane.org/gmane.comp.version-control.git/256502 Paul Tan (5): t4150: test applying StGit patch am: teach StGit patch

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

2015-06-08 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 1/5] t4150: test applying StGit patch

2015-06-08 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 5/5] am: teach mercurial patch parser how to read from stdin

2015-06-08 Thread Paul Tan
-line. Based-on-patch-by: Chris Packham judge.pack...@gmail.com Signed-off-by: Paul Tan pyoka...@gmail.com --- git-am.sh | 4 +++- t/t4150-am.sh | 10 ++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/git-am.sh b/git-am.sh index d97da85..0a40d46 100755 --- a/git-am.sh

[PATCH 1/6] am --skip: revert changes introduced by failed 3way merge

2015-06-06 Thread Paul Tan
the failed merge. Signed-off-by: Paul Tan pyoka...@gmail.com --- git-am.sh | 7 ++- t/t4151-am-abort.sh | 11 +++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/git-am.sh b/git-am.sh index 761befb..df3c8f4 100755 --- a/git-am.sh +++ b/git-am.sh @@ -69,6 +69,8

[PATCH 2/6] am -3: support 3way merge on unborn branch

2015-06-06 Thread Paul Tan
While on an unborn branch, git am -3 will fail to do a threeway merge as it references HEAD as our tree, but HEAD does not point to a valid tree. Fix this by using an empty tree as our tree when we are on an unborn branch. Signed-off-by: Paul Tan pyoka...@gmail.com --- git-am.sh | 3

[PATCH 5/6] am --abort: support aborting to unborn branch

2015-06-06 Thread Paul Tan
to by HEAD if there is no ORIG_HEAD. Signed-off-by: Paul Tan pyoka...@gmail.com --- git-am.sh | 9 - t/t4151-am-abort.sh | 17 + 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/git-am.sh b/git-am.sh index e4fe3ed..95f90a0 100755 --- a/git-am.sh +++ b

[PATCH 6/6] am --abort: keep unrelated commits on unborn branch

2015-06-06 Thread Paul Tan
-by: Paul Tan pyoka...@gmail.com --- git-am.sh | 2 +- t/t4151-am-abort.sh | 11 +++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/git-am.sh b/git-am.sh index 95f90a0..4324bb1 100755 --- a/git-am.sh +++ b/git-am.sh @@ -87,7 +87,7 @@ safe_to_abort

[PATCH 4/6] am --abort: revert changes introduced by failed 3way merge

2015-06-06 Thread Paul Tan
, thus undoing all the changes from the failed merge. When we are on an unborn branch, HEAD and ORIG_HEAD will not point to valid trees. In this case, use an empty tree. Signed-off-by: Paul Tan pyoka...@gmail.com --- git-am.sh | 6 +- t/t4151-am-abort.sh | 23

[PATCH 3/6] am --skip: support skipping while on unborn branch

2015-06-06 Thread Paul Tan
When git am --skip is run, git am will copy HEAD's tree entries to the index with git reset HEAD. However, on an unborn branch, HEAD does not point to a tree, so git reset HEAD will fail. Fix this by treating HEAD as en empty tree when we are on an unborn branch. Signed-off-by: Paul Tan pyoka

[PATCH 0/6] am --skip/--abort: improve index/worktree cleanup

2015-06-06 Thread Paul Tan
branch. Paul Tan (6): am --skip: revert changes introduced by failed 3way merge am -3: support 3way merge on unborn branch am --skip: support skipping while on unborn branch am --abort: revert changes introduced by failed 3way merge am --abort: support aborting to unborn branch am --abort

Re: [RFC] git-am: handling unborn branches

2015-06-05 Thread Paul Tan
On Fri, Jun 5, 2015 at 1:26 AM, Junio C Hamano gits...@pobox.com wrote: Paul Tan pyoka...@gmail.com writes: git-am generally supports applying patches to unborn branches. However, there are 2 cases where git-am does not handle unborn branches which I would like to address before the git-am

Re: [RFC] git-am: handling unborn branches

2015-06-05 Thread Paul Tan
On Fri, Jun 5, 2015 at 1:27 AM, Stefan Beller sbel...@google.com wrote: On Thu, Jun 4, 2015 at 3:34 AM, Paul Tan pyoka...@gmail.com wrote: Or, the current behavior of git-am.sh will print some scary errors about the missing HEAD, but will then continue on to the next patch. If the index

Re: [RFC] git-am: handling unborn branches

2015-06-05 Thread Paul Tan
On Fri, Jun 5, 2015 at 11:36 PM, Junio C Hamano gits...@pobox.com wrote: Paul Tan pyoka...@gmail.com writes: Hmm, actually git-am.sh doesn't seem to do that even when we have a history to apply patches to. This is okay in the non-3way case, as git-apply will check to see if the patch applies

[RFC] git-am: handling unborn branches

2015-06-04 Thread Paul Tan
Hi, git-am generally supports applying patches to unborn branches. However, there are 2 cases where git-am does not handle unborn branches which I would like to address before the git-am rewrite to C: 1. am --skip For git am --skip, git-am.sh does a fast-forward checkout from HEAD to HEAD,

Re: [PATCH/WIP 1/8] wrapper: implement xopen()

2015-06-04 Thread Paul Tan
On Thu, May 28, 2015 at 3:03 AM, Torsten Bögershausen tbo...@web.de wrote: On 2015-05-27 15.33, Paul Tan wrote: +/** + * xopen() is the same as open(), but it die()s if the open() fails. + */ +int xopen(const char *path, int flags, mode_t mode) +{ + int fd; + + assert(path

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

2015-06-03 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 v2 18/19] pull --rebase: error on no merge candidate cases

2015-06-03 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 --- Notes: v2 * Decided to use fprintf_ln() for the sake of code consistency

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

2015-06-03 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 v2 08/19] pull: pass git-fetch's options to git-fetch

2015-06-03 Thread Paul Tan
-fetch if --dry-run is set. Re-implement this behavior. Signed-off-by: Paul Tan pyoka...@gmail.com --- Notes: v2 * Use parse_opt_parse_strbuf() builtin/pull.c | 95 ++ 1 file changed, 95 insertions(+) diff --git a/builtin/pull.c

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

2015-06-03 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 v2 03/19] argv-array: implement argv_array_pushv()

2015-06-03 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 v2 06/19] pull: pass verbosity, --progress flags to fetch and merge

2015-06-03 Thread Paul Tan
by introducing the option callback handler parse_opt_passthru(). This callback is used to pass the --progress or --no-progress command-line switch to git-fetch and git-merge. Signed-off-by: Paul Tan pyoka...@gmail.com --- Notes: v2 * Use parse_opt_pass_strbuf(). builtin/pull.c | 36

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

2015-06-03 Thread Paul Tan
-by: Junio C Hamano gits...@pobox.com Signed-off-by: Paul Tan pyoka...@gmail.com --- Notes: v2 * Don't use strbuf_rtrim(). builtin/pull.c | 22 ++ 1 file changed, 22 insertions(+) diff --git a/builtin/pull.c b/builtin/pull.c index f0d4710..c44cc90 100644

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

2015-06-03 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 v2 05/19] pull: implement fetch + merge

2015-06-03 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. Signed-off-by: Paul Tan pyoka...@gmail.com --- builtin/pull.c | 61

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

2015-06-03 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 v2 16/19] pull: configure --rebase via branch.name.rebase or pull.rebase

2015-06-03 Thread Paul Tan
sbel...@google.com Signed-off-by: Paul Tan pyoka...@gmail.com --- Notes: v2 * Previously, config_get_rebase() attempted to do too many things. It: 1. Checked if there was a configuration for branch.$curr_branch.rebase, and if not, then pull.rebase 2

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

2015-06-03 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 v2 07/19] pull: pass git-merge's options to git-merge

2015-06-03 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 --- Notes: v2 * Use opt_parse_pass_strbuf(), opt_parse_pass_argv_array() and argv_array_pushv() builtin/pull.c

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

2015-06-03 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 Signed-off-by: Paul Tan pyoka...@gmail.com --- Notes: v2 * Switched to using fprintf_ln() which will append the trailing newline

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

2015-06-03 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 v2 11/19] pull: check if in unresolved merge state

2015-06-03 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 6/8] am: extract patch, message and authorship with git-mailinfo

2015-06-03 Thread Paul Tan
On Thu, May 28, 2015 at 4:44 AM, Junio C Hamano gits...@pobox.com wrote: Paul Tan pyoka...@gmail.com writes: @@ -17,6 +34,10 @@ struct am_state { struct strbuf dir;/* state directory path */ int cur; /* current patch number */ int last

Re: [PATCH/WIP 6/8] am: extract patch, message and authorship with git-mailinfo

2015-06-03 Thread Paul Tan
On Thu, May 28, 2015 at 6:13 AM, Junio C Hamano gits...@pobox.com wrote: Paul Tan pyoka...@gmail.com writes: +static const char *msgnum(const struct am_state *state) +{ + static struct strbuf fmt = STRBUF_INIT; + static struct strbuf sb = STRBUF_INIT; + + strbuf_reset(fmt

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

2015-06-03 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 parse_opt_pass_strbuf

[PATCH v2 02/19] parse-options-cb: implement parse_opt_pass_argv_array()

2015-06-03 Thread Paul Tan
-options 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. Signed-off-by: Paul Tan pyoka...@gmail.com --- Notes: v2

[PATCH v2 01/19] parse-options-cb: implement parse_opt_pass_strbuf()

2015-06-03 Thread Paul Tan
callback, which will reconstruct the command-line option into an strbuf, such that it can be passed to another git command. Helped-by: Johannes Schindelin johannes.schinde...@gmx.de Signed-off-by: Paul Tan pyoka...@gmail.com --- Notes: v2 * Previously implemented as a static function

Re: [PATCH/WIP 1/8] wrapper: implement xopen()

2015-06-03 Thread Paul Tan
On Thu, May 28, 2015 at 5:53 AM, Jeff King p...@peff.net wrote: On Wed, May 27, 2015 at 09:03:47PM +0200, Torsten Bögershausen wrote: The original open can take 2 or 3 parameters, how about this: int xopen(const char *path, int oflag, ... ) { va_list params; int mode;

Re: [PATCH] pull: allow dirty tree when rebase.autostash enabled

2015-06-02 Thread Paul Tan
Hi, Some comments which may not necessarily be correct. On Wed, Jun 3, 2015 at 5:55 AM, Kevin Daudt m...@ikke.info wrote: rebase learned to stash changes when it encounters a dirty work tree, but git pull --rebase does not. Only verify if the working tree is dirty when rebase.autostash is

Re: [PATCH 11/14] pull: teach git pull about --rebase

2015-06-02 Thread Paul Tan
On Sun, May 31, 2015 at 4:18 PM, Paul Tan pyoka...@gmail.com wrote: On Tue, May 19, 2015 at 9:04 PM, Johannes Schindelin johannes.schinde...@gmx.de wrote: Also, I wonder if something like this would do the job: spec = parse_fetch_refspec(1, refspec); if (spec-dst

[PATCH v2 2/2] pull: use git-rev-parse --parseopt for option parsing

2015-06-02 Thread Paul Tan
To enable unambiguous parsing of abbreviated options, bundled short options, separate form options and to provide consistent usage help, use git-rev-parse --parseopt for option parsing. With this, simplify the option parsing code. Signed-off-by: Paul Tan pyoka...@gmail.com --- Notes: v2

[PATCH v2 0/2] Improve git-pull's option parsing

2015-06-02 Thread Paul Tan
change for my rewrite of git-pull.sh to C. Paul Tan (2): pull: handle git-fetch's options as well pull: use git-rev-parse --parseopt for option parsing Documentation/git-pull.txt | 3 -- git-pull.sh| 128 +++-- t/t5520-pull.sh

[PATCH v2 1/2] pull: handle git-fetch's options as well

2015-06-02 Thread Paul Tan
-rebase's options on the command line. Update the documentation to reflect this. Signed-off-by: Paul Tan pyoka...@gmail.com --- Notes: Improve git-pull's option parsing Previous versions: [v1] http://thread.gmane.org/gmane.comp.version-control.git/269249 This patch series

Re: [PATCH/RFC v2 2/2] git-am: add am.threeWay config variable

2015-06-02 Thread Paul Tan
Hi, On Tue, Jun 2, 2015 at 9:37 PM, Matthieu Moy matthieu@grenoble-inp.fr wrote: Remi Lespinet remi.lespi...@ensimag.grenoble-inp.fr writes: +if test $(git config --bool --get am.threeWay) = true +then +threeway=t +fi I think you missed Paul's remark on this:

Re: [PATCH/WIP 4/8] am: split out mbox/maildir patches with git-mailsplit

2015-06-02 Thread Paul Tan
On Fri, May 29, 2015 at 7:05 AM, Eric Sunshine sunsh...@sunshineco.com wrote: On Wed, May 27, 2015 at 9:33 AM, Paul Tan pyoka...@gmail.com wrote: @@ -128,13 +190,32 @@ static void am_next(struct am_state *state) */ +/** + * parse_options() callback that validates and sets opt-value

Re: [PATCH 11/14] pull: teach git pull about --rebase

2015-05-31 Thread Paul Tan
Hi Johannes, On Tue, May 19, 2015 at 9:04 PM, Johannes Schindelin johannes.schinde...@gmx.de wrote: On 2015-05-18 17:06, Paul Tan wrote: +/** + * Given a refspec, returns the merge branch. Returns NULL if the refspec src + * does not refer to a branch. + * + * FIXME: It should return

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

2015-05-30 Thread Paul Tan
Hi, On Tue, May 19, 2015 at 3:21 AM, Junio C Hamano gits...@pobox.com wrote: Paul Tan pyoka...@gmail.com writes: 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[2

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

2015-05-30 Thread Paul Tan
On Sat, May 30, 2015 at 3:29 PM, Paul Tan pyoka...@gmail.com wrote: Hi, Okay, I'm trying this out in the next re-roll. I do agree that this patch series should not touch anything in t/ at all. One problem(?) is that putting builtins/pull.o in the BUILTIN_OBJS and leaving git-pull.sh

[PATCH v5 2/8] t5520: test no merge candidates cases

2015-05-29 Thread Paul Tan
-by: Paul Tan pyoka...@gmail.com --- t/t5520-pull.sh | 55 +++ 1 file changed, 55 insertions(+) diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh index 5e4db67..4a2c0a1 100755 --- a/t/t5520-pull.sh +++ b/t/t5520-pull.sh @@ -109,6 +109,61

[PATCH v5 8/8] t5520: check reflog action in fast-forward merge

2015-05-29 Thread Paul Tan
When testing a fast-forward merge with git-pull, check to see if the reflog action is pull with the arguments passed to git-pull. While we are in the vicinity, remove the empty line as well. Signed-off-by: Paul Tan pyoka...@gmail.com --- Notes: v5: * Loosen up the pattern used

[PATCH v5 5/8] t5520: test --rebase with multiple branches

2015-05-29 Thread Paul Tan
fails and prints out the user-friendly error message in such a case. Signed-off-by: Paul Tan pyoka...@gmail.com --- t/t5520-pull.sh | 9 + 1 file changed, 9 insertions(+) diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh index 872d765..90728e0 100755 --- a/t/t5520-pull.sh +++ b/t/t5520-pull.sh

[PATCH v5 4/8] t5520: test work tree fast-forward when fetch updates head

2015-05-29 Thread Paul Tan
-friendly advice is printed upon failure. Signed-off-by: Paul Tan pyoka...@gmail.com --- t/t5520-pull.sh | 21 + 1 file changed, 21 insertions(+) diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh index 265c693..872d765 100755 --- a/t/t5520-pull.sh +++ b/t/t5520-pull.sh @@ -183,6

[PATCH v5 1/8] t5520: prevent field splitting in content comparisons

2015-05-29 Thread Paul Tan
fail in mysterious ways. Replace the above 2 forms with: test $(cat file) = expected as quoting the command substitution will prevent field splitting. Signed-off-by: Paul Tan pyoka...@gmail.com --- t/t5520-pull.sh | 70 - 1 file

[PATCH v5 3/8] t5520: test for failure if index has unresolved entries

2015-05-29 Thread Paul Tan
will not run, and will print these advices, if the user is in the middle of a merge or has unmerged files in the index. Signed-off-by: Paul Tan pyoka...@gmail.com --- Notes: v5: * use test_commit t/t5520-pull.sh | 19 +++ 1 file changed, 19 insertions(+) diff --git a/t

[PATCH v5 0/8] Improve git-pull test coverage

2015-05-29 Thread Paul Tan
round. [1] http://thread.gmane.org/gmane.comp.version-control.git/269236 Paul Tan (8): t5520: prevent field splitting in content comparisons t5520: test no merge candidates cases t5520: test for failure if index has unresolved entries t5520: test work tree fast-forward when fetch updates

Re: What's cooking in git.git (May 2015, #07; Tue, 26)

2015-05-29 Thread Paul Tan
Hi, On Fri, May 29, 2015 at 5:52 AM, Junio C Hamano gits...@pobox.com wrote: Junio C Hamano gits...@pobox.com writes: * pt/pull-tests (2015-05-18) 8 commits - t5520: check reflog action in fast-forward merge - t5521: test --dry-run does not make any changes - t5520: test --rebase failure

Re: [PATCH 1/3] t4150-am: refactor and clean common setup

2015-05-28 Thread Paul Tan
Hi, Take these comments/suggestions with a pinch of salt because I'm not that experienced with the code base as well ;-). On Wed, May 27, 2015 at 5:32 AM, Remi Lespinet remi.lespi...@ensimag.grenoble-inp.fr wrote: Add new functions to keep the setup cleaner: - setup_temporary_branch: creates

<    1   2   3   4   5   6   7   >