[PATCH v11 09/22] stash: convert apply to builtin

2018-11-22 Thread Paul-Sebastian Ungureanu
From: Joel Teichroeb Add a builtin helper for performing stash commands. Converting all at once proved hard to review, so starting with just apply lets conversion get started without the other commands being finished. The helper is being implemented as a drop in replacement for stash so

Re: [PATCH 1/1] apply --recount: allow "no-op hunks"

2018-11-12 Thread Josh Steadmon
On 2018.11.12 12:54, Johannes Schindelin via GitGitGadget wrote: > From: Johannes Schindelin > > When editing patches e.g. in `git add -e`, it is quite common that a > hunk ends up having no -/+ lines, i.e. it is now supposed to do nothing. > > This use case was broken by a

[PATCH 1/1] apply --recount: allow "no-op hunks"

2018-11-12 Thread Johannes Schindelin via GitGitGadget
From: Johannes Schindelin When editing patches e.g. in `git add -e`, it is quite common that a hunk ends up having no -/+ lines, i.e. it is now supposed to do nothing. This use case was broken by ad6e8ed37bc1 (apply: reject a hunk that does not do anything, 2015-06-01) with the good intention

Re: [PATCH 01/13] apply: mark include/exclude options as NONEG

2018-11-04 Thread Junio C Hamano
Jeff King writes: > The options callback for "git apply --no-include" is not ready to handle > the "unset" parameter, and as a result will segfault when it adds a NULL > argument to the include list (likewise for "--no-exclude"). > > In theory this mi

[PATCH 11/13] apply: return -1 from option callback instead of calling exit(1)

2018-11-04 Thread Jeff King
The option callback for "apply --whitespace" exits with status "1" on error. It makes more sense for it to just return an error to parse-options. That code will exit, too, but it will use status "129" that is customary for option errors. The exit() dates back to a

[PATCH 01/13] apply: mark include/exclude options as NONEG

2018-11-04 Thread Jeff King
The options callback for "git apply --no-include" is not ready to handle the "unset" parameter, and as a result will segfault when it adds a NULL argument to the include list (likewise for "--no-exclude"). In theory this might be used to clear the list, but since b

[PATCH 07/78] config.txt: move apply.* to a separate file

2018-10-27 Thread Nguyễn Thái Ngọc Duy
/config.txt index 5e0f76fc6e..c8d20227a8 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -297,17 +297,7 @@ include::config/alias.txt[] include::config/am.txt[] -apply.ignoreWhitespace:: - When set to 'change', tells 'git apply' to ignore changes

Re: [PATCH v2 3/3] rebase (autostash): use an explicit OID to apply the stash

2018-10-23 Thread Alban Gruin
Hi Johannes, this looks good to me, too! Cheers, Alban

Re: [PATCH v2 3/3] rebase (autostash): use an explicit OID to apply the stash

2018-10-23 Thread Johannes Schindelin
Hi, On Tue, 23 Oct 2018, Junio C Hamano wrote: > SZEDER Gábor writes: > > >> To prevent that from happening, let's append `^0` after the stash hash, > >> to make sure that it is interpreted as an OID rather than as a number. > > > > Oh, this is clever. > > Yeah, we can do this as we know we'd

Re: [PATCH v2 3/3] rebase (autostash): use an explicit OID to apply the stash

2018-10-22 Thread Junio C Hamano
SZEDER Gábor writes: >> To prevent that from happening, let's append `^0` after the stash hash, >> to make sure that it is interpreted as an OID rather than as a number. > > Oh, this is clever. Yeah, we can do this as we know we'd be dealing with a commit-ish. If we made a mistake to use a tree

Re: [PATCH v2 3/3] rebase (autostash): use an explicit OID to apply the stash

2018-10-22 Thread SZEDER Gábor
On Mon, Oct 22, 2018 at 03:15:05PM -0700, Johannes Schindelin via GitGitGadget wrote: > From: Johannes Schindelin > > When `git stash apply ` sees an argument that consists only of > digits, it tries to be smart and interpret it as `stash@{}`. > > Unfortunately, an all

Re: [PATCH v2 3/3] rebase (autostash): use an explicit OID to apply the stash

2018-10-22 Thread Eric Sunshine
On Mon, Oct 22, 2018 at 6:15 PM Johannes Schindelin via GitGitGadget wrote: > When `git stash apply ` sees an argument that consists only of > digits, it tries to be smart and interpret it as `stash@{}`. > > Unfortunately, an all-digit hash (which is unlikely but still possible) &g

[PATCH v2 3/3] rebase (autostash): use an explicit OID to apply the stash

2018-10-22 Thread Johannes Schindelin via GitGitGadget
From: Johannes Schindelin When `git stash apply ` sees an argument that consists only of digits, it tries to be smart and interpret it as `stash@{}`. Unfortunately, an all-digit hash (which is unlikely but still possible) is therefore misinterpreted as `stash@{}` reflog. To prevent that from

[PATCH 06/59] config.txt: move apply.* to a separate file

2018-10-20 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- Documentation/apply-config.txt | 11 +++ Documentation/config.txt | 12 +--- 2 files changed, 12 insertions(+), 11 deletions(-) create mode 100644 Documentation/apply-config.txt diff --git a/Documentation/apply-config.txt b

Re: Shouldn't git be able to apply diffs that it created with --ignore-whitespace?

2018-10-19 Thread brian m. carlson
the line ending on save, and I exit. > > At this point, my source file contains a) deliberate changes I want, and b) > whitespace changes I wish I could commit but that should not be a part of my > patch. > > Shouldn't the following workflow be supported: > > ~> git di

Shouldn't git be able to apply diffs that it created with --ignore-whitespace?

2018-10-18 Thread Mahmoud Al-Qudsi
wish I could commit but that should not be a part of my patch. Shouldn't the following workflow be supported: ~> git diff -w > foo.diff ~> git reset --hard ~> git apply [--ignore-whitespace] < foo.diff Because that throws an error in this case: > error: patch failed

Re: [PATCH v10 08/21] stash: convert apply to builtin

2018-10-15 Thread Thomas Gummerer
t; + opts.reset = reset; > > + opts.update = update; > > + opts.fn = oneway_merge; > > + > > + if (unpack_trees(nr_trees, t, )) > > + return -1; > > + > > + if (write_locked_index(_index, _file, COMMIT_LOCK)) > > +

Re: [PATCH v10 08/21] stash: convert apply to builtin

2018-10-15 Thread Johannes Schindelin
+ > +static int diff_tree_binary(struct strbuf *out, struct object_id *w_commit) > +{ > + struct child_process cp = CHILD_PROCESS_INIT; > + const char *w_commit_hex = oid_to_hex(w_commit); > + > + /* > + * Diff-tree would not be very hard to replace

[PATCH v2 13/15] apply: rename new_sha1_prefix and old_sha1_prefix

2018-10-14 Thread brian m. carlson
refix) != hexsz || - get_oid_hex(patch->old_sha1_prefix, ) || - get_oid_hex(patch->new_sha1_prefix, )) + if (strlen(patch->old_oid_prefix) != hexsz || + strlen(patch->new_oid_prefix) != hexsz || + get_oid_hex(patch->old_oid_prefix, ) || +

[PATCH v2 12/15] apply: replace hard-coded constants

2018-10-14 Thread brian m. carlson
strlen(patch->new_sha1_prefix) != hexsz || get_oid_hex(patch->old_sha1_prefix, ) || get_oid_hex(patch->new_sha1_prefix, )) return error(_("cannot apply binary patch to '%s' " @@ -4055,7 +4057,7 @@ static int preimage_oid_in_gitlink_patch(

[PATCH v10 08/21] stash: convert apply to builtin

2018-10-14 Thread Paul-Sebastian Ungureanu
From: Joel Teichroeb Add a builtin helper for performing stash commands. Converting all at once proved hard to review, so starting with just apply lets conversion get started without the other commands being finished. The helper is being implemented as a drop in replacement for stash so

[PATCH 19/19] Apply semantic patches from previous patches

2018-10-11 Thread Stefan Beller
Previous commits added some cocci rules, but did not patch the whole tree, as to not dilute the focus for reviewing the previous patches. This patch is generated by 'make coccicheck' and applying the resulting diff, which was white space damaged (>8 spaces after a tab) in blame.c, which has been

Re: [PoC -- do not apply 3/3] test-tree-bitmap: replace ewah with custom rle encoding

2018-10-10 Thread Jeff King
On Wed, Oct 10, 2018 at 09:58:51AM +0900, Junio C Hamano wrote: > > +static void bitmap_to_rle(struct strbuf *out, struct bitmap *bitmap) > > +{ > > + int curval = 0; /* count zeroes, then ones, then zeroes, etc */ > > + size_t run = 0; > > + size_t word; > > + size_t orig_len = out->len;

Re: [PoC -- do not apply 2/3] test-tree-bitmap: add "dump" mode

2018-10-10 Thread Jeff King
On Wed, Oct 10, 2018 at 09:48:53AM +0900, Junio C Hamano wrote: > Jeff King writes: > > > The one difference is the sort order: git's diff output is > > in tree-sort order, so a subtree "foo" sorts like "foo/", > > which is after "foo.bar". Whereas the bitmap path list has a > > true byte sort,

Re: [PoC -- do not apply 3/3] test-tree-bitmap: replace ewah with custom rle encoding

2018-10-09 Thread Junio C Hamano
Jeff King writes: > +static void strbuf_add_varint(struct strbuf *out, uintmax_t val) > +{ > + size_t len; > + strbuf_grow(out, 16); /* enough for any varint */ > + len = encode_varint(val, (unsigned char *)out->buf + out->len); > + strbuf_setlen(out, out->len + len); > +} > + >

Re: [PoC -- do not apply 2/3] test-tree-bitmap: add "dump" mode

2018-10-09 Thread Junio C Hamano
Jeff King writes: > The one difference is the sort order: git's diff output is > in tree-sort order, so a subtree "foo" sorts like "foo/", > which is after "foo.bar". Whereas the bitmap path list has a > true byte sort, which puts "foo.bar" after "foo". If we truly cared, it is easy enough to

[PoC -- do not apply 3/3] test-tree-bitmap: replace ewah with custom rle encoding

2018-10-09 Thread Jeff King
The rules are basically: - each bitmap is a series of counts of runs of 0/1 - each count is one of our standard varints - each bitmap must have at least one initial count of zeroes (which may itself be a zero-length count, if the first bit is set) - a zero-length count anywhere else

[PoC -- do not apply 2/3] test-tree-bitmap: add "dump" mode

2018-10-09 Thread Jeff King
This teaches "gen" mode (formerly the only mode) to include the list of paths, and to prefix each bitmap with its matching oid. The "dump" mode can then read that back in and generate the list of changed paths. This should be almost identical to: git rev-list --all | git diff-tree --stdin

[PoC -- do not apply 1/3] initial tree-bitmap proof of concept

2018-10-09 Thread Jeff King
Signed-off-by: Jeff King --- Makefile| 1 + t/helper/test-tree-bitmap.c | 167 2 files changed, 168 insertions(+) create mode 100644 t/helper/test-tree-bitmap.c diff --git a/Makefile b/Makefile index 13e1c52478..f6e823f2d6 100644 ---

[PATCH 11/14] apply: replace hard-coded constants

2018-10-08 Thread brian m. carlson
strlen(patch->new_sha1_prefix) != hexsz || get_oid_hex(patch->old_sha1_prefix, ) || get_oid_hex(patch->new_sha1_prefix, )) return error(_("cannot apply binary patch to '%s' " @@ -4055,7 +4057,7 @@ static int preimage_oid_in_gitlink_patch(

[PATCH 12/14] apply: rename new_sha1_prefix and old_sha1_prefix

2018-10-08 Thread brian m. carlson
refix) != hexsz || - get_oid_hex(patch->old_sha1_prefix, ) || - get_oid_hex(patch->new_sha1_prefix, )) + if (strlen(patch->old_oid_prefix) != hexsz || + strlen(patch->new_oid_prefix) != hexsz || + get_oid_hex(patch->old_oid_prefix, ) || +

Re: [BUG] Error while trying to git apply a patch; works with patch -p1

2018-10-05 Thread SZEDER Gábor
list > > > archives, so I'm sending it again without files attached. I apologize > > > if this is a duplicate. One should be able to reproduce this with the > > > current PR files, but if not, I can provide them. > > > > > > I've hit a strange error

Re: [BUG] Error while trying to git apply a patch; works with patch -p1

2018-10-05 Thread Eneas Queiroz
ched. I apologize > > if this is a duplicate. One should be able to reproduce this with the > > current PR files, but if not, I can provide them. > > > > I've hit a strange error while trying to apply a patch from github > > here: https://github.com/openwrt/openwrt/pull/965 > > > &g

Re: [BUG] Error while trying to git apply a patch; works with patch -p1

2018-10-04 Thread SZEDER Gábor
; current PR files, but if not, I can provide them. > > I've hit a strange error while trying to apply a patch from github > here: https://github.com/openwrt/openwrt/pull/965 > > 965.patch:452: trailing whitespace. > > 965.patch:559: space before tab in indent. >

[BUG] Error while trying to git apply a patch; works with patch -p1

2018-10-04 Thread Eneas Queiroz
trying to apply a patch from github here: https://github.com/openwrt/openwrt/pull/965 965.patch:452: trailing whitespace. 965.patch:559: space before tab in indent. -o $(SHLIBNAME_FULL) \ 965.patch:560: space before tab in indent. $$ALLSYMSFLAGS $$SHOBJECTS $$NOALLSYMSFLAGS

Re: [PATCH v9 07/21] stash: convert apply to builtin

2018-09-30 Thread Thomas Gummerer
On 09/26, Paul-Sebastian Ungureanu wrote: > From: Joel Teichroeb > > Add a builtin helper for performing stash commands. Converting > all at once proved hard to review, so starting with just apply > lets conversion get started without the other commands being > finished. >

[PATCH v9 07/21] stash: convert apply to builtin

2018-09-25 Thread Paul-Sebastian Ungureanu
From: Joel Teichroeb Add a builtin helper for performing stash commands. Converting all at once proved hard to review, so starting with just apply lets conversion get started without the other commands being finished. The helper is being implemented as a drop in replacement for stash so

Re: [PATCH 14/14] format-patch: allow --range-diff to apply to a lone-patch

2018-09-07 Thread Eric Sunshine
On Wed, Jul 25, 2018 at 5:07 PM Junio C Hamano wrote: > Eric Sunshine writes: > > + if (cmit_fmt_is_mail(ctx.fmt) && opt->rdiff1) { > > + struct diff_queue_struct dq; > > + > > + memcpy(, _queued_diff, sizeof(diff_queued_diff)); > > +

[GSoC][PATCH v8 06/20] stash: convert apply to builtin

2018-08-30 Thread Paul-Sebastian Ungureanu
From: Joel Teichroeb Add a builtin helper for performing stash commands. Converting all at once proved hard to review, so starting with just apply lets conversion get started without the other commands being finished. The helper is being implemented as a drop in replacement for stash so

Re: [GSoC][PATCH v7 26/26] stash: replace all "git apply" child processes with API calls

2018-08-19 Thread Thomas Gummerer
On 08/08, Paul-Sebastian Ungureanu wrote: > `apply_all_patches()` does not provide a method to apply patches > from strbuf. Because of this, this commit introduces a new > function `apply_patch_from_buf()` which applies a patch from buf. > It works by saving the strbuf as a file. Thi

Re: [GSoC][PATCH v7 05/26] stash: convert apply to builtin

2018-08-18 Thread Duy Nguyen
On Wed, Aug 8, 2018 at 9:00 PM Paul-Sebastian Ungureanu wrote: > + strbuf_init(>revision, 0); > + if (!commit) { > + if (!ref_exists(ref_stash)) { > + free_stash_info(info); > + fprintf_ln(stderr, "No stash entries found.");

Re: Bug? Git won't apply a split hunk that went through a text editor

2018-08-10 Thread Phillip Wood
reporting it here based on guidance from https://git-scm.com/community. I created a minimal testcase with a detailed README here: https://github.com/philipmw/git-bugreport-2018-hunk-fail Overview of the bug: When interactively selecting hunks to apply, using `git checkout -p `, git will correctly apply

Re: Bug? Git won't apply a split hunk that went through a text editor

2018-08-10 Thread Jeff King
nity. > > I created a minimal testcase with a detailed README here: > https://github.com/philipmw/git-bugreport-2018-hunk-fail > > Overview of the bug: > > When interactively selecting hunks to apply, using `git checkout -p > `, git will correctly apply an unmodified hun

Re: [GSoC][PATCH v7 05/26] stash: convert apply to builtin

2018-08-10 Thread Paul-Sebastian Ungureanu
have made some changes to his code and also added a lot more of my own. What I did was to completely convert git stash and apply some more optimizations on top of that, like reducing the number of spawned processes. Due to this kind of improvements I was able to significantly reduce the exec

Bug? Git won't apply a split hunk that went through a text editor

2018-08-09 Thread Philip White
README here: https://github.com/philipmw/git-bugreport-2018-hunk-fail Overview of the bug: When interactively selecting hunks to apply, using `git checkout -p `, git will correctly apply an unmodified hunk, but will refuse to apply a hunk that went through a text editor ("e" command), e

Re: [GSoC][PATCH v7 05/26] stash: convert apply to builtin

2018-08-09 Thread Junio C Hamano
Paul-Sebastian Ungureanu writes: >> Good to see that the right way to forward a patch from another >> person is used, but is this a GSoC project? > > Yes, it is. I forgot to add the [GSoC] tag in the last series of patches. The reason I asked was because IIRC GSoC was not supposed to be team

Re: [GSoC][PATCH v7 05/26] stash: convert apply to builtin

2018-08-09 Thread Paul-Sebastian Ungureanu
Hello, On 08.08.2018 23:18, Junio C Hamano wrote: Paul-Sebastian Ungureanu writes: From: Joel Teichroeb Add a builtin helper for performing stash commands. Converting all at once proved hard to review, so starting with just apply lets conversion get started without the other commands being

Re: [PATCH] update-index: there no longer is `apply --index-info`

2018-08-08 Thread Jeff King
On Wed, Aug 08, 2018 at 02:35:18PM -0700, Junio C Hamano wrote: > Back when we removed `git apply --index-info` in 2007, we forgot to > adjust the documentation for update-index that reads its output. > > Let's reorder the description of three formats to present the other &

[PATCH] update-index: there no longer is `apply --index-info`

2018-08-08 Thread Junio C Hamano
Back when we removed `git apply --index-info` in 2007, we forgot to adjust the documentation for update-index that reads its output. Let's reorder the description of three formats to present the other two formats that are still generated by git commands before this format, and stop mentioning

Re: [GSoC][PATCH v7 05/26] stash: convert apply to builtin

2018-08-08 Thread Junio C Hamano
Paul-Sebastian Ungureanu writes: > From: Joel Teichroeb > > Add a builtin helper for performing stash commands. Converting > all at once proved hard to review, so starting with just apply > lets conversion get started without the other commands being > finished. >

[GSoC][PATCH v7 26/26] stash: replace all "git apply" child processes with API calls

2018-08-08 Thread Paul-Sebastian Ungureanu
`apply_all_patches()` does not provide a method to apply patches from strbuf. Because of this, this commit introduces a new function `apply_patch_from_buf()` which applies a patch from buf. It works by saving the strbuf as a file. This way we can call `apply_all_patches()`. Before returning

[GSoC][PATCH v7 05/26] stash: convert apply to builtin

2018-08-08 Thread Paul-Sebastian Ungureanu
From: Joel Teichroeb Add a builtin helper for performing stash commands. Converting all at once proved hard to review, so starting with just apply lets conversion get started without the other commands being finished. The helper is being implemented as a drop in replacement for stash so

Re: [PATCH 14/14] format-patch: allow --range-diff to apply to a lone-patch

2018-07-25 Thread Junio C Hamano
Eric Sunshine writes: > @@ -750,6 +751,20 @@ void show_log(struct rev_info *opt) > > memcpy(_queued_diff, , sizeof(diff_queued_diff)); > } > + > + if (cmit_fmt_is_mail(ctx.fmt) && opt->rdiff1) { > + struct diff_queue_struct dq; > + > + memcpy(,

Re: [PATCH 06/14] format-patch: allow --interdiff to apply to a lone-patch

2018-07-23 Thread Eric Sunshine
e mixed feelings about this suggestion for the following reasons: * 'struct rev_info' already contains a number of specialized fields which apply in only certain use cases but not others, and those fields often are grouped textually to show relationship rather than being bundled in a struct. *

Re: [PATCH 06/14] format-patch: allow --interdiff to apply to a lone-patch

2018-07-23 Thread Duy Nguyen
On Sun, Jul 22, 2018 at 11:58 AM Eric Sunshine wrote: > diff --git a/log-tree.c b/log-tree.c > index 9d38f1cf79..56513fa83d 100644 > --- a/log-tree.c > +++ b/log-tree.c > @@ -14,6 +14,7 @@ > #include "sequencer.h" > #include "line-log.h" > #include "help.h" > +#include "interdiff.h" > >

[PATCH 14/14] format-patch: allow --range-diff to apply to a lone-patch

2018-07-22 Thread Eric Sunshine
When submitting a revised version of a patch or series, it can be helpful (to reviewers) to include a summary of changes since the previous attempt in the form of a range-diff, typically in the cover letter. However, it is occasionally useful, despite making for a noisy read, to insert a

[PATCH 06/14] format-patch: allow --interdiff to apply to a lone-patch

2018-07-22 Thread Eric Sunshine
When submitting a revised version of a patch or series, it can be helpful (to reviewers) to include a summary of changes since the previous attempt in the form of an interdiff, typically in the cover letter. However, it is occasionally useful, despite making for a noisy read, to insert an

[PATCH v6 1/4] stash: convert apply to builtin

2018-06-25 Thread Paul-Sebastian Ungureanu
From: Joel Teichroeb Add a builtin helper for performing stash commands. Converting all at once proved hard to review, so starting with just apply lets conversion get started without the other commands being finished. The helper is being implemented as a drop in replacement for stash so

[PATCH] apply: fix grammar error in comment

2018-06-06 Thread Elijah Newren
Signed-off-by: Elijah Newren --- apply.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apply.c b/apply.c index d79e61591b..85f2c92740 100644 --- a/apply.c +++ b/apply.c @@ -4053,7 +4053,7 @@ static int preimage_oid_in_gitlink_patch(struct patch *p, struct object_id *oid)

[PATCH v2 4/4] apply: add --intent-to-add

2018-05-26 Thread Nguyễn Thái Ngọc Duy
Similar to 'git reset -N', this option makes 'git apply' automatically mark new files as intent-to-add so they are visible in the following 'git diff' command and could also be committed with 'git commit -a'. Signed-off-by: Nguyễn Thái Ngọc Duy <pclo...@gmail.com> --- Documentation/git-app

[PATCH v2 0/4] Fix i-t-a entries in git-diff and git-apply

2018-05-26 Thread Nguyễn Thái Ngọc Duy
-[in]visible-in-index when diffing worktree-to-tree diff: turn --ita-invisible-in-index on by default t2203: add a test about "diff HEAD" case apply: add --intent-to-add Documentation/git-apply.txt | 10 +- apply.c | 19 +++ apply.h

Re: [PATCH 2/2] apply: add --intent-to-add

2018-05-20 Thread Junio C Hamano
t;set_ita = 0; >> >> I think this should error out, just like one line above does. >> "I-t-a" is impossible without having the index, just like "--index" >> is impossible without having the index. > > I was hoping to put this in an alias th

Re: git apply does not honor diff.noprefix config setting

2018-05-20 Thread Junio C Hamano
hIpPy <hippy2...@gmail.com> writes: > If I disable mnemonic prefix, > > $ git config --global diff.noprefix true > > and do a round-trip of format-patch and apply, Setting diff.noprefix does not disable "mnemonic prefix". It asks "diff" family of comma

Re: [PATCH 2/2] apply: add --intent-to-add

2018-05-20 Thread Duy Nguyen
On Mon, May 14, 2018 at 11:33:48AM +0900, Junio C Hamano wrote: > > diff --git a/Documentation/git-apply.txt b/Documentation/git-apply.txt > > index 4ebc3d3271..2374f64b51 100644 > > --- a/Documentation/git-apply.txt > > +++ b/Documentation/git-apply.txt > > @@

git apply does not honor diff.noprefix config setting

2018-05-19 Thread hIpPy
If I disable mnemonic prefix, $ git config --global diff.noprefix true and do a round-trip of format-patch and apply, $ git format-patch -1 @ $ git apply git apply fails with, error: git diff header lacks filename information when removing 1 leading pathname component (line 16) Without

Re: [PATCH 2/2] apply: add --intent-to-add

2018-05-13 Thread Junio C Hamano
Nguyễn Thái Ngọc Duy <pclo...@gmail.com> writes: > Similar to 'git reset -N', this option makes 'git apply' automatically > mark new files as intent-to-add so they are visible in the following > 'git diff' command and could also be committed with 'git commit -a'. > > Signe

[PATCH 2/2] apply: add --intent-to-add

2018-05-13 Thread Nguyễn Thái Ngọc Duy
Similar to 'git reset -N', this option makes 'git apply' automatically mark new files as intent-to-add so they are visible in the following 'git diff' command and could also be committed with 'git commit -a'. Signed-off-by: Nguyễn Thái Ngọc Duy <pclo...@gmail.com> --- Documentation/git-app

Re: [PATCH] apply: clarify "-p" documentation

2018-05-10 Thread Junio C Hamano
Jeff King <p...@peff.net> writes: > How about this? > > -- >8 -- > Subject: [PATCH] apply: clarify "-p" documentation > > We're not really removing slashes, but slash-separated path > components. Let's make that more clear. > > Reported-by: ke

[PATCH] apply: clarify "-p" documentation

2018-05-10 Thread Jeff King
home/user/repos/myrepo with -p2 becomes user/repos/myrepo > > This argument seems to be removing folders from the path, not slashes. Yes. I agree the current documentation is quite misleading. How about this? -- >8 -- Subject: [PATCH] apply: clarify "-p" documentation We're

Confusing documentation for git apply -p

2018-04-27 Thread kelly elton
https://git-scm.com/docs/git-apply#git-apply--pltngt > -p > Remove leading slashes from traditional diff paths. The default is 1. This suggests to me the following outcomes: 1) home/user/repos/myrepo with -p1 becomes home/user/repos/myrepo 2) home/user/repos/myrepo with -p2 becomes hom

[PATCH v10 23/36] merge-recursive: apply necessary modifications for directory renames

2018-04-19 Thread Elijah Newren
This commit hooks together all the directory rename logic by making the necessary changes to the rename struct, it's dst_entry, and the diff_filepair under consideration. Reviewed-by: Stefan Beller Signed-off-by: Elijah Newren Signed-off-by: Junio C Hamano

Re: [PATCH v5 2/5] stash: convert apply to builtin

2018-04-06 Thread Johannes Schindelin
ARSE_OPT_KEEP_UNKNOWN|PARSE_OPT_KEEP_DASHDASH); > + > + index_file = get_index_file(); > + strbuf_addf(_index_path, "%s.stash.%" PRIuMAX, index_file, > (uintmax_t)pid); > + > + if (argc < 1) > + usage_with_options(git_stash_helper_usag

Re: [PATCH v5 2/5] stash: convert apply to builtin

2018-04-06 Thread Johannes Schindelin
Hi Joel, On Wed, 4 Apr 2018, Joel Teichroeb wrote: > Add a bulitin helper for performing stash commands. Converting > all at once proved hard to review, so starting with just apply > let conversion get started without the other command being s/let/lets the/ s/command/commands/ &

Re: [PATCH v5 2/5] stash: convert apply to builtin

2018-04-05 Thread Johannes Schindelin
rom > stash")); I agree with this, as it avoids an unncessary indentation level. > So maybe we can get rid of `result` and have something like: > >if (argc < 1) { >error(_("at least one argument is required")); >usage_with_options(git_stash_helper_us

Re: [PATCH v5 2/5] stash: convert apply to builtin

2018-04-05 Thread Christian Couder
if (argc < 1) { >>error(_("at least one argument is required")); >>usage_with_options(git_stash_helper_usage, options); > > Maybe we could also simplify these 2 lines by using usage_msg_opt(). > >>} >> >>

Re: [PATCH v5 2/5] stash: convert apply to builtin

2018-04-05 Thread Christian Couder
gt;usage_with_options(git_stash_helper_usage, options); Maybe we could also simplify these 2 lines by using usage_msg_opt(). > } > >if (!strcmp(argv[0], "apply")) >return apply_stash(argc, argv, prefix); > >error(_("unknown subcomma

Re: [PATCH v5 2/5] stash: convert apply to builtin

2018-04-05 Thread Christian Couder
On Thu, Apr 5, 2018 at 4:28 AM, Joel Teichroeb <j...@teichroeb.net> wrote: > Add a bulitin helper for performing stash commands. Converting > all at once proved hard to review, so starting with just apply > let conversion get started without the other command being > finish

[PATCH v5 2/5] stash: convert apply to builtin

2018-04-04 Thread Joel Teichroeb
Add a bulitin helper for performing stash commands. Converting all at once proved hard to review, so starting with just apply let conversion get started without the other command being finished. The helper is being implemented as a drop in replacement for stash so that when it is complete it can

Re: [PATCH v4 2/5] stash: convert apply to builtin

2018-03-31 Thread Joel Teichroeb
e code was the weakest part of my patch before. I'm very happy to have it cleaned up like this! > >> +int cmd_stash__helper(int argc, const char **argv, const char *prefix) >> +{ >> + int result = 0; >> + pid_t pid = getpid(); >> + co

Re: [PATCH v4 2/5] stash: convert apply to builtin

2018-03-29 Thread Junio C Hamano
rgc, argv, prefix, options, > git_stash_helper_usage, > + PARSE_OPT_KEEP_UNKNOWN|PARSE_OPT_KEEP_DASHDASH); > + > + index_file = get_index_file(); > + xsnprintf(stash_index_path, PATH_MAX, "%s.stash.%"PRIuMAX, index_file, > (uintmax_t)pid); Wouldn't it make more sense to get rid of PATH_MAX and hold it in a strbuf instead? I.e. static struct strbuf stash_index_path = STRBUF_INIT; ... strbuf_addf(_index_path, "%s.stash.%" PRIuMAX, index_file, (uintmax_t)pid); > + cd "$START_DIR" > + git stash--helper apply "$@" > + res=$? > + cd_to_toplevel > + return $res > }

[PATCH v4 2/5] stash: convert apply to builtin

2018-03-28 Thread Joel Teichroeb
Add a bulitin helper for performing stash commands. Converting all at once proved hard to review, so starting with just apply let conversion get started without the other command being finished. The helper is being implemented as a drop in replacement for stash so that when it is complete it can

Re: [PATCH v2 3/6] stash: convert apply to builtin

2018-03-27 Thread Joel Teichroeb
On Mon, Mar 26, 2018 at 12:05 AM, Christian Couder wrote: > On Mon, Mar 26, 2018 at 3:14 AM, Joel Teichroeb wrote: >> Signed-off-by: Joel Teichroeb > > The commit message in this patch and the following ones could be a bit >

Re: [PATCH 1/4] stash: convert apply to builtin

2018-03-27 Thread Joel Teichroeb
On Sun, Mar 25, 2018 at 9:43 AM, Thomas Gummerer wrote: > On 03/24, Joel Teichroeb wrote: >> --- > > Missing sign-off? I saw it's missing in the other patches as well. > Thanks! I always forget to add a sign-off. >> [...] >> + >> + if (info->has_u) { >> +

Re: [PATCH v3 2/5] stash: convert apply to builtin

2018-03-27 Thread Joel Teichroeb
On Tue, Mar 27, 2018 at 9:02 AM, Johannes Schindelin wrote: > Hi Joel, > > [...] >> + >> +static int do_apply_stash(const char *prefix, struct stash_info *info, int >> index) >> +{ >> + struct merge_options o; >> + struct object_id c_tree; >> + struct

Re: [PATCH v3 2/5] stash: convert apply to builtin

2018-03-27 Thread Johannes Schindelin
Hi Joel, On Mon, 26 Mar 2018, Joel Teichroeb wrote: > Add a bulitin helper for performing stash commands. Converting > all at once proved hard to review, so starting with just apply > let conversion get started without the other command being > finished. > > The helper is

Re: [PATCH v3 2/5] stash: convert apply to builtin

2018-03-27 Thread Johannes Schindelin
Hi Joel, On Mon, 26 Mar 2018, Joel Teichroeb wrote: > Add a bulitin helper for performing stash commands. Converting > all at once proved hard to review, so starting with just apply > let conversion get started without the other command being > finished. > > The helper is

[PATCH v3 2/5] stash: convert apply to builtin

2018-03-26 Thread Joel Teichroeb
Add a bulitin helper for performing stash commands. Converting all at once proved hard to review, so starting with just apply let conversion get started without the other command being finished. The helper is being implemented as a drop in replacement for stash so that when it is complete it can

Re: [PATCH v2 3/6] stash: convert apply to builtin

2018-03-26 Thread Christian Couder
On Mon, Mar 26, 2018 at 3:14 AM, Joel Teichroeb wrote: > Signed-off-by: Joel Teichroeb The commit message in this patch and the following ones could be a bit more verbose. It could at least tell that the end goal is to convert git-stash.sh to a C builtin.

[PATCH v2 3/6] stash: convert apply to builtin

2018-03-25 Thread Joel Teichroeb
clude "refs.h" +#include "lockfile.h" +#include "cache-tree.h" +#include "unpack-trees.h" +#include "merge-recursive.h" +#include "argv-array.h" +#include "run-command.h" +#include "dir.h" + +static const cha

Re: [PATCH 1/4] stash: convert apply to builtin

2018-03-25 Thread Christian Couder
On Sun, Mar 25, 2018 at 6:51 PM, Joel Teichroeb wrote: > On Sun, Mar 25, 2018 at 1:09 AM, Christian Couder > wrote: >> It seems to me that the apply_stash() shell function is also used in >> pop_stash() and in apply_to_branch(). Can the new helper

Re: [PATCH 1/4] stash: convert apply to builtin

2018-03-25 Thread Thomas Gummerer
On 03/24, Joel Teichroeb wrote: > --- > [...] > + > +static const char *ref_stash = "refs/stash"; > +static int quiet; > +static char stash_index_path[PATH_MAX]; > + > +struct stash_info { > + struct object_id w_commit; > + struct object_id b_commit; > + struct object_id i_commit; > +

Re: [PATCH 1/4] stash: convert apply to builtin

2018-03-25 Thread Joel Teichroeb
On Sun, Mar 25, 2018 at 1:09 AM, Christian Couder wrote: > It seems to me that the apply_stash() shell function is also used in > pop_stash() and in apply_to_branch(). Can the new helper be used there > too instead of apply_stash()? And then could apply_stash() be

Re: [PATCH 1/4] stash: convert apply to builtin

2018-03-25 Thread Thomas Gummerer
_cache(REFRESH_QUIET)) > + return -1; > + > + if (write_cache_as_tree(c_tree.hash, 0, NULL) || reset_tree(c_tree, 0, > 0)) > + return error(_("Cannot apply a stash in the middle of a > merge")); > + > + if (index) { > + if (!oidcmp(>

Re: [PATCH 1/4] stash: convert apply to builtin

2018-03-25 Thread Christian Couder
t;> + argv_array_pushf(, "%s^2^..%s^2", >> sha1_to_hex(info->w_commit.hash), sha1_to_hex(info->w_commit.hash)); >> + if (pipe_command(, NULL, 0, , 0, NULL, 0)) >> + return -1; > > Leak

Re: [PATCH 1/4] stash: convert apply to builtin

2018-03-25 Thread Christian Couder
On Sat, Mar 24, 2018 at 6:37 PM, Joel Teichroeb <j...@teichroeb.net> wrote: > diff --git a/git-stash.sh b/git-stash.sh > index fc8f8ae640..92c084eb17 100755 > --- a/git-stash.sh > +++ b/git-stash.sh > @@ -711,7 +711,8 @@ push) > ;; > apply) >

Re: [PATCH 1/4] stash: convert apply to builtin

2018-03-25 Thread Eric Sunshine
ipe_command(, NULL, 0, , 0, NULL, 0)) > + return -1; Leaking 'out'? > + > + child_process_init(); > + cp.git_cmd = 1; > + argv_array_pushl(, "apply", "--cached", NULL); > +

Re: [PATCH 1/4] stash: convert apply to builtin

2018-03-24 Thread Christian Couder
> + if (unpack_trees(nr_trees, t, )) > + return -1; > + > + if (write_locked_index(_index, _file, COMMIT_LOCK)) { > + error(_("unable to write new index file")); > + return -1; Maybe: return error(...); > + } > + > + return 0; >

[PATCH 1/4] stash: convert apply to builtin

2018-03-24 Thread Joel Teichroeb
+#include "cache-tree.h" +#include "unpack-trees.h" +#include "merge-recursive.h" +#include "argv-array.h" +#include "run-command.h" +#include "dir.h" + +static const char * const git_stash_helper_usage[] = { + N_("git stash--h

[PATCH v8 30/29] fixup! merge-recursive: apply necessary modifications for directory renames

2018-02-27 Thread Elijah Newren
Use is_null_oid() instead of is_null_sha1() --- This is just a fixup to patch 23/29 in my v8 series for detecting directory renames; should squash cleanly. merge-recursive.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/merge-recursive.c b/merge-recursive.c index

Re: [PATCH] submodule: indicate that 'submodule.recurse' doesn't apply to clone

2018-02-21 Thread Junio C Hamano
Brandon Williams writes: > Update the documentation for the 'submodule.recurse' config to identify > that the clone command does not respect it. > > Signed-off-by: Brandon Williams > --- > Documentation/config.txt | 3 ++- > 1 file changed, 2

  1   2   3   4   5   6   7   8   9   10   >