@matheusbsbs / matheus-bagliano / commits / 1736855c9b
Fork 0

Add merge-subtree back

An earlier commit e1b3a2c (Build-in merge-recursive) made the subtree merge strategy backend unavailable. This resurrects it. A new test t6029 currently only tests the strategy is available, but it should be enhanced to check the real "subtree" case. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Feb 23, 2008 at 11:08 UTC 1736855c9b59ac787af979a44840a58361cbaf66
3 files changed +36 -5
Makefile
+3 -5
@@ -261,17 +261,18 @@ PROGRAMS = \
261 # Empty...
262 EXTRA_PROGRAMS =
263
264 +# List built-in command $C whose implementation cmd_$C() is not in
265 +# builtin-$C.o but is linked in as part of some other command.
266 BUILT_INS = \
267 git-format-patch$X git-show$X git-whatchanged$X git-cherry$X \
268 git-get-tar-commit-id$X git-init$X git-repo-config$X \
269 git-fsck-objects$X git-cherry-pick$X git-peek-remote$X git-status$X \
270 + git-merge-subtree$X \
271 $(patsubst builtin-%.o,git-%$X,$(BUILTIN_OBJS))
272
273 # what 'all' will build and 'install' will install, in gitexecdir
274 ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS)
275
273 -ALL_PROGRAMS += git-merge-subtree$X
274 -
276 # what 'all' will build but not install in gitexecdir
277 OTHER_PROGRAMS = git$X gitweb/gitweb.cgi
278
@@ -807,9 +808,6 @@ help.o: help.c common-cmds.h GIT-CFLAGS
808 '-DGIT_MAN_PATH="$(mandir_SQ)"' \
809 '-DGIT_INFO_PATH="$(infodir_SQ)"' $<
810
810 -git-merge-subtree$X: git-merge-recursive$X
811 - $(QUIET_BUILT_IN)$(RM) $@ && ln git-merge-recursive$X $@
812 -
811 $(BUILT_INS): git$X
812 $(QUIET_BUILT_IN)$(RM) $@ && ln git$X $@
813
git.c
+1
@@ -332,6 +332,7 @@ static void handle_internal_command(int argc, const char **argv)
332 { "merge-file", cmd_merge_file },
333 { "merge-ours", cmd_merge_ours, RUN_SETUP },
334 { "merge-recursive", cmd_merge_recursive, RUN_SETUP | NEED_WORK_TREE },
335 + { "merge-subtree", cmd_merge_recursive, RUN_SETUP | NEED_WORK_TREE },
336 { "mv", cmd_mv, RUN_SETUP | NEED_WORK_TREE },
337 { "name-rev", cmd_name_rev, RUN_SETUP },
338 { "pack-objects", cmd_pack_objects, RUN_SETUP },
t/t6029-merge-subtree.sh new
+32
@@ -0,0 +1,32 @@
1 +#!/bin/sh
2 +
3 +test_description='subtree merge strategy'
4 +
5 +. ./test-lib.sh
6 +
7 +test_expect_success setup '
8 +
9 + s="1 2 3 4 5 6 7 8"
10 + for i in $s; do echo $i; done >hello &&
11 + git add hello &&
12 + git commit -m initial &&
13 + git checkout -b side &&
14 + echo >>hello world &&
15 + git add hello &&
16 + git commit -m second &&
17 + git checkout master &&
18 + for i in mundo $s; do echo $i; done >hello &&
19 + git add hello &&
20 + git commit -m master
21 +
22 +'
23 +
24 +test_expect_success 'subtree available and works like recursive' '
25 +
26 + git merge -s subtree side &&
27 + for i in mundo $s world; do echo $i; done >expect &&
28 + diff -u expect hello
29 +
30 +'
31 +
32 +test_done