Commit graph

755 commits

Author SHA1 Message Date
Linus Torvalds 1c107dc422 Fix up INSTALL and "git add"
As suggested by Junio
2005-06-18 23:44:54 -07:00
Linus Torvalds 2160a025d2 read-cache.c: remove stray debugging printf
Pointed out by Junio, part of my debugging of the rewrite of the
file/dir conflict handling.
2005-06-18 23:34:12 -07:00
Linus Torvalds 12676608fe Re-implement "check_file_directory_conflict()"
This is (imho) more readable, and is also a lot faster.  The expense of
looking up sub-directory beginnings was killing us on things like
"git-diff-cache", even though that one didn't even care at all about the
file vs directory conflicts.

We really only care when somebody tries to add a conflicting name to
stage 0.

We should go through the conflict rules more carefully some day.
2005-06-18 20:21:34 -07:00
Linus Torvalds 3d958064e0 Avoid warning about function without return.
Strangely, this warning only shows up when not compiling with "-O2",
which is why I didn't see it originally.
2005-06-18 20:02:49 -07:00
Sven Verdoolaege deb153a75a [PATCH] cvs2git and file permissions
git-cvs2git: propagate mode information

Let cvs checkout in a temporary directory rather than
using the pipe option to avoid loss of mode information.

Signed-off-by: Sven Verdoolaege <skimo@liacs.nl>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-18 15:38:23 -07:00
Linus Torvalds 28342a5d32 Make "pretty" commit logs always show merge information
Otherwise the "git log" information doesn't tell enough to make sense of
a merge.

I'll need to add some parent information for regular entries too, I
think, but the merge is more important.
2005-06-18 13:52:05 -07:00
Linus Torvalds 8b3a1e056f git-rev-list: add "--bisect" flag to find the "halfway" point
This is useful for doing binary searching for problems.  You start with
a known good and known bad point, and you then test the "halfway" point
in between:

	git-rev-list --bisect bad ^good

and you test that.  If that one tests good, you now still have a known
bad case, but two known good points, and you can bisect again:

	git-rev-list --bisect bad ^good1 ^good2

and test that point.  If that point is bad, you now use that as your
known-bad starting point:

	git-rev-list --bisect newbad ^good1 ^good2

and basically at every iteration you shrink your list of commits by
half: you're binary searching for the point where the troubles started,
even though there isn't a nice linear ordering.
2005-06-17 22:54:50 -07:00
Linus Torvalds 753fd78458 Use "-M" instead of "-C" for "git diff" and "git status"
The "C" in "-C" may stand for "Cool", but it's also pretty slow, since
right now it leaves all unmodified files to be tested even if there are
no new files at all.  That just ends up being unacceptably slow for big
projects, especially if it's not all in the cache.
2005-06-17 15:34:19 -07:00
Linus Torvalds b7e8039a6f git-apply: use default name for mode change patches
Pure mode changes won't have the file-name in the extended header lines,
so make sure we pick it up from the default name from the "diff --git"
line.
2005-06-17 15:23:40 -07:00
Linus Torvalds aeac668125 Don't use -C in "git diff"
Right now it confuses at least git-diff-files, since it leaves
all the files (whether changed or not) in the diff queue.
2005-06-17 12:46:38 -07:00
Linus Torvalds c538d2d34a Add some installation notes in INSTALL
Jens was the second person who hadn't heard of the "merge" program, and
didn't have it installed.  So document as many dependency and install
issues as I can think of.
2005-06-17 11:30:04 -07:00
Linus Torvalds 7875b50d1a git-read-tree: fix "--reset" handling 2005-06-15 10:25:46 -07:00
Linus Torvalds ce30a4b68a Update tutorial a bit for scripted helpers. 2005-06-14 19:00:00 -07:00
Linus Torvalds 40d8cfe411 Trivial git script fixups
Fix permissions, and add trivial "reset" and "add" scripts.

The "reset" script just resets the index back to head, while the "add"
script is just a crutch for people used to do "cvs add".
2005-06-14 18:56:05 -07:00
Sven Verdoolaege 479346adc5 [PATCH] ssh-push: Don't add '/' to pathname
Paths in the host:path notation are usually interpreted
relative to the login directory rather than relative to
the root directory.

Signed-off-by: Sven Verdoolaege <skimo@liacs.nl>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-14 12:09:34 -07:00
Mark Allen 7737314de7 [PATCH] Unset TZ in t5000
Unset TZ to force GMT in test #4 and add a set of parens around
the length function in the awk script.

Signed-off-by: Mark Allen <mrallen1@yahoo.com>
Acked-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-14 12:08:06 -07:00
Linus Torvalds fc865468d8 Make 'git' script be a bit more helpful on unrecognized commands 2005-06-14 11:01:49 -07:00
Linus Torvalds 96069cf03a Make "git commit" handle initial commits too
No need to confuse ex-CVS users with a complex initial commit sequence.
2005-06-14 10:20:14 -07:00
Linus Torvalds de4971b500 git-apply: normalize file mode when comparing with expected value
Sine git only saves the 'x' bit, we shouldn't compare the stat contents
directly.
2005-06-13 20:41:38 -07:00
Linus Torvalds 940c1bb018 Add "git diff" script
It's a simple helper that depending on the arguments will either
use git-diff-files, git-diff-cache or git-diff-tree.
2005-06-13 15:09:34 -07:00
Linus Torvalds 921d865ea2 Teach git-rev-parse about revision-specifying arguments
Things like "--max-count=xxx" are "rev-only".
2005-06-13 11:14:20 -07:00
Linus Torvalds d6cb5e5f99 git-whatchanged: use the git-rev-parse helper
So now you can say

	git-whatchanged -p v2.6.12-rc5.. drivers/usb

and it will show you what changed (as a patch) in drivers/usb since the
v2.6.12-rc5 release.
2005-06-13 10:22:39 -07:00
Linus Torvalds 8ebb018402 git-rev-parse: split "revs" and "non-revs"
Sometimes we only want to output revisions, and sometimes we want to
only see the stuff that wasn't revisions.  Teach git-rev-parse to
understand the "--revs-only" and "--no-revs" flags.
2005-06-13 10:21:11 -07:00
Linus Torvalds f04b05697c Make "git log" use the new git-rev-parse helper
See the previous commit for explanations.
2005-06-13 10:07:25 -07:00
Linus Torvalds 178cb24338 Add 'git-rev-parse' helper script
It's an incredibly cheesy helper that changes human-readable revision
arguments into the git-rev-list argument format.

You can use it to do something like this:

	git-rev-list --pretty $(git-rev-parse --default HEAD "$@")

which is what git-log-script will become. Here git-rev-parse will
then allow you to use arguments like "v2.6.12-rc5.." or similar
human-readable ranges.

It's really quite stupid: "a..b" will be converted into "a" and "^b" if
"a" and "b" are valid object pointers.  And the "--default" case will be
used if nothing but flags have been seen, so that you can default to a
certain argument if there are no other ranges.
2005-06-13 10:06:50 -07:00
Linus Torvalds 84fb9a4dca git-apply: fix error handling for nonexistent files
Missing argument for error() function. We should really use the
gcc printf format checking capabilities.
2005-06-12 21:04:27 -07:00
Tommy M. McGuire 9718a00b90 [PATCH] git cvsimport fuzz argument
Add "-z fuzz" argument, passed to cvsps, and clean up argument
processing.  Also, use "cvsps --cvs-direct", which is is somewhat
faster.

Give the user the option of specifying the timestamp fuzz passed to
cvsps.  Looking at the other arguments to it, I can't see anything else
that would be sane to play with.  Also, use --cvs-direct, which speeds
up cvsps for remote repositories and doesn't seem to do anything bad to
local repositories.

Signed-off-by: Tommy McGuire <mcguire@crsr.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-12 20:48:18 -07:00
Tommy M. McGuire 1cc92ff6ca [PATCH] cvs-migration.txt
Slightly expand the cvsimport description, and make a couple of syntax
edits.

The way I figure it, telling someone why cvsimport is taking so long
will improve their overall user experience.  :-)

Signed-off-by: Tommy McGuire <mcguire@crsr.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-12 20:48:18 -07:00
Tommy M. McGuire 861cb6f02c [PATCH] git cvsimport sanity checking
This patch adds some sanity checking to git-cvsimport-script,
specifically forcing the use of cvsps -x (to get the latest information
from the repository, rather than whatever is in the cache) and aborting
early if cvsps does not produce any output.

I debated removing the $MODULE directory following an abort, but I
eventually decided leaving stuff behind would make debugging easier.  On
the other hand, this patch should help with the "cvsimport left me with
an empty repository" complaints.

Call cvsps with the -x flag, to get the current state of the repository,
and abort the cvs import early if cvsps does not produce any output.

Signed-off-by: Tommy McGuire <mcguire@crsr.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-12 20:48:18 -07:00
Tommy M. McGuire 667628d97a [PATCH] cvsimport: allow remote CVS repos
Remove unneeded sanity tests.  Remote repositories do, indeed, just
work.

Signed-off-by: Tommy McGuire <mcguire@crsr.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-12 20:48:18 -07:00
Junio C Hamano 9939664a0b [PATCH] diff-stages: unuglify the too big main() function.
Split the core of the program, diff_stage, from one big "main()"
function that does it all and leave only the parameter parsing,
setup and finalize part in the main().

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-12 20:40:20 -07:00
Junio C Hamano 036d51cc55 [PATCH] read-tree: loosen too strict index requirements
This patch teaches read-tree 3-way merge that, when only "the
other tree" changed a path, and if the index file already has
the same change, we are not in a situation that would clobber
the index and the work tree, and lets the merge succeed; this is
case #14ALT in t1000 test.  It does not change the result of the
merge, but prevents it from failing when it does not have to.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-12 20:40:20 -07:00
Junio C Hamano 32192e6622 [PATCH] Finish making --emu23 equivalent to pure 2-way merge.
This adds #3ALT rule (and #2ALT rule for symmetry) to the
read-tree 3-way merge logic that collapses paths that are added
only in one branch and not in the other internally.

This makes --emu23 to succeed in the last remaining case where
the pure 2-way merge succeeded and earlier one failed.  Running
diff between t1001 and t1005 test scripts shows that the only
difference between the two is that --emu23 can leave the states
into separate stages so that the user can use usual 3-way merge
resolution techniques to carry forward the local changes when
pure 2-way merge would have refused to run.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-12 20:40:20 -07:00
Junio C Hamano e7f9bc411c [PATCH] read-tree: fix too strong index requirement #5ALT
This fixes too strong index requirement 3-way merge enforces in
one case: the same file is added in both branches.

In this case, the original code insisted that if the index file
has that path, it must match our branch and be up-to-date.
However in this particular case, it only has to match it, and
can be dirty.  We just need to make sure that we keep the
work-tree copy instead of checking out the merge result.

The resolution of such a path, however, cannot be left to
outside script, because we will not keep the original stage0
entries for unmerged paths when read-tree finishes, and at that
point, the knowledge of "if we resolve it to match the new file
added in both branches, the merge succeeds and the work tree
would not lose information, but we should _not_ update the work
tree from the resulting index file" is lost.  For this reason,
the now code needs to resolve this case (#5ALT) internally.

This affects some existing tests in the test suite, but all in
positive ways.  In t1000 (3-way test), this #5ALT case now gets
one stage0 entry, instead of an identical stage2 and stage3
entry pair, for such a path, and one test that checked for merge
failure (because the test assumed the "stricter-than-necessary"
behaviour) does not have to fail anymore.  In t1005 (emu23
test), two tests that involves a case where the work tree
already had a change introduced in the upstream (aka "merged
head"), the merge succeeds instead of failing.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-12 20:40:20 -07:00
Junio C Hamano 03efa6d9a4 [PATCH] read-tree --emu23.
This new flag causes two-way fast forward to internally use the
three-way merge mechanism.  This behaviour is intended to offer
a better fast forward semantics when used in a dirty work tree.

The new test t1005 is parallel to the existing t1001 "pure
2-way" tests, but some parts that are commented out would fail.
These failures are due to three-way merge enforcing too strict
index requirements for cases that could succeed.  This problem
will be addressed by later patches.

Without even changing three-way mechanism, the --emu23 two-way
fast forward already gives the user an easier-to-handle merge
result when a file that "merged head" updates has local
modifications.  This is demonstrated as "case 16" test in t1005.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-12 20:40:20 -07:00
Junio C Hamano 76bc82ca0e [PATCH] Clean up read-tree two-way tests.
This is in preparation for "2-way fast-forward emulated with
3-way mechanism" series.  It does not change what the tests for
pure 2-way do.  It only changes how it tests things, to make
reviewing of differences of the two tests easier in later steps.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-12 20:40:20 -07:00
Junio C Hamano f2ce9fde57 [PATCH] Add --diff-filter= output restriction to diff-* family.
This is a halfway between debugging aid and a helper to write an
ultra-smart merge scripts.  The new option takes a string that
consists of a list of "status" letters, and limits the diff
output to only those classes of changes, with two exceptions:

 - A broken pair (aka "complete rewrite"), does not match D
   (deleted) or N (created).  Use B to look for them.

 - The letter "A" in the diff-filter string does not match
   anything itself, but causes the entire diff that contains
   selected patches to be output (this behaviour is similar to
   that of --pickaxe-all for the -S option).

For example,

    $ git-rev-list HEAD |
      git-diff-tree --stdin -s -v -B -C --diff-filter=BCR

shows a list of commits that have complete rewrite, copy, or
rename.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-12 20:40:20 -07:00
Junio C Hamano a7ca65405c [PATCH] diff-tree: --find-copies-harder
Normally, diff-tree does not feed unchanged filepair to diffcore
for performance reasons, so copies are detected only when the
source file of the copy happens to be modified in the same
changeset.  This adds --find-copies-harder flag to tell
diff-tree to sacrifice the performance in order to find copies
the same way as other commands in diff-* family.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-12 20:40:20 -07:00
Junio C Hamano d327b89a22 [PATCH] Tutorial update to adjust for -B fix
Now -B does not say silly "complete rewrite" anymore for small
files such as the one in the tutorial example.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-12 20:40:19 -07:00
Junio C Hamano 2210100ac0 [PATCH] Fix rename/copy when dealing with temporarily broken pairs.
When rename/copy uses a file that was broken by diffcore-break
as the source, and the broken filepair gets merged back later,
the output was mislabeled as a rename.  In this case, the source
file ends up staying in the output, so we should label it as a
copy instead.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-12 20:40:19 -07:00
Linus Torvalds a7fa68c5f9 git-whatchanged: make default output format be pretty.
If you want the raw stuff, just do

	git-whatchanged --pretty=raw

and it wil act like it used to.
2005-06-12 20:35:04 -07:00
Linus Torvalds ba88e54b1a git-diff-tree: fix output with just "--pretty".
It set verbose, but didn't set the output prefix to "diff-tree".
2005-06-12 20:34:09 -07:00
Junio C Hamano a8db165ee9 [PATCH] Support commit_format in diff-tree
This steals --pretty command line option from rev-list and
teaches diff-tree to do the same.  With this change,

    $ git-whatchanged --pretty

would work as expected.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-12 20:29:31 -07:00
Junio C Hamano dc7090efbc [PATCH] Re-Fix SIGSEGV on unmerged files in git-diff-files -p
When an unmerged path was fed via diff_unmerged() into diffcore,
it eventually called run_diff() with "one" and "two" parameters
with NULL, but run_diff() was not written carefully enough to
notice this situation.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-12 20:29:31 -07:00
Linus Torvalds 206de27efa git-apply: ignore empty git headers
A meaningful (ie non-empty) git patch always has more information in the
header than just the "diff --git" line itself: it needs to have either a
patch associated with it (which implies "---" and "+++" lines in the
header) or it needs to have rename/copy/delete/create information in it.

Just ignore git patches which have no change information. Otherwise we'll
end up with a patch that doesn't have filenames etc filled in, and we'll
be unhappy.
2005-06-12 09:37:49 -07:00
Junio C Hamano 025a0709b6 [PATCH] Bugfix: read-cache.c:write_cache() misrecords number of entries.
When we choose to omit deleted entries, we should subtract
numbers of such entries from the total number in the header.

Signed-off-by: Junio C Hamano <junkio@cox.net>

Oops.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-10 07:42:45 -07:00
Linus Torvalds aa16021efc git-read-tree: remove deleted files in the working directory
Only when "-u" is used of course.
2005-06-09 15:34:04 -07:00
Junio C Hamano 22f77b772d [PATCH] Add git-diff-stages command.
The diff-* brothers acquired a sibling, git-diff-stages.  With
an unmerged index file, you specify two stage numbers and it
shows the differences between them.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-09 15:30:21 -07:00
Linus Torvalds 438195cced git-read-tree: add "--reset" flag
This is the same as "-m", but it will silently ignore any unmerged
entries, which makes it useful for efficiently forcing a new position
regardless of the state of the current index file.

IOW, to reset to a previous HEAD (in case you have had a failed
merge, for example), you'd just do

	git-read-tree -u --reset HEAD

which will also update your working tree to the right state.

NOTE! The "update" will not remove files that may have been added by the
merge.  Yet.
2005-06-09 12:51:01 -07:00
Linus Torvalds 98a96b00b8 One more time.. Clean up git-merge-one-file-script
This uses git-checkout-file to make sure that the full pathname is
created, instead of the script having to verify it by hand.  Also,
simplify the 3-way merge case by just writing to the right file and
setting the initial index contents early.
2005-06-08 17:56:09 -07:00