Re: [PATCH] merge-recursive: check GIT_MERGE_VERBOSITY only once

2017-10-25 Thread Andrey Okoshkin
t regards, Andrey Okoshkin

Re: [PATCH] merge-recursive: check GIT_MERGE_VERBOSITY only once

2017-10-25 Thread Andrey Okoshkin
adable/maintainable when presenting this part of the code > to the user.) > > With or without this change: > Reviewed-by: Stefan Beller Yes, in current situation it's more for readability. And I'll make the usage of merge_verbosity just after the assignment. -- Best regards, Andrey Okoshkin

Re: [PATCH] merge-recursive: check GIT_MERGE_VERBOSITY only once

2017-10-25 Thread Andrey Okoshkin
24.10.2017 22:52, Jeff King wrote: > On Tue, Oct 24, 2017 at 07:11:24PM +0200, Martin Ă…gren wrote: > >> On 24 October 2017 at 18:45, Eric Sunshine wrote: >>> On Tue, Oct 24, 2017 at 12:28 PM, Stefan Beller wrote: >>>> On Tue, Oct 24, 2017 at 8:27 AM, Andrey

[PATCH v2] merge-recursive: check GIT_MERGE_VERBOSITY only once

2017-10-25 Thread Andrey Okoshkin
ned-off-by: Andrey Okoshkin Reviewed-by: Stefan Beller --- Changes since the previous patch: * no actions are taken between the merge_verbosity assignment and check. merge-recursive.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/merge-recursive.c b/merge-recursive.c index

Re: [PATCH v2] merge-recursive: check GIT_MERGE_VERBOSITY only once

2017-10-25 Thread Andrey Okoshkin
Thanks, Eric, indeed it's better to change the commit message. 25.10.2017 14:53, Eric Sunshine wrote: > On Wed, Oct 25, 2017 at 7:39 AM, Andrey Okoshkin > wrote: >> Check 'GIT_MERGE_VERBOSITY' environment variable only once in >> init_merge_options(). >

Re: [PATCH v3] merge-recursive: check GIT_MERGE_VERBOSITY only once

2017-10-25 Thread Andrey Okoshkin
trtol() as these environment related functions could modify the string pointer returned by the initial getenv() call. Signed-off-by: Andrey Okoshkin --- I tried to rework the commit message. merge-recursive.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/merge-rec

[PATCH] diff: fix lstat() error handling in diff_populate_filespec()

2017-10-27 Thread Andrey Okoshkin
Add lstat() error handling not only for ENOENT case. Otherwise uninitialised 'struct stat st' variable is used later in case of lstat() non-ENOENT failure which leads to processing of rubbish values of file mode ('S_ISLNK(st.st_mode)' check) or size ('xsize_t(st.st_size)&

[PATCH v4] merge-recursive: check GIT_MERGE_VERBOSITY only once

2017-10-30 Thread Andrey Okoshkin
trtol() as these environment related functions could modify the string pointer returned by the initial getenv() call. Signed-off-by: Andrey Okoshkin Reviewed-by: Stefan Beller --- Added 'reviewed-by' field. merge-recursive.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-)

Re: [PATCH v4] merge-recursive: check GIT_MERGE_VERBOSITY only once

2017-10-31 Thread Andrey Okoshkin
ade via the environment as the one we checked earlier), and I > can understand that it feels a bit redundant and ugly. Yes, you absolutely right. I believe this patch makes code more beautiful :-) >>> Signed-off-by: Andrey Okoshkin >>> Reviewed-by: Stefan Beller >

[PATCH v5] merge-recursive: check GIT_MERGE_VERBOSITY only once

2017-10-31 Thread Andrey Okoshkin
Get rid of the duplicated getenv('GIT_MERGE_VERBOSITY') calls with the same constant string argument. This makes code more readable and prevents typo in the further development. Signed-off-by: Andrey Okoshkin Reviewed-by: Stefan Beller --- Commit message is reworked according to th

[PATCH] commit: check result of resolve_ref_unsafe

2017-10-18 Thread Andrey Okoshkin
Add check of the resolved HEAD reference while printing of a commit summary. resolve_ref_unsafe() may return NULL pointer if underlying calls of lstat() or open() fail in files_read_raw_ref(). Such situation can be caused by race: file becomes inaccessible to this moment. Signed-off-by: Andrey

Re: [PATCH] commit: check result of resolve_ref_unsafe

2017-10-19 Thread Andrey Okoshkin
x27;t know how much trouble it is worth going to for that. It's buried behind a ref_transaction, and I don't think builtin/commit.c ever sees the real name (though maybe it would be a good feature of the transaction to record the destinations of any symrefs we updated). -- Best regards, Andrey Okoshkin

[PATCH v2] commit: check result of resolve_ref_unsafe

2017-10-19 Thread Andrey Okoshkin
: Andrey Okoshkin --- Thank you for your review. Changes since the previous patch: * BUG is replaced with die, message; * Message is changed. builtin/commit.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/builtin/commit.c b/builtin/commit.c index 1a0da71a4..cc27c9af7 100644 --- a/builtin

Re: [PATCH v2] commit: check result of resolve_ref_unsafe

2017-10-20 Thread Andrey Okoshkin
19.10.2017 20:44, Jeff King wrote: On Thu, Oct 19, 2017 at 12:36:50PM +0300, Andrey Okoshkin wrote: Thanks, this looks good to me. One other possible minor improvement: head = resolve_ref_unsafe("HEAD", 0, junk_oid.hash, NULL); + if (!head) + die(_(

[PATCH v3] commit: check result of resolve_ref_unsafe

2017-10-20 Thread Andrey Okoshkin
Add check of the resolved HEAD reference while printing of a commit summary. resolve_ref_unsafe() may return NULL pointer if underlying calls of lstat() or open() fail in files_read_raw_ref(). Such situation can be caused by race: file becomes inaccessible to this moment. Signed-off-by: Andrey

[PATCH v4] commit: check result of resolve_ref_unsafe

2017-10-20 Thread Andrey Okoshkin
Add check of the resolved HEAD reference while printing of a commit summary. resolve_ref_unsafe() may return NULL pointer if underlying calls of lstat() or open() fail in files_read_raw_ref(). Such situation can be caused by race: file becomes inaccessible to this moment. Signed-off-by: Andrey

[PATCH] path: use xmalloc in add_to_trie

2017-10-24 Thread Andrey Okoshkin
Add usage of xmalloc() instead of malloc() in add_to_trie() as xmalloc wraps and checks memory allocation result. Signed-off-by: Andrey Okoshkin --- Hello, I'm not sure but it looks like there is a missing check of the malloc result. memcpy() may crash with SIGSEGV due to the memory alloc

[PATCH] merge-recursive: check GIT_MERGE_VERBOSITY only once

2017-10-24 Thread Andrey Okoshkin
thread as getenv() is not thread-safe. Signed-off-by: Andrey Okoshkin --- merge-recursive.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/merge-recursive.c b/merge-recursive.c index 1494ffdb8..eaac98145 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -2163