Sync with 1.7.7.4

This commit is contained in:
Junio C Hamano 2011-11-18 11:30:02 -08:00
commit 4c00c852b3
5 changed files with 81 additions and 49 deletions

View File

@ -0,0 +1,14 @@
Git v1.7.7.4 Release Notes
==========================
Fixes since v1.7.7.3
--------------------
* A few header dependencies were missing from the Makefile.
* Some newer parts of the code used C99 __VA_ARGS__ while we still
try to cater to older compilers.
* "git name-rev --all" tried to name all _objects_, naturally failing to
describe many blobs and trees, instead of showing only commits as
advertised in its documentation.

View File

@ -518,6 +518,7 @@ LIB_H += compat/win32/syslog.h
LIB_H += compat/win32/poll.h LIB_H += compat/win32/poll.h
LIB_H += compat/win32/dirent.h LIB_H += compat/win32/dirent.h
LIB_H += connected.h LIB_H += connected.h
LIB_H += convert.h
LIB_H += csum-file.h LIB_H += csum-file.h
LIB_H += decorate.h LIB_H += decorate.h
LIB_H += delta.h LIB_H += delta.h
@ -2009,13 +2010,13 @@ builtin/branch.o builtin/checkout.o builtin/clone.o builtin/reset.o branch.o tra
builtin/bundle.o bundle.o transport.o: bundle.h builtin/bundle.o bundle.o transport.o: bundle.h
builtin/bisect--helper.o builtin/rev-list.o bisect.o: bisect.h builtin/bisect--helper.o builtin/rev-list.o bisect.o: bisect.h
builtin/clone.o builtin/fetch-pack.o transport.o: fetch-pack.h builtin/clone.o builtin/fetch-pack.o transport.o: fetch-pack.h
builtin/grep.o builtin/pack-objects.o transport-helper.o: thread-utils.h builtin/grep.o builtin/pack-objects.o transport-helper.o thread-utils.o: thread-utils.h
builtin/send-pack.o transport.o: send-pack.h builtin/send-pack.o transport.o: send-pack.h
builtin/log.o builtin/shortlog.o: shortlog.h builtin/log.o builtin/shortlog.o: shortlog.h
builtin/prune.o builtin/reflog.o reachable.o: reachable.h builtin/prune.o builtin/reflog.o reachable.o: reachable.h
builtin/commit.o builtin/revert.o wt-status.o: wt-status.h builtin/commit.o builtin/revert.o wt-status.o: wt-status.h
builtin/tar-tree.o archive-tar.o: tar.h builtin/tar-tree.o archive-tar.o: tar.h
connect.o transport.o http-backend.o: url.h connect.o transport.o url.o http-backend.o: url.h
http-fetch.o http-walker.o remote-curl.o transport.o walker.o: walker.h http-fetch.o http-walker.o remote-curl.o transport.o walker.o: walker.h
http.o http-walker.o http-push.o http-fetch.o remote-curl.o: http.h url.h http.o http-walker.o http-push.o http-fetch.o remote-curl.o: http.h url.h

View File

@ -291,7 +291,7 @@ int cmd_name_rev(int argc, const char **argv, const char *prefix)
max = get_max_object_index(); max = get_max_object_index();
for (i = 0; i < max; i++) { for (i = 0; i < max; i++) {
struct object *obj = get_indexed_object(i); struct object *obj = get_indexed_object(i);
if (!obj) if (!obj || obj->type != OBJ_COMMIT)
continue; continue;
show_name(obj, NULL, show_name(obj, NULL,
always, allow_undefined, data.name_only); always, allow_undefined, data.name_only);

View File

@ -70,8 +70,7 @@ static void add_mapping(struct string_list *map,
} else { } else {
/* create mailmap entry */ /* create mailmap entry */
struct string_list_item *item = string_list_insert_at_index(map, index, old_email); struct string_list_item *item = string_list_insert_at_index(map, index, old_email);
item->util = xmalloc(sizeof(struct mailmap_entry)); item->util = xcalloc(1, sizeof(struct mailmap_entry));
memset(item->util, 0, sizeof(struct mailmap_entry));
((struct mailmap_entry *)item->util)->namemap.strdup_strings = 1; ((struct mailmap_entry *)item->util)->namemap.strdup_strings = 1;
} }
me = (struct mailmap_entry *)map->items[index].util; me = (struct mailmap_entry *)map->items[index].util;
@ -88,7 +87,7 @@ static void add_mapping(struct string_list *map,
me->email = xstrdup(new_email); me->email = xstrdup(new_email);
} }
} else { } else {
struct mailmap_info *mi = xmalloc(sizeof(struct mailmap_info)); struct mailmap_info *mi = xcalloc(1, sizeof(struct mailmap_info));
debug_mm("mailmap: adding (complex) entry for %s at index %d\n", old_email, index); debug_mm("mailmap: adding (complex) entry for %s at index %d\n", old_email, index);
if (new_name) if (new_name)
mi->name = xstrdup(new_name); mi->name = xstrdup(new_name);

View File

@ -21,14 +21,6 @@ void init_notes_merge_options(struct notes_merge_options *o)
o->verbosity = NOTES_MERGE_VERBOSITY_DEFAULT; o->verbosity = NOTES_MERGE_VERBOSITY_DEFAULT;
} }
#define OUTPUT(o, v, ...) \
do { \
if ((o)->verbosity >= (v)) { \
printf(__VA_ARGS__); \
puts(""); \
} \
} while (0)
static int path_to_sha1(const char *path, unsigned char *sha1) static int path_to_sha1(const char *path, unsigned char *sha1)
{ {
char hex_sha1[40]; char hex_sha1[40];
@ -392,21 +384,26 @@ static int merge_one_change_manual(struct notes_merge_options *o,
strbuf_addf(&(o->commit_msg), "\t%s\n", sha1_to_hex(p->obj)); strbuf_addf(&(o->commit_msg), "\t%s\n", sha1_to_hex(p->obj));
OUTPUT(o, 2, "Auto-merging notes for %s", sha1_to_hex(p->obj)); if (o->verbosity >= 2)
printf("Auto-merging notes for %s\n", sha1_to_hex(p->obj));
check_notes_merge_worktree(o); check_notes_merge_worktree(o);
if (is_null_sha1(p->local)) { if (is_null_sha1(p->local)) {
/* D/F conflict, checkout p->remote */ /* D/F conflict, checkout p->remote */
assert(!is_null_sha1(p->remote)); assert(!is_null_sha1(p->remote));
OUTPUT(o, 1, "CONFLICT (delete/modify): Notes for object %s " if (o->verbosity >= 1)
printf("CONFLICT (delete/modify): Notes for object %s "
"deleted in %s and modified in %s. Version from %s " "deleted in %s and modified in %s. Version from %s "
"left in tree.", sha1_to_hex(p->obj), lref, rref, rref); "left in tree.\n",
sha1_to_hex(p->obj), lref, rref, rref);
write_note_to_worktree(p->obj, p->remote); write_note_to_worktree(p->obj, p->remote);
} else if (is_null_sha1(p->remote)) { } else if (is_null_sha1(p->remote)) {
/* D/F conflict, checkout p->local */ /* D/F conflict, checkout p->local */
assert(!is_null_sha1(p->local)); assert(!is_null_sha1(p->local));
OUTPUT(o, 1, "CONFLICT (delete/modify): Notes for object %s " if (o->verbosity >= 1)
printf("CONFLICT (delete/modify): Notes for object %s "
"deleted in %s and modified in %s. Version from %s " "deleted in %s and modified in %s. Version from %s "
"left in tree.", sha1_to_hex(p->obj), rref, lref, lref); "left in tree.\n",
sha1_to_hex(p->obj), rref, lref, lref);
write_note_to_worktree(p->obj, p->local); write_note_to_worktree(p->obj, p->local);
} else { } else {
/* "regular" conflict, checkout result of ll_merge() */ /* "regular" conflict, checkout result of ll_merge() */
@ -415,8 +412,9 @@ static int merge_one_change_manual(struct notes_merge_options *o,
reason = "add/add"; reason = "add/add";
assert(!is_null_sha1(p->local)); assert(!is_null_sha1(p->local));
assert(!is_null_sha1(p->remote)); assert(!is_null_sha1(p->remote));
OUTPUT(o, 1, "CONFLICT (%s): Merge conflict in notes for " if (o->verbosity >= 1)
"object %s", reason, sha1_to_hex(p->obj)); printf("CONFLICT (%s): Merge conflict in notes for "
"object %s\n", reason, sha1_to_hex(p->obj));
ll_merge_in_worktree(o, p); ll_merge_in_worktree(o, p);
} }
@ -438,24 +436,30 @@ static int merge_one_change(struct notes_merge_options *o,
case NOTES_MERGE_RESOLVE_MANUAL: case NOTES_MERGE_RESOLVE_MANUAL:
return merge_one_change_manual(o, p, t); return merge_one_change_manual(o, p, t);
case NOTES_MERGE_RESOLVE_OURS: case NOTES_MERGE_RESOLVE_OURS:
OUTPUT(o, 2, "Using local notes for %s", sha1_to_hex(p->obj)); if (o->verbosity >= 2)
printf("Using local notes for %s\n",
sha1_to_hex(p->obj));
/* nothing to do */ /* nothing to do */
return 0; return 0;
case NOTES_MERGE_RESOLVE_THEIRS: case NOTES_MERGE_RESOLVE_THEIRS:
OUTPUT(o, 2, "Using remote notes for %s", sha1_to_hex(p->obj)); if (o->verbosity >= 2)
printf("Using remote notes for %s\n",
sha1_to_hex(p->obj));
if (add_note(t, p->obj, p->remote, combine_notes_overwrite)) if (add_note(t, p->obj, p->remote, combine_notes_overwrite))
die("BUG: combine_notes_overwrite failed"); die("BUG: combine_notes_overwrite failed");
return 0; return 0;
case NOTES_MERGE_RESOLVE_UNION: case NOTES_MERGE_RESOLVE_UNION:
OUTPUT(o, 2, "Concatenating local and remote notes for %s", if (o->verbosity >= 2)
printf("Concatenating local and remote notes for %s\n",
sha1_to_hex(p->obj)); sha1_to_hex(p->obj));
if (add_note(t, p->obj, p->remote, combine_notes_concatenate)) if (add_note(t, p->obj, p->remote, combine_notes_concatenate))
die("failed to concatenate notes " die("failed to concatenate notes "
"(combine_notes_concatenate)"); "(combine_notes_concatenate)");
return 0; return 0;
case NOTES_MERGE_RESOLVE_CAT_SORT_UNIQ: case NOTES_MERGE_RESOLVE_CAT_SORT_UNIQ:
OUTPUT(o, 2, "Concatenating unique lines in local and remote " if (o->verbosity >= 2)
"notes for %s", sha1_to_hex(p->obj)); printf("Concatenating unique lines in local and remote "
"notes for %s\n", sha1_to_hex(p->obj));
if (add_note(t, p->obj, p->remote, combine_notes_cat_sort_uniq)) if (add_note(t, p->obj, p->remote, combine_notes_cat_sort_uniq))
die("failed to concatenate notes " die("failed to concatenate notes "
"(combine_notes_cat_sort_uniq)"); "(combine_notes_cat_sort_uniq)");
@ -518,7 +522,8 @@ static int merge_from_diffs(struct notes_merge_options *o,
conflicts = merge_changes(o, changes, &num_changes, t); conflicts = merge_changes(o, changes, &num_changes, t);
free(changes); free(changes);
OUTPUT(o, 4, "Merge result: %i unmerged notes and a %s notes tree", if (o->verbosity >= 4)
printf("Merge result: %i unmerged notes and a %s notes tree\n",
conflicts, t->dirty ? "dirty" : "clean"); conflicts, t->dirty ? "dirty" : "clean");
return conflicts ? -1 : 1; return conflicts ? -1 : 1;
@ -617,33 +622,40 @@ int notes_merge(struct notes_merge_options *o,
if (!bases) { if (!bases) {
base_sha1 = null_sha1; base_sha1 = null_sha1;
base_tree_sha1 = EMPTY_TREE_SHA1_BIN; base_tree_sha1 = EMPTY_TREE_SHA1_BIN;
OUTPUT(o, 4, "No merge base found; doing history-less merge"); if (o->verbosity >= 4)
printf("No merge base found; doing history-less merge\n");
} else if (!bases->next) { } else if (!bases->next) {
base_sha1 = bases->item->object.sha1; base_sha1 = bases->item->object.sha1;
base_tree_sha1 = bases->item->tree->object.sha1; base_tree_sha1 = bases->item->tree->object.sha1;
OUTPUT(o, 4, "One merge base found (%.7s)", if (o->verbosity >= 4)
printf("One merge base found (%.7s)\n",
sha1_to_hex(base_sha1)); sha1_to_hex(base_sha1));
} else { } else {
/* TODO: How to handle multiple merge-bases? */ /* TODO: How to handle multiple merge-bases? */
base_sha1 = bases->item->object.sha1; base_sha1 = bases->item->object.sha1;
base_tree_sha1 = bases->item->tree->object.sha1; base_tree_sha1 = bases->item->tree->object.sha1;
OUTPUT(o, 3, "Multiple merge bases found. Using the first " if (o->verbosity >= 3)
"(%.7s)", sha1_to_hex(base_sha1)); printf("Multiple merge bases found. Using the first "
"(%.7s)\n", sha1_to_hex(base_sha1));
} }
OUTPUT(o, 4, "Merging remote commit %.7s into local commit %.7s with " if (o->verbosity >= 4)
"merge-base %.7s", sha1_to_hex(remote->object.sha1), printf("Merging remote commit %.7s into local commit %.7s with "
sha1_to_hex(local->object.sha1), sha1_to_hex(base_sha1)); "merge-base %.7s\n", sha1_to_hex(remote->object.sha1),
sha1_to_hex(local->object.sha1),
sha1_to_hex(base_sha1));
if (!hashcmp(remote->object.sha1, base_sha1)) { if (!hashcmp(remote->object.sha1, base_sha1)) {
/* Already merged; result == local commit */ /* Already merged; result == local commit */
OUTPUT(o, 2, "Already up-to-date!"); if (o->verbosity >= 2)
printf("Already up-to-date!\n");
hashcpy(result_sha1, local->object.sha1); hashcpy(result_sha1, local->object.sha1);
goto found_result; goto found_result;
} }
if (!hashcmp(local->object.sha1, base_sha1)) { if (!hashcmp(local->object.sha1, base_sha1)) {
/* Fast-forward; result == remote commit */ /* Fast-forward; result == remote commit */
OUTPUT(o, 2, "Fast-forward"); if (o->verbosity >= 2)
printf("Fast-forward\n");
hashcpy(result_sha1, remote->object.sha1); hashcpy(result_sha1, remote->object.sha1);
goto found_result; goto found_result;
} }
@ -685,7 +697,8 @@ int notes_merge_commit(struct notes_merge_options *o,
int path_len = strlen(path), i; int path_len = strlen(path), i;
const char *msg = strstr(partial_commit->buffer, "\n\n"); const char *msg = strstr(partial_commit->buffer, "\n\n");
OUTPUT(o, 3, "Committing notes in notes merge worktree at %.*s", if (o->verbosity >= 3)
printf("Committing notes in notes merge worktree at %.*s\n",
path_len - 1, path); path_len - 1, path);
if (!msg || msg[2] == '\0') if (!msg || msg[2] == '\0')
@ -701,7 +714,9 @@ int notes_merge_commit(struct notes_merge_options *o,
unsigned char obj_sha1[20], blob_sha1[20]; unsigned char obj_sha1[20], blob_sha1[20];
if (ent->len - path_len != 40 || get_sha1_hex(relpath, obj_sha1)) { if (ent->len - path_len != 40 || get_sha1_hex(relpath, obj_sha1)) {
OUTPUT(o, 3, "Skipping non-SHA1 entry '%s'", ent->name); if (o->verbosity >= 3)
printf("Skipping non-SHA1 entry '%s'\n",
ent->name);
continue; continue;
} }
@ -713,13 +728,15 @@ int notes_merge_commit(struct notes_merge_options *o,
if (add_note(partial_tree, obj_sha1, blob_sha1, NULL)) if (add_note(partial_tree, obj_sha1, blob_sha1, NULL))
die("Failed to add resolved note '%s' to notes tree", die("Failed to add resolved note '%s' to notes tree",
ent->name); ent->name);
OUTPUT(o, 4, "Added resolved note for object %s: %s", if (o->verbosity >= 4)
printf("Added resolved note for object %s: %s\n",
sha1_to_hex(obj_sha1), sha1_to_hex(blob_sha1)); sha1_to_hex(obj_sha1), sha1_to_hex(blob_sha1));
} }
create_notes_commit(partial_tree, partial_commit->parents, msg, create_notes_commit(partial_tree, partial_commit->parents, msg,
result_sha1); result_sha1);
OUTPUT(o, 4, "Finalized notes merge commit: %s", if (o->verbosity >= 4)
printf("Finalized notes merge commit: %s\n",
sha1_to_hex(result_sha1)); sha1_to_hex(result_sha1));
free(path); free(path);
return 0; return 0;
@ -732,7 +749,8 @@ int notes_merge_abort(struct notes_merge_options *o)
int ret; int ret;
strbuf_addstr(&buf, git_path(NOTES_MERGE_WORKTREE)); strbuf_addstr(&buf, git_path(NOTES_MERGE_WORKTREE));
OUTPUT(o, 3, "Removing notes merge worktree at %s", buf.buf); if (o->verbosity >= 3)
printf("Removing notes merge worktree at %s\n", buf.buf);
ret = remove_dir_recursively(&buf, 0); ret = remove_dir_recursively(&buf, 0);
strbuf_release(&buf); strbuf_release(&buf);
return ret; return ret;