Commit graph

14 commits

Author SHA1 Message Date
Petr Baudis f1a7eb36b0 Merge with http://members.cox.net/junkio/git-jc.git 2005-05-11 02:00:49 +02:00
Petr Baudis c899350e9d write-tree is now willing to write empty tree
Cogito wants to be able to do some initial commit at the time of cg-init,
which may be empty in case when cg-init is called in an empty tree.
2005-05-08 16:15:59 +02:00
Junio C Hamano 8eef4d3ed1 Notice index that has path and path/file and refuse to write such a tree.
Kay Sievers noticed that you can have both path and path/file in
the cache and write-tree happily creates a tree object from such
a state.  Since a merge can result in such situation and the
user should be able to see the situation by looking at the
cache, rather than forbidding add_cache_entry() to create such
conflicts, fix it by making write-tree refuse to write such an
nonsensical tree.  Here is a test case.

-- test case --

$ ls -a
./  ../
$ git-init-db
defaulting to local storage area
$ date >path
$ git-update-cache --add path
$ rm path
$ mkdir path
$ date >path/file
$ git-update-cache --add path/file
$ git-ls-files --stage
100644 1738f2536b1201218c41153941da065cc26174c9 0 path
100644 620c72f1c1de15f56ff9d63d6d7cdc69e828f1e3 0 path/file
$ git-ls-tree $(git-write-tree)                     ;# using old one
100644	blob	1738f2536b1201218c41153941da065cc26174c9	path
040000	tree	ec116937f223e3df95aeac9f076902ae1618ae98	path
$ ../git-write-tree                                 ;# using new one
You have both path and path/file
fatal: write-tree: not able to write tree
$ exit

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-05-07 12:22:02 -07:00
Christopher Li 812666c8e6 [PATCH] introduce xmalloc and xrealloc
Introduce xmalloc and xrealloc to die gracefully with a descriptive
message when out of memory, rather than taking a SIGSEGV. 

Signed-off-by: Christopher Li<chrislgit@chrisli.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-26 12:00:58 -07:00
Linus Torvalds a44c9a5e2e Simplify "write_sha1_file()" interfaces
The write function now adds the header to the file by itself, so there
is no reason to duplicate it among all the users any more.
2005-04-25 10:19:53 -07:00
Brad Roberts 7223a88ce7 [PATCH] fix for memory leak in write-tree.c
Fix a memory leak in write-tree.c, not freeing the directory buffer.
2005-04-17 10:55:12 -07:00
Linus Torvalds c347ea5d6f write-tree: refuse to write out trees with unmerged index entries.
Of course, we can't even generate such an index yet, but give me
some time. This is a cunning plan. Let's see if it actually works.

(I feel like Wile E Coyote, waiting for the big rock to fall).
2005-04-15 22:04:54 -07:00
Linus Torvalds ccc4feb579 Convert the index file reading/writing to use network byte order.
This allows using a git tree over NFS with different byte order, and
makes it possible to just copy a fully populated repository and have
the end result immediately usable (needing just a refresh to update
the stat information).
2005-04-15 10:44:27 -07:00
Petr Baudis 2de381f919 [PATCH] Consolidate the error handling
Now there is error() for "library" errors and die() for fatal "application"
errors. usage() is now used strictly only for usage errors.

Signed-off-by: Petr Baudis <pasky@ucw.cz>
2005-04-13 02:28:48 -07:00
Linus Torvalds 121481abf8 Make "update-cache" a bit friendlier to use (and harder to mis-use).
It now requires the "--add" flag before you add any new files, and
a "--remove" file if you want to mark files for removal. And giving
it the "--refresh" flag makes it just update all the files that it
already knows about.
2005-04-10 11:32:54 -07:00
Linus Torvalds d6d3f9d012 This implements the new "recursive tree" write-tree.
It's got some debugging printouts etc still in it, but testing on the
kernel seems to show that it does indeed fix the issue with huge tree
files for each commit.
2005-04-09 17:09:34 -07:00
Linus Torvalds 19b2860cba Use "-Wall -O2" for the compiler to get more warnings.
And fix up the warnings that it pointed out. Let's keep the tree
clean from early on.

Not that the code is very beautiful anyway ;)
2005-04-08 09:59:28 -07:00
Linus Torvalds 8bc9a0c769 Add copyright notices.
The tool interface sucks (especially "committing" information, which is just
me doing everything by hand from the command line), but I think this is in
theory actually a viable way of describing the world. So copyright it.
2005-04-07 15:16:10 -07:00
Linus Torvalds e83c516331 Initial revision of "git", the information manager from hell 2005-04-07 15:13:13 -07:00