git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Mark Levedahl <mlevedahl@gmail.com>
To: gitster@pobox.com, davvid@gmail.com
Cc: git@vger.kernel.org, Mark Levedahl <mlevedahl@gmail.com>
Subject: [PATCH] git-submodule - Use "get_default_remote" from git-parse-remote
Date: Sun, 24 Aug 2008 14:46:10 -0400	[thread overview]
Message-ID: <1219603570-516-1-git-send-email-mlevedahl@gmail.com> (raw)
In-Reply-To: <e21617f50ffaae98ab73fa364e40440397bcbe33.1219598198.git.davvid@gmail.com>

Resolve_relative_url was using its own code for this function, but
this is duplication with the best result that this continues to work.
Replace with the common function provided by git-parse-remote.

Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
---

I think it makes more sense to use the facility provided elsewhere rather
than duplicate. (I've had this patch in my tree for quite a while, never
really had a reason to submit it.)


 git-submodule.sh |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/git-submodule.sh b/git-submodule.sh
index 2a3a197..59fe7b3 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -9,6 +9,7 @@ USAGE="[--quiet] [--cached] \
 [--] [<path>...]|[foreach <command>]"
 OPTIONS_SPEC=
 . git-sh-setup
+. git-parse-remote
 require_work_tree

 command=
@@ -30,9 +31,7 @@ say()
 # Resolve relative url by appending to parent's url
 resolve_relative_url ()
 {
-	branch="$(git symbolic-ref HEAD 2>/dev/null)"
-	remote="$(git config branch.${branch#refs/heads/}.remote)"
-	remote="${remote:-origin}"
+	remote=$(get_default_remote)
 	remoteurl=$(git config "remote.$remote.url") ||
 		die "remote ($remote) does not have a url defined in .git/config"
 	url="$1"
--
1.6.0.127.gf1d7c

  parent reply	other threads:[~2008-08-24 18:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-24 17:21 git-submodule: add "sync" command (v2) David Aguilar
2008-08-24 17:21 ` [PATCH 1/3] git-submodule: add a get_remote function David Aguilar
2008-08-24 17:21   ` [PATCH 2/3] git-submodule: use get_remote in resolve_relative_url David Aguilar
2008-08-24 17:21     ` [PATCH 3/3] git-submodule: add "sync" command David Aguilar
2008-08-24 18:57       ` Junio C Hamano
2008-08-24 19:23         ` David Aguilar
2008-08-24 19:43         ` [PATCH v3] " David Aguilar
2008-08-27  8:43           ` David Aguilar
2008-08-27 17:39             ` Junio C Hamano
2008-08-24 21:29         ` [PATCH 3/3] " Mark Levedahl
2008-08-24 18:55     ` [PATCH 2/3] git-submodule: use get_remote in resolve_relative_url Junio C Hamano
2008-08-24 19:18       ` Junio C Hamano
2008-08-24 18:46   ` Mark Levedahl [this message]
2008-08-24 19:07     ` [PATCH] git-submodule - Use "get_default_remote" from git-parse-remote 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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1219603570-516-1-git-send-email-mlevedahl@gmail.com \
    --to=mlevedahl@gmail.com \
    --cc=davvid@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).