Revert "rehabilitate 'git index-pack' inside the object store"
Now setup_git_directory_gently behaves sanely even from subdirs of .git, so simplify index-pack by no longer protecting against that. This reverts commit a672ea6ac5a1b876bc7adfe6534b16fa2a32c94b (excluding tests). Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy committed
Jul 24, 2010 at 06:30 UTC
3f8099fce7779631fe8827a8979d7b57629a36de
1 file changed
+5
-19
builtin/index-pack.c
+5
-19
@@ -880,29 +880,15 @@ int cmd_index_pack(int argc, const char **argv, const char *prefix)
880
char *index_name_buf = NULL, *keep_name_buf = NULL;
881
struct pack_idx_entry **idx_objects;
882
unsigned char pack_sha1[20];
883
+ int nongit;
884
885
if (argc == 2 && !strcmp(argv[1], "-h"))
886
usage(index_pack_usage);
887
887
- /*
888
- * We wish to read the repository's config file if any, and
889
- * for that it is necessary to call setup_git_directory_gently().
890
- * However if the cwd was inside .git/objects/pack/ then we need
891
- * to go back there or all the pack name arguments will be wrong.
892
- * And in that case we cannot rely on any prefix returned by
893
- * setup_git_directory_gently() either.
894
- */
895
- {
896
- char cwd[PATH_MAX+1];
897
- int nongit;
898
-
899
- if (!getcwd(cwd, sizeof(cwd)-1))
900
- die("Unable to get current working directory");
901
- setup_git_directory_gently(&nongit);
902
- git_config(git_index_pack_config, NULL);
903
- if (chdir(cwd))
904
- die("Cannot come back to cwd");
905
- }
888
+ prefix = setup_git_directory_gently(&nongit);
889
+ git_config(git_index_pack_config, NULL);
890
+ if (prefix && chdir(prefix))
891
+ die("Cannot come back to cwd");
892
893
for (i = 1; i < argc; i++) {
894
const char *arg = argv[i];