Subject: Re: git and time

From: Shawn Pearce <[email-masked]>
Date: Wed, 27 Sep 2006 11:11:02 -0400

Junio C Hamano <[email-masked]> wrote:
> One thing that makes "the common library code" less useful is
> that lock_ref_sha1() and its cousin lock_any_ref_for_update() do
> not let the caller to tell why a ref could not be locked ("did
> it not exist?  did the old_sha1 not match?"  and in
> lock_ref_sha1()'s case "did the ref have funny characters?").

Yes.  But I thought that in all such cases we use error or die so
the message is sent to STDERR before the process either terminates
or the function returns NULL.  So although the caller doesn't know
why the lock failed the end user does.

Git hasn't exactly structured its error messages in the past.
If we are talking about going down the path of having functions
return why they failed to the caller so the caller can react to
the failure as they see fit then we've got some work to do.  :)

> diff --git a/receive-pack.c b/receive-pack.c
> @@ -318,9 +258,11 @@ int main(int argc, char **argv)
>  	if (!dir)
>  		usage(receive_pack_usage);
>  
> -	if(!enter_repo(dir, 0))
> +	if (!enter_repo(dir, 0))
>  		die("'%s': unable to chdir or not a git archive", dir);
>  

You are missing:
+	setup_ident();

Without that reflog can't get the proper committer data from the
host's gecos information.  This is probably what is desired for
most pushes over SSH.

> +	git_config(git_default_config);
> +
>  	write_head_info();

-- 
Shawn.