From d551bbaf3af1fad947c704bdeb9cf664b34e38c6 Mon Sep 17 00:00:00 2001 From: Thomas Rast Date: Sat, 6 Dec 2008 21:50:09 +0100 Subject: [PATCH 1/6] fetch-pack: Avoid memcpy() with src==dst memcpy() may only be used for disjoint memory areas, but when invoked from cmd_fetch_pack(), we have my_args == &args. (The argument cannot be removed entirely because transport.c invokes with its own variable.) Signed-off-by: Thomas Rast Signed-off-by: Junio C Hamano --- builtin-fetch-pack.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/builtin-fetch-pack.c b/builtin-fetch-pack.c index 21ce3e0163..22a57121a8 100644 --- a/builtin-fetch-pack.c +++ b/builtin-fetch-pack.c @@ -780,7 +780,8 @@ struct ref *fetch_pack(struct fetch_pack_args *my_args, struct ref *ref_cpy; fetch_pack_setup(); - memcpy(&args, my_args, sizeof(args)); + if (&args != my_args) + memcpy(&args, my_args, sizeof(args)); if (args.depth > 0) { if (stat(git_path("shallow"), &st)) st.st_mtime = 0; From e4a80ecf40c9651741def7c4f0b2ca56b42af1a8 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Sun, 7 Dec 2008 01:45:37 +0100 Subject: [PATCH 2/6] http.c: use 'git_config_string' to get 'curl_http_proxy' Signed-off-by: Miklos Vajna Signed-off-by: Junio C Hamano --- http.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/http.c b/http.c index a97fdf5117..c18e30abe8 100644 --- a/http.c +++ b/http.c @@ -24,7 +24,7 @@ static const char *ssl_cainfo = NULL; static long curl_low_speed_limit = -1; static long curl_low_speed_time = -1; static int curl_ftp_no_epsv = 0; -static char *curl_http_proxy = NULL; +static const char *curl_http_proxy = NULL; static struct curl_slist *pragma_header; @@ -149,11 +149,8 @@ static int http_options(const char *var, const char *value, void *cb) return 0; } if (!strcmp("http.proxy", var)) { - if (curl_http_proxy == NULL) { - if (!value) - return config_error_nonbool(var); - curl_http_proxy = xstrdup(value); - } + if (curl_http_proxy == NULL) + return git_config_string(&curl_http_proxy, var, value); return 0; } @@ -309,7 +306,7 @@ void http_cleanup(void) pragma_header = NULL; if (curl_http_proxy) { - free(curl_http_proxy); + free((void *)curl_http_proxy); curl_http_proxy = NULL; } } From bcc6a833032e0830195c1de1b834006a1d0156fe Mon Sep 17 00:00:00 2001 From: Jakub Narebski Date: Sun, 7 Dec 2008 10:36:36 +0100 Subject: [PATCH 3/6] gitweb: Make project specific override for 'grep' feature work The 'grep' feature was marked in the comments as having project specific config, but it lacked 'sub' key required for it to work. Kind-of-Noticed-by: Matt Kraai Signed-off-by: Jakub Narebski Signed-off-by: Junio C Hamano --- gitweb/gitweb.perl | 1 + 1 file changed, 1 insertion(+) diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index eae5084c66..ced7bb740f 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -232,6 +232,7 @@ our %feature = ( # $feature{'grep'}{'override'} = 1; # and in project config gitweb.grep = 0|1; 'grep' => { + 'sub' => \&feature_grep, 'override' => 0, 'default' => [1]}, From 3927bbe9a4d4033551dea39ac1abb9cdc45d822c Mon Sep 17 00:00:00 2001 From: Jeff King Date: Sat, 6 Dec 2008 14:40:34 -0500 Subject: [PATCH 4/6] tag: delete TAG_EDITMSG only on successful tag The user may put some effort into writing an annotated tag message. When the tagging process later fails (which can happen fairly easily, since it may be dependent on gpg being correctly configured and used), there is no record left on disk of the tag message. Instead, let's keep the TAG_EDITMSG file around until we are sure the tag has been created successfully. If we die because of an error, the user can recover their text from that file. Leaving the file in place causes no conflicts; it will be silently overwritten by the next annotated tag creation. This matches the behavior of COMMIT_EDITMSG, which stays around in case of error. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- builtin-tag.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/builtin-tag.c b/builtin-tag.c index 11b91b3c3b..2cdefb1d9a 100644 --- a/builtin-tag.c +++ b/builtin-tag.c @@ -253,6 +253,15 @@ static void write_tag_body(int fd, const unsigned char *sha1) free(buf); } +static int build_tag_object(struct strbuf *buf, int sign, unsigned char *result) +{ + if (sign && do_sign(buf) < 0) + return error("unable to sign the tag"); + if (write_sha1_file(buf->buf, buf->len, tag_type, result) < 0) + return error("unable to write tag file"); + return 0; +} + static void create_tag(const unsigned char *object, const char *tag, struct strbuf *buf, int message, int sign, unsigned char *prev, unsigned char *result) @@ -260,6 +269,7 @@ static void create_tag(const unsigned char *object, const char *tag, enum object_type type; char header_buf[1024]; int header_len; + char *path = NULL; type = sha1_object_info(object, NULL); if (type <= OBJ_NONE) @@ -279,7 +289,6 @@ static void create_tag(const unsigned char *object, const char *tag, die("tag header too big."); if (!message) { - char *path; int fd; /* write the template message before editing: */ @@ -300,9 +309,6 @@ static void create_tag(const unsigned char *object, const char *tag, "Please supply the message using either -m or -F option.\n"); exit(1); } - - unlink(path); - free(path); } stripspace(buf, 1); @@ -312,10 +318,16 @@ static void create_tag(const unsigned char *object, const char *tag, strbuf_insert(buf, 0, header_buf, header_len); - if (sign && do_sign(buf) < 0) - die("unable to sign the tag"); - if (write_sha1_file(buf->buf, buf->len, tag_type, result) < 0) - die("unable to write tag file"); + if (build_tag_object(buf, sign, result) < 0) { + if (path) + fprintf(stderr, "The tag message has been left in %s\n", + path); + exit(128); + } + if (path) { + unlink(path); + free(path); + } } struct msg_arg { From dbc2fb6b841dd3a72c52a5a161e2362a26fc65f5 Mon Sep 17 00:00:00 2001 From: Matt McCutchen Date: Fri, 10 Oct 2008 21:56:15 -0400 Subject: [PATCH 5/6] "git diff {3,}": do not reverse order of arguments According to the message of commit 0fe7c1de16f71312e6adac4b85bddf0d62a47168, "git diff" with three or more trees expects the merged tree first followed by the parents, in order. However, this command reversed the order of its arguments, resulting in confusing diffs. A comment /* Again, the revs are all reverse */ suggested there was a reason for this, but I can't figure out the reason, so I removed the reversal of the arguments. Test case included. Signed-off-by: Matt McCutchen Signed-off-by: Shawn O. Pearce --- builtin-diff.c | 4 +--- t/t4013-diff-various.sh | 1 + t/t4013/diff.diff_master_master^_side | 29 +++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 t/t4013/diff.diff_master_master^_side diff --git a/builtin-diff.c b/builtin-diff.c index 26cf678591..375a0d3302 100644 --- a/builtin-diff.c +++ b/builtin-diff.c @@ -175,10 +175,8 @@ static int builtin_diff_combined(struct rev_info *revs, if (!revs->dense_combined_merges && !revs->combine_merges) revs->dense_combined_merges = revs->combine_merges = 1; parent = xmalloc(ents * sizeof(*parent)); - /* Again, the revs are all reverse */ for (i = 0; i < ents; i++) - hashcpy((unsigned char *)(parent + i), - ent[ents - 1 - i].item->sha1); + hashcpy((unsigned char *)(parent + i), ent[i].item->sha1); diff_tree_combined(parent[0], parent + 1, ents - 1, revs->dense_combined_merges, revs); return 0; diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh index 9337b81064..99d9e0ba13 100755 --- a/t/t4013-diff-various.sh +++ b/t/t4013-diff-various.sh @@ -258,6 +258,7 @@ diff --patch-with-stat -r initial..side diff --patch-with-raw -r initial..side diff --name-status dir2 dir diff --no-index --name-status dir2 dir +diff master master^ side EOF test_done diff --git a/t/t4013/diff.diff_master_master^_side b/t/t4013/diff.diff_master_master^_side new file mode 100644 index 0000000000..50ec9cadd6 --- /dev/null +++ b/t/t4013/diff.diff_master_master^_side @@ -0,0 +1,29 @@ +$ git diff master master^ side +diff --cc dir/sub +index cead32e,7289e35..992913c +--- a/dir/sub ++++ b/dir/sub +@@@ -1,6 -1,4 +1,8 @@@ + A + B + +C + +D + +E + +F ++ 1 ++ 2 +diff --cc file0 +index b414108,f4615da..10a8a9f +--- a/file0 ++++ b/file0 +@@@ -1,6 -1,6 +1,9 @@@ + 1 + 2 + 3 + +4 + +5 + +6 ++ A ++ B ++ C +$ From 1c2ed59de2d14ad6ee9daa4d4f7254297d9a3830 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sun, 7 Dec 2008 03:03:16 -0800 Subject: [PATCH 6/6] GIT 1.6.0.5 Signed-off-by: Junio C Hamano --- Documentation/RelNotes-1.6.0.5.txt | 43 +++++++++++++++++++----------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/Documentation/RelNotes-1.6.0.5.txt b/Documentation/RelNotes-1.6.0.5.txt index 1dc101c6a3..a08bb96738 100644 --- a/Documentation/RelNotes-1.6.0.5.txt +++ b/Documentation/RelNotes-1.6.0.5.txt @@ -4,40 +4,53 @@ GIT v1.6.0.5 Release Notes Fixes since v1.6.0.4 -------------------- -* 'git checkout' used to crash when your HEAD was pointing at a deleted +* "git checkout" used to crash when your HEAD was pointing at a deleted branch. -* 'git checkout' from an un-checked-out state did not allow switching out +* "git checkout" from an un-checked-out state did not allow switching out of the current branch. -* 'git diff' always allowed GIT_EXTERNAL_DIFF and --no-ext-diff was no-op for +* "git diff" always allowed GIT_EXTERNAL_DIFF and --no-ext-diff was no-op for the command. -* 'git fast-export' did not export all tags. +* Giving 3 or more tree-ish to "git diff" is supposed to show the combined + diff from second and subsequent trees to the first one, but the order was + screwed up. -* 'git ls-files --with-tree=' did not work with options other +* "git fast-export" did not export all tags. + +* "git ls-files --with-tree=" did not work with options other than -c, most notably with -m. -* 'git pack-objects' did not make its best effort to honor --max-pack-size +* "git pack-objects" did not make its best effort to honor --max-pack-size option when a single first object already busted the given limit and placed many objects in a single pack. -* 'git-p4' fast import frontend was too eager to trigger its keyword expansion +* "git-p4" fast import frontend was too eager to trigger its keyword expansion logic, even on a keyword-looking string that does not have closing '$' on the same line. -* 'git push $there' when the remote $there is defined in $GIT_DIR/branches/$there +* "git push $there" when the remote $there is defined in $GIT_DIR/branches/$there behaves more like what cg-push from Cogito used to work. -* 'git tag' did not complain when given mutually incompatible set of options. +* when giving up resolving a conflicted merge, "git reset --hard" failed + to remove new paths from the working tree. -* 'make check' cannot be run without sparse; people may have meant to say - 'make test' instead, so suggest that. +* "git tag" did not complain when given mutually incompatible set of options. + +* The message constructed in the internal editor was discarded when "git + tag -s" failed to sign the message, which was often caused by the user + not configuring GPG correctly. + +* "make check" cannot be run without sparse; people may have meant to say + "make test" instead, so suggest that. + +* Internal diff machinery had a corner case performance bug that choked on + a large file with many repeated contents. + +* "git repack" used to grab objects out of packs marked with .keep + into a new pack. * Many unsafe call to sprintf() style varargs functions are corrected. * Also contains quite a few documentation updates. - --- -O=v1.6.0.4-39-g27f6496 -