Merge branch 'sb/submodule-path-misc-bugs' into sb/submodule-init
authorJunio C Hamano <gitster@pobox.com>
Thu, 14 Apr 2016 19:47:44 +0000 (12:47 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 14 Apr 2016 19:47:45 +0000 (12:47 -0700)
"git submodule" reports the paths of submodules the command
recurses into, but this was incorrect when the command was not run
from the root level of the superproject.

Any further comments? Otherwise will merge to 'next'.

* sb/submodule-path-misc-bugs: (600 commits)
t7407: make expectation as clear as possible
submodule update: test recursive path reporting from subdirectory
submodule update: align reporting path for custom command execution
submodule status: correct path handling in recursive submodules
submodule update --init: correct path handling in recursive submodules
submodule foreach: correct path display in recursive submodules
Git 2.8
Documentation: fix git-p4 AsciiDoc formatting
mingw: skip some tests in t9115 due to file name issues
t1300: fix the new --show-origin tests on Windows
t1300-repo-config: make it resilient to being run via 'sh -x'
config --show-origin: report paths with forward slashes
submodule: fix regression for deinit without submodules
l10n: pt_PT: Update and add new translations
l10n: ca.po: update translation
Git 2.8-rc4
Documentation: fix broken linkgit to git-config
Documentation: use ASCII quotation marks in git-p4
Revert "config.mak.uname: use clang for Mac OS X 10.6"
git-compat-util: st_add4: work around gcc 4.2.x compiler crash
...

16 files changed:
1  2 
Documentation/config.txt
Documentation/git-clone.txt
builtin/clone.c
builtin/fetch.c
builtin/submodule--helper.c
git-submodule.sh
run-command.c
run-command.h
strbuf.c
strbuf.h
submodule-config.c
submodule-config.h
submodule.c
submodule.h
t/t7400-submodule-basic.sh
t/t7406-submodule-update.sh
Simple merge
Simple merge
diff --cc builtin/clone.c
Simple merge
diff --cc builtin/fetch.c
index 5aa1c2de449dde74c1aa97d41b571aa22d5e03cf,e4639d8eb1d5fda586520f10271c05a0897f2ea5..f8455bde7a84e110da182d56f62ac3f89026f55c
@@@ -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;
Simple merge
index 86018ee9c5d66048fc360c76843029311fe1302d,753a90d3071d1917495ca725fe15a944f84b6f60..07290d07ae2012714702b287d7ddcd357038b449
@@@ -740,12 -763,24 +758,17 @@@ cmd_update(
                        then
                                # Run fetch only if $sha1 isn't present or it
                                # is not reachable from a ref.
-                               (clear_local_git_env; cd "$sm_path" &&
-                                       ( (rev=$(git rev-list -n 1 $sha1 --not --all 2>/dev/null) &&
-                                        test -z "$rev") || git-fetch)) ||
+                               is_tip_reachable "$sm_path" "$sha1" ||
+                               fetch_in_submodule "$sm_path" ||
                                die "$(eval_gettext "Unable to fetch in submodule path '\$displaypath'")"
+                               # Now we tried the usual fetch, but $sha1 may
+                               # not be reachable from any of the refs
+                               is_tip_reachable "$sm_path" "$sha1" ||
+                               fetch_in_submodule "$sm_path" "$sha1" ||
+                               die "$(eval_gettext "Fetched in submodule path '\$displaypath', but it did not contain $sha1. Direct fetching of that commit failed.")"
                        fi
  
 -                      # Is this something we just cloned?
 -                      case ";$cloned_modules;" in
 -                      *";$name;"*)
 -                              # then there is no local change to integrate
 -                              update_module=checkout ;;
 -                      esac
 -
                        must_die_on_failure=
                        case "$update_module" in
                        checkout)
diff --cc run-command.c
Simple merge
diff --cc run-command.h
Simple merge
diff --cc strbuf.c
Simple merge
diff --cc strbuf.h
index d4f2aa1365d52e80d5601f8c298024bd82a95fa7,f72fd14c2eaded0399b779150ea1565edd7bf47a..7987405313de3a8779e338129af62f9286c9985c
+++ b/strbuf.h
@@@ -386,16 -386,11 +386,17 @@@ 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`.
Simple merge
Simple merge
diff --cc submodule.c
Simple merge
diff --cc submodule.h
Simple merge
Simple merge
Simple merge