Commit graph

853 commits

Author SHA1 Message Date
Junio C Hamano b155725dae [PATCH] Fix oversimplified optimization for add_cache_entry().
An earlier change to optimize directory-file conflict check
broke what "read-tree --emu23" expects.  This is fixed by this
commit.

(1) Introduces an explicit flag to tell add_cache_entry() not to
    check for conflicts and use it when reading an existing tree
    into an empty stage --- by definition this case can never
    introduce such conflicts.

(2) Makes read-cache.c:has_file_name() and read-cache.c:has_dir_name()
    aware of the cache stages, and flag conflict only with paths
    in the same stage.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-25 16:52:16 -07:00
Junio C Hamano aacc15ec52 [PATCH] git-merge-one-file-script: do not misinterpret rm failure.
When a merge adds a file DF and removes a directory there by
deleting a path DF/DF, git-merge-one-file-script can be called
for the removal of DF/DF when the path DF is already created by
"git-read-tree -m -u".  When this happens, we get confused by a
failure return from 'rm -f -- "$4"' (where $4 is DF/DF); finding
file DF there the "rm -f" command complains that DF is not a
directory.

What we want to ensure is that there is no file DF/DF in this
case. Avoid getting ourselves confused by first checking if
there is a file, and only then try to remove it (and check for
failure from the "rm" command).

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-25 16:52:16 -07:00
Junio C Hamano 1abb3f14c8 [PATCH] Add more tests for read-tree --emu23.
This adds more tests for --emu23.  One is to show how it can
carry forward more local changes than the straightforward
two-way fast forward, and another is to show the recent
overeager optimization of directory/file conflict check broke
things, which will be fixed in the next commit.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-25 16:52:16 -07:00
Junio C Hamano 59e6b23ace [PATCH] git-rebase-script: rebase local commits to new upstream head.
Using git-cherry, forward port local commits missing from the
new upstream head.  This also depends on "-m" flag support in
git-commit-script.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-25 16:52:16 -07:00
Junio C Hamano 93c36dcd0a [PATCH] git-cherry: find commits not merged upstream.
The git-cherry command helps the git-rebase script by finding
commits that have not been merged upstream.  Commits already
included in upstream are prefixed with '-' (meaning "drop from
my local pull"), while commits missing from upstream are
prefixed with '+' (meaning "add to the updated upstream").

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-25 16:52:16 -07:00
Junio C Hamano 5fec3ef101 [PATCH] git-commit-script: get commit message from an existing one.
With -m flag specified, git-commit-script takes the commit
message along with author information from an existing commit.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-25 16:52:16 -07:00
Junio C Hamano 9cb480f2ad [PATCH] fix date parsing for GIT raw commit timestamp format.
Usually all of the match_xxx routines in date.c fill tm
structure assuming that the parsed string talks about local
time, and parse_date routine compensates for it by adjusting the
value with tz offset parsed out separately.  However, this logic
does not work well when we feed GIT raw commit timestamp to it,
because what match_digits gets is already in GMT.

A good testcase is:

    $ make test-date
    $ ./test-date 'Fri Jun 24 16:55:27 2005 -0700' '1119657327 -0700'

These two timestamps represent the same time, but the second one
without the fix this commit introduces gives you 7 hours off.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-25 16:52:16 -07:00
Linus Torvalds 7453695831 git-unpack-objects: start parsing the actual packed data
So far we just print out the type and size.
2005-06-25 15:59:31 -07:00
Linus Torvalds d38c3721a1 git-pack-objects: mark the delta packing with a 'D'.
When writing a delta, we take the real type from the object we're
doing the delta against, and just write a 'D' as the type of the
current object.
2005-06-25 15:58:42 -07:00
Linus Torvalds bad50dc80f First cut at git-unpack-objects
So far it just reads the header and generates the list of objects.

It also sorts them by the order they are written in the pack file,
since that ends up being the same order we got them originally, and
is thus "most recent first".
2005-06-25 15:27:14 -07:00
Linus Torvalds 49397104f2 git-pack-objects: fix typo
("<" should be "=")
2005-06-25 15:24:30 -07:00
Linus Torvalds c323ac7d9c git-pack-objects: create a packed object representation.
This is kind of like a tar-ball for a set of objects, ready to be
shipped off to another end.  Alternatively, you could use is as a packed
representation of the object database directly, if you changed
"read_sha1_file()" to read these kinds of packs.

The latter is partiularly useful to generate a "packed history", ie you
could pack up your old history efficiently, but still have it available
(at a performance hit, of course).

I haven't actually written an unpacker yet, so the end result has not
been verified in any way yet.  I obviously always write bug-free code,
so it just has to work, no?
2005-06-25 14:42:43 -07:00
Jan Harkes 7323aa11af [PATCH] git-write-tree doesn't check alternate directories
git-write-tree failed when referenced objects only exist in the
GIT_ALTERNATE_OBJECT_DIRECTORIES path.

Signed-off-by: Jan Harkes <jaharkes@cs.cmu.edu>
Acked-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-25 13:41:10 -07:00
Linus Torvalds 9de48752fe git-rev-list: add option to list all objects (not just commits)
When you do

	git-rev-list --objects $(git-rev-parse HEAD^..HEAD)

it now lists not only the "commit difference" between the parent of HEAD
and HEAD itself (which is normally just the parent, but in the case of a
merge will be all the newly merged commits), but also all the new tree
and blob objects that weren't in the original.

NOTE! It doesn't walk all the way to the root, so it doesn't do a full
object search in the full old history.  Instead, it will only look as
far back in the history as it needs to resolve the commits.  Thus, if
the commit reverts a blob (or tree) back to a state much further back in
history, we may end up listing some blobs (or trees) as "new" even
though they exist further back.

Regardless, the list of objects will be a superset (usually exact) list
of objects needed to go from the beginning commit to ending commit.

As a particularly obvious special case,

	git-rev-list --objects HEAD

will end up listing every single object that is reachable from the HEAD
commit.

Side note: the objects are sorted by "recency", with commits first.
2005-06-24 22:56:58 -07:00
Linus Torvalds 023d66ed7b git-rev-parse: re-organize and be more careful
Output default revisions as their hex SHA1 names to be consistent.

Add "--verify" flag that verifies that we output a single ref and not
more (and disables ref arguments).
2005-06-24 10:12:55 -07:00
Linus Torvalds f97672225b Add "git-patch-id" program to generate patch ID's.
A "patch ID" is nothing but a SHA1 of the diff associated with a patch,
with whitespace and line numbers ignored.  As such, it's "reasonably
stable", but at the same time also reasonably unique, ie two patches
that have the same "patch ID" are almost guaranteed to be the same
thing.

IOW, you can use this thing to look for likely duplicate commits.
2005-06-23 15:06:04 -07:00
Linus Torvalds 180926636e Clean up git-diff-tree 'header' generation 2005-06-23 13:56:55 -07:00
Linus Torvalds aefa4a5b1c git-apply: take "--apply" flag to force an apply even if we also ask for a diffstat
Also, remove debugging statement about applying a fragment at an offset.
2005-06-23 09:00:01 -07:00
Linus Torvalds 5fca669f19 Make "git fetch" able to fetch a named tag
Use "git fetch <repo> tag <tagname>" to get the named tag and everything
it points to.
2005-06-23 08:59:00 -07:00
Jon Seymour 170774a39d [PATCH] Fix to how --merge-order handles multiple roots
This patch addresses the problem reported by Paul Mackerras such that --merge-order
did not report the last root of a graph with merge of two independent roots.

Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-22 19:15:04 -07:00
Jon Seymour 6e4c0a5109 [PATCH] A test case that demonstrates a problem with merges with two roots.
git-rev-list --merge-order is omitting one of the roots when
displaying a merge containing two distinct roots.

A subsequent patch will fix the problem.

Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-22 19:15:04 -07:00
Linus Torvalds e4bcaac17e Don't ignore reachability of tag objects in fsck
We used to ignore unreachable tags, which just causes problems: it makes
"git prune" leave them around, but since we'll have prune everything
that tag points to, the tag object really should be removed too.

So remove the code that made us think tags were always reachable.
2005-06-22 19:06:34 -07:00
Linus Torvalds 3f571e0b3a Add "git-clone-script" thingy
It's just a trivial wrapper, but it should make Jeff's kernel developer
guide to git look a bit less intimidating.
2005-06-22 18:49:43 -07:00
Jon Seymour 60646e9a71 [PATCH] Fix --merge-order unit test breaks introduced by 6c88be1698
The sensible cleanup of the in-memory storage order of commit parents broke the --merge-order
code which was dependent on the previous behaviour of parse_commit().

This patch restores the correctness --merge-order behaviour by taking account of the
new behaviour of parse_commit.

Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-22 17:54:44 -07:00
Linus Torvalds bac15c454e Add "gitk" to the list of scripts to be installed automatically.
Btw, it's fun just looking at the merged git repository itself with
gitk, now that it has two "roots".
2005-06-22 14:07:41 -07:00
Linus Torvalds 5569bf9bbe Do a cross-project merge of Paul Mackerras' gitk visualizer
gitk is really quite incredibly cool, and is great for visualizing what
is going on in a git repository.  It's especially useful when you are
looking at what has changed since a particular version, since it
gracefully handles partial trees (and this also avoids the expense of
looking at _all_ changes in a big project).

For example, to see what changed in a merge after a "git pull", do

	gitk ORIG_HEAD..

to see only the new things.  Or you can simply do "gitk v2.6.12.." to
see what has changed since the v2.6.12 tag etc.

This merge itself is pretty interesting too, since it shows off a
feature of git itself that is incredibly cool: you can merge a
_separate_ git project into another git project.  Not only does this
keep all the history of the original project, it also makes it possible
to continue to merge with the original project and the union of the two
projects.

I don't think anybody else can do that.
2005-06-22 14:05:02 -07:00
Junio C Hamano fae22ac9d7 [PATCH] git-apply: tests for --stat and --summary.
This adds tests (which also serves demonstration) for the --stat
and --summary flags to the git-apply command.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-22 10:23:49 -07:00
Junio C Hamano d0587fd59f [PATCH] git-apply: documentation.
Add missing documentation for git-apply.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-22 10:23:48 -07:00
Junio C Hamano 96c912a484 [PATCH] git-apply: implement --summary option.
Typical expected usage is "git-apply --stat --summary" to show
diffstat plus dense description of information available in git
extended headers, such as creations, renames, and mode changes.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-22 10:23:48 -07:00
Junio C Hamano 03b4538bad [PATCH] git-apply --stat: show new filename for rename/copy patch.
When a patch is a git extended rename/copy patch, "git-apply
--stat" showed the old filename.  Change it to show the new
filename, because most of the time we are interested in looking
at the resulting tree.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-22 10:23:48 -07:00
Junio C Hamano f5ab6ccae3 [PATCH] local-pull: implement fetch_ref()
This makes "-w ref" usable for git-local-pull.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-22 10:23:48 -07:00
Paul Mackerras 6c20ff3423 Try to assign colors so crossing lines have different colors
In particular try hard to give different colors to lines that cross
at a corner in one of the lines.
2005-06-22 19:53:32 +10:00
Paul Mackerras 806ce09718 Account for indentation of the checkin comments by git-rev-list
This involves adding indentation when we read a commit with
git-cat-file and trimming the whitespace from the headline.
2005-06-22 18:15:15 +10:00
Linus Torvalds 5c8af185cc git-apply: create subdirectories leading up to a new file
Applying Andrew's latest patch-bomb showed us failing miserably if a new
subdirectory needed to be created..  That said, it's uncommon enough
that it's worth optimistically assuming it won't be needed, and then
creating the subdirectories only on failure.
2005-06-21 19:10:21 -07:00
Daniel Barkalow fa3e0655a4 [PATCH] Pull refs by HTTP
This adds support for refs to http-pull, both the -w option and reading
the target from a served file.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-21 18:29:13 -07:00
Daniel Barkalow 3173bd4969 [PATCH] Pull misc objects
Make pull fetch whatever is specified, parse it to figure out what it is, and
then process it appropriately. This also supports getting tag objects, and
getting whatever they tag.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-21 18:29:13 -07:00
Daniel Barkalow 89e4202f98 [PATCH] Parse tags for absent objects
Handle parsing a tag for a non-present object. This adds a function to lookup
an object with lookup_* for * in a string, so that it can get the right storage
based on the "type" line in the tag.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-21 18:29:12 -07:00
Paul Mackerras b490a99176 Use git-rev-list --header.
With --header, git-rev-list gives us the contents of the commit
in-line, so we don't need to exec a git-cat-file to get it, and we
don't need the readobj command either.
Also fixed a residual problem with handling the commit that
has a parent listed twice.
2005-06-22 10:25:38 +10:00
Linus Torvalds 9661c25640 Fix typo in git-checkout-script.
The confusion between "revs" vs "refs" caused us to not find the branch
name, which in turn meant that we never switched the HEAD over to it.
2005-06-21 17:12:38 -07:00
Linus Torvalds ef0bfa25e9 Remove MERGE_HEAD in "git checkout/reset"
Both of these scripts will end up resetting the index to some specific
head, and any unresolved merge will be forgotten.
2005-06-21 15:40:00 -07:00
Linus Torvalds 6b38a402e9 Clean up different special *HEAD handling
We codify the following different heads (in addition to the main "HEAD",
which points to the current branch, of course):

 - FETCH_HEAD

   Populated by "git fetch"

 - ORIG_HEAD

   The old HEAD before a "git pull/resolve" (successful or not)

 - LAST_MERGE

   The HEAD we're currently merging in "git pull/resolve"

 - MERGE_HEAD

   The previous head of a unresolved "git pull", which gets committed by
   a "git commit" after manually resolving the result

We used to have "MERGE_HEAD" be populated directly by the fetch, and we
removed ORIG_HEAD and LAST_MERGE too aggressively.
2005-06-21 14:04:13 -07:00
Mika Kukkonen d565b3412a [PATCH] Fix several gcc4 signedness warnings
Here is a patch that fixes several gcc4 warnings about different signedness,
all between char and unsigned char. I tried to keep the patch minimal
so resertod to casts in three places.

Signed-off-by: Mika Kukkonen <mikukkon@iki.fi>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-21 13:30:55 -07:00
Linus Torvalds dc14841102 git checkout: fix default head case
The "${new=$old}" syntax only works for an undefined 'new', not for an
empty one. I knew that. Really. I'm not stupid.
2005-06-21 11:14:47 -07:00
Linus Torvalds e8b11749f0 Make "git checkout" know about different branches
Now "git checkout xyzzy" will check out branch "xyzzy" and
switch the HEAD to it.
2005-06-21 11:03:11 -07:00
Linus Torvalds a79944d76c "git checkout": add "-u" flag to update HEAD conditionally
And fix braino on testing "-f".
2005-06-21 09:59:26 -07:00
Linus Torvalds 303e5f4c32 Add "git checkout" that does what the name suggests
It is careful by default and refuses to overwrite old info, but if you
want to force everything to be re-read, use the "-f" flag.

Some day I'll make it take individual filenames too. Right now
it's all-or-nothing.
2005-06-21 09:47:37 -07:00
Nicolas Pitre 83ba99bc8c [PATCH] fix scalability problems with git-deltafy-script
Current version would spin forever and exhaust memory while attempting
to sort all files from all revisions at once, until it dies before even
doing any real work.  This is especially noticeable when used on a big
repository like the imported bkcvs repo for the Linux kernel.

This patch allows for batching the sort to put a bound on needed
resources and making progress early, as well as including some small
cleanups.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-21 08:58:56 -07:00
Sven Verdoolaege 69f956e104 [PATCH] git-apply: Don't barf when --stat'ing a diff with no line changes.
Diffs with only mode changes didn't pass through git-apply --stat.

[ Linus' note: they did for me, on my ppc64, where division by zero just
  silently returns zero.  Duh.  ]

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-21 08:41:56 -07:00
Linus Torvalds 0795495388 Let "git commit" take arguments for files to commit.
It does a "git-update-cache" on the arguments, meaning that you can
commit files without doing a separate "git-update-cache".  This commit
was done with

	git commit git-commit-script

for example.
2005-06-20 21:20:41 -07:00
Linus Torvalds 0ed3715ffc Add "-q" flag to git-update-cache
It suppresses the "needs update" message for subsequent "--refresh"
cases (but not other errors).

Will be useful for "git commit". Stay tuned.
2005-06-20 21:18:54 -07:00