contrib: Make remotes2config.sh script more robust
The remotes2config.sh script replaced all 'unsafe' characters in repo name with '.'; include '-' in the 'safe' characters set (the set is probably even larger). Script required also space after "URL:", "Push:" and "Pull:" in remotes file. This for example made the following remote URL: git://git.kernel.org/pub/scm/git/git.git Pull: refs/heads/master:refs/heads/origin Pull:+refs/heads/pu:refs/heads/pu miss 'pu' branch (forced branch) in config file after conversion. Allow for any number of whitespace after "URL:", "Push:", "Pull:". Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jakub Narebski committed
Dec 2, 2007 at 20:40 UTC
afa75bc8aa1d453d18cc2486ba8fc53e7df92c4d
1 file changed
+4
-4
contrib/remotes2config.sh
+4
-4
@@ -11,11 +11,11 @@ if [ -d "$GIT_DIR"/remotes ]; then
11
{
12
cd "$GIT_DIR"/remotes
13
ls | while read f; do
14
- name=$(printf "$f" | tr -c "A-Za-z0-9" ".")
14
+ name=$(printf "$f" | tr -c "A-Za-z0-9-" ".")
15
sed -n \
16
- -e "s/^URL: \(.*\)$/remote.$name.url \1 ./p" \
17
- -e "s/^Pull: \(.*\)$/remote.$name.fetch \1 ^$ /p" \
18
- -e "s/^Push: \(.*\)$/remote.$name.push \1 ^$ /p" \
16
+ -e "s/^URL:[ ]*\(.*\)$/remote.$name.url \1 ./p" \
17
+ -e "s/^Pull:[ ]*\(.*\)$/remote.$name.fetch \1 ^$ /p" \
18
+ -e "s/^Push:[ ]*\(.*\)$/remote.$name.push \1 ^$ /p" \
19
< "$f"
20
done
21
echo done