Commit Graph

21298 Commits

Author SHA1 Message Date
Daniel Barkalow
2636f61437 [PATCH] Add tag header/parser to library
This adds preliminary support for tags in the library. It doesn't even
store the signature, however, let alone provide any way of checking it.

Signed-Off-By: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-28 07:46:33 -07:00
Daniel Barkalow
a510bfaa8c [PATCH] Mark blobs as parsed when they're actually parsed
This eliminates the special case for blobs versus other types of
objects. Now the scheme is entirely regular and I won't introduce stupid
bugs. (And fsck-cache doesn't have to do the do-nothing parse)

Signed-Off-By: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-28 07:46:33 -07:00
Junio C Hamano
3a663fd984 [PATCH] diff-tree -p implies diff-tree -p -r
This makes diff-tree -p imply recursive behaviour.

Other commands in the family always takes a flat universe view
so this is not even needed.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-27 16:25:59 -07:00
Junio C Hamano
ce9be4e4e8 [PATCH] Use diff-tree -p -r instead of "git diff" in git-export.
Now diff-tree can produce patch itself, there is no reason to
depend on Cogito to show diff in the git-export output anymore.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-27 15:36:01 -07:00
Junio C Hamano
d15aa4309c [PATCH] Make -s flag to show-diff a no-op.
With the recent "no-patch-by-default" change, the -s flag to the
show-diff command (and silent variable in the show-diff.c) became
meaningless.  This deprecates it. 

Cogito uses "show-diff -s" for the purpose of "I do not want the patch
text.  I just want to know if something has potentially changed, in
which case I know you will have some output.  I'll run update-cache
--refresh if you say something", so we cannot barf on seeing -s on our
command line yet. 

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-27 15:22:02 -07:00
Andreas Gal
ec8f81160d [PATCH] Fix up <sys/socket.h> include dependency
This makes rsh.c compile on Darwin/MacOSX (and might possibly help on
some Linux distributions too).

sys/socket.h needs sys/types.h

Signed-off-by: Andreas Gal <gal@uci.edu>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-27 13:46:36 -07:00
Linus Torvalds
4765dd57e6 diff.c: don't add extra '/' to pathname
The "base" string already contains any finishing "/", so the way
to get the full pathname is to just concatenate the base and
path directly, with no extra slashes in between.
2005-04-27 10:21:13 -07:00
Linus Torvalds
c9cddabe99 diff-cache: handle modified new files correctly
Junio pointed out that diff-cache didn't handle the case of a new file
that was different from its index entry correctly. It needs to check
the working copy the same way the modified file case did.
2005-04-27 09:41:15 -07:00
Junio C Hamano
91f192a909 [PATCH] Teach diff-tree-helper to handle unmerged paths.
This teaches diff-tree-helper to call diff_unmerge() so that it can
report unmerged paths to GIT_EXTERNAL_DIFF, instead of consuming it on
its own. 

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-27 09:21:00 -07:00
Junio C Hamano
f92a446581 [PATCH] Add -p (patch) to diff-cache.
This uses the reworked diff interface to generate patches directly out
of diff-cache when -p is specified. 

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-27 09:21:00 -07:00
Junio C Hamano
3ebfd4aa29 [PATCH] Add -p (patch) to diff-tree.
This uses the reworked diff interface to generate patches directly out
of diff-tree when -p is specified. 

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-27 09:21:00 -07:00
Junio C Hamano
4a6bf9e18a [PATCH] Reactivate show-diff patch generation
This uses the reworked diff interface to generate patches directly out
of show-diff when -p is specified. 

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-27 09:21:00 -07:00
Junio C Hamano
77eb272046 [PATCH] Reworked external diff interface.
This introduces three public functions for diff-cache and friends can
use to call out to the GIT_EXTERNAL_DIFF program when they wish to.

A normal "add/remove/change" entry is turned into 7-parameter process
invocation of GIT_EXTERNAL_DIFF program as before.  In addition, the
program can now be called with a single parameter when diff-cache and
friends want to report an unmerged path. 

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-27 09:21:00 -07:00
Linus Torvalds
520fc2415e Allow writing to the private index file mapping.
We now modify the in-memory copy of the index file in "diff-cache", so
we need to add PROT_WRITE.
2005-04-26 19:27:27 -07:00
Linus Torvalds
b0fe89caeb diff-cache: fix handling of unmerged files.
We've always warned about them properly, but we would then do the
wrong thing if that filename existed in the tree we were comparing
against (we'd think the file has been deleted, because we forgot
about the unmerged cases).
2005-04-26 18:03:07 -07:00
Linus Torvalds
a5cd7e1620 diff-cache.c: use the "U <pathname>" format for unmerged entries.
This makes it match "show-diff" behaviour.
2005-04-26 17:48:57 -07:00
Junio C Hamano
0b32ff0dd9 [PATCH] diff-cache/tree compatible output for show-diff (take 2).
This makes diff-tree-helper handle ("warn about") unmerged path entries

    U <path> <record-terminator>

This is emitted once per unmerged path, no matter how many unmerged
stages there are. 

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-26 17:39:01 -07:00
Linus Torvalds
b8a55ce71d show-diff: don't print out the full "ce" format for unmerged files
It really doesn't make sense, since there are potentially _many_ different
cache entries for an unmerged file. So just do the "U pathname" thing.
2005-04-26 17:37:11 -07:00
Linus Torvalds
0a7668e99f show-diff: match diff-tree and diff-cache output
You'll need "diff-tree-helper" to show the full diff, but Junio is
dead set on adding a "-p" argument to all three to avoid it. That's
next..
2005-04-26 17:17:36 -07:00
Linus Torvalds
9831d8f860 git-pull-script: do automatic merges
When the trivial "read-tree" merge fails, fall back on the (equally
trivial) automatic merge script instead of forcing the user to do
it by hand.

When _that_ fails, you get to do a manual merge.
2005-04-26 12:26:46 -07:00
Christopher Li
812666c8e6 [PATCH] introduce xmalloc and xrealloc
Introduce xmalloc and xrealloc to die gracefully with a descriptive
message when out of memory, rather than taking a SIGSEGV. 

Signed-off-by: Christopher Li<chrislgit@chrisli.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-26 12:00:58 -07:00
Linus Torvalds
f2a19340ad update-cache: remove index lock file on SIGINT
This makes it a lot more pleasant to use when you
interrupt a long-running operation.
2005-04-26 11:55:42 -07:00
Junio C Hamano
5697ecc7be [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>
2005-04-26 10:13:31 -07:00
Junio C Hamano
be3cfa85f4 [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>
2005-04-26 09:25:05 -07:00
Junio C Hamano
d1df574380 [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>
2005-04-25 18:26:45 -07:00
Junio C Hamano
86436c2828 [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>
2005-04-25 18:22:47 -07:00
Linus Torvalds
ab7df1874d 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.
2005-04-25 16:34:13 -07:00
Linus Torvalds
889262eacf 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.
2005-04-25 16:31:13 -07:00
Linus Torvalds
cd2fb81d11 Add the git-*-script files to the install 2005-04-25 15:29:45 -07:00
Linus Torvalds
65f0d0ee46 Add example "git-tag-script" to show how to create signed tag objects. 2005-04-25 15:23:53 -07:00
Linus Torvalds
56ce69f7af 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.
2005-04-25 15:21:49 -07:00
Linus Torvalds
ec4465adb3 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.
2005-04-25 12:07:44 -07:00
Linus Torvalds
f5b913c9cb Fix up the types in write_sha1_file
Use "unsigned long" for the size, like we do everywhere else.
2005-04-25 12:04:55 -07:00
Linus Torvalds
a44c9a5e2e Simplify "write_sha1_file()" interfaces
The write function now adds the header to the file by itself, so there
is no reason to duplicate it among all the users any more.
2005-04-25 10:19:53 -07:00
Linus Torvalds
e6948b6d88 fsck-cache: warn about missing commit dates
Now that we have hopefully converted all old archives, we
can consider it an error.
2005-04-24 16:20:53 -07:00
Linus Torvalds
3f053897b3 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.
2005-04-24 15:49:09 -07:00
James Bottomley
c6e007b094 [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>
2005-04-24 15:14:16 -07:00
James Bottomley
32718b6c5e [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>
2005-04-24 15:14:16 -07:00
Linus Torvalds
235ac40772 Don't add references to objects we couldn't find.
That would SIGSEGV.
2005-04-24 14:31:57 -07:00
Linus Torvalds
c35dfe8589 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.
2005-04-24 14:22:09 -07:00
Linus Torvalds
d32987be61 Set object type at object creation time, not object parse time.
Otherwise we can have objects without a type, which is not good.
2005-04-24 14:17:13 -07:00
Linus Torvalds
4728b861ac 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.
2005-04-24 14:10:55 -07:00
Andreas Gal
da6abf5d9c [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>
2005-04-24 14:04:13 -07:00
Linus Torvalds
c5b423860d 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>
2005-04-23 22:08:00 -07:00
James Bottomley
e2b6a9d0bf [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>
2005-04-23 20:50:10 -07:00
Daniel Barkalow
58e28af6a4 [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>
2005-04-23 20:29:22 -07:00
Linus Torvalds
4056c09114 Don't add parents to the commit list if we have already
seen them.

Otherwise any merges will make the parent list explode.
2005-04-23 19:21:28 -07:00
Linus Torvalds
64745109c4 Add "rev-list" program that uses the new time-based commit listing.
This is probably what you'd want to see for "git log".
2005-04-23 19:04:40 -07:00
Daniel Barkalow
6eb7ed5403 [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>
2005-04-23 18:47:23 -07:00
Daniel Barkalow
b6b15db3f4 [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>
2005-04-23 18:47:23 -07:00