Merge branch 'os/commit-submodule-ignore' into maint
authorJunio C Hamano <gitster@pobox.com>
Mon, 8 Oct 2012 18:34:34 +0000 (11:34 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 8 Oct 2012 18:34:34 +0000 (11:34 -0700)
"git status" honored the ignore=dirty settings in .gitmodules but
"git commit" didn't.

* os/commit-submodule-ignore:
  commit: pay attention to submodule.$name.ignore in .gitmodules

1  2 
builtin/commit.c

index 62028e7b44b206e9722eef750be8c067aae31b32,3cb1ef73ad2fe9977c90bb76dbe0ff96b10d3cde..7a83cae6ff9d0168c3d9be4241e3cd94f1128a23
@@@ -1445,30 -1253,24 +1445,31 @@@ int cmd_commit(int argc, const char **a
        struct commit_list *parents = NULL, **pptr = &parents;
        struct stat statbuf;
        int allow_fast_forward = 1;
 -      struct wt_status s;
 +      struct commit *current_head = NULL;
 +      struct commit_extra_header *extra = NULL;
 +
 +      if (argc == 2 && !strcmp(argv[1], "-h"))
 +              usage_with_options(builtin_commit_usage, builtin_commit_options);
  
        wt_status_prepare(&s);
+       gitmodules_config();
        git_config(git_commit_config, &s);
 -      in_merge = file_exists(git_path("MERGE_HEAD"));
 -      s.in_merge = in_merge;
 -
 -      if (s.use_color == -1)
 -              s.use_color = git_use_color_default;
 -      argc = parse_and_validate_options(argc, argv, builtin_commit_usage,
 -                                        prefix, &s);
 -      if (dry_run) {
 -              if (diff_use_color_default == -1)
 -                      diff_use_color_default = git_use_color_default;
 -              return dry_run_commit(argc, argv, prefix, &s);
 +      determine_whence(&s);
 +      s.colopts = 0;
 +
 +      if (get_sha1("HEAD", sha1))
 +              current_head = NULL;
 +      else {
 +              current_head = lookup_commit_or_die(sha1, "HEAD");
 +              if (!current_head || parse_commit(current_head))
 +                      die(_("could not parse HEAD commit"));
        }
 -      index_file = prepare_index(argc, argv, prefix, 0);
 +      argc = parse_and_validate_options(argc, argv, builtin_commit_options,
 +                                        builtin_commit_usage,
 +                                        prefix, current_head, &s);
 +      if (dry_run)
 +              return dry_run_commit(argc, argv, prefix, current_head, &s);
 +      index_file = prepare_index(argc, argv, prefix, current_head, 0);
  
        /* Set up everything for writing the commit object.  This includes
           running hooks, writing the trees, and interacting with the user.  */