summaryrefslogtreecommitdiff
path: root/git-merge-one-file.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-05-13 10:44:19 -0700
committerJunio C Hamano <gitster@pobox.com>2011-05-13 10:44:19 -0700
commit8272bcabac0b68e6d526ec0fcbc6d6e532b3e2af (patch)
tree877e3cbaafa693fb8752acf55a693a27b15f9737 /git-merge-one-file.sh
parenta613b534bca2d56f2ad67b3a7f0cf2b34f031260 (diff)
parent6aaeca900b05a8265d1930d3dc0a2df19002771f (diff)
downloadgit-8272bcabac0b68e6d526ec0fcbc6d6e532b3e2af.tar.gz
Merge branch 'jk/merge-one-file-working-tree' into maint
* 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