Re: [PATCH] add--interactive: handle initial commit better

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Wed, 13 Feb 2008, Jeff King wrote:

> diff --git a/sha1_file.c b/sha1_file.c
> index 4179949..1a6c7c8 100644
> --- a/sha1_file.c
> +++ b/sha1_file.c
> @@ -1845,6 +1845,15 @@ static struct cached_object {
>  } *cached_objects;
>  static int cached_object_nr, cached_object_alloc;
>  
> +static struct cached_object empty_tree = {
> +	/* empty tree sha1: 4b825dc642cb6eb9a060e54bf8d69288fbee4904 */
> +	"\x4b\x82\x5d\xc6\x42\xcb\x6e\xb9\xa0\x60"
> +	"\xe5\x4b\xf8\xd6\x92\x88\xfb\xee\x49\x04",
> +	OBJ_TREE,
> +	"",
> +	0
> +};
> +
>  static struct cached_object *find_cached_object(const unsigned char *sha1)
>  {
>  	int i;
> @@ -1854,6 +1863,8 @@ static struct cached_object *find_cached_object(const unsigned char *sha1)
>  		if (!hashcmp(co->sha1, sha1))
>  			return co;
>  	}
> +	if (!hashcmp(sha1, empty_tree.sha1))
> +		return &empty_tree;
>  	return NULL;
>  }

Heh.  This is cute.  But it is also a bit hard to reference, no?  I mean, 
you have to remember the SHA-1 of it...

Maybe {} ?

Ciao,
Dscho

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux