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

2018-10-26 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'

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-di

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
xes up 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: >

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

2018-10-18 Thread Mahmoud Al-Qudsi
space changes I 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: >

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, &opts)) > > + return -1; > > + > > + if (write_locked_index(&the_index, &lock_file, COMMIT_LOCK)) > > +

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

2018-10-15 Thread Johannes Schindelin
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 with a native function, > + * however it shoul

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

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

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

2018-10-14 Thread brian m. carlson
ha1_prefix) != hexsz || + strlen(patch->new_sha1_prefix) != hexsz || get_oid_hex(patch->old_sha1_prefix, &oid) || get_oid_hex(patch->new_sha1_prefix, &oid)) return error(_("cannot apply binary patch to '%s

[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 that

[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 f

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 fi

[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 m

[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 --n

[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 --- a/

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

2018-10-08 Thread brian m. carlson
ha1_prefix) != hexsz || + strlen(patch->new_sha1_prefix) != hexsz || get_oid_hex(patch->old_sha1_prefix, &oid) || get_oid_hex(patch->new_sha1_prefix, &oid)) return error(_("cannot apply binary patch to '%s

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

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

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

2018-10-05 Thread SZEDER Gábor
it in the 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

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

2018-10-05 Thread Eneas Queiroz
ed. 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/9

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

2018-10-04 Thread SZEDER Gábor
is 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 > > 965.patch:452: trailing whitespace. > > 965.patch:559: space before tab in inde

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

2018-10-04 Thread Eneas Queiroz
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. -o $(SHLIBNAME_FULL) \ 965.patch:560: space before tab in indent. $$ALLSYMSFLAGS $$SHOBJE

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 that

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(&dq, &diff_queued_diff, sizeof(diff_queued_diff)); > > + DIFF_QUEUE_CLE

[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 that

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(&info->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
) I’m 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

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 execution tim

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 eff

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 menti

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, the

[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 that

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(&diff_queued_diff, &dq, sizeof(diff_queued_diff)); > } > + > + if (cmit_fmt_is_mail(ctx.fmt) && opt->rdiff1) { > + struct diff_queue_struct dq; > + > + mem

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 stru

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" > > static

[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 range-diff

[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 interdiff

[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 that

[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 Du

[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
gnore --ita-[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
gt;> 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 that works both with or without

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

2018-05-20 Thread Junio C Hamano
hIpPy 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 commands to use no prefix, not ev

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

2018-05-19 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 > > @@ -9

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 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

[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 Du

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

2018-05-10 Thread Junio C Hamano
Jeff King 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: kelly elton >

[PATCH] apply: clarify "-p" documentation

2018-05-10 Thread Jeff King
o > 2) 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" documentati

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 --- merge-recursive.c

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(&stash_index_path, "%s.stash.%" PRIuMAX, index_file, > (uintmax_t)pid); > + > + if (argc < 1) > + usage_with_options(git_stash_helper_

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
ld not restore untracked files from > 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"));

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

2018-04-05 Thread Christian Couder
or(_("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(). > >>} >> >>if (!strcmp(argv[0], "apply")) >>

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

2018-04-05 Thread Christian Couder
sage, 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 subcommand: %s"), argv[0]); >usage_with_options(git_stash_helper_usage, options); > }

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 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 bein

[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
cleaned up like this! > >> +int cmd_stash__helper(int argc, const char **argv, const char *prefix) >> +{ >> + int result = 0; >> + pid_t pid = getpid(); >> + const char *index_file; >> + >> + struct option options[] = { >> + OPT_END() >> + }; >> + >> + git_config(git_default_config, NULL); >> + >> + argc = parse_options(argc, 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(&stash_index_path, "%s.stash.%" PRIuMAX, index_file, > (uintmax_t)pid); > That makes it a lot cleaner, thanks! >> + cd "$START_DIR" >> + git stash--helper apply "$@" >> + res=$? >> + cd_to_toplevel >> + return $res >> }

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

2018-03-29 Thread Junio C Hamano
= getpid(); > + const char *index_file; > + > + struct option options[] = { > + OPT_END() > + }; > + > + git_config(git_default_config, NULL); > + > + argc = parse_options(argc, 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(&stash_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 > more verbose. It could at least tell that the end goal is to convert >

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) { >> + struct child_process cp

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 object_id index_tree; >> + co

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 bein

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 bein

[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. > +static void destroy_stash_info(struc

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

2018-03-25 Thread Joel Teichroeb
+#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 char * const git_stash_helper_usage[] = {

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 be used there >> too instead of apply_stash()? An

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 remove? I wasn't really sure if

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

2018-03-25 Thread Thomas Gummerer
ESH_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) { > +

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

2018-03-25 Thread Christian Couder
t;> + argv_array_pushf(&cp.args, "%s^2^..%s^2", >> sha1_to_hex(info->w_commit.hash), sha1_to_hex(info->w_commit.hash)); >> + if (pipe_command(&cp, NULL, 0, &out, 0, NULL, 0)) >> + retu

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 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) > shift > - apply_stash &q

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

2018-03-24 Thread Eric Sunshine
sh)); > + if (pipe_command(&cp, NULL, 0, &out, 0, NULL, 0)) > + return -1; Leaking 'out'? > + > + child_process_init(&cp); > + cp.git_cmd = 1; > +

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

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

[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 ffe1

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 insertions(+), 1 deletion(-) Thanks. > diff --git

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

2018-02-20 Thread Brandon Williams
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 insertions(+), 1 deletion(-) diff --git a/Documentation/config.txt b/Documentation/config.t

Re: [PATCH v7 25/31] merge-recursive: apply necessary modifications for directory renames

2018-02-15 Thread SZEDER Gábor
On Wed, Jan 31, 2018 at 12:25 AM, Elijah Newren wrote: > 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. > > Signed-off-by: Elijah Newren > --- > merge-recursive.c

Re: [PATCH 2/2] apply: handle Subversion diffs with /dev/null gracefully

2018-02-15 Thread Junio C Hamano
Johannes Schindelin writes: > } else { > - if (!starts_with(line, "/dev/null\n")) > + if (!is_dev_null(line)) > return error(_("git apply: bad git-diff - expected > /dev/null on line %d"), state->linenr);

[PATCH 1/2] apply: demonstrate a problem applying svn diffs

2018-02-14 Thread Johannes Schindelin
Subversion generates diffs that contain funny ---/+++ lines containing more than just the file names. Example: --- a/trunk/README (revision 4711) +++ /dev/null (nonexistent) Let's add a test case demonstrating that apply cannot handle the /dev/null line (although i

[PATCH 2/2] apply: handle Subversion diffs with /dev/null gracefully

2018-02-14 Thread Johannes Schindelin
From: Tatyana Krasnukha Subversion generates diffs that can contain lines like this one: --- /dev/null (nonexistent) Let's teach Git's apply machinery to handle such a line gracefully. This fixes https://github.com/git-for-windows/git/isues/1489 Signed-off-by: Tatyana

[PATCH 0/2] Teach `git apply` to accept Subversion-generated diffs

2018-02-14 Thread Johannes Schindelin
et's handle the case gracefully where the diff contains a "--- /dev/null" line with a trailing comment. This contribution came in via Pull Request to Git for Windows, from a first time contributor! Yes! Johannes Schindelin (1): apply: demonstrate a problem applying svn diffs Tat

<    1   2   3   4   5   6   7   8   9   10   >