Re: [GSoC][PATCH v2 04/13] submodule: port submodule subcommand 'status' from shell to C
From: Christian Couder <hidden>
Date: 2017-07-30 05:35:53
On Sun, Jul 30, 2017 at 12:23 AM, Prathamesh Chavan [off-list ref] wrote:
+static void print_status(struct status_cb *info, char state, const char *path,
+ const struct object_id *oid, const char *displaypath)
+{
+ if (info->quiet)
+ return;
+
+ printf("%c%s %s", state, oid_to_hex(oid), displaypath);
+
+Spurious new line.
+ if (state == ' ' || state == '+') {
+ struct argv_array name_rev_args = ARGV_ARRAY_INIT;
+
+ argv_array_pushl(&name_rev_args, "print-name-rev",
+ path, oid_to_hex(oid), NULL);
+ print_name_rev(name_rev_args.argc, name_rev_args.argv,
+ info->prefix);
+ } else {
+ printf("\n");
+ }
+}+static void status_submodule(const struct cache_entry *list_item, void *cb_data)
+{
+ struct status_cb *info = cb_data;
+ char *displaypath;
+ struct argv_array diff_files_args = ARGV_ARRAY_INIT;
+
+ if (!submodule_from_path(null_sha1, list_item->name))
+ die(_("no submodule mapping found in .gitmodules for path '%s'"),
+ list_item->name);
+
+ displaypath = get_submodule_displaypath(list_item->name, info->prefix);
+
+ trace_printf("the value of flag is %d\n", list_item->ce_flags);Debugging left over.
+ if (list_item->ce_flags) {
+ trace_printf("for U the value of flag is %d\n", list_item->ce_flags);
+ print_status(info, 'U', list_item->name,
+ &null_oid, displaypath);
+ goto cleanup;
+ }