Merge branch 'jt/sparse-checkout-leading-dir-fix'
"git sparse-checkout init" failed to write into $GIT_DIR/info directory when the repository was created without one, which has been corrected to auto-create it. * jt/sparse-checkout-leading-dir-fix: sparse-checkout: create leading directory
This commit is contained in:
		| @ -471,6 +471,9 @@ static int sparse_checkout_init(int argc, const char **argv) | |||||||
| 		FILE *fp; | 		FILE *fp; | ||||||
|  |  | ||||||
| 		/* assume we are in a fresh repo, but update the sparse-checkout file */ | 		/* assume we are in a fresh repo, but update the sparse-checkout file */ | ||||||
|  | 		if (safe_create_leading_directories(sparse_filename)) | ||||||
|  | 			die(_("unable to create leading directories of %s"), | ||||||
|  | 			    sparse_filename); | ||||||
| 		fp = xfopen(sparse_filename, "w"); | 		fp = xfopen(sparse_filename, "w"); | ||||||
| 		if (!fp) | 		if (!fp) | ||||||
| 			die(_("failed to open '%s'"), sparse_filename); | 			die(_("failed to open '%s'"), sparse_filename); | ||||||
|  | |||||||
| @ -79,6 +79,12 @@ test_expect_success 'git sparse-checkout init' ' | |||||||
| 	check_files repo a | 	check_files repo a | ||||||
| ' | ' | ||||||
|  |  | ||||||
|  | test_expect_success 'git sparse-checkout init in empty repo' ' | ||||||
|  | 	test_when_finished rm -rf empty-repo blank-template && | ||||||
|  | 	git init --template= empty-repo && | ||||||
|  | 	git -C empty-repo sparse-checkout init | ||||||
|  | ' | ||||||
|  |  | ||||||
| test_expect_success 'git sparse-checkout list after init' ' | test_expect_success 'git sparse-checkout list after init' ' | ||||||
| 	git -C repo sparse-checkout list >actual && | 	git -C repo sparse-checkout list >actual && | ||||||
| 	cat >expect <<-\EOF && | 	cat >expect <<-\EOF && | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Junio C Hamano
					Junio C Hamano