From b933e818e951c290e8355ae544567bba949f392e Mon Sep 17 00:00:00 2001 From: Josef Weidendorfer Date: Sun, 27 Nov 2005 22:08:33 +0100 Subject: Small fixes in Documentation/git-mv.txt The two synopsis lines have to be prefixed with a space so that asciidoc inserts a line break inbetween for the manual page. Signed-off-by: Josef Weidendorfer Signed-off-by: Junio C Hamano --- Documentation/git-mv.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Documentation') diff --git a/Documentation/git-mv.txt b/Documentation/git-mv.txt index f2d5882f48..3013b8d0c2 100644 --- a/Documentation/git-mv.txt +++ b/Documentation/git-mv.txt @@ -8,14 +8,14 @@ git-mv - Script used to move or rename a file, directory or symlink. SYNOPSIS -------- -'git-mv' [-f] [-n] -'git-mv' [-f] [-k] [-n] ... + 'git-mv' [-f] [-n] + 'git-mv' [-f] [-n] [-k] ... DESCRIPTION ----------- This script is used to move or rename a file, directory or symlink. In the first form, it renames , which must exist and be either -a file, symlink or directory, to , which must not exist. +a file, symlink or directory, to . In the second form, the last argument has to be an existing directory; the given sources will be moved into this directory. @@ -25,7 +25,7 @@ committed. OPTIONS ------- -f:: - Force renaming or moving even targets exist + Force renaming or moving of a file even if the target exists -k:: Skip move or rename actions which would lead to an error condition. An error happens when a source is neither existing nor -- cgit v1.3-6-g1900 From 9f63892b3803701c97259d51143e199fe9603d3f Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 28 Nov 2005 01:29:52 -0800 Subject: mailinfo: Do not use -u=; say --encoding= Specifying the value for a single letter, single dash option parameter with equal sign looked funny, and more importantly calling the flag to override encoding from utf-8 to something else "-u" (obviously abbreviated from "utf-8") did not make any sense. So spell it out. Signed-off-by: Junio C Hamano --- Documentation/git-mailinfo.txt | 11 +++++++++-- mailinfo.c | 6 +++--- 2 files changed, 12 insertions(+), 5 deletions(-) (limited to 'Documentation') diff --git a/Documentation/git-mailinfo.txt b/Documentation/git-mailinfo.txt index dc7d725ea1..8890754740 100644 --- a/Documentation/git-mailinfo.txt +++ b/Documentation/git-mailinfo.txt @@ -8,7 +8,7 @@ git-mailinfo - Extracts patch from a single e-mail message. SYNOPSIS -------- -'git-mailinfo' [-k] [-u] +'git-mailinfo' [-k] [-u | --encoding=] DESCRIPTION @@ -37,10 +37,17 @@ OPTIONS author email are taken from the e-mail without any charset conversion, after minimally decoding MIME transfer encoding. This flag causes the resulting - commit to be encoded in utf-8 by transliterating them. + commit to be encoded in the encoding specified by + i18n.commitencoding configuration (defaults to utf-8) by + transliterating them. Note that the patch is always used as is without charset conversion, even with this flag. +--encoding=:: + Similar to -u but if the local convention is different + from what is specified by i18n.commitencoding, this flag + can be used to override it. + :: The commit log message extracted from e-mail, usually except the title line which comes from e-mail Subject. diff --git a/mailinfo.c b/mailinfo.c index de105acaa8..890e3487ad 100644 --- a/mailinfo.c +++ b/mailinfo.c @@ -717,7 +717,7 @@ static void handle_body(void) } static const char mailinfo_usage[] = - "git-mailinfo [-k] [-u] msg patch info"; + "git-mailinfo [-k] [-u | --encoding=] msg patch info"; int main(int argc, char **argv) { @@ -731,8 +731,8 @@ int main(int argc, char **argv) keep_subject = 1; else if (!strcmp(argv[1], "-u")) metainfo_charset = git_commit_encoding; - else if (!strncmp(argv[1], "-u=", 3)) - metainfo_charset = argv[1] + 3; + else if (!strncmp(argv[1], "--encoding=", 11)) + metainfo_charset = argv[1] + 11; else usage(mailinfo_usage); argc--; argv++; -- cgit v1.3-6-g1900 From ffb1a4bed55534e276a0e4fc7dc1c94d17be8579 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 28 Nov 2005 22:54:30 -0800 Subject: Documentation: Describe merge operation a bit better. In git-merge documentation, add a section to describe what happens to the index and working tree during merge, and what their cleanliness requirements are before the merge. Signed-off-by: Junio C Hamano --- Documentation/git-merge.txt | 95 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) (limited to 'Documentation') diff --git a/Documentation/git-merge.txt b/Documentation/git-merge.txt index 904e2fc4c5..c1174041ec 100644 --- a/Documentation/git-merge.txt +++ b/Documentation/git-merge.txt @@ -37,6 +37,101 @@ include::merge-options.txt[] include::merge-strategies.txt[] +HOW MERGE WORKS +--------------- + +A merge is always between the current `HEAD` and one or more +remote branch heads, and the index file must exactly match the +tree of `HEAD` commit (i.e. the contents of the last commit) when +it happens. In other words, `git-diff --cached HEAD` must +report no changes. + +[NOTE] +This is a bit of lie. In certain special cases, your index are +allowed to be different from the tree of `HEAD` commit. The most +notable case is when your `HEAD` commit is already ahead of what +is being merged, in which case your index can have arbitrary +difference from your `HEAD` commit. Otherwise, your index entries +are allowed have differences from your `HEAD` commit that match +the result of trivial merge (e.g. you received the same patch +from external source to produce the same result as what you are +merging). For example, if a path did not exist in the common +ancestor and your head commit but exists in the tree you are +merging into your repository, and if you already happen to have +that path exactly in your index, the merge does not have to +fail. + +Otherwise, merge will refuse to do any harm to your repository +(that is, it may fetch the objects from remote, and it may even +update the local branch used to keep track of the remote branch +with `git pull remote rbranch:lbranch`, but your working tree, +`.git/HEAD` pointer and index file are left intact). + +You may have local modifications in the working tree files. In +other words, `git-diff` is allowed to report changes. +However, the merge uses your working tree as the working area, +and in order to prevent the merge operation from losing such +changes, it makes sure that they do not interfere with the +merge. Those complex tables in read-tree documentation define +what it means for a path to "interfere with the merge". And if +your local modifications interfere with the merge, again, it +stops before touching anything. + +So in the above two "failed merge" case, you do not have to +worry about lossage of data --- you simply were not ready to do +a merge, so no merge happened at all. You may want to finish +whatever you were in the middle of doing, and retry the same +pull after you are done and ready. + +When things cleanly merge, these things happen: + +1. the results are updated both in the index file and in your + working tree, +2. index file is written out as a tree, +3. the tree gets committed, and +4. the `HEAD` pointer gets advanced. + +Because of 2., we require that the original state of the index +file to match exactly the current `HEAD` commit; otherwise we +will write out your local changes already registered in your +index file along with the merge result, which is not good. +Because 1. involves only the paths different between your +branch and the remote branch you are pulling from during the +merge (which is typically a fraction of the whole tree), you can +have local modifications in your working tree as long as they do +not overlap with what the merge updates. + +When there are conflicts, these things happen: + +1. `HEAD` stays the same. + +2. Cleanly merged paths are updated both in the index file and + in your working tree. + +3. For conflicting paths, the index file records the version + from `HEAD`. The working tree files have the result of + "merge" program; i.e. 3-way merge result with familiar + conflict markers `<<< === >>>`. + +4. No other changes are done. In particular, the local + modifications you had before you started merge will stay the + same and the index entries for them stay as they were, + i.e. matching `HEAD`. + +After seeing a conflict, you can do two things: + + * Decide not to merge. The only clean-up you need are to reset + the index file to the `HEAD` commit to reverse 2. and to clean + up working tree changes made by 2. and 3.; `git-reset` can + be used for this. + + * Resolve the conflicts. `git-diff` would report only the + conflicting paths because of the above 2. and 3.. Edit the + working tree files into a desirable shape, `git-update-index` + them, to make the index file contain what the merge result + should be, and run `git-commit` to commit the result. + + SEE ALSO -------- gitlink:git-fmt-merge-msg[1], gitlink:git-pull[1] -- cgit v1.3-6-g1900 From b020dcd54cc3f2b783339f83d09e46bb7ff08a3e Mon Sep 17 00:00:00 2001 From: "jdl@freescale.com" Date: Tue, 29 Nov 2005 08:59:56 -0600 Subject: Fix typos and minor format issues. Signed-off-by: Jon Loeliger Signed-off-by: Junio C Hamano --- Documentation/pull-fetch-param.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'Documentation') diff --git a/Documentation/pull-fetch-param.txt b/Documentation/pull-fetch-param.txt index 6413d525ce..b5b979242c 100644 --- a/Documentation/pull-fetch-param.txt +++ b/Documentation/pull-fetch-param.txt @@ -15,10 +15,10 @@ - ssh://host.xz/~/path/to/repo.git =============================================================== + - SSH Is the default transport protocol and also supports an - scp-like syntax. Both syntaxes support username expansion, - as does the native git protocol. The following three are - identical to the last three above, respectively: +SSH Is the default transport protocol and also supports an +scp-like syntax. Both syntaxes support username expansion, +as does the native git protocol. The following three are +identical to the last three above, respectively: + =============================================================== - host.xz:/path/to/repo.git/ @@ -26,8 +26,8 @@ - host.xz:path/to/repo.git =============================================================== + - To sync with a local directory, use: - +To sync with a local directory, use: ++ =============================================================== - /path/to/repo.git/ =============================================================== @@ -113,7 +113,7 @@ on the remote branch, merge it into your development branch with `git pull . remote-B`, while you are on `my-B` branch. The common `Pull: master:origin` mapping of a remote `master` branch to a local `origin` branch, which is then merged to a -ocal development branch, again typically named `master`, is made +local development branch, again typically named `master`, is made when you run `git clone` for you to follow this pattern. + [NOTE] -- cgit v1.3-6-g1900 From 034908047d8c46fb4e1323285b3b066567c7fadc Mon Sep 17 00:00:00 2001 From: Matthias Urlichs Date: Tue, 29 Nov 2005 08:13:04 +0100 Subject: SVN import: Use one log call One "svn log" (or its equivalent) per revision adds delay and server load. Instead, open two SVN connections -- one for the log, and one for the files. Positive side effect: Only those log entries which actually contain data are committed => no more empty commits. Also, change the "-l" option to set the maximum revision to be pulled, not the number of revisions. Signed-off-by: Junio C Hamano --- Documentation/git-svnimport.txt | 13 +++++-------- git-svnimport.perl | 37 ++++++++++++++++--------------------- 2 files changed, 21 insertions(+), 29 deletions(-) (limited to 'Documentation') diff --git a/Documentation/git-svnimport.txt b/Documentation/git-svnimport.txt index fcc79fa93a..f8dbee7096 100644 --- a/Documentation/git-svnimport.txt +++ b/Documentation/git-svnimport.txt @@ -10,7 +10,7 @@ git-svnimport - Import a SVN repository into git SYNOPSIS -------- 'git-svnimport' [ -o ] [ -h ] [ -v ] [ -d | -D ] - [ -C ] [ -i ] [ -u ] [-l limit_nr_changes] + [ -C ] [ -i ] [ -u ] [-l limit_rev] [ -b branch_subdir ] [ -t trunk_subdir ] [ -T tag_subdir ] [ -s start_chg ] [ -m ] [ -M regex ] [ ] @@ -71,14 +71,11 @@ When importing incementally, you might need to edit the .git/svn2git file. regex. It can be used with -m to also see the default regexes. You must escape forward slashes. --l :: - Limit the number of SVN changesets we pull before quitting. - This option is necessary because the SVN library has serious memory - leaks; the recommended value for nontrivial imports is 100. +-l :: + Specify a maximum revision number to pull. - git-svnimport will still exit with a zero exit code. You can check - the size of the file ".git/svn2git" to determine whether to call - the importer again. + Formerly, this option controlled how many revisions to pull, due to + SVN memory leaks. (These have been worked around.) -v:: Verbosity: let 'svnimport' report what it is doing. diff --git a/git-svnimport.perl b/git-svnimport.perl index 45d77c5bae..65868a91e5 100755 --- a/git-svnimport.perl +++ b/git-svnimport.perl @@ -35,7 +35,7 @@ our($opt_h,$opt_o,$opt_v,$opt_u,$opt_C,$opt_i,$opt_m,$opt_M,$opt_t,$opt_T,$opt_b sub usage() { print STDERR <new($svn); $svn = SVNconn->new($svn); my $lwp_ua; @@ -198,7 +199,7 @@ $ENV{GIT_INDEX_FILE} = $git_index; my $maxnum = 0; my $last_rev = ""; my $last_branch; -my $current_rev = $opt_s-1; +my $current_rev = $opt_s || 1; unless(-d $git_dir) { system("git-init-db"); die "Cannot init the GIT db at $git_tree: $?\n" if $?; @@ -254,7 +255,7 @@ EOM my($num,$branch,$ref) = split; $branches{$branch}{$num} = $ref; $branches{$branch}{"LAST"} = $ref; - $current_rev = $num if $current_rev < $num; + $current_rev = $num+1 if $current_rev <= $num; } close($B); } @@ -708,17 +709,17 @@ sub commit { print "DONE: $revision $dest $cid\n" if $opt_v; } -my ($changed_paths, $revision, $author, $date, $message, $pool) = @_; -sub _commit_all { - ($changed_paths, $revision, $author, $date, $message, $pool) = @_; +sub commit_all { + # Recursive use of the SVN connection does not work + local $svn = $svn2; + + my ($changed_paths, $revision, $author, $date, $message, $pool) = @_; my %p; while(my($path,$action) = each %$changed_paths) { $p{$path} = [ $action->action,$action->copyfrom_path, $action->copyfrom_rev, $path ]; } $changed_paths = \%p; -} -sub commit_all { my %done; my @col; my $pref; @@ -734,18 +735,12 @@ sub commit_all { } } -while(++$current_rev <= $svn->{'maxrev'}) { - if (defined $opt_l) { - $opt_l--; - if ($opt_l < 0) { - last; - } - } - my $pool=SVN::Pool->new; - $svn->{'svn'}->get_log("/",$current_rev,$current_rev,1,1,1,\&_commit_all,$pool); - $pool->clear; - commit_all(); -} +$opt_l = $svn->{'maxrev'} if not defined $opt_l or $opt_l > $svn->{'maxrev'}; +print "Fetching from $current_rev to $opt_l ...\n" if $opt_v; + +my $pool=SVN::Pool->new; +$svn->{'svn'}->get_log("/",$current_rev,$opt_l,0,1,1,\&commit_all,$pool); +$pool->clear; unlink($git_index); -- cgit v1.3-6-g1900 From 10637b84d91cf8870d1db8609a10dc5e58722378 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Tue, 29 Nov 2005 21:06:10 -0800 Subject: diff-files: -1/-2/-3 to diff against unmerged stage. While resolving conflicted merge, it was not easy to compare the working tree file with unmerged index entries. This commit introduces new options -1/-2/-3 (with synonyms --base, --ours, and --theirs) to compare working tree files with specified stages. When none of these options are given, the command defaults to -2 if the index file is unmerged, otherwise it acts as before. [jc: majorly butchered from the version Linus originally posted.] Signed-off-by: Junio C Hamano --- Documentation/git-diff-files.txt | 10 +++++++ diff-files.c | 62 ++++++++++++++++++++++++++++++++++------ 2 files changed, 64 insertions(+), 8 deletions(-) (limited to 'Documentation') diff --git a/Documentation/git-diff-files.txt b/Documentation/git-diff-files.txt index 3b04bfeec6..b45d1e69da 100644 --- a/Documentation/git-diff-files.txt +++ b/Documentation/git-diff-files.txt @@ -21,6 +21,16 @@ OPTIONS ------- include::diff-options.txt[] +-1 -2 -3 or --base --ours --theirs, and -0:: + Diff against the "base" version, "our branch" or "their + branch" respectively. With these options, diffs for + merged entries are not shown. ++ +The default is to diff against our branch (-2) if there +is an unmerged path, and show diff for unmerged entries +otherwise. The option -0 can be given to force diff for +unmerged entries even when the index is unmerged. + -q:: Remain silent even on nonexisting files diff --git a/diff-files.c b/diff-files.c index 38599b5b75..bbeeea7988 100644 --- a/diff-files.c +++ b/diff-files.c @@ -7,12 +7,12 @@ #include "diff.h" static const char diff_files_usage[] = -"git-diff-files [-q] " -"[] [...]" +"git-diff-files [-q] [-0/-1/2/3] [] [...]" COMMON_DIFF_OPTIONS_HELP; static struct diff_options diff_options; static int silent = 0; +static int diff_unmerged_stage = -1; static void show_unmerge(const char *path) { @@ -46,7 +46,21 @@ int main(int argc, const char **argv) argc--; break; } - if (!strcmp(argv[1], "-q")) + if (!strcmp(argv[1], "-0")) + diff_unmerged_stage = 0; + else if (!strcmp(argv[1], "-1")) + diff_unmerged_stage = 1; + else if (!strcmp(argv[1], "-2")) + diff_unmerged_stage = 2; + else if (!strcmp(argv[1], "-3")) + diff_unmerged_stage = 3; + else if (!strcmp(argv[1], "--base")) + diff_unmerged_stage = 1; + else if (!strcmp(argv[1], "--ours")) + diff_unmerged_stage = 2; + else if (!strcmp(argv[1], "--theirs")) + diff_unmerged_stage = 3; + else if (!strcmp(argv[1], "-q")) silent = 1; else if (!strcmp(argv[1], "-r")) ; /* no-op */ @@ -73,6 +87,20 @@ int main(int argc, const char **argv) pathspec = get_pathspec(prefix, argv + 1); entries = read_cache(); + if (diff_unmerged_stage < 0) { + /* default to "ours" if unmerged index, otherwise 0 */ + for (i = 0; i < entries; i++) { + struct cache_entry *ce = active_cache[i]; + if (ce_stage(ce)) { + diff_unmerged_stage = 2; + break; + } + } + if (diff_unmerged_stage < 0) + diff_unmerged_stage = 0; + } + + if (diff_setup_done(&diff_options) < 0) usage(diff_files_usage); @@ -94,13 +122,31 @@ int main(int argc, const char **argv) continue; if (ce_stage(ce)) { - show_unmerge(ce->name); - while (i < entries && - !strcmp(ce->name, active_cache[i]->name)) + if (!diff_unmerged_stage) + show_unmerge(ce->name); + while (i < entries) { + struct cache_entry *nce = active_cache[i]; + + if (strcmp(ce->name, nce->name)) + break; + /* diff against the proper unmerged stage */ + if (ce_stage(nce) == diff_unmerged_stage) + ce = nce; i++; - i--; /* compensate for loop control increments */ - continue; + } + /* + * Compensate for loop update + */ + i--; + /* + * Show the diff for the 'ce' if we found the one + * from the desired stage. + */ + if (ce_stage(ce) != diff_unmerged_stage) + continue; } + else if (diff_unmerged_stage) + continue; if (lstat(ce->name, &st) < 0) { if (errno != ENOENT && errno != ENOTDIR) { -- cgit v1.3-6-g1900 From 15bf57a18aaf10c038e2026dfe54281edbb6080a Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 30 Nov 2005 02:16:36 -0800 Subject: diff-files: show diffs with stage0 and unmerged stage at the same time. After thinking about it more, I realized that much of the change I did on top of Linus' version does not make much sense. This commit reverts it so that it by default shows diffs with stage0 paths or stage2 paths with working tree; the unmerged stage to use can be overridden with -1/-2/-3 option (-2 is the default so essentially is a no-op). When the index file is unmerged, we are by definition in the middle of a conflicting merge, and we should show the diff with stage 2 by default. More importantly, paths without conflicts are updated in the working tree and collapsed to stage0 in the index, so showing diff with stage0 at the same time does not hurt. In normal cases, stage0 entries should be in sync with the working tree files and does not clutter the output. It even helps the user to realize that the working tree has local changes unrelated to the merge and remember to be careful not to do a "git-commit -a" after resolving the conflicts. When there is no unmerged entries, giving diff_unmerged_stage a default value of 2 does not cause any harm, because it would not be used anyway. So in all, always showing diff between stage0 paths and unmerged entries from a stage (defaulting to 2) is the right thing to do, as Linus originally did. Signed-off-by: Junio C Hamano --- Documentation/git-diff-files.txt | 7 +++---- diff-files.c | 21 ++------------------- 2 files changed, 5 insertions(+), 23 deletions(-) (limited to 'Documentation') diff --git a/Documentation/git-diff-files.txt b/Documentation/git-diff-files.txt index b45d1e69da..67f51265e6 100644 --- a/Documentation/git-diff-files.txt +++ b/Documentation/git-diff-files.txt @@ -26,10 +26,9 @@ include::diff-options.txt[] branch" respectively. With these options, diffs for merged entries are not shown. + -The default is to diff against our branch (-2) if there -is an unmerged path, and show diff for unmerged entries -otherwise. The option -0 can be given to force diff for -unmerged entries even when the index is unmerged. +The default is to diff against our branch (-2) and the +cleanly resolved paths. The option -0 can be given to +omit diff output for unmerged entries and just show "Unmerged". -q:: Remain silent even on nonexisting files diff --git a/diff-files.c b/diff-files.c index bbeeea7988..6c0696c34f 100644 --- a/diff-files.c +++ b/diff-files.c @@ -12,7 +12,7 @@ COMMON_DIFF_OPTIONS_HELP; static struct diff_options diff_options; static int silent = 0; -static int diff_unmerged_stage = -1; +static int diff_unmerged_stage = 2; static void show_unmerge(const char *path) { @@ -87,20 +87,6 @@ int main(int argc, const char **argv) pathspec = get_pathspec(prefix, argv + 1); entries = read_cache(); - if (diff_unmerged_stage < 0) { - /* default to "ours" if unmerged index, otherwise 0 */ - for (i = 0; i < entries; i++) { - struct cache_entry *ce = active_cache[i]; - if (ce_stage(ce)) { - diff_unmerged_stage = 2; - break; - } - } - if (diff_unmerged_stage < 0) - diff_unmerged_stage = 0; - } - - if (diff_setup_done(&diff_options) < 0) usage(diff_files_usage); @@ -122,8 +108,7 @@ int main(int argc, const char **argv) continue; if (ce_stage(ce)) { - if (!diff_unmerged_stage) - show_unmerge(ce->name); + show_unmerge(ce->name); while (i < entries) { struct cache_entry *nce = active_cache[i]; @@ -145,8 +130,6 @@ int main(int argc, const char **argv) if (ce_stage(ce) != diff_unmerged_stage) continue; } - else if (diff_unmerged_stage) - continue; if (lstat(ce->name, &st) < 0) { if (errno != ENOENT && errno != ENOTDIR) { -- cgit v1.3-6-g1900 From 0501c2409d7661d2b13f094136d246b9b5b8acf9 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 30 Nov 2005 02:38:24 -0800 Subject: Tutorial: adjust merge example to recursive strategy. Current default, merge-recursive, gives slightly different message while working from merge-resolve which was used to prepare the illustration in the tutorial. Signed-off-by: Junio C Hamano --- Documentation/tutorial.txt | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'Documentation') diff --git a/Documentation/tutorial.txt b/Documentation/tutorial.txt index e2dfb00ab1..cf7ba76ddf 100644 --- a/Documentation/tutorial.txt +++ b/Documentation/tutorial.txt @@ -898,9 +898,8 @@ file, which had no differences in the `mybranch` branch), and say: fatal: Merge requires file-level merging Nope. ... - merge: warning: conflicts during merge - ERROR: Merge conflict in hello. - fatal: merge program failed + Auto-merging hello + CONFLICT (content): Merge conflict in hello Automatic merge failed/prevented; fix up by hand ---------------- @@ -942,10 +941,10 @@ environment, is `git show-branch`. ------------------------------------------------ $ git show-branch master mybranch -* [master] Merged "mybranch" changes. +* [master] Merge work in mybranch ! [mybranch] Some work. -- -+ [master] Merged "mybranch" changes. ++ [master] Merge work in mybranch ++ [mybranch] Some work. ------------------------------------------------ @@ -998,10 +997,10 @@ looks like, or run `show-branch`, which tells you this. ------------------------------------------------ $ git show-branch master mybranch -! [master] Merged "mybranch" changes. - * [mybranch] Merged "mybranch" changes. +! [master] Merge work in mybranch + * [mybranch] Merge work in mybranch -- -++ [master] Merged "mybranch" changes. +++ [master] Merge work in mybranch ------------------------------------------------ -- cgit v1.3-6-g1900 From a3e3dc46901e3ba20a9f1d3ae503ac2faf5a8ea9 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 1 Dec 2005 12:24:51 -0800 Subject: Documentation: describe '-f' option to git-fetch. The option description header was there without body text, confusingly getting rendered as if the description for --tags applied to the option. Noticed by Carl Baldwin. Signed-off-by: Junio C Hamano --- Documentation/fetch-options.txt | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Documentation') diff --git a/Documentation/fetch-options.txt b/Documentation/fetch-options.txt index a25d04a4fa..200c9b240d 100644 --- a/Documentation/fetch-options.txt +++ b/Documentation/fetch-options.txt @@ -4,6 +4,11 @@ option old data in `.git/FETCH_HEAD` will be overwritten. -f, \--force:: + When `git-fetch` is used with `:` + refspec, it refuses to update the local branch + `` unless the remote branch `` it + fetches is a descendant of ``. This option + overrides that check. -t, \--tags:: By default, the git core utilities will not fetch and store -- cgit v1.3-6-g1900 From 3ace1fe34bbf24a62215d06614f9cf29a80def4a Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 2 Dec 2005 01:05:35 -0800 Subject: git-merge documentation: conflicting merge leaves higher stages in index This hopefully concludes the latest updates that changes the behaviour of the merge on an unsuccessful automerge. Instead of collapsing the conflicted path in the index to show HEAD, we leave it unmerged, now that diff-files can compare working tree files with higher stages. Signed-off-by: Junio C Hamano --- Documentation/git-merge.txt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'Documentation') diff --git a/Documentation/git-merge.txt b/Documentation/git-merge.txt index c1174041ec..0cac563d40 100644 --- a/Documentation/git-merge.txt +++ b/Documentation/git-merge.txt @@ -108,10 +108,12 @@ When there are conflicts, these things happen: 2. Cleanly merged paths are updated both in the index file and in your working tree. -3. For conflicting paths, the index file records the version - from `HEAD`. The working tree files have the result of - "merge" program; i.e. 3-way merge result with familiar - conflict markers `<<< === >>>`. +3. For conflicting paths, the index file records up to three + versions; stage1 stores the version from the common ancestor, + stage2 from `HEAD`, and stage3 from the remote branch (you + can inspect the stages with `git-ls-files -u`). The working + tree files have the result of "merge" program; i.e. 3-way + merge result with familiar conflict markers `<<< === >>>`. 4. No other changes are done. In particular, the local modifications you had before you started merge will stay the -- cgit v1.3-6-g1900 From 3f41f5a9fefafabb561db4ce9c9b4e0944ec1f85 Mon Sep 17 00:00:00 2001 From: No name Date: Fri, 2 Dec 2005 06:37:13 -0500 Subject: documentation: clarify read-tree --reset [jc: light edit applied on top of the original] Signed-off-by: Junio C Hamano --- Documentation/git-read-tree.txt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'Documentation') diff --git a/Documentation/git-read-tree.txt b/Documentation/git-read-tree.txt index 8b91847856..6e92e4aa66 100644 --- a/Documentation/git-read-tree.txt +++ b/Documentation/git-read-tree.txt @@ -28,11 +28,14 @@ will be in unmerged state when "git-read-tree" returns. OPTIONS ------- -m:: - Perform a merge, not just a read. + Perform a merge, not just a read. The command will + refuse to run if your index file has unmerged entries, + indicating that you have not finished previous merge you + started. --reset:: - - Same as -m except that unmerged entries will be silently ignored. + Same as -m, except that unmerged entries are discarded + instead of failing. -u:: After a successful merge, update the files in the work @@ -47,7 +50,6 @@ OPTIONS trees that are not directly related to the current working tree status into a temporary index file. - :: The id of the tree object(s) to be read/merged. -- cgit v1.3-6-g1900 From d2abdd2647c6241ec7cced9df9cdd4b98d3d6898 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 2 Dec 2005 12:15:23 -0800 Subject: documentation: git-bisect (help HTML break man) Use the same trick Josef used to introduce line breaks for git-mv documentation for now, to help HTML rendering. This breaks manpages and we need to come up with a better solution. Noticed by linux@horizon.com (No Name). Signed-off-by: Junio C Hamano --- Documentation/git-bisect.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'Documentation') diff --git a/Documentation/git-bisect.txt b/Documentation/git-bisect.txt index 39fa665d9d..8a399703dc 100644 --- a/Documentation/git-bisect.txt +++ b/Documentation/git-bisect.txt @@ -8,13 +8,13 @@ git-bisect - Find the change that introduced a bug SYNOPSIS -------- -'git bisect' start -'git bisect' bad -'git bisect' good -'git bisect' reset [] -'git bisect' visualize -'git bisect' replay -'git bisect' log + 'git bisect' start + 'git bisect' bad + 'git bisect' good + 'git bisect' reset [] + 'git bisect' visualize + 'git bisect' replay + 'git bisect' log DESCRIPTION ----------- -- cgit v1.3-6-g1900 From 56b5e946f2ba4fd57bbe14f9e3ec2e0ae314d5e6 Mon Sep 17 00:00:00 2001 From: No name Date: Fri, 2 Dec 2005 06:37:13 -0500 Subject: documentation: git-tag [jc: light edit applied on top of the original] Signed-off-by: Junio C Hamano --- Documentation/git-tag.txt | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'Documentation') diff --git a/Documentation/git-tag.txt b/Documentation/git-tag.txt index 95de436c10..841c9dcf97 100644 --- a/Documentation/git-tag.txt +++ b/Documentation/git-tag.txt @@ -10,6 +10,26 @@ SYNOPSIS -------- 'git-tag' [-a | -s | -u ] [-f | -d] [-m ] [] +OPTIONS +------- +-a:: + Make an unsigned, annotated tag object + +-s:: + Make a GPG-signed tag, using the default e-mail address's key + +-u :: + Make a GPG-signed tag, using the given key + +-f:: + Replace an existing tag with the given name (instead of failing) + +-d:: + Delete an existing tag with the given name + +-m :: + Use the given tag message (instead of prompting) + DESCRIPTION ----------- Adds a 'tag' reference in .git/refs/tags/ @@ -23,7 +43,7 @@ creates a 'tag' object, and requires the tag message. Unless in the tag message. Otherwise just the SHA1 object name of the commit object is -written (i.e. an lightweight tag). +written (i.e. a lightweight tag). A GnuPG signed tag object will be created when `-s` or `-u ` is used. When `-u ` is not used, the -- cgit v1.3-6-g1900 From 7950571ad75c1c97e5e53626d8342b01b167c790 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sat, 3 Dec 2005 17:57:48 -0800 Subject: A few more options for git-cat-file This adds '-e' option to git-cat-file, to test for the existence of the object. This also cleans up the option-parsing in git-cat-file slightly. [jc: HPA version had -n option which did rev-parse --verify; the real value of this patch is the option parsing cleanup.] Signed-off-by: H. Peter Anvin Signed-off-by: Junio C Hamano --- Documentation/git-cat-file.txt | 13 +++++++++--- cat-file.c | 47 ++++++++++++++++++++++++++++-------------- 2 files changed, 42 insertions(+), 18 deletions(-) (limited to 'Documentation') diff --git a/Documentation/git-cat-file.txt b/Documentation/git-cat-file.txt index ab4dcae21c..9a7700fa7f 100644 --- a/Documentation/git-cat-file.txt +++ b/Documentation/git-cat-file.txt @@ -8,7 +8,7 @@ git-cat-file - Provide content or type information for repository objects SYNOPSIS -------- -'git-cat-file' (-t | -s | ) +'git-cat-file' (-t | -s | -e | ) DESCRIPTION ----------- @@ -29,6 +29,10 @@ OPTIONS Instead of the content, show the object size identified by . +-e:: + Suppress all output; instead exit with zero status if + exists and is a valid object. + :: Typically this matches the real type of but asking for a type that can trivially be dereferenced from the given @@ -39,8 +43,11 @@ OPTIONS OUTPUT ------ -If '-t' is specified, one of the . If '-s' is specified, -the size of the in bytes. +If '-t' is specified, one of the . + +If '-s' is specified, the size of the in bytes. + +If '-e' is specified, no output. Otherwise the raw (though uncompressed) contents of the will be returned. diff --git a/cat-file.c b/cat-file.c index d775a1545b..7594108c6e 100644 --- a/cat-file.c +++ b/cat-file.c @@ -11,27 +11,44 @@ int main(int argc, char **argv) char type[20]; void *buf; unsigned long size; + int opt; setup_git_directory(); if (argc != 3 || get_sha1(argv[2], sha1)) - usage("git-cat-file [-t | -s | ] "); - - if (!strcmp("-t", argv[1]) || !strcmp("-s", argv[1])) { - if (!sha1_object_info(sha1, type, - argv[1][1] == 's' ? &size : NULL)) { - switch (argv[1][1]) { - case 't': - printf("%s\n", type); - break; - case 's': - printf("%lu\n", size); - break; - } + usage("git-cat-file [-t|-s|-e|] "); + + opt = 0; + if ( argv[1][0] == '-' ) { + opt = argv[1][1]; + if ( !opt || argv[1][2] ) + opt = -1; /* Not a single character option */ + } + + buf = NULL; + switch (opt) { + case 't': + if (!sha1_object_info(sha1, type, NULL)) { + printf("%s\n", type); return 0; } - buf = NULL; - } else { + break; + + case 's': + if (!sha1_object_info(sha1, type, &size)) { + printf("%lu\n", size); + return 0; + } + break; + + case 'e': + return !has_sha1_file(sha1); + + case 0: buf = read_object_with_reference(sha1, argv[1], &size, NULL); + break; + + default: + die("git-cat-file: unknown option: %s\n", argv[1]); } if (!buf) -- cgit v1.3-6-g1900