[PATCH 0/5] parse-options: allow -h as a short option

2015-11-17 Thread René Scharfe
The short option -h is hard-wired in parseopt to list the options of a command together with a short explanation. If -h is to be given a different meaning then the flag PARSE_OPT_NO_INTERNAL_HELP has to be specified, which turns off handling for -h, --help and --help-all (except that --help handli

[PATCH] wt-status: use strncmp() for length-limited string comparison

2015-11-06 Thread René Scharfe
When a branch name is longer than four characters, memcmp() can read past the end of the string literal "HEAD". Use strncmp() instead, which stops at the end of a string. This fixes the following test failures with AddressSanitizer: t3203-branch-output.sh (Wstat: 256 Te

Re: [PATCH 3/5] wt-status: avoid building bogus branch name with detached HEAD

2015-11-01 Thread René Scharfe
Am 01.11.2015 um 18:50 schrieb Junio C Hamano: René Scharfe writes: If we're on a detached HEAD then wt_shortstatus_print_tracking() takes the string "HEAD (no branch)", translates it, skips the first eleven characters and passes the result to branch_get(), which returns a b

[PATCH] show-branch: use argv_array for default arguments

2015-10-31 Thread René Scharfe
Use argv_array instead of open-coding it. Signed-off-by: Rene Scharfe --- builtin/show-branch.c | 24 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/builtin/show-branch.c b/builtin/show-branch.c index ac5141d..e17744b 100644 --- a/builtin/show-branch.c ++

[PATCH 4/5] wt-status: don't skip a magical number of characters blindly

2015-10-31 Thread René Scharfe
Use the variable branch_name, which already has "refs/heads/" removed, instead of blindly advancing in the ->branch string by 11 bytes. This is safer and less magical. Signed-off-by: Rene Scharfe --- wt-status.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wt-status.c b/w

[PATCH 5/5] wt-status: use skip_prefix() to get rid of magic string length constants

2015-10-31 Thread René Scharfe
Signed-off-by: Rene Scharfe --- wt-status.c | 36 +++- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/wt-status.c b/wt-status.c index 42ea15e..435fc28 100644 --- a/wt-status.c +++ b/wt-status.c @@ -897,15 +897,15 @@ static void wt_status_print_verb

[PATCH 3/5] wt-status: avoid building bogus branch name with detached HEAD

2015-10-31 Thread René Scharfe
If we're on a detached HEAD then wt_shortstatus_print_tracking() takes the string "HEAD (no branch)", translates it, skips the first eleven characters and passes the result to branch_get(), which returns a bogus result and accesses memory out of bounds in order to produce it. Somehow stat_tracking_

[PATCH 2/5] wt-status: exit early using goto in wt_shortstatus_print_tracking()

2015-10-31 Thread René Scharfe
Deduplicate printing the line terminator by jumping to the end of the function. Signed-off-by: Rene Scharfe --- wt-status.c | 13 + 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/wt-status.c b/wt-status.c index 3e3b8c0..083328f 100644 --- a/wt-status.c +++ b/wt-status.

[PATCH 1/5] t7060: add test for status --branch on a detached HEAD

2015-10-31 Thread René Scharfe
This test fails when run under Valgrind because branch_get() gets passed a bogus branch name pointer: ==62831== Invalid read of size 1 ==62831==at 0x4F76AE: branch_get (remote.c:1650) ==62831==by 0x53499E: wt_shortstatus_print_tracking (wt-status.c:1654) ==62831==by 0x53499E: wt_shorts

[PATCH 0/5] wt-status: fix an invalid memory read, clean up

2015-10-31 Thread René Scharfe
Memory is accessed out-of-bounds when try to show --branch info in a repo with a detached HEAD. Add a test in patch 1 and a fix in patch 3, as well as some cleanups. Rene Scharfe (5): t7060: add test for status --branch on a detached HEAD wt-status: exit early using goto in wt_shortstatus_pri

[PATCH v2 3/3] daemon: plug memory leak

2015-10-31 Thread René Scharfe
Call child_process_clear() when a child ends to release the memory allocated for its environment. This is necessary because unlike all other users of start_command() we don't call finish_command(), which would have taken care of that for us. This leak was introduced by f063d38b (daemon: use cld->

[PATCH v2 2/3] run-command: export child_process_clear()

2015-10-31 Thread René Scharfe
Make the API symmetric by including a cleanup function as a counterpart to child_process_init(). Signed-off-by: Rene Scharfe --- Documentation/technical/api-run-command.txt | 7 +++ run-command.c | 2 +- run-command.h | 1 + 3 files

[PATCH v2 1/3] run-command: name the cleanup function child_process_clear()

2015-10-31 Thread René Scharfe
Rename child_process_deinit() to child_process_clear() in order to stay consistent with similar cleanup functions like argv_array_clear(), string_list_clear() etc. Signed-off-by: Rene Scharfe --- run-command.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/run-c

[PATCH v2 0/3] daemon: plug memory leak

2015-10-31 Thread René Scharfe
Changes since v1: - Rebased on next, which already has a cleanup function. - Added first patch for renaming it. Rene Scharfe (3): run-command: name the cleanup function child_process_clear() run-command: export child_process_clear() daemon: plug memory leak Documentation/technical/api-run

Re: [PATCH 1/2] run-command: factor out child_process_clear()

2015-10-27 Thread René Scharfe
Am 26.10.2015 um 20:23 schrieb Stefan Beller: On Mon, Oct 26, 2015 at 11:43 AM, Junio C Hamano wrote: René Scharfe writes: Avoid duplication by moving the code to release allocated memory for arguments and environment to its own function, child_process_clear(). Export it to provide a

Re: [PATCH] use pop_commit() for consuming the first entry of a struct commit_list

2015-10-27 Thread René Scharfe
Am 26.10.2015 um 22:33 schrieb Junio C Hamano: René Scharfe writes: Instead of open-coding the function pop_commit() just call it. This makes the intent clearer and reduces code size. Signed-off-by: Rene Scharfe --- builtin/fmt-merge-msg.c | 9 +++-- builtin/merge.c | 12

[PATCH] use pop_commit() for consuming the first entry of a struct commit_list

2015-10-24 Thread René Scharfe
Instead of open-coding the function pop_commit() just call it. This makes the intent clearer and reduces code size. Signed-off-by: Rene Scharfe --- builtin/fmt-merge-msg.c | 9 +++-- builtin/merge.c | 12 +--- builtin/reflog.c| 6 +- builtin/rev-parse.c |

[PATCH 2/2] daemon: plug memory leak

2015-10-24 Thread René Scharfe
Call child_process_clear() when a child ends to release the memory allocated for its environment. This is necessary because unlike all other users of start_command() we don't call finish_command(), which would have taken care of that for us. This leak was introduced by f063d38b (daemon: use cld->

[PATCH 1/2] run-command: factor out child_process_clear()

2015-10-24 Thread René Scharfe
Avoid duplication by moving the code to release allocated memory for arguments and environment to its own function, child_process_clear(). Export it to provide a counterpart to child_process_init(). Signed-off-by: Rene Scharfe --- Documentation/technical/api-run-command.txt | 7 +++ run-com

Re: [PATCH v3] merge: fix cache_entry use-after-free

2015-10-15 Thread René Scharfe
Am 15.10.2015 um 21:02 schrieb David Turner: On Thu, 2015-10-15 at 05:35 +0200, René Scharfe wrote: Am 15.10.2015 um 00:07 schrieb David Turner: From: Keith McGuigan During merges, we would previously free entries that we no longer need in the destination index. But those entries might also

Re: [PATCH v3] merge: fix cache_entry use-after-free

2015-10-14 Thread René Scharfe
Am 15.10.2015 um 00:07 schrieb David Turner: From: Keith McGuigan During merges, we would previously free entries that we no longer need in the destination index. But those entries might also be stored in the dir_entry cache, and when a later call to add_to_index found them, they would be used

Re: [PATCH 60/68] prefer memcpy to strcpy

2015-09-27 Thread René Scharfe
Am 27.09.2015 um 15:13 schrieb René Scharfe: Am 27.09.2015 um 15:06 schrieb Torsten Bögershausen: On 2015-09-27 13.19, René Scharfe wrote: Am 24.09.2015 um 23:08 schrieb Jeff King: When we already know the length of a string (e.g., because we just malloc'd to fit it), it's nicer to

Re: [PATCH 60/68] prefer memcpy to strcpy

2015-09-27 Thread René Scharfe
Am 27.09.2015 um 15:06 schrieb Torsten Bögershausen: On 2015-09-27 13.19, René Scharfe wrote: Am 24.09.2015 um 23:08 schrieb Jeff King: When we already know the length of a string (e.g., because we just malloc'd to fit it), it's nicer to use memcpy than strcpy, as it makes it more ob

Re: [PATCH 60/68] prefer memcpy to strcpy

2015-09-27 Thread René Scharfe
Am 24.09.2015 um 23:08 schrieb Jeff King: When we already know the length of a string (e.g., because we just malloc'd to fit it), it's nicer to use memcpy than strcpy, as it makes it more obvious that we are not going to overflow the buffer (because the size we pass matches the size in the alloca

Eric Sunshine mail delivery failure

2015-08-23 Thread René Scharfe
Eric, hope you see this reply on the list. Direct replies to sunsh...@sunshineco.com are rejected by my mail provider on submit in Thunderbird with the following message: Requested action not taken: mailbox unavailable invalid DNS MX or A/ resource record. And with this one when us

Re: [PATCH 1/3] t5004: test ZIP archives with many entries

2015-08-23 Thread René Scharfe
Am 23.08.2015 um 07:54 schrieb Eric Sunshine: > On Sat, Aug 22, 2015 at 3:06 PM, René Scharfe wrote: >> diff --git a/t/t5004-archive-corner-cases.sh >> b/t/t5004-archive-corner-cases.sh >> index 654adda..c6bd729 100755 >> --- a/t/t5004-archive-corner-cases.sh >

[PATCH 1/3] t5004: test ZIP archives with many entries

2015-08-22 Thread René Scharfe
A ZIP file directory has a 16-bit field for the number of entries it contains. There are 64-bit extensions to deal with that. Demonstrate that git archive --format=zip currently doesn't use them and instead overflows the field. InfoZIP's unzip doesn't care about this field and extracts all files

[PATCH 3/3] archive-zip: support more than 65535 entries

2015-08-22 Thread René Scharfe
Support more than 65535 entries cleanly by writing a "zip64 end of central directory record" (with a 64-bit field for the number of entries) before the usual "end of central directory record" (which contains only a 16-bit field). InfoZIP's zip does the same. Archives with 65535 or less entries are

[PATCH 2/3] archive-zip: use a local variable to store the creator version

2015-08-22 Thread René Scharfe
Use a simpler conditional right next to the code which makes a higher creator version necessary -- namely symlink handling and support for executable files -- instead of a long line with a ternary operator. The resulting code has more lines but is simpler and allows reuse of the value easily. Sign

Re: bug: git-archive does not use the zip64 extension for archives with more than 16k entries

2015-08-12 Thread René Scharfe
Am 11.08.2015 um 12:40 schrieb Johannes Schauer: Hi, for repositories with more than 16k files and folders, git-archive will create zip files which store the wrong number of entries. That is, it stores the number of entries modulo 16k. This will break unpackers that do not include code to suppor

[PATCH] diff: parse ws-error-highlight option more strictly

2015-07-11 Thread René Scharfe
Check if a matched token is followed by a delimiter before advancing the pointer arg. This avoids accepting composite words like "allnew" or "defaultcontext". Signed-off-by: Rene Scharfe --- diff.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/diff.c b/diff.c index 8

git@vger.kernel.org

2015-07-11 Thread René Scharfe
Am 10.07.2015 um 22:50 schrieb Jeff King: Thanks, this definitely is a problem, but we already have a fix in the sb/p5310-and-chain topic. I thought that had been merged-up, but it looks like it is only in "next" right now. All the better. And I see it's in master now. René -- To unsubscribe

git@vger.kernel.org

2015-07-10 Thread René Scharfe
Signed-off-by: Rene Scharfe --- GIT_TEST_CHAIN_LINT complains about the missing &&s and is enabled by default now. t/perf/p5310-pack-bitmaps.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/t/perf/p5310-pack-bitmaps.sh b/t/perf/p5310-pack-bitmaps.sh index f8ed857..de2

Re: [PATCH] grep: use regcomp() for icase search with non-ascii patterns

2015-07-06 Thread René Scharfe
Am 06.07.2015 um 14:42 schrieb Nguyễn Thái Ngọc Duy: Noticed-by: Plamen Totev Signed-off-by: Nguyễn Thái Ngọc Duy --- grep.c | 14 +++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/grep.c b/grep.c index b58c7c6..48db15a 100644 --- a/grep.c +++ b/grep.c @@ -378,7 +

Re: [PATCH v3 0/4] submodule config lookup API

2015-05-21 Thread René Scharfe
Am 21.05.2015 um 19:06 schrieb Heiko Voigt: diff --git a/submodule-config.h b/submodule-config.h index 9061e4e..58afc83 100644 --- a/submodule-config.h +++ b/submodule-config.h @@ -24,6 +24,6 @@ const struct submodule *submodule_from_name(const unsigned char *commit_sha1, const c

[PATCH] use file_exists() to check if a file exists in the worktree

2015-05-19 Thread René Scharfe
Call file_exists() instead of open-coding it. That's shorter, simpler and the intent becomes clearer. Signed-off-by: Rene Scharfe --- builtin/blame.c | 15 +++ builtin/rm.c | 3 +-- merge-recursive.c | 3 +-- sha1_name.c | 7 +++ submodule.c | 3 +-- 5 fil

Re: [PATCH] git-gui: sort entries in tclIndex

2015-04-25 Thread René Scharfe
Looping in Pat (git-gui maintainer). Am 15.04.2015 um 09:22 schrieb Olaf Hering: Ping? On Tue, Feb 10, Olaf Hering wrote: Ping? On Mon, Jan 26, Olaf Hering wrote: ALL_LIBFILES uses wildcard, which provides the result in directory order. This order depends on the underlying filesystem on th

Re: [PATCH 0/6] address packed-refs speed regressions

2015-04-05 Thread René Scharfe
Am 05.04.2015 um 20:59 schrieb Jeff King: Still, the numbers are promising. Here's are comparisons against for-each-ref on torvalds/linux, which has a 218M packed-refs file: $ time git for-each-ref \ --format='%(objectname) %(refname)' \ refs/remotes/2325298/ | wc -c 4

Re: [PATCH 0/6] address packed-refs speed regressions

2015-04-05 Thread René Scharfe
Am 05.04.2015 um 20:52 schrieb Jeff King: On Sun, Apr 05, 2015 at 03:41:39PM +0200, René Scharfe wrote: I wonder if pluggable reference backends could help here. Storing refs in a database table indexed by refname should simplify things. ...this. I think that effort might be better spent on

Re: [PATCH 0/6] address packed-refs speed regressions

2015-04-05 Thread René Scharfe
Am 05.04.2015 um 03:06 schrieb Jeff King: > As I've mentioned before, I have some repositories with rather large > numbers of refs. The worst one has ~13 million refs, for a 1.6GB > packed-refs file. So I was saddened by this: > >$ time git.v2.0.0 rev-parse refs/heads/foo >/dev/null 2>&1 >

Re: [PATCH 00/14] numparse module: systematically tighten up integer parsing

2015-03-24 Thread René Scharfe
Am 24.03.2015 um 17:06 schrieb Michael Haggerty: Parsing numbers is not rocket science, but there are a lot of pitfalls, especially around overflow. It's even harder to write such code via macros and the result is less readable. This patch series is mostly about finding a reasonable API and whip

[PATCH] use isxdigit() for checking if a character is a hexadecimal digit

2015-03-09 Thread René Scharfe
Use the standard function isxdigit() to make the intent clearer and avoid using magic constants. Signed-off-by: Rene Scharfe --- sha1_name.c | 2 +- transport.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sha1_name.c b/sha1_name.c index 95f9f8f..6d10f05 100644 --- a/sh

[PATCH v2 1/2] daemon: use strbuf for hostname info

2015-03-07 Thread René Scharfe
Convert hostname, canon_hostname, ip_address and tcp_port to strbuf. This allows to get rid of the helpers strbuf_addstr_or_null() and STRARG because a strbuf always represents a valid (initially empty) string. sanitize_client() is not needed anymore and sanitize_client_strbuf() takes its place an

[PATCH v2 2/2] daemon: deglobalize hostname information

2015-03-07 Thread René Scharfe
Move the variables related to the client-supplied hostname into its own struct, let execute() own an instance of that instead of storing the information in global variables and pass the struct to any function that needs to access it as a parameter. The lifetime of the variables is easier to see th

Re: [PATCH] daemon: use strbuf for hostname info

2015-03-07 Thread René Scharfe
Am 07.03.2015 um 02:08 schrieb Jeff King: On Sat, Mar 07, 2015 at 01:20:22AM +0100, René Scharfe wrote: Not a big deal, but do we want to rename sanitize_client_strbuf to sanitize_client? It only had the unwieldy name to distinguish it from this one. A patch would look like this. The result

Re: [PATCH] daemon: use strbuf for hostname info

2015-03-06 Thread René Scharfe
Am 06.03.2015 um 22:06 schrieb Jeff King: On Fri, Mar 06, 2015 at 09:57:22AM +0100, René Scharfe wrote: if (port) { - free(tcp_port); - tcp_port = sanitize_client(port

Re: [PATCH] daemon: use strbuf for hostname info

2015-03-06 Thread René Scharfe
Am 06.03.2015 um 22:06 schrieb Jeff King: > On Fri, Mar 06, 2015 at 09:57:22AM +0100, René Scharfe wrote: > >> Convert hostname, canon_hostname, ip_address and tcp_port to strbuf. >> This allows to get rid of the helpers strbuf_addstr_or_null() and STRARG >> because a st

Re: [PATCH] [GSoC][MICRO] Forbid "log --graph --no-walk"

2015-03-06 Thread René Scharfe
Am 06.03.2015 um 09:55 schrieb Dongcan Jiang: Because --graph is about connected history while --no-walk is about discrete points. revision.c: Judge whether --graph and --no-walk come together when running git-log. buildin/log.c: Set git-log cmd flag. Documentation/rev-list-options.txt: Add sp

[PATCH] daemon: use strbuf for hostname info

2015-03-06 Thread René Scharfe
Convert hostname, canon_hostname, ip_address and tcp_port to strbuf. This allows to get rid of the helpers strbuf_addstr_or_null() and STRARG because a strbuf always represents a valid (initially empty) string. sanitize_client() becomes unused and is removed as well. Signed-off-by: Rene Scharfe -

[PATCH] zlib: initialize git_zstream in git_deflate_init{,_gzip,_raw}

2015-03-05 Thread René Scharfe
Clear the git_zstream variable at the start of git_deflate_init() etc. so that callers don't have to do that. Signed-off-by: Rene Scharfe --- archive-zip.c | 2 -- builtin/index-pack.c | 1 - builtin/pack-objects.c | 2 -- bulk-checkin.c | 1 - diff.c | 1 - fa

[PATCH v2] archive-zip: mark text files in archives

2015-03-05 Thread René Scharfe
Set the text flag for ZIP archive entries that look like text files so that unzip -a can be used to perform end-of-line conversions. Info-ZIP zip does the same. Detect binary files the same way as git diff and git grep do, namely by checking for the attribute "diff" and its negation "-diff", and

Re: [PATCH] archive-zip: add --text parameter

2015-03-05 Thread René Scharfe
Am 05.03.2015 um 03:16 schrieb Junio C Hamano: René Scharfe writes: No sign-off, yet, because I'm not sure we really need another option. E.g. --text=all doesn't seem to be actually useful, but it was easy to implement. Info-ZIP's zip always creates archives like --text=auto d

Re: [PATCH] archive-zip: add --text parameter

2015-03-05 Thread René Scharfe
Am 04.03.2015 um 22:13 schrieb René Scharfe: diff --git a/archive-zip.c b/archive-zip.c index 4bde019..3767940 100644 --- a/archive-zip.c +++ b/archive-zip.c @@ -5,6 +5,7 @@ #include "archive.h" #include "streaming.h" #include "utf8.h" +#include "xdiff-

[PATCH] archive-zip: add --text parameter

2015-03-04 Thread René Scharfe
Entries in a ZIP file can be marked as text files. Extractors can use that flag to apply end-of-line conversions. An example is unzip -a. git archive currently marks all ZIP file entries as binary files. This patch adds the new option --text that can be used to mark non-binary files or all file

Re: zip files created with git archive flags text files as binaries

2015-03-04 Thread René Scharfe
Am 23.02.2015 um 20:30 schrieb René Scharfe: Am 23.02.2015 um 14:58 schrieb Ulrike Fischer: The zip contained four text files and a pdf. The CTAN maintainers informed me that all files in the zip are flagged as binaries and this makes it difficult for them to process them further (they want to

Re: Copyright on wildmatch.c

2015-02-24 Thread René Scharfe
Am 24.02.2015 um 13:34 schrieb Guilherme: This is just an email to all the people i have written in private about relicensing the files in need in TSS so they can reply to this email and it be recorded in the mailing list. The files are part of ctypes.c hex.c git-compat-util.h. On Tue, Feb 24,

Re: zip files created with git archive flags text files as binaries

2015-02-23 Thread René Scharfe
Am 23.02.2015 um 14:58 schrieb Ulrike Fischer: I'm using git on windows 7. $ git --version git version 1.9.4.msysgit.0 Git's code for ZIP file creation hasn't changed since then. Some days ago I uploaded a latex package to CTAN (www.ctan.org). I created the zip-file with git archive --forma

Re: [PATCH] sha1_name: use strlcpy() to copy strings

2015-02-22 Thread René Scharfe
Am 22.02.2015 um 21:00 schrieb Junio C Hamano: René Scharfe writes: Use strlcpy() instead of calling strncpy() and then setting the last byte of the target buffer to NUL explicitly. This shortens and simplifies the code a bit. Thanks. It makes me wonder if the longer term direction should

[PATCH] sha1_name: use strlcpy() to copy strings

2015-02-21 Thread René Scharfe
Use strlcpy() instead of calling strncpy() and then setting the last byte of the target buffer to NUL explicitly. This shortens and simplifies the code a bit. Signed-of-by: Rene Scharfe --- sha1_name.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/sha1_name.c b/sha

[PATCH] pretty: use starts_with() to check for a prefix

2015-02-21 Thread René Scharfe
Simplify the code and avoid duplication by using starts_with() instead of strlen() and strncmp() to check if a line starts with "encoding ". Signed-off-by: Rene Scharfe --- pretty.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pretty.c b/pretty.c index 9d34d02..7b49304 100

[PATCH] for-each-ref: use skip_prefix() to avoid duplicate string comparison

2015-02-21 Thread René Scharfe
Use skip_prefix() to get the part after "color:" (if present) and only compare it with "reset" instead of comparing the whole string again. This gets rid of the duplicate "color:" part of the string constant. Signed-off-by: Rene Scharfe --- builtin/for-each-ref.c | 7 +++ 1 file changed, 3 i

[PATCH] connect: use strcmp() for string comparison

2015-02-21 Thread René Scharfe
Get rid of magic string length constants and simply compare the strings using strcmp(). This makes the intent of the code a bit clearer. Signed-off-by: Rene Scharfe --- connect.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/connect.c b/connect.c index 062e133..2a5c400 1

[PATCH 2/2] daemon: use callback to build interpolated path

2015-02-15 Thread René Scharfe
Provide a callback function for strbuf_expand() instead of using the helper strbuf_expand_dict_cb(). While the resulting code is longer, it only looks up the canonical hostname and IP address if at least one of the placeholders %CH and %IP are used with --interpolated-path. Use a struct for passi

[PATCH 1/2] daemon: look up client-supplied hostname lazily

2015-02-15 Thread René Scharfe
Look up canonical hostname and IP address using getaddrinfo(3) or gethostbyname(3) only if --interpolated-path or --access-hook were specified. Do that by introducing getter functions for canon_hostname and ip_address and using them for all read accesses. These wrappers call the new helper lookup

Re: [PATCH] .clang-format: introduce the use of clang-format

2015-01-18 Thread René Scharfe
Am 17.01.2015 um 22:30 schrieb Ramkumar Ramachandra: Instead of manually eyeballing style in reviews, just ask all contributors to run their patches through [git-]clang-format. Signed-off-by: Ramkumar Ramachandra --- The idea is to introduce the community to this new toy I found called clan

Re: [PATCH 1/2] remote: Remove -v/--verbose option from git remote show synopsis

2015-01-08 Thread René Scharfe
Am 08.01.2015 um 18:57 schrieb Alexander Kuleshov: git remote show doesn't use -v/--verbose option Hmm, but it does? $ git version git version 2.2.1 $ git remote show origin $ git remote -v show origin git://git.kernel.org/pub/scm/git/git.git (f

[PATCH] refs: release strbuf after use in check_refname_component()

2014-12-23 Thread René Scharfe
Signed-off-by: Rene Scharfe --- refs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/refs.c b/refs.c index 5fcacc6..ed3b2cb 100644 --- a/refs.c +++ b/refs.c @@ -2334,7 +2334,7 @@ static struct ref_lock *lock_ref_sha1_basic(const char *refname, struct

[PATCH] commit-tree: simplify parsing of option -S using skip_prefix()

2014-12-23 Thread René Scharfe
Signed-off-by: Rene Scharfe --- builtin/commit-tree.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/builtin/commit-tree.c b/builtin/commit-tree.c index 8a66c74..25aa2cd 100644 --- a/builtin/commit-tree.c +++ b/builtin/commit-tree.c @@ -66,10 +66,8 @@ int cmd_commit_tree(i

[PATCH] transport: simplify duplicating a substring in transport_get() using xmemdupz()

2014-12-23 Thread René Scharfe
Signed-off-by: Rene Scharfe --- transport.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/transport.c b/transport.c index 70d38e4..08bcd3a 100644 --- a/transport.c +++ b/transport.c @@ -971,9 +971,7 @@ struct transport *transport_get(struct remote *remote, const char *ur

[PATCH] merge: release strbuf after use in suggest_conflicts()

2014-12-23 Thread René Scharfe
Signed-off-by: Rene Scharfe --- builtin/merge.c | 1 + 1 file changed, 1 insertion(+) diff --git a/builtin/merge.c b/builtin/merge.c index 215d485..d722889 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -894,6 +894,7 @@ static int suggest_conflicts(void) append_conflicts_hint(&m

[PATCH] use strbuf_complete_line() for adding a newline if needed

2014-12-12 Thread René Scharfe
Call strbuf_complete_line() instead of open-coding it. Also remove surrounding comments indicating the intent to complete a line since this information is already included in the function name. Signed-off-by: Rene Scharfe --- builtin/fmt-merge-msg.c | 3 +-- notes-utils.c | 3 +-- tra

[PATCH] use labs() for variables of type long instead of abs()

2014-11-15 Thread René Scharfe
Using abs() on long values can cause truncation, so use labs() instead. Reported by Clang 3.5 (-Wabsolute-value, enabled by -Wall). Signed-off-by: Rene Scharfe --- builtin/receive-pack.c | 2 +- config.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/built

[PATCH] run-command: use void to declare that functions take no parameters

2014-11-10 Thread René Scharfe
Explicitly declare that git_atexit_dispatch() and git_atexit_clear() take no parameters instead of leaving their parameter list empty and thus unspecified. Signed-off-by: Rene Scharfe --- run-command.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/run-command.c b/run-co

Re: [PATCH] use child_process_init() to initialize struct child_process variables

2014-11-09 Thread René Scharfe
Am 29.10.2014 um 18:21 schrieb Jeff King: > On Tue, Oct 28, 2014 at 09:52:34PM +0100, René Scharfe wrote: >> diff --git a/trailer.c b/trailer.c >> index 8514566..7ff036c 100644 >> --- a/trailer.c >> +++ b/trailer.c >> @@ -237,7 +237,7 @@ static const char *

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

2014-11-09 Thread René Scharfe
Am 20.10.2014 um 11:19 schrieb Jeff King: > On Sun, Oct 19, 2014 at 01:14:20PM +0200, René Scharfe wrote: > >> --- a/wt-status.c >> +++ b/wt-status.c >> @@ -726,14 +726,14 @@ static void wt_status_print_changed(struct wt_status >> *s) >> static void wt_s

[PATCH] api-run-command: add missing list item marker

2014-10-28 Thread René Scharfe
Signed-off-by: Rene Scharfe --- Documentation/technical/api-run-command.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/technical/api-run-command.txt b/Documentation/technical/api-run-command.txt index 3f12fcd..a9fdb45 100644 --- a/Documentation/technical/ap

[PATCH] use child_process_init() to initialize struct child_process variables

2014-10-28 Thread René Scharfe
Call child_process_init() instead of zeroing the memory of variables of type struct child_process by hand before use because the former is both clearer and shorter. Signed-off-by: Rene Scharfe --- bundle.c | 2 +- column.c | 2 +- trailer.c | 2 +- transport-helper.c

[PATCH] receive-pack: avoid minor leak in case start_async() fails

2014-10-28 Thread René Scharfe
If the asynchronous start of copy_to_sideband() fails, then any env_array entries added to struct child_process proc by prepare_push_cert_sha1() are leaked. Call the latter function only after start_async() succeeded so that the allocated entries are cleaned up automatically by start_command() or

Re: [PATCH][RFC] grep: add color.grep.matchcontext and color.grep.matchselected

2014-10-28 Thread René Scharfe
Am 28.10.2014 um 00:32 schrieb Zoltan Klinger: > I like René's approach, too. It's more flexible, supports the old > behaviour and it scratches my itch as well. > Don't mind if you dropped my patch and used René's instead. Good. :) And here's the t/ part of your patch, slightly changed to exerci

[PATCH][RFC] grep: add color.grep.matchcontext and color.grep.matchselected

2014-10-27 Thread René Scharfe
The config option color.grep.match can be used to specify the highlighting color for matching strings. Add the options matchContext and matchSelected to allow different colors to be specified for matching strings in the context vs. in selected lines. This is similar to the ms and mc specifiers in

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 writes: Unfortunately, the git archive doc clearly says that the umask is applied to all archive entries. Is an

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 '*' charac

[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. Sign

[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 Signed-off-by: Rene Scharfe --- Documentation/techni

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] 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 --- builtin/receive-pack.c | 18 -- 1 file changed, 8

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 writes: > >> @@ -335,20 +337,18 @@ static int append_ref(const char *refname, const >> unsigned char *sha1, int flags, >> static struct { >> int kind; >> const char

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 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 input to unsigne

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 branc

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

[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 --- builtin/apply.c | 2 +- builtin

[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 Signed-off-by: Rene Scharfe --- Original thread: http://thread.gmane.org/gmane.comp.version-control.git/255140 builtin/mailsplit.c | 1 - 1 file changed, 1 delet

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 the

[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 --- 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 +++ b/bundle.c @@ -2

[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 v2 1/2] sha1-array: add test-sha1-array and basic tests

2014-10-01 Thread René Scharfe
Helped-by: Jeff King Helped-by: Eric Sunshine Signed-off-by: Rene Scharfe --- 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, as suggested by Eric. .gitignore|

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 wrote: Signed-off-by: Rene Scharfe --- 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-array.sh @@ -0,0 +1,64

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 in

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'

[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 --- 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 +815,6 @@ stati

<    5   6   7   8   9   10   11   12   13   14   >