git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Atharva Raykar <raykar.ath@gmail.com>
To: raykar.ath@gmail.com
Cc: avarab@gmail.com, christian.couder@gmail.com,
	congdanhqx@gmail.com, emilyshaffer@google.com,
	git@vger.kernel.org, gitster@pobox.com, jrnieder@gmail.com,
	kaartic.sivaraam@gmail.com, pc44800@gmail.com,
	periperidip@gmail.com, rafaeloliveira.cs@gmail.com,
	sunshine@sunshineco.com
Subject: [GSoC] [PATCH v5 0/9] submodule: convert the rest of 'add' to C
Date: Tue, 10 Aug 2021 17:16:32 +0530	[thread overview]
Message-ID: <20210810114641.27188-1-raykar.ath@gmail.com> (raw)
In-Reply-To: <20210807071613.99610-1-raykar.ath@gmail.com>

NOTE: This series uses (ar/submodule-add-config):
https://lore.kernel.org/git/20210806140431.92018-1-raykar.ath@gmail.com/

Since v4:
* Rename a local variable in 'compute_submodule_clone_url()' to reduce ambiguity.
* Add a new patch that renames 'compute_submodule_clone_url()' to
  'resolve_relative_url()' to better convey its use. We add it at the end after
  the 'resolve-relative-url' subcommand is removed so that there is no confusion
  as to what that function name binds to.
* Fix incorrect example in the docstring for 'git_url_basename()'. Also add
  another example for more clarity.

Also since this query of mine got buried in the revisions, I shall include it
here again:

Questions about the cache API used in [PATCH 5/9]:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1. What is the difference between 'read_cache()' and 'read_cache_preload()'?
     From what I can tell, the latter optimistically preloads the index stat
     data. Is there any reason to use 'read_cache()' over
     'read_cache_preload()'?
  2. Which one is more appropriate for use in 'die_on_index_match()'?

Fetch-it-Via:
git fetch https://github.com/tfidfwastaken/git submodule-helper-add-list-5

Atharva Raykar (9):
  submodule--helper: add options for compute_submodule_clone_url()
  submodule--helper: refactor resolve_relative_url() helper
  submodule--helper: remove repeated code in sync_submodule()
  dir: libify and export helper functions from clone.c
  submodule--helper: convert the bulk of cmd_add() to C
  submodule--helper: remove add-clone subcommand
  submodule--helper: remove add-config subcommand
  submodule--helper: remove resolve-relative-url subcommand
  submodule--helper: rename compute_submodule_clone_url()

 builtin/clone.c             | 118 +-------------
 builtin/submodule--helper.c | 307 +++++++++++++++++++-----------------
 dir.c                       | 114 +++++++++++++
 dir.h                       |  11 ++
 git-submodule.sh            |  96 +----------
 5 files changed, 291 insertions(+), 355 deletions(-)

Range-diff against v4:
 1:  75edf24186 !  1:  78e19c4b01 submodule--helper: add options for compute_submodule_clone_url()
    @@ Commit message
         `resolve_relative_url()` by using this function, something we will do in
         the next patch.
     
    +    We also rename the local variable 'relurl' to avoid potential confusion
    +    with the 'rel_url' parameter while we are at it.
    +
         Having this functionality factored out will be useful for converting the
         rest of `submodule add` in subsequent patches.
     
    @@ builtin/submodule--helper.c: static int module_foreach(int argc, const char **ar
     -static char *compute_submodule_clone_url(const char *rel_url)
     +static char *compute_submodule_clone_url(const char *rel_url, const char *up_path, int quiet)
      {
    - 	char *remoteurl, *relurl;
    +-	char *remoteurl, *relurl;
    ++	char *remoteurl, *resolved_url;
      	char *remote = get_default_remote();
    -@@ builtin/submodule--helper.c: static char *compute_submodule_clone_url(const char *rel_url)
    + 	struct strbuf remotesb = STRBUF_INIT;
      
      	strbuf_addf(&remotesb, "remote.%s.url", remote);
      	if (git_config_get_string(remotesb.buf, &remoteurl)) {
    @@ builtin/submodule--helper.c: static char *compute_submodule_clone_url(const char
      		remoteurl = xgetcwd();
      	}
     -	relurl = relative_url(remoteurl, rel_url, NULL);
    -+	relurl = relative_url(remoteurl, rel_url, up_path);
    ++	resolved_url = relative_url(remoteurl, rel_url, up_path);
      
      	free(remote);
      	free(remoteurl);
    + 	strbuf_release(&remotesb);
    + 
    +-	return relurl;
    ++	return resolved_url;
    + }
    + 
    + struct init_cb {
     @@ builtin/submodule--helper.c: static void init_submodule(const char *path, const char *prefix,
      		if (starts_with_dot_dot_slash(url) ||
      		    starts_with_dot_slash(url)) {
 2:  8e7a3e727a !  2:  faadf74ec1 submodule--helper: refactor resolve_relative_url() helper
    @@ builtin/submodule--helper.c: static char *relative_url(const char *remote_url,
     +static char *compute_submodule_clone_url(const char *rel_url, const char *up_path, int quiet)
      {
     -	char *remoteurl = NULL;
    -+	char *remoteurl, *relurl;
    ++	char *remoteurl, *resolved_url;
      	char *remote = get_default_remote();
     +	struct strbuf remotesb = STRBUF_INIT;
     +
    @@ builtin/submodule--helper.c: static char *relative_url(const char *remote_url,
     +				remotesb.buf);
     +		remoteurl = xgetcwd();
     +	}
    -+	relurl = relative_url(remoteurl, rel_url, up_path);
    ++	resolved_url = relative_url(remoteurl, rel_url, up_path);
     +
     +	free(remote);
     +	free(remoteurl);
     +	strbuf_release(&remotesb);
     +
    -+	return relurl;
    ++	return resolved_url;
     +}
     +
     +static int resolve_relative_url(int argc, const char **argv, const char *prefix)
    @@ builtin/submodule--helper.c: static int module_foreach(int argc, const char **ar
      
     -static char *compute_submodule_clone_url(const char *rel_url, const char *up_path, int quiet)
     -{
    --	char *remoteurl, *relurl;
    +-	char *remoteurl, *resolved_url;
     -	char *remote = get_default_remote();
     -	struct strbuf remotesb = STRBUF_INIT;
     -
    @@ builtin/submodule--helper.c: static int module_foreach(int argc, const char **ar
     -				remotesb.buf);
     -		remoteurl = xgetcwd();
     -	}
    --	relurl = relative_url(remoteurl, rel_url, up_path);
    +-	resolved_url = relative_url(remoteurl, rel_url, up_path);
     -
     -	free(remote);
     -	free(remoteurl);
     -	strbuf_release(&remotesb);
     -
    --	return relurl;
    +-	return resolved_url;
     -}
     -
      struct init_cb {
 3:  82961ddd02 =  3:  d2127bd09a submodule--helper: remove repeated code in sync_submodule()
 4:  fa97d6801e !  4:  4b05f93def dir: libify and export helper functions from clone.c
    @@ dir.h: static inline int is_dot_or_dotdot(const char *name)
     + *
     + * For example:
     + * 	/path/to/repo.git => "repo"
    -+ * 	host.xz.foo/.git => "foo"
    ++ * 	host.xz:foo/.git => "foo"
    ++ * 	http://example.com/user/bar.baz => "bar.baz"
     + */
     +char *git_url_basename(const char *repo, int is_bundle, int is_bare);
     +void strip_dir_trailing_slashes(char *dir);
 5:  a3aa25518d =  5:  1491a011b0 submodule--helper: convert the bulk of cmd_add() to C
 6:  9667159d4b =  6:  5d5d07a6ba submodule--helper: remove add-clone subcommand
 7:  dc87b5627a =  7:  0ea27c2a15 submodule--helper: remove add-config subcommand
 8:  ea08e4fbad !  8:  6bd2571f73 submodule--helper: remove resolve-relative-url subcommand
    @@ Commit message
     
      ## builtin/submodule--helper.c ##
     @@ builtin/submodule--helper.c: static char *compute_submodule_clone_url(const char *rel_url, const char *up_pat
    - 	return relurl;
    + 	return resolved_url;
      }
      
     -static int resolve_relative_url(int argc, const char **argv, const char *prefix)
 -:  ---------- >  9:  14a05a0c1d submodule--helper: rename compute_submodule_clone_url()
-- 
2.32.0


  parent reply	other threads:[~2021-08-10 11:47 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-05  7:19 [GSoC] [PATCH 0/8] submodule: convert the rest of 'add' to C Atharva Raykar
2021-08-05  7:19 ` [GSoC] [PATCH 1/8] submodule--helper: refactor resolve_relative_url() helper Atharva Raykar
2021-08-05  7:19 ` [GSoC] [PATCH 2/8] submodule--helper: remove repeated code in sync_submodule() Atharva Raykar
2021-08-06  0:53   ` Đoàn Trần Công Danh
2021-08-06  9:06     ` Christian Couder
2021-08-06 10:06       ` Atharva Raykar
2021-08-06 16:21       ` Junio C Hamano
2021-08-05  7:19 ` [GSoC] [PATCH 3/8] dir: libify and export helper functions from clone.c Atharva Raykar
2021-08-05  7:19 ` [GSoC] [PATCH 4/8] submodule--helper: remove constness of sm_path Atharva Raykar
2021-08-05  7:19 ` [GSoC] [PATCH 5/8] submodule--helper: convert the bulk of cmd_add() to C Atharva Raykar
2021-08-05  7:19 ` [GSoC] [PATCH 6/8] submodule--helper: remove add-clone subcommand Atharva Raykar
2021-08-05  7:19 ` [GSoC] [PATCH 7/8] submodule--helper: remove add-config subcommand Atharva Raykar
2021-08-05  7:19 ` [GSoC] [PATCH 8/8] submodule--helper: remove resolve-relative-url subcommand Atharva Raykar
2021-08-05  7:40 ` [GSoC] [PATCH v2 0/9] submodule: convert the rest of 'add' to C Atharva Raykar
2021-08-05  7:40   ` [GSoC] [PATCH v2 1/9] submodule--helper: add options for compute_submodule_clone_url() Atharva Raykar
2021-08-05 20:05     ` Junio C Hamano
2021-08-05  7:40   ` [GSoC] [PATCH v2 2/9] submodule--helper: refactor resolve_relative_url() helper Atharva Raykar
2021-08-05 20:13     ` Junio C Hamano
2021-08-05  7:40   ` [GSoC] [PATCH v2 3/9] submodule--helper: remove repeated code in sync_submodule() Atharva Raykar
2021-08-05 20:20     ` Junio C Hamano
2021-08-05  7:40   ` [GSoC] [PATCH v2 4/9] dir: libify and export helper functions from clone.c Atharva Raykar
2021-08-05 20:37     ` Junio C Hamano
2021-08-06 11:12       ` Atharva Raykar
2021-08-06 16:36         ` Junio C Hamano
2021-08-07  7:15           ` Atharva Raykar
2021-08-05  7:40   ` [GSoC] [PATCH v2 5/9] submodule--helper: remove constness of sm_path Atharva Raykar
2021-08-05 20:40     ` Junio C Hamano
2021-08-06 11:16       ` Atharva Raykar
2021-08-05  7:40   ` [GSoC] [PATCH v2 6/9] submodule--helper: convert the bulk of cmd_add() to C Atharva Raykar
2021-08-06  1:14     ` Đoàn Trần Công Danh
2021-08-06 11:33       ` Atharva Raykar
2021-08-05  7:40   ` [GSoC] [PATCH v2 7/9] submodule--helper: remove add-clone subcommand Atharva Raykar
2021-08-05  7:40   ` [GSoC] [PATCH v2 8/9] submodule--helper: remove add-config subcommand Atharva Raykar
2021-08-05  7:40   ` [GSoC] [PATCH v2 9/9] submodule--helper: remove resolve-relative-url subcommand Atharva Raykar
2021-08-06 12:01   ` [GSoC] [PATCH v3 0/8] submodule: convert the rest of 'add' to C Atharva Raykar
2021-08-06 12:01     ` [GSoC] [PATCH v3 1/8] submodule--helper: add options for compute_submodule_clone_url() Atharva Raykar
2021-08-06 12:01     ` [GSoC] [PATCH v3 2/8] submodule--helper: refactor resolve_relative_url() helper Atharva Raykar
2021-08-06 12:01     ` [GSoC] [PATCH v3 3/8] submodule--helper: remove repeated code in sync_submodule() Atharva Raykar
2021-08-06 12:01     ` [GSoC] [PATCH v3 4/8] dir: libify and export helper functions from clone.c Atharva Raykar
2021-08-06 12:01     ` [GSoC] [PATCH v3 5/8] submodule--helper: convert the bulk of cmd_add() to C Atharva Raykar
2021-08-06 12:01     ` [GSoC] [PATCH v3 6/8] submodule--helper: remove add-clone subcommand Atharva Raykar
2021-08-06 12:01     ` [GSoC] [PATCH v3 7/8] submodule--helper: remove add-config subcommand Atharva Raykar
2021-08-06 12:01     ` [GSoC] [PATCH v3 8/8] submodule--helper: remove resolve-relative-url subcommand Atharva Raykar
2021-08-07  7:16     ` [GSoC] [PATCH v4 0/8] submodule: convert the rest of 'add' to C Atharva Raykar
2021-08-07  7:16       ` [GSoC] [PATCH v4 1/8] submodule--helper: add options for compute_submodule_clone_url() Atharva Raykar
2021-08-08 17:41         ` Kaartic Sivaraam
2021-08-08 18:26           ` Kaartic Sivaraam
2021-08-09  7:29             ` Atharva Raykar
2021-08-09  8:47               ` Atharva Raykar
2021-08-10 17:36                 ` Kaartic Sivaraam
2021-08-07  7:16       ` [GSoC] [PATCH v4 2/8] submodule--helper: refactor resolve_relative_url() helper Atharva Raykar
2021-08-07  7:16       ` [GSoC] [PATCH v4 3/8] submodule--helper: remove repeated code in sync_submodule() Atharva Raykar
2021-08-08 19:00         ` Kaartic Sivaraam
2021-08-09  7:36           ` Atharva Raykar
2021-08-07  7:16       ` [GSoC] [PATCH v4 4/8] dir: libify and export helper functions from clone.c Atharva Raykar
2021-08-08 19:23         ` Kaartic Sivaraam
2021-08-09  8:02           ` Atharva Raykar
2021-08-10 17:53             ` Kaartic Sivaraam
2021-08-10 21:27               ` Junio C Hamano
2021-08-11 10:25               ` Atharva Raykar
2021-08-07  7:16       ` [GSoC] [PATCH v4 5/8] submodule--helper: convert the bulk of cmd_add() to C Atharva Raykar
2021-08-07  7:16       ` [GSoC] [PATCH v4 6/8] submodule--helper: remove add-clone subcommand Atharva Raykar
2021-08-07  7:16       ` [GSoC] [PATCH v4 7/8] submodule--helper: remove add-config subcommand Atharva Raykar
2021-08-07  7:16       ` [GSoC] [PATCH v4 8/8] submodule--helper: remove resolve-relative-url subcommand Atharva Raykar
2021-08-08 18:01       ` [GSoC] [PATCH v4 0/8] submodule: convert the rest of 'add' to C Kaartic Sivaraam
2021-08-10 11:46       ` Atharva Raykar [this message]
2021-08-10 11:46         ` [GSoC] [PATCH v5 1/9] submodule--helper: add options for compute_submodule_clone_url() Atharva Raykar
2021-08-11  6:44           ` Bagas Sanjaya
2021-08-11 10:30             ` Atharva Raykar
2021-08-10 11:46         ` [GSoC] [PATCH v5 2/9] submodule--helper: refactor resolve_relative_url() helper Atharva Raykar
2021-08-10 11:46         ` [GSoC] [PATCH v5 3/9] submodule--helper: remove repeated code in sync_submodule() Atharva Raykar
2021-08-10 11:46         ` [GSoC] [PATCH v5 4/9] dir: libify and export helper functions from clone.c Atharva Raykar
2021-08-10 11:46         ` [GSoC] [PATCH v5 5/9] submodule--helper: convert the bulk of cmd_add() to C Atharva Raykar
2021-08-10 11:46         ` [GSoC] [PATCH v5 6/9] submodule--helper: remove add-clone subcommand Atharva Raykar
2021-08-10 11:46         ` [GSoC] [PATCH v5 7/9] submodule--helper: remove add-config subcommand Atharva Raykar
2021-08-10 11:46         ` [GSoC] [PATCH v5 8/9] submodule--helper: remove resolve-relative-url subcommand Atharva Raykar
2021-08-10 11:46         ` [GSoC] [PATCH v5 9/9] submodule--helper: rename compute_submodule_clone_url() Atharva Raykar
2021-09-08  0:31         ` [GSoC] [PATCH v5 0/9] submodule: convert the rest of 'add' to C 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=20210810114641.27188-1-raykar.ath@gmail.com \
    --to=raykar.ath@gmail.com \
    --cc=avarab@gmail.com \
    --cc=christian.couder@gmail.com \
    --cc=congdanhqx@gmail.com \
    --cc=emilyshaffer@google.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    --cc=kaartic.sivaraam@gmail.com \
    --cc=pc44800@gmail.com \
    --cc=periperidip@gmail.com \
    --cc=rafaeloliveira.cs@gmail.com \
    --cc=sunshine@sunshineco.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.
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).