X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=rev-list.c;h=5ec9ccb6036bf79276f50fa13bd3cf9398c859f3;hb=37dcf6de60498dfedb5d97ad96789b0527493bcd;hp=523fda07e1eef4b3a1a801abbf94358d06af17fd;hpb=7fe2fc79358673a909d71e62d3f80ffe0f525fce;p=git.git diff --git a/rev-list.c b/rev-list.c index 523fda07..5ec9ccb6 100644 --- a/rev-list.c +++ b/rev-list.c @@ -194,7 +194,17 @@ static void show_commit_list(struct commit_list *list) die("unknown pending object %s (%s)", sha1_to_hex(obj->sha1), name); } while (objects) { - printf("%s %s\n", sha1_to_hex(objects->item->sha1), objects->name); + /* An object with name "foo\n0000000000000000000000000000000000000000" + * can be used confuse downstream git-pack-objects very badly. + */ + const char *ep = strchr(objects->name, '\n'); + if (ep) { + printf("%s %.*s\n", sha1_to_hex(objects->item->sha1), + (int) (ep - objects->name), + objects->name); + } + else + printf("%s %s\n", sha1_to_hex(objects->item->sha1), objects->name); objects = objects->next; } }