summaryrefslogtreecommitdiff
path: root/git-merge-one-file.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-05-06 10:54:08 -0700
committerJunio C Hamano <gitster@pobox.com>2011-05-06 10:54:08 -0700
commitac13e7c514d6790cc59041545f26b3f5da543b25 (patch)
tree567f0447e8274f14813543bdf74e621d8b0d41e6 /git-merge-one-file.sh
parent22dbeee715e4c9fae3e3fdc1f3a2c4a6ec90e593 (diff)
parent6aaeca900b05a8265d1930d3dc0a2df19002771f (diff)
downloadgit-ac13e7c514d6790cc59041545f26b3f5da543b25.tar.gz
Merge branch 'jk/merge-one-file-working-tree'
* jk/merge-one-file-working-tree: merge-one-file: fix broken merges with alternate work trees add tests for merge-index / merge-one-file
Diffstat (limited to 'git-merge-one-file.sh')
-rwxr-xr-xgit-merge-one-file.sh7
1 files changed, 6 insertions, 1 deletions
diff --git a/git-merge-one-file.sh b/git-merge-one-file.sh
index b86402afa5..7aeb96952f 100755
--- a/git-merge-one-file.sh
+++ b/git-merge-one-file.sh
@@ -22,6 +22,11 @@ LONG_USAGE="Usage: git merge-one-file $USAGE
Blob ids and modes should be empty for missing files."
+SUBDIRECTORY_OK=Yes
+. git-sh-setup
+cd_to_toplevel
+require_work_tree
+
if ! test "$#" -eq 7
then
echo "$LONG_USAGE"
@@ -132,7 +137,7 @@ case "${1:-.}${2:-.}${3:-.}" in
# Create the working tree file, using "our tree" version from the
# index, and then store the result of the merge.
- git checkout-index -f --stage=2 -- "$4" && cat "$src1" >"$4"
+ git checkout-index -f --stage=2 -- "$4" && cat "$src1" >"$4" || exit 1
rm -f -- "$orig" "$src1" "$src2"
if [ "$6" != "$7" ]; then