Skip to content

Commit

Permalink
git-submodule - register submodule URL if adding in place
Browse files Browse the repository at this point in the history
When adding a new submodule in place, meaning the user created the
submodule as a git repo in the superproject's tree first, we don't go
through "git submodule init" to register the module.  Thus, the
submodule's origin repository URL is not stored in .git/config, and no
subsequent submodule operation will ever do so.  In this case, assume the
URL the user supplies to "submodule add" is the one that should be
registered, and do so.

Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Mark Levedahl authored and Junio C Hamano committed Jul 15, 2008
1 parent ec05df3 commit c2f9391
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions git-submodule.sh
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,16 @@ cmd_add()
else
die "'$path' already exists and is not a valid git repo"
fi

case "$repo" in
./*|../*)
url=$(resolve_relative_url "$repo") || exit
;;
*)
url="$repo"
;;
esac
git config submodule."$path".url "$url"
else

module_clone "$path" "$realrepo" || exit
Expand Down

0 comments on commit c2f9391

Please sign in to comment.