Git fork

Merge branch 'maint'

* maint:
test-lib: fix broken printf
git apply --directory broken for new files

+60 -1
+7
builtin-apply.c
··· 805 805 * the default name from the header. 806 806 */ 807 807 patch->def_name = git_header_name(line, len); 808 + if (patch->def_name && root) { 809 + char *s = xmalloc(root_len + strlen(patch->def_name) + 1); 810 + strcpy(s, root); 811 + strcpy(s + root_len, patch->def_name); 812 + free(patch->def_name); 813 + patch->def_name = s; 814 + } 808 815 809 816 line += len; 810 817 size -= len;
+52
t/t4128-apply-root.sh
··· 40 40 41 41 ' 42 42 43 + cat > patch << EOF 44 + diff --git a/newfile b/newfile 45 + new file mode 100644 46 + index 0000000..d95f3ad 47 + --- /dev/null 48 + +++ b/newfile 49 + @@ -0,0 +1 @@ 50 + +content 51 + EOF 52 + 53 + test_expect_success 'apply --directory (new file)' ' 54 + git reset --hard initial && 55 + git apply --directory=some/sub/dir/ --index patch && 56 + test content = $(git show :some/sub/dir/newfile) && 57 + test content = $(cat some/sub/dir/newfile) 58 + ' 59 + 60 + cat > patch << EOF 61 + diff --git a/delfile b/delfile 62 + deleted file mode 100644 63 + index d95f3ad..0000000 64 + --- a/delfile 65 + +++ /dev/null 66 + @@ -1 +0,0 @@ 67 + -content 68 + EOF 69 + 70 + test_expect_success 'apply --directory (delete file)' ' 71 + git reset --hard initial && 72 + echo content >some/sub/dir/delfile && 73 + git add some/sub/dir/delfile && 74 + git apply --directory=some/sub/dir/ --index patch && 75 + ! git ls-files | grep delfile 76 + ' 77 + 78 + cat > patch << 'EOF' 79 + diff --git "a/qu\157tefile" "b/qu\157tefile" 80 + new file mode 100644 81 + index 0000000..d95f3ad 82 + --- /dev/null 83 + +++ "b/qu\157tefile" 84 + @@ -0,0 +1 @@ 85 + +content 86 + EOF 87 + 88 + test_expect_success 'apply --directory (quoted filename)' ' 89 + git reset --hard initial && 90 + git apply --directory=some/sub/dir/ --index patch && 91 + test content = $(git show :some/sub/dir/quotefile) && 92 + test content = $(cat some/sub/dir/quotefile) 93 + ' 94 + 43 95 test_done
+1 -1
t/test-lib.sh
··· 112 112 *) test -n "$quiet" && return;; 113 113 esac 114 114 shift 115 - printf "* $*" 115 + printf "* %s" "$*" 116 116 tput sgr0 117 117 echo 118 118 )