git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 9/9] Revert "rehabilitate 'git index-pack' inside the object store"

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Jul 24, 2010, 11:30 UTC
Message-ID
<20100724113049.GB16338@burratino>
In-Reply-To
<20100724111505.GC7150@burratino>
From: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>

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>
---
That’s the end of the series.  Thanks for reading.

Good night, Jonathan

 builtin/index-pack.c |   24 +++++-------------------
 1 files changed, 5 insertions(+), 19 deletions(-)
diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index a89ae83..89a1f12 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -880,29 +880,15 @@ int cmd_index_pack(int argc, const char **argv, const char *prefix)
 	char *index_name_buf = NULL, *keep_name_buf = NULL;
 	struct pack_idx_entry **idx_objects;
 	unsigned char pack_sha1[20];
+	int nongit;
 
 	if (argc == 2 && !strcmp(argv[1], "-h"))
 		usage(index_pack_usage);
 
-	/*
-	 * We wish to read the repository's config file if any, and
-	 * for that it is necessary to call setup_git_directory_gently().
-	 * However if the cwd was inside .git/objects/pack/ then we need
-	 * to go back there or all the pack name arguments will be wrong.
-	 * And in that case we cannot rely on any prefix returned by
-	 * setup_git_directory_gently() either.
-	 */
-	{
-		char cwd[PATH_MAX+1];
-		int nongit;
-
-		if (!getcwd(cwd, sizeof(cwd)-1))
-			die("Unable to get current working directory");
-		setup_git_directory_gently(&nongit);
-		git_config(git_index_pack_config, NULL);
-		if (chdir(cwd))
-			die("Cannot come back to cwd");
-	}
+	prefix = setup_git_directory_gently(&nongit);
+	git_config(git_index_pack_config, NULL);
+	if (prefix && chdir(prefix))
+		die("Cannot come back to cwd");
 
 	for (i = 1; i < argc; i++) {
 		const char *arg = argv[i];
-- 
1.7.2.rc3.593.g19611.dirty
Previous: Jonathan NiederNext: Nguyen Thai Ngoc Duy
Message 19 of 20 in “worktree setup: return to original cwd if prefix is set NULL”
  1. 1/2 worktree setup: return to original cwd if prefix is set NULLNguyễn Thái Ngọc Duy, Jul 23, 2010
  2. 2/2 Revert "rehabilitate 'git index-pack' inside the object store"Nguyễn Thái Ngọc Duy, Jul 23, 2010
  3. Ævar Arnfjörð BjarmasonJul 23, 2010
  4. Nguyen Thai Ngoc DuyJul 24, 2010
  5. Ævar Arnfjörð BjarmasonJul 24, 2010
  6. 1/2 worktree setup: return to original cwd if prefix is set NULLNguyễn Thái Ngọc Duy, Jul 23, 2010
  7. 0/9 setup_git_directory(): return to original cwd upon reaching .gitJonathan Nieder, Jul 24, 2010
  8. 1/9 t1501 (rev-parse): clarifyJonathan Nieder, Jul 24, 2010
  9. 2/9 tests: try git apply from subdir of toplevelJonathan Nieder, Jul 24, 2010
  10. 3/9 setup: split off $GIT_DIR-set case from setup_git_directory_gentlyJonathan Nieder, Jul 24, 2010
  11. Nguyen Thai Ngoc DuyJul 24, 2010
  12. 4/9 setup: split off a function to checks working dir for .git fileJonathan Nieder, Jul 24, 2010
  13. Nguyen Thai Ngoc DuyJul 24, 2010
  14. Jonathan NiederJul 24, 2010
  15. 5/9 setup: split off code to handle stumbling upon a repositoryJonathan Nieder, Jul 24, 2010
  16. 6/9 setup: split off a function to handle hitting ceiling in repo searchJonathan Nieder, Jul 24, 2010
  17. 7/9 setup: split off get_device_or_die helperJonathan Nieder, Jul 24, 2010
  18. 8/9 setup: do not forget working dir from subdir of gitdirJonathan Nieder, Jul 24, 2010
  19. 9/9 Revert "rehabilitate 'git index-pack' inside the object store"Jonathan Nieder, Jul 24, 2010
  20. Nguyen Thai Ngoc DuyJul 24, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.