* git-log fatal error in empty repo
@ 2007-06-07 13:34 Steve Hoelzer
2007-06-07 20:29 ` Junio C Hamano
0 siblings, 1 reply; 3+ messages in thread
From: Steve Hoelzer @ 2007-06-07 13:34 UTC (permalink / raw)
To: git
git-log will return a fatal error for an empty repo, like so:
$ git --version
git version 1.5.2.73.g18bece
$ mkdir mytest
$ cd mytest
$ git-init
Initialized empty Git repository in .git/
$ git-log
fatal: bad default revision 'HEAD'
It would be nice if git-log was quiet or returned a "no log" message
instead of the fatal error.
Steve
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: git-log fatal error in empty repo
2007-06-07 13:34 git-log fatal error in empty repo Steve Hoelzer
@ 2007-06-07 20:29 ` Junio C Hamano
2007-06-09 2:31 ` Geert Bosch
0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2007-06-07 20:29 UTC (permalink / raw)
To: Steve Hoelzer; +Cc: git
"Steve Hoelzer" <shoelzer@gmail.com> writes:
> git-log will return a fatal error for an empty repo, like so:
>
> $ git --version
> git version 1.5.2.73.g18bece
> $ mkdir mytest
> $ cd mytest
> $ git-init
> Initialized empty Git repository in .git/
> $ git-log
> fatal: bad default revision 'HEAD'
>
> It would be nice if git-log was quiet or returned a "no log" message
> instead of the fatal error.
Maybe, but I highly doubt if it is worth to bother about it.
revision.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/revision.c b/revision.c
index 0a29b53..0573b86 100644
--- a/revision.c
+++ b/revision.c
@@ -1218,8 +1218,11 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
unsigned char sha1[20];
struct object *object;
unsigned mode;
- if (get_sha1_with_mode(def, sha1, &mode))
+ if (get_sha1_with_mode(def, sha1, &mode)) {
+ if (!strcmp("HEAD", def))
+ die("You have no history yet on your HEAD");
die("bad default revision '%s'", def);
+ }
object = get_reference(revs, def, sha1, 0);
add_pending_object_with_mode(revs, object, def, mode);
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: git-log fatal error in empty repo
2007-06-07 20:29 ` Junio C Hamano
@ 2007-06-09 2:31 ` Geert Bosch
0 siblings, 0 replies; 3+ messages in thread
From: Geert Bosch @ 2007-06-09 2:31 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Steve Hoelzer, git
On Jun 7, 2007, at 16:29, Junio C Hamano wrote:
> Maybe, but I highly doubt if it is worth to bother about it.
My first confusion with git was exactly this issue.
It's very normal for a new user to do a git init
and than try to verify that the current state is a sane
empty repository.
So, git log, git status and git fsck should all properly
handle this situation and give reasonable output in this case.
-Geert
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-06-09 2:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-07 13:34 git-log fatal error in empty repo Steve Hoelzer
2007-06-07 20:29 ` Junio C Hamano
2007-06-09 2:31 ` Geert Bosch
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 NNTP newsgroup(s).