Commit graph

262 commits

Author SHA1 Message Date
Junio C Hamano 9af0b8dbe2 t0000-basic: more commit-tree tests.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-26 18:25:15 -07:00
Junio C Hamano fdeb6bf55b t0000-basic: Add ls-tree recursive test back.
When we updated ls-tree recursive output to omit the tree nodes,
246cc52f38 adjusted the old test
so that we do not expect to see trees in its output.  Later,
with 0f8f45cb4a, we added back the
ability to show both with -t option, but we forgot to update the
test as well.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-26 02:27:59 -07:00
Junio C Hamano e09ad6e1e3 Libify diff-index.
The second installment to libify diff brothers.  The pathname
arguments are checked more strictly than before because we now
use the revision.c::setup_revisions() infrastructure.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-22 02:43:00 -07:00
Junio C Hamano 6973dcaee7 Libify diff-files.
This is the first installment to libify diff brothers.

The updated diff-files uses revision.c::setup_revisions()
infrastructure to parse its command line arguments, which means
the pathname arguments are checked more strictly than before.
The tests are adjusted to separate possibly missing paths from
the rest of arguments with double-dashes, to show the kosher
way.

As Linus pointed out, renaming diff.c to diff-lib.c was simply
stupid, so I am renaming it back.  The new diff-lib.c is to
contain pieces extracted from diff brothers.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-22 02:37:45 -07:00
Junio C Hamano 0080f50eb3 Merge branch 'fix'
* fix:
  git-commit --amend: two fixes.
2006-04-20 02:52:04 -07:00
Junio C Hamano 6a74642c50 git-commit --amend: two fixes.
When running "git commit --amend" only to fix the commit log
message without any content change, we mistakenly showed the
git-status output that says "nothing to commit" without
commenting it out.

If you have already run update-index but you want to amend the
top commit, "git commit --amend --only" without any paths should
have worked, because --only means "starting from the base
commit, update-index these paths only to prepare the index to
commit, and perform the commit".  However, we refused -o without
paths.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-20 02:51:12 -07:00
Junio C Hamano 34e98ea564 Merge branch 'lt/logopt'
* lt/logopt:
  Fix "git log --stat": make sure to set recursive with --stat.
  combine-diff: show diffstat with the first parent.
  git.c: LOGSIZE is unused after log printing cleanup.
  Log message printout cleanups (#3): fix --pretty=oneline
  Log message printout cleanups (#2)
  Log message printout cleanups
  rev-list --header: output format fix
  Fixes for option parsing
  log/whatchanged/show - log formatting cleanup.
  Simplify common default options setup for built-in log family.
  Tentative built-in "git show"
  Built-in git-whatchanged.
  rev-list option parser fix.
  Split init_revisions() out of setup_revisions()
  Fix up rev-list option parsing.
  Fix up default abbrev in setup_revisions() argument parser.
  Common option parsing for "git log --diff" and friends
2006-04-18 13:56:36 -07:00
Linus Torvalds 9153983310 Log message printout cleanups
On Sun, 16 Apr 2006, Junio C Hamano wrote:
>
> In the mid-term, I am hoping we can drop the generate_header()
> callchain _and_ the custom code that formats commit log in-core,
> found in cmd_log_wc().

Ok, this was nastier than expected, just because the dependencies between
the different log-printing stuff were absolutely _everywhere_, but here's
a patch that does exactly that.

The patch is not very easy to read, and the "--patch-with-stat" thing is
still broken (it does not call the "show_log()" thing properly for
merges). That's not a new bug. In the new world order it _should_ do
something like

	if (rev->logopt)
		show_log(rev, rev->logopt, "---\n");

but it doesn't. I haven't looked at the --with-stat logic, so I left it
alone.

That said, this patch removes more lines than it adds, and in particular,
the "cmd_log_wc()" loop is now a very clean:

	while ((commit = get_revision(rev)) != NULL) {
		log_tree_commit(rev, commit);
		free(commit->buffer);
		commit->buffer = NULL;
	}

so it doesn't get much prettier than this. All the complexity is entirely
hidden in log-tree.c, and any code that needs to flush the log literally
just needs to do the "if (rev->logopt) show_log(...)" incantation.

I had to make the combined_diff() logic take a "struct rev_info" instead
of just a "struct diff_options", but that part is pretty clean.

This does change "git whatchanged" from using "diff-tree" as the commit
descriptor to "commit", and I changed one of the tests to reflect that new
reality. Otherwise everything still passes, and my other tests look fine
too.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-17 15:18:25 -07:00
A Large Angry SCM e6bfaf3e33 Makefile fixups.
Signed-off-by: A Large Angry SCM <gitzilla@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-16 20:42:37 -07:00
Junio C Hamano 7f732c632f t5500: test fix
Relying on eye-candy progress bar was fragile to begin with.
Run fetch-pack with -k option, and count the objects that are in
the pack that were transferred from the other end.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-13 22:28:06 -07:00
Junio C Hamano 2283645b85 t3600-rm: skip failed-remove test when we cannot make an unremovable file.
When running t3600-rm test under fakeroot (or as root), we
cannot make a file unremovable with "chmod a-w .".  Detect this
case early and skip that test.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-13 11:57:57 -07:00
Junio C Hamano 5ca64e488f Retire t5501-old-fetch-and-upload test.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-11 16:35:39 -07:00
Mark Wooding acb7257729 xdiff: Show function names in hunk headers.
The speed of the built-in diff generator is nice; but the function names
shown by `diff -p' are /really/ nice.  And I hate having to choose.  So,
we hack xdiff to find the function names and print them.

xdiff has grown a flag to say whether to dig up the function names.  The
builtin_diff function passes this flag unconditionally.  I suppose it
could parse GIT_DIFF_OPTS, but it doesn't at the moment.  I've also
reintroduced the `function name' into the test suite, from which it was
removed in commit 3ce8f089.

The function names are parsed by a particularly stupid algorithm at the
moment: it just tries to find a line in the `old' file, from before the
start of the hunk, whose first character looks plausible.  Still, it's
most definitely a start.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-27 18:43:51 -08:00
Junio C Hamano 9acf322d69 Merge branch 'lt/diffgen' into next
* lt/diffgen:
  built-in diff: minimum tweaks
  builtin-diff: \No newline at end of file.
  Use a *real* built-in diff generator
2006-03-25 17:44:01 -08:00
Junio C Hamano 3ce8f08944 built-in diff: minimum tweaks
This fixes up a couple of minor issues with the real built-in
diff to be more usable:

 - Omit ---/+++ header unless we emit diff output;

 - Detect and punt binary diff like GNU does;

 - Honor GIT_DIFF_OPTS minimally (only -u<number> and
   --unified=<number> are currently supported);

 - Omit line count of 1 from "@@ -l,k +m,n @@" hunk header
   (i.e. when k == 1 or n == 1)

 - Adjust testsuite for the lack of -p support.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-25 16:50:00 -08:00
Rene Scharfe 4c691724f1 tar-tree: Use the prefix field of a tar header
... to store parts of the path, if possible.  This allows us to avoid
writing extended headers in certain cases (long pathes can only be
split at '/' chars).

Also adds a file to the test repo with a 100 chars long directory name.
Even old versions of tar that don't understand POSIX extended headers
should be able to handle this testcase.

Btw.: The longest path in the kernel tree currently has 70 chars.
Together with a 30 chars long prefix this would already cross the
field limit of 100 chars.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-25 16:40:34 -08:00
Mark Wooding 8c3222079a annotate-tests: override VISUAL when running tests.
The tests hang for me waiting for Emacs with its output directed
somewhere strage, because I hedged my bets and set both EDITOR and
VISUAL to run Emacs.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-12 11:50:23 -08:00
Junio C Hamano eb0e0024b7 Fix t1200 test for breakage caused by removal of full-stop at the end of fast-forward message.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-09 22:51:21 -08:00
Jonas Fonseca f067a13745 repo-config: give value_ a sane default so regexec won't segfault
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-07 17:06:10 -08:00
Junio C Hamano 2dcdb4c697 Merge branch 'sp/checkout'
* sp/checkout:
  Add --temp and --stage=all options to checkout-index.
2006-03-06 20:58:17 -08:00
Junio C Hamano 1242642c46 annotate-blame: tests incomplete lines.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-06 00:41:17 -08:00
Junio C Hamano ce5b6e7111 annotate-blame test: add evil merge.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-05 22:37:15 -08:00
Junio C Hamano 8ad02bc964 annotate-blame test: don't "source", but say "."
Just I am old fashioned.  Source inclusion in bourne shell is
"." (dot), not "source" -- that's csh.

[jc: yes I know bash groks it, but I am old fashioned.]

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-05 22:10:26 -08:00
Junio C Hamano 92a903acfd annotate/blame tests updates.
This rewrites the result check code a bit.  The earlier one
using awk was splitting columns at any whitespace, which
confused lines attributed incorrectly to the merge made by the
default author "A U Thor <author@example.com>" with lines
attributed to author "A".

The latest test by Ryan to add the "starting from older commit"
test is also included, with another older commit test.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-05 22:09:15 -08:00
Fredrik Kuivinen 8752d11d60 git-blame: Use the same tests for git-blame as for git-annotate
Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-05 16:02:44 -08:00
Mark Wooding 0aee3d6d4e gitignore: Ignore some more boring things.
Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-05 11:26:18 -08:00
Shawn Pearce de84f99c12 Add --temp and --stage=all options to checkout-index.
Sometimes it is convient for a Porcelain to be able to checkout all
unmerged files in all stages so that an external merge tool can be
executed by the Porcelain or the end-user.  Using git-unpack-file
on each stage individually incurs a rather high penalty due to the
need to fork for each file version obtained.  git-checkout-index -a
--stage=all will now do the same thing, but faster.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-05 00:58:13 -08:00
Junio C Hamano 21dbe12c76 Merge branch 'lt/rev-list'
* lt/rev-list:
  setup_revisions(): handle -n<n> and -<n> internally.
  git-log (internal): more options.
  git-log (internal): add approxidate.
  Rip out merge-order and make "git log <paths>..." work again.
  Tie it all together: "git log"
  Introduce trivial new pager.c helper infrastructure
  git-rev-list libification: rev-list walking
  Splitting rev-list into revisions lib, end of beginning.
  rev-list split: minimum fixup.
  First cut at libifying revlist generation
2006-03-04 13:21:17 -08:00
Alex Riesen d51fac5310 workaround fat/ntfs deficiencies for t3600-rm.sh (git-rm)
Signed-off-by: Alex Riesen <ariesen@harmanbecker.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-03 11:28:33 -08:00
Josef Weidendorfer 90924d55c5 git-mv: fix moves into a subdir from outside
git-mv needs to be run from the base directory so that
the check if a file is under revision also covers files
outside of a subdirectory. Previously, e.g. in the git repo,

  cd Documentation; git-mv ../README .

produced the error

  Error: '../README' not under version control

The test is extended for this case; it previously only tested
one direction.

Signed-off-by: Josef Weidendorfer <Josef.Weidendorfer@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-03 11:28:28 -08:00
Johannes Schindelin d5dddccaa0 Fix test case for some sed
Some versions of sed lack the "-i" option.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-02 23:06:47 -08:00
Ryan Anderson 7c3ecb65ee annotate: Add a basic set of test cases.
Signed-off-by: Ryan Anderson <ryan@michonline.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-01 21:32:20 -08:00
Linus Torvalds 765ac8ec46 Rip out merge-order and make "git log <paths>..." work again.
Well, assuming breaking --merge-order is fine, here's a patch (on top of
the other ones) that makes

	git log <filename>

actually work, as far as I can tell.

I didn't add the logic for --before/--after flags, but that should be
pretty trivial, and is independent of this anyway.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-01 01:45:50 -08:00
Carl Worth 3844cdc8f1 git-rm: Fix to properly handle files with spaces, tabs, newlines, etc.
New tests are added to the git-rm test case to cover this as well.

Signed-off-by: Carl Worth <cworth@cworth.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-22 17:10:42 -08:00
Carl Worth d4a1cab541 Add new git-rm command with documentation
This adds a git-rm command which provides convenience similar to
git-add, (and a bit more since it takes care of the rm as well if
given -f).

Like git-add, git-rm expands the given path names through
git-ls-files. This means it only acts on files listed in the
index. And it does act recursively on directories by default, (no -r
needed as in the case of rm itself). When it recurses, it does not
remove empty directories that are left behind.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-22 17:10:42 -08:00
Junio C Hamano 752b0fe287 Merge branch 'fix'
* fix:
  git-push: Update documentation to describe the no-refspec behavior.
  format-patch: pretty-print timestamp correctly.
  git-add: Add support for --, documentation, and test.
2006-02-22 00:35:07 -08:00
Junio C Hamano 712b1dd389 Merge branch 'js/portable'
* js/portable:
  Fix "gmake -j"
  Really honour NO_PYTHON
  avoid makefile override warning
  Fixes for ancient versions of GNU make
2006-02-21 22:28:40 -08:00
Carl Worth c8af25ca01 git-ls-files: Fix, document, and add test for --error-unmatch option.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-21 18:37:36 -08:00
Carl Worth 5508a61663 New test to verify that when git-clone fails it cleans up the new directory.
Signed-off-by: Carl Worth <cworth@cworth.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-21 18:18:25 -08:00
Carl Worth 60ace8790f git-add: Add support for --, documentation, and test.
This adds support to git-add to allow the common -- to separate
command-line options and file names. It adds documentation and a new
git-add test case as well.

[jc: this should apply to 1.2.X maintenance series, so I reworked
 git-ls-files --error-unmatch test. ]

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-21 17:33:43 -08:00
Junio C Hamano 6643688867 Merge part of jc/portable branch 2006-02-21 00:52:18 -08:00
Johannes Schindelin 39c015c556 Fixes for ancient versions of GNU make
Some versions of GNU make do not understand $(call), and have problems to
interpret rules like this:

some_target: CFLAGS += -Dsome=defs

[jc: simplified substitution a bit. ]

Signed-off-by: Johannes E. Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-18 23:17:01 -08:00
Johannes Schindelin abb7c7b31c Optionally work without python
In some setups (notably server setups) you do not need that dependency.
Gracefully handle the absence of python when NO_PYTHON is defined.

Signed-off-by: Johannes E. Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-18 23:16:09 -08:00
Shawn Pearce 772d8a3b63 Make git-reset delete empty directories
When git-reset --hard is used and a subdirectory becomes
empty (as it contains no tracked files in the target tree)
the empty subdirectory should be removed.  This matches
the behavior of git-checkout-index and git-read-tree -m
which would not have created the subdirectory or would
have deleted it when updating the working directory.

Subdirectories which are not empty will be left behind.
This may happen if the subdirectory still contains object
files from the user's build process (for example).

[jc: simplified the logic a bit, while keeping the test script.]
2006-02-17 23:52:57 -08:00
Carl Worth eedf8f97e5 Abstract test_create_repo out for use in tests.
Signed-off-by: Carl Worth <cworth@cworth.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-17 16:16:53 -08:00
Alex Riesen 0dbc4e89bb avoid echo -e, there are systems where it does not work
FreeBSD 4.11 being one example: the built-in echo doesn't have -e,
and the installed /bin/echo does not do "-e" as well.
"printf" works, laking just "\e" and "\xAB'.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-12 11:36:19 -08:00
Alex Riesen ef1af9d9af fix "test: 2: unexpected operator" on bsd
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-12 11:36:17 -08:00
Junio C Hamano 16139f9035 t5500: adjust to change in pack-object reporting behaviour.
Now pack-object is not as chatty when its stderr is not connected
to a terminal, so the test needs to be adjusted for that.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-11 23:08:23 -08:00
Junio C Hamano 29e55cd5ad Define GIT_(AUTHOR|COMMITTER)_(NAME|EMAIL) to known values.
Without these, running tests with an account with empty gecos
field would fail.

We might want to loosen error from "git-var -l" (but not
"git-var GIT_AUTHOR_NAME") later, but that is more or less an
independent issue.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-10 19:11:23 -08:00
Junio C Hamano 47e013f920 t6000: fix a careless test library add-on.
It tried to "restore" GIT_AUTHOR_EMAIL environment variable but
the variable started out as unset, so ended up setting it to an
empty string.  This is now caught as an error.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-08 21:55:34 -08:00