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

[PATCH] builtin-clone: fix initial checkout

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
May 15, 2008, 09:48 UTC
Message-ID
<alpine.DEB.1.00.0805151042570.30431@racer>
In-Reply-To
<20080515045026.GA26161@sigill.intra.peff.net>

Somewhere in the process of finishing up builtin-clone, the update of the working tree was lost. This was due to not using the option "merge" for unpack_trees().

Breakage noticed by Kevin Ballard.
Test by Jeff King.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
	> On Thu, May 15, 2008 at 12:44:02AM -0400, Jeff King wrote:
	> 
	> > Hmm, builtin-clone does seem to be completely broken. It looks 
	> > like unpack_trees is not doing its job for some reason, but I
	> > haven't looked further. But it surprised me that we aren't 
	> > testing anything as simple as "clone works". The test below
	> > currently fails (though I am getting other test failures which 
	> > are presumably related).
	I did not notice the breakage earlier, because I ran with a 
	"twoway_merge" version of builtin-clone in my personal tree.
 builtin-clone.c  |    3 +++
 t/t5601-clone.sh |    7 +++++++
 2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/builtin-clone.c b/builtin-clone.c
index a7c075d..8713128 100644
--- a/builtin-clone.c
+++ b/builtin-clone.c
@@ -525,7 +525,10 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
 
 		memset(&opts, 0, sizeof opts);
 		opts.update = 1;
+		opts.merge = 1;
+		opts.fn = oneway_merge;
 		opts.verbose_update = !option_quiet;
+		opts.src_index = &the_index;
 		opts.dst_index = &the_index;
 
 		tree = parse_tree_indirect(remote_head->old_sha1);
diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh
index dc9d63d..593d1a3 100755
--- a/t/t5601-clone.sh
+++ b/t/t5601-clone.sh
@@ -23,4 +23,11 @@ test_expect_success 'clone with excess parameters' '
 
 '
 
+test_expect_success 'clone checks out files' '
+
+	git clone src dst &&
+	test -f dst/file
+
+'
+
 test_done
-- 
1.5.5.1.424.g3256b
Previous: Jeff KingNext: Jeff King
Message 4 of 7 in “git clone broken in next”
  1. Kevin BallardMay 15, 2008
  2. Jeff KingMay 15, 2008
  3. Jeff KingMay 15, 2008
  4. builtin-clone: fix initial checkoutJohannes Schindelin, May 15, 2008
  5. Jeff KingMay 15, 2008
  6. Daniel BarkalowMay 15, 2008
  7. Kevin BallardMay 15, 2008

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.