Re: [BUG] submodule config does not apply to upper case submodules?

2017-02-15 Thread Jonathan Tan
On 02/15/2017 03:11 PM, Junio C Hamano wrote: Junio C Hamano writes: Perhaps something like this? This looks good. I was hoping to unify the processing logic between this CLI parsing and the usual stream parsing, but this approach is probably simpler. config.c | 16

Re: [BUG] submodule config does not apply to upper case submodules?

2017-02-15 Thread Jonathan Tan
On 02/15/2017 10:53 AM, Junio C Hamano wrote: Lars Schneider writes: It looks like as if submodule configs ("submodule.*") for submodules with upper case names are ignored. This observation is surprising, as the second level in three-level names like ".." is

Re: [PATCH 6/7] grep: avoid resolving revision names in --no-index case

2017-02-14 Thread Jonathan Tan
On 02/14/2017 10:04 AM, Jeff King wrote: On Tue, Feb 14, 2017 at 08:53:04AM -0800, Jonathan Tan wrote: On 02/13/2017 10:07 PM, Jeff King wrote: diff --git a/builtin/grep.c b/builtin/grep.c index e83b33bda..c4c632594 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -1176,6 +1176,12 @@ int

Re: [PATCH 0/7] grep rev/path parsing fixes

2017-02-14 Thread Jonathan Tan
On 02/13/2017 10:00 PM, Jeff King wrote: I've fixed that, along with a few other bugs and cleanups. The complete series is below. Patch 2 is your (untouched) patch. My suggestions for your test are in patch 3, which can either remain on its own or be squashed in. [1/7]: grep: move thread

Re: [PATCH 6/7] grep: avoid resolving revision names in --no-index case

2017-02-14 Thread Jonathan Tan
On 02/13/2017 10:07 PM, Jeff King wrote: diff --git a/builtin/grep.c b/builtin/grep.c index e83b33bda..c4c632594 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -1176,6 +1176,12 @@ int cmd_grep(int argc, const char **argv, const char *prefix) break; }

[PATCH for NEXT] grep: do not unnecessarily query repo for "--"

2017-02-13 Thread Jonathan Tan
ore, always interpret "--" as signaling the end of options, instead of trying to interpret it as a rev first. Signed-off-by: Jonathan Tan <jonathanta...@google.com> --- There is probably a similar bug for commands of the form: git grep --no-index pattern foo If there

Re: [RFC 00/14] Allow fetch-pack to send ref names (globs allowed)

2017-02-07 Thread Jonathan Tan
Looking back at the comments I have received in reply, I think that there were two major concerns: (i) the case where a server ACKs a client "have" line and the client forever thinks that the server has it, but it may not be the case for future servers (or future invocations of the same server),

Re: Deadlock between git-remote-http and git fetch-pack

2017-01-27 Thread Jonathan Tan
On 01/27/2017 02:31 PM, tsuna wrote: Hi there, While investigating a hung job in our CI system today, I think I found a deadlock in git-remote-http Git version: 2.9.3 Linux (amd64) kernel 4.9.0 Excerpt from the process list: jenkins 27316 0.0 0.0 18508 6024 ?S19:30 0:00 |

Re: [RFC 03/14] upload-pack: test negotiation with changing repo

2017-01-26 Thread Jonathan Tan
On 01/26/2017 02:33 PM, Junio C Hamano wrote: Jonathan Tan <jonathanta...@google.com> writes: diff --git a/t/lib-httpd/one-time-sed.sh b/t/lib-httpd/one-time-sed.sh new file mode 100644 index 0..060ec0300 --- /dev/null +++ b/t/lib-httpd/one-time-sed.sh @@ -0,0 +1,8 @@ +#!/

Re: [RFC 02/14] upload-pack: allow ref name and glob requests

2017-01-26 Thread Jonathan Tan
On 01/26/2017 02:23 PM, Junio C Hamano wrote: Jonathan Tan <jonathanta...@google.com> writes: Currently, while performing packfile negotiation [1], upload-pack allows clients to specify their desired objects only as SHA-1s. This causes: (a) vulnerability to failure when an object tur

Re: [RFC 00/14] Allow fetch-pack to send ref names (globs allowed)

2017-01-26 Thread Jonathan Tan
Thanks for your comments. On 01/26/2017 03:00 PM, Jeff King wrote: On Wed, Jan 25, 2017 at 02:02:53PM -0800, Jonathan Tan wrote: Negotiation currently happens by upload-pack initially sending a list of refs with names and SHA-1 hashes, and then several request/response pairs in which

Re: [RFC 12/14] fetch-pack: do not printf after closing stdout

2017-01-26 Thread Jonathan Tan
On 01/25/2017 04:50 PM, Stefan Beller wrote: On Wed, Jan 25, 2017 at 2:03 PM, Jonathan Tan <jonathanta...@google.com> wrote: In fetch-pack, during a stateless RPC, printf is invoked after stdout is closed. Update the code to not do this, preserving the existing behavior. This seems

[RFC 06/14] fetch: refactor to make function args narrower

2017-01-25 Thread Jonathan Tan
Refactor find_non_local_tags and get_ref_map to only take the information they need instead of the entire transport struct. Besides improving code clarity, this also improves their flexibility, which will be needed in a future patch. Signed-off-by: Jonathan Tan <jonathanta...@google.

[RFC 10/14] fetch-pack: support partial names and globs

2017-01-25 Thread Jonathan Tan
Teach fetch-pack to support partial ref names and ref patterns as input. This does not use "want-ref" yet - support for that will be added in a future patch. Signed-off-by: Jonathan Tan <jonathanta...@google.com> --- builtin/fetch-pack.c | 40 ---

[RFC 08/14] fetch-pack: check returned refs for matches

2017-01-25 Thread Jonathan Tan
the nested for loop in this patch.) Signed-off-by: Jonathan Tan <jonathanta...@google.com> --- builtin/fetch-pack.c | 7 ++- fetch-pack.c | 9 ++--- fetch-pack.h | 2 -- remote.h | 3 +-- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/buil

[RFC 09/14] transport: put ref oid in out param

2017-01-25 Thread Jonathan Tan
by the fetch mechanism. Signed-off-by: Jonathan Tan <jonathanta...@google.com> --- builtin/clone.c | 14 -- builtin/fetch-pack.c | 4 ++-- fetch-pack.c | 26 +++--- fetch-pack.h | 2 +- transport-helper.c

[RFC 14/14] DONT USE advertise_ref_in_want=1

2017-01-25 Thread Jonathan Tan
--- t/t5500-fetch-pack.sh | 2 ++ upload-pack.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh index 18fe23c97..f39dbcab8 100755 --- a/t/t5500-fetch-pack.sh +++ b/t/t5500-fetch-pack.sh @@ -551,6 +551,7 @@

[RFC 07/14] fetch-pack: put shallow info in out param

2017-01-25 Thread Jonathan Tan
a remote-tracking branch seems to track more than one remote branch. This is the 1st of 3 patches to eliminate using input refs to communicate information obtained by the fetch mechanism. Signed-off-by: Jonathan Tan <jonathanta...@google.com> --- builtin/clone.c| 4 ++-- b

[RFC 11/14] fetch-pack: support want-ref

2017-01-25 Thread Jonathan Tan
Teach fetch-pack to use the want-ref mechanism whenever the server advertises it. Signed-off-by: Jonathan Tan <jonathanta...@google.com> --- builtin/fetch-pack.c | 5 +- fetch-pack.c | 173 -- fetch-pack.h | 2 + t

[RFC 03/14] upload-pack: test negotiation with changing repo

2017-01-25 Thread Jonathan Tan
his effort, a mechanism to substitute strings in an HTTP response only on the first invocation is added. Signed-off-by: Jonathan Tan <jonathanta...@google.com> --- t/lib-httpd.sh | 1 + t/lib-httpd/apache.conf| 8 t/lib-httpd/one-time-sed.sh|

[RFC 05/14] fetch: refactor fetch_refs into two functions

2017-01-25 Thread Jonathan Tan
Refactor the fetch_refs function into a function that does the fetching of refs and another function that stores them. This prepares for a future patch where some processing may be done between those tasks. Signed-off-by: Jonathan Tan <jonathanta...@google.com> --- builtin/fetch.

[RFC 12/14] fetch-pack: do not printf after closing stdout

2017-01-25 Thread Jonathan Tan
In fetch-pack, during a stateless RPC, printf is invoked after stdout is closed. Update the code to not do this, preserving the existing behavior. Signed-off-by: Jonathan Tan <jonathanta...@google.com> --- builtin/fetch-pack.c | 14 ++ 1 file changed, 10 insertions(+), 4 del

[RFC 13/14] fetch: send want-ref and receive fetched refs

2017-01-25 Thread Jonathan Tan
Teach fetch to send refspecs to the underlying transport, and teach all components used by the HTTP transport (remote-curl, transport-helper, fetch-pack) to understand and propagate the names and SHA-1s of the refs fetched. Signed-off-by: Jonathan Tan <jonathanta...@google.com> --- b

[RFC 00/14] Allow fetch-pack to send ref names (globs allowed)

2017-01-25 Thread Jonathan Tan
"want-ref refs/heads/foo", "want-ref refs/tags/foo", among others, and ensure that at least one such ref has been fetched. [2] <20161024132932.i42rqn2vlpocq...@sigill.intra.peff.net> Jonathan Tan (14): upload-pack: move parsing of "want" line

[RFC 04/14] fetch: refactor the population of hashes

2017-01-25 Thread Jonathan Tan
Populate SHA-1 ref hashes in get_ref_map instead of do_fetch. Besides tightening scopes of variables in the code, this also prepares for a future patch where get_ref_map is called multiple times within do_fetch. Signed-off-by: Jonathan Tan <jonathanta...@google.com> --- builtin/fetch.

[RFC 02/14] upload-pack: allow ref name and glob requests

2017-01-25 Thread Jonathan Tan
quot;, among others, and ensure that at least one such ref has been fetched. [1] pack-protocol.txt Signed-off-by: Jonathan Tan <jonathanta...@google.com> --- Documentation/technical/http-protocol.txt | 20 +- Documentation/technical/pack-protocol.txt | 24 +- Documen

[RFC 01/14] upload-pack: move parsing of "want" line

2017-01-25 Thread Jonathan Tan
Refactor to parse "want" lines when the prefix is found. This makes it easier to add support for another prefix, which will be done in a subsequent commit. Signed-off-by: Jonathan Tan <jonathanta...@google.com> --- upload-pack.c | 28 ++-- 1 file change

Re: [PATCH 2/2] mailinfo: Understand forwarded patches

2017-01-12 Thread Jonathan Tan
On 01/12/2017 01:20 AM, Matthew Wilcox wrote: From: Matthew Wilcox Extend the --scissors mechanism to strip off the preamble created by forwarding a patch. There are a couple of extra headers ("Sent" and "To") added by forwarding, but other than that, the --scissors

Re: [PATCH 1/2] mailinfo: Add support for keep_cr

2017-01-12 Thread Jonathan Tan
On 01/12/2017 01:20 AM, Matthew Wilcox wrote: From: Matthew Wilcox If you have a base-64 encoded patch with CRLF endings (as produced by forwarding a patch from Outlook to a Linux machine, for example), the keep_cr setting is not honoured because keep_cr is only passed

Re: [PATCH] mailinfo.c: move side-effects outside of assert

2016-12-19 Thread Jonathan Tan
On 12/19/2016 12:38 PM, Kyle J. McKay wrote: On Dec 19, 2016, at 12:03, Jeff King wrote: On Sat, Dec 17, 2016 at 11:54:18AM -0800, Kyle J. McKay wrote: Since 6b4b013f18 (mailinfo: handle in-body header continuations, 2016-09-20, v2.11.0) mailinfo.c has contained new code with an assert of

[PATCH] transport-helper: drop broken "unchanged" feature

2016-11-30 Thread Jonathan Tan
emote ref always has the contents of the local ref of the same name. (Git also cannot assume that the remote ref has the value of the current destination local ref, or any other ref, since the previous import/fetch could have been made using a different refspec.) Drop that assumption. Signed-off-by: Jona

[BUG?] Remote helper's wrong assumption of unchanged ref

2016-11-30 Thread Jonathan Tan
s2 M1 local refs/remotes/origin/master && + compare_refs s2 B1 local refs/remotes/origin/mybranch && + + # One unchanged branch + + GIT_REMOTE_TESTGIT_UNCHANGED_BRANCH_REGEX=mybranch git -C local fetch && + compare_refs s2 M1 local refs/remotes/origin/master &&am

Re: What's cooking in git.git (Nov 2016, #05; Wed, 23)

2016-11-28 Thread Jonathan Tan
On Mon, Nov 28, 2016 at 4:06 PM, Junio C Hamano <gits...@pobox.com> wrote: > Jonathan Tan <jonathanta...@google.com> writes: > >> On 11/23/2016 03:21 PM, Junio C Hamano wrote: >>> * jt/use-trailer-api-in-commands (2016-11-02) 6 commits >>> - sequencer: u

Re: What's cooking in git.git (Nov 2016, #05; Wed, 23)

2016-11-28 Thread Jonathan Tan
On 11/23/2016 03:21 PM, Junio C Hamano wrote: * jt/use-trailer-api-in-commands (2016-11-02) 6 commits - sequencer: use trailer's trailer layout - trailer: have function to describe trailer layout - trailer: avoid unnecessary splitting on lines - commit: make ignore_non_trailer take buf/len

[PATCH] doc: mention user-configured trailers

2016-11-21 Thread Jonathan Tan
/t7513-interpret-trailers.sh Signed-off-by: Jonathan Tan <jonathanta...@google.com> --- Yes, mentioning a trailer in a Git config will cause interpret-trailers to treat it similarly to a Git-generated trailer (in that its presence causes a block partially consisting of trailers to be considered

Re: [PATCH v3 5/6] grep: enable recurse-submodules to work on objects

2016-11-14 Thread Jonathan Tan
On 11/14/2016 10:56 AM, Junio C Hamano wrote: Jonathan Tan <jonathanta...@google.com> writes: to: HEAD:file HEAD:sub/file Signed-off-by: Brandon Williams <bmw...@google.com> --- Unrelated tangent, but this makes readers wonder what the updated trailer code would do to the la

Re: [PATCH v3 5/6] grep: enable recurse-submodules to work on objects

2016-11-14 Thread Jonathan Tan
On 11/14/2016 10:10 AM, Junio C Hamano wrote: Brandon Williams writes: Teach grep to recursively search in submodules when provided with a object. This allows grep to search a submodule based on the state of the submodule that is present in a commit of the super project.

Re: [PATCH v2 5/6] grep: enable recurse-submodules to work on objects

2016-11-11 Thread Jonathan Tan
On 10/31/2016 03:38 PM, Brandon Williams wrote: diff --git a/Documentation/git-grep.txt b/Documentation/git-grep.txt index 17aa1ba..386a868 100644 --- a/Documentation/git-grep.txt +++ b/Documentation/git-grep.txt @@ -26,7 +26,7 @@ SYNOPSIS [--threads ] [-f ] [-e]

[PATCH] fetch: do not redundantly calculate tag refmap

2016-11-10 Thread Jonathan Tan
ot; anyway. This was introduced in commit c5a84e9 ("fetch --tags: fetch tags *in addition to* other stuff", 2013-10-29) when modifying the effect of the --tags parameter to "git fetch". The refmap-for-tag calculation was copied instead of moved. Signed-off-by: Jonathan Tan <

Re: [PATCH 4/5] grep: optionally recurse into submodules

2016-11-04 Thread Jonathan Tan
On Thu, Oct 27, 2016 at 3:38 PM, Brandon Williams wrote: > diff --git a/builtin/grep.c b/builtin/grep.c > index 8887b6add..f34f16df9 100644 > --- a/builtin/grep.c > +++ b/builtin/grep.c > @@ -18,12 +18,20 @@ > #include "quote.h" > #include "dir.h" > #include "pathspec.h" >

Re: [PATCH v2 1/6] submodules: add helper functions to determine presence of submodules

2016-11-04 Thread Jonathan Tan
On 10/31/2016 03:38 PM, Brandon Williams wrote: + struct strbuf buf = STRBUF_INIT; + char *submodule_url = NULL; + + strbuf_addf(, "submodule.%s.url", module->name); + ret = !git_config_get_string(buf.buf, _url); + +

[PATCH v3 2/5] commit: make ignore_non_trailer take buf/len

2016-11-02 Thread Jonathan Tan
Make ignore_non_trailer take a buf/len pair instead of struct strbuf. Signed-off-by: Jonathan Tan <jonathanta...@google.com> --- builtin/commit.c | 2 +- commit.c | 22 +++--- commit.h | 2 +- trailer.c| 2 +- 4 files changed, 14 insertions(

[PATCH v3 3/5] trailer: avoid unnecessary splitting on lines

2016-11-02 Thread Jonathan Tan
-by: Jonathan Tan <jonathanta...@google.com> --- trailer.c | 194 -- 1 file changed, 100 insertions(+), 94 deletions(-) diff --git a/trailer.c b/trailer.c index 9d7765e..afbff4b 100644 --- a/trailer.c +++ b/trailer.c @@ -102,12 +102,12 @@ stat

[PATCH v3 5/5] sequencer: use trailer's trailer layout

2016-11-02 Thread Jonathan Tan
locks under certain conditions, and therefore suppressing the extra newline in those cases. Consistency with trailer extends to respecting trailer configs. Tests have been included to show that. Signed-off-by: Jonathan Tan <jonathanta...@google.com>

[PATCH v3 4/5] trailer: have function to describe trailer layout

2016-11-02 Thread Jonathan Tan
, another component will be made to use this. Signed-off-by: Jonathan Tan <jonathanta...@google.com> --- trailer.c | 118 +++--- trailer.h | 25 + 2 files changed, 107 insertions(+), 36 deletions(-) diff --git a/trailer.c b/tra

[PATCH v3 0/5] Make other git commands use trailer layout

2016-11-02 Thread Jonathan Tan
This is the same as v2 except that in 1/5, the comment about find_separators has been moved from the commit message to the code itself. Also, a trailing whitespace and unused variable fix. Jonathan Tan (5): trailer: be stricter in parsing separators commit: make ignore_non_trailer take buf

[PATCH v3 1/5] trailer: be stricter in parsing separators

2016-11-02 Thread Jonathan Tan
Currently, a line is interpreted to be a trailer line if it contains a separator. Make parsing stricter by requiring the text on the left of the separator, if not the empty string, to be of the "" form. Signed-off-by: Jonathan Tan <jonathanta...@google.com> ---

Re: [PATCH v2 1/5] trailer: be stricter in parsing separators

2016-11-01 Thread Jonathan Tan
On 11/01/2016 01:37 PM, Junio C Hamano wrote: Junio C Hamano <gits...@pobox.com> writes: Jonathan Tan <jonathanta...@google.com> writes: Currently, a line is interpreted to be a trailer line if it contains a separator. Make parsing stricter by requiring the text on the left of t

[PATCH v2 0/5] Make other git commands use trailer layout

2016-11-01 Thread Jonathan Tan
temporary strings that include '\n' to be passed into the find_separator method. In 2/4 (now 3/5), I've also changed some variable names as requested (e.g. sb -> input, and un-did some others). Jonathan Tan (5): trailer: be stricter in parsing separators commit: make ignore_non_trailer t

[PATCH v2 1/5] trailer: be stricter in parsing separators

2016-11-01 Thread Jonathan Tan
tor-starts-line case because some callers of this function need such a distinction.) Signed-off-by: Jonathan Tan <jonathanta...@google.com> --- trailer.c | 23 +-- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/trailer.c b/trailer.c index f0ecde2

[PATCH v2 3/5] trailer: avoid unnecessary splitting on lines

2016-11-01 Thread Jonathan Tan
-by: Jonathan Tan <jonathanta...@google.com> --- trailer.c | 195 -- 1 file changed, 101 insertions(+), 94 deletions(-) diff --git a/trailer.c b/trailer.c index 04edab2..f5427ec 100644 --- a/trailer.c +++ b/trailer.c @@ -102,12 +102,12 @@ stat

[PATCH v2 4/5] trailer: have function to describe trailer layout

2016-11-01 Thread Jonathan Tan
, another component will be made to use this. Signed-off-by: Jonathan Tan <jonathanta...@google.com> --- trailer.c | 118 +++--- trailer.h | 25 + 2 files changed, 107 insertions(+), 36 deletions(-) diff --git a/trailer.c b/tra

[PATCH v2 2/5] commit: make ignore_non_trailer take buf/len

2016-11-01 Thread Jonathan Tan
Make ignore_non_trailer take a buf/len pair instead of struct strbuf. Signed-off-by: Jonathan Tan <jonathanta...@google.com> --- builtin/commit.c | 2 +- commit.c | 22 +++--- commit.h | 2 +- trailer.c| 2 +- 4 files changed, 14 insertions(

[PATCH v2 5/5] sequencer: use trailer's trailer layout

2016-11-01 Thread Jonathan Tan
locks under certain conditions, and therefore suppressing the extra newline in those cases. Consistency with trailer extends to respecting trailer configs. Tests have been included to show that. Signed-off-by: Jonathan Tan <jonathanta...@google.com>

Re: [PATCH 4/4] sequencer: use trailer's trailer layout

2016-11-01 Thread Jonathan Tan
On 10/31/2016 06:11 PM, Junio C Hamano wrote: Jonathan Tan <jonathanta...@google.com> writes: diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh index ba4902d..635b394 100755 --- a/t/t4014-format-patch.sh +++ b/t/t4014-format-patch.sh @@ -1277,8 +1277,7 @@ EOF 4:Subject:

[PATCH 3/4] trailer: have function to describe trailer layout

2016-10-28 Thread Jonathan Tan
, another component will be made to use this. Signed-off-by: Jonathan Tan <jonathanta...@google.com> --- trailer.c | 120 +++--- trailer.h | 25 + 2 files changed, 108 insertions(+), 37 deletions(-) diff --git a/trailer.c b/tra

[PATCH 4/4] sequencer: use trailer's trailer layout

2016-10-28 Thread Jonathan Tan
locks under certain conditions, and therefore suppressing the extra newline in those cases. Consistency with trailer extends to respecting trailer configs. Tests have been included to show that. Signed-off-by: Jonathan Tan <jonathanta...@google.com>

[PATCH 1/4] commit: make ignore_non_trailer take buf/len

2016-10-28 Thread Jonathan Tan
Make ignore_non_trailer take a buf/len pair instead of struct strbuf. Signed-off-by: Jonathan Tan <jonathanta...@google.com> --- builtin/commit.c | 2 +- commit.c | 22 +++--- commit.h | 2 +- trailer.c| 2 +- 4 files changed, 14 insertions(

[PATCH 2/4] trailer: avoid unnecessary splitting on lines

2016-10-28 Thread Jonathan Tan
-by: Jonathan Tan <jonathanta...@google.com> --- trailer.c | 215 +- 1 file changed, 116 insertions(+), 99 deletions(-) diff --git a/trailer.c b/trailer.c index 6d8375b..d4d9e10 100644 --- a/trailer.c +++ b/trailer.c @@ -102,12 +102,12 @@ stat

[PATCH 0/4] Make other git commands use trailer layout

2016-10-28 Thread Jonathan Tan
t, the aforementioned commands would now handle trailers like those described in [1]. [1] <84f28caa-2e4b-1231-1a76-3b7e765c0...@google.com> Jonathan Tan (4): commit: make ignore_non_trailer take buf/len trailer: avoid unnecessary splitting on lines trailer: have function to describe trail

Re: What's cooking in git.git (Oct 2016, #07; Wed, 26)

2016-10-26 Thread Jonathan Tan
On 10/26/2016 03:29 PM, Junio C Hamano wrote: * jt/trailer-with-cruft (2016-10-21) 8 commits - trailer: support values folded to multiple lines - trailer: forbid leading whitespace in trailers - trailer: allow non-trailers in trailer block - trailer: clarify failure modes in parse_trailer -

[PATCH v5 3/8] trailer: streamline trailer item create and add

2016-10-21 Thread Jonathan Tan
Currently, creation and addition (to a list) of trailer items are spread across multiple functions. Streamline this by only having 2 functions: one to parse the user-supplied string, and one to add the parsed information to a list. Signed-off-by: Jonathan Tan <jonathanta...@google.

[PATCH v5 8/8] trailer: support values folded to multiple lines

2016-10-21 Thread Jonathan Tan
. Signed-off-by: Jonathan Tan <jonathanta...@google.com> --- Documentation/git-interpret-trailers.txt | 7 +- t/t7513-interpret-trailers.sh| 169 +++ trailer.c| 45 ++-- 3 files changed, 211 insertions(+), 10 del

[PATCH v5 2/8] trailer: use list.h for doubly-linked list

2016-10-21 Thread Jonathan Tan
Replace the existing handwritten implementation of a doubly-linked list in trailer.c with the functions and macros from list.h. This significantly simplifies the code. Signed-off-by: Jonathan Tan <jonathanta...@google.com> Signed-off-by: Ramsay Jones <ram...@ramsayjones.plus.com> --

[PATCH v5 7/8] trailer: forbid leading whitespace in trailers

2016-10-21 Thread Jonathan Tan
Currently, interpret-trailers allows leading whitespace in trailer lines. This leads to false positives, especially for quoted lines or bullet lists. Forbid leading whitespace in trailers. Signed-off-by: Jonathan Tan <jonathanta...@google.com> --- Documentation/git-interpret-trailers.tx

[PATCH v5 6/8] trailer: allow non-trailers in trailer block

2016-10-21 Thread Jonathan Tan
89f8808570e37fb90aa3 Signed-off-by: Jonathan Tan <jonathanta...@google.com> --- Documentation/git-interpret-trailers.txt | 5 +- t/t7513-interpret-trailers.sh| 115 +++ trailer.c| 89 3 fil

[PATCH v5 0/8] allow non-trailers and multiple-line trailers

2016-10-21 Thread Jonathan Tan
it as its own function. No other updates. Jonathan Tan (8): trailer: improve const correctness trailer: use list.h for doubly-linked list trailer: streamline trailer item create and add trailer: make args have their own struct trailer: clarify failure modes in parse_trailer trailer: allow

[PATCH v5 1/8] trailer: improve const correctness

2016-10-21 Thread Jonathan Tan
Change "const char *" to "char *" in struct trailer_item and in the return value of apply_command (since those strings are owned strings). Change "struct conf_info *" to "const struct conf_info *" (since that struct is not modified). Signed-off-by

[PATCH v5 5/8] trailer: clarify failure modes in parse_trailer

2016-10-21 Thread Jonathan Tan
command line arguments (which allow '=' as separator) and file input (which does not allow '=' as separator). Signed-off-by: Jonathan Tan <jonathanta...@google.com> --- trailer.c | 75 --- 1 file changed, 53 insertions(+), 22 del

[PATCH v5 4/8] trailer: make args have their own struct

2016-10-21 Thread Jonathan Tan
"struct trailer_item" to be further differentiated from "struct arg_item" in future patches. Signed-off-by: Jonathan Tan <jonathanta...@google.com> --- trailer.c | 135 +++--- 1 file changed, 85 insertions(+), 50 deletion

Re: [PATCH v4 5/8] trailer: clarify failure modes in parse_trailer

2016-10-20 Thread Jonathan Tan
On 10/20/2016 03:45 PM, Junio C Hamano wrote: Jonathan Tan <jonathanta...@google.com> writes: If we do that, there is also the necessity of creating a string that combines the separators and '=' (I guess '\n' is not necessary now, since all the lines are null terminated). I'm OK eith

Re: [PATCH v4 5/8] trailer: clarify failure modes in parse_trailer

2016-10-20 Thread Jonathan Tan
On 10/20/2016 03:40 PM, Jonathan Tan wrote: On 10/20/2016 03:14 PM, Junio C Hamano wrote: Stefan Beller <sbel...@google.com> writes: +static int find_separator(const char *line) +{ + const char *c; + for (c = line; ; c++) { + if (!*c || *c

Re: [PATCH v4 5/8] trailer: clarify failure modes in parse_trailer

2016-10-20 Thread Jonathan Tan
On 10/20/2016 03:14 PM, Junio C Hamano wrote: Stefan Beller writes: +static int find_separator(const char *line) +{ + const char *c; + for (c = line; ; c++) { + if (!*c || *c == '\n') + return -1; + if (*c ==

[PATCH v4 4/8] trailer: make args have their own struct

2016-10-20 Thread Jonathan Tan
"struct trailer_item" to be further differentiated from "struct arg_item" in future patches. Signed-off-by: Jonathan Tan <jonathanta...@google.com> --- trailer.c | 135 +++--- 1 file changed, 85 insertions(+), 50 deletion

[PATCH v4 3/8] trailer: streamline trailer item create and add

2016-10-20 Thread Jonathan Tan
Currently, creation and addition (to a list) of trailer items are spread across multiple functions. Streamline this by only having 2 functions: one to parse the user-supplied string, and one to add the parsed information to a list. Signed-off-by: Jonathan Tan <jonathanta...@google.

[PATCH v4 6/8] trailer: allow non-trailers in trailer block

2016-10-20 Thread Jonathan Tan
89f8808570e37fb90aa3 Signed-off-by: Jonathan Tan <jonathanta...@google.com> --- Documentation/git-interpret-trailers.txt | 5 +- t/t7513-interpret-trailers.sh| 115 +++ trailer.c| 89 3 fil

[PATCH v4 2/8] trailer: use list.h for doubly-linked list

2016-10-20 Thread Jonathan Tan
Replace the existing handwritten implementation of a doubly-linked list in trailer.c with the functions and macros from list.h. This significantly simplifies the code. Signed-off-by: Jonathan Tan <jonathanta...@google.com> Signed-off-by: Ramsay Jones <ram...@ramsayjones.plus.com> --

[PATCH v4 7/8] trailer: forbid leading whitespace in trailers

2016-10-20 Thread Jonathan Tan
Currently, interpret-trailers allows leading whitespace in trailer lines. This leads to false positives, especially for quoted lines or bullet lists. Forbid leading whitespace in trailers. Signed-off-by: Jonathan Tan <jonathanta...@google.com> --- Documentation/git-interpret-trailers.tx

[PATCH v4 8/8] trailer: support values folded to multiple lines

2016-10-20 Thread Jonathan Tan
. Signed-off-by: Jonathan Tan <jonathanta...@google.com> --- Documentation/git-interpret-trailers.txt | 7 +- t/t7513-interpret-trailers.sh| 169 +++ trailer.c| 43 ++-- 3 files changed, 210 insertions(+), 9 deletions(-)

[PATCH v4 5/8] trailer: clarify failure modes in parse_trailer

2016-10-20 Thread Jonathan Tan
from a file or from a command-line argument. Extract a function to find the separator, allowing the invokers of parse_trailer to determine how to handle the failure modes instead of making parse_trailer do it. Signed-off-by: Jonathan Tan <jonathanta...@google.com> --- trailer.

[PATCH v4 0/8] allow non-trailers and multiple-line trailers

2016-10-20 Thread Jonathan Tan
e existing behavior of ignoring comments, since the number of trailers and non-trailers in the trailer block now matters more new->7/8: - new patch 6/6->8/8: - updated trailer block recognizing code, since the continuation lines must not be counted if they follow a trai

[PATCH v4 1/8] trailer: improve const correctness

2016-10-20 Thread Jonathan Tan
Change "const char *" to "char *" in struct trailer_item and in the return value of apply_command (since those strings are owned strings). Change "struct conf_info *" to "const struct conf_info *" (since that struct is not modified). Signed-off-by

Re: [PATCH v3 5/6] trailer: allow non-trailers in trailer block

2016-10-19 Thread Jonathan Tan
On 10/18/2016 09:36 AM, Junio C Hamano wrote: Jonathan Tan <jonathanta...@google.com> writes: * rs/c-auto-resets-attributes: pretty: avoid adding reset for %C(auto) if output is empty And neither of the two colon containing line remotely resembles how a typical RFC-822

Re: [PATCH v3 5/6] trailer: allow non-trailers in trailer block

2016-10-17 Thread Jonathan Tan
On 10/17/2016 06:42 PM, Junio C Hamano wrote: Stefan Beller <sbel...@google.com> writes: On Fri, Oct 14, 2016 at 10:38 AM, Jonathan Tan <jonathanta...@google.com> wrote: Existing trailers are extracted from the input message by looking for -a group of one or more lines that con

[PATCH v3 6/6] trailer: support values folded to multiple lines

2016-10-14 Thread Jonathan Tan
. Signed-off-by: Jonathan Tan <jonathanta...@google.com> --- Documentation/git-interpret-trailers.txt | 7 +- t/t7513-interpret-trailers.sh| 139 +++ trailer.c| 22 +++-- 3 files changed, 160 insertions(+), 8 del

[PATCH v3 5/6] trailer: allow non-trailers in trailer block

2016-10-14 Thread Jonathan Tan
/stable/linux-stable/+/e7d316a02f683864a12389f8808570e37fb90aa3 Signed-off-by: Jonathan Tan <jonathanta...@google.com> --- Documentation/git-interpret-trailers.txt | 3 +- t/t7513-interpret-trailers.sh| 35 +++ trailer.c| 77 +++

[PATCH v3 4/6] trailer: make args have their own struct

2016-10-14 Thread Jonathan Tan
"struct trailer_item" to be further differentiated from "struct arg_item" in future patches. Signed-off-by: Jonathan Tan <jonathanta...@google.com> --- trailer.c | 135 +++--- 1 file changed, 85 insertions(+), 50 deletion

[PATCH v3 2/6] trailer: use list.h for doubly-linked list

2016-10-14 Thread Jonathan Tan
Replace the existing handwritten implementation of a doubly-linked list in trailer.c with the functions and macros from list.h. This significantly simplifies the code. Signed-off-by: Jonathan Tan <jonathanta...@google.com> --- trailer.c

[PATCH v3 3/6] trailer: streamline trailer item create and add

2016-10-14 Thread Jonathan Tan
Currently, creation and addition (to a list) of trailer items are spread across multiple functions. Streamline this by only having 2 functions: one to parse the user-supplied string, and one to add the parsed information to a list. Signed-off-by: Jonathan Tan <jonathanta...@google.

[PATCH v3 1/6] trailer: improve const correctness

2016-10-14 Thread Jonathan Tan
Change "const char *" to "char *" in struct trailer_item and in the return value of apply_command (since those strings are owned strings). Change "struct conf_info *" to "const struct conf_info *" (since that struct is not modified). Signed-off-by

[PATCH v3 0/6] allow non-trailers and multiple-line trailers

2016-10-14 Thread Jonathan Tan
Ah, I knew I forgot something. These are exactly the same as v2, except that these are signed off. Jonathan Tan (6): trailer: improve const correctness trailer: use list.h for doubly-linked list trailer: streamline trailer item create and add trailer: make args have their own struct

[PATCH v2 2/6] trailer: use list.h for doubly-linked list

2016-10-12 Thread Jonathan Tan
Replace the existing handwritten implementation of a doubly-linked list in trailer.c with the functions and macros from list.h. This significantly simplifies the code. --- trailer.c | 258 ++ 1 file changed, 91 insertions(+), 167

[PATCH v2 5/6] trailer: allow non-trailers in trailer block

2016-10-12 Thread Jonathan Tan
Currently, interpret-trailers requires all lines of a trailer block to be trailers (or comments) - if not it would not identify that block as a trailer block, and thus create its own trailer block, inserting a blank line. For example: echo -e "\na: b\nnot trailer" | git interpret-trailers

[PATCH v2 4/6] trailer: make args have their own struct

2016-10-12 Thread Jonathan Tan
Improve type safety by making arguments (whether from configuration or from the command line) have their own "struct arg_item" type, separate from the "struct trailer_item" type used to represent the trailers in the buffer being manipulated. This change also prepares "struct trailer_item" to be

[PATCH v2 3/6] trailer: streamline trailer item create and add

2016-10-12 Thread Jonathan Tan
Currently, creation and addition (to a list) of trailer items are spread across multiple functions. Streamline this by only having 2 functions: one to parse the user-supplied string, and one to add the parsed information to a list. --- trailer.c | 130

[PATCH v2 6/6] trailer: support values folded to multiple lines

2016-10-12 Thread Jonathan Tan
Currently, interpret-trailers requires that a trailer be only on 1 line. For example: a: first line second line would be interpreted as one trailer line followed by one non-trailer line. Make interpret-trailers support RFC 822-style folding, treating those lines as one logical trailer.

[PATCH v2 1/6] trailer: improve const correctness

2016-10-12 Thread Jonathan Tan
Change "const char *" to "char *" in struct trailer_item and in the return value of apply_command (since those strings are owned strings). Change "struct conf_info *" to "const struct conf_info *" (since that struct is not modified). --- trailer.c | 14 +++--- 1 file changed, 7

[PATCH v2 0/6] allow non-trailers and multiple-line trailers

2016-10-12 Thread Jonathan Tan
;char *" instead of "struct strbuf" - Modified test slightly to test whitespace at beginning of line Jonathan Tan (6): trailer: improve const correctness trailer: use list.h for doubly-linked list trailer: streamline trailer item create and add trailer: make args have their ow

[PATCH 3/5] trailer: make args have their own struct

2016-10-11 Thread Jonathan Tan
Improve type safety by making arguments (whether from configuration or from the command line) have their own "struct arg_item" type, separate from the "struct trailer_item" type used to represent the trailers in the buffer being manipulated. Also take the opportunity to refine the "struct

[PATCH 2/5] trailer: streamline trailer item create and add

2016-10-11 Thread Jonathan Tan
Currently, creation and addition (to a list) of trailer items are spread across multiple functions. Streamline this by only having 2 functions: one to parse the user-supplied string, and one to add the parsed information to a list. --- trailer.c | 135

<    5   6   7   8   9   10   11   >