David Aguilar | bc7a96a | 2011-08-18 00:23:46 -0700 | [diff] [blame] | 1 | diff_cmd () { |
David Aguilar | 950b568 | 2012-12-26 16:45:29 -0800 | [diff] [blame] | 2 | empty_file= |
| 3 | |
David Aguilar | 3facc60 | 2012-10-10 20:22:36 -0700 | [diff] [blame] | 4 | # p4merge does not like /dev/null |
David Aguilar | 3facc60 | 2012-10-10 20:22:36 -0700 | [diff] [blame] | 5 | if test "/dev/null" = "$LOCAL" |
| 6 | then |
David Aguilar | 950b568 | 2012-12-26 16:45:29 -0800 | [diff] [blame] | 7 | LOCAL="$(create_empty_file)" |
David Aguilar | 3facc60 | 2012-10-10 20:22:36 -0700 | [diff] [blame] | 8 | fi |
| 9 | if test "/dev/null" = "$REMOTE" |
| 10 | then |
David Aguilar | 950b568 | 2012-12-26 16:45:29 -0800 | [diff] [blame] | 11 | REMOTE="$(create_empty_file)" |
David Aguilar | 3facc60 | 2012-10-10 20:22:36 -0700 | [diff] [blame] | 12 | fi |
| 13 | |
David Aguilar | bc7a96a | 2011-08-18 00:23:46 -0700 | [diff] [blame] | 14 | "$merge_tool_path" "$LOCAL" "$REMOTE" |
David Aguilar | 3facc60 | 2012-10-10 20:22:36 -0700 | [diff] [blame] | 15 | |
David Aguilar | 950b568 | 2012-12-26 16:45:29 -0800 | [diff] [blame] | 16 | if test -n "$empty_file" |
David Aguilar | 3facc60 | 2012-10-10 20:22:36 -0700 | [diff] [blame] | 17 | then |
David Aguilar | 950b568 | 2012-12-26 16:45:29 -0800 | [diff] [blame] | 18 | rm -f "$empty_file" |
David Aguilar | 3facc60 | 2012-10-10 20:22:36 -0700 | [diff] [blame] | 19 | fi |
David Aguilar | bc7a96a | 2011-08-18 00:23:46 -0700 | [diff] [blame] | 20 | } |
| 21 | |
Fernando Ramos | 980145f | 2022-03-30 21:19:09 +0200 | [diff] [blame] | 22 | diff_cmd_help () { |
| 23 | echo "Use HelixCore P4Merge (requires a graphical session)" |
| 24 | } |
| 25 | |
David Aguilar | bc7a96a | 2011-08-18 00:23:46 -0700 | [diff] [blame] | 26 | merge_cmd () { |
Kevin Bracey | 4549162 | 2013-03-13 03:12:21 +0200 | [diff] [blame] | 27 | if ! $base_present |
| 28 | then |
| 29 | cp -- "$LOCAL" "$BASE" |
| 30 | create_virtual_base "$BASE" "$REMOTE" |
| 31 | fi |
Kevin Bracey | c699a7c | 2013-03-13 03:12:20 +0200 | [diff] [blame] | 32 | "$merge_tool_path" "$BASE" "$REMOTE" "$LOCAL" "$MERGED" |
David Aguilar | bc7a96a | 2011-08-18 00:23:46 -0700 | [diff] [blame] | 33 | } |
David Aguilar | 950b568 | 2012-12-26 16:45:29 -0800 | [diff] [blame] | 34 | |
| 35 | create_empty_file () { |
| 36 | empty_file="${TMPDIR:-/tmp}/git-difftool-p4merge-empty-file.$$" |
| 37 | >"$empty_file" |
| 38 | |
David Aguilar | d272c84 | 2013-02-09 17:21:25 -0800 | [diff] [blame] | 39 | printf "%s" "$empty_file" |
David Aguilar | 950b568 | 2012-12-26 16:45:29 -0800 | [diff] [blame] | 40 | } |
Fernando Ramos | 980145f | 2022-03-30 21:19:09 +0200 | [diff] [blame] | 41 | |
| 42 | merge_cmd_help () { |
| 43 | echo "Use HelixCore P4Merge (requires a graphical session)" |
| 44 | } |