Am 23.10.2016 um 11:11 schrieb Jeff King:
On Sun, Oct 23, 2016 at 11:00:48AM +0200, René Scharfe wrote:
Overflow is defined for unsigned integers, but not for signed ones.
Make the ring buffer index in sha1_to_hex() unsigned to be on the
safe side.
Signed-off-by: Rene Scharfe <l@web
Overflow is defined for unsigned integers, but not for signed ones.
Make the ring buffer index in sha1_to_hex() unsigned to be on the
safe side.
Signed-off-by: Rene Scharfe
---
Hard to trigger, but probably even harder to diagnose once someone
somehow manages to do it on some
Am 21.10.2016 um 12:59 schrieb Duy Nguyen:
On Thu, Oct 20, 2016 at 11:40 PM, René Scharfe <l@web.de> wrote:
I get this on WSL with prove -j8:
Files=750, Tests=13657, 906 wallclock secs ( 8.51 usr 17.17 sys + 282.62 cusr
3731.85 csys = 4040.15 CPU)
And this for a run on Debian
Am 21.10.2016 um 15:10 schrieb Matthieu Moy:
> René Scharfe <l@web.de> writes:
>
>> I get this on WSL with prove -j8:
>>
>> Files=750, Tests=13657, 906 wallclock secs ( 8.51 usr 17.17 sys + 282.62
>> cusr 3731.85 csys = 4040.15 CPU)
>>
>>
Am 20.10.2016 um 13:02 schrieb Duy Nguyen:
> On Wed, Oct 19, 2016 at 4:18 PM, Johannes Schindelin
> wrote:
>> Hi Junio,
>>
>> I know you are a fan of testing things thoroughly in the test suite, but I
>> have to say that it is getting out of hand, in particular due to
Am 18.10.2016 um 17:17 schrieb Raffael Reichelt:
Hello!
I have a serious problem with git, After my provider had updated to a
X86_64 architecture git crashes with various memory-related errors.
This is happening remote when pushing to the repository from my local
machine as well as trying it on
Am 17.10.2016 um 22:07 schrieb Junio C Hamano:
Ramsay Jones writes:
Heh, I actually have the following in my config.mak already:
extra-clean: clean
find . -iname '*.o' -exec rm {} \;
But for some reason I _always_ type 'make clean' and then, to top
it
Am 17.10.2016 um 20:08 schrieb Junio C Hamano:
> ... oops. Totally unrelated to this patch, but I see these in
> strbuf.cocci.patch (this is at the tip of 'pu'), which are total
> nonsense. Perhaps I am running a way-stale spatch? It claims to be
> "spatch version 1.0.0-rc19 with Python support
Am 15.10.2016 um 19:13 schrieb Jeff King:
> On Sat, Oct 15, 2016 at 06:23:11PM +0200, René Scharfe wrote:
>
>> Calculating offsets involving a NULL pointer is undefined. It works in
>> practice (for now?), but we should not rely on it. Allocate first and
>> then simp
Calculating offsets involving a NULL pointer is undefined. It works in
practice (for now?), but we should not rely on it. Allocate first and
then simply refer to the flexible array member by its name instead of
performing pointer arithmetic up front. The resulting code is slightly
shorter,
The object_id functions oid_to_hex, oid_to_hex_r, oidclr, oidcmp, and
oidcpy are defined as wrappers of their legacy counterparts sha1_to_hex,
sha1_to_hex_r, hashclr, hashcmp, and hashcpy, respectively. Make sure
that the Coccinelle transformations for converting legacy function calls
are not
Helped-by: Jeff King
Signed-off-by: Rene Scharfe
---
Removed confusing and unnecessary reference to the "colors" paragraph.
Documentation/pretty-formats.txt | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/Documentation/pretty-formats.txt
Am 10.10.2016 um 01:46 schrieb Jeff King:
>> diff --git a/Documentation/pretty-formats.txt
>> b/Documentation/pretty-formats.txt
>> index a942d57..89e3bc6 100644
>> --- a/Documentation/pretty-formats.txt
>> +++ b/Documentation/pretty-formats.txt
>> @@ -166,7 +166,8 @@ endif::git-rev-list[]
>> -
Am 10.10.2016 um 02:00 schrieb Jeff King:
> On Sat, Oct 08, 2016 at 05:38:47PM +0200, René Scharfe wrote:
>
>> Call strbuf_add_unique_abbrev() to add abbreviated hashes to strbufs
>> instead of taking detours through find_unique_abbrev() and its static
>> buffer. This
Am 10.10.2016 um 19:42 schrieb Jeff King:
On Mon, Oct 10, 2016 at 07:09:12PM +0200, René Scharfe wrote:
diff --git a/pretty.c b/pretty.c
index 25efbca..73e58b5 100644
--- a/pretty.c
+++ b/pretty.c
@@ -965,22 +965,31 @@ static size_t parse_color(struct strbuf *sb, /* in UTF-8
Am 10.10.2016 um 17:15 schrieb Jeff King:
On Mon, Oct 10, 2016 at 10:28:18AM -0400, Jeff King wrote:
We could add some new tag to change the behavior of all following %C
tags. Something like %C(tty) maybe (probably a bad name), then
discourage the use if "%C(auto" for terminal detection?
Am 09.10.2016 um 12:04 schrieb Tom Hale:
> On 2016-10-09 13:47, René Scharfe wrote:
>
>> %Cgreen emits color codes unconditionally. %C(auto,green) would respect
>> the config settings.
>
> Thanks, I've never seen the (,) syntax documented before!
Both the prefix "
Am 09.10.2016 um 07:43 schrieb Tom Hale:
$ ~/repo/git/git --version
git version 2.10.0.GIT
The `git-log` man page says:
`auto` alone (i.e. %C(auto)) will turn on auto coloring on the next
placeholders until the color is switched again.
In this example:
http://i.imgur.com/y3yLxk7.png
I turn
Call strbuf_add_unique_abbrev() to add abbreviated hashes to strbufs
instead of taking detours through find_unique_abbrev() and its static
buffer. This is shorter in most cases and a bit more efficient.
The changes here are not easily handled by a semantic patch because
they involve removing
free(3) handles NULL pointers just fine. Add a semantic patch for
removing unnecessary NULL checks before calling this function, and
apply it on the code base.
Signed-off-by: Rene Scharfe
---
contrib/coccinelle/free.cocci | 5 +
parse-options-cb.c| 3 +--
2 files
Am 08.10.2016 um 01:58 schrieb Stefan Beller:
Signed-off-by: Stefan Beller
---
remote.c | 4
1 file changed, 4 insertions(+)
diff --git a/remote.c b/remote.c
index ad6c542..5f9afb4 100644
--- a/remote.c
+++ b/remote.c
@@ -833,6 +833,8 @@ static int
Am 07.10.2016 um 02:46 schrieb Jeff King:
On Tue, Sep 27, 2016 at 09:11:58PM +0200, René Scharfe wrote:
Call strbuf_add_unique_abbrev() to add abbreviated hashes to strbufs
instead of taking detours through find_unique_abbrev() and its static
buffer. This is shorter and a bit more efficient
Am 03.10.2016 um 22:33 schrieb Jeff King:
This series is the result of René nerd-sniping me with the claim that we
could "easily" teach count-objects to print out the list of alternates
in:
http://public-inbox.org/git/c27dc1a4-3c7a-2866-d9d8-f5d3eb161...@web.de/
1. Send crappy patch
2.
Am 03.10.2016 um 22:34 schrieb Jeff King:
When we add a new alternate to the list, we try to normalize
out any redundant "..", etc. However, we do not look at the
return value of normalize_path_copy(), and will happily
continue with a path that could not be normalized. Worse,
the normalizing
Am 03.10.2016 um 22:36 schrieb Jeff King:
There's no way to get the list of alternates that git
computes internally; our tests only infer it based on which
objects are available. In addition to testing, knowing this
list may be helpful for somebody debugging their alternates
setup.
Let's add it
Am 04.10.2016 um 07:28 schrieb Kevin Bracey:
On 04/10/2016 01:00, René Scharfe wrote:
Am 03.10.2016 um 19:09 schrieb Kevin Bracey:
As such, NULL checks can still be elided even with your change. If you
effectively change your example to:
if (nmemb > 1)
qsort(array, nmemb, s
Am 03.10.2016 um 19:09 schrieb Kevin Bracey:
As such, NULL checks can still be elided even with your change. If you
effectively change your example to:
if (nmemb > 1)
qsort(array, nmemb, size, cmp);
if (!array)
printf("array is NULL\n");
array may only be checked for
suggest:
From c2716458f05893ca88c05ce211a295a330e74590 Mon Sep 17 00:00:00 2001
From: René Scharfe <l@web.de>
Date: Sat, 24 Sep 2016 13:30:22 +0200
Subject: [PATCH] git-gui: stop using deprecated merge syntax
Starting with v2.5.0 git merge can handle FETCH_HEAD internally and
warns whe
Am 15.09.2016 um 23:39 schrieb Junio C Hamano:
> René Scharfe <l@web.de> writes:
>
>> Am 15.09.2016 um 22:01 schrieb Junio C Hamano:
>>> René Scharfe <l@web.de> writes:
>>>
>>>> Take this for example:
>>>
Am 30.09.2016 um 21:36 schrieb Jeff King:
> We adjust the test script here to demonstrate that this now
> works. Unfortunately, we can't demonstrate that the
> duplicate is suppressed, since it has no user-visible
> behavior (it's just one less place for our object lookups to
> go). But you can
Am 30.09.2016 um 00:36 schrieb Junio C Hamano:
> 3. builtin/show-branch.c does this:
>
> qsort(ref_name + bottom, top - bottom, sizeof(ref_name[0]),
> compare_ref_name);
>
> where ref_name[] is a file-scope global:
>
> static char *ref_name[MAX_REVS + 1];
>
> and top and
Am 30.09.2016 um 01:21 schrieb René Scharfe:
> Am 30.09.2016 um 00:36 schrieb Junio C Hamano:
>> René Scharfe <l@web.de> writes:
>>
>>> Add the macro QSORT, a convenient wrapper for qsort(3) that infers the
>>> size of the array elements and supports t
Am 30.09.2016 um 00:36 schrieb Junio C Hamano:
> René Scharfe <l@web.de> writes:
>
>> Add the macro QSORT, a convenient wrapper for qsort(3) that infers the
>> size of the array elements and supports the convention of initializing
>> empty arrays with a NULL
Am 17.09.2016 um 20:25 schrieb René Scharfe:
> diff --git a/pretty.c b/pretty.c
> index 9788bd8..493edb0 100644
> --- a/pretty.c
> +++ b/pretty.c
> @@ -1072,6 +1072,8 @@ static size_t format_commit_one(struct strbuf *sb, /*
> in UTF-8 */
> case 'C':
>
Add the macro QSORT, a convenient wrapper for qsort(3) that infers the
size of the array elements and supports the convention of initializing
empty arrays with a NULL pointer, which we use in some places.
Calling qsort(3) directly with a NULL pointer is undefined -- even with
an element count of
Add a semantic patch for removing checks similar to the one that QSORT
already does internally and apply it to the code base.
Signed-off-by: Rene Scharfe
---
builtin/fmt-merge-msg.c| 10 --
contrib/coccinelle/qsort.cocci | 18 ++
sh-i18n--envsubst.c
Apply the semantic patch contrib/coccinelle/qsort.cocci to the code
base, replacing calls of qsort(3) with QSORT. The resulting code is
shorter and supports empty arrays with NULL pointers.
Signed-off-by: Rene Scharfe
---
Freshly generated using coccicheck, compiles, survives make
Am 27.09.2016 um 22:28 schrieb Junio C Hamano:
> René Scharfe <l@web.de> writes:
>> diff --git a/submodule.c b/submodule.c
>> index dcc5ce3..8cf40ea 100644
>> --- a/submodule.c
>> +++ b/submodule.c
>> @@ -396,7 +396,7 @@ static void show_submodu
Am 27.09.2016 um 21:52 schrieb Jakub Narębski:
> W dniu 27.09.2016 o 21:01, René Scharfe pisze:
>> Signed-off-by: Rene Scharfe <l@web.de>
>> ---
>> .gitignore | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/.gitignore
Call strbuf_add_unique_abbrev() to add abbreviated hashes to strbufs
instead of taking detours through find_unique_abbrev() and its static
buffer. This is shorter and a bit more efficient.
1eb47f167d65d1d305b9c196a1bb40eb96117cb1 already converted six cases,
this patch covers three more.
A
Replace uses of strbuf_addf() for adding strings with more lightweight
strbuf_addstr() calls. This is shorter and makes the intent clearer.
bc57b9c0cc5a123365a922fa1831177e3fd607ed already converted three cases,
this patch covers two more.
A semantic patch for Coccinelle is included for easier
Signed-off-by: Rene Scharfe
---
.gitignore | 1 +
1 file changed, 1 insertion(+)
diff --git a/.gitignore b/.gitignore
index 05cb58a..f370ba0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -207,6 +207,7 @@
/tags
/TAGS
/cscope*
+/contrib/coccinelle/*.patch*
*.obj
*.lib
*.res
--
Am 25.09.2016 um 09:41 schrieb Jeff King:
On Sun, Sep 25, 2016 at 09:15:42AM +0200, René Scharfe wrote:
It checks if the multiplication of size and element count overflows.
The inferred size is passed first to st_mult, which allows the division
there to be done at compilation time.
I wonder
Ha, can't count. It should be [PATCH 2/2] of course.
René
Add a semantic patch for converting certain calls of memcpy(3) to
COPY_ARRAY() and apply that transformation to the code base. The result
is
shorter and safer code. For now only consider calls where source and
destination have the same type, or in other words: easy cases.
Signed-off-by: Rene
Add COPY_ARRAY, a safe and convenient helper for copying arrays,
complementing ALLOC_ARRAY and REALLOC_ARRAY. Users just specify source,
destination and the number of elements; the size of an element is
inferred automatically.
It checks if the multiplication of size and element count overflows.
Starting with v2.5.0 git merge can handle FETCH_HEAD internally and
warns when it's called like 'git merge HEAD ' because
that syntax is deprecated. Use this feature in git-gui and get rid of
that warning.
Signed-off-by: Rene Scharfe
---
Tested only _very_ lightly!
Add a static initializer for struct checkout and use it throughout the
code base. It's shorter, avoids a memset(3) call and makes sure the
base_dir member is initialized to a valid (empty) string.
Signed-off-by: Rene Scharfe
---
apply.c | 4 +---
Am 18.09.2016 um 14:30 schrieb Anatoly Borodin:
On Sat, Sep 17, 2016 at 8:25 PM, René Scharfe <l@web.de> wrote:
I'm not sure how just how automatic %C(auto) is supposed to be, but you
expected it do emit the reset for you, right? Sounds reasonable to me.
I don't see a good
Am 17.09.2016 um 14:51 schrieb Anatoly Borodin:
> Hi All!
>
> First bug:
>
> git log -3 --pretty='%C(cyan)%C(auto)%h%C(auto)%d %s'
>
> prints %h with the default color (normal yellow), but
>
> git log -3 --pretty='%C(bold cyan)%C(auto)%h%C(auto)%d %s'
>
> shows %h with bold
Am 15.09.2016 um 22:01 schrieb Junio C Hamano:
> René Scharfe <l@web.de> writes:
>
>> Take this for example:
>>
>> -strbuf_addf(>obuf, _("(bad commit)\n"));
>> +strbuf_addstr(>obuf, _("(bad co
Am 15.09.2016 um 21:38 schrieb Jeff King:
On Thu, Sep 15, 2016 at 12:25:43PM -0700, Junio C Hamano wrote:
Silly question: Is there a natural language that uses percent signs
as letters or e.g. instead of commas? :)
I don't know, but if they do, they'd better get used to escaping them.
:)
I
Provide a simple way to run Coccinelle against all source files, in the
form of a Makefile target. Running "make coccicheck" applies each
.cocci file in contrib/coccinelle/ on all source files. It generates
a .patch file for each .cocci file, containing the actual changes for
effecting the
Replace uses of strbuf_addf() for adding strings with more lightweight
strbuf_addstr() calls. This makes the intent clearer and avoids
potential issues with printf format specifiers.
02962d36845b89145cd69f8bc65e015d78ae3434 already converted six cases,
this patch covers eleven more.
A semantic
Both sha1_to_hex_r() and oid_to_hex_r() take two parameters, so use two
expressions in the semantic patch for transforming calls of the former
to the latter one.
Signed-off-by: Rene Scharfe
---
contrib/coccinelle/object_id.cocci | 12 ++--
1 file changed, 6 insertions(+),
If the function context for a hunk (with -W) reaches the beginning of
the next hunk then we need to merge these two -- otherwise we'd show
some lines twice, which looks strange and even confuses git apply. We
already do this checking and merging in xdl_emit_diff(), but forget to
consider regular
Sort the linked list of packs directly using llist_mergesort() instead
of building an array, calling qsort(3) and fixing up the list pointers.
This is shorter and less complicated.
Signed-off-by: Rene Scharfe
---
Peff: Or do you have other plans, e.g. to replace packed_git with
Add a parameter for the struct checkout variable to check_updates()
instead of using a static global variable. Passing it explicitly makes
object ownership and usage more easily apparent. And we get rid of a
static variable; those can be problematic in library-like code.
Signed-off-by: Rene
Document the fact that checkout_stage() and checkout_merged() don't
change the objects passed to them by adding the modifier const.
Signed-off-by: Rene Scharfe
---
builtin/checkout.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/builtin/checkout.c
The fourth argument of strbuf_splice() is passed to memcpy(3), which is
not supposed to handle NULL pointers. Let's be extra careful and use a
valid empty string instead. It even shortens the source code. :)
Signed-off-by: Rene Scharfe
---
strbuf.c | 2 +-
1 file changed, 1
Am 13.09.2016 um 06:45 schrieb Stefan Beller:
In a later patch, I want to propose an option to detect
moved lines in a diff, which cannot be done in a one-pass over
the diff. Instead we need to go over the whole diff twice,
because we cannot detect the first line of the two corresponding
lines
Am 04.09.2016 um 09:49 schrieb Johannes Schindelin:
Hi René,
On Sat, 3 Sep 2016, René Scharfe wrote:
Add and use a helper function that decodes the char value of two
hexadecimal digits. It returns a negative number on error, avoids
running over the end of the given string and doesn't shift
discussion you started
about compiler warnings in that code.
On Sat, 3 Sep 2016, René Scharfe wrote:
Move our implementation of strdup(3) out of compat/nedmalloc/ and allow
it to be used independently from USE_NED_ALLOCATOR. This reduces the
difference of our copy of nedmalloc from
Add and use a helper function that decodes the char value of two
hexadecimal digits. It returns a negative number on error, avoids
running over the end of the given string and doesn't shift negative
values.
Signed-off-by: Rene Scharfe
---
cache.h | 10 ++
hex.c
Move our implementation of strdup(3) out of compat/nedmalloc/ and allow
it to be used independently from USE_NED_ALLOCATOR. This reduces the
difference of our copy of nedmalloc from the original, making it easier
to update, and allows for easier testing and reusing of our version of
strdup().
Signed-off-by: Rene Scharfe
---
This script was added by v2.10.0-rc0~3^2.
t/perf/p3400-rebase.sh | 0
1 file changed, 0 insertions(+), 0 deletions(-)
mode change 100644 => 100755 t/perf/p3400-rebase.sh
diff --git a/t/perf/p3400-rebase.sh b/t/perf/p3400-rebase.sh
old mode 100644
Am 22.08.2016 um 13:22 schrieb Michael Haggerty:
"git blame" already parsed generic diff options from the command line
via diff_opt_parse(), but instead of passing the resulting xdl_opts to
xdi_diff(), it sent its own xdl_opts, which only reflected the values of
the self-parsed options "-w" and
Am 13.08.2016 um 11:09 schrieb Jeff King:
On Sat, Aug 13, 2016 at 11:01:21AM +0200, René Scharfe wrote:
This section is about "The FLEXPTR_* variants", so use FLEXPTR_ALLOC_STR
in the example.
Oops, yeah. Your patch is clearly an improvement.
Since this is obviously an easy mista
Use the macro FLEX_ALLOC_MEM instead of open-coding it. This shortens
and simplifies the code a bit.
Signed-off-by: Rene Scharfe
---
builtin/receive-pack.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index
Convert the name member of struct merge_remote_desc to a FLEX_ARRAY and
use FLEX_ALLOC_STR to build the struct. This halves the number of
memory allocations, saves the storage for a pointer and avoids an
indirection when reading the name.
Suggested-by: Jeff King
Signed-off-by:
One of the indirect callers of make_virtual_commit() passes the result of
oid_to_hex() as the name, i.e. a pointer to a static buffer. Since the
function uses that string pointer directly in building a struct
merge_remote_desc, multiple entries can end up sharing the same name
inadvertently.
Fix
Export a helper function for allocating, populating and attaching a
merge_remote_desc to a commit.
Signed-off-by: Rene Scharfe
---
commit.c | 19 ---
commit.h | 2 ++
2 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/commit.c b/commit.c
index
Handle allocation errors for the name member just like we already do
for the struct merge_remote_desc itself.
Signed-off-by: Rene Scharfe
---
commit.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/commit.c b/commit.c
index 71a360d..ccd232a 100644
---
Am 13.08.2016 um 11:23 schrieb Jeff King:
On Sat, Aug 13, 2016 at 11:14:31AM +0200, René Scharfe wrote:
Add a helper function for allocating, populating and attaching struct
merge_remote_desc to a commit and use it consistently. It allocates the
necessary memory in a single block.
commit.c
Am 13.08.2016 um 11:09 schrieb Jeff King:
On Sat, Aug 13, 2016 at 11:01:21AM +0200, René Scharfe wrote:
This section is about "The FLEXPTR_* variants", so use FLEXPTR_ALLOC_STR
in the example.
Oops, yeah. Your patch is clearly an improvement.
Since this is obviously an easy mista
Add a helper function for allocating, populating and attaching struct
merge_remote_desc to a commit and use it consistently. It allocates the
necessary memory in a single block.
commit.c::get_merge_parent() forgot to check for memory allocation
failures of strdup(3).
handle_message_id() duplicates the contents of the strbuf that is passed
to it. Its only caller proceeds to release the strbuf immediately after
that. Reuse it instead and make that change of object ownership more
obvious by inlining this short function.
Signed-off-by: Rene Scharfe
This section is about "The FLEXPTR_* variants", so use FLEXPTR_ALLOC_STR
in the example.
Signed-off-by: Rene Scharfe
---
git-compat-util.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/git-compat-util.h b/git-compat-util.h
index 590bfdd..f52e00b 100644
---
Am 06.08.2016 um 01:26 schrieb Stefan Beller:
When moving code around, we usually get large chunks of text. If the contributor
is not 100% trustworthy, we need to review all the code without much intelectual
joy. Essentially the reviewer is just making sure the parts of the text are the
same.
Call strbuf_add_unique_abbrev() to add abbreviated hashes to strbufs
instead of taking detours through find_unique_abbrev() and its static
buffer. This is shorter and a bit more efficient.
Signed-off-by: Rene Scharfe
---
builtin/checkout.c | 3 +--
pretty.c | 13
The function write_extended_header() only ever returns 0. Simplify
it and its caller by dropping its return value, like we did with
write_global_extended_header() earlier.
Signed-off-by: Rene Scharfe
---
archive-tar.c | 15 +--
1 file changed, 5 insertions(+), 10
. :) Minor comments below.
Thanks.
-- >8 --
From: René Scharfe <l@web.de>
Date: Thu, 4 Aug 2016 23:56:54 +0200
Subject: [PATCH] nedmalloc: work around overzealous GCC 6 warning
With GCC 6, the strdup() function is declared with the "nonnull"
attribute, stating that
Call string_list_split() for cutting a space separated list into pieces
instead of reimplementing it based on struct strategy. The attr member
of struct strategy was not used split_merge_strategies(); it was a pure
string operation. Also be nice and clean up once we're done splitting;
the old
Initialize a string_list right when it's defined. That's shorter, saves
a function call and makes it more obvious that we're using the NODUP
variant here.
Signed-off-by: Rene Scharfe
---
merge-recursive.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git
Initialize struct child_process variables already when they're defined.
That's shorter and saves a function call.
Signed-off-by: Rene Scharfe
---
builtin/submodule--helper.c | 3 +--
builtin/worktree.c | 6 ++
2 files changed, 3 insertions(+), 6 deletions(-)
diff
Call strbuf_addstr() for adding a simple string to a strbuf instead of
using the heavier strbuf_addf(). This is shorter and documents the
intent more clearly.
Signed-off-by: Rene Scharfe
---
builtin/fmt-merge-msg.c | 2 +-
http.c | 2 +-
sequencer.c |
Am 04.08.2016 um 18:07 schrieb Johannes Schindelin:
With GCC 6, the strdup() function is declared with the "nonnull"
attribute, stating that it is not allowed to pass a NULL value as
parameter.
In nedmalloc()'s reimplementation of strdup(), Postel's Law is heeded
and NULL parameters are handled
The result of st_mult() is the same no matter the order of its
arguments. It invokes the macro unsigned_mult_overflows(), which
divides the second parameter by the first one. Pass constants
first to allow that division to be done already at compile time.
Signed-off-by: Rene Scharfe
Replace uses of strbuf_addf() for adding strings with more lightweight
strbuf_addstr() calls.
In http-push.c it becomes easier to see what's going on without having
to verfiy that the definition of PROPFIND_ALL_REQUEST doesn't contain
any format specifiers.
Signed-off-by: Rene Scharfe
Am 20.07.2016 um 10:25 schrieb Heiko Voigt:
Hi,
On Tue, Jul 19, 2016 at 09:05:43PM +0200, René Scharfe wrote:
Use a string constant instead of an empty strbuf to shorten the code
and make it easier to read.
This must have been some oversight from my original code. I also can not
see any
Am 20.07.2016 um 15:20 schrieb Jeff King:
> On Tue, Jul 19, 2016 at 08:36:29PM +0200, René Scharfe wrote:
>
>> Use strbuf_addbuf() where possible; it's shorter and more efficient.
>
> After seeing "efficient", I was momentarily surprised by the first hunk:
>
Use a string constant instead of an empty strbuf to shorten the code
and make it easier to read.
Signed-off-by: Rene Scharfe
---
... unless someone can come up with a suitable non-empty string to feed
to git_config_from_mem() as its name parameter.
submodule-config.c | 3 +--
1
Use strbuf_addbuf() where possible; it's shorter and more efficient.
Signed-off-by: Rene Scharfe
---
dir.c | 2 +-
path.c | 2 +-
wt-status.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/dir.c b/dir.c
index 6172b34..0ea235f 100644
--- a/dir.c
Am 16.07.2016 um 21:12 schrieb n...@dad.org:
I am trying to learn how to use git, and am having difficulty using 'git diff'.
I can't deal with its output very well.
The other replies covered how to use the system's own diff instead.
Just curious: What makes using git diff difficult and its
absolute_path() is a wrapper for strbuf_add_absolute_path(). Call the
latter directly for adding absolute paths to a strbuf. That's shorter
and avoids an extra string copy.
Signed-off-by: Rene Scharfe
---
worktree.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff
Don't throw the memory allocated for remove_dir_recursively() away after
a single call, use it for the other entries as well instead.
Signed-off-by: Rene Scharfe
---
builtin/rm.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/builtin/rm.c b/builtin/rm.c
Am 08.07.2016 um 11:04 schrieb Jeff King:
Here it is. There actually weren't that many spots to clean up, as quite
a few of them have a "twist" where they want to do something clever,
like open the file and feed the descriptor to a sub-function, or open
with funny things like O_EXCL.
But still,
Hi Dscho,
Am 08.07.2016 um 08:33 schrieb Johannes Schindelin:
On Thu, 7 Jul 2016, René Scharfe wrote:
write_file() either returns 0 or dies, so there is no point in checking
its return value.
The question is whether it makes sense for write_file() to die(). It is a
library function
Set the diff attribute for C source file to "cpp" in order to improve
git's ability to determine hunk headers. In particular it helps avoid
showing unindented labels in hunk headers. That in turn is useful for
git diff -W and git grep -W, which show whole functions now instead of
stopping at a
Use the open(2) flag O_EXCL to ensure the file doesn't already exist
instead of (racily) calling stat(2) through file_exists(). While at it
switch to xopen() to reduce code duplication and get more consistent
error messages.
Signed-off-by: Rene Scharfe
---
notes-merge.c | 6
601 - 700 of 1163 matches
Mail list logo