mirror of
https://github.com/git/git
synced 2024-08-27 03:29:21 +00:00
Merge branch 'mg/submodule-status-from-a-subdirectory'
"git submodule status" that is run from a subdirectory of the superproject did not work well, which has been corrected. * mg/submodule-status-from-a-subdirectory: submodule: fix 'submodule status' when called from a subdirectory
This commit is contained in:
commit
88cf80949e
|
@ -802,7 +802,8 @@ static void status_submodule(const char *path, const struct object_id *ce_oid,
|
||||||
path, NULL);
|
path, NULL);
|
||||||
|
|
||||||
git_config(git_diff_basic_config, NULL);
|
git_config(git_diff_basic_config, NULL);
|
||||||
repo_init_revisions(the_repository, &rev, prefix);
|
|
||||||
|
repo_init_revisions(the_repository, &rev, NULL);
|
||||||
rev.abbrev = 0;
|
rev.abbrev = 0;
|
||||||
diff_files_args.argc = setup_revisions(diff_files_args.argc,
|
diff_files_args.argc = setup_revisions(diff_files_args.argc,
|
||||||
diff_files_args.argv,
|
diff_files_args.argv,
|
||||||
|
|
|
@ -356,6 +356,28 @@ test_expect_success 'status should only print one line' '
|
||||||
test_line_count = 1 lines
|
test_line_count = 1 lines
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'status from subdirectory should have the same SHA1' '
|
||||||
|
test_when_finished "rmdir addtest/subdir" &&
|
||||||
|
(
|
||||||
|
cd addtest &&
|
||||||
|
mkdir subdir &&
|
||||||
|
git submodule status >output &&
|
||||||
|
awk "{print \$1}" <output >expect &&
|
||||||
|
cd subdir &&
|
||||||
|
git submodule status >../output &&
|
||||||
|
awk "{print \$1}" <../output >../actual &&
|
||||||
|
test_cmp ../expect ../actual &&
|
||||||
|
git -C ../submod checkout HEAD^ &&
|
||||||
|
git submodule status >../output &&
|
||||||
|
awk "{print \$1}" <../output >../actual2 &&
|
||||||
|
cd .. &&
|
||||||
|
git submodule status >output &&
|
||||||
|
awk "{print \$1}" <output >expect2 &&
|
||||||
|
test_cmp expect2 actual2 &&
|
||||||
|
! test_cmp actual actual2
|
||||||
|
)
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success 'setup - fetch commit name from submodule' '
|
test_expect_success 'setup - fetch commit name from submodule' '
|
||||||
rev1=$(cd .subrepo && git rev-parse HEAD) &&
|
rev1=$(cd .subrepo && git rev-parse HEAD) &&
|
||||||
printf "rev1: %s\n" "$rev1" &&
|
printf "rev1: %s\n" "$rev1" &&
|
||||||
|
|
Loading…
Reference in a new issue