[PATCH v5 2/2] cleanup duplicate name_compare() functions

2014-06-19 Thread Jeremiah Mahler
implementations of these two functions return values returned by memcmp(3) when the one string is not a prefix of the other string, and the only thing memcmp(3) guarantees its callers is the sign of the returned value, not the magnitude. Signed-off-by: Jeremiah Mahler --- cache.h| 2

[PATCH v5 0/2] cleanup duplicate name_compare() functions

2014-06-19 Thread Jeremiah Mahler
(). This avoids renaming cache_name_compare() to name_compare() in a later patch. - Cleanup of log message by Junio C Humano. Jeremiah Mahler (2): name-hash.c: replace cache_name_compare() with memcmp() cleanup duplicate name_compare() functions cache.h| 2 +- dir.c | 3

[PATCH v5 1/2] name-hash.c: replace cache_name_compare() with memcmp()

2014-06-19 Thread Jeremiah Mahler
When cache_name_compare() is used on counted strings of the same length, it is equivalent to a memcmp(). Since the one use of cache_name_compare() in name-hash.c requires that the lengths are equal, just replace it with memcmp(). Signed-off-by: Jeremiah Mahler --- name-hash.c | 2 +- 1 file

Re: [PATCH v4] cleanup duplicate name_compare() functions

2014-06-19 Thread Jeremiah Mahler
ring is not a prefix of the > other string, and the only thing memcmp(3) guarantees its callers is > the sign of the returned value, not the magnitude. > > or something like that, perhaps? Yes, that looks good. It is a bit clearer than my message. I like how you used "th

Re: [PATCH v4] cleanup duplicate name_compare() functions

2014-06-19 Thread Jeremiah Mahler
Junio, On Thu, Jun 19, 2014 at 11:03:03AM -0700, Junio C Hamano wrote: > Jeremiah Mahler writes: > > > Both unpack-trees.c and read-cache.c have their own name_compare() > > function, which are identical. And read-cache.c has a > > cache_name_compare() function whic

[PATCH v4] cleanup duplicate name_compare() functions

2014-06-19 Thread Jeremiah Mahler
new name, name_compare(), makes it clear that no cache is involved. Signed-off-by: Jeremiah Mahler --- cache.h| 2 +- dir.c | 3 +-- name-hash.c| 2 +- read-cache.c | 23 +-- tree-walk.c| 10 -- unpack-trees.c | 11 --- 6 files

[PATCH v4] cleanup duplicate name_compare() functions

2014-06-19 Thread Jeremiah Mahler
]. [1]: http://marc.info/?l=git&m=140311885416615&w=2 Jeremiah Mahler (1): cleanup duplicate name_compare() functions cache.h| 2 +- dir.c | 3 +-- name-hash.c| 2 +- read-cache.c | 23 +-- tree-walk.c| 10 -- unpack-tree

Re: [PATCH v3 0/5] cleanup duplicate name_compare() functions

2014-06-19 Thread Jeremiah Mahler
Jonathan, On Wed, Jun 18, 2014 at 12:14:07PM -0700, Jonathan Nieder wrote: > Jeremiah Mahler wrote: > > > Jeremiah Mahler (5): > > cache: rename cache_name_compare() to name_compare() > > tree-walk.c: remove name_compare() function > > unpack-trees.c:

Re: [PATCH v3 2/5] tree-walk.c: remove name_compare() function

2014-06-19 Thread Jeremiah Mahler
Jonathan, On Wed, Jun 18, 2014 at 12:03:59PM -0700, Jonathan Nieder wrote: > Jeremiah Mahler wrote: > > > Remove the duplicate name_compare() function and use the one provided by > > read-cache.c. > > I'd squash this into patch 1/5. > > > --- > >

[PATCH v3 4/5] dir.c: rename to name_compare()

2014-06-18 Thread Jeremiah Mahler
Rename the call to cache_name_compare() to name_compare(). Signed-off-by: Jeremiah Mahler --- Notes: This is a case where cache_name_compare() was used even though it had nothing to do with a cache. The new name makes it clear that no cache is involved. dir.c | 3 +-- 1 file

[PATCH v3 3/5] unpack-trees.c: remove name_compare() function

2014-06-18 Thread Jeremiah Mahler
Remove the duplicate name_compare() function and use the one provided by read-cache.c. Signed-off-by: Jeremiah Mahler --- Notes: There is one small difference between the old function and the new one. The old one returned -N and +N whereas the new one returns -1 and +1. However

[PATCH v3 2/5] tree-walk.c: remove name_compare() function

2014-06-18 Thread Jeremiah Mahler
Remove the duplicate name_compare() function and use the one provided by read-cache.c. Signed-off-by: Jeremiah Mahler --- Notes: There is one small difference between the old function and the new one. The old one returned -N and +N whereas the new one returns -1 and +1. However

[PATCH v3 5/5] name-hash.c: rename to name_compare()

2014-06-18 Thread Jeremiah Mahler
Rename the call to cache_name_compare() to name_compare(). Signed-off-by: Jeremiah Mahler --- name-hash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/name-hash.c b/name-hash.c index be7c4ae..e2bea88 100644 --- a/name-hash.c +++ b/name-hash.c @@ -179,7 +179,7 @@ static

[PATCH v3 1/5] cache: rename cache_name_compare() to name_compare()

2014-06-18 Thread Jeremiah Mahler
The cache_name_compare() function is not specific to a cache. Make its name more general by renaming it to name_compare(). Simplify cache_name_stage_compare() via name_compare(). Where lengths are involved, change int to size_t. Signed-off-by: Jeremiah Mahler --- cache.h | 2 +- read

[PATCH v3 0/5] cleanup duplicate name_compare() functions

2014-06-18 Thread Jeremiah Mahler
http://marc.info/?l=git&m=140299051431479&w=2 [2]: http://marc.info/?l=git&m=140300329403706&w=2 Jeremiah Mahler (5): cache: rename cache_name_compare() to name_compare() tree-walk.c: remove name_compare() function unpack-trees.c: remove name_compare() function dir.c: rename t

Re: [PATCH v2 1/3] add strnncmp() function

2014-06-17 Thread Jeremiah Mahler
Junio, On Tue, Jun 17, 2014 at 10:55:18AM -0700, Junio C Hamano wrote: > Jeremiah Mahler writes: > > > Add a strnncmp() function which behaves like strncmp() except it takes > > the length of both strings instead of just one. It behaves the same as > > strncmp() up to t

Re: [PATCH v2 0/3] add strnncmp() function

2014-06-17 Thread Jeremiah Mahler
Jonathan, On Tue, Jun 17, 2014 at 10:48:17AM -0700, Jonathan Nieder wrote: > >> On 2014-06-17 09.34, Jeremiah Mahler wrote: > > >>> Also, strnncmp() was switched from using memcmp() to strncmp() > >>> internally to make it clear that this is meant for strings,

Re: [PATCH v2 0/3] add strnncmp() function

2014-06-17 Thread Jeremiah Mahler
Torsten, On Tue, Jun 17, 2014 at 01:08:05PM +0200, Torsten Bögershausen wrote: > On 2014-06-17 09.34, Jeremiah Mahler wrote: > > Add a strnncmp() function which behaves like strncmp() except it takes > > the length of both strings instead of just one. > > > > Then simp

Re: [PATCH v2 1/3] add strnncmp() function

2014-06-17 Thread Jeremiah Mahler
Erik, On Tue, Jun 17, 2014 at 11:09:59AM +0200, Erik Faye-Lund wrote: > On Tue, Jun 17, 2014 at 9:34 AM, Jeremiah Mahler wrote: > > Add a strnncmp() function which behaves like strncmp() except it takes > > the length of both strings instead of just one. It behaves the same as &

Re: [PATCH v2 1/3] add strnncmp() function

2014-06-17 Thread Jeremiah Mahler
Torsten, On Tue, Jun 17, 2014 at 10:23:14AM +0200, Torsten Bögershausen wrote: > On 2014-06-17 09.34, Jeremiah Mahler wrote: > > Add a strnncmp() function which behaves like strncmp() except it takes > > the length of both strings instead of just one. It behaves the same as >

[PATCH v2 1/3] add strnncmp() function

2014-06-17 Thread Jeremiah Mahler
returned. Signed-off-by: Jeremiah Mahler --- strbuf.c | 9 + strbuf.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a/strbuf.c b/strbuf.c index ac62982..4eb7954 100644 --- a/strbuf.c +++ b/strbuf.c @@ -600,3 +600,12 @@ char *xstrdup_tolower(const char *string) result[i

[PATCH v2 3/3] unpack-trees: simplify via strnncmp()

2014-06-17 Thread Jeremiah Mahler
Simplify unpack-trees.c using the strnncmp() function and remove the name_compare() function. Signed-off-by: Jeremiah Mahler --- unpack-trees.c | 13 + 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/unpack-trees.c b/unpack-trees.c index 4a9cdf2..9a71b5a 100644 --- a

[PATCH v2 2/3] tree-walk: simplify via strnncmp()

2014-06-17 Thread Jeremiah Mahler
Simplify tree-walk.c using the strnncmp() function and remove the name_compare() function. Signed-off-by: Jeremiah Mahler --- tree-walk.c | 16 +++- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/tree-walk.c b/tree-walk.c index 4dc86c7..efbd3b7 100644 --- a/tree

[PATCH v2 0/3] add strnncmp() function

2014-06-17 Thread Jeremiah Mahler
() to strncmp() internally to make it clear that this is meant for strings, not general buffers. [1]: http://marc.info/?l=git&m=140294981320743&w=2 Jeremiah Mahler (3): add strnncmp() function tree-walk: simplify via strnncmp() unpack-trees: simplify via strnncmp() strbuf.c

Re: [PATCH 2/3] tree-walk: simplify via strnncmp()

2014-06-17 Thread Jeremiah Mahler
Jonathan, On Mon, Jun 16, 2014 at 01:18:06PM -0700, Jonathan Nieder wrote: > Jeremiah Mahler wrote: > > > --- a/tree-walk.c > > +++ b/tree-walk.c > [...] > > @@ -174,7 +164,7 @@ static int check_entry_match(const char *a, int a_len, > > const char *b, int b

[PATCH 2/3] tree-walk: simplify via strnncmp()

2014-06-16 Thread Jeremiah Mahler
Simplify tree-walk.c using the strnncmp() function and remove the name_compare() function. Signed-off-by: Jeremiah Mahler --- tree-walk.c | 16 +++- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/tree-walk.c b/tree-walk.c index 4dc86c7..efbd3b7 100644 --- a/tree

[PATCH 1/3] add strnncmp() function

2014-06-16 Thread Jeremiah Mahler
Add a strnncmp() function which behaves like strncmp() except it uses the length of both strings instead of just one. Signed-off-by: Jeremiah Mahler --- strbuf.c | 6 ++ strbuf.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/strbuf.c b/strbuf.c index ac62982..bd486c3 100644 --- a

[PATCH 3/3] unpack-trees: simplify via strnncmp()

2014-06-16 Thread Jeremiah Mahler
Simplify unpack-trees.c using the strnncmp() function and remove the name_compare() function. Signed-off-by: Jeremiah Mahler --- unpack-trees.c | 13 + 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/unpack-trees.c b/unpack-trees.c index 4a9cdf2..9a71b5a 100644 --- a

[PATCH 0/3] add strnncmp() function

2014-06-16 Thread Jeremiah Mahler
identical copies of. Jeremiah Mahler (3): add strnncmp() function tree-walk: simplify via strnncmp() unpack-trees: simplify via strnncmp() strbuf.c | 6 ++ strbuf.h | 2 ++ tree-walk.c| 16 +++- unpack-trees.c | 13 + 4 files changed, 12 insertions

Re: [PATCH v3 1/2] add strbuf_set operations

2014-06-13 Thread Jeremiah Mahler
Peff, On Fri, Jun 13, 2014 at 03:15:50AM -0400, Jeff King wrote: > On Thu, Jun 12, 2014 at 04:46:37PM -0700, Jeremiah Mahler wrote: > > > > Although strbuf_set() does make the code a bit easier to read > > > when strbufs are repeatedly re-used, re-using a variable

Re: [PATCH v5 0/4] commit: Add commit.verbose configuration

2014-06-13 Thread Jeremiah Mahler
On Fri, Jun 13, 2014 at 11:49:10AM -0500, Caleb Thompson wrote: > On Thu, Jun 12, 2014 at 01:30:10PM -0700, Jeremiah Mahler wrote: > > On Thu, Jun 12, 2014 at 02:38:58PM -0500, Caleb Thompson wrote: > > > This patch allows people to set commit.verbose to implicitly send >

Re: [PATCH v2 01/19] add strbuf_set operations

2014-06-12 Thread Jeremiah Mahler
Michael, On Thu, Jun 12, 2014 at 12:21:48PM +0200, Michael Haggerty wrote: > On 06/12/2014 09:10 AM, Jeremiah Mahler wrote: > > On Wed, Jun 11, 2014 at 02:05:35PM +0200, Michael Haggerty wrote: > >> [...] > >> If there were a function like strbuf_grow_to(sb, len): &g

Re: [PATCH v3 1/2] add strbuf_set operations

2014-06-12 Thread Jeremiah Mahler
Eric, On Thu, Jun 12, 2014 at 05:48:52PM -0400, Eric Sunshine wrote: > On Thu, Jun 12, 2014 at 3:31 PM, Jeremiah Mahler wrote: > > On Thu, Jun 12, 2014 at 11:50:41AM -0700, Junio C Hamano wrote: > >> I am on the fence. > >> > >> I have this suspicion that the

Re: [PATCH v3 1/2] add strbuf_set operations

2014-06-12 Thread Jeremiah Mahler
On Thu, Jun 12, 2014 at 05:18:29PM -0400, Eric Sunshine wrote: > On Thu, Jun 12, 2014 at 3:36 PM, Jeremiah Mahler wrote: > > On Thu, Jun 12, 2014 at 11:51:19AM -0700, Junio C Hamano wrote: > >> Jeremiah Mahler writes: > >> > >> > Thomas, > >> &

Re: [PATCH v5 0/4] commit: Add commit.verbose configuration

2014-06-12 Thread Jeremiah Mahler
On Thu, Jun 12, 2014 at 02:38:58PM -0500, Caleb Thompson wrote: > This patch allows people to set commit.verbose to implicitly send > --verbose to git-commit. > > This version incorporates changes suggested by Eric Sunshine, Duy > Nguyen, and Jeremiah Mahler. > > It intro

Re: [PATCH v3 1/2] add strbuf_set operations

2014-06-12 Thread Jeremiah Mahler
Junio, On Thu, Jun 12, 2014 at 11:51:19AM -0700, Junio C Hamano wrote: > Jeremiah Mahler writes: > > > Thomas, > > > > On Thu, Jun 12, 2014 at 10:11:36AM +0200, Thomas Braun wrote: > >> Am 12.06.2014 09:29, schrieb Jeremiah Mahler: > >> > A common us

Re: [PATCH v3 1/2] add strbuf_set operations

2014-06-12 Thread Jeremiah Mahler
Junio, Comments below... On Thu, Jun 12, 2014 at 11:50:41AM -0700, Junio C Hamano wrote: > Jeremiah Mahler writes: > > > A common use case with strubfs is to set the buffer to a new value. > > This must be done in two steps: a reset followed by an add. > >

Re: [PATCH v4 1/4] commit test: Use test_config instead of git-config

2014-06-12 Thread Jeremiah Mahler
Caleb, On Thu, Jun 12, 2014 at 01:23:41PM -0500, Caleb Thompson wrote: > Jeremiah, > > On Thu, Jun 12, 2014 at 11:04:59AM -0700, Jeremiah Mahler wrote: > > ... > > > > How are you preparing your patches. 'git format-patch' with a 'git > > send-

Re: [PATCH v4 1/4] commit test: Use test_config instead of git-config

2014-06-12 Thread Jeremiah Mahler
On Thu, Jun 12, 2014 at 11:04:59AM -0700, Jeremiah Mahler wrote: > Caleb, > ... > > Thanks for checking. Unfortunately the problem persists for me. > > It seems to be related to there not being a space at the left most part > of the patch. It is just a tab with no spac

Re: [PATCH v4 1/4] commit test: Use test_config instead of git-config

2014-06-12 Thread Jeremiah Mahler
gt; > On Thu, Jun 12, 2014 at 01:41:52AM -0700, Jeremiah Mahler wrote: > > On Wed, Jun 11, 2014 at 01:24:36PM -0500, ca...@calebthompson.io wrote: > > > Some of the tests in t/t7507-commit-verbose.sh were still using > > > git-config to set configuration. Change them

Re: [PATCH v4 1/4] commit test: Use test_config instead of git-config

2014-06-12 Thread Jeremiah Mahler
of git-config The copy of the patch that failed is found in: /home/jeri/git/.git/rebase-apply/patch When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop p

Re: [PATCH v3 1/2] add strbuf_set operations

2014-06-12 Thread Jeremiah Mahler
Thomas, On Thu, Jun 12, 2014 at 10:11:36AM +0200, Thomas Braun wrote: > Am 12.06.2014 09:29, schrieb Jeremiah Mahler: > > A common use case with strubfs is to set the buffer to a new value. > > This must be done in two steps: a reset followed by an add. > > &

[PATCH v3 2/2] builtin/remote: improve readability via strbuf_set()

2014-06-12 Thread Jeremiah Mahler
builtin/remote.c has many cases where a strbuf was being set to a new value. Improve its readability by using strbuf_set() operations instead of reset + add. Signed-off-by: Jeremiah Mahler --- builtin/remote.c | 63 +--- 1 file changed, 23

[PATCH v3 1/2] add strbuf_set operations

2014-06-12 Thread Jeremiah Mahler
) { strbuf_set(buf, data3, len3); } Signed-off-by: Jeremiah Mahler --- Documentation/technical/api-strbuf.txt | 18 ++ strbuf.c | 21 + strbuf.h | 13 + 3 files changed, 52 insertions

[PATCH v3 0/2] add strbuf_set operations

2014-06-12 Thread Jeremiah Mahler
on as suggested by Michael Haggerty [2] has been left for a later patch. [1]: http://marc.info/?l=git&m=140247618416057&w=2 [2]: http://marc.info/?l=git&m=140248834420244&w=2 Jeremiah Mahler (2): add strbuf_set operations builtin/remote: improve readability via strbuf_

Re: [PATCH v2 01/19] add strbuf_set operations

2014-06-12 Thread Jeremiah Mahler
Michael, On Wed, Jun 11, 2014 at 02:05:35PM +0200, Michael Haggerty wrote: > On 06/10/2014 12:19 AM, Jeremiah Mahler wrote: > > Currently, the data in a strbuf is modified using add operations. To > > set the buffer to some data a reset must be performed before an add. > >

Re: [PATCH v2 01/19] add strbuf_set operations

2014-06-12 Thread Jeremiah Mahler
On Wed, Jun 11, 2014 at 04:42:56AM -0400, Eric Sunshine wrote: > On Mon, Jun 9, 2014 at 6:19 PM, Jeremiah Mahler wrote: > > Currently, the data in a strbuf is modified using add operations. To > > set the buffer to some data a reset must be performed before an add. > > &

Re: [PATCH v2 00/19] add strbuf_set operations

2014-06-12 Thread Jeremiah Mahler
Eric, On Wed, Jun 11, 2014 at 04:09:17AM -0400, Eric Sunshine wrote: > On Mon, Jun 9, 2014 at 6:19 PM, Jeremiah Mahler wrote: > > Version 2 of the patch set to add strbuf_set operations. > > > > Includes suggestions from Eric Sunshine [1]: > > > > [...snip...] &g

Re: [PATCH 10/15] imap-send.c: rearrange xcalloc arguments

2014-06-10 Thread Jeremiah Mahler
(sizeof(*imap), 1); Why wasn't the second instance swapped? It is still this way in the latest 'pu' branch. -- Jeremiah Mahler jmmah...@gmail.com http://github.com/jmahler -- To unsubscribe from this list: send the line "unsubsc

[PATCH v2 19/19] wt-status: simplify via strbuf_set()

2014-06-09 Thread Jeremiah Mahler
Simplify cases where a strbuf_reset is immediately followed by a strbuf_add by using strbuf_set operations. Signed-off-by: Jeremiah Mahler --- wt-status.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/wt-status.c b/wt-status.c index 318a191..a89cd73 100644 --- a/wt

[PATCH v2 14/19] ident: simplify via strbuf_set()

2014-06-09 Thread Jeremiah Mahler
Simplify cases where a strbuf_reset is immediately followed by a strbuf_add by using strbuf_set operations. Signed-off-by: Jeremiah Mahler --- ident.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ident.c b/ident.c index 1d9b6e7..523e249 100644 --- a/ident.c +++ b

[PATCH v2 16/19] submodule: simplify via strbuf_set()

2014-06-09 Thread Jeremiah Mahler
Simplify cases where a strbuf_reset is immediately followed by a strbuf_add by using strbuf_set operations. Signed-off-by: Jeremiah Mahler --- submodule.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/submodule.c b/submodule.c index 3402af6..878cc48 100644 --- a

[PATCH v2 18/19] vcs-svn/svndump: simplify via strbuf_set()

2014-06-09 Thread Jeremiah Mahler
Simplify cases where a strbuf_reset is immediately followed by a strbuf_add by using strbuf_set operations. Signed-off-by: Jeremiah Mahler --- vcs-svn/svndump.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/vcs-svn/svndump.c b/vcs-svn/svndump.c index 31d1d83..7fbf5d8

[PATCH v2 15/19] remote-curl: simplify via strbuf_set()

2014-06-09 Thread Jeremiah Mahler
Simplify cases where a strbuf_reset is immediately followed by a strbuf_add by using strbuf_set operations. Signed-off-by: Jeremiah Mahler --- remote-curl.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/remote-curl.c b/remote-curl.c index 4493b38..49d27f5 100644 --- a

[PATCH v2 17/19] transport: simplify via strbuf_set()

2014-06-09 Thread Jeremiah Mahler
Simplify cases where a strbuf_reset is immediately followed by a strbuf_add by using strbuf_set operations. Signed-off-by: Jeremiah Mahler --- transport.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/transport.c b/transport.c index 172b3d8..e8f5dfa 100644 --- a

[PATCH v2 11/19] diffcore-order: simplify via strbuf_set()

2014-06-09 Thread Jeremiah Mahler
Simplify cases where a strbuf_reset is immediately followed by a strbuf_add by using strbuf_set operations. Signed-off-by: Jeremiah Mahler --- diffcore-order.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/diffcore-order.c b/diffcore-order.c index 97dd3d0..5a93971 100644

[PATCH v2 13/19] http: simplify via strbuf_set()

2014-06-09 Thread Jeremiah Mahler
Simplify cases where a strbuf_reset is immediately followed by a strbuf_add by using strbuf_set operations. Signed-off-by: Jeremiah Mahler --- http.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/http.c b/http.c index 2b4f6a3..626fed7 100644 --- a/http.c +++ b/http.c

[PATCH v2 08/19] builtin/mailinfo: simplify via strbuf_set()

2014-06-09 Thread Jeremiah Mahler
Simplify cases where a strbuf_reset is immediately followed by a strbuf_add by using strbuf_set operations. Signed-off-by: Jeremiah Mahler --- builtin/mailinfo.c | 18 ++ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/builtin/mailinfo.c b/builtin/mailinfo.c index

[PATCH v2 09/19] builtin/tag: simplify via strbuf_set()

2014-06-09 Thread Jeremiah Mahler
Simplify cases where a strbuf_reset is immediately followed by a strbuf_add by using strbuf_set operations. Signed-off-by: Jeremiah Mahler --- builtin/tag.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/builtin/tag.c b/builtin/tag.c index c6e8a71..b545c21 100644 --- a

[PATCH v2 10/19] date: simplify via strbuf_set()

2014-06-09 Thread Jeremiah Mahler
Simplify cases where a strbuf_reset is immediately followed by a strbuf_add by using strbuf_set operations. Signed-off-by: Jeremiah Mahler --- date.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/date.c b/date.c index 782de95..0b723a4 100644 --- a/date.c +++ b/date.c

[PATCH v2 12/19] http-backend: simplify via strbuf_set()

2014-06-09 Thread Jeremiah Mahler
Simplify cases where a strbuf_reset is immediately followed by a strbuf_add by using strbuf_set operations. Signed-off-by: Jeremiah Mahler --- http-backend.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/http-backend.c b/http-backend.c index d2c0a62..25c7435 100644

[PATCH v2 03/19] fast-import: simplify via strbuf_set()

2014-06-09 Thread Jeremiah Mahler
Simplify cases where a strbuf_reset is immediately followed by a strbuf_add by using strbuf_set operations. Signed-off-by: Jeremiah Mahler --- fast-import.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fast-import.c b/fast-import.c index e8ec34d..cfe9404 100644

[PATCH v2 04/19] builtin/remote: simplify via strbuf_set()

2014-06-09 Thread Jeremiah Mahler
Simplify cases where a strbuf_reset is immediately followed by a strbuf_add by using strbuf_set operations. Signed-off-by: Jeremiah Mahler --- builtin/remote.c | 59 1 file changed, 21 insertions(+), 38 deletions(-) diff --git a/builtin

[PATCH v2 01/19] add strbuf_set operations

2014-06-09 Thread Jeremiah Mahler
ations which allow this common sequence to be performed in one line instead of two. strbuf_set(buf, cb.buf.buf, cb.buf.len); Signed-off-by: Jeremiah Mahler --- Documentation/technical/api-strbuf.txt | 18 ++ strbuf.c | 21 +

[PATCH v2 07/19] builtin/checkout: simplify via strbuf_set()

2014-06-09 Thread Jeremiah Mahler
Simplify cases where a strbuf_reset is immediately followed by a strbuf_add by using strbuf_set operations. Signed-off-by: Jeremiah Mahler --- builtin/checkout.c | 18 ++ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/builtin/checkout.c b/builtin/checkout.c index

[PATCH v2 05/19] branch: simplify via strbuf_set()

2014-06-09 Thread Jeremiah Mahler
Simplify cases where a strbuf_reset is immediately followed by a strbuf_add by using strbuf_set operations. Signed-off-by: Jeremiah Mahler --- branch.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/branch.c b/branch.c index 660097b..bc7cc7e 100644 --- a/branch.c

[PATCH v2 06/19] builtin/branch: simplify via strbuf_set()

2014-06-09 Thread Jeremiah Mahler
Simplify cases where a strbuf_reset is immediately followed by a strbuf_add by using strbuf_set operations. Signed-off-by: Jeremiah Mahler --- builtin/branch.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/builtin/branch.c b/builtin/branch.c index 2d1c57c..ad641b6 100644

[PATCH v2 02/19] sha1_name: simplify via strbuf_set()

2014-06-09 Thread Jeremiah Mahler
Simplify cases where a strbuf_reset is immediately followed by a strbuf_add by using strbuf_set operations. Signed-off-by: Jeremiah Mahler --- sha1_name.c | 15 +-- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/sha1_name.c b/sha1_name.c index 2b6322f..f88b66c 100644

[PATCH v2 00/19] add strbuf_set operations

2014-06-09 Thread Jeremiah Mahler
amp;mybuf, ...); /* Replace everything. */ Several single line replacements were made for this reason. Additional files have also been converted compared to version 1 [1]. [1]: http://marc.info/?l=git&m=140230874124060&w=2 Jeremiah Mahler (19): add strbuf_set operations sha1_name: sim

Re: [PATCH/RFC v1 0/5] add strbuf_set operations

2014-06-09 Thread Jeremiah Mahler
Duy, On Mon, Jun 09, 2014 at 05:39:12PM +0700, Duy Nguyen wrote: > On Mon, Jun 9, 2014 at 3:36 PM, Jeremiah Mahler wrote: > > Currently, the data in a strbuf is modified using add operations. To > > set the buffer to some data a reset must be performed before an add. > > &

Re: [PATCH/RFC v1 4/5] fast-import.c: cleanup using strbuf_set operations

2014-06-09 Thread Jeremiah Mahler
Eric, On Mon, Jun 09, 2014 at 06:12:12AM -0400, Eric Sunshine wrote: > On Mon, Jun 9, 2014 at 4:36 AM, Jeremiah Mahler wrote: > > Subject: fast-import.c: cleanup using strbuf_set operations > ... > > > Signed-off-by: Jeremiah Mahler > > --- > > fast-import.

Re: [PATCH/RFC v1 2/5] add strbuf_set operations documentation

2014-06-09 Thread Jeremiah Mahler
Eric, On Mon, Jun 09, 2014 at 05:53:49AM -0400, Eric Sunshine wrote: > On Mon, Jun 9, 2014 at 4:36 AM, Jeremiah Mahler wrote: > > Add documentation of the strbuf_set operations to > > technical/api-strbuf.txt. > > Since this patch is concise and so closely related to pat

[PATCH/RFC v1 3/5] sha1_name.c: cleanup using strbuf_set operations

2014-06-09 Thread Jeremiah Mahler
Simplified cases where a strbuf_reset was immediately followed by a strbuf_add using the new strbuf_set operations. Signed-off-by: Jeremiah Mahler --- sha1_name.c | 15 +-- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/sha1_name.c b/sha1_name.c index 2b6322f

[PATCH/RFC v1 5/5] builtin/remote.c: cleanup using strbuf_set operations

2014-06-09 Thread Jeremiah Mahler
Simplified cases where a strbuf_reset was immediately followed by a strbuf_add using the new strbuf_set operations. Signed-off-by: Jeremiah Mahler --- builtin/remote.c | 51 +-- 1 file changed, 17 insertions(+), 34 deletions(-) diff --git a

[PATCH/RFC v1 2/5] add strbuf_set operations documentation

2014-06-09 Thread Jeremiah Mahler
Add documentation of the strbuf_set operations to technical/api-strbuf.txt. Signed-off-by: Jeremiah Mahler --- Documentation/technical/api-strbuf.txt | 18 ++ 1 file changed, 18 insertions(+) diff --git a/Documentation/technical/api-strbuf.txt b/Documentation/technical/api

[PATCH/RFC v1 0/5] add strbuf_set operations

2014-06-09 Thread Jeremiah Mahler
buf_set operations which allow this common sequence to be performed in one line instead of two. strbuf_set(buf, cb.buf.buf, cb.buf.len); Only the first few files have been converted in this preliminary patch set. Jeremiah Mahler (5): add strbuf_set operations add strbuf_set operatio

[PATCH/RFC v1 4/5] fast-import.c: cleanup using strbuf_set operations

2014-06-09 Thread Jeremiah Mahler
Simplified cases where a strbuf_reset was immediately followed by a strbuf_add using the new strbuf_set operations. Signed-off-by: Jeremiah Mahler --- fast-import.c | 19 ++- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/fast-import.c b/fast-import.c index

[PATCH/RFC v1 1/5] add strbuf_set operations

2014-06-09 Thread Jeremiah Mahler
ations which allow this common sequence to be performed in one line instead of two. strbuf_set(buf, cb.buf.buf, cb.buf.len); Signed-off-by: Jeremiah Mahler --- strbuf.c | 21 + strbuf.h | 14 ++ 2 files changed, 35 insertions(+) diff --git a/strbuf.c b/strbuf.c index

[PATCH] api-strbuf.txt minor typos

2014-06-08 Thread Jeremiah Mahler
Fixed some minor typos in api-strbuf.txt: 'A' instead of 'An', 'have' instead of 'has', a overlong line, and 'another' instead of 'an other'. Signed-off-by: Jeremiah Mahler --- Documentation/technical/api-strbuf.txt | 10 +- 1

[PATCH] t/t7810-grep.sh: remove duplicate test_config()

2014-06-04 Thread Jeremiah Mahler
t/t7810-grep.sh had its own test_config() function which served the same purpose as the one in t/test-lib-functions.sh. Removed, all tests pass. Signed-off-by: Jeremiah Mahler --- t/t7810-grep.sh | 5 - 1 file changed, 5 deletions(-) diff --git a/t/t7810-grep.sh b/t/t7810-grep.sh index

Re: [PATCH v3 0/9] replace signal() with sigaction()

2014-06-02 Thread Jeremiah Mahler
On Mon, Jun 02, 2014 at 12:05:29PM -0700, Junio C Hamano wrote: > Johannes Sixt writes: > > >> Jeremiah Mahler (9): > >> compat/mingw.c: expand MinGW support for sigaction > >> connect.c: replace signal() with sigaction() > >> p

Re: [PATCH v3 0/9] replace signal() with sigaction()

2014-06-02 Thread Jeremiah Mahler
Hannes, On Mon, Jun 02, 2014 at 01:28:25PM +0200, Johannes Sixt wrote: > Am 6/1/2014 20:10, schrieb Jeremiah Mahler: > > This is version 3 of the patch set to convert signal(2) to sigaction(2) > > (previous discussion [1]). > > ... > > sigchain.c: replace signal(

[PATCH v3 7/9] builtin/merge-index.c: replace signal() with sigaction()

2014-06-01 Thread Jeremiah Mahler
>From the signal(2) man page: The behavior of signal() varies across UNIX versions, and has also var‐ ied historically across different versions of Linux. Avoid its use: use sigaction(2) instead. Replaced signal() with sigaction() in builtin/merge-index.c Signed-off-by: Jerem

[PATCH v3 8/9] builtin/verify-tag.c: replace signal() with sigaction()

2014-06-01 Thread Jeremiah Mahler
>From the signal(2) man page: The behavior of signal() varies across UNIX versions, and has also var‐ ied historically across different versions of Linux. Avoid its use: use sigaction(2) instead. Replaced signal() with sigaction() in builtin/verify-tag.c Signed-off-by: Jeremiah Mah

[PATCH v3 5/9] daemon.c: replace signal() with sigaction()

2014-06-01 Thread Jeremiah Mahler
>From the signal(2) man page: The behavior of signal() varies across UNIX versions, and has also var‐ ied historically across different versions of Linux. Avoid its use: use sigaction(2) instead. Replaced signal() with sigaction() in daemon.c Signed-off-by: Jeremiah Mah

[PATCH v3 6/9] builtin/log.c: replace signal() with sigaction()

2014-06-01 Thread Jeremiah Mahler
>From the signal(2) man page: The behavior of signal() varies across UNIX versions, and has also var‐ ied historically across different versions of Linux. Avoid its use: use sigaction(2) instead. Replaced signal() with sigaction() in builtin/log.c Signed-off-by: Jeremiah Mah

[PATCH v3 9/9] sigchain.c: replace signal() with sigaction()

2014-06-01 Thread Jeremiah Mahler
>From the signal(2) man page: The behavior of signal() varies across UNIX versions, and has also var‐ ied historically across different versions of Linux. Avoid its use: use sigaction(2) instead. Replaced signal() with sigaction() in sigchain.c Signed-off-by: Jeremiah Mah

[PATCH v3 0/9] replace signal() with sigaction()

2014-06-01 Thread Jeremiah Mahler
which would be SIG_ERR if an error occurred. sigaction() just returns -1 in this case. Jeremiah Mahler (9): compat/mingw.c: expand MinGW support for sigaction connect.c: replace signal() with sigaction() progress.c: replace signal() with sigaction() write_or_die.c: replace s

[PATCH v3 4/9] write_or_die.c: replace signal() with sigaction()

2014-06-01 Thread Jeremiah Mahler
>From the signal(2) man page: The behavior of signal() varies across UNIX versions, and has also var‐ ied historically across different versions of Linux. Avoid its use: use sigaction(2) instead. Replaced signal() with sigaction() in write_or_die.c Signed-off-by: Jeremiah Mah

[PATCH v3 3/9] progress.c: replace signal() with sigaction()

2014-06-01 Thread Jeremiah Mahler
>From the signal(2) man page: The behavior of signal() varies across UNIX versions, and has also var‐ ied historically across different versions of Linux. Avoid its use: use sigaction(2) instead. Replaced signal() with sigaction() in progress.c Signed-off-by: Jeremiah Mah

[PATCH v3 2/9] connect.c: replace signal() with sigaction()

2014-06-01 Thread Jeremiah Mahler
>From the signal(2) man page: The behavior of signal() varies across UNIX versions, and has also var‐ ied historically across different versions of Linux. Avoid its use: use sigaction(2) instead. Replaced signal() with sigaction() in connect.c Signed-off-by: Jeremiah Mah

[PATCH v3 1/9] compat/mingw.c: expand MinGW support for sigaction

2014-06-01 Thread Jeremiah Mahler
to use signal() in other cases. This patch expands the faux sigaction function so that it calls signal in cases other than SIGALRM. Now sigaction can be used across the entire Git project and MinGW will still work with signal as it did before. Signed-off-by: Jeremiah Mahler --- compat/mingw.c

Re: [PATCH v2 2/2] connect.c: replace signal() with sigaction()

2014-05-31 Thread Jeremiah Mahler
Chris, On Sat, May 31, 2014 at 10:39:39PM +1200, Chris Packham wrote: > On 31/05/14 08:58, Jeremiah Mahler wrote: > > From signal(2) man page: > > ... > > - signal(SIGCHLD, SIG_DFL); > > + memset(&sa, 0, sizeof(sa)); > > + sa.sa_handler = SIG_DFL; >

[PATCH v2 0/2] replace signal() with sigaction()

2014-05-30 Thread Jeremiah Mahler
SIGALRM. Now it works as expected. I have tested these changes under Linux and under Windows 7 using Msysgit. [1]: http://marc.info/?l=git&m=140125769223552&w=2 [2]: http://marc.info/?l=git&m=140126288325213&w=2 Jeremiah Mahler (2): compat/mingw.c: expand MinGW support for sigac

[PATCH v2 1/2] compat/mingw.c: expand MinGW support for sigaction

2014-05-30 Thread Jeremiah Mahler
to use signal() in other cases. This patch expands the faux sigaction function so that it calls signal in cases other than SIGALRM. Now sigaction can be used across the entire Git project and MinGW will still work with signal as it did before. Signed-off-by: Jeremiah Mahler --- compat/mingw.c

[PATCH v2 2/2] connect.c: replace signal() with sigaction()

2014-05-30 Thread Jeremiah Mahler
>From signal(2) man page: The behavior of signal() varies across UNIX versions, and has also var‐ ied historically across different versions of Linux. Avoid its use: use sigaction(2) instead. Replaced signal() with sigaction() in connect.c Signed-off-by: Jeremiah Mah

Re: [PATCH 0/5] replace signal() with sigaction()

2014-05-28 Thread Jeremiah Mahler
On Wed, May 28, 2014 at 09:40:55AM +0200, Johannes Sixt wrote: > Am 5/28/2014 8:14, schrieb Jeremiah Mahler: > > From signal(2) > > > > The behavior of signal() varies across UNIX versions, and has also var‐ > > ied historically across different versions of Linux.

Re: [PATCH 1/5] progress.c: replace signal() with sigaction()

2014-05-28 Thread Jeremiah Mahler
On Wed, May 28, 2014 at 08:07:38PM +1200, Chris Packham wrote: > On 28/05/14 18:14, Jeremiah Mahler wrote: > > From signal(2) > > > > The behavior of signal() varies across UNIX versions, and has also var‐ > > ied historically across different versions of Linux.

[PATCH 5/5] connect.c: replace signal() with sigaction()

2014-05-27 Thread Jeremiah Mahler
>From signal(2) The behavior of signal() varies across UNIX versions, and has also var‐ ied historically across different versions of Linux. Avoid its use: use sigaction(2) instead. See Portability below. Replaced signal() with sigaction() in connect.c Signed-off-by: Jeremiah Mah

[PATCH 1/5] progress.c: replace signal() with sigaction()

2014-05-27 Thread Jeremiah Mahler
>From signal(2) The behavior of signal() varies across UNIX versions, and has also var‐ ied historically across different versions of Linux. Avoid its use: use sigaction(2) instead. See Portability below. Replaced signal() with sigaction() in progress.c Signed-off-by: Jeremiah Mah

  1   2   >