diff options
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/show-index.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/builtin/show-index.c b/builtin/show-index.c index 3152d3c74b..756d632b51 100644 --- a/builtin/show-index.c +++ b/builtin/show-index.c @@ -40,6 +40,15 @@ int cmd_show_index(int argc, repo_set_hash_algo(the_repository, hash_algo); } + /* + * Fallback to SHA1 if we are running outside of a repository. + * + * TODO: Figure out and implement a way to detect the hash algorithm in use by the + * the index file passed in and use that instead. + */ + if (!the_hash_algo) + repo_set_hash_algo(the_repository, GIT_HASH_SHA1); + hashsz = the_hash_algo->rawsz; if (fread(top_index, 2 * 4, 1, stdin) != 1) |