[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 <a.okosh...@samsung.com> Reviewed-by: Stefan Beller <sbel...@google.com>

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

2017-10-31 Thread Andrey Okoshkin
t the end > user made 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 <a.okosh...@samsung.com>

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

2017-10-30 Thread Andrey Okoshkin
() as these environment related functions could modify the string pointer returned by the initial getenv() call. Signed-off-by: Andrey Okoshkin <a.okosh...@samsung.com> Reviewed-by: Stefan Beller <sbel...@google.com> --- Added 'reviewed-by' field. merge-recursive.c | 7 --- 1 fil

[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)'). Signed-off-by: Andrey

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

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

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 <a.okosh...@samsung.com> > wrote: >> Check 'GIT_MERGE_VERBOSITY' environment variable only once in >> init_merge_opt

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

2017-10-25 Thread Andrey Okoshkin
-by: Andrey Okoshkin <a.okosh...@samsung.com> Reviewed-by: Stefan Beller <sbel...@google.com> --- 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 -

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

2017-10-25 Thread Andrey Okoshkin
;>>> On Tue, Oct 24, 2017 at 8:27 AM, Andrey Okoshkin <a.okosh...@samsung.com> >>>> wrote: >>>>> Add check of 'GIT_MERGE_VERBOSITY' environment variable only once in >>>>> init_merge_options(). >>>>> Consequential call of ge

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

2017-10-25 Thread Andrey Okoshkin
e/maintainable when presenting this part of the code > to the user.) > > With or without this change: > Reviewed-by: Stefan Beller <sbel...@google.com> 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
t regards, Andrey Okoshkin

[PATCH] merge-recursive: check GIT_MERGE_VERBOSITY only once

2017-10-24 Thread Andrey Okoshkin
as getenv() is not thread-safe. Signed-off-by: Andrey Okoshkin <a.okosh...@samsung.com> --- 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

[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 <a.okosh...@samsung.com> --- Hello, I'm not sure but it looks like there is a missing check of the malloc result. memcpy() may crash with SIGSE

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

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 v2] commit: check result of resolve_ref_unsafe

2017-10-19 Thread Andrey Okoshkin
-by: Andrey Okoshkin <a.okosh...@samsung.com> --- 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..cc2

Re: [PATCH] commit: check result of resolve_ref_unsafe

2017-10-19 Thread Andrey Okoshkin
now 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] 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