From: Junio C Hamano <gitster@pobox.com>
To: David Aguilar <davvid@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/2] git-submodule: add "sync" command
Date: Fri, 22 Aug 2008 16:13:17 -0700 [thread overview]
Message-ID: <7vhc9c63ua.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <e1d3f1871f869a0161fb3f0d84777de9e0125023.1219390139.git.davvid@gmail.com> (David Aguilar's message of "Fri, 22 Aug 2008 00:30:51 -0700")
David Aguilar <davvid@gmail.com> writes:
> When a submodule's URL changes upstream, existing submodules
> will be out of sync since their remote.origin.url will still
> be set to the old value.
Ok.
> +#
> +# Sync git urls for submodules
> +# This makes the value for remote.origin.url match the value
> +# specified in .gitmodules.
> +#
> +cmd_sync()
> +{
> + while test $# -ne 0
> + do
> + case "$1" in
> + -q|--quiet)
> + quiet=1
> + ;;
> + -*)
> + usage
> + ;;
> + --)
> + shift
> + break
> + ;;
> + *)
> + break
> + ;;
> + esac
> + shift
> + done
> +
> + cd_to_toplevel
> +
> + module_list "$@" |
> + while read mode sha1 stage path
> + do
> + ! test -f "$path"/.git/config &&
> + echo "Warn: submodule at path '$path' does not exist."
> + test -f "$path"/.git/config || continue
> + name=$(module_name "$path")
> + url=$(git config -f .gitmodules --get submodule."$name".url)
> + say "Synchronizing submodule url for '$name'"
> + git config -f "$path"/.git/config remote.origin.url "$url"
> + done
> +}
Hmm. I do not quite like this.
We allow using a gitfile for submodule $GIT_DIR; checking for file
existence of "$path/.git/config" does not work for such a configuration.
Neither does 'git config -f "$path/.git/config"' work. I think it should
be more like:
( unset GIT_DIR; cd "$path" && git config remote.origin.url "$url" )
It is a norm not to have any interest in a submodule that appears in the
index of a superproject. You shouldn't get as many warnings as you have
submodules in such a repository. You should just skip them (which you
already do, but see above), or at least honor "$quiet".
I also think the warning should be sent to the standard error stream.
next prev parent reply other threads:[~2008-08-22 23:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-22 7:30 [PATCH 1/2] git-submodule: replace duplicated code with a module_list function David Aguilar
2008-08-22 7:30 ` [PATCH 2/2] git-submodule: add "sync" command David Aguilar
2008-08-22 23:13 ` Junio C Hamano [this message]
2008-08-22 22:53 ` [PATCH 1/2] git-submodule: replace duplicated code with a module_list function Junio C Hamano
2008-08-23 0:01 ` Mark Levedahl
2008-08-23 0:08 ` Junio C Hamano
2008-08-23 0:36 ` Mark Levedahl
2008-08-23 1:01 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vhc9c63ua.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=davvid@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).