Re: git and time

From: Shawn Pearce <spearce@spearce.org>
Date: 2006-09-28 01:11:02
Junio C Hamano <junkio@cox.net> 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.
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Thu Sep 28 01:12:15 2006

This archive was generated by hypermail 2.1.8 : 2006-09-28 01:12:58 EST