git-merge-one-file: resurrect leading path creation.
Since we do not use git-update-index followed by git-checkout-index -u to create the half-merged file on conflicting case anymore, we need to make sure the leading directories are created here. Maybe a better solution would be to allow update-index to add to higher stage, and checkout-index to extract from such, but that is a change slightly bigger than I would like to have so close to 1.0, so this should do for now. Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Dec 6, 2005 at 00:07 UTC
be61db922a230ae2638c27c071ee4b8c98f01f72
1 file changed
+10
-2
git-merge-one-file.sh
+10
-2
@@ -16,6 +16,14 @@
16
# been handled already by git-read-tree, but that one doesn't
17
# do any merges that might change the tree layout.
18
19
+verify_path() {
20
+ file="$1"
21
+ dir=`dirname "$file"` &&
22
+ mkdir -p "$dir" &&
23
+ rm -f -- "$file" &&
24
+ : >"$file"
25
+}
26
+
27
case "${1:-.}${2:-.}${3:-.}" in
28
#
29
# Deleted in both or deleted in one and unchanged in the other
@@ -90,9 +98,9 @@ case "${1:-.}${2:-.}${3:-.}" in
98
# Create the working tree file, with the correct permission bits.
99
# we can not rely on the fact that our tree has the path, because
100
# we allow the merge to be done in an unchecked-out working tree.
93
- rm -f "$4" &&
101
+ verify_path "$4" &&
102
git-cat-file blob "$2" >"$4" &&
95
- case "$6" in *7??) chmod +x "$4" ;; esac &&
103
+ case "$6" in *7??) chmod +x -- "$4" ;; esac &&
104
merge "$4" "$orig" "$src2"
105
ret=$?
106
rm -f -- "$orig" "$src2"