summaryrefslogtreecommitdiff
path: root/builtin/submodule--helper.c
diff options
context:
space:
mode:
authorLibravatar Shourya Shukla <shouryashukla.oo@gmail.com>2020-08-27 23:15:01 +0530
committerLibravatar Junio C Hamano <gitster@pobox.com>2020-08-27 11:47:10 -0700
commitd79b14556922e5b7139268e92f2dface8d174278 (patch)
tree2ab668dcc18b4caac5577af079df096b7e6c3600 /builtin/submodule--helper.c
parentsubmodule: fix style in function definition (diff)
downloadtgif-d79b14556922e5b7139268e92f2dface8d174278.tar.xz
t7421: eliminate 'grep' check in t7421.4 for mingw compatibility
The 'grep' check in test 4 of t7421 resulted in the failure of t7421 on Windows due to a different error message error: cannot spawn git: No such file or directory instead of fatal: exec 'rev-parse': cd to 'my-subm' failed: No such file or directory Tighten up the check to compute 'src_abbrev' by guarding the 'verify_submodule_committish()' call using `p->status !='D'`, so that the former isn't called in case of non-existent submodule directory, consequently, there is no such error message on any execution environment. The same need not be implemented for 'dst_abbrev' and is rather redundant since the conditional 'if (S_ISGITLINK(p->mod_dst))' already guards the 'verify_submodule_committish()' when we have a status of 'D'. Therefore, eliminate the 'grep' check in t7421. Instead, verify the absence of an error message by doing a 'test_must_be_empty' on the file containing the error. Reported-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Helped-by: Kaartic Sivaraam <kaartic.sivaraam@gmail.com> Mentored-by: Christian Couder <chriscool@tuxfamily.org> Mentored-by: Kaartic Sivaraam <kaartic.sivaraam@gmail.com> Signed-off-by: Shourya Shukla <shouryashukla.oo@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/submodule--helper.c')
-rw-r--r--builtin/submodule--helper.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 93d0700891..1db1176e48 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -1035,7 +1035,7 @@ static void print_submodule_summary(struct summary_cb *info, char *errmsg,
static void generate_submodule_summary(struct summary_cb *info,
struct module_cb *p)
{
- char *displaypath, *src_abbrev, *dst_abbrev;
+ char *displaypath, *src_abbrev = NULL, *dst_abbrev;
int missing_src = 0, missing_dst = 0;
char *errmsg = NULL;
int total_commits = -1;
@@ -1061,8 +1061,9 @@ static void generate_submodule_summary(struct summary_cb *info,
}
if (S_ISGITLINK(p->mod_src)) {
- src_abbrev = verify_submodule_committish(p->sm_path,
- oid_to_hex(&p->oid_src));
+ if (p->status != 'D')
+ src_abbrev = verify_submodule_committish(p->sm_path,
+ oid_to_hex(&p->oid_src));
if (!src_abbrev) {
missing_src = 1;
/*