git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/2] submodule: port resolve_relative_url from shell to C

From
Duy Nguyen <pclouds@gmail.com>
Date
Feb 27, 2016, 08:28 UTC
Message-ID
<20160227082821.GA14856@lanh>
In-Reply-To
<1455320356-15778-2-git-send-email-sbeller@google.com>
On Fri, Feb 12, 2016 at 03:39:15PM -0800, Stefan Beller wrote:
Show 16 quoted lines
> Later on we want to automatically call `git submodule init` from
> other commands, such that the users don't have to initialize the
> submodule themselves.  As these other commands are written in C
> already, we'd need the init functionality in C, too.  The
> `resolve_relative_url` function is a large part of that init
> functionality, so start by porting this function to C.
> 
> To create the tests in t0060, the function `resolve_relative_url`
> was temporarily enhanced to write all inputs and output to disk
> when running the test suite. The added tests in this patch are
> a small selection thereof.
> 
> Signed-off-by: Stefan Beller <sbeller@google.com>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
>  builtin/submodule--helper.c | 208 +++++++++++++++++++++++++++++++++++++++++++-
i18n fixes. Can you squash this patch in when it's re-rolled?
-- 8< --
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index f4a0fd7..a6e54fa 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -22,7 +22,7 @@ static char *get_default_remote(void)
 	const char *refname = resolve_ref_unsafe("HEAD", 0, sha1, &flag);
 
 	if (!refname)
-		die("No such ref: HEAD");
+		die(_("No such ref: %s"), "HEAD");
 
 	/* detached HEAD */
 	if (!strcmp(refname, "HEAD"))
-- 8< --
Previous: Junio C HamanoNext: Johannes Sixt
Message 4 of 9 in “Port `git submodule init` from shell to C”
  1. 0/2 Port `git submodule init` from shell to CStefan Beller, Feb 12, 2016
  2. 1/2 submodule: port resolve_relative_url from shell to CStefan Beller, Feb 12, 2016
  3. Junio C HamanoFeb 18, 2016
  4. Duy NguyenFeb 27, 2016
  5. Johannes SixtMar 2, 2016
  6. Stefan BellerMar 2, 2016
  7. 2/2 submodule: port init from shell to CStefan Beller, Feb 12, 2016
  8. Junio C HamanoFeb 18, 2016
  9. Junio C HamanoFeb 18, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.