From: Junio C Hamano Date: Tue, 24 Nov 2009 06:31:51 +0000 (-0800) Subject: Merge branch 'mm/maint-hint-failed-merge' X-Git-Tag: v1.6.6-rc1~37 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/444e10df2a4159b5dd2975feadbb9e1213d65b47?ds=sidebyside;hp=-c Merge branch 'mm/maint-hint-failed-merge' * mm/maint-hint-failed-merge: user-manual: Document that "git merge" doesn't like uncommited changes. merge-recursive: point the user to commit when file would be overwritten. --- 444e10df2a4159b5dd2975feadbb9e1213d65b47 diff --combined Documentation/config.txt index 657f0016d3,0b550dc490..a8e0876a2a --- a/Documentation/config.txt +++ b/Documentation/config.txt @@@ -126,16 -126,16 +126,20 @@@ advice.*: Directions on how to stage/unstage/add shown in the output of linkgit:git-status[1] and the template shown when writing commit messages. Default: true. + commitBeforeMerge:: + Advice shown when linkgit:git-merge[1] refuses to + merge to avoid overwritting local changes. + Default: true. -- core.fileMode:: If false, the executable bit differences between the index and the working copy are ignored; useful on broken filesystems like FAT. - See linkgit:git-update-index[1]. True by default. + See linkgit:git-update-index[1]. ++ +The default is true, except linkgit:git-clone[1] or linkgit:git-init[1] +will probe and set core.fileMode false if appropriate when the +repository is created. core.ignoreCygwinFSTricks:: This option is only used by Cygwin implementation of Git. If false, @@@ -148,18 -148,6 +152,18 @@@ is true, in which case ignoreCygwinFSTricks is ignored as Cygwin's POSIX emulation is required to support core.filemode. +core.ignorecase:: + If true, this option enables various workarounds to enable + git to work better on filesystems that are not case sensitive, + like FAT. For example, if a directory listing finds + "makefile" when git expects "Makefile", git will assume + it is really the same file, and continue to remember it as + "Makefile". ++ +The default is false, except linkgit:git-clone[1] or linkgit:git-init[1] +will probe and set core.ignorecase true if appropriate when the repository +is created. + core.trustctime:: If false, the ctime differences between the index and the working copy are ignored; useful when the inode change time @@@ -185,10 -173,9 +189,10 @@@ core.autocrlf: writing to the filesystem. The variable can be set to 'input', in which case the conversion happens only while reading from the filesystem but files are written out with - `LF` at the end of lines. Currently, which paths to consider - "text" (i.e. be subjected to the autocrlf mechanism) is - decided purely based on the contents. + `LF` at the end of lines. A file is considered + "text" (i.e. be subjected to the autocrlf mechanism) based on + the file's `crlf` attribute, or if `crlf` is unspecified, + based on the file's contents. See linkgit:gitattributes[5]. core.safecrlf:: If true, makes git check if converting `CRLF` as controlled by @@@ -240,11 -227,7 +244,11 @@@ core.symlinks: contain the link text. linkgit:git-update-index[1] and linkgit:git-add[1] will not change the recorded type to regular file. Useful on filesystems like FAT that do not support - symbolic links. True by default. + symbolic links. ++ +The default is true, except linkgit:git-clone[1] or linkgit:git-init[1] +will probe and set core.symlinks false if appropriate when the repository +is created. core.gitProxy:: A "proxy command" to execute (as 'command host port') instead @@@ -401,15 -384,16 +405,15 @@@ Common unit suffixes of 'k', 'm', or 'g core.excludesfile:: In addition to '.gitignore' (per-directory) and '.git/info/exclude', git looks into this file for patterns - of files which are not meant to be tracked. See - linkgit:gitignore[5]. + of files which are not meant to be tracked. "{tilde}/" is expanded + to the value of `$HOME` and "{tilde}user/" to the specified user's + home directory. See linkgit:gitignore[5]. core.editor:: Commands such as `commit` and `tag` that lets you edit messages by launching an editor uses the value of this variable when it is set, and the environment variable - `GIT_EDITOR` is not set. The order of preference is - `GIT_EDITOR` environment, `core.editor`, `VISUAL` and - `EDITOR` environment variables and then finally `vi`. + `GIT_EDITOR` is not set. See linkgit:git-var[1]. core.pager:: The command that git will use to paginate output. Can @@@ -436,17 -420,13 +440,17 @@@ core.whitespace: consider them as errors. You can prefix `-` to disable any of them (e.g. `-trailing-space`): + -* `trailing-space` treats trailing whitespaces at the end of the line +* `blank-at-eol` treats trailing whitespaces at the end of the line as an error (enabled by default). * `space-before-tab` treats a space character that appears immediately before a tab character in the initial indent part of the line as an error (enabled by default). * `indent-with-non-tab` treats a line that is indented with 8 or more space characters as an error (not enabled by default). +* `blank-at-eof` treats blank lines added at the end of file as an error + (enabled by default). +* `trailing-space` is a short-hand to cover both `blank-at-eol` and + `blank-at-eof`. * `cr-at-eol` treats a carriage-return at the end of line as part of the line terminator, i.e. with it, `trailing-space` does not trigger if the character before such a carriage-return @@@ -478,19 -458,6 +482,19 @@@ On some file system/operating system co Set this config setting to 'rename' there; However, This will remove the check that makes sure that existing object files will not get overwritten. +core.notesRef:: + When showing commit messages, also show notes which are stored in + the given ref. This ref is expected to contain files named + after the full SHA-1 of the commit they annotate. ++ +If such a file exists in the given ref, the referenced blob is read, and +appended to the commit message, separated by a "Notes:" line. If the +given ref itself does not exist, it is not an error, but means that no +notes should be printed. ++ +This setting defaults to "refs/notes/commits", and can be overridden by +the `GIT_NOTES_REF` environment variable. + add.ignore-errors:: Tells 'git-add' to continue adding files when some files cannot be added due to indexing errors. Equivalent to the '--ignore-errors' @@@ -703,8 -670,6 +707,8 @@@ color.ui: commit.template:: Specify a file to use as the template for new commit messages. + "{tilde}/" is expanded to the value of `$HOME` and "{tilde}user/" to the + specified user's home directory. diff.autorefreshindex:: When using 'git-diff' to compare with work tree @@@ -1128,14 -1093,6 +1132,14 @@@ http.maxRequests: How many HTTP requests to launch in parallel. Can be overridden by the 'GIT_HTTP_MAX_REQUESTS' environment variable. Default is 5. +http.postBuffer:: + Maximum size in bytes of the buffer used by smart HTTP + transports when POSTing data to the remote system. + For requests larger than this buffer size, HTTP/1.1 and + Transfer-Encoding: chunked is used to avoid creating a + massive pack file locally. Default is 1 MiB, which is + sufficient for most requests. + http.lowSpeedLimit, http.lowSpeedTime:: If the HTTP transfer speed is less than 'http.lowSpeedLimit' for longer than 'http.lowSpeedTime' seconds, the transfer is aborted. @@@ -1367,11 -1324,6 +1371,11 @@@ rebase.stat: Whether to show a diffstat of what changed upstream since the last rebase. False by default. +receive.autogc:: + By default, git-receive-pack will run "git-gc --auto" after + receiving data from git-push and updating refs. You can stop + it by setting this variable to false. + receive.fsckObjects:: If it is set to true, git-receive-pack will check all received objects. It will abort in the case of a malformed object or a @@@ -1403,14 -1355,10 +1407,14 @@@ receive.denyCurrentBranch: receive.denyNonFastForwards:: If set to true, git-receive-pack will deny a ref update which is - not a fast forward. Use this to prevent such an update via a push, + not a fast-forward. Use this to prevent such an update via a push, even if that push is forced. This configuration variable is set when initializing a shared repository. +receive.updateserverinfo:: + If set to true, git-receive-pack will run git-update-server-info + after receiving data from git-push and updating refs. + remote..url:: The URL of a remote repository. See linkgit:git-fetch[1] or linkgit:git-push[1]. @@@ -1437,13 -1385,7 +1441,13 @@@ remote..mirror: remote..skipDefaultUpdate:: If true, this remote will be skipped by default when updating - using the update subcommand of linkgit:git-remote[1]. + using linkgit:git-fetch[1] or the `update` subcommand of + linkgit:git-remote[1]. + +remote..skipFetchAll:: + If true, this remote will be skipped by default when updating + using linkgit:git-fetch[1] or the `update` subcommand of + linkgit:git-remote[1]. remote..receivepack:: The default program to execute on the remote side when pushing. See diff --combined Documentation/user-manual.txt index 27d97b6d1e,c32dd87c8b..b169836684 --- a/Documentation/user-manual.txt +++ b/Documentation/user-manual.txt @@@ -1183,7 -1183,23 +1183,23 @@@ $ git merge branchnam ------------------------------------------------- merges the development in the branch "branchname" into the current - branch. If there are conflicts--for example, if the same file is + branch. + + A merge is made by combining the changes made in "branchname" and the + changes made up to the latest commit in your current branch since + their histories forked. The work tree is overwritten by the result of + the merge when this combining is done cleanly, or overwritten by a + half-merged results when this combining results in conflicts. + Therefore, if you have uncommitted changes touching the same files as + the ones impacted by the merge, Git will refuse to proceed. Most of + the time, you will want to commit your changes before you can merge, + and if you don't, then linkgit:git-stash[1] can take these changes + away while you're doing the merge, and reapply them afterwards. + + If the changes are independant enough, Git will automatically complete + the merge and commit the result (or reuse an existing commit in case + of <>, see below). On the other hand, + if there are conflicts--for example, if the same file is modified in two different ways in the remote branch and the local branch--then you are warned; the output may look something like this: @@@ -1384,7 -1400,7 +1400,7 @@@ were merged However, if the current branch is a descendant of the other--so every commit present in the one is already contained in the other--then git -just performs a "fast forward"; the head of the current branch is moved +just performs a "fast-forward"; the head of the current branch is moved forward to point at the head of the merged-in branch, without any new commits being created. @@@ -1679,7 -1695,7 +1695,7 @@@ Sharing development with other Getting updates with git pull ----------------------------- - After you clone a repository and make a few changes of your own, you + After you clone a repository and commit a few changes of your own, you may wish to check the original repository for updates and merge them into your own work. @@@ -1719,7 -1735,7 +1735,7 @@@ producing a default commit message docu repository that you pulled from. (But note that no such commit will be created in the case of a -<>; instead, your branch will just be +<>; instead, your branch will just be updated to point to the latest commit from the upstream branch.) The `git pull` command can also be given "." as the "remote" repository, @@@ -1943,7 -1959,7 +1959,7 @@@ $ git push ssh://yourserver.com/~you/pr ------------------------------------------------- As with `git fetch`, `git push` will complain if this does not result in a -<>; see the following section for details on +<>; see the following section for details on handling this case. Note that the target of a "push" is normally a @@@ -1976,7 -1992,7 +1992,7 @@@ details What to do when a push fails ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -If a push would not result in a <> of the +If a push would not result in a <> of the remote branch, then it will fail with an error like: ------------------------------------------------- @@@ -2115,7 -2131,7 +2131,7 @@@ $ git checkout release && git pul Important note! If you have any local changes in these branches, then this merge will create a commit object in the history (with no local -changes git will simply do a "Fast forward" merge). Many people dislike +changes git will simply do a "fast-forward" merge). Many people dislike the "noise" that this creates in the Linux history, so you should avoid doing this capriciously in the "release" branch, as these noisy commits will become part of the permanent history when you ask Linus to pull @@@ -2569,7 -2585,7 +2585,7 @@@ them again with linkgit:git-am[1] Other tools ----------- -There are numerous other tools, such as StGIT, which exist for the +There are numerous other tools, such as StGit, which exist for the purpose of maintaining a patch series. These are outside of the scope of this manual. @@@ -2729,9 -2745,9 +2745,9 @@@ In the previous example, when updating checks to make sure that the most recent commit on the remote branch is a descendant of the most recent commit on your copy of the branch before updating your copy of the branch to point at the new -commit. Git calls this process a <>. +commit. Git calls this process a <>. -A fast forward looks something like this: +A fast-forward looks something like this: ................................................ o--o--o--o <-- old head of the branch @@@ -4275,7 -4291,7 +4291,7 @@@ You see, Git is actually the best tool itself! [[glossary]] -GIT Glossary +Git Glossary ============ include::glossary-content.txt[] diff --combined merge-recursive.c index baabe2c356,1870448d98..a91208f295 --- a/merge-recursive.c +++ b/merge-recursive.c @@@ -3,6 -3,7 +3,7 @@@ * Fredrik Kuivinen. * The thieves were Alex Riesen and Johannes Schindelin, in June/July 2006 */ + #include "advice.h" #include "cache.h" #include "cache-tree.h" #include "commit.h" @@@ -86,7 -87,6 +87,7 @@@ static void flush_output(struct merge_o } } +__attribute__((format (printf, 3, 4))) static void output(struct merge_options *o, int v, const char *fmt, ...) { int len; @@@ -171,7 -171,7 +172,7 @@@ static int git_merge_trees(int index_on int rc; struct tree_desc t[3]; struct unpack_trees_options opts; - static const struct unpack_trees_error_msgs msgs = { + struct unpack_trees_error_msgs msgs = { /* would_overwrite */ "Your local changes to '%s' would be overwritten by merge. Aborting.", /* not_uptodate_file */ @@@ -183,6 -183,11 +184,11 @@@ /* bind_overlap -- will not happen here */ NULL, }; + if (advice_commit_before_merge) { + msgs.would_overwrite = msgs.not_uptodate_file = + "Your local changes to '%s' would be overwritten by merge. Aborting.\n" + "Please, commit your changes or stash them before you can merge."; + } memset(&opts, 0, sizeof(opts)); if (index_only) @@@ -215,8 -220,7 +221,8 @@@ struct tree *write_tree_from_memory(str for (i = 0; i < active_nr; i++) { struct cache_entry *ce = active_cache[i]; if (ce_stage(ce)) - output(o, 0, "%d %.*s", ce_stage(ce), ce_namelen(ce), ce->name); + output(o, 0, "%d %.*s", ce_stage(ce), + (int)ce_namelen(ce), ce->name); } return NULL; }