From 4fb40c2b8206f7bdffedd8d58d2f9c031227b01b Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Sat, 15 Jan 2011 19:08:42 -0600 Subject: [PATCH 1/3] ll-merge: simplify opts == NULL case As long as sizeof(struct ll_merge_options) is small, there is not much reason not to keep a copy of the default merge options in the BSS section. In return, we get clearer code and one less stack frame in the opts == NULL case. Signed-off-by: Jonathan Nieder Signed-off-by: Junio C Hamano --- ll-merge.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/ll-merge.c b/ll-merge.c index 007dd3e4d3..6ce512efc4 100644 --- a/ll-merge.c +++ b/ll-merge.c @@ -351,16 +351,13 @@ int ll_merge(mmbuffer_t *result_buf, const struct ll_merge_options *opts) { static struct git_attr_check check[2]; + static const struct ll_merge_options default_opts; const char *ll_driver_name = NULL; int marker_size = DEFAULT_CONFLICT_MARKER_SIZE; const struct ll_merge_driver *driver; - if (!opts) { - struct ll_merge_options default_opts = {0}; - return ll_merge(result_buf, path, ancestor, ancestor_label, - ours, our_label, theirs, their_label, - &default_opts); - } + if (!opts) + opts = &default_opts; if (opts->renormalize) { normalize_file(ancestor, path); From 898243b82db862867106854ad10794e74c215e49 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Sat, 15 Jan 2011 20:16:05 -0600 Subject: [PATCH 2/3] Documentation/fast-import: capitalize beginning of sentence Signed-off-by: Jonathan Nieder Signed-off-by: Junio C Hamano --- Documentation/git-fast-import.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/git-fast-import.txt b/Documentation/git-fast-import.txt index f56dfcabb9..fed48bd722 100644 --- a/Documentation/git-fast-import.txt +++ b/Documentation/git-fast-import.txt @@ -905,7 +905,7 @@ The `` can be either a mark reference (`:`) set previously or a full 40-byte SHA-1 of a Git blob, preexisting or ready to be written. -output uses the same format as `git cat-file --batch`: +Output uses the same format as `git cat-file --batch`: ==== SP 'blob' SP LF From 60a2e3320f3030d7c1f453a8cadafad7012fd820 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Sat, 15 Jan 2011 21:49:40 -0600 Subject: [PATCH 3/3] remote-ext: do not segfault for blank lines Instead of stripping space characters past the beginning of the line and overflowing a buffer, stop at the beginning of the line (mimicking the corresponding fix in remote-fd). The argument to isspace does not need to be cast explicitly because git isspace takes care of that already. Noticed-by: Junio C Hamano Signed-off-by: Jonathan Nieder Signed-off-by: Junio C Hamano --- builtin/remote-ext.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/builtin/remote-ext.c b/builtin/remote-ext.c index 1f773171cb..ea71977c83 100644 --- a/builtin/remote-ext.c +++ b/builtin/remote-ext.c @@ -212,16 +212,16 @@ static int command_loop(const char *child) char buffer[MAXCOMMAND]; while (1) { - size_t length; + size_t i; if (!fgets(buffer, MAXCOMMAND - 1, stdin)) { if (ferror(stdin)) die("Comammand input error"); exit(0); } /* Strip end of line characters. */ - length = strlen(buffer); - while (isspace((unsigned char)buffer[length - 1])) - buffer[--length] = 0; + i = strlen(buffer); + while (i > 0 && isspace(buffer[i - 1])) + buffer[--i] = 0; if (!strcmp(buffer, "capabilities")) { printf("*connect\n\n");