Linus Torvalds [Thu, 21 Apr 2005 19:14:46 +0000 (12:14 -0700)]
Split up Makefile library list handling with separate entries for
zlib and libssl.
I'll start giving people choices here..
Linus Torvalds [Thu, 21 Apr 2005 18:21:33 +0000 (11:21 -0700)]
Include <limits.h> in commit.c for ULONG_MAX. Remove old "revision.h".
The old revision.h helper header isn't used any more, but I never noticed
it until I started grepping for ULONG_MAX users.
Linus Torvalds [Thu, 21 Apr 2005 17:55:18 +0000 (10:55 -0700)]
Add support for a "GIT_INDEX_FILE" environment variable.
We use that to specify alternative index files, which can be useful
if you want to (for example) generate a temporary index file to do
some specific operation that you don't want to mess with your main
one with.
It defaults to the regular ".git/index" if it hasn't been specified.
Linus Torvalds [Thu, 21 Apr 2005 17:15:02 +0000 (10:15 -0700)]
Add the ability to prefix something to the pathname to "checkout-cache.c"
This basically makes it trivial to use checkout-cache as a "export as
tree" function. Just read the desired tree into the index, and do a
checkout-cache --prefix=export-dir/ -a
and checkout-cache will "export" the cache into the specified directory.
NOTE! The final "/" is important. The exported name is literally just
prefixed with the specified string, so you can also do something like
checkout-cache --prefix=.merged- Makefile
to check out the currently cached copy of "Makefile" into the file
".merged-Makefile".
Linus Torvalds [Thu, 21 Apr 2005 16:58:24 +0000 (09:58 -0700)]
Fix NSEC compile problem, and properly parse the rev-tree cmd line.
The rev-tree thing just happened to work. It shouldn't have.
Junio C Hamano [Thu, 21 Apr 2005 02:49:16 +0000 (19:49 -0700)]
[PATCH] Usage-string fixes.
Usage string fixes to make maintenance easier (only one instance
of a string to update not multiple copies). I've spotted and
corrected inconsistent usage text in diff-tree while doing this.
Also diff-cache and read-tree usage text have been corrected to
match their up-to-date features. Earlier, neither "--cached"
form of diff-cache nor "-m single-merge" form of read-tree were
described.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Linus Torvalds [Thu, 21 Apr 2005 02:19:11 +0000 (19:19 -0700)]
Duh, just make git-export.c use the proper syntax, everything is fine.
Linus Torvalds [Thu, 21 Apr 2005 01:49:41 +0000 (18:49 -0700)]
Fix up some problems from the commit->tree helper patch
Linus Torvalds [Thu, 21 Apr 2005 01:48:27 +0000 (18:48 -0700)]
Fix up git-export to use the lower-level interfaces for diff generation.
The high-level helpers seem to have forgotten what to do with sha1
names.
Junio C Hamano [Thu, 21 Apr 2005 01:06:50 +0000 (18:06 -0700)]
[PATCH] Teach read-tree about commit objects
Updates read-tree to use read_tree_with_tree_or_commit_sha1()
function. The command can take either tree or commit IDs with
this patch.
The change involves a slight modification of how it recurses down
the tree. Earlier the caller only supplied SHA1 and the recurser
read the object using it, but now it is the caller's responsibility
to read the object and give it to the recurser. This matches the
way recursive behaviour is done in other tree- related commands.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Junio C Hamano [Thu, 21 Apr 2005 01:06:50 +0000 (18:06 -0700)]
[PATCH] Teach ls-tree about commit objects
Updates ls-tree.c to use read_tree_with_tree_or_commit_sha1()
function. The command can take either tree or commit IDs with
this patch.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Junio C Hamano [Thu, 21 Apr 2005 01:06:50 +0000 (18:06 -0700)]
[PATCH] Teach diff-tree about commit objects
Updates diff-tree.c to use read_tree_with_tree_or_commit_sha1()
function. The command can take either tree or commit IDs with this patch.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Junio C Hamano [Thu, 21 Apr 2005 01:06:49 +0000 (18:06 -0700)]
[PATCH] Teach diff-cache about commit objects
Updates diff-cache.c to use read_tree_with_tree_or_commit_sha1()
function. The end-user visible result is the same --- the command
takes either tree or commit ID.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Junio C Hamano [Thu, 21 Apr 2005 01:06:49 +0000 (18:06 -0700)]
[PATCH] Accept commit in some places when tree is needed.
This patch implements read_tree_with_tree_or_commit_sha1(),
which can be used when you are interested in reading an unpacked
raw tree data but you do not know nor care if the SHA1 you
obtained your user is a tree ID or a commit ID. Before this
function's introduction, you would have called read_sha1_file(),
examined its type, parsed it to call read_sha1_file() again if
it is a commit, and verified that the resulting object is a
tree. Instead, this function does that for you. It returns
NULL if the given SHA1 is not either a tree or a commit.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Andre Noll [Wed, 20 Apr 2005 20:10:13 +0000 (13:10 -0700)]
[PATCH] simplify Makefile
Use a generic rule for executables that depend only on the corresponding
.o and on $(LIB_FILE).
Signed-Off-By: Andre Noll <maan@systemlinux.org>
Signed-Off-By: Linus Torvalds <torvalds@osdl.org>
Linus Torvalds [Wed, 20 Apr 2005 20:00:08 +0000 (13:00 -0700)]
Improve build: add <unistd.h> and use -O2 instead of -O3
(Nobody should use -O3. It just makes bad inlining decisions).
Linus Torvalds [Wed, 20 Apr 2005 19:36:41 +0000 (12:36 -0700)]
Make the sha1 of the index file go at the very end of the file.
This allows us to both calculate it and verify it faster.
Linus Torvalds [Wed, 20 Apr 2005 19:16:57 +0000 (12:16 -0700)]
Speed up index file writing by chunking it nicely.
No point in making 17,000 small writes when you can make just
a couple of hundred nice 8kB writes instead and save a lot
of time.
Linus Torvalds [Wed, 20 Apr 2005 16:28:05 +0000 (09:28 -0700)]
Make "write_sha1_file()" exit early if the file already exists.
Avoid the compression.
Linus Torvalds [Wed, 20 Apr 2005 08:34:54 +0000 (01:34 -0700)]
The recent hash/compression switch-over missed the blob creation.
Happily, convert-cache just magically fixes all errors.
Linus Torvalds [Wed, 20 Apr 2005 08:10:46 +0000 (01:10 -0700)]
Do SHA1 hash _before_ compression.
And add a "convert-cache" program to convert from old-style
to new-style.
Zach Welch [Wed, 20 Apr 2005 04:48:15 +0000 (21:48 -0700)]
[PATCH] init-db.c: create and use safe_create_dir helper
Factor mkdir calls into common safe_create_dir subroutine.
Signed-Off-By: Zach Welch <zw@superlucidity.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Zach Welch [Wed, 20 Apr 2005 04:48:15 +0000 (21:48 -0700)]
[PATCH] init-db.c: normalize env var handling.
Normalize init-db environment variable handling, allowing the creation
of object directories with something other than DEFAULT_DB_ENVIRONMENT.
Signed-Off-By: Zach Welch <zw@superlucidity.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Zach Welch [Wed, 20 Apr 2005 04:48:15 +0000 (21:48 -0700)]
[PATCH] init-db.c: cleanup comments
Consolidate comments at top of main.
Signed-Off-By: Zach Welch <zw@superlucidity.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Linus Torvalds [Wed, 20 Apr 2005 04:39:28 +0000 (21:39 -0700)]
Make "diff-tree" take commit objects too, like "diff-cache" does.
Sometimes it's just easier to not have to look up the "commit"->"tree"
translation by hand first. It's trivial to do inside diff-tree, and
it's just being polite.
Linus Torvalds [Wed, 20 Apr 2005 04:00:09 +0000 (21:00 -0700)]
Add "diff-cache" helper program to compare a tree (or commit) with
the current cache state and/or working directory.
Very useful to see what has changed since the last commit, either in
the index file or in the whole working directory.
Also very possibly very buggy. Matching the two up is not entirely
trivial.
Linus Torvalds [Tue, 19 Apr 2005 22:46:06 +0000 (15:46 -0700)]
Make us be better at guessing a good hostname for the email.
It's still just a guess, and the result is not a real email
address anyway. If you want to, you can use COMMIT_AUTHOR_EMAIL
to correct for any git guesses.
Linus Torvalds [Tue, 19 Apr 2005 21:11:06 +0000 (14:11 -0700)]
Remove duplicate getenv(DB_ENVIRONMENT) call
Noted by Tony Luck.
Linus Torvalds [Tue, 19 Apr 2005 21:00:34 +0000 (14:00 -0700)]
Add stupid "git export" thing, which can export a git archive
as a set of patches and commentary.
You'd want something like this if you are tracking a git archive
in another SCM format. Notably, we want something like that for
BK users.
Linus Torvalds [Tue, 19 Apr 2005 20:59:17 +0000 (13:59 -0700)]
Fix init-db shared database case
Noted by Aaron Straus
Linus Torvalds [Tue, 19 Apr 2005 19:56:47 +0000 (12:56 -0700)]
Update "git-pull-script" to use "read-tree -m" for
reading a single tree too. That should speed up a
trivial merge noticeably.
Also, don't bother reading back the tree we just wrote
when we committed a real merge. It had better be the
same one we still have..
Linus Torvalds [Tue, 19 Apr 2005 18:41:18 +0000 (11:41 -0700)]
Make "read-tree" know how to do a "1-way merge".
This one just reads one tree, but picks up any matching stat information
from the old index.
Linus Torvalds [Tue, 19 Apr 2005 18:16:12 +0000 (11:16 -0700)]
Make "read-tree" take the 'stat' information for a merge result from the
old index state if the result matches.
This leaves the stat information in the result tree for any trivial
merges, which is just the way we like it.
Linus Torvalds [Tue, 19 Apr 2005 16:53:58 +0000 (09:53 -0700)]
Make git-pull-script do the right thing for symlinked HEAD's.
Also exit gracefully if the HEAD pull failed, rather than use
a possibly stale MERGE_HEAD.
Linus Torvalds [Tue, 19 Apr 2005 16:52:24 +0000 (09:52 -0700)]
Don't parse commit objects more than once.
Yes, the "parse_commit()" already checks for this condition, but
we need to check for it in rev-tree too, so that we don't start
walking the parent chain unnecessarily.
James Bottomley [Tue, 19 Apr 2005 02:55:19 +0000 (19:55 -0700)]
[PATCH] SCSI trees, merges and git status
Doing the latest SCSI merge exposed two bugs in your merge script:
1) It doesn't like a completely new directory (the misc tree contains a
new drivers/scsi/lpfc)
2) the merge testing logic is wrong. You only want to exit 1 if the
merge fails.
Greg KH [Tue, 19 Apr 2005 00:37:32 +0000 (17:37 -0700)]
[PATCH] provide better committer information to commit-tree.c
Here's a small patch to commit-tree.c that does two things:
- allows the committer email address and name to be overridden
by environment variables (if you don't like the environment
variable names I've used (COMMIT_AUTHOR_NAME,
COMMIT_AUTHOR_EMAIL), feel free to change them.)
- provide the proper domainname to the author/committer email
address (otherwise, my address was only showing up as from the
hostname.)
This allows people to set sane values for the commit names and email
addresses, preventing odd, private hostnames and domains from being
exposed to the world.
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Linus Torvalds [Tue, 19 Apr 2005 00:35:31 +0000 (17:35 -0700)]
Make fsck-cache print the object type for unreachable objects.
This got lost when I updated to Daniel's new object model.
Junio C Hamano [Mon, 18 Apr 2005 23:51:09 +0000 (16:51 -0700)]
[PATCH] show-diff: Remove stale comments
Patch 1/6 in the series has already cleaned the interface to
call sq_expand(), but the comment before that function still
carries the stale interface warning. Remove it.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Junio C Hamano [Mon, 18 Apr 2005 23:49:21 +0000 (16:49 -0700)]
[PATCH] Do not let rsync obliterate .git/object symbolic link.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Junio C Hamano [Mon, 18 Apr 2005 22:07:24 +0000 (15:07 -0700)]
[PATCH] show-diff.c: -R option for reverse diff.
This adds -R option to obtain reverse diff.
It may be useful in the merge workflow. After the base of the working
directory is merged and commited, in the working directory:
$ read-tree <tree-id-of-merged-tree>
$ show-diff -R
to re-validate if upstream changes make sense, and/or revert or
conflict with local changes you have in the working files.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Junio C Hamano [Mon, 18 Apr 2005 22:07:24 +0000 (15:07 -0700)]
[PATCH] show-diff.c: make diff options customizable.
This makes the diff output formatting options customizable via the
environment variables. The default is still the Linux kernel style.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Junio C Hamano [Mon, 18 Apr 2005 22:07:24 +0000 (15:07 -0700)]
[PATCH] show-diff.c: adjust default format for the Linux kernel.
This patch adjusts the default output format of show-diff to match
the Linux kernel style, recommended in Documentation/SubmittingPatches.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Junio C Hamano [Mon, 18 Apr 2005 22:07:24 +0000 (15:07 -0700)]
[PATCH] show-diff.c: simplify show_diff_empty.
This patch removes the custom diff generation code from the
show_diff_empty() function. Instead, just use show_differences().
This reduces the code size; but more importantly, it is needed for
the later patch to give diff options.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Junio C Hamano [Mon, 18 Apr 2005 22:07:24 +0000 (15:07 -0700)]
[PATCH] show-diff.c: check unreadbale blob.
This patch fixes show-diff to detect unreadable blob and warn
instead of going ahead and crashing.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Junio C Hamano [Mon, 18 Apr 2005 22:07:24 +0000 (15:07 -0700)]
[PATCH] show-diff.c: clean up private buffer use.
This patch fixes sq_expand() and show_differences() not to use and
hold onto its privately allocated buffer, which was a misguided
attempt to reduce calls to malloc but made later changes harder.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Linus Torvalds [Mon, 18 Apr 2005 22:01:48 +0000 (15:01 -0700)]
Add "update-cache --refresh" to git-pull-script to make sure
out index is all ready to go after a pull.
Noted by Russell King
Linus Torvalds [Mon, 18 Apr 2005 21:17:58 +0000 (14:17 -0700)]
Change merge-cache and git-merge-one-file to use the SHA1 of the file
instead of a checked-out temporary copy.
If merging requires a checked-out-copy, we now do so with "unpack-file".
Linus Torvalds [Mon, 18 Apr 2005 21:11:01 +0000 (14:11 -0700)]
Add "unpack-file" helper that unpacks a sha1 blob into a tmpfile.
Linus Torvalds [Mon, 18 Apr 2005 20:12:21 +0000 (13:12 -0700)]
Add more header dependencies.
Yeah, my Makefiles are always a total disaster. Better this than autotools
or some horror like that, though.
Linus Torvalds [Mon, 18 Apr 2005 20:04:43 +0000 (13:04 -0700)]
Split up read-cache.c into more logical clumps.
Do the usage and error reporting in "usage.c", and the sha1 file
accesses in "sha1_file.c".
Small, nice, easily separated parts. Good.
Linus Torvalds [Mon, 18 Apr 2005 19:49:39 +0000 (12:49 -0700)]
Clean up the Makefile a bit.
This introduces the concept of git "library" objects that
the real programs use, and makes it easier to add such things
to a "libgit.a".
This will also make it trivial to split the current "read-cache.o"
into more aptly named pieces (it does a lot more than just read
the index file).
Linus Torvalds [Mon, 18 Apr 2005 19:15:10 +0000 (12:15 -0700)]
Add the simple scripts I used to do a merge with content conflicts.
They sure as hell aren't perfect, but they allow you to do:
./git-pull-script {other-git-directory}
to do the initial merge, and if that had content clashes, you do
merge-cache ./git-merge-one-file-script -a
which tries to auto-merge. When/if the auto-merge fails, it will
leave the last file in your working directory, and you can edit
it and then when you're happy you can do "update-cache filename"
on it. Re-do the merge-cache thing until there are no files left
to be merged, and now you can write the tree and commit:
write-tree
commit-tree .... -p $(cat .git/HEAD) -p $(cat .git/MERGE_HEAD)
and you're done.
Linus Torvalds [Mon, 18 Apr 2005 19:12:00 +0000 (12:12 -0700)]
Merge the new object model thing from Daniel Barkalow
This was a real git merge with conflicts. I'll commit the scripts I used
to do the merge next.
Not pretty, but it's half-way functional.
James Bottomley [Mon, 18 Apr 2005 18:44:31 +0000 (11:44 -0700)]
[PATCH] fix bug in read-cache.c which loses files when merging a tree
I noticed this when I tried a non-trivial scsi merge and checked the
results against BK. The problem is that remove_entry_at() actually
decrements active_nr, so decrementing it in add_cache_entry() before
calling remove_entry_at() is a double decrement (hence we lose cache
entries at the end).
Daniel Barkalow [Mon, 18 Apr 2005 18:39:48 +0000 (11:39 -0700)]
[PATCH] Switch implementations of merge-base, port to parsing
This switches to my implementation of merge-base, but with the new parsing
library.
Signed-Off-By: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Daniel Barkalow [Mon, 18 Apr 2005 18:39:48 +0000 (11:39 -0700)]
[PATCH] Port fsck-cache to use parsing functions
This ports fsck-cache to use parsing functions. Note that performance
could be improved here by only reading each object once, but this requires
somewhat more complicated flow control.
Signed-Off-By: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Daniel Barkalow [Mon, 18 Apr 2005 18:39:48 +0000 (11:39 -0700)]
[PATCH] Port rev-tree to parsing functions
This ports rev-tree to use the parsing functions introduced in the
previous patches.
Signed-Off-By: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Daniel Barkalow [Mon, 18 Apr 2005 18:39:48 +0000 (11:39 -0700)]
[PATCH] Implementations of parsing functions
This implements the parsing functions.
Signed-Off-By: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Daniel Barkalow [Mon, 18 Apr 2005 18:39:48 +0000 (11:39 -0700)]
[PATCH] Header files for object parsing
This adds the structs and function declarations for parsing git objects.
Signed-Off-By: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Junio C Hamano [Mon, 18 Apr 2005 17:42:48 +0000 (10:42 -0700)]
[PATCH] Fix confusing behaviour of update-cache --refresh on unmerged paths.
The "update-cache --refresh" command attempts refresh_entry()
on unmerged path, which results in as many "needs update" messages
as there are unmerged stages for that path. This does not do
any harm to the working directory, but it is confusing.
Here is a fix.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Linus Torvalds [Mon, 18 Apr 2005 04:52:23 +0000 (21:52 -0700)]
Update README to reflect the hierarchical tree objects,
and other newfangled things like merging.
Also, talk more about the actual operations, and give some
rough examples of what you can do.
Junio C Hamano [Mon, 18 Apr 2005 03:31:40 +0000 (20:31 -0700)]
[PATCH] (resend) show-diff.c off-by-one fix
The patch to introduce shell safety to show-diff has an
off-by-one error. Here is an fix.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Linus Torvalds [Mon, 18 Apr 2005 02:52:54 +0000 (19:52 -0700)]
Ass a "merge-cache" helper program to execute a merge on
any unmerged files.
This one doesn't actually do the merging, but it makes it
easy to script the programs that do using it.
Brad Roberts [Mon, 18 Apr 2005 02:12:14 +0000 (19:12 -0700)]
[PATCH] fork optional branch point normazilation
Fix remove_specials for real. The second half logic needs the original
head of the string.
Signed-off-by: Brad Roberts <braddr@puremagic.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Linus Torvalds [Mon, 18 Apr 2005 01:39:14 +0000 (18:39 -0700)]
Ignore any unmerged entries for "checkout-cache -a".
They don't "exist" yet, and you need to merge them first.
Linus Torvalds [Sun, 17 Apr 2005 23:52:54 +0000 (16:52 -0700)]
Remove extraneous ',' ';' and '.' characters from the full name gecos field.
Apparently some distributions tend to have space for phone numbers etc there.
Linus Torvalds [Sun, 17 Apr 2005 23:19:32 +0000 (16:19 -0700)]
Make the revision tracking track the object types too.
This allows fsck to verify not just that an object exists, but
also that it has the type it was expected to have.
Linus Torvalds [Sun, 17 Apr 2005 22:26:13 +0000 (15:26 -0700)]
Make "commit-tree" check the input objects more carefully.
Let's not allow trivially bogus commits. I did one for the first
trial of the first kernel git merge. fsck found it ok, but..
Linus Torvalds [Sun, 17 Apr 2005 19:40:18 +0000 (12:40 -0700)]
Make "parse_commit" return the "struct revision" for the commit.
Also, make it a fatal error to pass in a non-commit object. The callers
never checked, so better check here.
This simplifies merge-base further. It's now so trivial that it's almost
ridiculous.
Linus Torvalds [Sun, 17 Apr 2005 19:18:17 +0000 (12:18 -0700)]
Do a very simple "merge-base" that finds the most recent common
parent of two commits.
The question of "best" commit can probably be tweaked almost arbitrarily.
In particular, trying to take things like how big the tree differences
are into account migt be a good idea. This one is just very simple.
Linus Torvalds [Sun, 17 Apr 2005 19:09:20 +0000 (12:09 -0700)]
Make "rev-tree.c" use the new-and-improved "mark_reachable()"
It used to have its own specialized version for marking the
sub-reachability bits.
Linus Torvalds [Sun, 17 Apr 2005 19:07:00 +0000 (12:07 -0700)]
Make "revision.h" slightly better to use.
- mark_reachable() can be more generic, marking the reachable revisions
with an arbitrary mask.
- date parsing will parse to a date of 0 rather than ULONG_MAX for the
bad old case, sorting the dates correctly.
Linus Torvalds [Sun, 17 Apr 2005 18:39:18 +0000 (11:39 -0700)]
Move "parse_commit()" into common revision.h file.
This also drops the old-style date parsing. We just don't care
enough, since we dropped that format pretty early.
Yes, this could do with some cleanup, and a common library file.
Some day.
Brad Roberts [Sun, 17 Apr 2005 17:55:12 +0000 (10:55 -0700)]
[PATCH] fix for memory leak in write-tree.c
Fix a memory leak in write-tree.c, not freeing the directory buffer.
Petr Baudis [Sun, 17 Apr 2005 17:04:48 +0000 (10:04 -0700)]
[PATCH] Fix +x-related show-diff false positives
This fixes show-diff listing all +x files as differring.
Signed-off-by: Petr Baudis <pasky@ucw.cz>
[ That's what I get for working on a G5 - my testing was all
big-endian in the first place. -- Linus ]
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Junio C Hamano [Sun, 17 Apr 2005 17:02:22 +0000 (10:02 -0700)]
[PATCH] Remove unused arguments from index_fd()
The function index_fd() in update-cache.c takes 5 arguments, but
two is not necessary and one that is a pointer to a structure
really needs to be a pointer to one member of that structure.
This patch cleans it up.
Also it removes printf() apparently left after initial
debugging.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Junio C Hamano [Sun, 17 Apr 2005 17:02:21 +0000 (10:02 -0700)]
[PATCH] Better error message from checkout-cache for unmerged files.
The checkout-cache command says "file is not in the cache" when
an unmerged path is given. This patch adds code to distinguish
the unmerged and the nonexistent cases and gives an appropriate
error message.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Linus Torvalds [Sun, 17 Apr 2005 16:55:36 +0000 (09:55 -0700)]
Fix total permission bogosity in "checkout-cache.c".
Use the proper octal mode naming instead of random decimal
crud, and don't reset the mode after the create with fchmod:
the whole point was to let "umask" do its thing.
Duh.
Junio C Hamano [Sun, 17 Apr 2005 16:53:35 +0000 (09:53 -0700)]
[PATCH] update-cache --remove marks the path merged.
When update-cache --remove is run, resolve unmerged state for
the path. This is consistent with the update-cache --add
behaviour. Essentially, the user is telling us how he wants to
resolve the merge by running update-cache.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Fixed to do the right thing at the end.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Junio C Hamano [Sun, 17 Apr 2005 16:53:35 +0000 (09:53 -0700)]
[PATCH] show-diff.c: do not include unused header file
This is my bad. I added #include <ctype.h> to the file,
which I ended up not using and failed to remove it.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Linus Torvalds [Sun, 17 Apr 2005 05:26:31 +0000 (22:26 -0700)]
Be much more liberal about the file mode bits.
We only really care about the difference between a file being executable
or not (by its owner). Everything else we leave for the user umask to
decide.
Junio C Hamano [Sun, 17 Apr 2005 04:29:45 +0000 (21:29 -0700)]
[PATCH] Do not run useless show-diff on unmerged paths repeatedly.
When run on unmerged dircache, show-diff compares the working
file with each non-empty stage for that path. Two out of three
times, this is not very helpful. This patch makes it report the
unmergedness only once per each path and avoids running the
actual diff.
Upper layer SCMs like Cogito are expected to find out mode/SHA1
for each stage by using "show-files --stage" and run the diff
itself. This would result in more sensible diffs.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Junio C Hamano [Sun, 17 Apr 2005 04:29:45 +0000 (21:29 -0700)]
[PATCH] show-diff style fix.
This fixes some stylistic problems introduced by my previous set
of patches. I'll be sending my last patch to show-diff next,
which depends on this cleanup.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Junio C Hamano [Sun, 17 Apr 2005 04:29:45 +0000 (21:29 -0700)]
[PATCH] Rename confusing variable in show-diff
The show-diff command uses a variable "new" but it is always
used to point at the original data recorded in the dircache
before the user started editing in the working file. Rename it
to "old" to avoid confusion.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Junio C Hamano [Sun, 17 Apr 2005 04:29:45 +0000 (21:29 -0700)]
[PATCH] show-diff shell safety
The command line for running "diff" command is built without
taking shell metacharacters into account. A malicious dircache
entry "foo 2>bar" (yes, a filename with space) would result in
creating a file called "bar" with the error message "diff: foo:
No such file or directory" in it.
This is not just a user screwing over himself. Such a dircache
can be created as a result of a merge with tree from others.
Here is a fix.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Junio C Hamano [Sun, 17 Apr 2005 04:29:45 +0000 (21:29 -0700)]
[PATCH] show-diff -z option for machine readable output.
This patch adds the -z option to the show-diff command,
primarily for use by scripts. The information emitted is
similar to that of -q option, but in a more machine readable
form. Records are terminated with NUL instead of LF, so that
the scripts can deal with pathnames with embedded newlines.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Junio C Hamano [Sun, 17 Apr 2005 04:29:45 +0000 (21:29 -0700)]
[PATCH] Optionally tell show-diff to show only named files
SCMs have ways to say "I want diff only this particular file",
or "I want diff files under this directory". This patch teaches
show-diff to do something similar. Without command line
arguments, it still examines everything in the dircache as
before.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Junio C Hamano [Sat, 16 Apr 2005 20:57:39 +0000 (13:57 -0700)]
[PATCH] Un unoptimize ls-tree behaviour
ls-tree unconditionally called read_sha1_file() for all paths
even when not needed, which was a mistake introduced by me.
Rectify this by first checking S_ISDIR(mode) and read the tree
contents only when it is a tree and we are recursive. There is
no need to read it in any other cases.
The patch also removes the confusing comment that led to this
incorrect implementation.
Thanks to Peter Baudis for noticing this problem.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Linus Torvalds [Sat, 16 Apr 2005 19:43:32 +0000 (12:43 -0700)]
Add "--unmerged" flag to "show-files", which does what the name implies.
The flag also implies "--stage", since unmerged file information doesn't
make sense without the full output.
Linus Torvalds [Sat, 16 Apr 2005 19:24:12 +0000 (12:24 -0700)]
Remove "merge-tree.c"
It's there in the history if somebody wants to resurrect it, but it
seems to have been successfully superceded by the new and improved
index-merge thing, where we do all merging entirely in the index.
Linus Torvalds [Sat, 16 Apr 2005 19:05:45 +0000 (12:05 -0700)]
When inserting a index entry of stage 0, remove all old unmerged entries.
This allows you to actually tell git that you've resolved a conflict.
Linus Torvalds [Sat, 16 Apr 2005 16:11:49 +0000 (09:11 -0700)]
Make 'read-tree' do a few more of the trivial merge cases.
This cuts down the work for the "real merge" to stuff where
people might actually disagree on the algorithm. The trivial
cases would seem to be totally independent of any policy.
Junio C Hamano [Sat, 16 Apr 2005 15:33:23 +0000 (08:33 -0700)]
[PATCH] Add --stage to show-files for new stage dircache.
This adds --stage option to show-files command. It shows
file-mode, SHA1, stage and pathname. Record separator follows
the usual convention of -z option as before.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Junio C Hamano [Sat, 16 Apr 2005 15:30:20 +0000 (08:30 -0700)]
[PATCH] Byteorder fix for read-tree, new -m semantics version.
The ce_namelen field has been renamed to ce_flags and split into
the top 2-bit unused, next 2-bit stage number and the lowest
12-bit name-length, stored in the network byte order. A new
macro create_ce_flags() is defined to synthesize this value from
length and stage, but it forgets to turn the value into the
network byte order. Here is a fix.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Linus Torvalds [Sat, 16 Apr 2005 05:53:45 +0000 (22:53 -0700)]
Make "read-tree" merge the trees it reads by giving them consecutive states.
Normally you'd use state 0 for the "merged" state, and start out with
state 1 being "origin", state 2 being "first tree" and state 3 being
"second tree".
Once all the index entries are back in state 0, we have a successful
merge and can write the result tree back.
Linus Torvalds [Sat, 16 Apr 2005 05:51:44 +0000 (22:51 -0700)]
Make cache entry comparison take the new "state" flag into account.
This is what allows us to have multiple states of the same file in
the index, and what makes it always sort correctly.
Linus Torvalds [Sat, 16 Apr 2005 05:04:54 +0000 (22:04 -0700)]
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).
Linus Torvalds [Sat, 16 Apr 2005 04:45:38 +0000 (21:45 -0700)]
Encode a few extra flags per index entry.
This will allow us to have the same name in different "states" in the
index at the same time. Which in turn seems to be a very simple way to
merge.
Linus Torvalds [Sat, 16 Apr 2005 04:42:34 +0000 (21:42 -0700)]
Simplify show-diff cache entry name handling.
The cache-entry names are all proper strings, no need to worry about
their length.