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

[PATCH 2/3] Use setup_work_tree() in builtin-ls-files.c

From
Mike Hommey <mh@glandium.org>
Date
Nov 3, 2007, 11:23 UTC
Message-ID
<1194088993-25692-2-git-send-email-mh@glandium.org>
In-Reply-To
<1194088993-25692-1-git-send-email-mh@glandium.org>
Signed-off-by: Mike Hommey <mh@glandium.org>
---
 builtin-ls-files.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/builtin-ls-files.c b/builtin-ls-files.c
index b70da18..e0b856f 100644
--- a/builtin-ls-files.c
+++ b/builtin-ls-files.c
@@ -525,11 +525,8 @@ int cmd_ls_files(int argc, const char **argv, const char *prefix)
 		break;
 	}
 
-	if (require_work_tree && !is_inside_work_tree()) {
-		const char *work_tree = get_git_work_tree();
-		if (!work_tree || chdir(work_tree))
-			die("This operation must be run in a work tree");
-	}
+	if (require_work_tree && !is_inside_work_tree())
+		setup_work_tree();
 
 	pathspec = get_pathspec(prefix, argv + i);
 
-- 
1.5.3.5
Previous: Mike HommeyNext: Mike Hommey
Message 2 of 6 in “Refactor working tree setup”
  1. 1/3 Refactor working tree setupMike Hommey, Nov 3, 2007
  2. 2/3 Use setup_work_tree() in builtin-ls-files.cMike Hommey, Nov 3, 2007
  3. 3/3 Don't always require working tree for git-rmMike Hommey, Nov 3, 2007
  4. Johannes SchindelinNov 3, 2007
  5. Miles BaderNov 8, 2007
  6. Junio C HamanoNov 8, 2007

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.