Merge branch 'hv/submodule-recurse-push'
authorJunio C Hamano <gitster@pobox.com>
Tue, 24 Apr 2012 21:40:20 +0000 (14:40 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 24 Apr 2012 21:40:20 +0000 (14:40 -0700)
"git push --recurse-submodules" learns to optionally look into the
histories of submodules bound to the superproject and push them out.

By Heiko Voigt
* hv/submodule-recurse-push:
  push: teach --recurse-submodules the on-demand option
  Refactor submodule push check to use string list instead of integer
  Teach revision walking machinery to walk multiple times sequencially

1  2 
.gitignore
Documentation/git-push.txt
Makefile
builtin/push.c
object.c
revision.c
submodule.h
transport.c
transport.h

diff --cc .gitignore
Simple merge
Simple merge
diff --cc Makefile
Simple merge
diff --cc builtin/push.c
Simple merge
diff --cc object.c
Simple merge
diff --cc revision.c
Simple merge
diff --cc submodule.h
Simple merge
diff --cc transport.c
index 2dfac700b630aabb2d1014c51a08889b3a3bae82,4177b7d6091c0b11491d77815df69c6da8ed23fb..1811b500d92b1120a01d0ac09f86c0218f3d163b
@@@ -1002,17 -994,32 +1003,36 @@@ void transport_set_verbosity(struct tra
         * Rules used to determine whether to report progress (processing aborts
         * when a rule is satisfied):
         *
 -       *   1. Report progress, if force_progress is 1 (ie. --progress).
 -       *   2. Don't report progress, if verbosity < 0 (ie. -q/--quiet ).
 -       *   3. Report progress if isatty(2) is 1.
 +       *   . Report progress, if force_progress is 1 (ie. --progress).
 +       *   . Don't report progress, if force_progress is 0 (ie. --no-progress).
 +       *   . Don't report progress, if verbosity < 0 (ie. -q/--quiet ).
 +       *   . Report progress if isatty(2) is 1.
         **/
 -      transport->progress = force_progress || (verbosity >= 0 && isatty(2));
 +      if (force_progress >= 0)
 +              transport->progress = !!force_progress;
 +      else
 +              transport->progress = verbosity >= 0 && isatty(2);
  }
  
+ static void die_with_unpushed_submodules(struct string_list *needs_pushing)
+ {
+       int i;
+       fprintf(stderr, "The following submodule paths contain changes that can\n"
+                       "not be found on any remote:\n");
+       for (i = 0; i < needs_pushing->nr; i++)
+               printf("  %s\n", needs_pushing->items[i].string);
+       fprintf(stderr, "\nPlease try\n\n"
+                       "       git push --recurse-submodules=on-demand\n\n"
+                       "or cd to the path and use\n\n"
+                       "       git push\n\n"
+                       "to push them to a remote.\n\n");
+       string_list_clear(needs_pushing, 0);
+       die("Aborting.");
+ }
  int transport_push(struct transport *transport,
                   int refspec_nr, const char **refspec, int flags,
                   int *nonfastforward)
diff --cc transport.h
index 1631a35ea6332fb07e993ce42042ba9c8d037a21,c6bee7061310d5d4ec9503f5dee0b4627c8b9576..b866c126e695810131cdab537b8b994c0c32e14e
@@@ -102,7 -102,7 +102,8 @@@ struct transport 
  #define TRANSPORT_PUSH_PORCELAIN 16
  #define TRANSPORT_PUSH_SET_UPSTREAM 32
  #define TRANSPORT_RECURSE_SUBMODULES_CHECK 64
 +#define TRANSPORT_PUSH_PRUNE 128
+ #define TRANSPORT_RECURSE_SUBMODULES_ON_DEMAND 256
  
  #define TRANSPORT_SUMMARY_WIDTH (2 * DEFAULT_ABBREV + 3)