aboutsummaryrefslogtreecommitdiff
path: root/builtin-merge.c
Commit message (Collapse)AuthorAge
...
| * | builtin-merge: release the lockfile in try_merge_strategy()Miklos Vajna2008-09-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Once we committed the locked index, we should release the lockfile. In most cases this is done automatically when the process ends, but this is not true in this case. [jc: with additional tests from Eric Raible] Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | builtin-merge: avoid run_command_v_opt() for recursive and subtreeMiklos Vajna2008-08-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The try_merge_strategy() function always ran the strategy in a separate process, though this is not always necessary. The recursive and subtree strategy can be called without a fork(). This patch adds a check, and calls recursive in the same process without wasting resources. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'mv/commit-tree'Shawn O. Pearce2008-09-25
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | * mv/commit-tree: t7603: add new testcases to ensure builtin-commit uses reduce_heads() builtin-commit: use commit_tree() commit_tree(): add a new author parameter
| * | | commit_tree(): add a new author parameterMiklos Vajna2008-09-10
| |/ / | | | | | | | | | | | | | | | | | | | | | In case it's NULL, it is still determined automatically, but now you have the ability to specify one yourself. Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'maint'Shawn O. Pearce2008-09-25
|\ \ \ | |/ / |/| / | |/ | | | | | | | | | | * maint: Update release notes for 1.6.0.3 checkout: Do not show local changes when in quiet mode for-each-ref: Fix --format=%(subject) for log message without newlines git-stash.sh: don't default to refs/stash if invalid ref supplied maint: check return of split_cmdline to avoid bad config strings
| * maint: check return of split_cmdline to avoid bad config stringsDeskin Miller2008-09-24
| | | | | | | | | | | | | | | | | | | | | | As the testcase demonstrates, it's possible for split_cmdline to return -1 and deallocate any memory it's allocated, if the config string is missing an end quote. In both the cases below, which are the only calling sites, the return isn't checked, and using the pointer causes a pretty immediate segfault. Signed-off-by: Deskin Miller <deskinm@umich.edu> Acked-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | Remove useless memset of static command name lists in builtin-merge.cAlex Riesen2008-08-28
| | | | | | | | | | | | | | The statics are always initialized with 0 Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Remove calculation of the longest command name from where it is not usedAlex Riesen2008-08-28
| | | | | | | | | | | | | | | | | | Just calculate it where it is needed - it is cheap and trivial, as all the lengths are already there (stored when creating the command lists). Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'mv/merge-custom'Junio C Hamano2008-08-27
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * mv/merge-custom: t7606: fix custom merge test Fix "git-merge -s bogo" help text Update .gitignore to ignore git-help Builtin git-help. builtin-help: always load_command_list() in cmd_help() Add a second testcase for handling invalid strategies in git-merge Add a new test for using a custom merge strategy builtin-merge: allow using a custom strategy builtin-help: make some internal functions available to other builtins Conflicts: help.c
| * | Fix "git-merge -s bogo" help textJunio C Hamano2008-08-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | It does not make much sense to reuse the output code from "git help" to show the list of commands to the standard output while giving the error message before that to the standard error stream. This makes the output consistent to that of the 1.6.0 version of "git merge". Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | builtin-merge: allow using a custom strategyMiklos Vajna2008-07-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow using a custom strategy, as long as it's named git-merge-foo. The error handling is now done using is_git_command(). The list of available strategies is now shown by list_commands(). If an invalid strategy is supplied, like -s foobar, then git-merge would list all git-merge-* commands. This is not perfect, since for example git-merge-index is not a valid strategy. These are removed from the output by scanning the list of main commands; if the git-merge-foo command is listed in the all_strategy list, then it's shown, otherwise excluded. This does not exclude commands somewhere else in the PATH, where custom strategies are expected. Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'maint' to sync with 1.6.0.1Junio C Hamano2008-08-24
|\ \ \ | | |/ | |/|
| * | merge: fix numerus bugs around "trivial merge" areaJunio C Hamano2008-08-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The "trivial merge" codepath wants to optimize itself by making an internal call to the read-tree machinery, but it does not read the index before doing so, and the codepath is never exercised. Incidentally, this failure to read the index upfront means that the safety to refuse doing anything when the index is unmerged does not kick in, either. These two problem are fixed by using read_cache_unmerged() that does read the index before checking if it is unmerged at the beginning of cmd_merge(). The primary logic of the merge, however, assumes that the process never reads the index in-core, and the call to write_cache_as_tree() it makes from write_tree_trivial() will always read from the on-disk index that is prepared the strategy back-ends. This assumption is now broken by the above fix. To fix this issue, we now call discard_cache() before calling write_tree_trivial() when it wants to write the on-disk index as a tree. When multiple strategies are tried, their results are evaluated by reading the resulting index and inspecting it. The codepath needs to make a call to read_cache() for each successful strategy, and for that to work, they need to discard_cache() the one read by the previous round. Also the "trivial merge" forgot that the current commit is one of the parents of the resulting commit. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | provide more errors for the "merge into empty head" casePaolo Bonzini2008-08-21
|/ / | | | | | | | | | | | | | | | | | | | | | | | | A squash merge into an unborn branch could be implemented by building the index from the merged-from branch, and doing a single commit, but this is not supported yet. A non-fast-forward merge into an unborn branch does not make any sense, because you cannot make a merge commit if you don't have a commit to use as the parent. Signed-off-by: Paolo Bonzini <bonzini@gnu.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | "git-merge": allow fast-forwarding in a stat-dirty treeJunio C Hamano2008-08-20
| | | | | | | | | | | | | | We used to refresh the index to clear stat-dirtyness before a fast-forward merge. Recent C rewrite forgot to do this. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Fix merge name generation in "merge in C"Junio C Hamano2008-07-30
|/ | | | | | | | | | | | | | | | | | | | | | When merging an early part of a branch, e.g. "git merge xyzzy~20", we were supposed to say "branch 'xyzzy' (early part)", but it incorrectly said "branch 'refs/heads/xy' (early part)" instead. The logic was supposed to first strip away "~20" part to make sure that what follows "~" is a non-zero posint, prefix it with "refs/heads/" and ask resolve_ref() if it is a ref. If it is, then we know xyzzy was a branch, and we can give the correct message. However, there were a few bugs. First of all, the logic to build this "true branch refname" did not count the characters correctly. At this point of the code, "len" is the number of trailing, non-name part of the given extended SHA-1 expression given by the user, i.e. number of bytes in "~20" in the above example. In addition, the message forgot to skip "refs/heads/" it prefixed from the output. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Make non-static functions, that may be static, staticStephan Beyer2008-07-23
| | | | | Signed-off-by: Stephan Beyer <s-beyer@gmx.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* builtin-merge: add missing structure initializationPierre Habouzit2008-07-21
| | | | | | | | The parameter that is eventually passed to read_directory() to scan the working tree should be properly initialized. Signed-off-by: Pierre Habouzit <madcoder@debian.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* builtin-merge: give a proper error message for invalid strategies in configMiklos Vajna2008-07-21
| | | | | | | | | | 'git merge -s foobar' diagnosed invalid "foobar" strategy and errored out with a message, but foobar in pull.twohead or pull.octopus was just silently ignored. This makes invalid strategy both on the command line and in the configuration file to trigger the same error. Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* builtin-merge.c: Fix option parsingMichele Ballabio2008-07-20
| | | | | | | | | | Now "git merge -m" needs a message, and errors out with the usage text if none is given. This way, t7600-merge.sh is fixed. Signed-off-by: Michele Ballabio <barra_cuda@katamail.com> Acked-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Teach 'git merge' that some merge strategies no longer existMiklos Vajna2008-07-20
| | | | | | | | | | | | | | 'recur' co-existed with 'recursive' when rewriting it in C, but it no longer available. 'stupid' was also recently removed. "git merge -s confused origin" still includes them in the list of available merge strategies. [jc: this is a squash of two micropatches] Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'mv/merge-in-c'Junio C Hamano2008-07-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * mv/merge-in-c: reduce_heads(): protect from duplicate input reduce_heads(): thinkofix Add a new test for git-merge-resolve t6021: add a new test for git-merge-resolve Teach merge.log to "git-merge" again Build in merge Fix t7601-merge-pull-config.sh on AIX git-commit-tree: make it usable from other builtins Add new test case to ensure git-merge prepends the custom merge message Add new test case to ensure git-merge reduces octopus parents when possible Introduce reduce_heads() Introduce get_merge_bases_many() Add new test to ensure git-merge handles more than 25 refs. Introduce get_octopus_merge_bases() in commit.c git-fmt-merge-msg: make it usable from other builtins Move read_cache_unmerged() to read-cache.c Add new test to ensure git-merge handles pull.twohead and pull.octopus Move parse-options's skip_prefix() to git-compat-util.h Move commit_list_count() to commit.c Move split_cmdline() to alias.c Conflicts: Makefile parse-options.c
* Teach merge.log to "git-merge" againJunio C Hamano2008-07-10
| | | | | | The command forgot the configuration variable when rewritten in C. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Build in mergeMiklos Vajna2008-07-07
Mentored-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>