Re: [GSoC][PATCH v2 04/13] submodule: port submodule subcommand 'status' from shell to C
On Sun, Jul 30, 2017 at 12:23 AM, Prathamesh Chavan <pc44800@gmail.com> wrote:
Show 9 quoted lines
> +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);
> +
> +Show 11 quoted lines
> + 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");
> + }
> +}Show 13 quoted lines
> +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);Show 6 quoted lines
> + 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;
> + }