From d44c92d6ab4ded7a1960bb0b4a1da0c2fc102b89 Mon Sep 17 00:00:00 2001 From: Chris Wright Date: Sun, 10 Dec 2006 23:39:32 -0800 Subject: [PATCH 1/6] no need to install manpages as executable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No need to install manpages as executable. Noticed by Ville Skytt,Ad(B. Signed-off-by: Chris Wright Signed-off-by: Junio C Hamano --- Documentation/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/Makefile b/Documentation/Makefile index c00f5f62b7..d68bc4a788 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile @@ -56,8 +56,8 @@ man7: $(DOC_MAN7) install: man $(INSTALL) -d -m755 $(DESTDIR)$(man1dir) $(DESTDIR)$(man7dir) - $(INSTALL) $(DOC_MAN1) $(DESTDIR)$(man1dir) - $(INSTALL) $(DOC_MAN7) $(DESTDIR)$(man7dir) + $(INSTALL) -m644 $(DOC_MAN1) $(DESTDIR)$(man1dir) + $(INSTALL) -m644 $(DOC_MAN7) $(DESTDIR)$(man7dir) # From 554a2636f7c5125a83bb07194632445467d46c83 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Mon, 11 Dec 2006 19:06:34 +0100 Subject: [PATCH 2/6] Don't use memcpy when source and dest. buffers may overlap git-index-pack can call memcpy with overlapping source and destination buffers. The patch below makes it use memmove instead. If you want to demonstrate a failure, add the following two lines + if (input_offset < input_len) + abort (); before the existing memcpy call (shown in the patch below), and then run this: (cd t; sh ./t5500-fetch-pack.sh) Signed-off-by: Jim Meyering Signed-off-by: Junio C Hamano --- index-pack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index-pack.c b/index-pack.c index 8331d99a62..6d6c92bf14 100644 --- a/index-pack.c +++ b/index-pack.c @@ -96,7 +96,7 @@ static void flush(void) if (output_fd >= 0) write_or_die(output_fd, input_buffer, input_offset); SHA1_Update(&input_ctx, input_buffer, input_offset); - memcpy(input_buffer, input_buffer + input_offset, input_len); + memmove(input_buffer, input_buffer + input_offset, input_len); input_offset = 0; } } From 9abd46a3471c2d58976e06a00e937b03672b98bc Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Thu, 7 Dec 2006 05:17:07 -0500 Subject: [PATCH 3/6] Make sure the empty tree exists when needed in merge-recursive. There are some baseless merge cases where git-merge-recursive will try to compare one of the branches against the empty tree. However most projects won't have the empty tree object in their object database as Git does not normally create empty tree objects. If the empty tree object is missing then the merge process will die, as it cannot load the object from the database. The error message may make the user think that their database is corrupt when its actually not. So instead we should just create the empty tree object whenever it is needed. If the object already exists as a loose object then no harm done. Otherwise that loose object will be pruned away later by either git-prune or git-prune-packed. Thanks goes to Junio for suggesting this fix. Signed-off-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- merge-recursive.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/merge-recursive.c b/merge-recursive.c index cd2cc77bf4..32e186c15e 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -1238,7 +1238,7 @@ static int merge(struct commit *h1, tree->object.parsed = 1; tree->object.type = OBJ_TREE; - hash_sha1_file(NULL, 0, tree_type, tree->object.sha1); + write_sha1_file(NULL, 0, tree_type, tree->object.sha1); merged_common_ancestors = make_virtual_commit(tree, "ancestor"); } From bca73251da5cc3e4bea71e28e0096a5cd662bbd9 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sun, 10 Dec 2006 15:55:07 -0800 Subject: [PATCH 4/6] shortlog: remove "[PATCH]" prefix from shortlog output Originally noticed by Nicolas Pitre; the real cause was the code was prepared to deal with [PATCH] (and [PATCH n/m whatever]) prefixes but forgot that the string can be indented while acting as a filter. Signed-off-by: Junio C Hamano --- builtin-shortlog.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/builtin-shortlog.c b/builtin-shortlog.c index 7a2ddfe797..3322c3a2ee 100644 --- a/builtin-shortlog.c +++ b/builtin-shortlog.c @@ -195,11 +195,17 @@ static void read_from_stdin(struct path_list *list) while (fgets(buffer2, sizeof(buffer2), stdin) && buffer2[0] != '\n') ; /* chomp input */ - if (fgets(buffer2, sizeof(buffer2), stdin)) + if (fgets(buffer2, sizeof(buffer2), stdin)) { + int l2 = strlen(buffer2); + int i; + for (i = 0; i < l2; i++) + if (!isspace(buffer2[i])) + break; insert_author_oneline(list, buffer + offset, bob - buffer - offset, - buffer2, strlen(buffer2)); + buffer2 + i, l2 - i); + } } } } From 6f9872582246b9b8ee4bdc9f6a563b409aab1ecb Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sun, 10 Dec 2006 15:51:54 -0800 Subject: [PATCH 5/6] shortlog: fix segfault on empty authorname The old code looked backwards from the email address to parse the name, allowing an arbitrary number of spaces between the two. However, in the case of no name, we looked back too far to the 'author' (or 'Author:') header. The bug was triggered by commit febf7ea4bed from linux-2.6. Jeff King originally fixed it by looking back only one character; Johannes Schindelin pointed out that we could try harder while at it to cope with commits with broken headers. Signed-off-by: Junio C Hamano --- builtin-shortlog.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/builtin-shortlog.c b/builtin-shortlog.c index 3322c3a2ee..3fc43dd7dd 100644 --- a/builtin-shortlog.c +++ b/builtin-shortlog.c @@ -188,7 +188,8 @@ static void read_from_stdin(struct path_list *list) bob = buffer + strlen(buffer); else { offset = 8; - if (isspace(bob[-1])) + while (buffer + offset < bob && + isspace(bob[-1])) bob--; } From bfddbc5e1e68373ba96441ca228236667912265c Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sun, 10 Dec 2006 13:50:59 -0800 Subject: [PATCH 6/6] diff --numstat: show binary with '-' to match "apply --numstat" This changes the --numstat output for binary files from "0 0" to "- -" to match what "apply --numstat" does. Signed-off-by: Junio C Hamano --- diff.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/diff.c b/diff.c index 33153787b8..d6d17f4734 100644 --- a/diff.c +++ b/diff.c @@ -802,7 +802,10 @@ static void show_numstat(struct diffstat_t* data, struct diff_options *options) for (i = 0; i < data->nr; i++) { struct diffstat_file *file = data->files[i]; - printf("%d\t%d\t", file->added, file->deleted); + if (file->is_binary) + printf("-\t-\t"); + else + printf("%d\t%d\t", file->added, file->deleted); if (options->line_termination && quote_c_style(file->name, NULL, NULL, 0)) quote_c_style(file->name, NULL, stdout, 0);