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

[PATCH 8/8] Make the rest of commands work from a subdirectory.

From
Junio C Hamano <junkio@cox.net>
Date
Nov 26, 2005, 09:57 UTC
Message-ID
<7vek534tq6.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<7vmzjtn3h1.fsf@assigned-by-dhcp.cox.net>
These commands are converted to run from a subdirectory.
    commit-tree convert-objects merge-base merge-index mktag
    pack-objects pack-redundant prune-packed read-tree tar-tree
    unpack-file unpack-objects update-server-info write-tree
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 commit-tree.c        |    2 ++
 convert-objects.c    |    2 ++
 merge-base.c         |    2 ++
 merge-index.c        |    1 +
 mktag.c              |    2 ++
 pack-objects.c       |    2 ++
 pack-redundant.c     |    2 ++
 prune-packed.c       |    2 ++
 read-tree.c          |    2 ++
 tar-tree.c           |    2 ++
 unpack-file.c        |    2 ++
 unpack-objects.c     |    2 ++
 update-server-info.c |    2 ++
 write-tree.c         |    5 ++++-
 14 files changed, 29 insertions(+), 1 deletions(-)

applies-to: 46e976598ab7b7822d7664fdcc88dc63d2e9cf7a 87a21588fb4f8ed433364716ccb90ef934a99585

diff --git a/commit-tree.c b/commit-tree.c
index b60299f..4634b50 100644
--- a/commit-tree.c
+++ b/commit-tree.c
@@ -91,6 +91,8 @@ int main(int argc, char **argv)
 	if (argc < 2 || get_sha1_hex(argv[1], tree_sha1) < 0)
 		usage(commit_tree_usage);
 
+	setup_git_directory();
+
 	check_valid(tree_sha1, "tree");
 	for (i = 2; i < argc; i += 2) {
 		char *a, *b;
diff --git a/convert-objects.c b/convert-objects.c
index a892013..d78a8b4 100644
--- a/convert-objects.c
+++ b/convert-objects.c
@@ -316,6 +316,8 @@ int main(int argc, char **argv)
 	unsigned char sha1[20];
 	struct entry *entry;
 
+	setup_git_directory();
+
 	if (argc != 2 || get_sha1(argv[1], sha1))
 		usage("git-convert-objects <sha1>");
 
diff --git a/merge-base.c b/merge-base.c
index 751c3c2..e73fca7 100644
--- a/merge-base.c
+++ b/merge-base.c
@@ -236,6 +236,8 @@ int main(int argc, char **argv)
 	struct commit *rev1, *rev2;
 	unsigned char rev1key[20], rev2key[20];
 
+	setup_git_directory();
+
 	while (1 < argc && argv[1][0] == '-') {
 		char *arg = argv[1];
 		if (!strcmp(arg, "-a") || !strcmp(arg, "--all"))
diff --git a/merge-index.c b/merge-index.c
index 727527f..024196e 100644
--- a/merge-index.c
+++ b/merge-index.c
@@ -102,6 +102,7 @@ int main(int argc, char **argv)
 	if (argc < 3)
 		usage("git-merge-index [-o] [-q] <merge-program> (-a | <filename>*)");
 
+	setup_git_directory();
 	read_cache();
 
 	i = 1;
diff --git a/mktag.c b/mktag.c
index 585677e..97e270a 100644
--- a/mktag.c
+++ b/mktag.c
@@ -111,6 +111,8 @@ int main(int argc, char **argv)
 	if (argc != 1)
 		usage("cat <signaturefile> | git-mktag");
 
+	setup_git_directory();
+
 	// Read the signature
 	size = 0;
 	for (;;) {
diff --git a/pack-objects.c b/pack-objects.c
index 8864a31..a62c9f8 100644
--- a/pack-objects.c
+++ b/pack-objects.c
@@ -473,6 +473,8 @@ int main(int argc, char **argv)
 	struct object_entry **list;
 	int i;
 
+	setup_git_directory();
+
 	for (i = 1; i < argc; i++) {
 		const char *arg = argv[i];
 
diff --git a/pack-redundant.c b/pack-redundant.c
index 793fa08..0a43278 100644
--- a/pack-redundant.c
+++ b/pack-redundant.c
@@ -600,6 +600,8 @@ int main(int argc, char **argv)
 	unsigned char *sha1;
 	char buf[42]; /* 40 byte sha1 + \n + \0 */
 
+	setup_git_directory();
+
 	for (i = 1; i < argc; i++) {
 		const char *arg = argv[i];
 		if(!strcmp(arg, "--")) {
diff --git a/prune-packed.c b/prune-packed.c
index 26123f7..d24b097 100644
--- a/prune-packed.c
+++ b/prune-packed.c
@@ -58,6 +58,8 @@ int main(int argc, char **argv)
 {
 	int i;
 
+	setup_git_directory();
+
 	for (i = 1; i < argc; i++) {
 		const char *arg = argv[i];
 
diff --git a/read-tree.c b/read-tree.c
index df156ea..e3b9c0d 100644
--- a/read-tree.c
+++ b/read-tree.c
@@ -629,6 +629,8 @@ int main(int argc, char **argv)
 	unsigned char sha1[20];
 	merge_fn_t fn = NULL;
 
+	setup_git_directory();
+
 	newfd = hold_index_file_for_update(&cache_file, get_index_file());
 	if (newfd < 0)
 		die("unable to create new cachefile");
diff --git a/tar-tree.c b/tar-tree.c
index 970c4bb..bacb23a 100644
--- a/tar-tree.c
+++ b/tar-tree.c
@@ -407,6 +407,8 @@ int main(int argc, char **argv)
 	void *buffer;
 	unsigned long size;
 
+	setup_git_directory();
+
 	switch (argc) {
 	case 3:
 		basedir = argv[2];
diff --git a/unpack-file.c b/unpack-file.c
index d4ac3a5..07303f8 100644
--- a/unpack-file.c
+++ b/unpack-file.c
@@ -29,6 +29,8 @@ int main(int argc, char **argv)
 	if (argc != 2 || get_sha1(argv[1], sha1))
 		usage("git-unpack-file <sha1>");
 
+	setup_git_directory();
+
 	puts(create_temp_file(sha1));
 	return 0;
 }
diff --git a/unpack-objects.c b/unpack-objects.c
index 8490895..cfd61ae 100644
--- a/unpack-objects.c
+++ b/unpack-objects.c
@@ -269,6 +269,8 @@ int main(int argc, char **argv)
 	int i;
 	unsigned char sha1[20];
 
+	setup_git_directory();
+
 	for (i = 1 ; i < argc; i++) {
 		const char *arg = argv[i];
 
diff --git a/update-server-info.c b/update-server-info.c
index e824f62..0b6c383 100644
--- a/update-server-info.c
+++ b/update-server-info.c
@@ -19,5 +19,7 @@ int main(int ac, char **av)
 	if (i != ac)
 		usage(update_server_info_usage);
 
+	setup_git_directory();
+
 	return !!update_server_info(force);
 }
diff --git a/write-tree.c b/write-tree.c
index 2b2c6b7..0aac32f 100644
--- a/write-tree.c
+++ b/write-tree.c
@@ -86,9 +86,12 @@ static int write_tree(struct cache_entry
 int main(int argc, char **argv)
 {
 	int i, funny;
-	int entries = read_cache();
+	int entries;
 	unsigned char sha1[20];
 	
+	setup_git_directory();
+
+	entries = read_cache();
 	if (argc == 2) {
 		if (!strcmp(argv[1], "--missing-ok"))
 			missing_ok = 1;
---
0.99.9.GIT
Previous: Junio C HamanoNext: Josef Weidendorfer
Message 56 of 62 in “Get rid of .git/branches/ and .git/remotes/?”
  1. Johannes SchindelinNov 20, 2005
  2. Linus TorvaldsNov 20, 2005
  3. Sven VerdoolaegeNov 20, 2005
  4. Linus TorvaldsNov 20, 2005
  5. Andreas EricssonNov 20, 2005
  6. Johannes SchindelinNov 20, 2005
  7. Petr BaudisNov 26, 2005
  8. Junio C HamanoNov 27, 2005
  9. Josef WeidendorferNov 20, 2005
  10. Johannes SchindelinNov 20, 2005
  11. Josef WeidendorferNov 22, 2005
  12. Johannes SchindelinNov 22, 2005
  13. Andreas EricssonNov 22, 2005
  14. Johannes SchindelinNov 23, 2005
  15. Junio C HamanoNov 23, 2005
  16. Andreas EricssonNov 23, 2005
  17. Johannes SchindelinNov 23, 2005
  18. Andreas EricssonNov 24, 2005
  19. Junio C HamanoNov 24, 2005
  20. Rename git-config-set to git-repo-configJohannes Schindelin, Nov 24, 2005
  21. Junio C HamanoNov 24, 2005
  22. Johannes SchindelinNov 24, 2005
  23. Junio C HamanoNov 24, 2005
  24. Johannes SchindelinNov 24, 2005
  25. Junio C HamanoNov 26, 2005
  26. Linus TorvaldsNov 26, 2005
  27. Linus TorvaldsNov 26, 2005
  28. 0/8 Make C-level operable from subdirectoriesJunio C Hamano, Nov 26, 2005
  29. Junio C HamanoNov 26, 2005
  30. Ryan AndersonNov 26, 2005
  31. Junio C HamanoNov 27, 2005
  32. Petr BaudisNov 27, 2005
  33. Linus TorvaldsNov 27, 2005
  34. Petr BaudisNov 27, 2005
  35. Linus TorvaldsNov 27, 2005
  36. Junio C HamanoNov 28, 2005
  37. Linus TorvaldsNov 28, 2005
  38. Junio C HamanoNov 28, 2005
  39. Linus TorvaldsNov 28, 2005
  40. Junio C HamanoNov 28, 2005
  41. Junio C HamanoNov 28, 2005
  42. ls-tree: Resurrect funny name quoting lost during rewrite.Junio C Hamano, Nov 28, 2005
  43. Junio C HamanoNov 26, 2005
  44. 1/8 git-apply: work from subdirectory.Junio C Hamano, Nov 26, 2005
  45. Linus TorvaldsNov 26, 2005
  46. Junio C HamanoNov 26, 2005
  47. Junio C HamanoNov 27, 2005
  48. Lars Magne IngebrigtsenNov 27, 2005
  49. 2/8 peek-remote: honor proxy config even from subdirectory.Junio C Hamano, Nov 26, 2005
  50. 3/8 fsck-objects: work from subdirectory.Junio C Hamano, Nov 26, 2005
  51. 4/8 checkout-index: work from subdirectory.Junio C Hamano, Nov 26, 2005
  52. 5/8 hash-object: work within subdirectory.Junio C Hamano, Nov 26, 2005
  53. 6/8 ls-tree: work from subdirectory.Junio C Hamano, Nov 26, 2005
  54. Linus TorvaldsNov 26, 2005
  55. 7/8 Make networking commands to work from a subdirectory.Junio C Hamano, Nov 26, 2005
  56. 8/8 Make the rest of commands work from a subdirectory.Junio C Hamano, Nov 26, 2005
  57. Josef WeidendorferNov 22, 2005
  58. Johannes SchindelinNov 23, 2005
  59. Josef WeidendorferNov 23, 2005
  60. Johannes SchindelinNov 23, 2005
  61. Lars Magne IngebrigtsenNov 27, 2005
  62. Junio C HamanoNov 27, 2005

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.