Commit Graph

15295 Commits

Author SHA1 Message Date
Rene Scharfe
c504aae2a6 [PATCH] fix and testcase for git-commit-tree option
Actually use GIT_COMMITTER_DATE in git-commit-tree.

(It used to mistakenly re-use the author date)

Add test-case for it.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-26 16:21:13 -07:00
Junio C Hamano
2eab945e86 [PATCH] Make ls-* output consistent with diff-* output format.
Use SP as the column separator except the ones before path which
uses TAB, to make the output format consistent across ls-* and
diff-* commands.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-26 15:18:55 -07:00
Jason McMullan
6d3a5077dd [PATCH] ls-tree matching multiple paths
Enhance git-ls-tree to allow optional 'match paths' that
restricts the output of git-ls-tree.  This is useful to retrieve
a single file's SHA1 out of a tree without creating an index.

[JC: I added the test case]

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-26 15:18:55 -07:00
Junio C Hamano
4ba406a75c [PATCH] Add git-external-diff-script
This is a demonstration of GIT_EXTERNAL_DIFF mechanism, and a
testbed for tweaking and enhancing what the built-in diff should
do.  This script is designed to output exactly the same output
as what the built-in diff driver produces when used as the
GIT_EXTERNAL_DIFF command.

I've run this and updated built-in diff on the entire history of
linux-2.6 git repository, and JG's udev.git repository which has
interesting symlink cases to make sure it is equivalent to the
built-in diff driver.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-26 15:18:55 -07:00
Junio C Hamano
4130b99571 [PATCH] Diff updates to express type changes
With the introduction of type 'T' in the diff-raw output, and
the "apply-patch" program Linus has been quietly working on
without much advertisement, it started to make sense to emit
usable information in the "diff --git" patch output format as
well.  Earlier built-in diff driver punted and did not say
anything about a symbolic link changing into a file or vice
versa, but this version represents it as a pair of deletion
and creation.

It also fixes a minor problem dealing with old archive created
with ancient git.  The earlier code was reporting file mode
change between 100664 and 100644 (we shouldn't).  The linux-2.6
git tree has a good example that exposes this problem.  A good
test case is commit ce1dc02f76432a46db149241e015a4f782974623.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-26 15:18:55 -07:00
Linus Torvalds
a577284aee git-apply: add "--check" option to check that the diff makes sense
It currently only verifies the index against the working directory,
it doesn't actually verify the diff fragments themselves yet.
2005-05-26 15:10:02 -07:00
Linus Torvalds
0e87e048e1 git-apply: when validating default names, check the final EOLN too
This means that filenames are totally unambiguous even if they
have spaces or tabs in them.
2005-05-26 13:28:42 -07:00
Linus Torvalds
5041aa7040 git-apply: pick up default filenames from "diff --git" header line
Pure mode changes, and deletes or creates of empty files won't have this
information anywhere else.
2005-05-26 13:11:24 -07:00
Linus Torvalds
fab2c257be git-apply: make the diffstat output happen for "--stat" only.
Slowly this is takign the form of a program that we'd actually
use. Now "git-apply --stat" basically ends up being a perfectly
useful diffstat.
2005-05-26 12:25:52 -07:00
Linus Torvalds
3f40315aaa git-apply: implement "diffstat" output
Hey, it's almost free by now, and it's a good way to see that
we parse the patches correctly.
2005-05-26 11:40:43 -07:00
Linus Torvalds
19c58fb84d git-apply: parse the whole list of patches into memory first
Make it a clear two-phase thing: first a read-only parse of
the patch itself (which is independent of any current index
information), and then the second phase actually uses the patch.

The second phase might not be a real apply, it could be just a
diffstat, for example. Which is trivial to do once the patch is
parsed.
2005-05-26 10:23:51 -07:00
Mark Allen
368da62598 [PATCH] Test case portability fix.
This is the remainder of testcase fix by Mark Allen to make them
work on his Darwin box.  I was using "xargs -r" (GNU) where it
was not needed, sed -ne '/^\(author\|committer\)/s|>.*|>|p'
where some sed does not know what to do with '\|', and also
"cmp - file" to compare standard input with a file, which his
cmp does not support.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-25 19:37:10 -07:00
Linus Torvalds
bd1e17e245 Make "parse_object()" also fill in commit message buffer data.
And teach fsck to free it to save memory.
2005-05-25 19:26:28 -07:00
Linus Torvalds
a6f68d4767 git-rev-list: add "end" commit and "--header" flag
The "end" commit is just faking it right now, it's sorting things
purely by date, so this is _not_ a reachability analysis. Some day.

The "--header" flag causes the commit message to be printed out,
with a NUL character separator after it for parseability. This
allows you to do things like use "grep -z" to grep for certain
authors etc.
2005-05-25 18:29:09 -07:00
Linus Torvalds
3ff1fbbb94 commit: save the commit buffer off when parsing a commit
object.

A fair number of the users potentially want to look at the
commit objects more closely, and if you worry about memory
leaking in certain applications, you can always do a

	free(commit->buffer);
	commit->buffer = NULL;

by hand after parsing them.
2005-05-25 18:27:14 -07:00
Linus Torvalds
e871b649a3 unpack_sha1_file: zero-pad the unpacked object.
This makes them easier to parse without having to worry about
running off the end, and allows us to treat commits as normal
strings.
2005-05-25 18:25:08 -07:00
Junio C Hamano
9fdade0673 [PATCH] Mode only changes from diff.
This fixes another bug.

 - Mode-only changes were pruned incorrectly from the output.
 - Added test to catch the above problem.
 - Normalize rename/copy similarity score in the diff-raw output
   to per-cent, no matter what scale we internally use.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-25 16:06:24 -07:00
Junio C Hamano
96716a1976 [PATCH] Fix type-change handling when assigning the status code to filepairs.
The interim single-liner '?' fix resulted delete entries that
should not have emitted coming out in the output as an
unintended side effect; I caught this with the "rename" test in
the test suite.  This patch instead fixes the code that assigns
the status code to each filepair.

I verified this does not break the testcase in udev.git tree Kay
Sievers gave us, by running git-diff-tree on that tree which
showed 21 file to symlink changes.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-25 15:21:57 -07:00
Junio C Hamano
908bddab96 [PATCH] Adjust show-files test for dotfiles.
The earlier test was relying on the fact that dotfiles do not
appear in the output to prepare expected test results, which
inevitably got broken when we started handling dotfiles.  Change
the test to be honest about what "--other" file it creates.

The problem was originally pointed out by Mark Allen.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-25 15:21:57 -07:00
Linus Torvalds
c5434dead6 git-pull-script: pretty-print the merge head information
This also drops the common ".git" part from the end of the repo
name, and if a non-default head reference is given, makes a nicer
commit message about it.
2005-05-25 14:05:13 -07:00
Jeff Garzik
ea88ee46de [PATCH] optimize git-resolve-script
This change was suggested for my git-switch-tree script, and the same
issues apply to core git's git-resolve-script as well.
2005-05-25 11:59:37 -07:00
Linus Torvalds
6f93a631ac diff.c: don't silently ignore unknown state changes in diffs.
Give them an "unknown" status, ie '?'.
2005-05-25 11:09:12 -07:00
Junio C Hamano
4cae1a967a [PATCH] show changed tree objects with recursive git-diff-tree
This adds a "-t" flag to tell the raw diff output to include the tree
objects in the output when doing a recursive diff.

Since that's how the non-recursive output already handles trees and the
flag thus doesn't make sense without "-r", I made "-t" imply "-r".

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-25 09:32:54 -07:00
Junio C Hamano
f4d89f26ce [PATCH] Use pathspec array correctly
Oh, I am an idiot.  Repeating the same check against the first
element of pathspec array as many times as the pathspec array
has elements in it would not do us any good.

This patch allows you to specify more than one pathspec to
diff-tree family and have them actually used.

Signed-off-by: Junio C Hamano <junkio@cox.net>
;)
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-25 09:12:12 -07:00
Linus Torvalds
ea84480f01 git-rev-tree: teach it about tag references
And various cleanups that makes it able to not care.
2005-05-24 21:34:12 -07:00
Junio C Hamano
c4ee2952b3 [PATCH] Allow dot files in ls-files as well (take #2).
This attempts to match "the directory '.git' anywhere in the
tree is ignored" approach taken in update-cache.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-24 20:09:46 -07:00
Linus Torvalds
6c56c5340a git-diff-cache: fix argument parsing
And make the code more readable while at it.
2005-05-24 18:10:11 -07:00
Junio C Hamano
8597697458 [PATCH] Update rename/copy similarity estimator.
The second round similarity estimator simply used the size of
the xdelta itself to estimate the extent of damage.  This patch
keeps that logic to detect big insertions to terminate the check
early, but otherwise looks at the generated delta in order to
estimate the extent of edit more accurately.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-24 17:47:05 -07:00
Junio C Hamano
bba0f401ee [PATCH] Squelch compiler warning
Not important but I am a bit annoyed by gcc complaining about the
control falling out of the function without returning value.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-24 17:47:05 -07:00
Junio C Hamano
d7f6ea3d7d [PATCH] Allow symlinks in the leading path in checkout-cache --prefix=
This is what Linus wrote, improving what David Greaves
originally submitted.

I just added a test case and verified the patch works.

Author: David Greaves <david@dgreaves.com>
Author: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-24 17:47:05 -07:00
Junio C Hamano
d0309355c9 [PATCH] Use DIFF_FORMAT_NO_OUTPUT to implement diff-tree -s option.
Instead of checking silent flag all over the place, simply use
the NO_OUTPUT option diffcore provides to suppress the diff
output.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-24 17:47:05 -07:00
Linus Torvalds
320d3a1b1a git-update-cache: allow dot-files
We still refuse to add ".", ".." and ".git".

In theory, you could track another git-repository by allowing ".git",
but the potential for confusion is just too high.
2005-05-24 14:40:28 -07:00
Linus Torvalds
d2b6f7c2fd cvs2git: fix character quoting
We need to quote backslash and backtick too.

And inform the user about our progress, since converting a
big archive can take time. Doing the full mutt history took
just under eight minutes.
2005-05-24 12:57:12 -07:00
Linus Torvalds
c4bd907d95 git-commit-tree: allow overriding of commit date
Using GIT_COMMITTER_DATE, of course..
2005-05-24 10:21:13 -07:00
Linus Torvalds
1db0819a9c cvs2git: set timezone info to UTC, the way CVS does
This should also mean that the conversion is now completely
defined by the CVS tree, and that two people doing a cvs2git
conversion on the same base will always get the same results
regardless of when or in what timezone they do it.
2005-05-24 10:15:42 -07:00
Linus Torvalds
b535a802b2 cvs2git: add support for GIT_COMMITTER_DATE
Of course, this requires a version of git that cares..
2005-05-24 09:59:55 -07:00
Linus Torvalds
e16c03b549 cvs2git: escape <<EOF messages, and work around cvsps branch handling
This escapes '$' characters in <<-handling, and gives preference to
the new branch when cvsps incorrectly reports a commit as originating
on an old branch.
2005-05-24 09:36:33 -07:00
Linus Torvalds
e69a19f784 Fix cvs2git branch handling
.. and tell 'co' to shut up about the rcs noise.

This still leaves some branch issues up in the air: it looks like
cvsps has some questionable originating branch information, but I
don't know whether that's a cvsps bug or an actual bug in the
syslinux archive I'm using to test.

I'll let David Mansfield answer my questions about CVS. I'm a
total idiot when it comes to branches under CVS ("I'm pure!").
2005-05-24 09:06:51 -07:00
Junio C Hamano
25d5ea410f [PATCH] Redo rename/copy detection logic.
Earlier implementation had a major screw-up in the memory
management area.  Rename/copy logic sometimes borrowed a pointer
to a structure without any provision for downstream to determine
which pointer is shared and which is not.  This resulted in the
later clean-up code to sometimes double free such structure,
resulting in a segfault.  This made -M and -C useless.

Another problem the earlier implementation had was that it
reordered the patches, and forced the logic to differentiate
renames and copies to depend on that particular order.  This
problem was fixed by teaching rename/copy detection logic not to
do any reordering, and rename-copy differentiator not to depend
on the order of the patches.  The diffs will leave rename/copy
detector in the same destination path order as the patch that
was fed into it.  Some test vectors have been reordered to
accommodate this change.

It also adds a sanity check logic to the human-readable diff-raw
output to detect paths with embedded TAB and LF characters,
which cannot be expressed with that format.  This idea came up
during a discussion with Chris Wedgwood.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-24 01:26:26 -07:00
Linus Torvalds
3e91311ae7 Add "cvs2git" program to convert a CVS archive into a GIT archive
It's very hacky, and it needs lots of work, but it seems to have converted
Peter's "syslinux" archive successfully. Whether the end result is correct
or not is to be seen.

Tons of work still to do: do name conversion properly, and do tags etc.

And testing. Lots of testing.
2005-05-24 01:07:31 -07:00
Linus Torvalds
1e3f6b6e64 git-apply: more consistency checks on gitdiff filenames
There's some duplication of filenames when doing filename operations
(creates, deletes, renames and copies), and this makes us verify that
the pathnames match when they should.
2005-05-23 19:54:55 -07:00
Nicolas Pitre
587e49405b [PATCH] adjust git-deltafy-script to the new diff-tree output format
Also prevent 'sort' from sorting on the sha1 which was screwing the
history listing.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-23 19:17:06 -07:00
Junio C Hamano
b1c006dd65 [PATCH] Update git-diff-cache documentation.
The recent diff updates gave diff-cache the same ability to
filter paths, which was not properly documented.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-23 19:17:06 -07:00
Junio C Hamano
bceafe752c [PATCH] Fix diff-pruning logic which was running prune too early.
For later stages to reorder patches, pruning logic and rename detection
logic should not decide which delete to discard (because another entry
said it will take over the file as a rename) until the very end.

Also fix some tests that were assuming the earlier "last one is rename
or keep everything else is copy" semantics of diff-raw format, which no
longer is true.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-23 19:17:06 -07:00
Linus Torvalds
9a4a100eb4 git-apply: start using the index file information.
Right now we only use it to figure out what the filename might
be when that is ambiguous, but we'll get there..
2005-05-23 19:13:55 -07:00
Linus Torvalds
4dfdbe10dc git-apply: if no input files specified, apply stdin
This makes it act more like a traditional UNIX thing (eg "cat").
2005-05-23 16:42:21 -07:00
Linus Torvalds
9ab55bd29a diff-tree: don't write headers if the diff queue is empty
This is not a pickaxe-specific thing, we do this regardless of
what has pruned down the diff queue.
2005-05-23 16:37:47 -07:00
Linus Torvalds
881b07654c git-apply: unknown modes are zero, not -1 2005-05-23 16:32:19 -07:00
Junio C Hamano
b6d8f309d9 [PATCH] diff-raw format update take #2.
This changes the diff-raw format again, following the mailing
list discussion.  The new format explicitly expresses which one
is a rename and which one is a copy.

The documentation and tests are updated to match this change.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-23 16:23:10 -07:00
Linus Torvalds
a4acb0eb14 git-apply: parse the diff headers (both traditional and new)
.. and print out the information. This sets up all the pathname
information, and whether it's a new file, deleted file, rename,
copy or whatever.

It's slowly getting to the point where it all comes together,
and we can actually apply all the information that we've gathered.
2005-05-23 16:09:09 -07:00