Commit graph

20 commits

Author SHA1 Message Date
Ben Jackson ea10b60c91 Work around ash "alternate value" expansion bug
Ash (used as /bin/sh on many distros) has a shell expansion bug
for the form ${var:+word word}.  The result is a single argument
"word word".  Work around by using ${var:+word} ${var:+word} or
equivalent.

Signed-off-by: Ben Jackson <ben@ben.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-18 21:37:46 -07:00
Junio C Hamano 500ff11968 Merge branch 'mg/maint-submodule-normalize-path'
* mg/maint-submodule-normalize-path:
  git submodule: Fix adding of submodules at paths with ./, .. and //
  git submodule: Add test cases for git submodule add
2009-03-11 13:50:29 -07:00
Michael J Gruber db75ada559 git submodule: Fix adding of submodules at paths with ./, .. and //
Make 'git submodule add' normalize the submodule path in the
same way as 'git ls-files' does, so that 'git submodule init' looks up
the information in .gitmodules with the same key under which 'git
submodule add' stores it.

This fixes 4 known breakages.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-03 21:46:09 -08:00
Michael J Gruber ac8463d2b4 git submodule: Add test cases for git submodule add
Add simple test cases for adding and initialising submodules. The
init step is necessary in order to verify the added information.

The second test exposes a known breakage due to './' in the path: git
ls-files simplifies the path but git add does not, which leads to git
init looking for different lines in .gitmodules than git add adds.

The other tests add test cases for '//' and '..' in the path which
currently fail for the same reason.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-03 21:46:09 -08:00
Johannes Schindelin 496917b721 submodule: warn about non-submodules
Earlier, when you called

        git submodule some/bogus/path

Git would silently ignore the path, without warning the user about the
likely mistake.  Now it does.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-07 12:49:58 -08:00
Johannes Schindelin f3670a5749 Let ls-files strip trailing slashes in submodules' paths
Tab completion makes it easy to add a trailing slash to a submodule path.
As it is completely clear what the user actually wanted to say, be nice
and strip that slash at the end.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-07 12:49:50 -08:00
Johannes Schindelin 2ce53f9b77 git add: do not add files from a submodule
It comes quite as a surprise to an unsuspecting Git user that calling
"git add submodule/file" (which is a mistake, alright) _removes_
the submodule in the index, and adds the file.  Instead, complain loudly.

While at it, be nice when the user said "git add submodule/" which is
most likely the consequence of tab-completion, and stage the submodule,
instead of trying to add the contents of that directory.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-01-05 10:48:32 -08:00
Nanako Shiraishi 47a528ad24 tests: use "git xyzzy" form (t7200 - t9001)
Converts tests between t7201-t9001.

Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-09-03 14:51:48 -07:00
Stephan Beyer d492b31caf t/: Use "test_must_fail git" instead of "! git"
This patch changes every occurrence of "! git" -- with the meaning
that a git call has to gracefully fail -- into "test_must_fail git".

This is useful to

 - make sure the test does not fail because of a signal,
   e.g. SIGSEGV, and

 - advertise the use of "test_must_fail" for new tests.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-13 13:21:26 -07:00
Johannes Schindelin be4d2c83b6 submodule update: add convenience option --init
When a submodule is not initialized and you do not want to change the
defaults from .gitmodules anyway, you can now say

	$ git submodule update --init <name>

When "update" is called without --init on an uninitialized submodule,
a hint to use --init is printed.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-16 13:03:55 -07:00
Junio C Hamano a2d93aea25 git-submodule: add test for the subcommand parser fix
This modifies the existing t7400 test to use 'init' as the
pathname that a submodule is bound to.  Without the earlier
subcommand parser fix, this fails.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-01-20 20:57:42 -08:00
Sven Verdoolaege 5701115aa7 git-diff: don't squelch the new SHA1 in submodule diffs
The code to squelch empty diffs introduced by commit
fb13227e08 would inadvertently
populate filespec "two" of a submodule change using the uninitialized
(null) SHA1, thereby replacing the submodule SHA1 by 0{40} in the output.

This change teaches diffcore_skip_stat_unmatch to handle
submodule changes correctly.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-09 02:28:57 -07:00
Sven Verdoolaege e06c5a6c7b git-apply: apply submodule changes
Apply "Subproject commit HEX" changes produced by git-diff.
As usual in the current git, only the superproject itself is actually
modified (possibly creating empty directories for new submodules).
Any checked-out submodule is left untouched and is not required to
be up-to-date.

With clean-ups from Junio C Hamano.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-15 21:39:07 -07:00
Sven Verdoolaege 0cf7375542 unpack-trees.c: assume submodules are clean during check-out
In particular, when moving back to a commit without a given submodule
and then moving back forward to a commit with the given submodule,
we shouldn't complain that updating would lose untracked file in
the submodule, because git currently does not checkout subprojects
during superproject check-out.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-18 17:01:00 -07:00
Junio C Hamano 5be60078c9 Rewrite "git-frotz" to "git frotz"
This uses the remove-dashes target to replace "git-frotz" to "git frotz".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-02 22:52:14 -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
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
Lars Hjemli 88961ef258 Add basic test-script for git-submodule
This test tries to verify basic sanity of git-submodule, i.e. that it is
able to clone and update a submodule repository, that its status output is
sane, and that it barfs when the submodule path is occupied during init.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-06-02 12:48:07 -07:00