index-pack: complain when --stdin is used outside of a repo
The index-pack builtin is marked as RUN_SETUP_GENTLY, because it's perfectly fine to index a pack in the filesystem outside of any repository. However, --stdin mode will write the result to the object database, which does not make sense outside of a repository. Doing so creates a bogus ".git" directory with nothing in it except the newly-created pack and its index. Instead, let's flag this as an error and abort. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
de95302a4c
commit
7176a31444
@ -1730,6 +1730,8 @@ int cmd_index_pack(int argc, const char **argv, const char *prefix)
|
||||
usage(index_pack_usage);
|
||||
if (fix_thin_pack && !from_stdin)
|
||||
die(_("--fix-thin cannot be used without --stdin"));
|
||||
if (from_stdin && !startup_info->have_repository)
|
||||
die(_("--stdin requires a git repository"));
|
||||
if (!index_name && pack_name)
|
||||
index_name = derive_filename(pack_name, ".idx", &index_name_buf);
|
||||
if (keep_msg && !keep_name && pack_name)
|
||||
|
||||
Reference in New Issue
Block a user