git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: Jon Loeliger <jdl@freescale.com>
Cc: git@vger.kernel.org
Subject: Re: [BUG] git-show-branch cant show --more
Date: Mon, 19 Sep 2005 01:12:18 -0700	[thread overview]
Message-ID: <7vwtldtr19.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <E1EHCAx-0007xp-JW@jdl.com> (Jon Loeliger's message of "Sun, 18 Sep 2005 22:18:39 -0500")

Jon Loeliger <jdl@freescale.com> writes:

> I realize I probably dumbly expected more history out
> of a partial git repository than is actually present,
> but a segmentation fault wasn't a nice way to tell me. :-)
>
> Start with just Paul's repo over here:
>
> rsync://rsync.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc-merge.git

Hmph.  That repository does not look partial to me, although it
seems to use alternates to borrow heavily from Linus.

  $ git clone rsync://rsync.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc-merge.git ppc-merge
  $ git show-branch --more=10
  [master] ppc32: Allow user to individual select CHRP/PMAC/PREP config
  [master~1] powerpc: Merge simplified sections.h into asm-powerpc
  [master~2] powerpc: Remove section free() and linker script bits
  [master~3] powerpc: Remove sections use from ppc64 and drivers
  [master~4] powerpc: Remove sections use from ppc
  [master~5] ppc32: Removed non-inlined versions of local_irq* functions
  [master~6] powerpc: Merged ppc_asm.h
  [master~7] powerpc: Merge kmap_types.h
  [master~8] [NETFILTER]: Solve Kconfig dependency problem
  [master~9] [IPV6]: Check connect(2) status for IPv6 UDP socket (Re: xfrm_lookup)
  [master~10] [BOND]: Fix bond_init() error path handling.
  $ git --version
  git version 0.99.7

But in any case you are right.  We should barf a bit nicely when
we encounter an corrupt repository.  How about something like
this (not fully tested)?

------------
[PATCH] Be nice when running in a corrupt repository.

We may end up trying to print a commit we do not have but only
whose existence is known to us because another commit we have
refer to it.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
diff --git a/show-branch.c b/show-branch.c
--- a/show-branch.c
+++ b/show-branch.c
@@ -196,8 +196,11 @@ static void show_one_commit(struct commi
 {
 	char pretty[128], *cp;
 	struct commit_name *name = commit->object.util;
-	pretty_print_commit(CMIT_FMT_ONELINE, commit->buffer, ~0,
-			    pretty, sizeof(pretty));
+	if (commit->object.parsed)
+		pretty_print_commit(CMIT_FMT_ONELINE, commit->buffer, ~0,
+				    pretty, sizeof(pretty));
+	else
+		strcpy(pretty, "(unavailable)");
 	if (!strncmp(pretty, "[PATCH] ", 8))
 		cp = pretty + 8;
 	else

      reply	other threads:[~2005-09-19  8:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-19  3:18 [BUG] git-show-branch cant show --more Jon Loeliger
2005-09-19  8:12 ` Junio C Hamano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vwtldtr19.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=git@vger.kernel.org \
    --cc=jdl@freescale.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).