Commit graph

27 commits

Author SHA1 Message Date
Junio C Hamano 8c1becff24 [PATCH] show-diff: Remove stale comments
Patch 1/6 in the series has already cleaned the interface to
call sq_expand(), but the comment before that function still
carries the stale interface warning.  Remove it.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-18 16:51:09 -07:00
Junio C Hamano 4789576e0e [PATCH] show-diff.c: -R option for reverse diff.
This adds -R option to obtain reverse diff.

It may be useful in the merge workflow.  After the base of the working
directory is merged and commited, in the working directory:

    $ read-tree <tree-id-of-merged-tree>
    $ show-diff -R

to re-validate if upstream changes make sense, and/or revert or
conflict with local changes you have in the working files.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-18 15:07:24 -07:00
Junio C Hamano ff69ab9ad8 [PATCH] show-diff.c: make diff options customizable.
This makes the diff output formatting options customizable via the
environment variables.  The default is still the Linux kernel style. 

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-18 15:07:24 -07:00
Junio C Hamano 5a6ad74623 [PATCH] show-diff.c: adjust default format for the Linux kernel.
This patch adjusts the default output format of show-diff to match
the Linux kernel style, recommended in Documentation/SubmittingPatches.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-18 15:07:24 -07:00
Junio C Hamano 8f3671dcd9 [PATCH] show-diff.c: simplify show_diff_empty.
This patch removes the custom diff generation code from the
show_diff_empty() function.  Instead, just use show_differences().

This reduces the code size; but more importantly, it is needed for
the later patch to give diff options.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-18 15:07:24 -07:00
Junio C Hamano d0db466326 [PATCH] show-diff.c: check unreadbale blob.
This patch fixes show-diff to detect unreadable blob and warn
instead of going ahead and crashing.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-18 15:07:24 -07:00
Junio C Hamano c157d37674 [PATCH] show-diff.c: clean up private buffer use.
This patch fixes sq_expand() and show_differences() not to use and
hold onto its privately allocated buffer, which was a misguided
attempt to reduce calls to malloc but made later changes harder.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-18 15:07:24 -07:00
Junio C Hamano 64982f7510 [PATCH] (resend) show-diff.c off-by-one fix
The patch to introduce shell safety to show-diff has an
off-by-one error.  Here is an fix.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-17 20:31:40 -07:00
Junio C Hamano 8f41523fc1 [PATCH] show-diff.c: do not include unused header file
This is my bad.  I added #include <ctype.h> to the file,
which I ended up not using and failed to remove it.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-17 09:53:35 -07:00
Junio C Hamano 9fec8b26ef [PATCH] Do not run useless show-diff on unmerged paths repeatedly.
When run on unmerged dircache, show-diff compares the working
file with each non-empty stage for that path.  Two out of three
times, this is not very helpful.  This patch makes it report the
unmergedness only once per each path and avoids running the
actual diff.

Upper layer SCMs like Cogito are expected to find out mode/SHA1
for each stage by using "show-files --stage" and run the diff
itself.  This would result in more sensible diffs.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-16 21:29:45 -07:00
Junio C Hamano d2522a6528 [PATCH] show-diff style fix.
This fixes some stylistic problems introduced by my previous set
of patches.  I'll be sending my last patch to show-diff next,
which depends on this cleanup.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-16 21:29:45 -07:00
Junio C Hamano b70c8942d3 [PATCH] Rename confusing variable in show-diff
The show-diff command uses a variable "new" but it is always
used to point at the original data recorded in the dircache
before the user started editing in the working file.  Rename it
to "old" to avoid confusion.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-16 21:29:45 -07:00
Junio C Hamano 9bd94cafdf [PATCH] show-diff shell safety
The command line for running "diff" command is built without
taking shell metacharacters into account.  A malicious dircache
entry "foo 2>bar" (yes, a filename with space) would result in
creating a file called "bar" with the error message "diff: foo:
No such file or directory" in it.

This is not just a user screwing over himself.  Such a dircache
can be created as a result of a merge with tree from others.

Here is a fix.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-16 21:29:45 -07:00
Junio C Hamano d94c6128e6 [PATCH] show-diff -z option for machine readable output.
This patch adds the -z option to the show-diff command,
primarily for use by scripts.  The information emitted is
similar to that of -q option, but in a more machine readable
form.  Records are terminated with NUL instead of LF, so that
the scripts can deal with pathnames with embedded newlines.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-16 21:29:45 -07:00
Junio C Hamano b8f80925e3 [PATCH] Optionally tell show-diff to show only named files
SCMs have ways to say "I want diff only this particular file",
or "I want diff files under this directory".  This patch teaches
show-diff to do something similar.  Without command line
arguments, it still examines everything in the dircache as
before.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-16 21:29:45 -07:00
Linus Torvalds 13e897e580 Simplify show-diff cache entry name handling.
The cache-entry names are all proper strings, no need to worry about
their length.
2005-04-15 21:42:34 -07:00
Junio C Hamano ca2a079865 [PATCH] Add "-q" option to show-diff.c
This adds the '-q' option for show-diff.c to squelch complaints for
missing files.

It is handy if you want to run it in the merge temporary directory after
running merge-trees with its minimum checkout mode, which is the
default, because you would not find any files other than the ones that
needs human validation after the merge there. 

It also fixes the argument parsing bug Paul Mackerras noticed in
<16991.42305.118284.139777@cargo.ozlabs.ibm.com> but slightly
differently.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-15 15:08:09 -07:00
Linus Torvalds ccc4feb579 Convert the index file reading/writing to use network byte order.
This allows using a git tree over NFS with different byte order, and
makes it possible to just copy a fully populated repository and have
the end result immediately usable (needing just a refresh to update
the stat information).
2005-04-15 10:44:27 -07:00
Ingo Molnar aebb267908 [PATCH] Whitespace Fixes
Trivial whitespace fixes.

From: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Petr Baudis <pasky@ucw.cz>
2005-04-13 02:35:04 -07:00
Petr Baudis c57a3a91f1 [PATCH] Correct show-diff output for deleted files
My convention is that contrary to files trimmed to zero size,
deleted files always go to /dev/null. This patch turns show-diff
to abide this.

Signed-off-by: Petr Baudis <pasky@ucw.cz>
2005-04-13 01:46:35 -07:00
Petr Baudis e2e5e98a40 [PATCH] Silent flag for show-diff
This patch adds a -s flag for show-diff, which will surpress the
actual diffing. This is useful for my scripts when they just want
to see what needs to be updated in the cache.

Signed-off-by: Petr Baudis <pasky@ucw.cz>
2005-04-13 01:40:09 -07:00
Christopher Li c0fb976aa7 [PATCH] show-diff show deleted files as diff as well.
The ideas is that using the show-diff to generate the
patch including deleted and new file (in the next patch).
So we don't have to do the temp new file diff dance on the
script.

The cache index now contain enough information to generate
the whole patch. So the GIT SCM don't need separate command
for check out file to edit or delete. Just do the edit and
remove and GIT will generate the correct patch.

It still require tell GIT to add new files.
2005-04-12 02:04:44 -07:00
Linus Torvalds 5e76011c0d Remove the annoying "ok" printout from show-diff.
It used to be useful before I wrote "show-files", so that
show-diff would also tell what the cached files were. Now
it's just annoying.
2005-04-12 02:01:12 -07:00
Linus Torvalds 734aab758c Make the cache stat information comparator public.
Like the cache filename finder, it's a generically useful function,
rather than something specific to the current "show-diff" thing.
2005-04-09 09:48:20 -07:00
Linus Torvalds 19b2860cba Use "-Wall -O2" for the compiler to get more warnings.
And fix up the warnings that it pointed out. Let's keep the tree
clean from early on.

Not that the code is very beautiful anyway ;)
2005-04-08 09:59:28 -07:00
Linus Torvalds 8bc9a0c769 Add copyright notices.
The tool interface sucks (especially "committing" information, which is just
me doing everything by hand from the command line), but I think this is in
theory actually a viable way of describing the world. So copyright it.
2005-04-07 15:16:10 -07:00
Linus Torvalds e83c516331 Initial revision of "git", the information manager from hell 2005-04-07 15:13:13 -07:00