Code

git.git
19 years agoNotice tree objects with duplicate entries.
Junio C Hamano [Sat, 7 May 2005 21:43:32 +0000 (14:43 -0700)]
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>
19 years ago[PATCH] make INSTALL binary in Makefile configurable via make variable
Thomas Glanzmann [Sat, 7 May 2005 08:41:54 +0000 (10:41 +0200)]
[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>
19 years ago[PATCH] Add #include <limits.h> so that git compiles under Solaris
Thomas Glanzmann [Sat, 7 May 2005 08:41:41 +0000 (10:41 +0200)]
[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>
19 years agoUse backticks in git-merge-one-file-script instead of $(command).
Junio C Hamano [Sat, 7 May 2005 19:26:15 +0000 (12:26 -0700)]
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>
19 years agoNotice index that has path and path/file and refuse to write such a tree.
Junio C Hamano [Sat, 7 May 2005 19:22:02 +0000 (12:22 -0700)]
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>
19 years agoDate: Thu Apr 14 08:26:38 2005 +0200
Ingo Molnar [Thu, 14 Apr 2005 06:26:38 +0000 (08:26 +0200)]
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>
19 years agoFree compressed buffer after write_sha1_file() is done.
Junio C Hamano [Sat, 7 May 2005 08:27:00 +0000 (01:27 -0700)]
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>
19 years agoFix usage string of git-diff-cache and add documentation of -m flag.
Junio C Hamano [Sat, 7 May 2005 08:11:00 +0000 (01:11 -0700)]
Fix usage string of git-diff-cache and add documentation of -m flag.

Signed-off-by: Junio C Hamano <junkio@cox.net>
19 years agoFix thinko in the logic to refuse unmerged path fed to git-apply-patch-script.
Junio C Hamano [Sat, 7 May 2005 07:48:00 +0000 (00:48 -0700)]
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>
19 years agoIntroduce SHA1_FILE_DIRECTORIES to support multiple object databases.
Junio C Hamano [Sat, 7 May 2005 07:38:04 +0000 (00:38 -0700)]
Introduce SHA1_FILE_DIRECTORIES to support multiple object databases.

SHA1_FILE_DIRECTORIES environment variable is a colon separated paths
used when looking for SHA1 files not found in the usual place for
reading.  Creating a new SHA1 file does not use this alternate object
database location mechanism.  This is useful to archive older, rarely
used objects into separate directories.

Signed-off-by: Junio C Hamano <junkio@cox.net>
19 years ago[PATCH] Lift path length limits from git-tar-tree.
Rene Scharfe [Sat, 7 May 2005 00:57:06 +0000 (02:57 +0200)]
[PATCH] Lift path length limits from git-tar-tree.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Remove unused sha1_file_directory variable.
Junio C Hamano [Fri, 6 May 2005 23:33:39 +0000 (16:33 -0700)]
[PATCH] Remove unused sha1_file_directory variable.

Now all the users have gone.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Do not initialize sha1_file_directory by hand.
Junio C Hamano [Fri, 6 May 2005 23:32:28 +0000 (16:32 -0700)]
[PATCH] Do not initialize sha1_file_directory by hand.

Some commands initialize sha1_file_directory by hand.  There is no
need to do so; sha1_file.c knows how to handle it.

The next patch will remove the variable altogether.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years agoRevert bogus optimization that avoids index file writes
Linus Torvalds [Fri, 6 May 2005 23:48:43 +0000 (16:48 -0700)]
Revert bogus optimization that avoids index file writes

It didn't properly mark all cache updates as being dirty, and
causes merge errors due to that. In particular, it didn't notice
when a file was force-removed.

Besides, it was ugly as hell. I've put in place a slightly cleaner
version, but I've not enabled the optimization because I don't
want to be burned again.

19 years agodiff-tree: add author/date information to the verbose output
Linus Torvalds [Fri, 6 May 2005 22:33:59 +0000 (15:33 -0700)]
diff-tree: add author/date information to the verbose output

19 years agodate.c: add "show_date()" function.
Linus Torvalds [Fri, 6 May 2005 22:28:59 +0000 (15:28 -0700)]
date.c: add "show_date()" function.

Kind of like ctime(), but not as broken.

19 years ago[PATCH] Document --stdin, -m, -s, and -v flags to git-diff-tree
Junio C Hamano [Fri, 6 May 2005 20:17:13 +0000 (13:17 -0700)]
[PATCH] Document --stdin, -m, -s, and -v flags to git-diff-tree

This updates the usage message string and Documentation/core-git.txt
to describe the new flags added to the git-diff-tree command.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] git-tar-tree: add symlink support
Rene Scharfe [Fri, 6 May 2005 20:56:16 +0000 (22:56 +0200)]
[PATCH] git-tar-tree: add symlink support

Add symlink support to git-tar-tree.

19 years ago[PATCH] git-tar-tree: make file contents accessible to write_header()
Rene Scharfe [Fri, 6 May 2005 20:56:08 +0000 (22:56 +0200)]
[PATCH] git-tar-tree: make file contents accessible to write_header()

Pass pointer to filecontents to write_header() and pass pointer
to filecontents, its size and some flags to write_exntended_header().
These parameters are not used, yet.  They are added in preparation
to symlink support.

19 years ago[PATCH] git-tar-tree: add extended header helpers
Rene Scharfe [Fri, 6 May 2005 20:56:01 +0000 (22:56 +0200)]
[PATCH] git-tar-tree: add extended header helpers

Introduce append_extended_header_prefix(), extended_header_len()
and append_extended_header().  These are helper functions that
make it easier to handle multiple entries in a pax extended
header.  append_log() is no longer needed and can go away.

19 years ago[PATCH] git-tar-tree: add TYPEFLAG_ constants
Rene Scharfe [Fri, 6 May 2005 20:55:52 +0000 (22:55 +0200)]
[PATCH] git-tar-tree: add TYPEFLAG_ constants

Add TYPEFLAG_ constants.

19 years ago[PATCH] git-tar-tree: add get_record()
Rene Scharfe [Fri, 6 May 2005 20:55:42 +0000 (22:55 +0200)]
[PATCH] git-tar-tree: add get_record()

Add get_record() which returns a pointer to the next record in the block.

19 years agodiff-tree: add "verbose header" mode
Linus Torvalds [Fri, 6 May 2005 18:42:47 +0000 (11:42 -0700)]
diff-tree: add "verbose header" mode

This allows you to trivially do fancy and readable output. Something like

git-rev-list HEAD | git-diff-tree -p -v --stdin kernel/ | less -S

gives a nice output of what has changed in the kernel/ subdirectory lately.

19 years ago[PATCH] don't load and decompress objects twice with parse_object()
Nicolas Pitre [Fri, 6 May 2005 17:48:34 +0000 (13:48 -0400)]
[PATCH] don't load and decompress objects twice with parse_object()

It turns out that parse_object() is loading and decompressing given
object to free it just before calling the specific object parsing
function which does mmap and decompress the same object again. This
patch introduces the ability to parse specific objects directly from a
memory buffer.

Without this patch, running git-fsck-cache on the kernel repositorytake:

real    0m13.006s
user    0m11.421s
sys     0m1.218s

With this patch applied:

real    0m8.060s
user    0m7.071s
sys     0m0.710s

The performance increase is significant, and this is kind of a
prerequisite for sane delta object support with fsck.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years agogit-diff-tree: clean up output
Linus Torvalds [Fri, 6 May 2005 17:56:35 +0000 (10:56 -0700)]
git-diff-tree: clean up output

This only shows the tree headers when something actually changed. Also,
add a "silent" mode, which doesn't actually show the changes at all,
just the commit information.

19 years agodiff-tree: support list if input trees on stdin
Linus Torvalds [Fri, 6 May 2005 17:03:17 +0000 (10:03 -0700)]
diff-tree: support list if input trees on stdin

This means that you can do

git-rev-list HEAD --max-count=10 | git-diff-tree --stdin update-cache.c

to see which (if any) of the last ten commits changed update-cache.c.

Use the "-m" flag to see merges too. Normally they are suppressed.

19 years ago[PATCH] control/limit output of git-rev-list
Kay Sievers [Fri, 6 May 2005 08:00:11 +0000 (10:00 +0200)]
[PATCH] control/limit output of git-rev-list

gitweb.cgi's default view is the log of the last day and git-rev-list
can stop crawling the whole repo if we have all our data to display in the
browser. Also the rss-feed query needs only the last 20 items. This
will speeds up these queries dramatically.

  usage: rev-list [OPTION] commit-id
    --max-count=nr
    --max-age=epoch
    --min-age=epoch

Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years agoupdate-cache: remove compiler warning
Linus Torvalds [Fri, 6 May 2005 15:49:07 +0000 (08:49 -0700)]
update-cache: remove compiler warning

"Unused variable len"

19 years ago[PATCH] fix compare symlink against readlink not data
Kay Sievers [Fri, 6 May 2005 13:45:01 +0000 (15:45 +0200)]
[PATCH] fix compare symlink against readlink not data

Fix update-cache to compare the blob of a symlink against the link-target
and not the file it points to. Also ignore all permissions applied to
links.

Thanks to Greg for recognizing this while he added our list of symlinks
back to the udev repository.

Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years agoSteal -t option to git-ls-files from Cogito fork.
Petr Baudis [Fri, 22 Apr 2005 02:47:08 +0000 (19:47 -0700)]
Steal -t option to git-ls-files from Cogito fork.

This backports the -t option git-ls-files in Cogito added to the Linus
version.

Signed-off-by: Petr Baudis <pasky@ucw.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
19 years agoImplement -v (verbose) option for pull methods other than local transport.
Junio C Hamano [Fri, 6 May 2005 08:37:21 +0000 (01:37 -0700)]
Implement -v (verbose) option for pull methods other than local transport.

This moves the private "say()" function to pull.c, renames it to
"pull_say()", and introduces a global variable "get_verbosely" that
makes the pull backends report what they fetch.  The -v option is
added to git-rpull and git-http-pull to match git-local-pull.

The documentation is updated to describe these pull commands.

Signed-off-by: Junio C Hamano <junkio@cox.net>
19 years agoAdd http and local transport support for git-pull-script.
Junio C Hamano [Fri, 6 May 2005 08:12:04 +0000 (01:12 -0700)]
Add http and local transport support for git-pull-script.

Signed-off-by: Junio C Hamano <junkio@cox.net>
19 years agoAdd documentation for the rest of commands.
Junio C Hamano [Fri, 6 May 2005 06:50:22 +0000 (23:50 -0700)]
Add documentation for the rest of commands.

This adds descriptions for the core GIT commands that were not
mentioned in the previous version.

Signed-off-by: Junio C Hamano <junkio@cox.net>
19 years agoAdjust core-git documentation to more recent Linus GIT.
Junio C Hamano [Fri, 6 May 2005 06:49:58 +0000 (23:49 -0700)]
Adjust core-git documentation to more recent Linus GIT.

Signed-off-by: Junio C Hamano <junkio@cox.net>
19 years agoReference documentation for the core git commands.
David Greaves [Fri, 6 May 2005 06:48:52 +0000 (23:48 -0700)]
Reference documentation for the core git commands.

Signed-off-by: David Greaves <david@dgreaves.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
19 years agoMerge of http://members.cox.net/junkio/git-jc.git
Linus Torvalds [Fri, 6 May 2005 01:30:18 +0000 (18:30 -0700)]
Merge of http://members.cox.net/junkio/git-jc.git

19 years ago[PATCH] create subdirs for symlinks
Kay Sievers [Thu, 5 May 2005 23:34:10 +0000 (01:34 +0200)]
[PATCH] create subdirs for symlinks

We may need to create subdirectories, before we can create a
symlink.

Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years agoBe more careful about tree entry modes.
Linus Torvalds [Thu, 5 May 2005 23:18:48 +0000 (16:18 -0700)]
Be more careful about tree entry modes.

The tree object parsing used to get the executable bit wrong,
and didn't know about symlinks. Also, fsck really wants the
full mode value so that it can verify the other bits for sanity,
so save it all in struct tree_entry.

19 years agoOctopus merge of the following five patches.
Junio C Hamano [Thu, 5 May 2005 23:16:54 +0000 (16:16 -0700)]
Octopus merge of the following five patches.

  Update git-apply-patch-script for symbolic links.
  Make git-prune-script executable again.
  Do not write out new index if nothing has changed.
  diff-cache shows differences for unmerged paths without --cache.
  Update diff engine for symlinks stored in the cache.

Signed-off-by: Junio C Hamano <junkio@cox.net>
19 years agoUpdate git-apply-patch-script for symbolic links.
Junio C Hamano [Thu, 5 May 2005 23:14:01 +0000 (16:14 -0700)]
Update git-apply-patch-script for symbolic links.

This patch updates the git-apply-patch-script for the symbolic links
in the cache, recently added by Kay Sievers.

It currently is very anal about symbolic link changes.  It refuses to
change between a regular file and a symbolic link, and only allows
symbolic link changes if the patch is based on the same original.

Signed-off-by: Junio C Hamano <junkio@cox.net>
19 years agoUpdate diff engine for symlinks stored in the cache.
Junio C Hamano [Thu, 5 May 2005 23:10:21 +0000 (16:10 -0700)]
Update diff engine for symlinks stored in the cache.

This patch updates the external diff interface engine for the change
to store the symbolic links in the cache, recently done by Kay
Sievers.

The main thing it does is when comparing with the work tree, it
prepares the counterpart to the blob being compared by doing a
readlink followed by sending that result to a temporary file to
be diffed.

Signed-off-by: Junio C Hamano <junkio@cox.net>
19 years agoFix git-resolve-script.
Linus Torvalds [Thu, 5 May 2005 23:07:56 +0000 (16:07 -0700)]
Fix git-resolve-script.

I'd stupidly forgotten one merge_head -> merge conversion, and
all my tests were for the fast-forward case that never triggered
the bug.

19 years agoFix symlink handling
Linus Torvalds [Thu, 5 May 2005 23:01:46 +0000 (16:01 -0700)]
Fix symlink handling

We really always want to have S_IFREG there for non-symlinks,
otherwise we create corrupt index files.

19 years agodiff-cache shows differences for unmerged paths without --cache.
Junio C Hamano [Thu, 5 May 2005 22:35:49 +0000 (15:35 -0700)]
diff-cache shows differences for unmerged paths without --cache.

While manually resolving a merge conflict, being able to run
diff-cache without --cache option between files in the work tree
and either of the ancestor trees is helpful to verify the hand
merged result.  However, diff-cache refuses to handle unmerged
paths, even when run without --cache option.

This changes the behaviour so that the above use case will
report the differences between the compared tree and the magic
0{40} SHA1 (i.e. "look at the work tree").  When there is no
corresponding file in the work tree, or when the command is run
with "--cache" option, it continues to report "unmerged".

Signed-off-by: Junio C Hamano <junkio@cox.net>
19 years agoDo not write out new index if nothing has changed.
Junio C Hamano [Thu, 5 May 2005 22:29:06 +0000 (15:29 -0700)]
Do not write out new index if nothing has changed.

The git-update-cache command, especially with --refresh, may not change
anything.  In such a case, writing 1.6MB of the same thing is a waste.

Signed-off-by: Junio C Hamano <junkio@cox.net>
19 years agoMake git-prune-script executable again.
Junio C Hamano [Thu, 5 May 2005 22:10:49 +0000 (15:10 -0700)]
Make git-prune-script executable again.

I do not know why the executable bit was lost since the change went in as
GIT pull, not via e-mail patch, but here is a fix.

Signed-off-by: Junio C Hamano <junkio@cox.net>
19 years ago[PATCH] git: Mention the '-p' option in the usage help string if git-diff-tree.
Thomas Glanzmann [Thu, 5 May 2005 19:51:34 +0000 (21:51 +0200)]
[PATCH] git: Mention the '-p' option in the usage help string if git-diff-tree.

Mention the '-p' option in the usage help string of git-diff-tree.

Signed-Off-by: Thomas Glanzmann <sithglan@stud.uni-erlangen.de>
Signed-Off-by: Linus Torvalds <torvalds@osdl.org>
19 years agoSplit "git-pull-script" into two parts
Linus Torvalds [Thu, 5 May 2005 18:43:30 +0000 (11:43 -0700)]
Split "git-pull-script" into two parts

Separate out the merge resolve from the actual getting of the
data. Also, update the resolve phase to take advantage of the
fact that we don't need to do the commit->tree object lookup
by hand, since all the actors involved happily just act on a
commit object these days.

19 years agogit-diff-cache: add "-m" flag to match all non-checked-out files with the index.
Linus Torvalds [Thu, 5 May 2005 16:31:09 +0000 (09:31 -0700)]
git-diff-cache: add "-m" flag to match all non-checked-out files with the index.

This allows you to work with a directory tree that isn't fully populated,
without making diff-cache say that all the files are gone.

19 years ago[PATCH] git and symlinks as tracked content
Kay Sievers [Thu, 5 May 2005 12:38:25 +0000 (14:38 +0200)]
[PATCH] git and symlinks as tracked content

Allow to store and track symlink in the repository. A symlink is stored
the same way as a regular file, only with the appropriate mode bits set.
The symlink target is therefore stored in a blob object.
This will hopefully make our udev repository fully functional. :)

Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Fix git rpush.
Anton Altaparmakov [Thu, 5 May 2005 12:31:53 +0000 (13:31 +0100)]
[PATCH] Fix git rpush.

Following up from my fix to rpull, please also apply this, which fixes
rpush.c to call git-rpull rather than rpull which no longer exists after
the Big Rename(TM)...

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Fix git rpull.
Anton Altaparmakov [Thu, 5 May 2005 11:30:25 +0000 (12:30 +0100)]
[PATCH] Fix git rpull.

This fixes rpull.c to call git-rpush rather than rpush which no longer
exists after the Big Rename(TM)...

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years agogit-pull-script: do the diffstat also for the fast-forward case
Linus Torvalds [Thu, 5 May 2005 09:21:42 +0000 (02:21 -0700)]
git-pull-script: do the diffstat also for the fast-forward case

This way you always see what the state change was.

19 years agoMerge http://members.cox.net/junkio/git-jc.git/
Linus Torvalds [Thu, 5 May 2005 01:18:40 +0000 (18:18 -0700)]
Merge http://members.cox.net/junkio/git-jc.git/

19 years agoMake "git-prune-script" take all refs into account.
Linus Torvalds [Thu, 5 May 2005 00:26:41 +0000 (17:26 -0700)]
Make "git-prune-script" take all refs into account.

This avoids pruning the kernel v2.6.11 tree that now has a tag.

19 years agoTeach fsck-cache to accept non-commits for reachability analysis.
Linus Torvalds [Thu, 5 May 2005 00:03:09 +0000 (17:03 -0700)]
Teach fsck-cache to accept non-commits for reachability analysis.

In particular, teach it about tags. Also, to make reachability actually
work for tags, we need to add the ref to the tagged object.

19 years agoTeach "git-pull-script" about alternate HEAD's to pull..
Linus Torvalds [Thu, 5 May 2005 00:02:16 +0000 (17:02 -0700)]
Teach "git-pull-script" about alternate HEAD's to pull..

People are already starting to use a multi-head model.

19 years ago[PATCH] Fix memory leaks in git-fsck-cache
Sergey Vlasov [Wed, 4 May 2005 17:44:15 +0000 (21:44 +0400)]
[PATCH] Fix memory leaks in git-fsck-cache

This patch fixes memory leaks in parse_object() and related functions;
these leaks were very noticeable when running git-fsck-cache.

Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years agoWhen the patch tries to create a new file and the file exists, abort.
Junio C Hamano [Wed, 4 May 2005 17:45:36 +0000 (10:45 -0700)]
When the patch tries to create a new file and the file exists, abort.

This fixes an error introduced to git-apply-patch-script in the previous
round.  We do not invoke patch for create/delete case, so we need to
be a bit careful about detecting conflicts like this.

Signed-off-by: Junio C Hamano <junkio@cox.net>
19 years agogit-pull-script: add a final "diffstat" to show the result of the merge.
Linus Torvalds [Wed, 4 May 2005 14:12:18 +0000 (07:12 -0700)]
git-pull-script: add a final "diffstat" to show the result of the merge.

This is useful to verify that you got the right thing.

19 years agoOptimize diff-cache -p --cached
Junio C Hamano [Wed, 4 May 2005 08:45:24 +0000 (01:45 -0700)]
Optimize diff-cache -p --cached

This patch optimizes "diff-cache -p --cached" by avoiding to
inflate blobs into temporary files when the blob recorded in the
cache matches the corresponding file in the work tree.  The file
in the work tree is passed as the comparison source in such a
case instead.

This optimization kicks in only when we have already read the
cache this optimization and this is deliberate.  Especially,
diff-tree does not use this code, because changes are contained
in small number of files relative to the project size most of
the time, and reading cache is so expensive for a large project
that the cost of reading it outweighs the savings by not
inflating blobs.

Also this patch cleans up the structure passed from diff clients
by removing one unused structure member.

Signed-off-by: Junio C Hamano <junkio@cox.net>
19 years agoTerminate diff-* on non-zero exit from GIT_EXTERNAL_DIFF
Junio C Hamano [Wed, 4 May 2005 08:38:06 +0000 (01:38 -0700)]
Terminate diff-* on non-zero exit from GIT_EXTERNAL_DIFF

(slightly updated from the version posted to the GIT mailing list
with small bugfixes).

This patch changes the git-apply-patch-script to exit non-zero when
the patch cannot be applied.  Previously, the external diff driver
deliberately ignored the exit status of GIT_EXTERNAL_DIFF command,
which was a design mistake.  It now stops the processing when
GIT_EXTERNAL_DIFF exits non-zero, so the damages from running
git-diff-* with git-apply-patch-script between two wrong trees can be
contained.

The "diff" command line generated by the built-in driver is changed to
always exit 0 in order to match this new behaviour.  I know Pasky does
not use GIT_EXTERNAL_DIFF yet, so this change should not break Cogito,
either.

Signed-off-by: Junio C Hamano <junkio@cox.net>
19 years agoGit-prune-script loses blobs referenced from an uncommitted cache.
Junio C Hamano [Wed, 4 May 2005 08:33:33 +0000 (01:33 -0700)]
Git-prune-script loses blobs referenced from an uncommitted cache.

(updated from the version posted to GIT mailing list).

When a new blob is registered with update-cache, and before the cache
is written as a tree and committed, git-fsck-cache will find the blob
unreachable.  This patch adds a new flag, "--cache" to git-fsck-cache,
with which it keeps such blobs from considered "unreachable".

The git-prune-script is updated to use this new flag.  At the same time
it adds .git/refs/*/* to the set of default locations to look for heads,
which should be consistent with expectations from Cogito users.

Without this fix, "diff-cache -p --cached" after git-prune-script has
pruned the blob object will fail mysteriously and git-write-tree would
also fail.

Signed-off-by: Junio C Hamano <junkio@cox.net>
19 years agoShort-cut error return path in git-local-pull.
Junio C Hamano [Wed, 4 May 2005 08:28:45 +0000 (01:28 -0700)]
Short-cut error return path in git-local-pull.

When git-local-pull with -l option gets ENOENT attempting to create
a hard link, there is no point falling back to other copy methods.
With this patch, git-local-pull detects such a case and gives up
copying the file early.

Signed-off-by: Junio C Hamano <junkio@cox.net>
19 years agoMake git-*-pull say who wants them for missing objects.
Junio C Hamano [Wed, 4 May 2005 08:26:24 +0000 (01:26 -0700)]
Make git-*-pull say who wants them for missing objects.

This patch updates pull.c, the engine that decides which objects are
needed, given a commit to traverse from, to report which commit was
calling for the object that cannot be retrieved from the remote side.
This complements git-fsck-cache in that it checks the consistency of
the remote repository for reachability.

Signed-off-by: Junio C Hamano <junkio@cox.net>
19 years agosha1_file: make the new sha1 object writing be coda-friendly.
Linus Torvalds [Tue, 3 May 2005 22:16:18 +0000 (15:16 -0700)]
sha1_file: make the new sha1 object writing be coda-friendly.

Coda doesn't like cross-directory hardlinks. So try to fall back
on a plain rename instead.

19 years agoImprove sha1 object file writing.
Linus Torvalds [Tue, 3 May 2005 18:46:16 +0000 (11:46 -0700)]
Improve sha1 object file writing.

Make it much safer: we write to a temporary file, and then link that
temporary file to the final destination. This avoids all the nasty
races if several people write the same object at the same time.

It should also result in nicer on-disk layout, since it means that
objects all get created in the same subdirectory. That makes a lot
of block allocation algorithms happier, since the objects will now
be allocated from the same zone.

19 years agofsck-cache: fix SIGSEGV on bad tag object
Linus Torvalds [Tue, 3 May 2005 14:57:56 +0000 (07:57 -0700)]
fsck-cache: fix SIGSEGV on bad tag object

fsck_tag() failes to notice that the parsing of the tag may
have failed in the parse_object() call on the object that it
is tagging.

Noticed by Junio.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years agoAutomatic merge of /home/torvalds/junkio/.git/
Linus Torvalds [Tue, 3 May 2005 14:30:10 +0000 (07:30 -0700)]
Automatic merge of /home/torvalds/junkio/.git/

19 years agofsck-cache: report broken links correctly
Linus Torvalds [Tue, 3 May 2005 04:10:54 +0000 (21:10 -0700)]
fsck-cache: report broken links correctly

We reported the type of te missing object incorrectly: we reported it as
the type of the referrer object, not the object that was referred to.

19 years agoMake fsck-cache do better tree checking.
Linus Torvalds [Mon, 2 May 2005 23:13:18 +0000 (16:13 -0700)]
Make fsck-cache do better tree checking.

We check the ordering of the entries, and we verify that none
of the entries has a slash in it (this allows us to remove the
hacky "has_full_path" member from the tree structure, since we
now just test it by walking the tree entries instead).

19 years ago[PATCH] Fix warning in convert-cache
tony.luck@intel.com [Mon, 2 May 2005 17:57:02 +0000 (10:57 -0700)]
[PATCH] Fix warning in convert-cache

gcc 3.4.3 kicks out this warning:
convert-cache.c: In function `write_subdirectory':
convert-cache.c:102: warning: field precision is not type int (arg 4)

Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years agofsck-cache: sort entries by inode number
Linus Torvalds [Mon, 2 May 2005 16:06:33 +0000 (09:06 -0700)]
fsck-cache: sort entries by inode number

This improves the cold-cache behaviour on most filesystems,
since it makes the fsck access patterns more regular on
the disk, rather than seeking back and forth.

Note the "most". Not all filesystems have any relationship
between inode number and location on disk.

19 years agoUpdate git-merge-one-file-script.
Junio C Hamano [Mon, 2 May 2005 06:53:32 +0000 (23:53 -0700)]
Update git-merge-one-file-script.

With this change, git-merge-one-file-script ceases to smudge
files in the work tree when recording the trivial merge results
(conflicting auto-merge failure case does not touch the work
tree file as before).

Signed-off-by: Junio C Hamano <junkio@cox.net>
19 years agoImplement git-update-cache --force-remove <path>
Junio C Hamano [Mon, 2 May 2005 06:50:51 +0000 (23:50 -0700)]
Implement git-update-cache --force-remove <path>

This new flag tells git-update-cache to remove the named path even
when the work tree still happens to have the file.  It is used to
update git-merge-one-file-script not to smudge the work tree.

Signed-off-by: Junio C Hamano <junkio@cox.net>
19 years agoAdd git-write-blob.
Junio C Hamano [Mon, 2 May 2005 06:45:49 +0000 (23:45 -0700)]
Add git-write-blob.

A new command, git-write-blob, is introduced.  This registers
the contents of any file on the filesystem as a blob in the
object database and reports its SHA1 to the standard output.
To implement it, the patch promotes index_fd() from a static
function in update-cache.c to extern and moves it to a library
source, sha1_file.c.

This command is used to update git-merge-one-file-script so that
it does not smudge the work tree.

Signed-off-by: Junio C Hamano <junkio@cox.net>
19 years agoMake git-apply-patch-script executable.
Junio C Hamano [Mon, 2 May 2005 06:17:28 +0000 (23:17 -0700)]
Make git-apply-patch-script executable.

19 years agoChange the prefix for builtin diff generation.
Linus Torvalds [Mon, 2 May 2005 04:53:36 +0000 (21:53 -0700)]
Change the prefix for builtin diff generation.

It's silly, and it shouldn't matter, but every time I look at
the diffs, I ended up just worrying why "l/" and "k/" as the
prefixes.

Junio says it's a tribute to linux-kernel, but graciously also
said I can change it to something else. So make it "a/" and "b/"
until somebody else complains ;)

19 years ago[PATCH] git-export complains about mising cat-file
Alexey Nezhdanov [Mon, 2 May 2005 04:23:04 +0000 (21:23 -0700)]
[PATCH] git-export complains about mising cat-file

Fixes bits leaved during name change.

Signed-off-by: Alexey Nezhdanov <snake@penza-gsm.ru>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] git-local-pull updates
Junio C Hamano [Mon, 2 May 2005 04:10:04 +0000 (21:10 -0700)]
[PATCH] git-local-pull updates

This is to be applied on top of the previous patch to add
git-local-pull command.  In addition to the '-l' (attempt
hardlink before anything else) and the '-s' (then attempt
symlink) flags, it adds '-n' (do not fall back to file copy)
flag.  Also it updates the comments.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] typo fixes to git-apply-patch-script
Junio C Hamano [Mon, 2 May 2005 04:09:28 +0000 (21:09 -0700)]
[PATCH] typo fixes to git-apply-patch-script

When git-apply-patch-script creates a new file without
executable mode set, a typo caused it not to report that
activity to the user.  Also it was mistakenly running
git-update-cache twice for newly created or deleted paths.  This
patch fixes these problems.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Add git-local-pull.
Junio C Hamano [Mon, 2 May 2005 04:09:28 +0000 (21:09 -0700)]
[PATCH] Add git-local-pull.

This adds the git-local-pull command as a smaller brother of
http-pull and rpull.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Do not call fetch() when we have it.
Junio C Hamano [Mon, 2 May 2005 04:07:40 +0000 (21:07 -0700)]
[PATCH] Do not call fetch() when we have it.

Currently pull() calls fetch() without checking whether we have
the wanted object but all of the existing fetch()
implementations perform this check and return success
themselves.  This patch moves the check to the caller.

I will be sending a trivial git-local-pull which depends on
this in the next message.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Make git-update-cache --refresh fail if update/merge needed.
Junio C Hamano [Mon, 2 May 2005 04:07:40 +0000 (21:07 -0700)]
[PATCH] Make git-update-cache --refresh fail if update/merge needed.

Scripts may find it useful if they do not have to parse the
output from the command but just can rely on its exit status.

Earlier both Linus and myself thought this would be necessary to
make git-prune-script safer but it turns out that the issue was
somewhere else and not related to what this patch addresses.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years agoFix missing '\n' at end of git-cat-file -t output.
Linus Torvalds [Mon, 2 May 2005 02:40:39 +0000 (19:40 -0700)]
Fix missing '\n' at end of git-cat-file -t output.

19 years agoMake "cat-file" use "read_object_with_reference()"
Linus Torvalds [Mon, 2 May 2005 02:28:18 +0000 (19:28 -0700)]
Make "cat-file" use "read_object_with_reference()"

This means that you can take a tag object, and do

git-cat-file commit tagname

and it will cat the commit that the tag points to. Or you can
cat the tree that a commit (or tag) points to.

It still gives the old behaviour if you just give it the
original type, ie if you want to see the tag object itself,
you'd do

git-cat-file -t tagname

and you'd get the expected tag output.

19 years agoRemove the ugly jit-style parent syntax.
Linus Torvalds [Mon, 2 May 2005 02:16:06 +0000 (19:16 -0700)]
Remove the ugly jit-style parent syntax.

If somebody wants it later, we can re-do it, but for now we consider
it an experiment that wasn't worth it. Git will still honor symbolic
names, it just won't look up parents for you.

Of course, you can always do it by hand if you want to.

19 years agoAdd "look up parent" logic for the simple names.
Linus Torvalds [Mon, 2 May 2005 01:13:16 +0000 (18:13 -0700)]
Add "look up parent" logic for the simple names.

It uses the jit syntax, at least for now. 0-xxxx is the first parent of xxxx,
while 1-xxxx is the second, and so on. You can use just "-xxxx" for the first
parent, but a lot of commands will think that the initial '-' implies a
command line flag.

19 years agoAdd "get_sha1()" helper function.
Linus Torvalds [Sun, 1 May 2005 23:36:56 +0000 (16:36 -0700)]
Add "get_sha1()" helper function.

This allows the programs to use various simplified versions of
the SHA1 names, eg just say "HEAD" for the SHA1 pointed to by
the .git/HEAD file etc.

For example, this commit has been done with

git-commit-tree $(git-write-tree) -p HEAD

instead of the traditional "$(cat .git/HEAD)" syntax.

19 years agodate handling: handle "AM"/"PM" on time
Linus Torvalds [Sun, 1 May 2005 19:34:56 +0000 (12:34 -0700)]
date handling: handle "AM"/"PM" on time

And be a bitmore careful about matching: if we don't recognize a word
or a number, we skip the whole thing, rather than trying the next character
in that word/number.

Finally: since ctime() adds the final '\n', don't add another one in test-date.

19 years agodate.c: allow even more varied time formats
Linus Torvalds [Sun, 1 May 2005 18:48:34 +0000 (11:48 -0700)]
date.c: allow even more varied time formats

(and some added checks for truly non-sensical stuff)

19 years ago[PATCH] Allow removing files in a subdirectory.
Junio C Hamano [Sun, 1 May 2005 16:33:12 +0000 (09:33 -0700)]
[PATCH] Allow removing files in a subdirectory.

I found this during a conflict merge testing.  The original did
not have either DF (a file) or DF/DF (a file DF/DF under a
directory DF).  One side created DF, the other created DF/DF.  I
first resolved DF as a new file by taking what the first side
did.  After that, the entry DF/DF cannot be resolved by running
git-update-cache --remove although it does not exist on the
filesystem.

    $ /bin/ls -F
    AN  DF  MN  NM  NN  SS  Z/
    $ git-ls-files --stage | grep DF
    100644 71420ab81e254145d26d6fc0cddee64c1acd4787 0 DF
    100644 68a6d8b91da11045cf4aa3a5ab9f2a781c701249 2 DF/DF
    $ git-update-cache --remove DF/DF
    fatal: Unable to add DF/DF to database

It turns out that the errno from open() in this case was not
ENOENT but ENOTDIR, which the code did not check.  Here is a
fix.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Really fix git-merge-one-file-script this time.
Junio C Hamano [Sun, 1 May 2005 16:33:12 +0000 (09:33 -0700)]
[PATCH] Really fix git-merge-one-file-script this time.

The merge-cache program was updated to pass executable bits when
calling git-merge-one-file-script, but the called script
supplied as an example were not using them carefully.

This patch fixes the following problems in the script:

 * When a new file is created in a directory, which is a file in
   the work tree, it tried to create leading directory but did
   not check for failure from the "mkdir -p" command.

 * The script did not check the exit status from the
   git-update-cache command at all.

 * The parameter "$4" to the script is a file name that can
   contain almost any characters, so it must be quoted with
   double quotes and also needs to be preceded with -- to mark
   it as a non-option when passed to certain commands.

 * The chmod command was used with parameter "$6" or "$7" to set
   the mode bits.  This contradicts with the strategy taken by
   checkout-cache, where we honor user's umask and force only
   the executable bits.  With this patch, it creates a new file
   by redirecting into it (thus honoring user's default umask),
   and then uses "chmod +x" if we want the resulting file
   executable.  Without this fix, the merge result becomes 0644
   or 0755 for users whose umask is 002 for whom it should
   become 0664 or 0775.

 * When "$1 -> $2 -> $3" case was not handled, the script did
   not say which path it was working on, which was not so useful
   when used with the -a option of git-merge-cache.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Add git-apply-patch-script.
Junio C Hamano [Sun, 1 May 2005 16:33:12 +0000 (09:33 -0700)]
[PATCH] Add git-apply-patch-script.

I said:

     - Stop attempting to be compatible with cg-patch, and drop
       (mode:XXXXXX) bits from the diff.

     - Do keep the /dev/null change for created and deleted case.

     - No "Index:" line, no "Mode change:" line, anywhere in the
       output.  Anything that wants the mode bits and sha1 hash can
       do things from GIT_EXTERNAL_DIFF mechanism.  Maybe document
       suggested usage better.

This adds an example script git-apply-patch-script, that can be
used as the GIT_EXTERNAL_DIFF to apply changes between two trees
directly on the current work tree, like this:

 GIT_EXTERNAL_DIFF=git-apply-patch-script git-diff-tree -p <tree> <tree>

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Rework built-in diff to make its output more dense.
Junio C Hamano [Sun, 1 May 2005 16:33:12 +0000 (09:33 -0700)]
[PATCH] Rework built-in diff to make its output more dense.

Linus says,

    The fewer lines there are that don't usually tell a human
    anything, the better. Dense is good.

This patch makes the default diff output more dense.  This
removes the previous misguided attempt to be cg-patch
compatible.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Resurrect diff-tree-helper -R
Junio C Hamano [Sun, 1 May 2005 00:59:35 +0000 (17:59 -0700)]
[PATCH] Resurrect diff-tree-helper -R

Diff-tree-helper take two patch inadvertently dropped the
support of -R option, which is necessary to produce reverse diff
based on diff-cache and diff-files output (diff-tree does not
matter since you can feed two trees in reverse order).  This
patch restores it.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years ago[PATCH] Split out "pull" from particular methods
Daniel Barkalow [Sat, 30 Apr 2005 23:53:56 +0000 (16:53 -0700)]
[PATCH] Split out "pull" from particular methods

The method for deciding what to pull is useful separately from any of the
ways of actually fetching the objects.

So split out "pull" functionality from http-pull and rpull

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 years agorev-tree.c: don't include unnecessary header files
Linus Torvalds [Sat, 30 Apr 2005 23:26:56 +0000 (16:26 -0700)]
rev-tree.c: don't include unnecessary header files

We used to have all these time-related issues, long gone now.

19 years agodate.c: fix printout of timezone offsets that aren't exact hours
Linus Torvalds [Sat, 30 Apr 2005 23:18:41 +0000 (16:18 -0700)]
date.c: fix printout of timezone offsets that aren't exact hours

We'd get the sign wrong for the minutes part of a negative offset.

19 years agodate.c: only use the TZ names if we don't have anything better.
Linus Torvalds [Sat, 30 Apr 2005 22:21:57 +0000 (15:21 -0700)]
date.c: only use the TZ names if we don't have anything better.

Also, add EEST (hey, it's Finland).