Commit Graph

816 Commits

Author SHA1 Message Date
Carlos Rica
ef5a6fb597 Add test-script for git-tag
These tests are useful to develop the C version for git-tag.sh,
ensuring that the future builtin-tag.c will not break previous
behaviour.

The tests are focused on listing, verifying, deleting and creating
tags, checking always that the correct status value is returned
and everything remains as expected.

In order to verify and create signed tags, a PGP key was also
added, being created this way: gpg --homedir t/t7004 --gen-key
Type DSA and Elgamal, size 2048 bits, no expiration date.
Name and email: C O Mitter <committer@example.com>
No password given, to enable non-interactive operation.

Signed-off-by: Carlos Rica <jasampler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-28 20:46:35 -07:00
Carlos Rica
30d038e2ff Add test script for git-stripspace.
These tests check some features that git-stripspace already has
and those that it should manage well: Removing trailing spaces
from lines, removing blank lines at the beginning and end,
unifying multiple lines between paragraphs, doing the correct
when there is no newline at the last line, etc.

It seems that the implementation needs to save the whole line
in memory to be able to manage correctly long lines with
text and spaces conveniently distribuited on them.

Signed-off-by: Carlos Rica <jasampler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-26 23:36:40 -07:00
Frank Lichtenheld
2275d50211 config: Add --null/-z option for null-delimted output
Use \n as delimiter between key and value and \0 as
delimiter after each key/value pair. This should be
easily parsable output.

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-26 19:00:39 -07:00
Junio C Hamano
68fb465049 Merge branch 'maint'
* maint:
  config: Change output of --get-regexp for valueless keys
  config: Complete documentation of --get-regexp
  cleanup merge-base test script
  Fix zero-object version-2 packs
  Ignore submodule commits when fetching over dumb protocols
2007-06-26 18:45:29 -07:00
Frank Lichtenheld
b69ba460bb config: Change output of --get-regexp for valueless keys
Print no space after the name of a key without value.
Otherwise keys without values are printed exactly the
same as keys with empty values.

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-26 18:20:47 -07:00
Sam Vilain
e3ae6bb9aa cleanup merge-base test script
Add a picture, and keep the setup and the tests together.

Signed-off-by: Sam Vilain <sam.vilain@catalyst.net.nz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-26 18:17:53 -07:00
Sven Verdoolaege
fc746df647 t9500: skip gitweb tests if perl version is too old
gitweb calls Encode::decode_utf8 with two arguments,
but old versions of perl only allow this function to be called
with one argument.  Even older versions of perl do not even
have an Encode module.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-24 02:02:28 -07:00
Johannes Schindelin
55f22ff22e filter-branch: add example to move everything into a subdirectory
This is based on Jeff King's example in

	20070621130137.GB4487@coredump.intra.peff.net

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-22 23:20:44 -07:00
Junio C Hamano
0f2890acd9 Merge branch 'js/filter'
* js/filter:
  filter-branch: subdirectory filter needs --full-history
  filter-branch: Simplify parent computation.
  Teach filter-branch about subdirectory filtering
  filter-branch: also don't fail in map() if a commit cannot be mapped
  filter-branch: Use rev-list arguments to specify revision ranges.
  filter-branch: fix behaviour of '-k'
  filter-branch: use $(($i+1)) instead of $((i+1))
  chmod +x git-filter-branch.sh
  filter-branch: prevent filters from reading from stdin
  t7003: make test repeatable
  Add git-filter-branch
2007-06-22 23:20:40 -07:00
Johannes Schindelin
0ce396431e diffcore-rename: favour identical basenames
When there are several candidates for a rename source, and one of them
has an identical basename to the rename target, take that one.

Noticed by Govind Salinas, posted by Shawn O. Pearce, partial patch
by Linus Torvalds.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-22 22:43:51 -07:00
Alex Riesen
3c740268c4 cvsserver: Actually implement --export-all
Frank Lichtenheld, Fri, Jun 15, 2007 03:01:53 +0200:
> +test_expect_failure 'req_Root failure (export-all w/o whitelist)' \
> +  'cat request-anonymous | git-cvsserver --export-all pserver >log 2>&1
> +   || false'

This does not work, at least for bash in current Ubuntu:

    GNU bash, version 3.2.13(1)-release

You have to put "||" on the previous line:

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-20 16:22:09 -07:00
Junio C Hamano
952c8c5638 Merge branch 'jc/remote'
* jc/remote:
  git-push: Update description of refspecs and add examples
  remote.c: "git-push frotz" should update what matches at the source.
  remote.c: fix "git push" weak match disambiguation
  remote.c: minor clean-up of match_explicit()
  remote.c: refactor creation of new dst ref
  remote.c: refactor match_explicit_refs()
2007-06-16 01:22:45 -07:00
Junio C Hamano
5c088a22e2 Merge branch 'gp/branch'
* gp/branch:
  git-branch: cleanup config file when deleting branches
2007-06-16 01:22:43 -07:00
Junio C Hamano
57bd934ea6 Merge branch 'fl/cvsserver'
* fl/cvsserver:
  cvsserver: Actually implement --export-all
  cvsserver: Let --base-path and pserver get along just fine
  cvsserver: Add some useful commandline options
2007-06-16 01:22:38 -07:00
Junio C Hamano
ad2a2f6f0b Merge branch 'lh/submodule'
* lh/submodule:
  gitmodules(5): remove leading period from synopsis
  Add gitmodules(5)
  git-submodule: give submodules proper names
  Rename sections from "module" to "submodule" in .gitmodules
  git-submodule: remember to checkout after clone
  t7400: barf if git-submodule removes or replaces a file
2007-06-16 01:22:35 -07:00
Junio C Hamano
7b99befef7 git-branch --track: fix tracking branch computation.
The original code did not take hierarchical branch names into account at all.

[jc: cherry-picked 11f68d9 from 'master']

Tested-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-15 23:35:32 -07:00
Johannes Schindelin
fadf488f9b merge-recursive: refuse to merge binary files
[jc: cherry-picked 9f30855 from 'master']

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-15 23:28:10 -07:00
Frank Lichtenheld
226bccb9ad cvsserver: Actually implement --export-all
Embarrassing bug number two in my options patch.

Also enforce that --export-all is only ever used together with an
explicit whitelist. Otherwise people might export every git repository
on the whole system without realising.

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-15 22:38:48 -07:00
Frank Lichtenheld
fd1cd91e94 cvsserver: Let --base-path and pserver get along just fine
Embarassing bug number one in my options patch.

Since the code for --base-path support rewrote
the cvsroot value after comparing it with a possible
existing value (i.e. from pserver authentication)
the check always failed.

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-15 22:38:45 -07:00
Eric Wong
b3bf96d483 git-svn: test for creating new directories over svn://
As reported by Matthieu Moy, this is causing svnserve to
terminate connections, because it segfaults.

This test is disabled by default and can be enabled by setting
SVNSERVE_PORT to an unbound (for 127.0.0.1) TCP port in the
environment (in addition to SVN_TESTS=1).  I'm not comfortable
with having a test start a daemon by default and take up a port
that could potentially stay running if the test failed.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-13 11:01:49 -07:00
Junio C Hamano
4f01d0f92d Merge branch 'ar/clone' into maint
* ar/clone:
  Fix clone to setup the origin if its name ends with .git
2007-06-12 20:48:31 -07:00
Lars Hjemli
941987a554 git-submodule: give submodules proper names
This changes the way git-submodule uses .gitmodules: Subsections no longer
specify the submodule path, they now specify the submodule name. The
submodule path is found under the new key "submodule.<name>.path", which is
a required key.

With this change a submodule can be moved between different 'checkout paths'
without upsetting git-submodule.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-12 01:06:21 -07:00
Lars Hjemli
d57dd255a6 Rename sections from "module" to "submodule" in .gitmodules
Rename [module] to [submodule], so that it would be more
forward compatible with the proposed extension by harmonizing
the section names used in .gitmodules and .git/config.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-12 01:06:21 -07:00
Lars Hjemli
b10ee7606e t7400: barf if git-submodule removes or replaces a file
The test for an unmolested file wouldn't fail properly if the file had been
removed or replaced by something other than a regular file. This fixes it.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-12 01:06:21 -07:00
Junio C Hamano
30ba3809a4 Merge branch 'lh/submodule'
* lh/submodule:
  git-submodule: clone during update, not during init
  git-submodule: move cloning into a separate function
2007-06-12 00:17:26 -07:00
Johannes Sixt
cfabd6eee1 filter-branch: subdirectory filter needs --full-history
When two branches are merged that modify a subdirectory (possibly in
different intermediate steps) such that both end up identical, then
rev-list chooses only one branch. But when we filter history, we want to
keep both branches. Therefore, we must use --full-history.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-09 12:24:16 -07:00
Johannes Schindelin
685ef546b6 Teach filter-branch about subdirectory filtering
With git-filter-branch --subdirectory-filter <subdirectory> you can
get at the history, as seen by a certain subdirectory. The history
of the rewritten branch will only contain commits that touched that
subdirectory, and the subdirectory will be rewritten to be the new
project root.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-09 12:16:49 -07:00
Gerrit Pape
f1eccbab63 git-branch: cleanup config file when deleting branches
When deleting branches, remove the sections referring to these branches
from the config file.

Signed-off-by: Gerrit Pape <pape@smarden.org>
2007-06-09 11:53:05 -07:00
Junio C Hamano
1ed10b886b remote.c: "git-push frotz" should update what matches at the source.
Earlier, when the local repository has a branch "frotz" and the
remote repository has a tag "frotz" (but not branch "frotz"),
"git-push frotz" mistakenly updated the tag at the remote side.
This was because the partial refname matching code was applied
independently on both source and destination side.

With this fix, when a colon-less refspec is given to git-push,
we first match it with the refs in the source repository, and
update the matching ref in the destination repository.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-09 11:53:01 -07:00
Junio C Hamano
6125796f7d remote.c: fix "git push" weak match disambiguation
When "git push A:B" is given, and A (or B) is not a full refname
that begins with refs/, we require an unambiguous match with an
existing ref.  For this purpose, a match with a local branch or
a tag (i.e. refs/heads/A and refs/tags/A) is called a "strong
match", and any other match is called a "weak match".  A partial
refname is unambiguous when there is only one strong match with
any number of weak matches, or when there is only one weak match
and no other match.

However, as reported by Sparse with Ramsay Jones recently,
count_refspec_match() function had a bug where a variable in an
inner block masked a different variable of the same name, which
caused the weak matches to be ignored.

This fixes it, and adds tests for the fix.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-09 11:53:01 -07:00
René Scharfe
27c96c4fd3 t5000: silence unzip availability check
unzip -v on (at least) Ubuntu prints a screenful of version info
to stdout.  Get rid of it since we only want to know if unzip is
installed or not.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
2007-06-09 10:07:29 -07:00
Junio C Hamano
89dd19e107 Merge branch 'js/merge'
* js/merge:
  git-merge-file: refuse to merge binary files
2007-06-09 02:06:01 -07:00
Junio C Hamano
684a93d958 Merge branch 'ar/wildcardpush'
* ar/wildcardpush:
  Test wildcard push/fetch
  Fix push with refspecs containing wildcards
2007-06-08 21:03:36 -07:00
Junio C Hamano
52912cce77 Merge branch 'ar/clone'
* ar/clone:
  Fix clone to setup the origin if its name ends with .git
2007-06-08 21:03:04 -07:00
Frank Lichtenheld
693b63273e cvsserver: Add some useful commandline options
Make git-cvsserver understand some options inspired by
git-daemon, namely --base-path, --export-all, --strict-paths.

Also allow the caller to specify a whitelist of allowed
directories, again similar to git-daemon.

While already adding option parsing also support the common
--help and --version options.

Rationale:

While the gitcvs.enabled configuration option already
offers means to limit git-cvsserver access to a repository,
there are some use cases where other methods of access
control prove to be more useful.

E.g. if setting up a pserver for a collection of public
repositories one might want limit the exported repositories
to exactly the directory this collection is located whithout
having to worry about other repositories that might lie around
with the configuration variable set (never trust your users ;)

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-08 02:56:18 -07:00
Junio C Hamano
abc403f584 Merge branch 'maint'
* maint:
  checkout: do not get confused with ambiguous tag/branch names
2007-06-08 02:55:19 -07:00
Frank Lichtenheld
4890888d74 cvsserver: Make req_Root more critical of its input data
The path submitted with the Root request has to be absolute
(cvs does it this way and it may save us some sanity checks
later)

If multiple roots are specified (e.g. because we use
pserver authentication which will already include the
root), ensure that they say all the same.

Probably neither is a security risk, and neither should ever
be triggered by a sane client, but when validating
input data, it's better to be save than sorry.

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-08 02:37:18 -07:00
Junio C Hamano
5035242c47 checkout: do not get confused with ambiguous tag/branch names
Although it is not advisable, we have always allowed a branch
and a tag to have the same basename (i.e. it is not illegal to
have refs/heads/frotz and refs/tags/frotz at the same time).
When talking about a specific commit, the interpretation of
'frotz' has always been "use tag and then check branch",
although we warn when ambiguities exist.

However "git checkout $name" is defined to (1) first see if it
matches the branch name, and if so switch to that branch; (2)
otherwise it is an instruction to detach HEAD to point at the
commit named by $name.  We did not follow this definition when
$name appeared under both refs/heads/ and refs/tags/ -- we
switched to the branch but read the tree from the tagged commit,
which was utterly bogus.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-08 01:19:13 -07:00
Junio C Hamano
bcdb34f70d Test wildcard push/fetch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-08 00:43:22 -07:00
Junio C Hamano
a6080a0a44 War on whitespace
This uses "git-apply --whitespace=strip" to fix whitespace errors that have
crept in to our source files over time.  There are a few files that need
to have trailing whitespaces (most notably, test vectors).  The results
still passes the test, and build result in Documentation/ area is unchanged.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-07 00:04:01 -07:00
Alex Riesen
defe13a24a Fix clone to setup the origin if its name ends with .git
The problem is visible when cloning a local repo. The cloned
repository will have the origin url setup incorrectly: the origin name
will be copied verbatim in origin url of the cloned repository.
Normally, the name is to be expanded into absolute path.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 16:40:03 -07:00
Johannes Schindelin
3a86f36bed t5000: skip ZIP tests if unzip was not found
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 13:13:58 -07:00
Johannes Sixt
2766ce2815 filter-branch: Use rev-list arguments to specify revision ranges.
A subset of commits in a branch used to be specified by options (-k, -r)
as well as the branch tip itself (-s). It is more natural (for git users)
to specify revision ranges like 'master..next' instead. This makes it so.
If no range is specified it defaults to 'HEAD'.

As a consequence, the new name of the filtered branch must be the first
non-option argument. All remaining arguments are passed to 'git rev-list'
unmodified.

The tip of the branch that gets filtered is implied: It is the first
commit that git rev-list would print for the specified range.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 12:49:16 -07:00
Johannes Schindelin
9840906026 filter-branch: fix behaviour of '-k'
The option '-k' says that the given commit and _all_ of its ancestors
are kept as-is.

However, if a to-be-rewritten commit branched from an ancestor of an
ancestor of a commit given with '-k', filter-branch would fail.

Example:

	A - B
	  \
	    C

If filter-branch was called with '-k B -s C', it would actually keep
B (and A as its parent), but would rewrite C, and its parent.

Noticed by Johannes Sixt.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 12:49:16 -07:00
Lars Hjemli
211b7f19c7 git-submodule: clone during update, not during init
This teaches 'git-submodule init' to register submodule paths and urls in
.git/config instead of actually cloning them. The cloning is now handled
as part of 'git-submodule update'.

With this change it is possible to specify preferred/alternate urls for
the submodules in .git/config before the submodules are cloned.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 02:49:08 -07:00
Junio C Hamano
11f68d9082 git-branch --track: fix tracking branch computation.
The original code did not take hierarchical branch names into account at all.

Tested-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 01:10:53 -07:00
Junio C Hamano
aee078bf81 t7003: make test repeatable
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-05 00:07:31 -07:00
Johannes Schindelin
5771907a57 git-merge-file: refuse to merge binary files
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-04 23:10:29 -07:00
Johannes Schindelin
9f30855d0f merge-recursive: refuse to merge binary files
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-04 23:07:19 -07:00
Martin Koegler
00f429af7b gitweb: Handle non UTF-8 text better
gitweb assumes that everything is in UTF-8. If a text contains invalid
UTF-8 character sequences, the text must be in a different encoding.

This commit introduces $fallback_encoding which would be used as input
encoding if gitweb encounters text with is not valid UTF-8.

Add basic test for this in t/t9500-gitweb-standalone-no-errors.sh

Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Tested-by: Alexandre Julliard <julliard@winehq.org>
Tested-by: Ismail Dönmez <ismail@pardus.org.tr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-03 16:51:53 -07:00