Commit Graph

673 Commits

Author SHA1 Message Date
Linus Torvalds
ed37b5b2b9 Make fetch/pull scripts terminate cleanly on errors
Don't continue with a merge if the fetch failed.
2005-06-06 17:40:22 -07:00
Linus Torvalds
3f4eff7530 git-resolve-script: don't wait for three seconds any more
We used to overwrite peoples dirty state.  We don't any more.  So don't
print the scary message and don't delay, just do the update already.
2005-06-06 17:39:14 -07:00
Daniel Barkalow
c7c4bbe631 [PATCH] -w support for git-ssh-pull/push
This adds support for -w to git-ssh-pull and git-ssh-push to make
receiving side write the commit that was transferred to a reference file.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-06 17:12:47 -07:00
Daniel Barkalow
cd541a68b3 [PATCH] Generic support for pulling refs
This adds support to pull.c for requesting a reference and writing it to a
file. All of the git-*-pull programs get stubs for now.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-06 17:11:11 -07:00
Daniel Barkalow
9182f89ab2 [PATCH] rsh.c environment variable
rsh.c used to set the environment variable for the object database when
invoking the remote command. Now that there is a GIT_DIR variable, use
that instead.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-06 17:09:45 -07:00
Daniel Barkalow
95fc75129a [PATCH] Operations on refs
This patch adds code to read a hash out of a specified file under
{GIT_DIR}/refs/, and to write such files atomically and optionally with an
compare and lock.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-06 17:09:45 -07:00
Linus Torvalds
451322512f git-read-tree: some "final" cleanups
Looking good, but hey, it's not like I even have a real testcase for any
of this.  But unlike the mess that this was yerstday, today read-cache
is pretty readable and understandable.  Which is always a good sign.
2005-06-06 14:33:11 -07:00
Linus Torvalds
d723c69063 git-read-tree: simplify merge loops enormously
Stop trying to haev this stateful thing that keeps track of what it has
seen, and use a much simpler "gather all the different stages with the
same name together and just merge them in one go" approach.

Makes it a lot more understandable, and allows the different merge
algorithms to share the basic merge loop.
2005-06-06 14:01:58 -07:00
Junio C Hamano
96cd5429a4 [PATCH] index locking like everybody else
This patch teaches read-tree how to use the index file locking
helpers the same way "checkout-cache -u" and "update-cache" do.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-06 13:13:27 -07:00
Linus Torvalds
90334cf780 Add "__noreturn__" attribute to die() and usage()
Only with gcc. It fixes some warnings for certain versions
of gcc, but not apparently all.
2005-06-06 10:12:31 -07:00
Linus Torvalds
64de356299 git-rev-list: make sure to link with ssl libraries
Needed for the bignum stuff used by merge-order.
2005-06-06 09:09:43 -07:00
jon@blackcubes.dyndns.org
a3437b8c26 [PATCH] Modify git-rev-list to linearise the commit history in merge order.
This patch linearises the GIT commit history graph into merge order
which is defined by invariants specified in Documentation/git-rev-list.txt.

The linearisation produced by this patch is superior in an objective sense
to that produced by the existing git-rev-list implementation in that
the linearisation produced is guaranteed to have the minimum number of
discontinuities, where a discontinuity is defined as an adjacent pair of
commits in the output list which are not related in a direct child-parent
relationship.

With this patch a graph like this:

	a4 ---
	| \   \
	|  b4 |
	|/ |  |
	a3 |  |
	|  |  |
	a2 |  |
	|  |  c3
	|  |  |
	|  |  c2
	|  b3 |
	|  | /|
	|  b2 |
	|  |  c1
	|  | /
	|  b1
	a1 |
	|  |
	a0 |
	| /
	root

Sorts like this:

	= a4
	| c3
	| c2
	| c1
	^ b4
	| b3
	| b2
	| b1
	^ a3
	| a2
	| a1
	| a0
	= root

Instead of this:

	= a4
	| c3
	^ b4
	| a3
	^ c2
	^ b3
	^ a2
	^ b2
	^ c1
	^ a1
	^ b1
	^ a0
	= root

A test script, t/t6000-rev-list.sh, includes a test which demonstrates
that the linearisation produced by --merge-order has less discontinuities
than the linearisation produced by git-rev-list without the --merge-order
flag specified. To see this, do the following:

	cd t
	./t6000-rev-list.sh
	cd trash
	cat actual-default-order
	cat actual-merge-order

The existing behaviour of git-rev-list is preserved, by default. To obtain
the modified behaviour, specify --merge-order or --merge-order --show-breaks
on the command line.

This version of the patch has been tested on the git repository and also on the linux-2.6
repository and has reasonable performance on both - ~50-100% slower than the original algorithm.

This version of the patch has incorporated a functional equivalent of the Linus' output limiting
algorithm into the merge-order algorithm itself. This operates per the notes associated
with Linus' commit 337cb3fb8d.

This version has incorporated Linus' feedback regarding proposed changes to rev-list.c.
(see: [PATCH] Factor out filtering in rev-list.c)

This version has improved the way sort_first_epoch marks commits as uninteresting.

For more details about this change, refer to Documentation/git-rev-list.txt
and http://blackcubes.dyndns.org/epoch/.

Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-06 09:07:26 -07:00
Linus Torvalds
d925ffbd06 Fix off-by-one in new three-way-merge updates
That's the final one ("Yeah, sure, we believe you").

Anyway, at least the tests pass, which is not saying a lot, since they
don't end up testing all the new the things that the new merge world
order tries to do. But hopefully we're now at least not any worse off
than we were before the rewrite.
2005-06-05 23:38:18 -07:00
Junio C Hamano
c3f13d59f7 [PATCH] 3-way merge tests for new "git-read-tree -m"?
The updated git-tread-tree -m is more strict in that it wants to
have the original cache up to date.  The initial part of t1000
(merge tests from hell) fails due to it.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-05 23:33:38 -07:00
Linus Torvalds
a76d74fb71 Three-way merge: fix silly bug that made trivial merges not work
Making the main loop look more like the one- and two-way cases
introduced a bug where "src" had been updated early, but later
users hadn't been adjusted to match.
2005-06-05 23:32:53 -07:00
Linus Torvalds
6ee67f2610 Fix entry.c dependency and compile problem
Bad Linus.
2005-06-05 23:15:40 -07:00
Linus Torvalds
e6ee623b7b git-read-tree: fix up two-way merge
This is starting to look better.
2005-06-05 22:59:59 -07:00
Linus Torvalds
220a0b527b More work on merging with git-read-tree..
Add a "-u" flag to update the tree as a result of a merge.

Right now this code is way too anal about things, and fails merges it
shouldn't, but let me fix up the different cases and this will allow for
much smoother merging even in the presense of dirty data in the working
tree.
2005-06-05 22:07:31 -07:00
Linus Torvalds
12dccc1654 Make fiel checkout function available to the git library
The merge stuff will want it soon, and we don't want to
duplicate all the work..
2005-06-05 21:59:54 -07:00
Linus Torvalds
76f38347b4 git-read-tree: fix up three-way merge tests
When we collapse three entries, we need to check all of the
collapsed entries against the old pre-merge state.
2005-06-05 20:28:33 -07:00
Linus Torvalds
02ede67ad4 git-read-tree: be a lot more careful about merging dirty trees
We don't want to overwrite state that we haven't committed yet
when merging, so it's better to make git-read-tree fail than
end up with a merge tree that ends up not having the dirty changes.

Update git-resolve-script to fail cleanly when git-read-tree fails.
2005-06-05 20:02:31 -07:00
Petr Baudis
9b63f50148 [PATCH] Make git-update-cache --force-remove regular
Make the --force-remove flag behave same as --add, --remove and
--replace. This means I can do

	git-update-cache --force-remove -- file1.c file2.c

which is probably saner and also makes it easier to use in cg-rm.

Signed-off-by: Petr Baudis <pasky@ucw.cz>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-05 16:57:23 -07:00
Junio C Hamano
418aaf847a [PATCH] rename git-rpush and git-rpull to git-ssh-push and git-ssh-pull
In preparation for 1.0 release, this makes the command names
consistent with others in git-*-pull family.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-05 16:12:27 -07:00
Linus Torvalds
dc93841715 diff 'rename' format change.
Clearly even Junio felt git "rename" header lines should say "from/to"
instead of "old/new", since he wrote the documentation that way.

This way it also matches "copy".

git-apply will accept both versions, at least for a while.
2005-06-05 15:31:52 -07:00
Linus Torvalds
f7b797073c git-apply: consider it an error to apply no changes
A "--stat" or a "--check" will just be quiet, but if
you try to apply something with no changes, that's an
error.
2005-06-05 15:25:28 -07:00
Junio C Hamano
1a93a7662d [PATCH] Documentation: describe git extended diff headers.
The documentation failed to describe "diff --git" extended diff
headers, so add some.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-05 15:23:57 -07:00
Junio C Hamano
4a1332d04b [PATCH] Documentation: describe diff tweaking.
This adds documentation for the diffcore mechanism and explains
how numeric parameters to -B/-C/-M options affect the output,
which was left "black magic" so far.

The documentation is not connected to any of the other asciidoc
nodes yet.  Awaiting for suggestions, fixes and help from other
people.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-05 15:23:57 -07:00
Linus Torvalds
33f4d087a9 git-apply: fix rename header parsing
It's not "rename from" and "rename to", it's "rename old" and "rename new".

Which is illogical and doesn't match the "copy from/to" case, but that's
life. Maybe Junio will fix it up one of these days.
2005-06-05 14:26:50 -07:00
Junio C Hamano
a48e1d67e1 [PATCH] pull: gracefully recover from delta retrieval failure.
This addresses a concern raised by Jason McMullan in the mailing
list discussion.  After retrieving and storing a potentially
deltified object, pull logic tries to check and fulfil its delta
dependency.  When the pull procedure is killed at this point,
however, there was no easy way to recover by re-running pull,
since next run would have found that we already have that
deltified object and happily reported success, without really
checking its delta dependency is satisfied.

This patch introduces --recover option to git-*-pull family
which causes them to re-validate dependency of deltified objects
we are fetching.  A new test t5100-delta-pull.sh covers such a
failure mode.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-05 14:18:00 -07:00
Junio C Hamano
f78c79c5d4 [PATCH] diffcore-break.c: various fixes.
This fixes three bugs in the -B heuristics.

 - Although it was advertised that the initial break criteria
   used was the same as what diffcore-rename uses, it was using
   something different.  Instead of using smaller of src and dst
   size to compare with "edit" size, (insertion and deletion),
   it was using larger of src and dst, unlike the rename/copy
   detection logic.  This caused the parameter to -B to mean
   something different from the one to -M and -C.  To compensate
   for this change, the default break score is also changed to
   match that of the default for rename/copy.

 - The code would have crashed with division by zero when trying
   to break an originally empty file.

 - Contrary to what the comment said, the algorithm was breaking
   small files, only to later merge them together.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-05 14:14:58 -07:00
Junio C Hamano
49d9e85d11 [PATCH] diff.c: -B argument passing fix.
This fixes a bug that was preventing non-default parameter to -B
option to be passed correctly; you could not give more than 50%
break score.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-05 14:14:58 -07:00
Junio C Hamano
0601e131c9 [PATCH] diff.c: locate_size_cache() fix.
This fixes two bugs.

 - declaration of auto variable "cmp" was preceeded by a
   statement, causing compilation error on real C compilers;
   noticed and patch given by Yoichi Yuasa.

 - the function's calling convention was overloading its size
   parameter to mean "largest possible value means do not add
   entry", which was a bad taste.  Brought up during a
   discussion with Peter Baudis.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-05 14:14:58 -07:00
Linus Torvalds
5aa7d94cd6 git-apply: actually apply patches and update the index
We update the index only if the "--index" flag is given,
so you can actually use this as a strange kind of "patch"
program even for non-git usage. Not that you'd likely
want to, but it comes in handy for testing.

This _should_ more or less get everythign right, but as
usual I leave the testing to the usrs..
2005-06-05 14:05:43 -07:00
Linus Torvalds
30996652e7 git-apply: fix apply of a new file
(And fix name handling for when we have an implied
create or delete event from a traditional diff).
2005-06-05 12:43:56 -07:00
Linus Torvalds
6e7c92a91d git-apply: find offset fragments, and really apply them
This applies the fragments in memory, but doesn't actually
write the results out to the files yet. But we now do all the
difficult parts, the rest is just basically writing the
results out and updating the index.
2005-06-05 12:16:32 -07:00
Linus Torvalds
3cca928d4a git-apply: first cut at actually checking fragment data
Right now it requires that the fragment offsets be exact,
and it doesn't actually apply the fragment yet, but it
does find where it goes and verify the data.

Next step: actually applying the fragment changes.
2005-06-05 11:03:13 -07:00
Linus Torvalds
477606f57d git-fsck-cache: complain if no default references found 2005-06-05 09:55:27 -07:00
Linus Torvalds
000182eacf pretty_print_commit: add different formats
You can ask to print out "raw" format (full headers, full body),
"medium" format (author and date, full body) or "short" format
(author only, condensed body).

Use "git-rev-list --pretty=short HEAD | less -S" for an example.
2005-06-05 09:02:03 -07:00
Linus Torvalds
848b292e83 git-shortlog: add name translations for 'sparse' repo 2005-06-04 20:33:01 -07:00
Linus Torvalds
fa375c7f1b Add git-shortlog perl script
Somebody finally came through - Jeff Garzik gets a gold
star for writing a shortlog script for git, so that I
can do nice release announcments again.

I added name translations from the current kernel history
(and git, for that matter). Hopefully it won't grow at
nearly the same rate the BK equivalent did, since 99% of
the time git records the full name already.

Usage: just do

        git-rev-list --pretty HEAD ^LAST_HEAD | git-shortlog

or, in fact, use any of the other tools (git-diff-tree,
git-whatchanged etc) that use the default "pretty" commit format.
2005-06-04 20:21:35 -07:00
Linus Torvalds
337cb3fb8d git-rev-list: allow arbitrary head selections, use git-rev-tree syntax
This makes git-rev-list use the same command line syntax to mark the
commits as git-rev-tree does, and instead of just allowing a start and
end commit, it allows an arbitrary list of "interesting" and "uninteresting"
commits.

For example, imagine that you had three branches (a, b and c) that you
are interested in, but you don't want to see stuff that already exists
in another persons three releases (x, y and z). You can do

	git-rev-list a b c ^x ^y ^z

(order doesn't matter, btw - feel free to put the uninteresting ones
first or otherwise swithc them around), and it will show all the
commits that are reachable from a/b/c but not reachable from x/y/z.

The old syntax "git-rev-list start end" would not be written as
"git-rev-list start ^end", or "git-rev-list ^end start".

There's no limit to the number of heads you can specify (unlike
git-rev-tree, which can handle a maximum of 16 heads).
2005-06-04 14:38:28 -07:00
Daniel Barkalow
dba385bb3e [PATCH] ssh-protocol version, command types, response code
This patch makes an incompatible change to the protocol used by
rpull/rpush which will let it be extended in the future without
incompatible changes.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-03 16:07:29 -07:00
Junio C Hamano
eeaa460314 [PATCH] diff: Update -B heuristics.
As Linus pointed out on the mailing list discussion, -B should
break a files that has many inserts even if it still keeps
enough of the original contents, so that the broken pieces can
later be matched with other files by -M or -C.  However, if such
a broken pair does not get picked up by -M or -C, we would want
to apply different criteria; namely, regardless of the amount of
new material in the result, the determination of "rewrite"
should be done by looking at the amount of original material
still left in the result.  If you still have the original 97
lines from a 100-line document, it does not matter if you add
your own 13 lines to make a 110-line document, or if you add 903
lines to make a 1000-line document.  It is not a rewrite but an
in-place edit.  On the other hand, if you did lose 97 lines from
the original, it does not matter if you added 27 lines to make a
30-line document or if you added 997 lines to make a 1000-line
document.  You did a complete rewrite in either case.

This patch introduces a post-processing phase that runs after
diffcore-rename matches up broken pairs diffcore-break creates.
The purpose of this post-processing is to pick up these broken
pieces and merge them back into in-place modifications.  For
this, the score parameter -B option takes is changed into a pair
of numbers, and it takes "-B99/80" format when fully spelled
out.  The first number is the minimum amount of "edit" (same
definition as what diffcore-rename uses, which is "sum of
deletion and insertion") that a modification needs to have to be
broken, and the second number is the minimum amount of "delete"
a surviving broken pair must have to avoid being merged back
together.  It can be abbreviated to "-B" to use default for
both, "-B9" or "-B9/" to use 90% for "edit" but default (80%)
for merge avoidance, or "-B/75" to use default (99%) "edit" and
75% for merge avoidance.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-03 11:23:03 -07:00
Junio C Hamano
0e3994fa97 [PATCH] diff: Clean up diff_scoreopt_parse().
This cleans up diff_scoreopt_parse() function that is used to
parse the fractional notation -B, -C and -M option takes.  The
callers are modified to check for errors and complain.  Earlier
they silently ignored malformed input and falled back on the
default.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-03 11:23:03 -07:00
Junio C Hamano
ce24067549 [PATCH] diff: Fix docs and add -O to diff-helper.
This patch updates diff documentation and usage strings:

 - clarify the semantics of -R.  It is not "output in reverse";
   rather, it is "I will feed diff backwards".  Semantically
   they are different when -C is involved.

 - describe -O in usage strings of diff-* brothers.  It was
   implemented, documented but not described in usage text.

Also it adds -O to diff-helper.  Like -S (and unlike -M/-C/-B),
this option can work on sanitized diff-raw output produced by
the diff-* brothers.  While we are at it, the call it makes to
diffcore is cleaned up to use the diffcore_std() like everybody
else, and the declaration for the low level diffcore routines
are moved from diff.h (public) to diffcore.h (private between
diff.c and diffcore backends).

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-03 11:23:03 -07:00
Junio C Hamano
355e76a4a3 [PATCH] Tweak count-delta interface
Make it return copied source and insertion separately, so that
later implementation of heuristics can use them more flexibly.

This does not change the heuristics implemented in
diffcore-rename nor diffcore-break in any way.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-03 11:23:03 -07:00
Rene Scharfe
5b86040679 [PATCH] git-tar-tree: do only basic tests in t/t5000-git-tar-tree.sh
git-tar-tree: remove tests of long path handling out of t5000-tar-tree.sh
and make test script cope with tar programs displaying file modification
date as hh:mm (newer variants show it as hh:mm:ss).

This makes the test cover only basic functionality that is expected to
be handled even by older tar programs.  Tests for long filenames (which
require pax extended headers) can be added separately.

I ran this test successfully with GNU tar 1.13, 1.14 and 1.15.1.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-03 09:51:01 -07:00
Rene Scharfe
a325a11b88 [PATCH] git-tar-tree: fix write_trailer
write_trailer() writes the last 10k (a full block) of the tar archive.
write_if_needed() writes out a block *if* it is full and then sets
the offset to 0.  In nine out of ten cases the messed up write_trailer()
function didn't manage to fill the block thus not writing anything at
all, truncating the archive.  I was "lucky" to hit the other case and so
my testing ran OK.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-03 07:36:42 -07:00
Rene Scharfe
d3d49c3d35 [PATCH] git-tar-tree: add a test case
add a simple test case.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-02 18:30:08 -07:00
Rene Scharfe
d3a15c49d4 [PATCH] git-tar-tree: small doc update
document difference in behaviour w/ regard to tree vs.  commit and
correct author information.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-02 18:30:08 -07:00