Skip to content

Commit

Permalink
Test for case where we don't have access to a file
Browse files Browse the repository at this point in the history
Test for case where we don't have access to a file.
Quote from Dscho:

> +		} else {
> +			if (p->mod_dst)
> +				die(_("unexpected mode %d\n"), p->mod_dst);

Hmm. This does not match what the shell script version does:

                        *)
                                # unexpected type
                                eval_gettextln "unexpected mode \$mod_dst" >&2
                                continue ;;

I think we should also just write the message to `stderr` and continue,
not `die()`.

In addition to that, I am missing the C code for this case:

                        000000)
                                ;; # removed

It is quite possible that our test suite does not cover this case (or did
the test suite fail for you?). If that is indeed the case, it would be
really good to add a test case as part of this patch series, to gain
confidence in the correctness of the conversion.
=============================================

Since we cover the case already, I have added a comment stating that we
ignore in case of p->mod_dst=0000000.
  • Loading branch information
periperidip committed Jul 18, 2020
1 parent 3ed9370 commit f0f8ba3
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions builtin/submodule--helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -1075,6 +1075,7 @@ static void generate_submodule_summary(struct summary_cb *info,
}
strbuf_release(&sb_hash_object);
} else {
/* for a submodule removal (mode:0000000), don't warn */
if (p->mod_dst)
warning(_("unexpected mode %d\n"), p->mod_dst);
}
Expand Down

0 comments on commit f0f8ba3

Please sign in to comment.