* [PATCH v3 0/2] submodule: move gitdir into superproject
@ 2011-08-12 19:55 Fredrik Gustafsson
2011-08-12 19:55 ` [PATCH v3 1/2] rev-parse: add option --is-well-formed-git-dir [path] Fredrik Gustafsson
2011-08-12 19:55 ` [PATCH v3 2/2] Move git-dir for submodules Fredrik Gustafsson
0 siblings, 2 replies; 10+ messages in thread
From: Fredrik Gustafsson @ 2011-08-12 19:55 UTC (permalink / raw)
To: git; +Cc: iveqy, jens.lehmann, hvoigt, gitster
Move git-dir for submodules into $GIT_DIR/modules/[name_of_submodule] of
the superproject. This is a step towards being able to delete submodule
directories without loosing the information from their .git directory
as that is now stored outside the submodules work tree.
This is done relying on the already existent .git-file functionality.
Tests that rely on .git being a directory have been fixed.
This is the third iteration of this patchseries. In this iteration the
commit message of the second patch is updated and the fixup-patch from
Junio squashed with the first commit.
The first can be found here:
http://thread.gmane.org/gmane.comp.version-control.git/177582
The second can be found here:
http://thread.gmane.org/gmane.comp.version-control.git/178970/focus=179154
Fredrik Gustafsson (2):
rev-parse: add option --is-well-formed-git-dir [path]
Move git-dir for submodules
Documentation/git-rev-parse.txt | 4 ++
builtin/rev-parse.c | 8 +++
cache.h | 1 +
git-submodule.sh | 49 ++++++++++++++++--
setup.c | 7 +++
t/t7400-submodule-basic.sh | 4 +-
t/t7403-submodule-sync.sh | 5 +-
t/t7406-submodule-update.sh | 107 +++++++++++++++++++++++++++++++++++++++
t/t7407-submodule-foreach.sh | 103 +++++++++++++++++++------------------
t/t7408-submodule-reference.sh | 4 +-
10 files changed, 231 insertions(+), 61 deletions(-)
--
1.7.6.403.g1fd2f.dirty
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v3 1/2] rev-parse: add option --is-well-formed-git-dir [path]
2011-08-12 19:55 [PATCH v3 0/2] submodule: move gitdir into superproject Fredrik Gustafsson
@ 2011-08-12 19:55 ` Fredrik Gustafsson
2011-08-12 20:57 ` Junio C Hamano
2011-08-13 2:49 ` Nguyen Thai Ngoc Duy
2011-08-12 19:55 ` [PATCH v3 2/2] Move git-dir for submodules Fredrik Gustafsson
1 sibling, 2 replies; 10+ messages in thread
From: Fredrik Gustafsson @ 2011-08-12 19:55 UTC (permalink / raw)
To: git; +Cc: iveqy, jens.lehmann, hvoigt, gitster
Check if [path] is a valid git-dir or a valid git-file that points
to a valid git-dir.
We want tests to be independent from the fact that a git-dir may
be a git-file. Thus we changed tests to use this feature.
Signed-off-by: Fredrik Gustafsson <iveqy@iveqy.com>
Mentored-by: Jens Lehmann <Jens.Lehmann@web.de>
Mentored-by: Heiko Voigt <hvoigt@hvoigt.net>
---
Documentation/git-rev-parse.txt | 4 ++
builtin/rev-parse.c | 8 +++
cache.h | 1 +
setup.c | 7 +++
t/t7400-submodule-basic.sh | 4 +-
t/t7403-submodule-sync.sh | 5 +-
t/t7407-submodule-foreach.sh | 97 ++++++++++++++++++++-------------------
7 files changed, 75 insertions(+), 51 deletions(-)
diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt
index 42c9676..3ce81c0 100644
--- a/Documentation/git-rev-parse.txt
+++ b/Documentation/git-rev-parse.txt
@@ -180,6 +180,10 @@ print a message to stderr and exit with nonzero status.
<args>...::
Flags and parameters to be parsed.
+--is-well-formed-git-dir [path]::
+ Check if [path] is a valid git-dir or a git-file pointing to a valid
+ git-dir. If [path] is a valid git-dir the resolved path to git-dir will
+ be printed.
include::revisions.txt[]
diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c
index 4c19f84..21ac43f 100644
--- a/builtin/rev-parse.c
+++ b/builtin/rev-parse.c
@@ -468,6 +468,14 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
return 0;
}
+ if (argc > 2 && !strcmp(argv[1], "--is-well-formed-git-dir")) {
+ const char *gitdir = resolve_gitdir(argv[2]);
+ if (!gitdir)
+ die("not a gitdir '%s'", argv[2]);
+ puts(gitdir);
+ return 0;
+ }
+
if (argc > 1 && !strcmp("-h", argv[1]))
usage(builtin_rev_parse_usage);
diff --git a/cache.h b/cache.h
index 9e12d55..550f632 100644
--- a/cache.h
+++ b/cache.h
@@ -436,6 +436,7 @@ extern char *get_graft_file(void);
extern int set_git_dir(const char *path);
extern const char *get_git_work_tree(void);
extern const char *read_gitfile_gently(const char *path);
+extern const char *resolve_gitdir(const char *suspect);
extern void set_git_work_tree(const char *tree);
#define ALTERNATE_DB_ENVIRONMENT "GIT_ALTERNATE_OBJECT_DIRECTORIES"
diff --git a/setup.c b/setup.c
index 5ea5502..efad002 100644
--- a/setup.c
+++ b/setup.c
@@ -808,3 +808,10 @@ const char *setup_git_directory(void)
{
return setup_git_directory_gently(NULL);
}
+
+const char *resolve_gitdir(const char *suspect)
+{
+ if (is_git_directory(suspect))
+ return suspect;
+ return read_gitfile_gently(suspect);
+}
diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
index 14dc927..4df53e5 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -360,10 +360,10 @@ test_expect_success 'update --init' '
git submodule update init > update.out &&
cat update.out &&
test_i18ngrep "not initialized" update.out &&
- ! test -d init/.git &&
+ test_must_fail git rev-parse --is-well-formed-git-dir init/.git &&
git submodule update --init init &&
- test -d init/.git
+ git rev-parse --is-well-formed-git-dir init/.git
'
test_expect_success 'do not add files from a submodule' '
diff --git a/t/t7403-submodule-sync.sh b/t/t7403-submodule-sync.sh
index 95ffe34..3620215 100755
--- a/t/t7403-submodule-sync.sh
+++ b/t/t7403-submodule-sync.sh
@@ -56,8 +56,9 @@ test_expect_success '"git submodule sync" should update submodule URLs' '
git pull --no-recurse-submodules &&
git submodule sync
) &&
- test -d "$(git config -f super-clone/submodule/.git/config \
- remote.origin.url)" &&
+ test -d "$(cd super-clone/submodule &&
+ git config remote.origin.url
+ )" &&
(cd super-clone/submodule &&
git checkout master &&
git pull
diff --git a/t/t7407-submodule-foreach.sh b/t/t7407-submodule-foreach.sh
index be745fb..1a974e2 100755
--- a/t/t7407-submodule-foreach.sh
+++ b/t/t7407-submodule-foreach.sh
@@ -118,19 +118,19 @@ test_expect_success 'use "submodule foreach" to checkout 2nd level submodule' '
git clone super clone2 &&
(
cd clone2 &&
- test ! -d sub1/.git &&
- test ! -d sub2/.git &&
- test ! -d sub3/.git &&
- test ! -d nested1/.git &&
+ test_must_fail git rev-parse --is-well-formed-git-dir sub1/.git &&
+ test_must_fail git rev-parse --is-well-formed-git-dir sub2/.git &&
+ test_must_fail git rev-parse --is-well-formed-git-dir sub3/.git &&
+ test_must_fail git rev-parse --is-well-formed-git-dir nested1/.git &&
git submodule update --init &&
- test -d sub1/.git &&
- test -d sub2/.git &&
- test -d sub3/.git &&
- test -d nested1/.git &&
- test ! -d nested1/nested2/.git &&
+ git rev-parse --is-well-formed-git-dir sub1/.git &&
+ git rev-parse --is-well-formed-git-dir sub2/.git &&
+ git rev-parse --is-well-formed-git-dir sub3/.git &&
+ git rev-parse --is-well-formed-git-dir nested1/.git &&
+ test_must_fail git rev-parse --is-well-formed-git-dir nested1/nested2/.git &&
git submodule foreach "git submodule update --init" &&
- test -d nested1/nested2/.git &&
- test ! -d nested1/nested2/nested3/.git
+ git rev-parse --is-well-formed-git-dir nested1/nested1/nested2/.git
+ test_must_fail git rev-parse --is-well-formed-git-dir nested1/nested2/nested3/.git
)
'
@@ -138,8 +138,8 @@ test_expect_success 'use "foreach --recursive" to checkout all submodules' '
(
cd clone2 &&
git submodule foreach --recursive "git submodule update --init" &&
- test -d nested1/nested2/nested3/.git &&
- test -d nested1/nested2/nested3/submodule/.git
+ git rev-parse --is-well-formed-git-dir nested1/nested2/nested3/.git &&
+ git rev-parse --is-well-formed-git-dir nested1/nested2/nested3/submodule/.git
)
'
@@ -183,18 +183,18 @@ test_expect_success 'use "update --recursive" to checkout all submodules' '
git clone super clone3 &&
(
cd clone3 &&
- test ! -d sub1/.git &&
- test ! -d sub2/.git &&
- test ! -d sub3/.git &&
- test ! -d nested1/.git &&
+ test_must_fail git rev-parse --is-well-formed-git-dir sub1/.git &&
+ test_must_fail git rev-parse --is-well-formed-git-dir sub2/.git &&
+ test_must_fail git rev-parse --is-well-formed-git-dir sub3/.git &&
+ test_must_fail git rev-parse --is-well-formed-git-dir nested1/.git &&
git submodule update --init --recursive &&
- test -d sub1/.git &&
- test -d sub2/.git &&
- test -d sub3/.git &&
- test -d nested1/.git &&
- test -d nested1/nested2/.git &&
- test -d nested1/nested2/nested3/.git &&
- test -d nested1/nested2/nested3/submodule/.git
+ git rev-parse --is-well-formed-git-dir sub1/.git &&
+ git rev-parse --is-well-formed-git-dir sub2/.git &&
+ git rev-parse --is-well-formed-git-dir sub3/.git &&
+ git rev-parse --is-well-formed-git-dir nested1/.git &&
+ git rev-parse --is-well-formed-git-dir nested1/nested2/.git &&
+ git rev-parse --is-well-formed-git-dir nested1/nested2/nested3/.git &&
+ git rev-parse --is-well-formed-git-dir nested1/nested2/nested3/submodule/.git
)
'
@@ -247,14 +247,17 @@ test_expect_success 'ensure "status --cached --recursive" preserves the --cached
test_expect_success 'use "git clone --recursive" to checkout all submodules' '
git clone --recursive super clone4 &&
- test -d clone4/.git &&
- test -d clone4/sub1/.git &&
- test -d clone4/sub2/.git &&
- test -d clone4/sub3/.git &&
- test -d clone4/nested1/.git &&
- test -d clone4/nested1/nested2/.git &&
- test -d clone4/nested1/nested2/nested3/.git &&
- test -d clone4/nested1/nested2/nested3/submodule/.git
+ (
+ cd clone4 &&
+ git rev-parse --is-well-formed-git-dir .git &&
+ git rev-parse --is-well-formed-git-dir sub1/.git &&
+ git rev-parse --is-well-formed-git-dir sub2/.git &&
+ git rev-parse --is-well-formed-git-dir sub3/.git &&
+ git rev-parse --is-well-formed-git-dir nested1/.git &&
+ git rev-parse --is-well-formed-git-dir nested1/nested2/.git &&
+ git rev-parse --is-well-formed-git-dir nested1/nested2/nested3/.git &&
+ git rev-parse --is-well-formed-git-dir nested1/nested2/nested3/submodule/.git
+ )
'
test_expect_success 'test "update --recursive" with a flag with spaces' '
@@ -262,11 +265,11 @@ test_expect_success 'test "update --recursive" with a flag with spaces' '
git clone super clone5 &&
(
cd clone5 &&
- test ! -d nested1/.git &&
+ test_must_fail git rev-parse --is-well-formed-git-dir d nested1/.git &&
git submodule update --init --recursive --reference="$(dirname "$PWD")/common objects" &&
- test -d nested1/.git &&
- test -d nested1/nested2/.git &&
- test -d nested1/nested2/nested3/.git &&
+ git rev-parse --is-well-formed-git-dir nested1/.git &&
+ git rev-parse --is-well-formed-git-dir nested1/nested2/.git &&
+ git rev-parse --is-well-formed-git-dir nested1/nested2/nested3/.git &&
test -f nested1/.git/objects/info/alternates &&
test -f nested1/nested2/.git/objects/info/alternates &&
test -f nested1/nested2/nested3/.git/objects/info/alternates
@@ -277,18 +280,18 @@ test_expect_success 'use "update --recursive nested1" to checkout all submodules
git clone super clone6 &&
(
cd clone6 &&
- test ! -d sub1/.git &&
- test ! -d sub2/.git &&
- test ! -d sub3/.git &&
- test ! -d nested1/.git &&
+ test_must_fail git rev-parse --is-well-formed-git-dir sub1/.git &&
+ test_must_fail git rev-parse --is-well-formed-git-dir sub2/.git &&
+ test_must_fail git rev-parse --is-well-formed-git-dir sub3/.git &&
+ test_must_fail git rev-parse --is-well-formed-git-dir nested1/.git &&
git submodule update --init --recursive -- nested1 &&
- test ! -d sub1/.git &&
- test ! -d sub2/.git &&
- test ! -d sub3/.git &&
- test -d nested1/.git &&
- test -d nested1/nested2/.git &&
- test -d nested1/nested2/nested3/.git &&
- test -d nested1/nested2/nested3/submodule/.git
+ test_must_fail git rev-parse --is-well-formed-git-dir sub1/.git &&
+ test_must_fail git rev-parse --is-well-formed-git-dir sub2/.git &&
+ test_must_fail git rev-parse --is-well-formed-git-dir sub3/.git &&
+ git rev-parse --is-well-formed-git-dir nested1/.git &&
+ git rev-parse --is-well-formed-git-dir nested1/nested2/.git &&
+ git rev-parse --is-well-formed-git-dir nested1/nested2/nested3/.git &&
+ git rev-parse --is-well-formed-git-dir nested1/nested2/nested3/submodule/.git
)
'
--
1.7.6.403.g1fd2f.dirty
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v3 2/2] Move git-dir for submodules
2011-08-12 19:55 [PATCH v3 0/2] submodule: move gitdir into superproject Fredrik Gustafsson
2011-08-12 19:55 ` [PATCH v3 1/2] rev-parse: add option --is-well-formed-git-dir [path] Fredrik Gustafsson
@ 2011-08-12 19:55 ` Fredrik Gustafsson
2011-08-15 14:30 ` Marc Branchaud
2011-08-16 17:34 ` Junio C Hamano
1 sibling, 2 replies; 10+ messages in thread
From: Fredrik Gustafsson @ 2011-08-12 19:55 UTC (permalink / raw)
To: git; +Cc: iveqy, jens.lehmann, hvoigt, gitster
Move git-dir for submodules into $GIT_DIR/modules/[name_of_submodule] of
the superproject. This is a step towards being able to delete submodule
directories without loosing the information from their .git directory
as that is now stored outside the submodules work tree.
This is done relying on the already existent .git-file functionality.
When adding or updating a submodule whose git directory is found under
$GIT_DIR/modules/[name_of_submodule], don't clone it again but simply
point the .git-file to it and remove the now stale index file from it.
The index will be recreated by the following checkout.
This patch will not affect already cloned submodules at all.
Tests that rely on .git being a directory have been fixed.
Signed-off-by: Fredrik Gustafsson <iveqy@iveqy.com>
Mentored-by: Jens Lehmann <Jens.Lehmann@web.de>
Mentored-by: Heiko Voigt <hvoigt@hvoigt.net>
---
git-submodule.sh | 49 ++++++++++++++++--
t/t7406-submodule-update.sh | 107 ++++++++++++++++++++++++++++++++++++++++
t/t7407-submodule-foreach.sh | 6 +-
t/t7408-submodule-reference.sh | 4 +-
4 files changed, 156 insertions(+), 10 deletions(-)
diff --git a/git-submodule.sh b/git-submodule.sh
index bc1d3fa..ace6c1d 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -122,14 +122,53 @@ module_clone()
path=$1
url=$2
reference="$3"
+ gitdir=
+ gitdir_base=
+ name=$(module_name "$path")
+ if test -z "$name"
+ then
+ name="$path"
+ fi
+ base_path=$(dirname "$path")
+
+ gitdir=$(git rev-parse --git-dir)
+ gitdir_base="$gitdir/modules/$base_path"
+ gitdir="$gitdir/modules/$path"
+
+ case $gitdir in
+ /*)
+ a="$(cd_to_toplevel && pwd)/"
+ b=$gitdir
+ while [ "$b" ] && [ "${a%%/*}" = "${b%%/*}" ]
+ do
+ a=${a#*/} b=${b#*/};
+ done
+
+ rel="$a$name"
+ rel=`echo $rel | sed -e 's|[^/]*|..|g'`
+ rel_gitdir="$rel/$b"
+ ;;
+ *)
+ rel=`echo $name | sed -e 's|[^/]*|..|g'`
+ rel_gitdir="$rel/$gitdir"
+ ;;
+ esac
- if test -n "$reference"
+ if test -d "$gitdir"
then
- git-clone "$reference" -n "$url" "$path"
+ mkdir -p "$path"
+ echo "gitdir: $rel_gitdir" >"$path/.git"
+ rm -f "$gitdir/index"
else
- git-clone -n "$url" "$path"
- fi ||
- die "$(eval_gettext "Clone of '\$url' into submodule path '\$path' failed")"
+ mkdir -p "$gitdir_base"
+ if test -n "$reference"
+ then
+ git-clone "$reference" -n "$url" "$path" --separate-git-dir "$gitdir"
+ else
+ git-clone -n "$url" "$path" --separate-git-dir "$gitdir"
+ fi ||
+ die "$(eval_gettext "Clone of '\$url' into submodule path '\$path' failed")"
+ fi
}
#
diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh
index c679f36..1ae6b4e 100755
--- a/t/t7406-submodule-update.sh
+++ b/t/t7406-submodule-update.sh
@@ -408,6 +408,7 @@ test_expect_success 'submodule update exit immediately in case of merge conflict
test_cmp expect actual
)
'
+
test_expect_success 'submodule update exit immediately after recursive rebase error' '
(cd super &&
git checkout master &&
@@ -442,4 +443,110 @@ test_expect_success 'submodule update exit immediately after recursive rebase er
test_cmp expect actual
)
'
+
+test_expect_success 'add different submodules to the same path' '
+ (cd super &&
+ git submodule add ../submodule s1 &&
+ test_must_fail git submodule add ../merging s1
+ )
+'
+
+test_expect_success 'submodule add places git-dir in superprojects git-dir' '
+ (cd super &&
+ mkdir deeper &&
+ git submodule add ../submodule deeper/submodule &&
+ (cd deeper/submodule &&
+ git log > ../../expected
+ ) &&
+ (cd .git/modules/deeper/submodule &&
+ git log > ../../../../actual
+ ) &&
+ test_cmp actual expected
+ )
+'
+
+test_expect_success 'submodule update places git-dir in superprojects git-dir' '
+ (cd super &&
+ git commit -m "added submodule"
+ ) &&
+ git clone super super2 &&
+ (cd super2 &&
+ git submodule init deeper/submodule &&
+ git submodule update &&
+ (cd deeper/submodule &&
+ git log > ../../expected
+ ) &&
+ (cd .git/modules/deeper/submodule &&
+ git log > ../../../../actual
+ ) &&
+ test_cmp actual expected
+ )
+'
+
+test_expect_success 'submodule add places git-dir in superprojects git-dir recursive' '
+ (cd super2 &&
+ (cd deeper/submodule &&
+ git submodule add ../submodule subsubmodule &&
+ (cd subsubmodule &&
+ git log > ../../../expected
+ ) &&
+ git commit -m "added subsubmodule" &&
+ git push
+ ) &&
+ (cd .git/modules/deeper/submodule/modules/subsubmodule &&
+ git log > ../../../../../actual
+ ) &&
+ git add deeper/submodule &&
+ git commit -m "update submodule" &&
+ git push &&
+ test_cmp actual expected
+ )
+'
+
+test_expect_success 'submodule update places git-dir in superprojects git-dir recursive' '
+ mkdir super_update_r &&
+ (cd super_update_r &&
+ git init --bare
+ ) &&
+ mkdir subsuper_update_r &&
+ (cd subsuper_update_r &&
+ git init --bare
+ ) &&
+ mkdir subsubsuper_update_r &&
+ (cd subsubsuper_update_r &&
+ git init --bare
+ ) &&
+ git clone subsubsuper_update_r subsubsuper_update_r2 &&
+ (cd subsubsuper_update_r2 &&
+ test_commit "update_subsubsuper" file &&
+ git push origin master
+ ) &&
+ git clone subsuper_update_r subsuper_update_r2 &&
+ (cd subsuper_update_r2 &&
+ test_commit "update_subsuper" file &&
+ git submodule add ../subsubsuper_update_r subsubmodule &&
+ git commit -am "subsubmodule" &&
+ git push origin master
+ ) &&
+ git clone super_update_r super_update_r2 &&
+ (cd super_update_r2 &&
+ test_commit "update_super" file &&
+ git submodule add ../subsuper_update_r submodule &&
+ git commit -am "submodule" &&
+ git push origin master
+ ) &&
+ rm -rf super_update_r2 &&
+ git clone super_update_r super_update_r2 &&
+ (cd super_update_r2 &&
+ git submodule update --init --recursive &&
+ (cd submodule/subsubmodule &&
+ git log > ../../expected
+ ) &&
+ (cd .git/modules/submodule/modules/subsubmodule
+ git log > ../../../../../actual
+ )
+ test_cmp actual expected
+ )
+'
+
test_done
diff --git a/t/t7407-submodule-foreach.sh b/t/t7407-submodule-foreach.sh
index 1a974e2..e410bd4 100755
--- a/t/t7407-submodule-foreach.sh
+++ b/t/t7407-submodule-foreach.sh
@@ -270,9 +270,9 @@ test_expect_success 'test "update --recursive" with a flag with spaces' '
git rev-parse --is-well-formed-git-dir nested1/.git &&
git rev-parse --is-well-formed-git-dir nested1/nested2/.git &&
git rev-parse --is-well-formed-git-dir nested1/nested2/nested3/.git &&
- test -f nested1/.git/objects/info/alternates &&
- test -f nested1/nested2/.git/objects/info/alternates &&
- test -f nested1/nested2/nested3/.git/objects/info/alternates
+ test -f .git/modules/nested1/objects/info/alternates &&
+ test -f .git/modules/nested1/modules/nested2/objects/info/alternates &&
+ test -f .git/modules/nested1/modules/nested2/modules/nested3/objects/info/alternates
)
'
diff --git a/t/t7408-submodule-reference.sh b/t/t7408-submodule-reference.sh
index cc16d3f..ab37c36 100755
--- a/t/t7408-submodule-reference.sh
+++ b/t/t7408-submodule-reference.sh
@@ -43,7 +43,7 @@ git commit -m B-super-added'
cd "$base_dir"
test_expect_success 'after add: existence of info/alternates' \
-'test `wc -l <super/sub/.git/objects/info/alternates` = 1'
+'test `wc -l <super/.git/modules/sub/objects/info/alternates` = 1'
cd "$base_dir"
@@ -66,7 +66,7 @@ test_expect_success 'update with reference' \
cd "$base_dir"
test_expect_success 'after update: existence of info/alternates' \
-'test `wc -l <super-clone/sub/.git/objects/info/alternates` = 1'
+'test `wc -l <super-clone/.git/modules/sub/objects/info/alternates` = 1'
cd "$base_dir"
--
1.7.6.403.g1fd2f.dirty
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v3 1/2] rev-parse: add option --is-well-formed-git-dir [path]
2011-08-12 19:55 ` [PATCH v3 1/2] rev-parse: add option --is-well-formed-git-dir [path] Fredrik Gustafsson
@ 2011-08-12 20:57 ` Junio C Hamano
2011-08-13 2:49 ` Nguyen Thai Ngoc Duy
1 sibling, 0 replies; 10+ messages in thread
From: Junio C Hamano @ 2011-08-12 20:57 UTC (permalink / raw)
To: Fredrik Gustafsson; +Cc: git, jens.lehmann, hvoigt
Fredrik Gustafsson <iveqy@iveqy.com> writes:
> Check if [path] is a valid git-dir or a valid git-file that points
> to a valid git-dir.
On Subject, here, and in the doc, I do not think you meant "[path]" (which
typically means "you do not have to have anything, but you are allowed to
have a path, if you do write something here."). Perhaps you meant to say
<path> instead (which is how most if not all of the documentation mark a
placeholder in a description)?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3 1/2] rev-parse: add option --is-well-formed-git-dir [path]
2011-08-12 19:55 ` [PATCH v3 1/2] rev-parse: add option --is-well-formed-git-dir [path] Fredrik Gustafsson
2011-08-12 20:57 ` Junio C Hamano
@ 2011-08-13 2:49 ` Nguyen Thai Ngoc Duy
2011-08-13 6:13 ` Heiko Voigt
1 sibling, 1 reply; 10+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2011-08-13 2:49 UTC (permalink / raw)
To: Fredrik Gustafsson; +Cc: git, jens.lehmann, hvoigt, gitster
On Sat, Aug 13, 2011 at 2:55 AM, Fredrik Gustafsson <iveqy@iveqy.com> wrote:
\> +--is-well-formed-git-dir [path]::
> + Check if [path] is a valid git-dir or a git-file pointing to a valid
> + git-dir. If [path] is a valid git-dir the resolved path to git-dir will
> + be printed.
May I suggest --is-valid-git-dir?
--
Duy
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3 1/2] rev-parse: add option --is-well-formed-git-dir [path]
2011-08-13 2:49 ` Nguyen Thai Ngoc Duy
@ 2011-08-13 6:13 ` Heiko Voigt
2011-08-14 21:42 ` Junio C Hamano
0 siblings, 1 reply; 10+ messages in thread
From: Heiko Voigt @ 2011-08-13 6:13 UTC (permalink / raw)
To: Nguyen Thai Ngoc Duy; +Cc: Fredrik Gustafsson, git, jens.lehmann, gitster
Hi,
On Sat, Aug 13, 2011 at 09:49:56AM +0700, Nguyen Thai Ngoc Duy wrote:
> On Sat, Aug 13, 2011 at 2:55 AM, Fredrik Gustafsson <iveqy@iveqy.com> wrote:
> \> +--is-well-formed-git-dir [path]::
> > + ?? ?? ?? Check if [path] is a valid git-dir or a git-file pointing to a valid
> > + ?? ?? ?? git-dir. If [path] is a valid git-dir the resolved path to git-dir will
> > + ?? ?? ?? be printed.
>
> May I suggest --is-valid-git-dir?
While we are talking about names how about:
--resolve-git-dir
? Since we had this information already the option prints out the found
resolved git directory and could be used for that.
Cheers Heiko
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3 1/2] rev-parse: add option --is-well-formed-git-dir [path]
2011-08-13 6:13 ` Heiko Voigt
@ 2011-08-14 21:42 ` Junio C Hamano
0 siblings, 0 replies; 10+ messages in thread
From: Junio C Hamano @ 2011-08-14 21:42 UTC (permalink / raw)
To: Heiko Voigt; +Cc: Nguyen Thai Ngoc Duy, Fredrik Gustafsson, git, jens.lehmann
Heiko Voigt <hvoigt@hvoigt.net> writes:
> While we are talking about names how about:
>
> --resolve-git-dir
>
> ? Since we had this information already the option prints out the found
> resolved git directory and could be used for that.
I think we have a winner in the bikeshedding contest.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3 2/2] Move git-dir for submodules
2011-08-12 19:55 ` [PATCH v3 2/2] Move git-dir for submodules Fredrik Gustafsson
@ 2011-08-15 14:30 ` Marc Branchaud
2011-08-15 15:14 ` Fredrik Gustafsson
2011-08-16 17:34 ` Junio C Hamano
1 sibling, 1 reply; 10+ messages in thread
From: Marc Branchaud @ 2011-08-15 14:30 UTC (permalink / raw)
To: Fredrik Gustafsson; +Cc: git, jens.lehmann, hvoigt, gitster
On 11-08-12 03:55 PM, Fredrik Gustafsson wrote:
>
> This patch will not affect already cloned submodules at all.
My question is perhaps a bit beyond the scope of this series...
Is there going to be a way to migrate submodules to the new layout? If the
eventual goal is to be able to delete & restore submodule working
directories, it would be nice if that could work with submodules cloned by an
older git.
M.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3 2/2] Move git-dir for submodules
2011-08-15 14:30 ` Marc Branchaud
@ 2011-08-15 15:14 ` Fredrik Gustafsson
0 siblings, 0 replies; 10+ messages in thread
From: Fredrik Gustafsson @ 2011-08-15 15:14 UTC (permalink / raw)
To: Marc Branchaud; +Cc: Fredrik Gustafsson, git, jens.lehmann, hvoigt, gitster
On Mon, Aug 15, 2011 at 10:30:19AM -0400, Marc Branchaud wrote:
> On 11-08-12 03:55 PM, Fredrik Gustafsson wrote:
> >
> > This patch will not affect already cloned submodules at all.
>
> My question is perhaps a bit beyond the scope of this series...
>
> Is there going to be a way to migrate submodules to the new layout? If the
> eventual goal is to be able to delete & restore submodule working
> directories, it would be nice if that could work with submodules cloned by an
> older git.
>
That's not planned as far as I know. However, a new clone will do that,
(and of course it's quite easy to do it manually).
When git supports to delete and restore submodules that will not be done
if there isn't a .git-FILE in the submodule.
--
Med vänliga hälsningar
Fredrik
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3 2/2] Move git-dir for submodules
2011-08-12 19:55 ` [PATCH v3 2/2] Move git-dir for submodules Fredrik Gustafsson
2011-08-15 14:30 ` Marc Branchaud
@ 2011-08-16 17:34 ` Junio C Hamano
1 sibling, 0 replies; 10+ messages in thread
From: Junio C Hamano @ 2011-08-16 17:34 UTC (permalink / raw)
To: Fredrik Gustafsson; +Cc: git, jens.lehmann, hvoigt
Fredrik Gustafsson <iveqy@iveqy.com> writes:
> diff --git a/git-submodule.sh b/git-submodule.sh
> index bc1d3fa..ace6c1d 100755
> --- a/git-submodule.sh
> +++ b/git-submodule.sh
> @@ -122,14 +122,53 @@ module_clone()
> path=$1
> url=$2
> reference="$3"
> + gitdir=
> + gitdir_base=
> + name=$(module_name "$path")
> + if test -z "$name"
> + then
> + name="$path"
> + fi
This conditional is not needed; module_name dies when it cannot find the
name for the path, as it should.
If the defaulting to the path itself were a good idea (which I do not
think it is), that should be done in module_name so that other callers
that tried to find the name for a given path that does not have a named
module would get a consistent result.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2011-08-16 17:34 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-12 19:55 [PATCH v3 0/2] submodule: move gitdir into superproject Fredrik Gustafsson
2011-08-12 19:55 ` [PATCH v3 1/2] rev-parse: add option --is-well-formed-git-dir [path] Fredrik Gustafsson
2011-08-12 20:57 ` Junio C Hamano
2011-08-13 2:49 ` Nguyen Thai Ngoc Duy
2011-08-13 6:13 ` Heiko Voigt
2011-08-14 21:42 ` Junio C Hamano
2011-08-12 19:55 ` [PATCH v3 2/2] Move git-dir for submodules Fredrik Gustafsson
2011-08-15 14:30 ` Marc Branchaud
2011-08-15 15:14 ` Fredrik Gustafsson
2011-08-16 17:34 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).