summaryrefslogtreecommitdiff
path: root/builtin/merge.c
AgeCommit message (Collapse)Author
2011-04-07merge: allow "-" as a short-hand for "previous branch"Junio C Hamano
Just like "git checkout -" is a short-hand for "git checkout @{-1}" to conveniently switch back to the previous branch, "git merge -" is a short-hand for "git merge @{-1}" to conveniently merge the previous branch. It will allow me to say: $ git checkout -b au/topic $ git am -s ./+au-topic.mbox $ git checkout pu $ git merge - which is an extremely typical and repetitive operation during my git day. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-02Merge branch 'jc/merge-sans-branch'Junio C Hamano
* jc/merge-sans-branch: merge: merge with the default upstream branch without argument merge: match the help text with the documentation Conflicts: builtin/merge.c
2011-04-02Merge branch 'ab/i18n-st'Junio C Hamano
* ab/i18n-st: (69 commits) i18n: git-shortlog basic messages i18n: git-revert split up "could not revert/apply" message i18n: git-revert literal "me" messages i18n: git-revert "Your local changes" message i18n: git-revert basic messages i18n: git-notes GIT_NOTES_REWRITE_MODE error message i18n: git-notes basic commands i18n: git-gc "Auto packing the repository" message i18n: git-gc basic messages i18n: git-describe basic messages i18n: git-clean clean.requireForce messages i18n: git-clean basic messages i18n: git-bundle basic messages i18n: git-archive basic messages i18n: git-status "renamed: " message i18n: git-status "Initial commit" message i18n: git-status "Changes to be committed" message i18n: git-status shortstatus messages i18n: git-status "nothing to commit" messages i18n: git-status basic messages ... Conflicts: builtin/branch.c builtin/checkout.c builtin/clone.c builtin/commit.c builtin/grep.c builtin/merge.c builtin/push.c builtin/revert.c t/t3507-cherry-pick-conflict.sh t/t7607-merge-overwrite.sh
2011-03-25merge: merge unborn index before setting refJeff King
When we merge into an unborn branch, there are basically two steps: 1. Write the sha1 of the new commit into the ref pointed to by HEAD. 2. Update the index with the new content, and check it out to the working tree. We currently do them in this order. However, (2) is the step that is much more likely to fail, since it can be blocked by things like untracked working tree files. When it does, the merge fails and we are left with an empty index but an updated HEAD. This patch switches the order, so that a failure in updating the index leaves us unchanged. Of course, a failure in updating the ref now leaves us with an updated index and mis-matched HEAD. That is arguably not much better, but it is probably less likely to actually happen. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-24merge: merge with the default upstream branch without argumentJunio C Hamano
"git merge" without specifying any commit is a no-op by default. A new option merge.defaultupstream can be set to true to cause such an invocation of the command to merge the upstream branches configured for the current branch by using their last observed values stored in their remote tracking branches. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-24merge: match the help text with the documentationJared Hance
We used to be very casual in terminology and used <branch>, <ref> and <rev> more or less interchangeably with <commit>. Match the help text given by "git merge -h" with that of the documentation. Signed-off-by: Jared Hance <jaredhance@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-20Merge branch 'jk/merge-rename-ux'Junio C Hamano
* jk/merge-rename-ux: pull: propagate --progress to merge merge: enable progress reporting for rename detection add inexact rename detection progress infrastructure commit: stop setting rename limit bump rename limit defaults (again) merge: improve inexact rename limit warning
2011-03-10i18n: git-merge "Wonderful" messageÆvar Arnfjörð Bjarmason
Gettextize the "Wonderful" message. A test in t7600-merge.sh explicitly checked for this message. Change it to skip under GETTEXT_POISON=YesPlease. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-10i18n: git-merge "Updating %s..%s" messageÆvar Arnfjörð Bjarmason
Gettextize the "Updating %s..%s\n" message. A test in t1200-tutorial.sh explicitly checked for this message. Split it into two tests to skip the test_cmp test under GETTEXT_POISON=YesPlease. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-10i18n: git-merge basic messagesÆvar Arnfjörð Bjarmason
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-09Merge branch 'js/cherry-pick-usability'Junio C Hamano
* js/cherry-pick-usability: Teach commit about CHERRY_PICK_HEAD bash: teach __git_ps1 about CHERRY_PICK_HEAD Introduce CHERRY_PICK_HEAD t3507: introduce pristine-detach helper
2011-02-28Merge branch 'mg/placeholders-are-lowercase'Junio C Hamano
* mg/placeholders-are-lowercase: Make <identifier> lowercase in Documentation Make <identifier> lowercase as per CodingGuidelines Make <identifier> lowercase as per CodingGuidelines Make <identifier> lowercase as per CodingGuidelines CodingGuidelines: downcase placeholders in usage messages
2011-02-28Merge branch 'js/maint-merge-use-prepare-commit-msg-hook'Junio C Hamano
* js/maint-merge-use-prepare-commit-msg-hook: merge: honor prepare-commit-msg hook
2011-02-22Introduce CHERRY_PICK_HEADJay Soffian
When a cherry-pick conflicts git advises: $ git commit -c <original commit id> to preserve the original commit message and authorship. Instead, let's record the original commit id in CHERRY_PICK_HEAD and advise: $ git commit -c CHERRY_PICK_HEAD A later patch teaches git to handle the '-c CHERRY_PICK_HEAD' part. Note that we record CHERRY_PICK_HEAD even in the case where there are no conflicts so that we may use it to communicate authorship to commit; this will then allow us to remove set_author_ident_env from revert.c. However, we do not record CHERRY_PICK_HEAD when --no-commit is used, as presumably the user intends to further edit the commit and possibly even cherry-pick additional commits on top. Tests and documentation contributed by Jonathan Nieder. Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Jay Soffian <jaysoffian@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-21merge: enable progress reporting for rename detectionJeff King
The user can enable or disable it explicitly with the new --progress, but it defaults to checking isatty(2). This works only with merge-recursive and subtree. In theory we could pass a progress flag to other strategies, but none of them support progress at this point, so let's wait until they grow such a feature before worrying about propagating it. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-15merge: honor prepare-commit-msg hookJay Soffian
When a merge is stopped due to conflicts or --no-commit, the subsequent commit calls the prepare-commit-msg hook. However, it is not called after a clean merge. Fix this inconsistency by invoking the hook after clean merges as well. Signed-off-by: Jay Soffian <jaysoffian@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-15Make <identifier> lowercase as per CodingGuidelinesMichael J Gruber
*.c part for matches with '"[A-Z]+"'. Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-15Merge branch 'maint'Junio C Hamano
* maint: pull: do not display fetch usage on --help-all git-tag.txt: list all modes in the description commit,status: describe -u likewise add: describe --patch like checkout, reset commit,merge,tag: describe -m likewise clone,init: describe --template using the same wording commit,status: describe --porcelain just like push commit,tag: use same wording for -F configure: use AC_LANG_PROGRAM consistently string_list_append: always set util pointer to NULL correct type of EMPTY_TREE_SHA1_BIN
2011-02-15commit,merge,tag: describe -m likewiseMichael J Gruber
This also removes the superfluous "specify" and rewords the misleading "if any" which sounds as if omitting "-m" would omit the merge commit message. (It means "if a merge commit is created at all".) Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-28cherry-pick/revert: add support for -X/--strategy-optionJonathan Nieder
For example, this would allow cherry-picking or reverting patches from a piece of history with a different end-of-line style, like so: $ git revert -Xrenormalize old-problematic-commit Currently that is possible with manual use of merge-recursive but the cherry-pick/revert porcelain does not expose the functionality. While at it, document the existing support for --strategy. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-13Merge branch 'jn/git-cmd-h-bypass-setup'Junio C Hamano
* jn/git-cmd-h-bypass-setup: update-index -h: show usage even with corrupt index merge -h: show usage even with corrupt index ls-files -h: show usage even with corrupt index gc -h: show usage even with broken configuration commit/status -h: show usage even with broken configuration checkout-index -h: show usage even in an invalid repository branch -h: show usage even in an invalid repository Conflicts: builtin/merge.c
2010-12-08Merge branch 'jh/notes-merge'Junio C Hamano
* jh/notes-merge: (23 commits) Provide 'git merge --abort' as a synonym to 'git reset --merge' cmd_merge(): Parse options before checking MERGE_HEAD Provide 'git notes get-ref' to easily retrieve current notes ref git notes merge: Add testcases for merging notes trees at different fanouts git notes merge: Add another auto-resolving strategy: "cat_sort_uniq" git notes merge: --commit should fail if underlying notes ref has moved git notes merge: List conflicting notes in notes merge commit message git notes merge: Manual conflict resolution, part 2/2 git notes merge: Manual conflict resolution, part 1/2 Documentation: Preliminary docs on 'git notes merge' git notes merge: Add automatic conflict resolvers (ours, theirs, union) git notes merge: Handle real, non-conflicting notes merges builtin/notes.c: Refactor creation of notes commits. git notes merge: Initial implementation handling trivial merges only builtin/notes.c: Split notes ref DWIMmery into a separate function notes.c: Use two newlines (instead of one) when concatenating notes (trivial) t3303: Indent with tabs instead of spaces for consistency notes.h/c: Propagate combine_notes_fn return value to add_note() and beyond notes.h/c: Allow combine_notes functions to remove notes notes.c: Reorder functions in preparation for next commit ... Conflicts: builtin.h
2010-11-24Merge branch 'cb/maint-orphan-merge-noclobber'Junio C Hamano
* cb/maint-orphan-merge-noclobber: do not overwrite untracked during merge from unborn branch
2010-11-17Provide 'git merge --abort' as a synonym to 'git reset --merge'Johan Herland
Teach 'git merge' the --abort option, which verifies the existence of MERGE_HEAD and then invokes 'git reset --merge' to abort the current in-progress merge and attempt to reconstruct the pre-merge state. The reason for adding this option is to provide a user interface for aborting an in-progress merge that is consistent with the interface for aborting a rebase ('git rebase --abort'), aborting the application of a patch series ('git am --abort'), and aborting an in-progress notes merge ('git notes merge --abort'). The patch includes documentation and testcases that explain and verify the various scenarios in which 'git merge --abort' can run. The testcases also document the cases in which 'git merge --abort' is unable to correctly restore the pre-merge state (look for the '###' comments towards the bottom of t/t7609-merge-abort.sh). This patch has been improved by the following contributions: - Jonathan Nieder: Move test documentation into test_description Thanks-to: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-17cmd_merge(): Parse options before checking MERGE_HEADJohan Herland
Reorder the initial part of builtin/merge.c:cmd_merge() so that command-line options are parsed _before_ we load the index and check for MERGE_HEAD (and exits if it exists). This does not change the behaviour of 'git merge', but is needed in preparation for the implementation of 'git merge --abort' (which requires MERGE_HEAD to be present). This patch has been improved by the following contributions: - Junio C Hamano: fixup minor style issues Thanks-to: Junio C Hamano <gitster@pobox.com> Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-15do not overwrite untracked during merge from unborn branchClemens Buchacher
In case HEAD does not point to a valid commit yet, merge is implemented as a hard reset. This will cause untracked files to be overwritten. Instead, assume the empty tree for HEAD and do a regular merge. An untracked file will cause the merge to abort and do nothing. If no conflicting files are present, the merge will have the same effect as a hard reset. Signed-off-by: Clemens Buchacher <drizzd@aon.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-03Change incorrect "remote branch" to "remote tracking branch" in C codeMatthieu Moy
(Just like we did for documentation already) In the process, we change "non-remote branch" to "branch outside the refs/remotes/ hierarchy" to avoid the ugly "non-remote-tracking branch". The new formulation actually corresponds to how the code detects this case (i.e. prefixcmp(refname, "refs/remotes")). Also, we use 'remote-tracking branch' in generated merge messages (by merge an fmt-merge-msg). Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-27Merge branch 'jf/merge-ignore-ws'Junio C Hamano
* jf/merge-ignore-ws: merge-recursive: options to ignore whitespace changes merge-recursive --patience ll-merge: replace flag argument with options struct merge-recursive: expose merge options for builtin merge
2010-10-22merge -h: show usage even with corrupt indexNguyễn Thái Ngọc Duy
Part of a campaign to make sure "git <command> -h" works correctly when run from distractingly bad repositories. [jn: with rewritten log message and tests] Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-29Merge branch 'rr/fmt-merge-msg'Junio C Hamano
* rr/fmt-merge-msg: t6200-fmt-merge-msg: Exercise '--log' to configure shortlog length t6200-fmt-merge-msg: Exercise 'merge.log' to configure shortlog length merge: Make 'merge.log' an integer or boolean option merge: Make '--log' an integer option for number of shortlog entries fmt_merge_msg: Change fmt_merge_msg API to accept shortlog_len Conflicts: builtin/merge.c
2010-09-09merge: Make 'merge.log' an integer or boolean optionRamkumar Ramachandra
Make 'merge.log' an integer or boolean option to set the number of shortlog entries to display in the merge commit. Note that it defaults to false, and that true means a default value of 20. Also update corresponding documentation. Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> Thanks-to: Jonathan Nieder <jrnieder@gmail.com> Thanks-to: Johannes Sixt <j.sixt@viscovery.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-09merge: Make '--log' an integer option for number of shortlog entriesRamkumar Ramachandra
Change the command-line '--log' option from a boolean option to an integer option, and parse the optional integer provided on the command-line into the 'shortlog_len' variable. Also update the documentation accordingly. Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> Reported-by: Yaroslav Halchenko <debian@onerussian.com> Thanks-to: Jonathan Nieder <jrnieder@gmail.com> Thanks-to: Johannes Sixt <j.sixt@viscovery.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-09fmt_merge_msg: Change fmt_merge_msg API to accept shortlog_lenRamkumar Ramachandra
Give "shortlog_len" parameter to the fmt_merge_msg(), remove its "merge_summary" parameter, and remove fmt_merge_msg_shortlog() function. In the updated API, shortlog_len == 0 means no shortlog is given. The parameter "merge_title" controls if the title of the merge commit is autogenerated (it reads something like "Merge branch ..."), and typically it is set to true when the caller does not give its own message. Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> Mentored-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-04Merge branch 'dg/local-mod-error-messages'Junio C Hamano
* dg/local-mod-error-messages: t7609-merge-co-error-msgs: test non-fast forward case too. Move "show_all_errors = 1" to setup_unpack_trees_porcelain() setup_unpack_trees_porcelain: take the whole options struct as parameter Move set_porcelain_error_msgs to unpack-trees.c and rename it Conflicts: merge-recursive.c
2010-09-03Merge branch 'jn/merge-custom-no-trivial'Junio C Hamano
* jn/merge-custom-no-trivial: t7606: Avoid using head as a file name merge: let custom strategies intervene in trivial merges t7606 (merge-theirs): modernize style
2010-09-03Merge branch 'jn/update-contrib-example-merge'Junio C Hamano
* jn/update-contrib-example-merge: (24 commits) merge script: learn --[no-]rerere-autoupdate merge script: notice @{-1} shorthand merge script: handle --no-ff --no-commit correctly merge script: --ff-only to disallow true merge merge script: handle many-way octopus merge script: handle -m --log correctly merge script: forbid merge -s index merge script: allow custom strategies merge script: merge -X<option> merge script: improve log message subject merge script: refuse to merge during merge merge script: tweak unmerged files message to match builtin merge script: --squash, --ff from unborn branch are errors fmt-merge-msg -m to override merge title merge-base --independent to print reduced parent list in a merge merge-base --octopus to mimic show-branch --merge-base Documentation: add a SEE ALSO section for merge-base t6200 (fmt-merge-msg): style nitpicks t6010 (merge-base): modernize style t7600 (merge): test merge from branch yet to be born ...
2010-09-03Merge branch 'jn/merge-renormalize'Junio C Hamano
* jn/merge-renormalize: merge-recursive --renormalize rerere: never renormalize rerere: migrate to parse-options API t4200 (rerere): modernize style ll-merge: let caller decide whether to renormalize ll-merge: make flag easier to populate Documentation/technical: document ll_merge merge-trees: let caller decide whether to renormalize merge-trees: push choice to renormalize away from low level t6038 (merge.renormalize): check that it can be turned off t6038 (merge.renormalize): try checkout -m and cherry-pick t6038 (merge.renormalize): style nitpicks Don't expand CRLFs when normalizing text during merge Try normalizing files to avoid delete/modify conflicts when merging Avoid conflicts when merging branches with mixed normalization Conflicts: builtin/rerere.c t/t4200-rerere.sh
2010-09-03Move "show_all_errors = 1" to setup_unpack_trees_porcelain()Matthieu Moy
Not only this makes the code clearer since setting up the porcelain error message is meant to work with show_all_errors, but this fixes a call to setup_unpack_trees_porcelain() in git_merge_trees() which did not set show_all_errors. add_rejected_path() used to double-check whether it was running in plumbing mode. This check was ineffective since it was setting show_all_errors too late for traverse_trees() to see it, and is made useless by this patch. Remove it. Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-03setup_unpack_trees_porcelain: take the whole options struct as parameterMatthieu Moy
This is a preparation patch to let setup_unpack_trees_porcelain set show_all_errors itself. Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-03Move set_porcelain_error_msgs to unpack-trees.c and rename itMatthieu Moy
The function is currently dealing only with error messages, but the intent of calling it is really to notify the unpack-tree mechanics that it is running in porcelain mode. Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-26merge-recursive: expose merge options for builtin mergeJonathan Nieder
There are two very similar blocks of code that recognize options for the "recursive" merge strategy. Unify them. No functional change intended. Cc: Avery Pennarun <apenwarr@gmail.com> Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-22Merge branch 'gb/split-cmdline-errmsg'Junio C Hamano
* gb/split-cmdline-errmsg: split_cmdline: Allow caller to access error string
2010-08-18merge: do not mistake (ancestor of) tag for branchJonathan Nieder
If no branch 'foo' exists but a tag 'foo' does, then git merge foo^ results in Merge branch 'foo' (early part) as a commit message, because the relevant code path checks that refs/heads/foo is a valid refname for writing rather than for reading. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-16merge: let custom strategies intervene in trivial mergesJonathan Nieder
As v1.6.1-rc1~294^2 (2008-08-23) explains, custom merge strategies do not even kick in when the merge is truly trivial. But they should, since otherwise a custom “--strategy=theirs” is not useful. Perhaps custom strategies should not allow fast-forward either. This patch does not make that change, since it is less important (because it is always possible to explicitly use --no-ff). Reported-by: Yaroslav Halchenko <debian@onerussian.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-11unpack_trees: group error messages by typeMatthieu Moy
When an error is encountered, it calls add_rejected_file() which either - directly displays the error message and stops if in plumbing mode (i.e. if show_all_errors is not initialized at 1) - or stores it so that it will be displayed at the end with display_error_msgs(), Storing the files by error type permits to have a list of files for which there is the same error instead of having a serie of almost identical errors. As each bind_overlap error combines a file and an old file, a list cannot be done, therefore, theses errors are not stored but directly displayed. Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-11merge-recursive: porcelain messages for checkoutDiane Gasselin
A porcelain message was first added in checkout.c in the commit 8ccba008 (Junio C Hamano, Sat May 17 21:03:49 2008, unpack-trees: allow Porcelain to give different error messages) to give better feedback in the case of merge errors. This patch adapts the porcelain messages for the case of checkout instead. This way, when having a checkout error, "merge" no longer appears in the error message. While we're there, we add an advice in the case of would_lose_untracked_file. Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-11Turn unpack_trees_options.msgs into an array + enumMatthieu Moy
The list of error messages was introduced as a structure, but an array indexed over an enum is more flexible, since it allows one to store a type of error message (index in the array) in a variable. This change needs to rename would_lose_untracked -> would_lose_untracked_file to avoid a clash with the function would_lose_untracked in merge-recursive.c. Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-11split_cmdline: Allow caller to access error stringGreg Brockman
This allows the caller to add its own error message to that returned by split_cmdline. Thus error output following a failed split_cmdline can be of the form fatal: Bad alias.test string: cmdline ends with \ rather than error: cmdline ends with \ fatal: Bad alias.test string Signed-off-by: Greg Brockman <gdb@mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-06merge-recursive --renormalizeJonathan Nieder
Teach "git merge-recursive" a --renormalize option to enable the merge.renormalize configuration. The --no-renormalize option can be used to override it in the negative. So in the future, you might be able to, e.g.: git checkout -m -Xrenormalize otherbranch or git revert -Xrenormalize otherpatch or git pull --rebase -Xrenormalize The bad part: merge.renormalize is still not honored for most commands. And it reveals lots of places that -X has not been plumbed in (so we get "git merge -Xrenormalize" but not much else). NEEDSWORK: tests Cc: Eyvind Bernhardsen <eyvind.bernhardsen@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-07-02Avoid conflicts when merging branches with mixed normalizationEyvind Bernhardsen
Currently, merging across changes in line ending normalization is painful since files containing CRLF will conflict with normalized files, even if the only difference between the two versions is the line endings. Additionally, any "real" merge conflicts that exist are obscured because every line in the file has a conflict. Assume you start out with a repo that has a lot of text files with CRLF checked in (A): o---C / \ A---B---D B: Add "* text=auto" to .gitattributes and normalize all files to LF-only C: Modify some of the text files D: Try to merge C You will get a ridiculous number of LF/CRLF conflicts when trying to merge C into D, since the repository contents for C are "wrong" wrt the new .gitattributes file. Fix ll-merge so that the "base", "theirs" and "ours" stages are passed through convert_to_worktree() and convert_to_git() before a three-way merge. This ensures that all three stages are normalized in the same way, removing from consideration differences that are only due to normalization. This feature is optional for now since it changes a low-level mechanism and is not necessary for the majority of users. The "merge.renormalize" config variable enables it. Signed-off-by: Eyvind Bernhardsen <eyvind.bernhardsen@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>