From: Junio C Hamano Date: Wed, 9 Apr 2008 07:40:46 +0000 (-0700) Subject: Merge branch 'jc/rebase' X-Git-Tag: v1.5.6-rc0~158 X-Git-Url: https://www.git.lorimer.id.au/gitweb.git/diff_plain/3ee5538a0c174bd03b0ff74962b54752b5e2c106?hp=0cb06644a569d92ea8b3b6e81bc8bd786d98920e Merge branch 'jc/rebase' * jc/rebase: rebase [--onto O] A B: omit needless checkout --- diff --git a/Documentation/RelNotes-1.5.4.5.txt b/Documentation/RelNotes-1.5.4.5.txt index fe768d497f..0282341398 100644 --- a/Documentation/RelNotes-1.5.4.5.txt +++ b/Documentation/RelNotes-1.5.4.5.txt @@ -4,6 +4,13 @@ GIT v1.5.4.5 Release Notes Fixes since v1.5.4.4 -------------------- + * "git fetch there" when the URL information came from the Cogito style + branches/there file did not update refs/heads/there (regression in + 1.5.4). + + * Bogus refspec configuration such as "remote.there.fetch = =" were not + detected as errors (regressionin 1.5.4). + * You couldn't specify a custom editor whose path contains a whitespace via GIT_EDITOR (and core.editor). @@ -46,8 +53,4 @@ Fixes since v1.5.4.4 * "git rebase -m" triggered pre-commit verification, which made "rebase --continue" impossible. --- -exec >/var/tmp/1 -echo O=$(git describe maint) -O=v1.5.4.4-25-ga6f7728 -git shortlog --no-merges $O..maint +As usual, it also comes with many documentation fixes and clarifications. diff --git a/Documentation/RelNotes-1.5.5.txt b/Documentation/RelNotes-1.5.5.txt index e31ae6a293..2932212488 100644 --- a/Documentation/RelNotes-1.5.5.txt +++ b/Documentation/RelNotes-1.5.5.txt @@ -6,7 +6,7 @@ Updates since v1.5.4 (subsystems) - * Comes with git-gui 0.9.3. + * Comes with git-gui 0.10.1 (portability) @@ -79,8 +79,9 @@ Updates since v1.5.4 * "git branch" (and "git checkout -b") to branch from a local branch can optionally set "branch..merge" to mark the new branch to build on the other local branch, when "branch.autosetupmerge" is set to - "always". By default, this does not happen when branching from a local - branch. + "always", or when passing the command line option "--track" (this option + was ignored when branching from local branches). By default, this does + not happen when branching from a local branch. * "git checkout" to switch to a branch that has "branch..merge" set (i.e. marked to build on another branch) reports how much the branch @@ -124,6 +125,9 @@ Updates since v1.5.4 * "git gc" now automatically prunes unreachable objects that are two weeks old or older. + * "git gc --auto" can be disabled more easily by just setting gc.auto + to zero. It also tolerates more packfiles by default. + * "git grep" now knows "--name-only" is a synonym for the "-l" option. * "git help " now reports "'git ' is alias to ", @@ -162,8 +166,8 @@ Updates since v1.5.4 symmetric difference between the HEAD version and the work tree version of the submodule commits. - * Various "git cvsimport", "git cvsexportcommit", "git svn" and - "git p4" improvements. + * Various "git cvsimport", "git cvsexportcommit", "git cvsserver", + "git svn" and "git p4" improvements. (internal) @@ -199,8 +203,5 @@ this release, unless otherwise noted. * "git-rebase --abort" did not go back to the right location if "git-reset" was run during the "git-rebase" session. ---- -exec >/var/tmp/1 -O=v1.5.4.4-620-gc817faa -echo O=`git describe refs/heads/master` -git shortlog --no-merges $O..refs/heads/master ^refs/heads/maint + * "git imap-send" without setting imap.host did not error out but + segfaulted. diff --git a/Documentation/config.txt b/Documentation/config.txt index 0865f4e01a..04c01c5fdc 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -582,7 +582,7 @@ gc.autopacklimit:: When there are more than this many packs that are not marked with `*.keep` file in the repository, `git gc --auto` consolidates them into one larger pack. The - default value is 20. Setting this to 0 disables it. + default value is 50. Setting this to 0 disables it. gc.packrefs:: `git gc` does not run `git pack-refs` in a bare repository by @@ -661,6 +661,13 @@ gitcvs.dbuser, gitcvs.dbpass:: 'gitcvs.dbuser' supports variable substitution (see linkgit:git-cvsserver[1] for details). +gitcvs.dbTableNamePrefix:: + Database table name prefix. Prepended to the names of any + database tables used, allowing a single database to be used + for several repositories. Supports variable substitution (see + linkgit:git-cvsserver[1] for details). Any non-alphabetic + characters will be replaced with underscores. + All gitcvs variables except for 'gitcvs.allbinary' can also be specified as 'gitcvs..' (where 'access_method' is one of "ext" and "pserver") to make them apply only for the given diff --git a/Documentation/git-add.txt b/Documentation/git-add.txt index c751a17d07..35e67a06e4 100644 --- a/Documentation/git-add.txt +++ b/Documentation/git-add.txt @@ -226,6 +226,12 @@ diff:: This lets you review what will be committed (i.e. between HEAD and index). +Bugs +---- +The interactive mode does not work with files whose names contain +characters that need C-quoting. `core.quotepath` configuration can be +used to work this limitation around to some degree, but backslash, +double-quote and control characters will still have problems. See Also -------- diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt index 4014e7256d..e11cddbfc9 100644 --- a/Documentation/git-checkout.txt +++ b/Documentation/git-checkout.txt @@ -3,7 +3,7 @@ git-checkout(1) NAME ---- -git-checkout - Checkout and switch to a branch +git-checkout - Checkout a branch or paths to the working tree SYNOPSIS -------- diff --git a/Documentation/git-cvsserver.txt b/Documentation/git-cvsserver.txt index d3e99931d7..9cec8021b8 100644 --- a/Documentation/git-cvsserver.txt +++ b/Documentation/git-cvsserver.txt @@ -227,6 +227,11 @@ gitcvs.dbpass:: Database password. Only useful if setting `dbdriver`, since SQLite has no concept of database passwords. +gitcvs.dbTableNamePrefix:: + Database table name prefix. Supports variable substitution + (see below). Any non-alphabetic characters will be replaced + with underscores. + All variables can also be set per access method, see <>. Variable substitution diff --git a/Documentation/git-fast-import.txt b/Documentation/git-fast-import.txt index 96f6767075..c29a4f8126 100644 --- a/Documentation/git-fast-import.txt +++ b/Documentation/git-fast-import.txt @@ -385,6 +385,9 @@ new commit. Omitting the `from` command in the first commit of a new branch will cause fast-import to create that commit with no ancestor. This tends to be desired only for the initial commit of a project. +If the frontend creates all files from scratch when making a new +branch, a `merge` command may be used instead of `from` to start +the commit with an empty tree. Omitting the `from` command on existing branches is usually desired, as the current commit on that branch is automatically assumed to be the first ancestor of the new commit. @@ -427,13 +430,15 @@ existing value of the branch. `merge` ^^^^^^^ -Includes one additional ancestor commit, and makes the current -commit a merge commit. An unlimited number of `merge` commands per +Includes one additional ancestor commit. If the `from` command is +omitted when creating a new branch, the first `merge` commit will be +the first ancestor of the current commit, and the branch will start +out with no files. An unlimited number of `merge` commands per commit are permitted by fast-import, thereby establishing an n-way merge. However Git's other tools never create commits with more than 15 additional ancestors (forming a 16-way merge). For this reason it is suggested that frontends do not use more than 15 `merge` -commands per commit. +commands per commit; 16, if starting a new, empty branch. Here `` is any of the commit specification expressions also accepted by `from` (see above). diff --git a/Documentation/git-filter-branch.txt b/Documentation/git-filter-branch.txt index 543a1cf105..2a78549be5 100644 --- a/Documentation/git-filter-branch.txt +++ b/Documentation/git-filter-branch.txt @@ -25,7 +25,7 @@ Otherwise, all information (including original commit times or merge information) will be preserved. The command will only rewrite the _positive_ refs mentioned in the -command line (i.e. if you pass 'a..b', only 'b' will be rewritten). +command line (e.g. if you pass 'a..b', only 'b' will be rewritten). If you specify no filters, the commits will be recommitted without any changes, which would normally have no effect. Nevertheless, this may be useful in the future for compensating for some git bugs or such, @@ -42,7 +42,7 @@ Always verify that the rewritten version is correct: The original refs, if different from the rewritten ones, will be stored in the namespace 'refs/original/'. -Note that since this operation is extensively I/O expensive, it might +Note that since this operation is very I/O expensive, it might be a good idea to redirect the temporary directory off-disk with the '-d' option, e.g. on tmpfs. Reportedly the speedup is very noticeable. @@ -51,14 +51,15 @@ Filters ~~~~~~~ The filters are applied in the order as listed below. The -argument is always evaluated in shell using the 'eval' command (with the -notable exception of the commit filter, for technical reasons). +argument is always evaluated in the shell context using the 'eval' command +(with the notable exception of the commit filter, for technical reasons). Prior to that, the $GIT_COMMIT environment variable will be set to contain the id of the commit being rewritten. Also, GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL, GIT_AUTHOR_DATE, GIT_COMMITTER_NAME, GIT_COMMITTER_EMAIL, -and GIT_COMMITTER_DATE are set according to the current commit. If any -evaluation of returns a non-zero exit status, the whole operation -will be aborted. +and GIT_COMMITTER_DATE are set according to the current commit. The values +of these variables after the filters have run, are used for the new commit. +If any evaluation of returns a non-zero exit status, the whole +operation will be aborted. A 'map' function is available that takes an "original sha1 id" argument and outputs a "rewritten sha1 id" if the commit has been already @@ -71,9 +72,9 @@ OPTIONS ------- --env-filter :: - This is the filter for modifying the environment in which - the commit will be performed. Specifically, you might want - to rewrite the author/committer name/email/time environment + This filter may be used if you only need to modify the environment + in which the commit will be performed. Specifically, you might + want to rewrite the author/committer name/email/time environment variables (see linkgit:git-commit[1] for details). Do not forget to re-export the variables. @@ -149,7 +150,7 @@ definition impossible to preserve signatures at any rate.) -d :: Use this option to set the path to the temporary directory used for rewriting. When applying a tree filter, the command needs to - temporary checkout the tree to some directory, which may consume + temporarily check out the tree to some directory, which may consume considerable space in case of large projects. By default it does this in the '.git-rewrite/' directory but you can override that choice by this parameter. diff --git a/Documentation/git-gc.txt b/Documentation/git-gc.txt index 229a7c9b30..d424a4ecbe 100644 --- a/Documentation/git-gc.txt +++ b/Documentation/git-gc.txt @@ -19,8 +19,15 @@ created from prior invocations of linkgit:git-add[1]. Users are encouraged to run this task on a regular basis within each repository to maintain good disk space utilization and good -operating performance. Some git commands may automatically run -`git-gc`; see the `--auto` flag below for details. +operating performance. + +Some git commands may automatically run `git-gc`; see the `--auto` flag +below for details. If you know what you're doing and all you want is to +disable this behavior permanently without further considerations, just do: + +---------------------- +$ git config --global gc.auto 0 +---------------------- OPTIONS ------- diff --git a/Documentation/git-pack-objects.txt b/Documentation/git-pack-objects.txt index eed0a94c6e..3a1be08186 100644 --- a/Documentation/git-pack-objects.txt +++ b/Documentation/git-pack-objects.txt @@ -22,8 +22,9 @@ archive with specified base-name, or to the standard output. A packed archive is an efficient way to transfer set of objects between two repositories, and also is an archival format which is efficient to access. The packed archive format (.pack) is -designed to be unpackable without having anything else, but for -random access, accompanied with the pack index file (.idx). +designed to be self contained so that it can be unpacked without +any further information, but for fast, random access to the objects +in the pack, a pack index file (.idx) will be generated. Placing both in the pack/ subdirectory of $GIT_OBJECT_DIRECTORY (or any of the directories on $GIT_ALTERNATE_OBJECT_DIRECTORIES) diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt index 336d797e80..9d0a10c562 100644 --- a/Documentation/git-send-email.txt +++ b/Documentation/git-send-email.txt @@ -216,6 +216,9 @@ sendemail.chainreplyto:: sendemail.smtpserver:: Default SMTP server to use. +sendemail.smtpserverport:: + Default SMTP server port to use. + sendemail.smtpuser:: Default SMTP-AUTH username. diff --git a/Documentation/git-tag.txt b/Documentation/git-tag.txt index b62a3d1c58..c22fb71176 100644 --- a/Documentation/git-tag.txt +++ b/Documentation/git-tag.txt @@ -26,6 +26,9 @@ creates a 'tag' object, and requires the tag message. Unless `-m ` or `-F ` is given, an editor is started for the user to type in the tag message. +If `-m ` or `-F ` is given and `-a`, `-s`, and `-u ` +are absent, `-a` is implied. + Otherwise just the SHA1 object name of the commit object is written (i.e. a lightweight tag). @@ -68,10 +71,14 @@ OPTIONS Use the given tag message (instead of prompting). If multiple `-m` options are given, there values are concatenated as separate paragraphs. + Implies `-a` if none of `-a`, `-s`, or `-u ` + is given. -F :: Take the tag message from the given file. Use '-' to read the message from the standard input. + Implies `-a` if none of `-a`, `-s`, or `-u ` + is given. CONFIGURATION ------------- diff --git a/Documentation/git.txt b/Documentation/git.txt index 3ed24d449a..336fe99cc7 100644 --- a/Documentation/git.txt +++ b/Documentation/git.txt @@ -43,9 +43,15 @@ unreleased) version of git, that is available from 'master' branch of the `git.git` repository. Documentation for older releases are available here: -* link:v1.5.4.4/git.html[documentation for release 1.5.4.4] +* link:v1.5.5/git.html[documentation for release 1.5.5] * release notes for + link:RelNotes-1.5.5.txt[1.5.5]. + +* link:v1.5.4.5/git.html[documentation for release 1.5.4.5] + +* release notes for + link:RelNotes-1.5.4.5.txt[1.5.4.5], link:RelNotes-1.5.4.4.txt[1.5.4.4], link:RelNotes-1.5.4.3.txt[1.5.4.3], link:RelNotes-1.5.4.2.txt[1.5.4.2], diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 84ec9623a2..04ca63ca3d 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -63,6 +63,13 @@ path in question, and its parent directories (the further the directory that contains `.gitattributes` is from the path in question, the lower its precedence). +If you wish to affect only a single repository (i.e., to assign +attributes to files that are particular to one user's workflow), then +attributes should be placed in the `$GIT_DIR/info/attributes` file. +Attributes which should be version-controlled and distributed to other +repositories (i.e., attributes of interest to all users) should go into +`.gitattributes` files. + Sometimes you would need to override an setting of an attribute for a path to `unspecified` state. This can be done by listing the name of the attribute prefixed with an exclamation point `!`. diff --git a/Documentation/gitignore.txt b/Documentation/gitignore.txt index e847b3ba63..613dca006f 100644 --- a/Documentation/gitignore.txt +++ b/Documentation/gitignore.txt @@ -38,6 +38,18 @@ precedence, the last matching pattern decides the outcome): * Patterns read from the file specified by the configuration variable 'core.excludesfile'. +Which file to place a pattern in depends on how the pattern is meant to +be used. Patterns which should be version-controlled and distributed to +other repositories via clone (i.e., files that all developers will want +to ignore) should go into a `.gitignore` file. Patterns which are +specific to a particular repository but which do not need to be shared +with other related repositories (e.g., auxiliary files that live inside +the repository but are specific to one user's workflow) should go into +the `$GIT_DIR/info/exclude` file. Patterns which a user wants git to +ignore in all situations (e.g., backup or temporary files generated by +the user's editor of choice) generally go into a file specified by +`core.excludesfile` in the user's `~/.gitconfig`. + The underlying git plumbing tools, such as linkgit:git-ls-files[1] and linkgit:git-read-tree[1], read `gitignore` patterns specified by command-line options, or from diff --git a/Documentation/glossary.txt b/Documentation/glossary.txt index ab4caf4e26..51b63532b6 100644 --- a/Documentation/glossary.txt +++ b/Documentation/glossary.txt @@ -45,9 +45,12 @@ GIT Glossary "changesets" with git. [[def_checkout]]checkout:: - The action of updating the <> to a - <> which was stored in the - <>. + The action of updating all or part of the + <> with a <> + or <> from the + <>, and updating the + <> and <> if the whole working tree has + been pointed at a new <>. [[def_cherry-picking]]cherry-picking:: In <> jargon, "cherry pick" means to choose a subset of diff --git a/Documentation/merge-strategies.txt b/Documentation/merge-strategies.txt index 7df0266ba8..1276f858ad 100644 --- a/Documentation/merge-strategies.txt +++ b/Documentation/merge-strategies.txt @@ -33,3 +33,10 @@ ours:: merge is always the current branch head. It is meant to be used to supersede old development history of side branches. + +subtree:: + This is a modified recursive strategy. When merging trees A and + B, if B corresponds to a subtree of A, B is first adjusted to + match the tree structure of A, instead of reading the trees at + the same level. This adjustment is also done to the common + ancestor tree. diff --git a/Documentation/pretty-formats.txt b/Documentation/pretty-formats.txt index 0193c3ce58..e8bea3e18e 100644 --- a/Documentation/pretty-formats.txt +++ b/Documentation/pretty-formats.txt @@ -123,3 +123,4 @@ The placeholders are: - '%Creset': reset color - '%m': left, right or boundary mark - '%n': newline +- '%x00': print a byte from a hex code diff --git a/Documentation/technical/pack-format.txt b/Documentation/technical/pack-format.txt index aa87756a55..1803e64e46 100644 --- a/Documentation/technical/pack-format.txt +++ b/Documentation/technical/pack-format.txt @@ -103,10 +103,24 @@ Pack file entry: <+ packed object data: If it is not DELTA, then deflated bytes (the size above is the size before compression). - If it is DELTA, then + If it is REF_DELTA, then 20-byte base object name SHA1 (the size above is the size of the delta data that follows). delta data, deflated. + If it is OFS_DELTA, then + n-byte offset (see below) interpreted as a negative + offset from the type-byte of the header of the + ofs-delta entry (the size above is the size of + the delta data that follows). + delta data, deflated. + + offset encoding: + n bytes with MSB set in all but the last one. + The offset is then the number constructed by + concatenating the lower 7 bit of each byte, and + for n >= 2 adding 2^7 + 2^14 + ... + 2^(7*(n-1)) + to the result. + = Version 2 pack-*.idx files support packs larger than 4 GiB, and diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt index 40b0de0877..565aeb9804 100644 --- a/Documentation/user-manual.txt +++ b/Documentation/user-manual.txt @@ -4144,7 +4144,7 @@ commits one by one with the function `get_revision()`. If you are interested in more details of the revision walking process, just have a look at the first implementation of `cmd_log()`; call -`git-show v1.3.0~155^2~4` and scroll down to that function (note that you +`git-show v1.3.0{tilde}155^2{tilde}4` and scroll down to that function (note that you no longer need to call `setup_pager()` directly). Nowadays, `git log` is a builtin, which means that it is _contained_ in the diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index 6ddf04d216..f60bab896b 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -1,7 +1,7 @@ #!/bin/sh GVF=GIT-VERSION-FILE -DEF_VER=v1.5.4.GIT +DEF_VER=v1.5.5.GIT LF=' ' diff --git a/Makefile b/Makefile index 87739e7e3c..7c70b00b82 100644 --- a/Makefile +++ b/Makefile @@ -232,59 +232,84 @@ SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__ BASIC_CFLAGS = BASIC_LDFLAGS = -SCRIPT_SH = \ - git-bisect.sh \ - git-clone.sh \ - git-merge-one-file.sh git-mergetool.sh git-parse-remote.sh \ - git-pull.sh git-rebase.sh git-rebase--interactive.sh \ - git-repack.sh git-request-pull.sh \ - git-sh-setup.sh \ - git-am.sh \ - git-merge.sh git-merge-stupid.sh git-merge-octopus.sh \ - git-merge-resolve.sh \ - git-lost-found.sh git-quiltimport.sh git-submodule.sh \ - git-filter-branch.sh \ - git-stash.sh \ - git-web--browse.sh - -SCRIPT_PERL = \ - git-add--interactive.perl \ - git-archimport.perl git-cvsimport.perl git-relink.perl \ - git-cvsserver.perl git-cvsexportcommit.perl \ - git-send-email.perl git-svn.perl +SCRIPT_SH += git-am.sh +SCRIPT_SH += git-bisect.sh +SCRIPT_SH += git-clone.sh +SCRIPT_SH += git-filter-branch.sh +SCRIPT_SH += git-lost-found.sh +SCRIPT_SH += git-merge-octopus.sh +SCRIPT_SH += git-merge-one-file.sh +SCRIPT_SH += git-merge-resolve.sh +SCRIPT_SH += git-merge.sh +SCRIPT_SH += git-merge-stupid.sh +SCRIPT_SH += git-mergetool.sh +SCRIPT_SH += git-parse-remote.sh +SCRIPT_SH += git-pull.sh +SCRIPT_SH += git-quiltimport.sh +SCRIPT_SH += git-rebase--interactive.sh +SCRIPT_SH += git-rebase.sh +SCRIPT_SH += git-repack.sh +SCRIPT_SH += git-request-pull.sh +SCRIPT_SH += git-sh-setup.sh +SCRIPT_SH += git-stash.sh +SCRIPT_SH += git-submodule.sh +SCRIPT_SH += git-web--browse.sh + +SCRIPT_PERL += git-add--interactive.perl +SCRIPT_PERL += git-archimport.perl +SCRIPT_PERL += git-cvsexportcommit.perl +SCRIPT_PERL += git-cvsimport.perl +SCRIPT_PERL += git-cvsserver.perl +SCRIPT_PERL += git-relink.perl +SCRIPT_PERL += git-send-email.perl +SCRIPT_PERL += git-svn.perl SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \ $(patsubst %.perl,%,$(SCRIPT_PERL)) \ git-instaweb -# ... and all the rest that could be moved out of bindir to gitexecdir -PROGRAMS = \ - git-fetch-pack$X \ - git-hash-object$X git-index-pack$X \ - git-fast-import$X \ - git-daemon$X \ - git-merge-index$X git-mktag$X git-mktree$X git-patch-id$X \ - git-receive-pack$X \ - git-send-pack$X git-shell$X \ - git-show-index$X \ - git-unpack-file$X \ - git-update-server-info$X \ - git-upload-pack$X \ - git-pack-redundant$X git-var$X \ - git-merge-tree$X git-imap-send$X \ - $(EXTRA_PROGRAMS) - # Empty... EXTRA_PROGRAMS = +# ... and all the rest that could be moved out of bindir to gitexecdir +PROGRAMS += $(EXTRA_PROGRAMS) +PROGRAMS += git-daemon$X +PROGRAMS += git-fast-import$X +PROGRAMS += git-fetch-pack$X +PROGRAMS += git-hash-object$X +PROGRAMS += git-imap-send$X +PROGRAMS += git-index-pack$X +PROGRAMS += git-merge-index$X +PROGRAMS += git-merge-tree$X +PROGRAMS += git-mktag$X +PROGRAMS += git-mktree$X +PROGRAMS += git-pack-redundant$X +PROGRAMS += git-patch-id$X +PROGRAMS += git-receive-pack$X +PROGRAMS += git-send-pack$X +PROGRAMS += git-shell$X +PROGRAMS += git-show-index$X +PROGRAMS += git-unpack-file$X +PROGRAMS += git-update-server-info$X +PROGRAMS += git-upload-pack$X +PROGRAMS += git-var$X + # List built-in command $C whose implementation cmd_$C() is not in # builtin-$C.o but is linked in as part of some other command. -BUILT_INS = \ - git-format-patch$X git-show$X git-whatchanged$X git-cherry$X \ - git-get-tar-commit-id$X git-init$X git-repo-config$X \ - git-fsck-objects$X git-cherry-pick$X git-peek-remote$X git-status$X \ - git-merge-subtree$X \ - $(patsubst builtin-%.o,git-%$X,$(BUILTIN_OBJS)) +BUILT_INS += $(patsubst builtin-%.o,git-%$X,$(BUILTIN_OBJS)) + +BUILT_INS += git-cherry-pick$X +BUILT_INS += git-cherry$X +BUILT_INS += git-format-patch$X +BUILT_INS += git-fsck-objects$X +BUILT_INS += git-get-tar-commit-id$X +BUILT_INS += git-init$X +BUILT_INS += git-merge-subtree$X +BUILT_INS += git-peek-remote$X +BUILT_INS += git-repo-config$X +BUILT_INS += git-show$X +BUILT_INS += git-status$X +BUILT_INS += git-whatchanged$X # what 'all' will build and 'install' will install, in gitexecdir ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS) @@ -305,113 +330,214 @@ export PERL_PATH LIB_FILE=libgit.a XDIFF_LIB=xdiff/lib.a -LIB_H = \ - archive.h blob.h cache.h cache-tree.h commit.h csum-file.h delta.h grep.h \ - diff.h object.h pack.h pkt-line.h quote.h refs.h list-objects.h sideband.h \ - run-command.h strbuf.h tag.h tree.h git-compat-util.h revision.h \ - tree-walk.h log-tree.h dir.h path-list.h unpack-trees.h builtin.h \ - utf8.h reflog-walk.h patch-ids.h attr.h decorate.h progress.h \ - mailmap.h remote.h parse-options.h transport.h diffcore.h hash.h ll-merge.h fsck.h \ - pack-revindex.h - -DIFF_OBJS = \ - diff.o diff-lib.o diffcore-break.o diffcore-order.o \ - diffcore-pickaxe.o diffcore-rename.o tree-diff.o combine-diff.o \ - diffcore-delta.o log-tree.o - -LIB_OBJS = \ - blob.o commit.o connect.o csum-file.o cache-tree.o base85.o \ - date.o diff-delta.o entry.o exec_cmd.o ident.o \ - pretty.o interpolate.o hash.o \ - lockfile.o \ - patch-ids.o \ - object.o pack-check.o pack-write.o patch-delta.o path.o pkt-line.o \ - sideband.o reachable.o reflog-walk.o \ - quote.o read-cache.o refs.o run-command.o dir.o \ - server-info.o setup.o sha1_file.o sha1_name.o strbuf.o \ - tag.o tree.o usage.o config.o environment.o ctype.o copy.o \ - revision.o pager.o tree-walk.o xdiff-interface.o \ - write_or_die.o trace.o list-objects.o grep.o match-trees.o \ - alloc.o merge-file.o path-list.o help.o unpack-trees.o $(DIFF_OBJS) \ - color.o wt-status.o archive-zip.o archive-tar.o shallow.o utf8.o \ - convert.o attr.o decorate.o progress.o mailmap.o symlinks.o remote.o \ - transport.o bundle.o walker.o parse-options.o ws.o archive.o branch.o \ - ll-merge.o alias.o fsck.o pack-revindex.o - -BUILTIN_OBJS = \ - builtin-add.o \ - builtin-annotate.o \ - builtin-apply.o \ - builtin-archive.o \ - builtin-blame.o \ - builtin-branch.o \ - builtin-bundle.o \ - builtin-cat-file.o \ - builtin-check-attr.o \ - builtin-checkout.o \ - builtin-checkout-index.o \ - builtin-check-ref-format.o \ - builtin-clean.o \ - builtin-commit.o \ - builtin-commit-tree.o \ - builtin-count-objects.o \ - builtin-describe.o \ - builtin-diff.o \ - builtin-diff-files.o \ - builtin-diff-index.o \ - builtin-diff-tree.o \ - builtin-fast-export.o \ - builtin-fetch.o \ - builtin-fetch-pack.o \ - builtin-fetch--tool.o \ - builtin-fmt-merge-msg.o \ - builtin-for-each-ref.o \ - builtin-fsck.o \ - builtin-gc.o \ - builtin-grep.o \ - builtin-init-db.o \ - builtin-log.o \ - builtin-ls-files.o \ - builtin-ls-tree.o \ - builtin-ls-remote.o \ - builtin-mailinfo.o \ - builtin-mailsplit.o \ - builtin-merge-base.o \ - builtin-merge-file.o \ - builtin-merge-ours.o \ - builtin-merge-recursive.o \ - builtin-mv.o \ - builtin-name-rev.o \ - builtin-pack-objects.o \ - builtin-prune.o \ - builtin-prune-packed.o \ - builtin-push.o \ - builtin-read-tree.o \ - builtin-reflog.o \ - builtin-remote.o \ - builtin-send-pack.o \ - builtin-config.o \ - builtin-rerere.o \ - builtin-reset.o \ - builtin-rev-list.o \ - builtin-rev-parse.o \ - builtin-revert.o \ - builtin-rm.o \ - builtin-shortlog.o \ - builtin-show-branch.o \ - builtin-stripspace.o \ - builtin-symbolic-ref.o \ - builtin-tag.o \ - builtin-tar-tree.o \ - builtin-unpack-objects.o \ - builtin-update-index.o \ - builtin-update-ref.o \ - builtin-upload-archive.o \ - builtin-verify-pack.o \ - builtin-verify-tag.o \ - builtin-write-tree.o \ - builtin-show-ref.o \ - builtin-pack-refs.o +LIB_H += archive.h +LIB_H += attr.h +LIB_H += blob.h +LIB_H += builtin.h +LIB_H += cache.h +LIB_H += cache-tree.h +LIB_H += commit.h +LIB_H += csum-file.h +LIB_H += decorate.h +LIB_H += delta.h +LIB_H += diffcore.h +LIB_H += diff.h +LIB_H += dir.h +LIB_H += fsck.h +LIB_H += git-compat-util.h +LIB_H += grep.h +LIB_H += hash.h +LIB_H += list-objects.h +LIB_H += ll-merge.h +LIB_H += log-tree.h +LIB_H += mailmap.h +LIB_H += object.h +LIB_H += pack.h +LIB_H += pack-revindex.h +LIB_H += parse-options.h +LIB_H += patch-ids.h +LIB_H += path-list.h +LIB_H += pkt-line.h +LIB_H += progress.h +LIB_H += quote.h +LIB_H += reflog-walk.h +LIB_H += refs.h +LIB_H += remote.h +LIB_H += revision.h +LIB_H += run-command.h +LIB_H += sideband.h +LIB_H += strbuf.h +LIB_H += tag.h +LIB_H += transport.h +LIB_H += tree.h +LIB_H += tree-walk.h +LIB_H += unpack-trees.h +LIB_H += utf8.h + +LIB_OBJS += alias.o +LIB_OBJS += alloc.o +LIB_OBJS += archive.o +LIB_OBJS += archive-tar.o +LIB_OBJS += archive-zip.o +LIB_OBJS += attr.o +LIB_OBJS += base85.o +LIB_OBJS += blob.o +LIB_OBJS += branch.o +LIB_OBJS += bundle.o +LIB_OBJS += cache-tree.o +LIB_OBJS += color.o +LIB_OBJS += combine-diff.o +LIB_OBJS += commit.o +LIB_OBJS += config.o +LIB_OBJS += connect.o +LIB_OBJS += convert.o +LIB_OBJS += copy.o +LIB_OBJS += csum-file.o +LIB_OBJS += ctype.o +LIB_OBJS += date.o +LIB_OBJS += decorate.o +LIB_OBJS += diffcore-break.o +LIB_OBJS += diffcore-delta.o +LIB_OBJS += diffcore-order.o +LIB_OBJS += diffcore-pickaxe.o +LIB_OBJS += diffcore-rename.o +LIB_OBJS += diff-delta.o +LIB_OBJS += diff-lib.o +LIB_OBJS += diff.o +LIB_OBJS += dir.o +LIB_OBJS += entry.o +LIB_OBJS += environment.o +LIB_OBJS += exec_cmd.o +LIB_OBJS += fsck.o +LIB_OBJS += grep.o +LIB_OBJS += hash.o +LIB_OBJS += help.o +LIB_OBJS += ident.o +LIB_OBJS += interpolate.o +LIB_OBJS += list-objects.o +LIB_OBJS += ll-merge.o +LIB_OBJS += lockfile.o +LIB_OBJS += log-tree.o +LIB_OBJS += mailmap.o +LIB_OBJS += match-trees.o +LIB_OBJS += merge-file.o +LIB_OBJS += object.o +LIB_OBJS += pack-check.o +LIB_OBJS += pack-revindex.o +LIB_OBJS += pack-write.o +LIB_OBJS += pager.o +LIB_OBJS += parse-options.o +LIB_OBJS += patch-delta.o +LIB_OBJS += patch-ids.o +LIB_OBJS += path-list.o +LIB_OBJS += path.o +LIB_OBJS += pkt-line.o +LIB_OBJS += pretty.o +LIB_OBJS += progress.o +LIB_OBJS += quote.o +LIB_OBJS += reachable.o +LIB_OBJS += read-cache.o +LIB_OBJS += reflog-walk.o +LIB_OBJS += refs.o +LIB_OBJS += remote.o +LIB_OBJS += revision.o +LIB_OBJS += run-command.o +LIB_OBJS += server-info.o +LIB_OBJS += setup.o +LIB_OBJS += sha1_file.o +LIB_OBJS += sha1_name.o +LIB_OBJS += shallow.o +LIB_OBJS += sideband.o +LIB_OBJS += strbuf.o +LIB_OBJS += symlinks.o +LIB_OBJS += tag.o +LIB_OBJS += trace.o +LIB_OBJS += transport.o +LIB_OBJS += tree-diff.o +LIB_OBJS += tree.o +LIB_OBJS += tree-walk.o +LIB_OBJS += unpack-trees.o +LIB_OBJS += usage.o +LIB_OBJS += utf8.o +LIB_OBJS += walker.o +LIB_OBJS += write_or_die.o +LIB_OBJS += ws.o +LIB_OBJS += wt-status.o +LIB_OBJS += xdiff-interface.o + +BUILTIN_OBJS += builtin-add.o +BUILTIN_OBJS += builtin-annotate.o +BUILTIN_OBJS += builtin-apply.o +BUILTIN_OBJS += builtin-archive.o +BUILTIN_OBJS += builtin-blame.o +BUILTIN_OBJS += builtin-branch.o +BUILTIN_OBJS += builtin-bundle.o +BUILTIN_OBJS += builtin-cat-file.o +BUILTIN_OBJS += builtin-check-attr.o +BUILTIN_OBJS += builtin-check-ref-format.o +BUILTIN_OBJS += builtin-checkout-index.o +BUILTIN_OBJS += builtin-checkout.o +BUILTIN_OBJS += builtin-clean.o +BUILTIN_OBJS += builtin-commit-tree.o +BUILTIN_OBJS += builtin-commit.o +BUILTIN_OBJS += builtin-config.o +BUILTIN_OBJS += builtin-count-objects.o +BUILTIN_OBJS += builtin-describe.o +BUILTIN_OBJS += builtin-diff-files.o +BUILTIN_OBJS += builtin-diff-index.o +BUILTIN_OBJS += builtin-diff-tree.o +BUILTIN_OBJS += builtin-diff.o +BUILTIN_OBJS += builtin-fast-export.o +BUILTIN_OBJS += builtin-fetch--tool.o +BUILTIN_OBJS += builtin-fetch-pack.o +BUILTIN_OBJS += builtin-fetch.o +BUILTIN_OBJS += builtin-fmt-merge-msg.o +BUILTIN_OBJS += builtin-for-each-ref.o +BUILTIN_OBJS += builtin-fsck.o +BUILTIN_OBJS += builtin-gc.o +BUILTIN_OBJS += builtin-grep.o +BUILTIN_OBJS += builtin-init-db.o +BUILTIN_OBJS += builtin-log.o +BUILTIN_OBJS += builtin-ls-files.o +BUILTIN_OBJS += builtin-ls-remote.o +BUILTIN_OBJS += builtin-ls-tree.o +BUILTIN_OBJS += builtin-mailinfo.o +BUILTIN_OBJS += builtin-mailsplit.o +BUILTIN_OBJS += builtin-merge-base.o +BUILTIN_OBJS += builtin-merge-file.o +BUILTIN_OBJS += builtin-merge-ours.o +BUILTIN_OBJS += builtin-merge-recursive.o +BUILTIN_OBJS += builtin-mv.o +BUILTIN_OBJS += builtin-name-rev.o +BUILTIN_OBJS += builtin-pack-objects.o +BUILTIN_OBJS += builtin-pack-refs.o +BUILTIN_OBJS += builtin-prune-packed.o +BUILTIN_OBJS += builtin-prune.o +BUILTIN_OBJS += builtin-push.o +BUILTIN_OBJS += builtin-read-tree.o +BUILTIN_OBJS += builtin-reflog.o +BUILTIN_OBJS += builtin-remote.o +BUILTIN_OBJS += builtin-rerere.o +BUILTIN_OBJS += builtin-reset.o +BUILTIN_OBJS += builtin-rev-list.o +BUILTIN_OBJS += builtin-rev-parse.o +BUILTIN_OBJS += builtin-revert.o +BUILTIN_OBJS += builtin-rm.o +BUILTIN_OBJS += builtin-send-pack.o +BUILTIN_OBJS += builtin-shortlog.o +BUILTIN_OBJS += builtin-show-branch.o +BUILTIN_OBJS += builtin-show-ref.o +BUILTIN_OBJS += builtin-stripspace.o +BUILTIN_OBJS += builtin-symbolic-ref.o +BUILTIN_OBJS += builtin-tag.o +BUILTIN_OBJS += builtin-tar-tree.o +BUILTIN_OBJS += builtin-unpack-objects.o +BUILTIN_OBJS += builtin-update-index.o +BUILTIN_OBJS += builtin-update-ref.o +BUILTIN_OBJS += builtin-upload-archive.o +BUILTIN_OBJS += builtin-verify-pack.o +BUILTIN_OBJS += builtin-verify-tag.o +BUILTIN_OBJS += builtin-write-tree.o GITLIBS = $(LIB_FILE) $(XDIFF_LIB) EXTLIBS = diff --git a/builtin-apply.c b/builtin-apply.c index a3f075df4b..abe73a0f81 100644 --- a/builtin-apply.c +++ b/builtin-apply.c @@ -1937,21 +1937,24 @@ static int apply_one_fragment(struct image *img, struct fragment *frag, trailing = frag->trailing; /* - * If we don't have any leading/trailing data in the patch, - * we want it to match at the beginning/end of the file. + * A hunk to change lines at the beginning would begin with + * @@ -1,L +N,M @@ * - * But that would break if the patch is generated with - * --unified=0; sane people wouldn't do that to cause us - * trouble, but we try to please not so sane ones as well. + * And a hunk to add to an empty file would begin with + * @@ -0,0 +N,M @@ + * + * In other words, a hunk that is (frag->oldpos <= 1) with or + * without leading context must match at the beginning. */ - if (unidiff_zero) { - match_beginning = (!leading && !frag->oldpos); - match_end = 0; - } - else { - match_beginning = !leading && (frag->oldpos == 1); - match_end = !trailing; - } + match_beginning = frag->oldpos <= 1; + + /* + * A hunk without trailing lines must match at the end. + * However, we simply cannot tell if a hunk must match end + * from the lack of trailing lines if the patch was generated + * with unidiff without any context. + */ + match_end = !unidiff_zero && !trailing; pos = frag->newpos ? (frag->newpos - 1) : 0; preimage.buf = oldlines; @@ -2994,7 +2997,7 @@ int cmd_apply(int argc, const char **argv, const char *unused_prefix) int read_stdin = 1; int inaccurate_eof = 0; int errs = 0; - int is_not_gitdir = 0; + int is_not_gitdir; const char *whitespace_option = NULL; diff --git a/builtin-bundle.c b/builtin-bundle.c index 9f38e2176a..ac476e7a4b 100644 --- a/builtin-bundle.c +++ b/builtin-bundle.c @@ -14,7 +14,7 @@ static const char *bundle_usage="git-bundle (create int cmd_bundle(int argc, const char **argv, const char *prefix) { struct bundle_header header; - int nongit = 0; + int nongit; const char *cmd, *bundle_file; int bundle_fd = -1; char buffer[PATH_MAX]; diff --git a/builtin-config.c b/builtin-config.c index 2b9a4261d4..c34bc8b6a6 100644 --- a/builtin-config.c +++ b/builtin-config.c @@ -264,7 +264,7 @@ static int get_colorbool(int argc, const char **argv) int cmd_config(int argc, const char **argv, const char *prefix) { - int nongit = 0; + int nongit; char* value; const char *file = setup_git_directory_gently(&nongit); diff --git a/builtin-diff-files.c b/builtin-diff-files.c index 4abe3c28fb..e2306c162a 100644 --- a/builtin-diff-files.c +++ b/builtin-diff-files.c @@ -16,7 +16,7 @@ COMMON_DIFF_OPTIONS_HELP; int cmd_diff_files(int argc, const char **argv, const char *prefix) { struct rev_info rev; - int nongit = 0; + int nongit; int result; prefix = setup_git_directory_gently(&nongit); diff --git a/builtin-diff.c b/builtin-diff.c index 444ff2fd92..7c2a8412fa 100644 --- a/builtin-diff.c +++ b/builtin-diff.c @@ -210,7 +210,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix) int ents = 0, blobs = 0, paths = 0; const char *path = NULL; struct blobinfo blob[2]; - int nongit = 0; + int nongit; int result = 0; /* diff --git a/builtin-fetch-pack.c b/builtin-fetch-pack.c index 7b28024224..65350ca522 100644 --- a/builtin-fetch-pack.c +++ b/builtin-fetch-pack.c @@ -26,6 +26,8 @@ static const char fetch_pack_usage[] = #define SEEN (1U << 3) #define POPPED (1U << 4) +static int marked; + /* * After sending this many "have"s if we do not get any new ACK , we * give up traversing our history. @@ -61,6 +63,16 @@ static int rev_list_insert_ref(const char *path, const unsigned char *sha1, int return 0; } +static int clear_marks(const char *path, const unsigned char *sha1, int flag, void *cb_data) +{ + struct object *o = deref_tag(parse_object(sha1), path, 0); + + if (o && o->type == OBJ_COMMIT) + clear_commit_marks((struct commit *)o, + COMMON | COMMON_REF | SEEN | POPPED); + return 0; +} + /* This function marks a rev and its ancestors as common. In some cases, it is desirable to mark only the ancestors (for example @@ -153,6 +165,10 @@ static int find_common(int fd[2], unsigned char *result_sha1, unsigned in_vain = 0; int got_continue = 0; + if (marked) + for_each_ref(clear_marks, NULL); + marked = 1; + for_each_ref(rev_list_insert_ref, NULL); fetching = 0; diff --git a/builtin-fetch.c b/builtin-fetch.c index b2b9935ed6..5841b3e51a 100644 --- a/builtin-fetch.c +++ b/builtin-fetch.c @@ -637,6 +637,8 @@ int cmd_fetch(int argc, const char **argv, const char *prefix) if (!strcmp(argv[i], "tag")) { char *ref; i++; + if (i >= argc) + die("You need to specify a tag name."); ref = xmalloc(strlen(argv[i]) * 2 + 22); strcpy(ref, "refs/tags/"); strcat(ref, argv[i]); @@ -652,5 +654,6 @@ int cmd_fetch(int argc, const char **argv, const char *prefix) signal(SIGINT, unlock_pack_on_signal); atexit(unlock_pack); - return do_fetch(transport, parse_ref_spec(ref_nr, refs), ref_nr); + return do_fetch(transport, + parse_fetch_refspec(ref_nr, refs), ref_nr); } diff --git a/builtin-gc.c b/builtin-gc.c index 95917d74a8..8cef36f6a4 100644 --- a/builtin-gc.c +++ b/builtin-gc.c @@ -25,7 +25,7 @@ static const char * const builtin_gc_usage[] = { static int pack_refs = 1; static int aggressive_window = -1; static int gc_auto_threshold = 6700; -static int gc_auto_pack_limit = 20; +static int gc_auto_pack_limit = 50; static char *prune_expire = "2.weeks.ago"; #define MAX_ADD 10 @@ -160,10 +160,10 @@ static int too_many_packs(void) static int need_to_gc(void) { /* - * Setting gc.auto and gc.autopacklimit to 0 or negative can - * disable the automatic gc. + * Setting gc.auto to 0 or negative can disable the + * automatic gc. */ - if (gc_auto_threshold <= 0 && gc_auto_pack_limit <= 0) + if (gc_auto_threshold <= 0) return 0; /* diff --git a/builtin-init-db.c b/builtin-init-db.c index 79eaf8d6ed..2854868b4e 100644 --- a/builtin-init-db.c +++ b/builtin-init-db.c @@ -167,9 +167,9 @@ static int create_default_files(const char *git_dir, const char *template_path) { unsigned len = strlen(git_dir); static char path[PATH_MAX]; - unsigned char sha1[20]; struct stat st1; char repo_version_string[10]; + char junk[2]; int reinit; int filemode; @@ -219,7 +219,8 @@ static int create_default_files(const char *git_dir, const char *template_path) * branch, if it does not exist yet. */ strcpy(path + len, "HEAD"); - reinit = !read_ref("HEAD", sha1); + reinit = (!access(path, R_OK) + || readlink(path, junk, sizeof(junk)-1) != -1); if (!reinit) { if (create_symref("HEAD", "refs/heads/master", NULL) < 0) exit(1); diff --git a/builtin-ls-remote.c b/builtin-ls-remote.c index 8907a89d6c..06ab8da1fb 100644 --- a/builtin-ls-remote.c +++ b/builtin-ls-remote.c @@ -31,7 +31,7 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix) { int i; const char *dest = NULL; - int nongit = 0; + int nongit; unsigned flags = 0; const char *uploadpack = NULL; const char **pattern = NULL; diff --git a/builtin-prune.c b/builtin-prune.c index bb8ead92cf..25f9304b82 100644 --- a/builtin-prune.c +++ b/builtin-prune.c @@ -4,8 +4,12 @@ #include "revision.h" #include "builtin.h" #include "reachable.h" +#include "parse-options.h" -static const char prune_usage[] = "git-prune [-n]"; +static const char * const prune_usage[] = { + "git-prune [-n] [--expire