author | Junio C Hamano <gitster@pobox.com> | |
Tue, 19 Jul 2011 16:45:37 +0000 (09:45 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 19 Jul 2011 16:45:37 +0000 (09:45 -0700) |
* jc/submodule-sync-no-auto-vivify:
submodule add: always initialize .git/config entry
submodule sync: do not auto-vivify uninteresting submodule
Conflicts:
git-submodule.sh
submodule add: always initialize .git/config entry
submodule sync: do not auto-vivify uninteresting submodule
Conflicts:
git-submodule.sh
1 | 2 | |||
---|---|---|---|---|
Documentation/git-submodule.txt | patch | | diff1 | | diff2 | | blob | history |
git-submodule.sh | patch | | diff1 | | diff2 | | blob | history |
t/t7403-submodule-sync.sh | patch | | diff1 | | diff2 | | blob | history |
diff --cc Documentation/git-submodule.txt
Simple merge
diff --cc git-submodule.sh
index 87c9452c8a8ae179ffb7e7958ba95688e95bd0e9,ec6178ee996ed72143fbcea88516b6b7e489a720..3daa0c834cad1ed402376adf535c73e1c06172e4
--- 1/git-submodule.sh
--- 2/git-submodule.sh
+++ b/git-submodule.sh
# ash fails to wordsplit ${branch:+-b "$branch"...}
case "$branch" in
'') git checkout -f -q ;;
- ?*) git checkout -f -q -b "$branch" "origin/$branch" ;;
+ ?*) git checkout -f -q -B "$branch" "origin/$branch" ;;
esac
- ) || die "Unable to checkout submodule '$path'"
+ ) || die "$(eval_gettext "Unable to checkout submodule '\$path'")"
fi
+ git config submodule."$path".url "$url"
git add $force "$path" ||
- die "Failed to add submodule '$path'"
+ die "$(eval_gettext "Failed to add submodule '\$path'")"
git config -f .gitmodules submodule."$path".path "$path" &&
git config -f .gitmodules submodule."$path".url "$repo" &&
do
# Skip already registered paths
name=$(module_name "$path") || exit
- url=$(git config submodule."$name".url)
- test -z "$url" || continue
-
- url=$(git config -f .gitmodules submodule."$name".url)
- test -z "$url" &&
- die "$(eval_gettext "No url found for submodule path '\$path' in .gitmodules")"
-
- # Possibly a url relative to parent
- case "$url" in
- ./*|../*)
- url=$(resolve_relative_url "$url") || exit
- ;;
- esac
-
- git config submodule."$name".url "$url" ||
- die "$(eval_gettext "Failed to register url for submodule path '\$path'")"
+ if test -z "$(git config "submodule.$name.url")"
+ then
+ url=$(git config -f .gitmodules submodule."$name".url)
+ test -z "$url" &&
- die "No url found for submodule path '$path' in .gitmodules"
++ die "$(eval_gettext "No url found for submodule path '\$path' in .gitmodules")"
+
+ # Possibly a url relative to parent
+ case "$url" in
+ ./*|../*)
+ url=$(resolve_relative_url "$url") || exit
+ ;;
+ esac
+ git config submodule."$name".url "$url" ||
- die "Failed to register url for submodule path '$path'"
++ die "$(eval_gettext "Failed to register url for submodule path '\$path'")"
+ fi
+ # Copy "update" setting when it is not set yet
upd="$(git config -f .gitmodules submodule."$name".update)"
test -z "$upd" ||
+ test -n "$(git config submodule."$name".update)" ||
git config submodule."$name".update "$upd" ||
- die "Failed to register update mode for submodule path '$path'"
+ die "$(eval_gettext "Failed to register update mode for submodule path '\$path'")"
- say "Submodule '$name' ($url) registered for path '$path'"
+ say "$(eval_gettext "Submodule '\$name' (\$url) registered for path '\$path'")"
done
}
;;
esac
- say "$(eval_gettext "Synchronizing submodule url for '\$name'")"
- git config submodule."$name".url "$url"
-
- if test -e "$path"/.git
+ if git config "submodule.$name.url" >/dev/null 2>/dev/null
then
- (
- clear_local_git_env
- cd "$path"
- remote=$(get_default_remote)
- git config remote."$remote".url "$url"
- )
- say "Synchronizing submodule url for '$name'"
++ say "$(eval_gettext "Synchronizing submodule url for '\$name'")"
+ git config submodule."$name".url "$url"
+
+ if test -e "$path"/.git
+ then
+ (
+ clear_local_git_env
+ cd "$path"
+ remote=$(get_default_remote)
+ git config remote."$remote".url "$url"
+ )
+ fi
fi
done
}
diff --cc t/t7403-submodule-sync.sh
Simple merge