1
0
mirror of https://github.com/git/git.git synced 2024-10-03 19:51:31 +02:00
Commit Graph

401 Commits

Author SHA1 Message Date
Linus Torvalds
b507b465f7 git-apply: prepare for upcoming GNU diff -u format change.
The latest GNU diff from CVS emits an empty line to express
an empty context line, instead of more traditional "single
white space followed by a newline".  Do not get broken by it.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-19 21:28:06 -07:00
Yasushi SHOJI
ced78b3907 clone: the given repository dir should be relative to $PWD
the repository argument for git-clone should be relative to $PWD
instead of the given target directory.  The old behavior gave us
surprising success and you need a few minute to know why it worked.

GIT_DIR is already exported so no need to cd into $D. And this makes
$PWD for git-fetch-pack, which is the actual command to take the given
repository dir, the same as git-clone.

Signed-off-by: Yasushi SHOJI <yashi@atmark-techno.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-14 18:22:04 -07:00
Junio C Hamano
4035b46e12 t4015: work-around here document problem on Cygwin.
Signed-off-by: Junio C Hamano <junio@twinsun.com>
2006-10-13 14:21:22 -07:00
Johannes Schindelin
2344d47fba diff: fix 2 whitespace issues
When whitespace or whitespace change was ignored, the function
xdl_recmatch() returned memcmp() style differences, which is wrong,
since it should return 0 on non-match.

Also, there were three horrible off-by-one bugs, even leading to wrong
hashes in the whitespace special handling.

The issue was noticed by Ray Lehtiniemi.

For good measure, this commit adds a test.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-12 09:30:14 -07:00
Martin Waitz
7a0cf2d013 test-lib: separate individual test better in verbose mode.
When running tests with --verbose it is difficult to see where
one test starts and where it ends because everything is printed
in one big lump.
Fix that by printing one single newline between each test.

Signed-off-by: Martin Waitz <tali@admingilde.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-07 21:33:48 -07:00
Robin Rosenberg
b599deec18 Error in test description of t1200-tutorial
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-03 01:02:27 -07:00
Junio C Hamano
f5961572a0 Merge branch 'maint'
* maint:
  git-push: .git/remotes/ file does not require SP after colon
  git-mv: invalidate the removed path properly in cache-tree
2006-10-02 00:47:32 -07:00
Junio C Hamano
4fddf5798d git-mv: invalidate the removed path properly in cache-tree
The command updated the cache without invalidating the cache
tree entries while removing an existing entry.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-01 23:32:39 -07:00
Junio C Hamano
69de8cc852 Merge branch 'jc/gitpm'
* jc/gitpm: (52 commits)
  Remove -fPIC which was only needed for Git.xs
  Git.pm: Kill Git.xs for now
  Revert "Make it possible to set up libgit directly (instead of from the environment)"
  Revert "Git.pm: Introduce fast get_object() method"
  Revert "Convert git-annotate to use Git.pm"
  Fix compilation with Sun CC
  pass DESTDIR to the generated perl/Makefile
  Eliminate Scalar::Util usage from private-Error.pm
  Convert git-annotate to use Git.pm
  Git.pm: Introduce fast get_object() method
  Make it possible to set up libgit directly (instead of from the environment)
  Work around sed and make interactions on the backslash at the end of line.
  Git.pm: Introduce ident() and ident_person() methods
  Convert git-send-email to use Git.pm
  Git.pm: Add config() method
  Use $GITPERLLIB instead of $RUNNING_GIT_TESTS and centralize @INC munging
  INSTALL: a tip for running after building but without installing.
  Perly Git: make sure we do test the freshly built one.
  Git.pm: Don't #define around die
  Git.xs: older perl do not know const char *
  ...
2006-09-30 23:38:24 -07:00
Junio C Hamano
51b2dd4e3f Merge branch 'cc/branch-test'
* cc/branch-test:
  Remove empty ref directories that prevent creating a ref.
2006-09-27 22:17:01 -07:00
Junio C Hamano
2b83ade977 Merge branch 'sp/void'
* sp/void:
  Allow git-checkout when on a non-existant branch.
2006-09-27 21:51:29 -07:00
Junio C Hamano
e38604e006 Merge branch 'jc/deprecate-recursive'
* jc/deprecate-recursive:
  Deprecate merge-recursive.py
2006-09-27 21:41:24 -07:00
Shawn Pearce
209e756931 Corrected copy-and-paste thinko in ignore executable bit test case.
This test should be testing update-index --add, not git-add as the
latter is implemented in terms of the former.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-27 12:44:02 -07:00
Junio C Hamano
16652170bf An illustration of rev-list --parents --pretty=raw
This script creates two separate histories, A and B, each of
which does:

      (A0, B0): create fileA and subdir/fileB
      (A1, B1): modify fileA
      (A2, B2): modify subdir/fileB

and then grafts them together to make B0 a child of A2.  So
the final history looks like (time flows from top to bottom):

		true parent	touches subdir?

	A0	none		yes (creates it)
        A1      A0		no
        A2	A1		yes
        B0	none		yes (different from what's in A2)
        B1	B0		no
        B2	B1		yes

"git rev-list --parents --pretty=raw B2" would give "fake"
parents on the "commit " header lines while "parent " header
lines show the parent as recorded in the commit object (i.e. B0
appears to have A2 as its parent on "commit " header but there
is no "parent A2" header line in it).

When you have path limiters, we simplify history to omit
commits that do not affect the specified paths.

So "git rev-list --parents --pretty=raw B2 subdir" would return
"B2 B0 A2 A0" (because B1 and A1 do not touch the path).  When
it does so, the "commit " header lines have "fake" parents
(i.e. B2 appears to have B0 as its parent on "commit " header),
but you can still get the true parents by looking at "parent "
header.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-27 12:34:37 -07:00
Shawn Pearce
5a03e7f253 Allow git-checkout when on a non-existant branch.
I've seen some users get into situtations where their HEAD
symbolic-ref is pointing at a non-existant ref.  (Sometimes this
happens during clone when the remote repository lacks a 'master'
branch.)  If this happens the user is unable to use git-checkout
to switch branches as there is no prior commit to merge from.

So instead of giving the user low-level errors about how HEAD
can't be resolved and how not a single revision was given change
the type of checkout to be a force and go through with the user's
request anyway.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-27 00:43:50 -07:00
Shawn Pearce
fd28b34afd Ignore executable bit when adding files if filemode=0.
If the user has configured core.filemode=0 then we shouldn't set
the execute bit in the index when adding a new file as the user
has indicated that the local filesystem can't be trusted.

This means that when adding files that should be marked executable
in a repository with core.filemode=0 the user must perform a
'git update-index --chmod=+x' on the file before committing the
addition.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-26 22:42:52 -07:00
Christian Couder
9c7b0b3fc4 Remove empty ref directories that prevent creating a ref.
This patch also adds test cases from Linus and Junio.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-25 23:54:40 -07:00
Junio C Hamano
a06f678eb9 Deprecate merge-recursive.py
This renames merge-recursive written in Python to merge-recursive-old,
and makes merge-recur as a synonym to merge-recursive.  We do not remove
merge-recur yet, but we will remove merge-recur and merge-recursive-old
in a few releases down the road.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-24 20:33:35 -07:00
Santi Béjar
6cc7c36d5e Add test for the default merges in fetch.
[jc: with minor fix-ups]

Signed-off-by: Santi Béjar <sbejar@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-24 02:00:21 -07:00
Junio C Hamano
7be1d62c6f Add t5510 to test per branch configuration affecting git-fetch.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-24 00:13:49 -07:00
Robin Rosenberg
3d5c0cc938 Quote arguments to tr in test-lib
When there are single-character filenames in the test directory,
the shell tries to expand regexps meant for tr.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-22 17:00:36 -07:00
Johannes Schindelin
199a92186b Document receive.denyNonFastforwards
[jc: with a fix to config handling in t5400 test, which took
 annoyingly long to diagnose.]

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-20 23:32:22 -07:00
Junio C Hamano
4be609625e apply --unidiff-zero: loosen sanity checks for --unidiff=0 patches
In "git-apply", we have a few sanity checks and heuristics that
expects that the patch fed to us is a unified diff with at least
one line of context.

 * When there is no leading context line in a hunk, the hunk
   must apply at the beginning of the preimage.  Similarly, no
   trailing context means that the hunk is anchored at the end.

 * We learn a patch deletes the file from a hunk that has no
   resulting line (i.e. all lines are prefixed with '-') if it
   has not otherwise been known if the patch deletes the file.
   Similarly, no old line means the file is being created.

And we declare an error condition when the file created by a
creation patch already exists, and/or when a deletion patch
still leaves content in the file.

These sanity checks are good safety measures, but breaks down
when people feed a diff generated with --unified=0.  This was
recently noticed first by Matthew Wilcox and Gerrit Pape.

This adds a new flag, --unified-zero, to allow bypassing these
checks.  If you are in control of the patch generation process,
you should not use --unified=0 patch and fix it up with this
flag; rather you should try work with a patch with context.  But
if all you have to work with is a patch without context, this
flag may come handy as the last resort.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-17 01:12:37 -07:00
Junio C Hamano
8aac4b45f3 t1400: make test debuggable.
I had a hard time figuring out why this test was failing with
the packed-refs update without running it under "sh -x".  This
makes output from "sh t1400-update-ref.sh -v" more descriptive.

Updating other tests would be a good janitorial task.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-16 13:41:14 -07:00
Junio C Hamano
2b6eef943f Make apply --binary a no-op.
Historically we did not allow binary patch applied without an
explicit permission from the user, and this flag was the way to
do so.  This makes the flag a no-op by always allowing binary
patch application.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-07 02:44:40 -07:00
Christian Couder
6ce4e61f1b Trace into a file or an open fd and refactor tracing code.
If GIT_TRACE is set to an absolute path (starting with a
'/' character), we interpret this as a file path and we
trace into it.

Also if GIT_TRACE is set to an integer value greater than
1 and lower than 10, we interpret this as an open fd value
and we trace into it.

Note that this behavior is not compatible with the
previous one.

We also trace whole messages using one write(2) call to
make sure messages from processes do net get mixed up in
the middle.

This patch makes it possible to get trace information when
running "make test".

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-02 14:47:53 -07:00
Junio C Hamano
2c6d22df9f t5710: fix two thinkos.
The intention of the test seems to be to build a long chain of
clones that locally borrow objects from their parents and see the
system give up dereferencing long chains.  There were two problems:

 (1) it did not test the right repository;
 (2) it did not build a chain long enough to trigger the limitation.

I do not think it is a good test to make sure the limitation the
current implementation happens to have still exists, but that is
a topic at a totally different level.

At least this fixes the broken test.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-31 14:16:09 -07:00
Junio C Hamano
b32d37a3a6 Merge branch 'jc/apply'
* jc/apply:
  git-apply --reject: finishing touches.
  apply --reject: count hunks starting from 1, not 0
  git-apply --verbose
  git-apply --reject: send rejects to .rej files.
  git-apply --reject
  apply --reverse: tie it all together.
  diff.c: make binary patch reversible.
  builtin-apply --reverse: two bugfixes.
2006-08-27 17:51:05 -07:00
Junio C Hamano
e866ffdf9b Merge branch 'maint'
* maint:
  builtin-mv: readability patch
  git-mv: fix off-by-one error
  git-mv: special case destination "."
2006-08-21 14:16:38 -07:00
Johannes Schindelin
c5203bdf66 git-mv: special case destination "."
Since the normalized basename of "." is "", the check for directory
failed erroneously.

Noticed by Fredrik Kuivinen.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-21 14:15:43 -07:00
Junio C Hamano
a2bf404e28 git-apply --verbose
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-18 03:14:48 -07:00
Junio C Hamano
82e2765f59 git-apply --reject: send rejects to .rej files.
... just like everybody else does, instead of sending it to the standard
output, which was just silly.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-18 03:10:19 -07:00
Junio C Hamano
57dc397cff git-apply --reject
With the new flag "--reject", hunks that do not apply are sent to
the standard output, and the usable hunks are applied.  The command
itself exits with non-zero status when this happens, so that the
user or wrapper can take notice and sort the remaining mess out.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-17 01:23:08 -07:00
Junio C Hamano
2cda1a214e apply --reverse: tie it all together.
Add a few tests, usage string, and documentation.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-16 21:08:45 -07:00
Junio C Hamano
c9c3470aec Merge branch 'maint'
* maint:
  finish_connect(): thinkofix
  git-mv: succeed even if source is a prefix of destination
  Solaris does not support C99 format strings before version 10
2006-08-15 21:15:32 -07:00
Johannes Schindelin
1d6249e609 git-mv: succeed even if source is a prefix of destination
As noted by Fredrik Kuivinen, without this patch, git-mv fails on

	git-mv README README-renamed

because "README" is a prefix of "README-renamed".

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-15 21:00:20 -07:00
Junio C Hamano
d7b6c3c0f5 Merge branch 'master' into pb/gitpm
* master: (166 commits)
  git-apply --binary: clean up and prepare for --reverse
  Fix detection of ipv6 on Solaris
  Look for sockaddr_storage in sys/socket.h
  Solaris has strlcpy() at least since version 8
  git-apply --reverse: simplify reverse option.
  t4116 apply --reverse test
  Make sha1flush void and remove conditional return.
  Make upload_pack void and remove conditional return.
  Make track_tree_refs void.
  Make pack_objects void.
  Make fsck_dir void.
  Make checkout_all void.
  Make show_entry void
  Make pprint_tag void and cleans up call in cmd_cat_file.
  Remove combine-diff.c::uninteresting()
  read-cache.c cleanup
  http-push.c cleanup
  diff.c cleanup
  builtin-push.c cleanup
  builtin-grep.c cleanup
  ...
2006-08-15 03:13:34 -07:00
Junio C Hamano
6a0ebe8ced t4116 apply --reverse test
The binary patch test needs to be made more careful not to have
the postimage blob in the repository in which the patch is applied

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-14 23:24:55 -07:00
Junio C Hamano
cd5fff64e6 Merge branch 'jc/grep' 2006-08-12 19:16:33 -07:00
Junio C Hamano
6c7f4cebdb t/t4013: fix futzing with the version string.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-12 18:11:10 -07:00
Junio C Hamano
0d042fecf2 git-grep: show pathnames relative to the current directory
By default, the command shows pathnames relative to the current
directory.  Use --full-name (the same flag to do so in ls-files)
if you want to see the full pathname relative to the project root.

This makes it very pleasant to run in Emacs compilation (or
"grep-find") buffer.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-11 19:08:10 -07:00
Junio C Hamano
2c71810b90 git-apply: applying a patch to make a symlink shorter.
The internal representation of the result is counted string
(i.e. char *buf and ulong size), which is fine for writing out
to regular file, but throwing the buf at symlink(2) was a
no-no.

Reported by Willy Tarreau.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-09 22:47:25 -07:00
Junio C Hamano
9673198ee8 Merge branch 'master' into pb/gitpm
This is to resolve the conflicts with Ryan's annotate updates early.
2006-08-07 17:02:07 -07:00
Junio C Hamano
f25b79397c Fix "grep -w"
We used to find the first match of the pattern and then if the
match is not for the entire word, declared that the whole line
does not match.

But that is wrong.  The command "git grep -w -e mmap" should
find that a line "foo_mmap bar mmap baz" matches, by tring the
second instance of pattern "mmap" on the same line.

Problems an earlier round of "fix" had were pointed out by Morten
Welinder, which have been incorporated in the t7002 tests.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-06 01:37:08 -07:00
Junio C Hamano
c43ce6d603 Add a couple of subdirectory tests.
We still have too few of them, but we have to start from somewhere.
The general rule is to make tests easy to debug when run with -v (notice
use of seemingly useless echo everywhere in the new tests).

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-03 14:41:29 -07:00
Ramsay Allan Jones
822a7d5071 Remove cmd_usage() routine and re-organize the help/usage code.
The cmd_usage() routine was causing warning messages due to a NULL
format parameter being passed in three out of four calls. This is a
problem if you want to compile with -Werror. A simple solution is to
simply remove the GNU __attribute__ format pragma from the cmd_usage()
declaration in the header file. The function interface was somewhat
muddled anyway, so re-write the code to finesse the problem.

[jc: this incidentally revealed that t9100 test assumed that the output
 from "git help" to be fixed in stone, but this patch lower-cases
 "Usage" to "usage".  Update the test not to rely on "git help" output.]

Signed-off-by: Ramsay Allan Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-02 00:27:18 -07:00
Ramsay Allan Jones
446c6faec6 New tests and en-passant modifications to mktag.
These changes were originally part of the next patch, but have been
split out since they were peripheral to the main purpose of that patch.

  - update comment describing the signature format to reflect
    the current code.
  - remove trailing \n in calls to error(), since a \n is already
    provided by error().
  - remove redundant call to get_sha1_hex().
  - call sha1_to_hex(sha1) to convert to ascii, rather than attempting
    to print the raw sha1.

The new tests provide a regression suite to support the modifications
to git-mktag in this and the next patch.

Signed-off-by: Ramsay Allan Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-02 00:27:18 -07:00
Ramsay Allan Jones
1fd4da643c Fix annotate test script; notice when git-annotate fails.
The t8001-annotate.sh test claimed all tests pass, when in fact
the git-annotate perl script failed to run! (prior to fixing the
script to work with perl 5.5).

Signed-off-by: Ramsay Allan Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-02 00:27:17 -07:00
Junio C Hamano
522a98caa5 Merge branch 'js/mv'
* js/mv:
  builtin git-mv: support moving directories
  Make git-mv a builtin
  Extract helper bits from c-merge-recursive work
2006-07-30 13:24:48 -07:00
Shawn Pearce
818f477c40 Display an error from update-ref if target ref name is invalid.
Alex Riesen (raa.lkml@gmail.com) recently observed that git branch
would fail with no error message due to unexpected situations with
regards to refs.  For example, if .git/refs/heads/gu is a file but
"git branch -b refs/heads/gu/fixa HEAD" was invoked by the user
it would fail silently due to refs/heads/gu being a file and not
a directory.

This change adds a test for trying to create a ref within a directory
that is actually currently a file, and adds error printing within
the ref locking routine should the resolve operation fail.

The error printing code probably belongs at this level of the library
as other failures within the ref locking, writing and logging code
are also currently at this level of the code.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-28 20:53:53 -07:00