Re: [[RFC memory leak, v.2]] Minor memory leak fix

2014-03-11 Thread René Scharfe
Am 11.03.2014 13:36, schrieb Fredrik Gustafsson: Strbuf needs to be released even if it's locally declared. Signed-off-by: Fredrik Gustafsson iv...@iveqy.com --- archive.c | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/archive.c b/archive.c index

[PATCH 1/2] t7810: add missing variables to tests in loop

2014-03-11 Thread René Scharfe
Some tests in t7810-grep.sh are in a loop that runs them against HEAD and the work tree. In order for that to work the test code should use the variables $L (display name), $H (HEAD or empty string) and $HC (revision prefix for result lines); otherwise tests are just repeated with the same

[PATCH 2/2] grep: support -h (no header) with --count

2014-03-11 Thread René Scharfe
Suppress printing the header (filename) with -h even if in -c/--count mode. GNU grep and OpenBSD's grep do the same. Signed-off-by: Rene Scharfe l@web.de --- grep.c | 7 +-- t/t7810-grep.sh | 12 2 files changed, 17 insertions(+), 2 deletions(-) diff --git

Re: [PATCH] general style: replaces memcmp() with proper starts_with()

2014-03-12 Thread René Scharfe
Am 12.03.2014 20:39, schrieb Junio C Hamano: Jeff King p...@peff.net writes: static inline int standard_header_field(const char *field, size_t len) { - return ((len == 4 !memcmp(field, tree , 5)) || - (len == 6 !memcmp(field, parent , 7)) || - (len == 6

Re: [PATCH] general style: replaces memcmp() with proper starts_with()

2014-03-12 Thread René Scharfe
Am 12.03.2014 22:16, schrieb David Kastrup: René Scharfe l@web.de writes: Am 12.03.2014 20:39, schrieb Junio C Hamano: Jeff King p...@peff.net writes: static inline int standard_header_field(const char *field, size_t len) { - return ((len == 4 !memcmp(field, tree , 5

Re: [RFC/PATCH] diff: simplify cpp funcname regex

2014-03-18 Thread René Scharfe
Am 18.03.2014 09:02, schrieb Johannes Sixt: Cc René; do you have any comments regarding grep --function-context? Am 3/18/2014 6:24, schrieb Jeff King: On Fri, Mar 14, 2014 at 07:56:46AM +0100, Johannes Sixt wrote: Consider this code: void above() {} static int Y; static int A;

Re: [PATCH 5/5] log: do not segfault on gmtime errors

2014-03-22 Thread René Scharfe
Am 24.02.2014 08:49, schrieb Jeff King: Many code paths assume that show_date and show_ident_date cannot return NULL. For the most part, we handle missing or corrupt timestamps by showing the epoch time t=0. However, we might still return NULL if gmtime rejects the time_t we feed it, resulting

[PATCH 08/10] pickaxe: move pickaxe() after pickaxe_match()

2014-03-22 Thread René Scharfe
pickaxe() calls pickaxe_match(); moving the definition of the former those after the latter allows us to do without an explicit function declaration. Signed-off-by: Rene Scharfe l@web.de --- diffcore-pickaxe.c | 79 ++ 1 file changed, 38

[PATCH 05/10] t4209: use helper functions to test --author

2014-03-22 Thread René Scharfe
Also add tests for case sensitive and non-matching cases. Signed-off-by: Rene Scharfe l@web.de --- t/t4209-log-pickaxe.sh | 13 - 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/t/t4209-log-pickaxe.sh b/t/t4209-log-pickaxe.sh index 873a10e..80aabe2 100755 ---

[PATCH 02/10] t4209: factor out helper function test_log()

2014-03-22 Thread René Scharfe
Twelve tests in t4209 follow the same simple pattern for description, git log call and checking. Extract that shared logic into a helper function named test_log. Test specifications become a lot more compact, new tests can be added more easily. Signed-off-by: Rene Scharfe l@web.de ---

[PATCH 07/10] pickaxe: merge diffcore_pickaxe_grep() and diffcore_pickaxe_count() into diffcore_pickaxe()

2014-03-22 Thread René Scharfe
diffcore_pickaxe_count() initializes the regular expression or kwset for the search term, calls pickaxe() with the callback has_changes() and cleans up afterwards. diffcore_pickaxe_grep() does the same, only it doesn't support kwset and uses the callback diff_grep() instead. Merge the two

[PATCH 10/10] pickaxe: simplify kwset loop in contains()

2014-03-22 Thread René Scharfe
Inlining the variable found actually makes the code shorter and easier to read. Signed-off-by: Rene Scharfe l@web.de --- diffcore-pickaxe.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/diffcore-pickaxe.c b/diffcore-pickaxe.c index 70753d0..185f86b 100644 ---

[PATCH 01/10] t4209: set up expectations up front

2014-03-22 Thread René Scharfe
Instead of creating an expect file for each test, build three files with the possible valid values during setup and use them in the tests. This shortens the test code and saves nine calls to git rev-parse. Signed-off-by: Rene Scharfe l@web.de --- t/t4209-log-pickaxe.sh | 64

[PATCH 09/10] pickaxe: call strlen only when necessary in diffcore_pickaxe_count()

2014-03-22 Thread René Scharfe
We need to determine the search term's length only when fixed-string matching is used; regular expression compilation takes a NUL-terminated string directly. Only call strlen() in the former case. Signed-off-by: Rene Scharfe l@web.de --- diffcore-pickaxe.c | 3 +-- 1 file changed, 1

[PATCH 04/10] t4209: use helper functions to test --grep

2014-03-22 Thread René Scharfe
Also add tests for non-matching cases. Signed-off-by: Rene Scharfe l@web.de --- t/t4209-log-pickaxe.sh | 18 -- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/t/t4209-log-pickaxe.sh b/t/t4209-log-pickaxe.sh index dd911c2..873a10e 100755 ---

[PATCH 03/10] t4209: factor out helper function test_log_icase()

2014-03-22 Thread René Scharfe
Reduce code duplication by introducing test_log_icase() that runs the same test with both --regexp-ignore-case and -i. The specification of the four basic test scenarios (matching/nomatching combined with case sensitive/insensitive) becomes easier to read and write. Signed-off-by: Rene Scharfe

[PATCH 00/10] pickaxe: honor -i when used with -S and --pickaxe-regex; cleanups

2014-03-22 Thread René Scharfe
This series allows the options -i/--regexp-ignore-case, --pickaxe-regex, and -S to be used together and work as expected to perform a pickaxe search using case-insensitive regular expression matching. Its first half refactors the test script and extends test coverage a bit while we're at it. The

[PATCH 06/10] pickaxe: honor -i when used with -S and --pickaxe-regex

2014-03-22 Thread René Scharfe
ade4 (pickaxe: allow -i to search in patch case-insensitively) allowed case-insenitive matching for -G and -S, but for the latter only if fixed string matching is used. Allow it for -S and regular expression matching as well to make the support complete. Signed-off-by: Rene Scharfe

Re: [PATCH 04/10] t4209: use helper functions to test --grep

2014-03-24 Thread René Scharfe
Am 24.03.2014 22:14, schrieb Jeff King: On Mon, Mar 24, 2014 at 11:22:58AM -0700, Junio C Hamano wrote: René Scharfe l@web.de writes: -test_expect_success 'log --grep -i' ' - git log -i --grep=InItial --format=%H actual - test_cmp expect_initial actual -' +test_log

Re: [PATCH 03/10] t4209: factor out helper function test_log_icase()

2014-03-24 Thread René Scharfe
Am 24.03.2014 22:10, schrieb Jeff King: On Mon, Mar 24, 2014 at 11:22:30AM -0700, Junio C Hamano wrote: +test_log_icase() { + test_log $@ --regexp-ignore-case + test_log $@ -i -cascade broken? Will squash in an obvious fix. I don't think so. This is happening outside of

Re: [PATCH 5/5] log: do not segfault on gmtime errors

2014-03-24 Thread René Scharfe
Am 24.03.2014 22:33, schrieb Jeff King: On Sat, Mar 22, 2014 at 10:32:37AM +0100, René Scharfe wrote: @@ -184,8 +184,10 @@ const char *show_date(unsigned long time, int tz, enum date_mode mode) tz = local_tzoffset(time); tm = time_to_tm(time, tz); - if (!tm

Re: [PATCH v3] MSVC: fix t0040-parse-options crash

2014-03-29 Thread René Scharfe
Am 29.03.2014 22:34, schrieb Andreas Schwab: Marat Radchenko ma...@slonopotamus.org writes: diff --git a/test-parse-options.c b/test-parse-options.c index 434e8b8..6f6c656 100644 --- a/test-parse-options.c +++ b/test-parse-options.c @@ -60,7 +60,7 @@ int main(int argc, char **argv)

Re: [PATCH 1/2] date: recognize bogus FreeBSD gmtime output

2014-04-01 Thread René Scharfe
Am 01.04.2014 09:42, schrieb Jeff King: diff --git a/compat/gmtime.c b/compat/gmtime.c new file mode 100644 index 000..ffcabf4 --- /dev/null +++ b/compat/gmtime.c @@ -0,0 +1,26 @@ +#include ../git-compat-util.h +#undef gmtime +#undef gmtime_r + +struct tm *git_gmtime(const time_t *timep) +{

[PATCH] rev-parse: fix typo in example on manpage

2014-04-01 Thread René Scharfe
--- Documentation/git-rev-parse.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index e05e6b3..377d9d7 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -363,7 +363,7 @@

Re: [PATCH 1/2] date: recognize bogus FreeBSD gmtime output

2014-04-01 Thread René Scharfe
Am 01.04.2014 21:08, schrieb Junio C Hamano: René Scharfe l@web.de writes: Am 01.04.2014 09:42, schrieb Jeff King: diff --git a/compat/gmtime.c b/compat/gmtime.c new file mode 100644 index 000..ffcabf4 --- /dev/null +++ b/compat/gmtime.c @@ -0,0 +1,26 @@ +#include ../git-compat-util.h

Re: [PATCH] rev-parse: fix typo in example on manpage

2014-04-02 Thread René Scharfe
Am 02.04.2014 19:32, schrieb Junio C Hamano: René Scharfe l@web.de writes: --- Documentation/git-rev-parse.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Thanks; I'll forge your Sign-off ;-) Oops, sorry, and thanks. Signed-off-by: Rene Scharfe l@web.de diff --git

Re: [PATCH 06/10] log: --function-name pickaxe

2014-04-03 Thread René Scharfe
Am 27.03.2014 19:50, schrieb David A. Dalrymple (and Bhushan G. Lodha): From: Bhushan G. Lodha David A. Dalrymple dad-...@mit.edu This is similar to the pickaxe grep option (-G), but applies the provided regex only to diff hunk headers, thereby showing only those commits which affect a

Re: Makefile: Another make command is used when going into SUBDIR perl

2014-04-06 Thread René Scharfe
Am 06.04.2014 01:10, schrieb Bjarni Ingi Gislason: Package: git-1.9.0 Another make command is used in the Makefile when it enters subdir PERL. The used make command is a link in my home directory to /usr/sfw/bin/gmake. Other make commands are /usr/ccs/bin/make and /usr/xpg4/bin/make.

[PATCH] read-cache: check for leading symlinks when refreshing index

2014-08-09 Thread René Scharfe
Don't add paths with leading symlinks to the index while refreshing; we only track those symlinks themselves. We already ignore them while preloading (see read_index_preload.c). Reported-by: Nikolay Avdeev avd...@math.vsu.ru Signed-off-by: Rene Scharfe l@web.de --- read-cache.c

Re: [PATCH] mailsplit.c: remove dead code

2014-08-12 Thread René Scharfe
Am 11.08.2014 um 23:11 schrieb Stefan Beller: This was found by coverity. (Id: 290001) the variable 'output' is only assigned to a value inequal to NUL, after all gotos to the corrupt label. Therefore we can conclude the two removed lines are actually dead code. After reading the above for

[PATCH] clean: use f(void) instead of f() to declare a pointer to a function without arguments

2014-08-16 Thread René Scharfe
Explicitly state that menu_item functions like clean_cmd don't take any arguments by using void instead of an empty parameter list. Found using gcc -Wstrict-prototypes. Signed-off-by: Rene Scharfe l@web.de --- builtin/clean.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

Re: [PATCH v3 03/10] setup: convert setup_git_directory_gently_1 et al. to strbuf

2014-08-16 Thread René Scharfe
Is there a chance to squueze this in: $ git diff diff --git a/setup.c b/setup.c index 526cdf6..fb61860 100644 --- a/setup.c +++ b/setup.c @@ -734,7 +734,7 @@ static const char *setup_git_directory_gently_1(int *nongit_ok) string_list_clear(ceiling_dirs, 0);

[PATCH] run-command: introduce CHILD_PROCESS_INIT

2014-08-16 Thread René Scharfe
Most struct child_process variables are cleared using memset right after declaration. Provide a macro, CHILD_PROCESS_INIT, that can be used to initialize them statically instead. That's shorter, doesn't require a function call and is slightly more readable (especially given that we already have

Re: [PATCH] run-command: introduce CHILD_PROCESS_INIT

2014-08-17 Thread René Scharfe
Am 17.08.2014 um 09:12 schrieb Jeff King: On Sun, Aug 17, 2014 at 12:55:23AM +0200, René Scharfe wrote: Most struct child_process variables are cleared using memset right after declaration. Provide a macro, CHILD_PROCESS_INIT, that can be used to initialize them statically instead. That's

[PATCH v2 1/4] run-command: introduce CHILD_PROCESS_INIT

2014-08-19 Thread René Scharfe
Most struct child_process variables are cleared using memset first after declaration. Provide a macro, CHILD_PROCESS_INIT, that can be used to initialize them statically instead. That's shorter, doesn't require a function call and is slightly more readable (especially given that we already have

[PATCH v2 3/4] run-command: call run_command_v_opt_cd_env() instead of duplicating it

2014-08-19 Thread René Scharfe
Signed-off-by: Rene Scharfe l@web.de --- run-command.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/run-command.c b/run-command.c index 47ab21b..9196ee0 100644 --- a/run-command.c +++ b/run-command.c @@ -577,9 +577,7 @@ static void prepare_run_command_v_opt(struct

[PATCH v2 4/4] run-command: inline prepare_run_command_v_opt()

2014-08-19 Thread René Scharfe
Merge prepare_run_command_v_opt() and its only caller. This removes a pointer indirection and allows to initialize the struct child_process using CHILD_PROCESS_INIT. Signed-off-by: Rene Scharfe l@web.de --- run-command.c | 24 1 file changed, 8 insertions(+), 16

[PATCH] sha1_name: avoid quadratic list insertion in handle_one_ref

2014-08-21 Thread René Scharfe
Similar to 16445242 (fetch-pack: avoid quadratic list insertion in mark_complete), sort only after all refs are collected instead of while inserting. The result is the same, but it's more efficient that way. The difference will only be measurable in repositories with a large number of refs.

[PATCH] walker: avoid quadratic list insertion in mark_complete

2014-08-21 Thread René Scharfe
Similar to 16445242 (fetch-pack: avoid quadratic list insertion in mark_complete), sort only after all refs are collected instead of while inserting. The result is the same, but it's more efficient that way. The difference will only be measurable in repositories with a large number of refs.

Re: [BUG] resolved deltas

2014-08-23 Thread René Scharfe
Am 22.08.2014 um 21:41 schrieb Martin von Gagern: On 21.08.2014 13:35, Petr Stodulka wrote: Hi guys, I wanted post you patch here for this bug, but I can't find primary source of this problem [0], because I don't understand some ideas in the code. […] Any next ideas/hints or explanation

Re: [BUG] resolved deltas

2014-08-25 Thread René Scharfe
Am 23.08.2014 um 13:18 schrieb Jeff King: On Sat, Aug 23, 2014 at 07:04:59AM -0400, Jeff King wrote: On Sat, Aug 23, 2014 at 06:56:40AM -0400, Jeff King wrote: So I think your patch is doing the right thing. By the way, if you want to add a test to your patch, there is infrastructure in

[PATCH] connect: simplify check_ref() using skip_prefix() and starts_with()

2014-08-30 Thread René Scharfe
Both callers of check_ref() pass in NUL-terminated strings for name. Remove the len parameter and then use skip_prefix() and starts_with() instead of memcmp() to check if it starts with certain strings. This gets rid of several magic string length constants and a strlen() call. Signed-off-by:

[PATCH] pack-write: simplify index_pack_lockfile using skip_prefix() and xstrfmt()

2014-08-30 Thread René Scharfe
Get rid of magic string length constants by using skip_prefix() instead of memcmp() and use xstrfmt() for building a string instead of a PATH_MAX-sized buffer, snprintf() and xstrdup(). Signed-off-by: Rene Scharfe l@web.de --- pack-write.c | 11 +-- 1 file changed, 5 insertions(+), 6

[PATCH] http-walker: simplify process_alternates_response() using strbuf

2014-08-30 Thread René Scharfe
Use strbuf to build the new base, which takes care of allocations and the terminating NUL character automatically. Signed-off-by: Rene Scharfe l@web.de --- http-walker.c | 15 ++- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/http-walker.c b/http-walker.c index

Re: [PATCH 2/2] index-pack: handle duplicate base objects gracefully

2014-08-30 Thread René Scharfe
Am 30.08.2014 um 15:16 schrieb Jeff King: On Fri, Aug 29, 2014 at 07:59:32PM -0700, Shawn Pearce wrote: I agree it is probably a bug on the sending side, but I think last time this came up we decided to try to be liberal in what we accept. c.f.

[PATCH] config: simplify git_config_include()

2014-08-30 Thread René Scharfe
Instead of using skip_prefix() to check the first part of the string and then strcmp() to check the rest, simply use strcmp() to check the whole string. Signed-off-by: Rene Scharfe l@web.de --- config.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/config.c

[PATCH] imap-send: simplify v_issue_imap_cmd() and get_cmd_result() using starts_with()

2014-08-30 Thread René Scharfe
Use starts_with() instead of memcmp() to check if NUL-terminated strings match prefixes. This gets rid of some magic string length constants. Signed-off-by: Rene Scharfe l@web.de --- imap-send.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/imap-send.c

[PATCH] merge-tree: remove unused df_conflict arguments

2014-08-30 Thread René Scharfe
merge_trees_recursive() stores a pointer to its parameter df_conflict in its struct traverse_info, but it is never actually used. Stop doing that, remove the parameter and inline the function into merge_trees(), as the latter is now only passing on its parameters. Remove the parameter

Re: [PATCH 2/2] index-pack: handle duplicate base objects gracefully

2014-08-31 Thread René Scharfe
Am 31.08.2014 um 17:17 schrieb Jeff King: On Sat, Aug 30, 2014 at 06:00:59PM +0200, René Scharfe wrote: My only nit with patch 2: Petr Stodulka pstod...@redhat.com and Martin von Gagern martin.vgag...@gmx.net should be mentioned as bug reporters. Yeah, I agree with that. And actually, you

Re: [PATCH] imap-send: simplify v_issue_imap_cmd() and get_cmd_result() using starts_with()

2014-09-02 Thread René Scharfe
Am 02.09.2014 um 21:23 schrieb Junio C Hamano: René Scharfe l@web.de writes: Use starts_with() instead of memcmp() to check if NUL-terminated strings match prefixes. This gets rid of some magic string length constants. Signed-off-by: Rene Scharfe l@web.de --- imap-send.c | 9

Re: [PATCH] parse-options: detect attempt to add a duplicate short option name

2014-09-03 Thread René Scharfe
Am 03.09.2014 um 21:42 schrieb Junio C Hamano: Junio C Hamano gits...@pobox.com writes: diff --git a/builtin/revert.c b/builtin/revert.c index f9ed5bd..831c2cd 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -91,6 +91,7 @@ static void parse_args(int argc, const char **argv,

Re: [PATCH] parse-options: detect attempt to add a duplicate short option name

2014-09-03 Thread René Scharfe
Am 03.09.2014 um 23:05 schrieb Junio C Hamano: René Scharfe l@web.de writes: Compact and useful, I like it. You might want to squash in something like this, though. Without it t1502 fails because -b is defined twice there. Thanks. I like it to see that the check automatically

Re: [PATCH] parse-options: detect attempt to add a duplicate short option name

2014-09-04 Thread René Scharfe
Am 04.09.2014 um 00:16 schrieb Junio C Hamano: René Scharfe l@web.de writes: It bugged me enough that we didn't identify which short option letter we were complaining about The old code did report the short option. E.g. for t1502 it said: error: BUG: switch 'b' short name

Re: trace.c, line 219: error: identifier redeclared: trace_strbuf

2014-09-06 Thread René Scharfe
Am 06.09.2014 um 21:26 schrieb dev: Build on Solaris 10 of latest git tarball fails thus : CC tag.o CC trace.o trace.c, line 219: error: identifier redeclared: trace_strbuf current : function(pointer to const char, pointer to const struct strbuf {unsigned long

Re: [RFC PATCH 1/2] Makefile: add check-headers target

2014-09-06 Thread René Scharfe
Am 06.09.2014 um 21:20 schrieb David Aguilar: This allows us to ensure that each header can be included individually without needing to include other headers first. Sounds like a good objective. Signed-off-by: David Aguilar dav...@gmail.com --- This patch demonstrates how to verify PATCH

Re: [RFC PATCH 2/2] headers: include dependent headers

2014-09-06 Thread René Scharfe
Am 06.09.2014 um 21:20 schrieb David Aguilar: Add dependent headers so that including a header does not require including additional headers. This makes it so that gcc -c $header succeeds for each header. Signed-off-by: David Aguilar dav...@gmail.com --- diff --git a/branch.h b/branch.h

Re: [RFC PATCH v2 2/2] headers: include dependent headers

2014-09-07 Thread René Scharfe
Am 07.09.2014 um 02:30 schrieb David Aguilar: Add dependent headers so that including a header does not require including additional headers. This makes it so that gcc -c $header succeeds for each header. Signed-off-by: David Aguilar dav...@gmail.com --- Addresses René's note to not

[PATCH 1/2] strbuf: export strbuf_addchars()

2014-09-07 Thread René Scharfe
Move strbuf_addchars() to strbuf.c, where it belongs, and make it available for other callers. Signed-off-by: Rene Scharfe l@web.de --- Documentation/technical/api-strbuf.txt | 4 strbuf.c | 7 +++ strbuf.h | 1 + utf8.c

[PATCH 2/2] strbuf: use strbuf_addchars() for adding a char multiple times

2014-09-07 Thread René Scharfe
Signed-off-by: Rene Scharfe l@web.de --- graph.c | 5 ++--- merge-recursive.c | 4 +--- pretty.c | 10 +++--- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/graph.c b/graph.c index 6404331..dfb99f6 100644 --- a/graph.c +++ b/graph.c @@ -1145,7 +1145,7

Re: [PATCH v3 2/2] headers: include dependent headers

2014-09-07 Thread René Scharfe
Am 07.09.2014 um 11:36 schrieb David Aguilar: Add dependent headers so that including a header does not require including additional headers. This makes it so that gcc -c $header succeeds for each header. diff --git a/cache.h b/cache.h index 4d5b76c..8b827d7 100644 --- a/cache.h +++

Re: [RFH] renaming strcmp/strncmp-icase

2014-09-08 Thread René Scharfe
Am 08.09.2014 um 20:52 schrieb Junio C Hamano: There are these two functions in dir.c that has only a handful of callers outside: int strcmp_icase(const char *a, const char *b); int strncmp_icase(const char *a, const char *b, size_t count); How many of you would think these are about

Re: [PATCH 1/2] strbuf: export strbuf_addchars()

2014-09-08 Thread René Scharfe
Am 08.09.2014 um 20:32 schrieb Junio C Hamano: René Scharfe l@web.de writes: Move strbuf_addchars() to strbuf.c, where it belongs, and make it available for other callers. Signed-off-by: Rene Scharfe l@web.de Wow, fixing up v1.7.0.2~9^2~2? About time, isn't it? ;) Both patches

Re: [RFC PATCH 2/2] headers: include dependent headers

2014-09-09 Thread René Scharfe
Am 08.09.2014 um 19:50 schrieb Junio C Hamano: René Scharfe l@web.de writes: Am 06.09.2014 um 21:20 schrieb David Aguilar: Add dependent headers so that including a header does not require including additional headers. This makes it so that gcc -c $header succeeds for each header

[PATCH] repack: call prune_packed_objects() and update_server_info() directly

2014-09-13 Thread René Scharfe
Call the functions behind git prune-packed and git update-server-info directly instead of using run_command(). This is shorter, easier and quicker. Signed-off-by: Rene Scharfe l@web.de --- builtin/repack.c | 23 ++- 1 file changed, 6 insertions(+), 17 deletions(-) diff

[PATCH 1/2] add macro REALLOCARRAY

2014-09-14 Thread René Scharfe
The macro ALLOC_GROW manages several aspects of dynamic memory allocations for arrays: It performs overprovisioning in order to avoid reallocations in future calls, updates the allocation size variable, multiplies the item size and thus allows users to simply specify the item count, performs the

[PATCH 2/2] use REALLOCARRAY for changing the allocation size of arrays

2014-09-14 Thread René Scharfe
Signed-off-by: Rene Scharfe l@web.de --- attr.c | 3 +-- builtin/apply.c| 2 +- builtin/for-each-ref.c | 9 +++-- builtin/index-pack.c | 4 +--- builtin/log.c | 2 +- builtin/merge.c| 2 +- builtin/mv.c | 8

Re: [PATCH 2/3] make update-server-info more robust

2014-09-14 Thread René Scharfe
Am 13.09.2014 um 22:19 schrieb Jeff King: Since git update-server-info may be called automatically as part of a push or a gc --auto, we should be robust against two processes trying to update it simultaneously. However, we currently use a fixed tempfile, which means that two simultaneous

Re: [PATCH 1/2] add macro REALLOCARRAY

2014-09-16 Thread René Scharfe
Am 16.09.2014 um 05:04 schrieb Junio C Hamano: On Sun, Sep 14, 2014 at 9:55 AM, René Scharfe l@web.de wrote: +#define REALLOCARRAY(x, alloc) x = xrealloc((x), (alloc) * sizeof(*(x))) I have been wondering if x could be an expression that has an operator that binds weaker than

[PATCH 1/2] add macro REALLOC_ARRAY

2014-09-16 Thread René Scharfe
The macro ALLOC_GROW manages several aspects of dynamic memory allocations for arrays: It performs overprovisioning in order to avoid reallocations in future calls, updates the allocation size variable, multiplies the item size and thus allows users to simply specify the item count, performs the

[PATCH 2/2] use REALLOC_ARRAY for changing the allocation size of arrays

2014-09-16 Thread René Scharfe
Signed-off-by: Rene Scharfe l@web.de --- attr.c | 3 +-- builtin/apply.c| 2 +- builtin/for-each-ref.c | 9 +++-- builtin/index-pack.c | 4 +--- builtin/log.c | 2 +- builtin/merge.c| 2 +- builtin/mv.c | 8

[PATCH 1/2] graph: simplify graph_padding_line()

2014-09-20 Thread René Scharfe
Deduplicate code common to both branches of if statements. Signed-off-by: Rene Scharfe l@web.de --- graph.c | 17 - 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/graph.c b/graph.c index dfb99f6..52605e4 100644 --- a/graph.c +++ b/graph.c @@ -1161,20 +1161,11

Re: [PATCH 1/2] graph: simplify graph_padding_line()

2014-09-20 Thread René Scharfe
Am 20.09.2014 um 20:29 schrieb René Scharfe: Deduplicate code common to both branches of if statements. There is no 2/2, this patch is the only one at this time. René -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More

[PATCH] remote: simplify match_name_with_pattern() using strbuf

2014-09-21 Thread René Scharfe
Make the code simpler and shorter by avoiding repetitive use of string length variables and leaving memory allocation to strbuf functions. Signed-off-by: Rene Scharfe l@web.de --- remote.c | 17 + 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/remote.c

Re: [PATCH 1/2] add macro REALLOC_ARRAY

2014-09-24 Thread René Scharfe
Am 24.09.2014 um 09:32 schrieb Michael Haggerty: Is there a reason that ALLOC_GROW and REALLOC_ARRAY are defined in two separate header files (cache.h and git-compat-util.h, respectively)? It seems to me that they are close siblings and therefore I find it surprising that they are not defined

Re: [PATCH 2/2] use REALLOC_ARRAY for changing the allocation size of arrays

2014-09-24 Thread René Scharfe
Am 24.09.2014 um 20:47 schrieb Jonathan Nieder: René Scharfe wrote: --- a/khash.h +++ b/khash.h (not really about this patch) Where did this file come from? Do we want to be able to sync with upstream to get later bugfixes (e.g., https://github.com/attractivechaos/klib/commit/000f0890

[PATCH] t0090: avoid passing empty string to printf %d

2014-09-30 Thread René Scharfe
FreeBSD's printf(1) doesn't accept empty strings for numerical format specifiers: $ printf %d\n /dev/null; echo $? printf: : expected numeric value 1 Initialize the AWK variable c to make sure the shell variable subtree_count always contains a numerical value, in order

[PATCH 1/2] sha1-array: add test-sha1-array and basic tests

2014-10-01 Thread René Scharfe
Signed-off-by: Rene Scharfe l@web.de --- .gitignore| 1 + Makefile | 1 + t/t0064-sha1-array.sh | 64 +++ test-sha1-array.c | 34 +++ 4 files changed, 100 insertions(+) create mode 100755

[PATCH 2/2] sha1-lookup: fix handling of duplicates in sha1_pos()

2014-10-01 Thread René Scharfe
If the first 18 bytes of the SHA1's of all entries are the same then sha1_pos() dies and reports that the lower and upper limits of the binary search were the same that this wasn't supposed to happen. This is wrong because the remaining two bytes could still differ. Furthermore: It wouldn't be a

[PATCH 1/3] daemon: handle gethostbyname() error

2014-10-01 Thread René Scharfe
If the user-supplied hostname can't be found then we should not use it. We already avoid doing that in the non-NO_IPV6 case by checking if the return value of getaddrinfo() is zero (success). Do the same in the NO_IPV6 case and make sure the return value of gethostbyname() isn't NULL before

[PATCH 2/3] daemon: fix error message after bind()

2014-10-01 Thread René Scharfe
Signed-off-by: Rene Scharfe l@web.de --- daemon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemon.c b/daemon.c index a6f467e..090f6a4 100644 --- a/daemon.c +++ b/daemon.c @@ -924,7 +924,7 @@ static int setup_named_sock(char *listen_addr, int listen_port, struct

[PATCH 3/3] daemon: remove write-only variable maxfd

2014-10-01 Thread René Scharfe
It became unused when 6573faff (NO_IPV6 support for git daemon) replaced select() with poll(). Signed-off-by: Rene Scharfe l@web.de --- daemon.c | 4 1 file changed, 4 deletions(-) diff --git a/daemon.c b/daemon.c index 090f6a4..54a03bd 100644 --- a/daemon.c +++ b/daemon.c @@ -815,7

Re: [PATCH 2/2] sha1-lookup: fix handling of duplicates in sha1_pos()

2014-10-01 Thread René Scharfe
Am 01.10.2014 um 12:50 schrieb Jeff King: On Wed, Oct 01, 2014 at 11:43:21AM +0200, René Scharfe wrote: If the first 18 bytes of the SHA1's of all entries are the same then sha1_pos() dies and reports that the lower and upper limits of the binary search were the same that this wasn't supposed

Re: [PATCH v7 09/38] lock_file(): always initialize and register lock_file object

2014-10-01 Thread René Scharfe
Am 01.10.2014 um 12:28 schrieb Michael Haggerty: The purpose of this patch is to make the state diagram for lock_file objects simpler and deterministic. If locking fails, lock_file() sometimes leaves the lock_file object partly initialized, but sometimes not. It sometimes registers the object

Re: [PATCH 1/2] sha1-array: add test-sha1-array and basic tests

2014-10-01 Thread René Scharfe
Am 01.10.2014 um 16:11 schrieb Eric Sunshine: On Wed, Oct 1, 2014 at 5:40 AM, René Scharfe l@web.de wrote: Signed-off-by: Rene Scharfe l@web.de --- diff --git a/t/t0064-sha1-array.sh b/t/t0064-sha1-array.sh new file mode 100755 index 000..bd68789 --- /dev/null +++ b/t/t0064-sha1

[PATCH v2 1/2] sha1-array: add test-sha1-array and basic tests

2014-10-01 Thread René Scharfe
Helped-by: Jeff King p...@peff.net Helped-by: Eric Sunshine sunsh...@sunshineco.com Signed-off-by: Rene Scharfe l@web.de --- Added a test for looking up a non-existing entry in an array that contains duplicates, as suggested by Jeff. Changed echo20() to add a space after the prefix as needed,

[PATCH v2 2/2] sha1-lookup: handle duplicates in sha1_pos()

2014-10-01 Thread René Scharfe
If the first 18 bytes of the SHA1's of all entries are the same then sha1_pos() dies and reports that the lower and upper limits of the binary search were the same that this wasn't supposed to happen. This is wrong because the remaining two bytes could still differ. Furthermore: It wouldn't be a

[PATCH] bundle: plug minor memory leak in is_tag_in_date_range()

2014-10-03 Thread René Scharfe
Free the buffer returned by read_sha1_file() even if no valid tagger line is found. Signed-off-by: Rene Scharfe l@web.de --- bundle.c | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/bundle.c b/bundle.c index b2b89fe..9ed865c 100644 --- a/bundle.c +++

Re: [PATCH 01/16] foreach_alt_odb: propagate return value from callback

2014-10-03 Thread René Scharfe
Am 03.10.2014 um 22:21 schrieb Jeff King: We check the return value of the callback and stop iterating if it is non-zero. However, we do not make the non-zero return value available to the caller, so they have no way of knowing whether the operation succeeded or not (technically they can keep

[PATCH] mailsplit: remove unnecessary unlink(2) call

2014-10-04 Thread René Scharfe
The output file hasn't been created at this point, yet, so there is no need to delete it when exiting early. Suggested-by: Jeff King p...@peff.net Signed-off-by: Rene Scharfe l@web.de --- Original thread: http://thread.gmane.org/gmane.comp.version-control.git/255140 builtin/mailsplit.c | 1

[PATCH] use skip_prefix() to avoid more magic numbers

2014-10-04 Thread René Scharfe
Continue where ae021d87 (use skip_prefix to avoid magic numbers) left off and use skip_prefix() in more places for determining the lengths of prefix strings to avoid using dependent constants and other indirect methods. Signed-off-by: Rene Scharfe l@web.de --- builtin/apply.c |

Re: [PATCH 12/16] sha1_file: add for_each iterators for loose and packed objects

2014-10-05 Thread René Scharfe
Am 03.10.2014 um 22:32 schrieb Jeff King: We typically iterate over the reachable objects in a repository by starting at the tips and walking the graph. There's no easy way to iterate over all of the objects, including unreachable ones. Let's provide a way of doing so. Signed-off-by: Jeff King

Re: [PATCH 16/16] write_sha1_file: freshen existing objects

2014-10-05 Thread René Scharfe
Am 03.10.2014 um 22:41 schrieb Jeff King: When we try to write a loose object file, we first check whether that object already exists. If so, we skip the write as an optimization. However, this can interfere with prune's strategy of using mtimes to mark files in progress. For example, if a

Re: [PATCH 0/16] make prune mtime-checking more careful

2014-10-05 Thread René Scharfe
Am 05.10.2014 um 00:22 schrieb Junio C Hamano: Jeff King p...@peff.net writes: There's quite a lot of patches here, but most of them are preparatory cleanups. The meat is in patches 13, 15, and 16. [01/16]: foreach_alt_odb: propagate return value from callback [02/16]: isxdigit: cast

Re: [PATCH] use skip_prefix() to avoid more magic numbers

2014-10-09 Thread René Scharfe
Am 07.10.2014 um 20:23 schrieb Junio C Hamano: René Scharfe l@web.de writes: @@ -335,20 +337,18 @@ static int append_ref(const char *refname, const unsigned char *sha1, int flags, static struct { int kind; const char *prefix; -int pfxlen

[PATCH] receive-pack: plug minor memory leak in unpack()

2014-10-11 Thread René Scharfe
The argv_array used in unpack() is never freed. Instead of adding explicit calls to argv_array_clear() use the args member of struct child_process and let run_command() and friends clean up for us. Signed-off-by: Rene Scharfe l@web.de --- builtin/receive-pack.c | 18 -- 1

[PATCH 1/2] run-command: add env_array, an optional argv_array for env

2014-10-19 Thread René Scharfe
Similar to args, add a struct argv_array member to struct child_process that simplifies specifying the environment for children. It is freed automatically by finish_command() or if start_command() encounters an error. Suggested-by: Jeff King p...@peff.net Signed-off-by: Rene Scharfe l@web.de

Re: [PATCH] receive-pack: plug minor memory leak in unpack()

2014-10-19 Thread René Scharfe
Am 14.10.2014 um 11:16 schrieb Jeff King: On Mon, Oct 13, 2014 at 12:08:09PM -0700, Junio C Hamano wrote: I wonder if run-command should provide a managed env array similar to the args array. That's a good idea. I took a look at a few of them: I took a brief look, too. I had hoped we

[PATCH 2/2] use env_array member of struct child_process

2014-10-19 Thread René Scharfe
Convert users of struct child_process to using the managed env_array for specifying environment variables instead of supplying an array on the stack or bringing their own argv_array. This shortens and simplifies the code and ensures automatically that the allocated memory is freed after use.

Re: [PATCH] grep: fix match highlighting for combined patterns with context lines

2014-10-26 Thread René Scharfe
Am 21.10.2014 um 07:56 schrieb Zoltan Klinger: When git grep is run with combined patterns such as '-e p1 --and -e p2' and surrounding context lines are requested, the output contains incorrectly highlighted matches. Consider the following output (highlighted matches are surrounded by '*'

Re: Sources for 3.18-rc1 not uploaded

2014-10-26 Thread René Scharfe
Am 23.10.2014 um 03:09 schrieb brian m. carlson: On Wed, Oct 22, 2014 at 11:42:48AM +0200, Michael J Gruber wrote: Junio C Hamano schrieb am 21.10.2014 um 20:14: Michael J Gruber g...@drmicha.warpmail.net writes: Unfortunately, the git archive doc clearly says that the umask is applied to

  1   2   3   4   5   6   7   8   9   10   >