Commit Graph

418 Commits

Author SHA1 Message Date
David Greaves
f77b100ada The Makefile is now aware of Documentation/ include directives
It makes the includers (diff commands documentation) depend on the includee
(diff format description).

Signed-off-by: David Greaves <david@dgreaves.com>
Signed-off-by: Petr Baudis <pasky@ucw.cz>
2005-05-14 00:01:41 +02:00
Junio C Hamano
6ca4594312 [PATCH 3/3] Add git-ls-files -k.
When checkout-cache attempts to check out a non-directory where
a directory exists on the work tree, or to check out a file
under directory D when path D is a non-directory on the work
tree, the attempt fails.  Before running checkout-cache, the
user can run git-ls-files with the -k (killed) option to get a
list of such paths.  The tagged output format uses "K" to denote
them.  This is useful for Porcelain layer to be careful when
dealing with the recently corrected behaviour of checkout-cache.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Petr Baudis <pasky@ucw.cz>
2005-05-13 07:34:59 +02:00
Junio C Hamano
a15c1c60db [PATCH 2/3] Support symlinks in git-ls-files --others.
It is kind of surprising that this was missed in the last round,
but the work tree scanner in git-ls-files was still deliberately
ignoring symlinks.  This patch fixes it, so that --others will
correctly report unregistered symlinks.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Petr Baudis <pasky@ucw.cz>
2005-05-13 07:30:23 +02:00
Junio C Hamano
1126b419d6 [PATCH] checkout-cache fix
Fix checkout-cache when existing work tree interferes with the checkout.

This is essentially the same one as the last one I sent to the
GIT list, except that the patch is rebased to the current tip of
the git-pb tree, and an unnecessary call to create_directories()
removed.

The checkout-cache command gets confused when checking out a
file in a subdirectory and the work tree has a symlink to the
subdirectory.  Also it fails to check things out when there is a
non-directory in the work tree when cache expects a directory
there, and vice versa.  This patch fixes the first problem by
making sure all the leading paths in the file being checked out
are indeed directories, and also fixes directory vs
non-directory conflicts when '-f' is specified by removing the
offending paths.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Petr Baudis <pasky@ucw.cz>
2005-05-12 21:36:27 +02:00
Petr Baudis
1424246481 Fixed a leak in read-tree
unpack_tree() would not free the tree object it has read.
2005-05-11 23:16:23 +02:00
Ingo Molnar
c599caca3a [patch] git: cleanup in ls-tree.c
cleanup: this patch adds a free() to ls-tree.c.

(Technically it's not a memory leak yet because the buffer is allocated
once by the function and then the utility exits - but it's a tad cleaner
to not leave such assumptions in the code, so that if someone reuses the
function (or extends the utility to include a loop) the uncleanliness
doesnt develop into a real memory leak.)

Signed-off-by: Ingo Molnar <mingo@elte.hu>

Forward-ported.

Signed-off-by: Petr Baudis <pasky@ucw.cz>
2005-05-11 23:08:20 +02:00
Ingo Molnar
aceedfe32e [patch] git: fix memory leak #2 in checkout-cache.c
this patch fixes another (very rare) memory leak in checkout-cache.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Petr Baudis <pasky@ucw.cz>
2005-05-11 23:05:47 +02:00
Petr Baudis
06cd3b94b2 rev-tree now handles commit problems better
This fixes possible crashes in case of broken commit tree, and makes
rev-tree die in case it cannot parse a given commit.
2005-05-11 23:01:20 +02:00
Jonas Fonseca
1c9da46da4 [PATCH] read_tree_recursive(): Fix leaks
Fix two potential leaks.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Petr Baudis <pasky@ucw.cz>
2005-05-11 22:47:46 +02:00
Petr Baudis
62d046a07b Stick a comment to update-cache.c:refresh_cache() that you can't
just free(archive_cache[i]) when replacing it there.
2005-05-11 22:45:42 +02:00
Ingo Molnar
cb1da3a794 [patch] git: fix overflow in update-cache.c
this patch fixes a 1-byte overflow in update-cache.c (probably not
exploitable). A specially crafted db object might trigger this overflow.

the bug is that normally the 'type' field is parsed by read_sha1_file(),
via:

	if (sscanf(buffer, "%10s %lu", type, size) != 2)

i.e. 0-10 long strings, which take 1-11 bytes of space. Normally the
type strings are stored in char [20] arrays, but in update-cache.c that
is char [10], so a 1 byte overflow might occur.

This should not happen with a 'friendly' DB, as the longest type string
("commit") is 7 bytes long. The fix is to use the customary char [20].

(someone might want to clean those open-coded constants up with a
TYPE_LEN define, they do tend to cause problems like this. I'm not
against open-coded constants (they make code much more readable), but
for fields that get filled in from possibly hostile objects this is
playing with fire.)

hey, this might be the first true security fix for GIT? ;-)

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Petr Baudis <pasky@ucw.cz>
2005-05-11 22:43:24 +02:00
Petr Baudis
071c41a047 Make update-cache be explicit about failed open() when doing
add_file_to_cache().
2005-05-11 22:37:58 +02:00
Junio C Hamano
d81ed1b591 Adjust quoting styles for some environment variables in the documentation.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-05-10 20:54:57 -07:00
Petr Baudis
7ffeb8c24b Document git-merge-cache -o 2005-05-11 04:49:36 +02:00
Petr Baudis
2a45925180 git-merge-cache -o does all the automerges in a single shot
When you pass git-merge-cache the -o option, it tries to do all the
automatic merges and possibly return error if any of them failed, instead
of the default behaviour of failing immediately after the first failed
automatic merge.

Ported from the Cogito branch - Cogito needs this behaviour.
2005-05-11 04:44:59 +02:00
Petr Baudis
f7ec43ae22 More README spelling fixes
Two other README spelling fixes. I wasn't able to pinpoint the relevant
commit in the cogito branch, but they are fairly trivial anyway.
2005-05-11 02:15:14 +02:00
Zack Brown
bebc5c6143 Spelling fixes in README.
Signed-off-by: Zack Brown <zbrown@tumblerings.org>
Signed-off-by: Petr Baudis <pasky@ucw.cz>
2005-05-11 02:08:53 +02:00
Pavel Roskin
90c4851b17 [PATCH] Misc fixes for git-pasky
* README: spell checked

Signed-off-by: Pavel Roskin <proski@gnu.org>

Few more s/ie/i.e./ fixes.

Signed-off-by: Petr Baudis <pasky@ucw.cz>
2005-05-11 02:06:44 +02:00
Petr Baudis
f1a7eb36b0 Merge with http://members.cox.net/junkio/git-jc.git 2005-05-11 02:00:49 +02:00
Petr Baudis
883550481f Mark the variable declarations in .h files as extern
This allows git to be built even with linkers which are not smart enough
to join those symbols, and makes this correct C. Pointed out by several
people.
2005-05-11 00:58:16 +02:00
David Greaves
b790abb874 [PATCH 4/4] split core-git.txt and update
Makefile for html and man

Signed-off-by: David Greaves <david@dgreaves.com>
2005-05-10 15:03:34 -07:00
David Greaves
c1bdacf97e [PATCH 3/4] split core-git.txt and update
Update git environment variable docs
Update first section of command docs (Manipulation commands section)

Signed-off-by: David Greaves <david@dgreaves.com>
2005-05-10 15:01:23 -07:00
David Greaves
204ee6a91b [PATCH 2/4] split core-git.txt and update
Rearrange commands in git.txt

Signed-off-by: David Greaves <david@dgreaves.com>
2005-05-10 14:59:56 -07:00
David Greaves
2cf565c53c [PATCH 1/4] split core-git.txt and update
Split the core-git.txt file
Formatting fix to the diff-format.txt

Signed-off-by: David Greaves <david@dgreaves.com>
2005-05-10 14:55:22 -07:00
Junio C Hamano
3be4b61aa4 Link with -lcrypto instead of -lssl when using openssl libraries.
Mark Allen had trouble with building GIT on his Darwin and
posted a patch to link with -lcrypto instead of -lssl on Darwin.
Later Daniel Barkalow suggested to change it for everybody who
uses openssl, because the relevant functionality is in -lcrypto
not in -lssl, and the current linking happens to work only
because -lssl pulls in -lcrypto.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-05-10 13:25:27 -07:00
Junio C Hamano
b4635be7c9 Do not report size of the object that cannot be written in local-pull.c
Reporting st.st_size with %ld is simply wrong, as H Peter Anvin
says.  No other pull drivers report the failure with size
anyway, so yank it out.  This is a cop-out patch but should be
good enough.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-05-09 23:48:21 -07:00
Junio C Hamano
8ac069ac0a Introduce GIT_DIR environment variable.
During the mailing list discussion on renaming GIT_ environment
variables, people felt that having one environment that lets the
user (or Porcelain) specify both SHA1_FILE_DIRECTORY (now
GIT_OBJECT_DIRECTORY) and GIT_INDEX_FILE for the default layout
would be handy.  This change introduces GIT_DIR environment
variable, from which the defaults for GIT_INDEX_FILE and
GIT_OBJECT_DIRECTORY are derived.  When GIT_DIR is not defined,
it defaults to ".git".  GIT_INDEX_FILE defaults to
"$GIT_DIR/index" and GIT_OBJECT_DIRECTORY defaults to
"$GIT_DIR/objects".

Special thanks for ideas and discussions go to Petr Baudis and
Daniel Barkalow.  Bugs are mine ;-)

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-05-09 22:57:58 -07:00
Junio C Hamano
d19938ab60 Rename environment variables.
H. Peter Anvin mentioned that using SHA1_whatever as an
environment variable name is not nice and we should instead use
names starting with "GIT_" prefix to avoid conflicts.  Here is
what this patch does:

 * Renames the following environment variables:

    New name                           Old Name

    GIT_AUTHOR_DATE                    AUTHOR_DATE
    GIT_AUTHOR_EMAIL                   AUTHOR_EMAIL
    GIT_AUTHOR_NAME                    AUTHOR_NAME
    GIT_COMMITTER_EMAIL                COMMIT_AUTHOR_EMAIL
    GIT_COMMITTER_NAME                 COMMIT_AUTHOR_NAME
    GIT_ALTERNATE_OBJECT_DIRECTORIES   SHA1_FILE_DIRECTORIES
    GIT_OBJECT_DIRECTORY               SHA1_FILE_DIRECTORY

 * Introduces a compatibility macro, gitenv(), which does an
   getenv() and if it fails calls gitenv_bc(), which in turn
   picks up the value from old name while giving a warning about
   using an old name.

 * Changes all users of the environment variable to fetch
   environment variable with the new name using gitenv().

 * Updates the documentation and scripts shipped with Linus GIT
   distribution.

The transition plan is as follows:

 * We will keep the backward compatibility list used by gitenv()
   for now, so the current scripts and user environments
   continue to work as before.  The users will get warnings when
   they have old name but not new name in their environment to
   the stderr.

 * The Porcelain layers should start using new names.  However,
   just in case it ends up calling old Plumbing layer
   implementation, they should also export old names, taking
   values from the corresponding new names, during the
   transition period.

 * After a transition period, we would drop the compatibility
   support and drop gitenv().  Revert the callers to directly
   call getenv() but keep using the new names.

   The last part is probably optional and the transition
   duration needs to be set to a reasonable value.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-05-09 17:57:56 -07:00
Petr Baudis
92747a907c Add copyright notice of Rene Scharfe to tar-tree.c 2005-05-09 23:33:02 +02:00
Junio C Hamano
b3f94c4b55 Fix git-update-cache --cacheinfo error message.
The error detection logic was too lazy to distinguish parameter
error and unable-to-add case.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-05-08 15:31:33 -07:00
David Greaves
03ea280249 [PATCH 2/2] core-git documentation update
Reformat core-git.txt to asciidoc format.
Includes split-docs.pl to create individual txt, html and man pages.

<JC> Editorial note.  I've updated to add git-diff-cache -m and
git-update-cache --replace description on top of the version
David posted to the GIT list and got his OK.

Signed-off-by: David Greaves <david@dgreaves.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-05-08 14:44:20 -07:00
Junio C Hamano
aa575f815e A stylistic fix to read-cache.c
Changes "if (pointer == 0)" to "if (!pointer)" to match the rest
of the code, noticed by Petr Baudis.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-05-08 14:02:19 -07:00
Junio C Hamano
ddd5d0568d Stylistic fixes to sha1_file.c
This fixes stylistic problems and one unused variable spotted by
Petr Baudis.  The buf variable unused in prepare_alt_odb() is
gone and the "creepy" function is more heavily documented.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-05-08 13:51:13 -07:00
David Greaves
cf5af17e45 [PATCH 1/2] core-git documentation update
Sorts core-git.txt into alphabetical order

Signed-off-by: David Greaves <david@dgreaves.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-05-08 12:49:48 -07:00
Thomas Glanzmann
6ffcee883b [PATCH] Really *do* nothing in while loop
A deflate loop in sha1_file.c would have /* nothing */ as its
body, but the semicolon was missing, so the next command was run.
Fortunately the loop went through exactly once so it didn't trigger
an actual bug so far.

Signed-Off-by: Thomas Glanzmann <sithglan@stud.uni-erlangen.de>
Signed-off-by: Petr Baudis <pasky@ucw.cz>
2005-05-08 17:29:33 +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
4c5abf4282 Allow removal of "path" when "path/file" exists.
When we used to have "path" as a file or a symlink, but now we
have "path/file" (or in general, have "path" as a directory), we
would want to remove "path" before adding "path/file".  The
logic in add_file_to_cache() only runs lstat() and does not
detect this case and fails to allow removing it in this case.
In the opposite case of having "path/file" in the index and
having "path" on the filesystem as a file or a symlink we do
allow removal of "path/file", so to be symmetric we should allow
it as well, without forcing the user to say --force-remove.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-05-08 00:05:18 -07:00
Junio C Hamano
192268c197 Add git-update-cache --replace option.
When "path" exists as a file or a symlink in the index, an
attempt to add "path/file" is refused because it results in file
vs directory conflict.  Similarly when "path/file1",
"path/file2", etc. exist, an attempt to add "path" as a file or
a symlink is refused.  With git-update-cache --replace, these
existing entries that conflict with the entry being added are
automatically removed from the cache, with warning messages.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-05-07 21:55:21 -07:00
Junio C Hamano
0f1e4f0401 git-update-cache refuses to add a file where a directory is registed.
And vice versa.  The next commit will introduce an option
--replace to allow replacing existing entries.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-05-07 21:48:12 -07:00
Junio C Hamano
77a837314e Build and install git-get-tar-commit-id
This useful program is not build nor installed by the Makefile.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-05-07 21:44:17 -07:00
Junio C Hamano
a4f35a2dc0 Notice tree objects with duplicate entries.
This is a follow-up fix to the earlier "Notice index that has
path and path/file and refuse to write such a tree" patch.
With this fix, git-fsck-cache complains if a tree object stores
more than one entries with the same name.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-05-07 14:43:32 -07:00
Thomas Glanzmann
29c2cce41b [PATCH] make INSTALL binary in Makefile configurable via make variable
On Solaris machines gnu install called ginstall

<JC> Editorial notes.  I've also changed it to use $(COPTS), $(prefix),
and $(bin) because I always get confused without compiling it with -O1
when I single step in gdb.  The default is left as Linus shipped.

Date:	Sat, 7 May 2005 10:41:54 +0200
Signed-off-by: Thomas Glanzmann <sithglan@stud.uni-erlangen.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-05-07 12:37:49 -07:00
Thomas Glanzmann
a1df57abb9 [PATCH] Add #include <limits.h> so that git compiles under Solaris
<JC> Editorial Note.  We may want to include standard headers in one
of those headers everybody includes, e.g. cache.h, to reduce clutters,
but this commit is as Thomas posted to the GIT list.

Date:	Sat, 7 May 2005 10:41:41 +0200
Signed-off-by: Thomas Glanzmann <sithglan@stud.uni-erlangen.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-05-07 12:32:21 -07:00
Junio C Hamano
c7d1d4e1b5 Use backticks in git-merge-one-file-script instead of $(command).
Thomas Glanzmann says that shell he uses on Solaris cannot grok
$(command) but the script does not use nested $(command) and 
works happily just by using backticks instead.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-05-07 12:26:15 -07: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
Petr Baudis
8c59926f5e Make merge-cache not fail immediatelly when the merge program
fails, but go on and return error code at the end. It makes sense
to try to merge everything, then let the user solve the commits
at once.
2005-05-07 16:09:44 +02:00
Ingo Molnar
36997b45ad Date: Thu Apr 14 08:26:38 2005 +0200
Author: Ingo Molnar <mingo@elte.hu>
    
[patch] git: fix memory leak in checkout-cache.c

this patch fixes a memory leak in checkout-cache.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Petr Baudis <pasky@ucw.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-05-07 01:32:24 -07:00
Junio C Hamano
383f85b72a Free compressed buffer after write_sha1_file() is done.
This does not matter for commands that write just a handful SHA1 files,
but is noticeable in git-convert-cache which essentially traverses the
entire object database.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-05-07 01:27:00 -07:00
Junio C Hamano
651df67bbc Fix usage string of git-diff-cache and add documentation of -m flag.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-05-07 01:11:00 -07:00
Junio C Hamano
e4f5b8c69d Fix thinko in the logic to refuse unmerged path fed to git-apply-patch-script.
An unmerged path is given as the sole parameter to the script, so it
should check against $# being 1, not 2.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-05-07 00:48:00 -07:00