{"thread":{"id":"1855","subject":"[BUG] git-show-branch cant show --more","startedAt":"2005-09-19T03:18:39Z","lastAt":"2005-09-19T08:12:18Z","messageCount":2,"participants":["Jon Loeliger","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"8825","messageId":"E1EHCAx-0007xp-JW@jdl.com","threadId":"1855","inReplyTo":null,"subject":"[BUG] git-show-branch cant show --more","fromName":"Jon Loeliger","fromEmail":"jdl@freescale.com","sentAt":"2005-09-19T03:18:39Z","receivedAt":"2005-09-19T03:18:39Z","isPatch":false,"sender":{"key":"jdl@jdl.com","avatar":"https://gravatar.com/avatar/75ce9a10b151acd2c28ec4ab2136dba7b2ff1634530bd04b155981a749d08a64?d=mp&s=160"},"body":"\nGuys,\n\nI realize I probably dumbly expected more history out\nof a partial git repository than is actually present,\nbut a segmentation fault wasn't a nice way to tell me. :-)\n\nStart with just Paul's repo over here:\n\nrsync://rsync.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc-merge.git\n\nAnd do a \"git show-branch --more=10\" on it.\n\nYeah, msg == 0.  Bad msg.  No dereferencing for you.\n\nThanks,\njdl\n\n\njdl.com 487 % gdb /usr/bin/git-show-branch\nUsing host libthread_db library \"/lib/tls/libthread_db.so.1\".\n(gdb) run --more=10\nStarting program: /usr/bin/git-show-branch --more=10\nerror: Could not read 628f87f3d585bd0c2b0e39df039585d7a5831cc9\n* [master] ppc32: Allow user to individual select CHRP/PMAC/PREP config\n ! [origin] ppc32: Allow user to individual select CHRP/PMAC/PREP config\n--\n++ [master] ppc32: Allow user to individual select CHRP/PMAC/PREP config\n++ [master~1] powerpc: Merge simplified sections.h into asm-powerpc\n++ [master~2] powerpc: Remove section free() and linker script bits\n++ [master~3] powerpc: Remove sections use from ppc64 and drivers\n++ [master~4] powerpc: Remove sections use from ppc\n++ [master~5] ppc32: Removed non-inlined versions of local_irq* functions\n++ [master~6] powerpc: Merged ppc_asm.h\n++ [master~7] powerpc: Merge kmap_types.h\n\nProgram received signal SIGSEGV, Segmentation fault.\nget_one_line (msg=0x0, len=4294967294) at commit.c:347\n347                     char c = *msg++;\n(gdb) where\n#0  get_one_line (msg=0x0, len=4294967294) at commit.c:347\n#1  0x0804dfc5 in pretty_print_commit (fmt=CMIT_FMT_ONELINE, msg=0x0,\n    len=4294967295, buf=0xbfc86e40 \"[PATCH] powerpc: Merge kmap_types.h\",\n    space=128) at commit.c:416\n#2  0x08049a22 in show_one_commit (commit=0x0) at show-branch.c:199\n#3  0x0804a304 in main (ac=0, av=0xbfc871bc) at show-branch.c:483\n"},{"id":"8840","messageId":"7vwtldtr19.fsf@assigned-by-dhcp.cox.net","threadId":"1855","inReplyTo":"E1EHCAx-0007xp-JW@jdl.com","subject":"Re: [BUG] git-show-branch cant show --more","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-09-19T08:12:18Z","receivedAt":"2005-09-19T08:12:18Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jon Loeliger <jdl@freescale.com> writes:\n\n> I realize I probably dumbly expected more history out\n> of a partial git repository than is actually present,\n> but a segmentation fault wasn't a nice way to tell me. :-)\n>\n> Start with just Paul's repo over here:\n>\n> rsync://rsync.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc-merge.git\n\nHmph.  That repository does not look partial to me, although it\nseems to use alternates to borrow heavily from Linus.\n\n  $ git clone rsync://rsync.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc-merge.git ppc-merge\n  $ git show-branch --more=10\n  [master] ppc32: Allow user to individual select CHRP/PMAC/PREP config\n  [master~1] powerpc: Merge simplified sections.h into asm-powerpc\n  [master~2] powerpc: Remove section free() and linker script bits\n  [master~3] powerpc: Remove sections use from ppc64 and drivers\n  [master~4] powerpc: Remove sections use from ppc\n  [master~5] ppc32: Removed non-inlined versions of local_irq* functions\n  [master~6] powerpc: Merged ppc_asm.h\n  [master~7] powerpc: Merge kmap_types.h\n  [master~8] [NETFILTER]: Solve Kconfig dependency problem\n  [master~9] [IPV6]: Check connect(2) status for IPv6 UDP socket (Re: xfrm_lookup)\n  [master~10] [BOND]: Fix bond_init() error path handling.\n  $ git --version\n  git version 0.99.7\n\nBut in any case you are right.  We should barf a bit nicely when\nwe encounter an corrupt repository.  How about something like\nthis (not fully tested)?\n\n------------\n[PATCH] Be nice when running in a corrupt repository.\n\nWe may end up trying to print a commit we do not have but only\nwhose existence is known to us because another commit we have\nrefer to it.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\ndiff --git a/show-branch.c b/show-branch.c\n--- a/show-branch.c\n+++ b/show-branch.c\n@@ -196,8 +196,11 @@ static void show_one_commit(struct commi\n {\n \tchar pretty[128], *cp;\n \tstruct commit_name *name = commit->object.util;\n-\tpretty_print_commit(CMIT_FMT_ONELINE, commit->buffer, ~0,\n-\t\t\t    pretty, sizeof(pretty));\n+\tif (commit->object.parsed)\n+\t\tpretty_print_commit(CMIT_FMT_ONELINE, commit->buffer, ~0,\n+\t\t\t\t    pretty, sizeof(pretty));\n+\telse\n+\t\tstrcpy(pretty, \"(unavailable)\");\n \tif (!strncmp(pretty, \"[PATCH] \", 8))\n \t\tcp = pretty + 8;\n \telse\n"}]}