Commit Graph

169 Commits

Author SHA1 Message Date
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
95bedc9eec git-apply --stat: limit lines to 79 characters
It had already tried to do that, but with the independent
rounding of the number of '+' and '-' characters, it would
sometimes do 80-char lines after all.
2005-05-31 20:50:49 -07:00
Linus Torvalds
381ca9a3bc git-apply: don't try to be clever about filenames and the index
It just causes things like "git-apply --stat" to parse traditional
patch headers differently depending on what your index is, which
is nasty.
2005-05-31 15:05:59 -07:00
Junio C Hamano
70aadac081 [PATCH] Show dissimilarity index for D and N case.
The way broken deletes and creates are shown in the -p
(diff-patch) output format has become consistent with how
rename/copy edits are shown.  They will show "dissimilarity
index" value, immediately following the "deleted file mode" and
"new file mode" lines.

The git-apply is taught to grok such an extended header.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-05-30 18:10:46 -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
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
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
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
881b07654c git-apply: unknown modes are zero, not -1 2005-05-23 16:32:19 -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
Linus Torvalds
46979f567b git-apply: improve error detection and messages
In particular, give line numbers when detecting corrupt patches.
This makes the tool a lot more friendly (indeed, much more so
than regular "patch", I think).
2005-05-23 14:38:49 -07:00
Linus Torvalds
5e224a2ed0 git-apply: bad patch fragments are fatal
Don't just stop at them and look for the next header. Die,
die, die!
2005-05-23 12:31:59 -07:00
Linus Torvalds
c1bb935020 Start implementing "git-apply"
This applies git patches (and old-style unified diffs)
in the index, rather than doing it in the working directory.

That allows for a lot more flexibility, and means that if a
patch fails, we aren't going to mess up the working directory.

NOTE! This is just the first cut at it, and right now it only
parses the incoming patch, it doesn't actually apply it yet.
2005-05-23 10:52:17 -07:00