[PATCH 0/2] Port `submodule init` to C

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is another round for sb/submodule-init.

Changes since last round:
* Also iterate over the submodules in the C helper. With that missing piece
  `git submodule init` is completely handled in C now except for the usage
  string and the command->subcommand selection. (i.e. when calling
  `git submodule init`, we still go through git.c -> git-submodule.sh
  -> submodule--helper.c, but we do not go back into the shell after parsing
  `init` and calling module_init for it.
* This applies on another base commit, such that we make use of the tests
  written in origin/sb/submodule-path-misc-bugs. (I am not sure if I have too
  many series in flight stomping on each other here)
* This time I actually fix what Ramsay was hinting at:
  strbuf_detach(&sb, NULL) instead of strbuf_detach(&sb, 0);

Where do these patches apply?
=============================

I ran the following commands for a new starting point of this series:

    git checkout --detach origin/sb/submodule-parallel-update
    git merge origin/sb/submodule-helper-clone-regression-fix
    git merge origin/sb/submodule-path-misc-bugs

The second merge produces 2 conflicts, which can be resolved like this:
(I am unsure about the second comment in strbuf.h though)
diff --cc builtin/fetch.c
index 5aa1c2d,e4639d8..0000000
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@@ -37,7 -37,8 +37,8 @@@ static int prune = -1; /* unspecified *
  static int all, append, dry_run, force, keep, multiple, update_head_ok, verbosity;
  static int progress = -1, recurse_submodules = RECURSE_SUBMODULES_DEFAULT;
  static int tags = TAGS_DEFAULT, unshallow, update_shallow;
 -static int max_children = 1;
 +static int max_children = -1;
+ static enum transport_family family;
  static const char *depth;
  static const char *upload_pack;
  static struct strbuf default_rla = STRBUF_INIT;
diff --cc strbuf.h
index d4f2aa1,f72fd14..0000000
--- a/strbuf.h
+++ b/strbuf.h
@@@ -387,15 -387,10 +387,16 @@@ extern ssize_t strbuf_read_file(struct 
  extern int strbuf_readlink(struct strbuf *sb, const char *path, size_t hint);
  
  /**
 + * Write the whole content of the strbuf to the stream not stopping at
 + * NUL bytes.
 + */
 +extern ssize_t strbuf_write(struct strbuf *sb, FILE *stream);
 +
 +/**
-  * Read a line from a FILE *, overwriting the existing contents
-  * of the strbuf. The second argument specifies the line
-  * terminator character, typically `'\n'`.
+  * Read a line from a FILE *, overwriting the existing contents of
+  * the strbuf.  The strbuf_getline*() family of functions share
+  * this signature, but have different line termination conventions.
+  *
   * Reading stops after the terminator or at EOF.  The terminator
   * is removed from the buffer before returning.  Returns 0 unless
   * there was nothing left before EOF, in which case it returns `EOF`.

As sb/submodule-parallel-update and sb/submodule-helper-clone-regression-fix
both touch builtin/submodule--helper.c, so we need those.

We need origin/sb/submodule-path-misc-bugs as it tests `submodule add`
output.

Thanks,
Stefan

Stefan Beller (2):
  submodule: port resolve_relative_url from shell to C
  submodule: port init from shell to C

 builtin/submodule--helper.c | 322 +++++++++++++++++++++++++++++++++++++++++++-
 git-submodule.sh            | 127 +----------------
 submodule.c                 |  21 +++
 submodule.h                 |   1 +
 t/t0060-path-utils.sh       |  43 ++++++
 5 files changed, 392 insertions(+), 122 deletions(-)

-- 
2.8.0.26.g0341e85

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]