diff options
author | Joey Hess <joey@kitenet.net> | 2011-06-23 17:38:27 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-06-23 17:38:27 -0400 |
commit | c4cc6ee42f63bb8196f44608aaf35f7f9f411fe1 (patch) | |
tree | dc799467c8648ce9608ecd8aefe94f948b4c9066 | |
parent | ab9b971f8f772cf7e89a904d665bc88ddb3afd47 (diff) |
fix merge_tree_index
--cached is needed when calling git-diff-index, as it is not diffing
against currently checked out branch.
-rw-r--r-- | GitUnionMerge.hs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/GitUnionMerge.hs b/GitUnionMerge.hs index fa14a6bc3..74579ebcc 100644 --- a/GitUnionMerge.hs +++ b/GitUnionMerge.hs @@ -9,7 +9,8 @@ module GitUnionMerge ( merge, commit, update_index, - update_index_line + update_index_line, + ls_tree ) where import System.Cmd.Utils @@ -40,7 +41,7 @@ merge _ _ = error "wrong number of branches to merge" - earlier ones, so the list can be generated from any combination of - ls_tree, merge_trees, and merge_tree_index. -} update_index :: Git.Repo -> [String] -> IO () -update_index g l = togit ["update-index", "-z", "--index-info"] (join "\0" l) +update_index g l = togit ["update-index", "-z", "--index-info"] (join "\0" l) where togit ps content = Git.pipeWrite g (map Param ps) content >>= forceSuccess @@ -57,13 +58,14 @@ ls_tree g x = Git.pipeNullSplit g $ {- For merging two trees. -} merge_trees :: Git.Repo -> String -> String -> IO [String] -merge_trees g x y = calc_merge g - ["diff-tree", "--raw", "-z", "-r", "--no-renames", "-l0", x, y] +merge_trees g x y = calc_merge g $ "diff-tree":diff_opts ++ [x, y] {- For merging a single tree into the index. -} merge_tree_index :: Git.Repo -> String -> IO [String] -merge_tree_index g x = calc_merge g - ["diff-index", "--raw", "-z", "-r", "--no-renames", "-l0", x] +merge_tree_index g x = calc_merge g $ "diff-index":diff_opts ++ ["--cached", x] + +diff_opts :: [String] +diff_opts = ["--raw", "-z", "-r", "--no-renames", "-l0"] {- Calculates how to perform a merge, using git to get a raw diff, - and returning a list suitable for update_index. -} |