# Git hangs while executing commit-tree

4 messages from 2005-04-20 to 2005-04-20. Participants: Rhys Hardwick, Petr Baudis, Linus Torvalds, David Greaves.
Thread: https://gitlist.dev/t/178

## Rhys Hardwick, 2005-04-20 21:28

Subject: Git hangs while executing commit-tree
Message-ID: <200504202228.35652.rhys@rhyshardwick.co.uk>
URL: https://gitlist.dev/e/200504202228.35652.rhys%40rhyshardwick.co.uk

```
Hey,

The following is a copy of the terminal session in question:

rhys@metatron:~/repo/tmp.repo$ ls
rhys@metatron:~/repo/tmp.repo$ init-db
defaulting to local storage area
rhys@metatron:~/repo/tmp.repo$ ls -l .git
total 4
drwxr-xr-x  258 rhys rhys 4096 2005-04-20 20:52 objects
rhys@metatron:~/repo/tmp.repo$ ls .git/objects/
00  0d  1a  27  34  41  4e  5b  68  75  82  8f  9c  a9  b6  c3  d0  dd  ea  f7
01  0e  1b  28  35  42  4f  5c  69  76  83  90  9d  aa  b7  c4  d1  de  eb  f8
02  0f  1c  29  36  43  50  5d  6a  77  84  91  9e  ab  b8  c5  d2  df  ec  f9
03  10  1d  2a  37  44  51  5e  6b  78  85  92  9f  ac  b9  c6  d3  e0  ed  fa
04  11  1e  2b  38  45  52  5f  6c  79  86  93  a0  ad  ba  c7  d4  e1  ee  fb
05  12  1f  2c  39  46  53  60  6d  7a  87  94  a1  ae  bb  c8  d5  e2  ef  fc
06  13  20  2d  3a  47  54  61  6e  7b  88  95  a2  af  bc  c9  d6  e3  f0  fd
07  14  21  2e  3b  48  55  62  6f  7c  89  96  a3  b0  bd  ca  d7  e4  f1  fe
08  15  22  2f  3c  49  56  63  70  7d  8a  97  a4  b1  be  cb  d8  e5  f2  ff
09  16  23  30  3d  4a  57  64  71  7e  8b  98  a5  b2  bf  cc  d9  e6  f3
0a  17  24  31  3e  4b  58  65  72  7f  8c  99  a6  b3  c0  cd  da  e7  f4
0b  18  25  32  3f  4c  59  66  73  80  8d  9a  a7  b4  c1  ce  db  e8  f5
0c  19  26  33  40  4d  5a  67  74  81  8e  9b  a8  b5  c2  cf  dc  e9  f6
rhys@metatron:~/repo/tmp.repo$ find . -type f
rhys@metatron:~/repo/tmp.repo$ mkdir src
rhys@metatron:~/repo/tmp.repo$ pico src/hello.c
rhys@metatron:~/repo/tmp.repo$ pico Makefile
rhys@metatron:~/repo/tmp.repo$ update-cache -add Makefile src/hello.c
fatal: unknown option -add
rhys@metatron:~/repo/tmp.repo$ update-cache --add Makefile src/hello.c
rhys@metatron:~/repo/tmp.repo$ write-tree
c80156fafbac377ab35beb076090c8320f874f91
rhys@metatron:~/repo/tmp.repo$ commit-tree 
c80156fafbac377ab35beb076090c8320f874f91
Committing initial tree c80156fafbac377ab35beb076090c8320f874f91
 


At this point, the command seems to be just waiting.  I have had it waiting 
for around 2 hours now!  I have tried removing ~/repo/tmp.repo and starting 
over, with exactly the same results.

I was testing git by following the tutorial posted by Tony Luck on this list.  
I updated and built the latest version of git, using git, at around 2000 GMT 
today.  I have attached the Makefile and hello.c if anyone finds them useful.

Thanks for any help,

Rhys


hello: src/hello.c
	cc -o hello -O src/hello.c



#include <stdio.h>

main()
{
	printf("Hello, world!\n");
}

```

## Petr Baudis, 2005-04-20 21:35

Subject: Re: Git hangs while executing commit-tree
Message-ID: <20050420213513.GG19112@pasky.ji.cz>
URL: https://gitlist.dev/e/20050420213513.GG19112%40pasky.ji.cz
In-Reply-To: <200504202228.35652.rhys@rhyshardwick.co.uk>

```
Dear diary, on Wed, Apr 20, 2005 at 11:28:35PM CEST, I got a letter
where Rhys Hardwick <rhys@rhyshardwick.co.uk> told me that...
> Hey,

Hi,

> rhys@metatron:~/repo/tmp.repo$ commit-tree 
> c80156fafbac377ab35beb076090c8320f874f91
> Committing initial tree c80156fafbac377ab35beb076090c8320f874f91
>  
> 
> 
> At this point, the command seems to be just waiting.  I have had it waiting 
> for around 2 hours now!  I have tried removing ~/repo/tmp.repo and starting 
> over, with exactly the same results.

just type in your commit message and press ctrl-D now. ;-)

If you can't get along by peeking at the source when you get stuck, etc,
you might prefer using git-pasky (http://pasky.or.cz/~pasky/dev/git/),
which will guide you nicely.

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor

```

## Linus Torvalds, 2005-04-20 21:48

Subject: Re: Git hangs while executing commit-tree
Message-ID: <Pine.LNX.4.58.0504201446510.6467@ppc970.osdl.org>
URL: https://gitlist.dev/e/Pine.LNX.4.58.0504201446510.6467%40ppc970.osdl.org
In-Reply-To: <200504202228.35652.rhys@rhyshardwick.co.uk>

```


On Wed, 20 Apr 2005, Rhys Hardwick wrote:
>
> rhys@metatron:~/repo/tmp.repo$ commit-tree  c80156fafbac377ab35beb076090c8320f874f91
> Committing initial tree c80156fafbac377ab35beb076090c8320f874f91
>  
> At this point, the command seems to be just waiting.

That's _exactly_ what it's doing. It's waiting for you to write a commit 
message.

Something like

	This is my initial commit of Hello World!
	^D

will make it happy.

Alternatively, you can certainly just write your message beforehand with 
an editor and just pipe it into commit-tree.

			Linus

```

## David Greaves, 2005-04-20 22:08

Subject: Re: Git hangs while executing commit-tree
Message-ID: <4266D2D0.5000503@dgreaves.com>
URL: https://gitlist.dev/e/4266D2D0.5000503%40dgreaves.com
In-Reply-To: <Pine.LNX.4.58.0504201446510.6467@ppc970.osdl.org>

```
Linus Torvalds wrote:
> 
> On Wed, 20 Apr 2005, Rhys Hardwick wrote:
> 
>>rhys@metatron:~/repo/tmp.repo$ commit-tree  c80156fafbac377ab35beb076090c8320f874f91
>>Committing initial tree c80156fafbac377ab35beb076090c8320f874f91
>> 
>>At this point, the command seems to be just waiting.
> 
> 
> That's _exactly_ what it's doing. It's waiting for you to write a commit 
> message.
> 
> Something like
> 
> 	This is my initial commit of Hello World!
> 	^D
> 
> will make it happy.
> 
> Alternatively, you can certainly just write your message beforehand with 
> an editor and just pipe it into commit-tree.
> 
> 			Linus

When someone commits the docs I'll submit the next patch for the README:

commit-tree
	commit-tree <sha1> [-p <parent sha1>...] < changelog

Creates a new commit object based on the provided tree object and
emits the new commit object id on stdout. If no parent is given then
it is considered to be an initial tree.

A commit comment is read from stdin (max 999 chars)

A commit object usually has 1 parent (a commit after a change) or 2
parents (a merge) although there is no reason it cannot have more than
2 parents.

While a tree represents a particular directory state of a working
directory, a commit represents that state in "time", and explains how
to get there.

Normally a commit would identify a new "HEAD" state, and while git
doesn't care where you save the note about that state, in practice we
tend to just write the result to the file ".git/HEAD", so that we can
always see what the last committed state was.

Options

<sha1>
	An existing tree object

-p <parent sha1>
	Each -p indicates a the id of a parent commit object.
	

Commit Information

A commit encapsulates:
	all parent object ids
	author name, email and date
	committer name and email and the commit time.

If not provided, commit-tree uses your name, hostname and domain to
provide author and committer info. This can be overridden using the
following environment variables.
	AUTHOR_NAME
	AUTHOR_EMAIL
	AUTHOR_DATE
	COMMIT_AUTHOR_NAME
	COMMIT_AUTHOR_EMAIL
(nb <,> and CRs are stripped)

see also: write-tree

David
-- 

```
