update-cache: remove index lock file on SIGINT
This makes it a lot more pleasant to use when you
interrupt a long-running operation.
This makes it a lot more pleasant to use when you
interrupt a long-running operation.
[PATCH] diff-cache buglet
diff-cache attempts to first remove all merge entries before letting the
diff_cache() do its work, but it incorrectly stops after the first
merge-entry it finds.
Fix by just replacing the "break" with a "continue".
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
diff-cache attempts to first remove all merge entries before letting the
diff_cache() do its work, but it incorrectly stops after the first
merge-entry it finds.
Fix by just replacing the "break" with a "continue".
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
[PATCH] Diff-tree-helper take two.
This reworks the diff-tree-helper and show-diff to further make external
diff command interface simpler.
These commands now honor GIT_EXTERNAL_DIFF environment variable which
can point at an arbitrary program that takes 7 parameters:
name file1 file1-sha1 file1-mode file2 file2-sha1 file2-mode
The parameters for an external diff command are as follows:
name this invocation of the command is to emit diff
for the named cache/tree entry.
file1 pathname that holds the contents of the first
file. This can be a file inside the working
tree, or a temporary file created from the blob
object, or /dev/null. The command should not
attempt to unlink it -- the temporary is
unlinked by the caller.
file1-sha1 sha1 hash if file1 is a blob object, or "."
otherwise.
file1-mode mode bits for file1, or "." for a deleted file.
If GIT_EXTERNAL_DIFF environment variable is not set, the
default is to invoke diff with the set of parameters old
show-diff used to use. This built-in implementation honors the
GIT_DIFF_CMD and GIT_DIFF_OPTS environment variables as before.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This reworks the diff-tree-helper and show-diff to further make external
diff command interface simpler.
These commands now honor GIT_EXTERNAL_DIFF environment variable which
can point at an arbitrary program that takes 7 parameters:
name file1 file1-sha1 file1-mode file2 file2-sha1 file2-mode
The parameters for an external diff command are as follows:
name this invocation of the command is to emit diff
for the named cache/tree entry.
file1 pathname that holds the contents of the first
file. This can be a file inside the working
tree, or a temporary file created from the blob
object, or /dev/null. The command should not
attempt to unlink it -- the temporary is
unlinked by the caller.
file1-sha1 sha1 hash if file1 is a blob object, or "."
otherwise.
file1-mode mode bits for file1, or "." for a deleted file.
If GIT_EXTERNAL_DIFF environment variable is not set, the
default is to invoke diff with the set of parameters old
show-diff used to use. This built-in implementation honors the
GIT_DIFF_CMD and GIT_DIFF_OPTS environment variables as before.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
[PATCH] Introduce diff-tree-helper.
This patch introduces a new program, diff-tree-helper. It reads
output from diff-cache and diff-tree, and produces a patch file.
The diff format customization can be done the same way the
show-diff uses; the same external diff interface introduced by
the previous patch to drive diff from show-diff is used so this
is not surprising.
It is used like the following examples:
$ diff-cache --cached -z <tree> | diff-tree-helper -z -R paths...
$ diff-tree -r -z <tree1> <tree2> | diff-tree-helper -z paths...
- As usual, the use of the -z flag is recommended in the script
to pass NUL-terminated filenames through the pipe between
commands.
- The -R flag is used to generate reverse diff. It does not
matter for diff-tree case, but it is sometimes useful to get
a patch in the desired direction out of diff-cache.
- The paths parameters are used to restrict the paths that
appears in the output. Again this is useful to use with
diff-cache, which, unlike diff-tree, does not take such paths
restriction parameters.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This patch introduces a new program, diff-tree-helper. It reads
output from diff-cache and diff-tree, and produces a patch file.
The diff format customization can be done the same way the
show-diff uses; the same external diff interface introduced by
the previous patch to drive diff from show-diff is used so this
is not surprising.
It is used like the following examples:
$ diff-cache --cached -z <tree> | diff-tree-helper -z -R paths...
$ diff-tree -r -z <tree1> <tree2> | diff-tree-helper -z paths...
- As usual, the use of the -z flag is recommended in the script
to pass NUL-terminated filenames through the pipe between
commands.
- The -R flag is used to generate reverse diff. It does not
matter for diff-tree case, but it is sometimes useful to get
a patch in the desired direction out of diff-cache.
- The paths parameters are used to restrict the paths that
appears in the output. Again this is useful to use with
diff-cache, which, unlike diff-tree, does not take such paths
restriction parameters.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
[PATCH] Split external diff command interface to a separate file.
With this patch, the non-core'ish part of show-diff command that
invokes an external "diff" comand to obtain patches is split
into a separate file. The next patch will introduce a new
command, diff-tree-helper, which uses this common diff interface
to format diff-tree and diff-cache output into a patch form.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
With this patch, the non-core'ish part of show-diff command that
invokes an external "diff" comand to obtain patches is split
into a separate file. The next patch will introduce a new
command, diff-tree-helper, which uses this common diff interface
to format diff-tree and diff-cache output into a patch form.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fsck-cache: show root objects only with "--root"
This makes the default fsck behaviour be quiet for a repository
that doesn't have any problems. Which is good.
This makes the default fsck behaviour be quiet for a repository
that doesn't have any problems. Which is good.
fsck-cache: only show tags if asked to do so with "--tags"
Normally we don't care, we just check them for being valid tag
objects.
Normally we don't care, we just check them for being valid tag
objects.
Add the git-*-script files to the install
Add example "git-tag-script" to show how to create signed tag objects.
Make "fsck" also show what the name of the tag object is, not just
the name of the object it tags.
You need this if you actually want to build up a list of tags.
the name of the object it tags.
You need this if you actually want to build up a list of tags.
Add "tag" objects that can be used to sign other objects.
You use "git-mktag" to create them, and fsck-cache knows how to parse them.
You use "git-mktag" to create them, and fsck-cache knows how to parse them.
Fix up the types in write_sha1_file
Use "unsigned long" for the size, like we do everywhere else.
Use "unsigned long" for the size, like we do everywhere else.
Simplify "write_sha1_file()" interfaces
The write function now adds the header to the file by itself, so there
is no reason to duplicate it among all the users any more.
The write function now adds the header to the file by itself, so there
is no reason to duplicate it among all the users any more.
fsck-cache: warn about missing commit dates
Now that we have hopefully converted all old archives, we
can consider it an error.
Now that we have hopefully converted all old archives, we
can consider it an error.
Update "convert-cache" to handle git itself.
The git archives have some old-date-format commits with timezones
that the converter didn't recognize. Also, make it be quiet about
already-converted dates.
The git archives have some old-date-format commits with timezones
that the converter didn't recognize. Also, make it be quiet about
already-converted dates.
[PATCH] update-cache: add "--ignore-missing" option
This adds an --ignore-missing option to update-cache, which makes it
ignore missing files. Together with the "-n" option to checkout-cache,
it allows me to do
checkout-cache -n -f -a && update-cache --ignore-missing --refresh
which only updates and refreshes the files I already have checked out.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This adds an --ignore-missing option to update-cache, which makes it
ignore missing files. Together with the "-n" option to checkout-cache,
it allows me to do
checkout-cache -n -f -a && update-cache --ignore-missing --refresh
which only updates and refreshes the files I already have checked out.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
[PATCH] checkout-cache: add "-n" option
This adds the "-n" option to checkout-cache which tells it to not check
out new files, only refresh files already checked out.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This adds the "-n" option to checkout-cache which tells it to not check
out new files, only refresh files already checked out.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Don't add references to objects we couldn't find.
That would SIGSEGV.
That would SIGSEGV.
Verify that the object type matches for tree/commit objects even before parsing.
The type doesn't come from the parsing, the type also has to match the usage.
The type doesn't come from the parsing, the type also has to match the usage.
Set object type at object creation time, not object parse time.
Otherwise we can have objects without a type, which is not good.
Otherwise we can have objects without a type, which is not good.
fsck-cache: notice missing "blob" objects.
We should _not_ mark a blob object "parsed" just because we
looked it up: it gets marked that way only once we've actually
seen it. Otherwise we can never notice a missing blob.
We should _not_ mark a blob object "parsed" just because we
looked it up: it gets marked that way only once we've actually
seen it. Otherwise we can never notice a missing blob.
[PATCH] fix segfault in fsck-cache
Here is how to trigger it:
echo blob 100 > .git/objects/00/ae4e8d3208e09f2cf7a38202a126f728cadb49
Then run fsck-cache. It will try to unpack after the header to calculate
the hash, inflate returns total_out == 0 and memcpy() dies.
The patch below seems to work with ZLIB 1.1 and 1.2.
Signed-off-by: Andreas Gal <gal@uci.edu>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Here is how to trigger it:
echo blob 100 > .git/objects/00/ae4e8d3208e09f2cf7a38202a126f728cadb49
Then run fsck-cache. It will try to unpack after the header to calculate
the hash, inflate returns total_out == 0 and memcpy() dies.
The patch below seems to work with ZLIB 1.1 and 1.2.
Signed-off-by: Andreas Gal <gal@uci.edu>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Support a fine-grained diff-tree
This is based on a patch by David Woodhouse, but with the selection
tests much simplified and streamlined.
It makes diff-tree take extra arguments, specifying the files or
directories which should be considered "interesting". Changes in
uninteresting directories are not reported.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This is based on a patch by David Woodhouse, but with the selection
tests much simplified and streamlined.
It makes diff-tree take extra arguments, specifying the files or
directories which should be considered "interesting". Changes in
uninteresting directories are not reported.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
[PATCH] make file merging respect permissions
1) permissions aren't respected in the merge script (primarily because
they're never passed in to it in the first place). Fix that and also
check for permission conflicts in the merge
2) the delete of a file in both branches may indeed be just that, but it
could also be the indicator of a rename conflict (file moved to
different locations in both branches), so error out and ask the
committer for guidance.
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1) permissions aren't respected in the merge script (primarily because
they're never passed in to it in the first place). Fix that and also
check for permission conflicts in the merge
2) the delete of a file in both branches may indeed be just that, but it
could also be the indicator of a rename conflict (file moved to
different locations in both branches), so error out and ask the
committer for guidance.
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
[PATCH] Allow multiple date-ordered lists
Make pop_most_recent_commit() return the same objects multiple times, but only
if called with different bits to mark.
This is necessary to make merge-base work again.
Signed-Off-By: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Make pop_most_recent_commit() return the same objects multiple times, but only
if called with different bits to mark.
This is necessary to make merge-base work again.
Signed-Off-By: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Don't add parents to the commit list if we have already
seen them.
Otherwise any merges will make the parent list explode.
seen them.
Otherwise any merges will make the parent list explode.
Add "rev-list" program that uses the new time-based commit listing.
This is probably what you'd want to see for "git log".
This is probably what you'd want to see for "git log".
[PATCH] Various transport programs
This patch adds three similar and related programs. http-pull downloads
objects from an HTTP server; rpull downloads objects by using ssh and
rpush on the other side; and rpush uploads objects by using ssh and rpull
on the other side.
The algorithm should be sufficient to make the network throughput required
depend only on how much content is new, not at all on how much content the
repository contains.
The combination should enable people to have remote repositories by way of
ssh login for authenticated users and HTTP for anonymous access.
Signed-Off-By: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This patch adds three similar and related programs. http-pull downloads
objects from an HTTP server; rpull downloads objects by using ssh and
rpush on the other side; and rpush uploads objects by using ssh and rpull
on the other side.
The algorithm should be sufficient to make the network throughput required
depend only on how much content is new, not at all on how much content the
repository contains.
The combination should enable people to have remote repositories by way of
ssh login for authenticated users and HTTP for anonymous access.
Signed-Off-By: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
[PATCH] Replace merge-base implementation
The old implementation was a nice algorithm, but, unfortunately, it could
be confused in some cases and would not necessarily do the obvious thing
if one argument was decended from the other. This version fixes that by
changing the criterion to the most recent common ancestor.
Signed-Off-By: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
The old implementation was a nice algorithm, but, unfortunately, it could
be confused in some cases and would not necessarily do the obvious thing
if one argument was decended from the other. This version fixes that by
changing the criterion to the most recent common ancestor.
Signed-Off-By: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
[PATCH] Additional functions for the objects database
This adds two functions: one to check if an object is present in the local
database, and one to add an object to the local database by reading it
from a file descriptor and checking its hash.
Signed-Off-By: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This adds two functions: one to check if an object is present in the local
database, and one to add an object to the local database by reading it
from a file descriptor and checking its hash.
Signed-Off-By: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
[PATCH] Parse tree objects completely
This adds the contents of trees to struct tree.
Signed-Off-By: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This adds the contents of trees to struct tree.
Signed-Off-By: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
[PATCH] Add some functions for commit lists
This adds a function for inserting an item in a commit list, a function
for sorting a commit list by date, and a function for progressively
scanning a commit history from most recent to least recent.
Signed-Off-By: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This adds a function for inserting an item in a commit list, a function
for sorting a commit list by date, and a function for progressively
scanning a commit history from most recent to least recent.
Signed-Off-By: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
[PATCH] Simplify building of programs
Do not first build .o files when building programs.
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Do not first build .o files when building programs.
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
[PATCH] Fix broken diff-cache output on added files
Added files were errorneously reported with the - prefix by diff-cache,
obviously leading to great confusion.
Signed-off-by: Petr Baudis <pasky@ucw.cz>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Added files were errorneously reported with the - prefix by diff-cache,
obviously leading to great confusion.
Signed-off-by: Petr Baudis <pasky@ucw.cz>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Make a hack to convert-cache for missing author dates in old
archives (notably the old sparse one).
Very hacky. But hopefully we can do the conversion once, and never
worry about this ever again.
archives (notably the old sparse one).
Very hacky. But hopefully we can do the conversion once, and never
worry about this ever again.
Make "convert-cache" able to handle the really old archive formats
This includes the old-style "flat tree" object, and the old broken
date format. Well, enough of the date format to convert the sparse
archive, at least.
This includes the old-style "flat tree" object, and the old broken
date format. Well, enough of the date format to convert the sparse
archive, at least.
Use O_NOATIME when opening the sha1 files.
We really don't care about atime, and it sucks to dirty the
inode cache just for it.
This is more than a one-liner only because we need to be able to
clear the O_NOATIME flag in case some of the objects are owned
by others (in which case open will return EPERM), and because not
everybody has the O_NOATIME flag.
We really don't care about atime, and it sucks to dirty the
inode cache just for it.
This is more than a one-liner only because we need to be able to
clear the O_NOATIME flag in case some of the objects are owned
by others (in which case open will return EPERM), and because not
everybody has the O_NOATIME flag.
[PATCH] PPC assembly implementation of SHA1
Here is a SHA1 implementation with the core written in PPC assembly.
On my 2GHz G5, it does 218MB/s, compared to 135MB/s for the openssl
version or 45MB/s for the mozilla version.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Here is a SHA1 implementation with the core written in PPC assembly.
On my 2GHz G5, it does 218MB/s, compared to 135MB/s for the openssl
version or 45MB/s for the mozilla version.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
New "diff-cache" implementation.
This one is about a million times simpler, and much more likely to be
correct too.
Instead of trying to match up a tree object against the index, we just
read in the tree object side-by-side into the index, and just walk the
resulting index file. This was what all the read-tree cleanups were
all getting to.
This one is about a million times simpler, and much more likely to be
correct too.
Instead of trying to match up a tree object against the index, we just
read in the tree object side-by-side into the index, and just walk the
resulting index file. This was what all the read-tree cleanups were
all getting to.
Move "read_tree()" to "tree.c" to be used as a generic helper function.
Next step: make "diff-cache" use it.
Next step: make "diff-cache" use it.
Clean up and simplify read-tree a bit.
This is preparation for moving parts of it into "tree.c" to be used
as a library function.
This is preparation for moving parts of it into "tree.c" to be used
as a library function.
Add support for alternate SHA1 library implementations.
This one includes the Mozilla SHA1 implementation sent in by Edgar Toernig.
It's dual-licenced under MPL-1.1 or GPL, so in the context of git, we
obviously use the GPL version.
Side note: the Mozilla SHA1 implementation is about twice as fast as the
default openssl one on my G5, but the default openssl one has optimized
x86 assembly language on x86. So choose wisely.
This one includes the Mozilla SHA1 implementation sent in by Edgar Toernig.
It's dual-licenced under MPL-1.1 or GPL, so in the context of git, we
obviously use the GPL version.
Side note: the Mozilla SHA1 implementation is about twice as fast as the
default openssl one on my G5, but the default openssl one has optimized
x86 assembly language on x86. So choose wisely.
Split up Makefile library list handling with separate entries for
zlib and libssl.
I'll start giving people choices here..
zlib and libssl.
I'll start giving people choices here..
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.
The old revision.h helper header isn't used any more, but I never noticed
it until I started grepping for ULONG_MAX users.
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.
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.
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".
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".
Fix NSEC compile problem, and properly parse the rev-tree cmd line.
The rev-tree thing just happened to work. It shouldn't have.
The rev-tree thing just happened to work. It shouldn't have.
[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>
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>
Duh, just make git-export.c use the proper syntax, everything is fine.
Fix up some problems from the commit->tree helper patch
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.
The high-level helpers seem to have forgotten what to do with sha1
names.
[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>
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>
[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>
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>
[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>
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>
[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>
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>
[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>
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>
[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>
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>
Improve build: add <unistd.h> and use -O2 instead of -O3
(Nobody should use -O3. It just makes bad inlining decisions).
(Nobody should use -O3. It just makes bad inlining decisions).
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.
This allows us to both calculate it and verify it faster.
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.
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.
Make "write_sha1_file()" exit early if the file already exists.
Avoid the compression.
Avoid the compression.
The recent hash/compression switch-over missed the blob creation.
Happily, convert-cache just magically fixes all errors.
Happily, convert-cache just magically fixes all errors.
Do SHA1 hash _before_ compression.
And add a "convert-cache" program to convert from old-style
to new-style.
And add a "convert-cache" program to convert from old-style
to new-style.
[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>
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>
[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>
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>
[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>
Consolidate comments at top of main.
Signed-Off-By: Zach Welch <zw@superlucidity.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
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.
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.
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.
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.
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.
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.
Remove duplicate getenv(DB_ENVIRONMENT) call
Noted by Tony Luck.
Noted by Tony Luck.
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.
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.
Fix init-db shared database case
Noted by Aaron Straus
Noted by Aaron Straus
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..
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..
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.
This one just reads one tree, but picks up any matching stat information
from the old index.
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.
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.
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.
Also exit gracefully if the HEAD pull failed, rather than use
a possibly stale MERGE_HEAD.
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.
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.
[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.
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.
[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>
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>
Make fsck-cache print the object type for unreachable objects.
This got lost when I updated to Daniel's new object model.
This got lost when I updated to Daniel's new object model.
[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>
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>
[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>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
[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>
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>
[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>
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>
[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>
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>
[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>
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>
[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>
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>
[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>
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>
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
out index is all ready to go after a pull.
Noted by Russell King
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".
instead of a checked-out temporary copy.
If merging requires a checked-out-copy, we now do so with "unpack-file".
Add "unpack-file" helper that unpacks a sha1 blob into a tmpfile.
Add more header dependencies.
Yeah, my Makefiles are always a total disaster. Better this than autotools
or some horror like that, though.
Yeah, my Makefiles are always a total disaster. Better this than autotools
or some horror like that, though.
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.
Do the usage and error reporting in "usage.c", and the sha1 file
accesses in "sha1_file.c".
Small, nice, easily separated parts. Good.
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).
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).
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.
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.
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.
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.
[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).
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).
[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>
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>
[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>
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>
[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>
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>