diff options
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/RelNotes-1.5.4.6.txt | 43 | ||||
-rw-r--r-- | Documentation/RelNotes-1.5.5.5.txt | 11 | ||||
-rw-r--r-- | Documentation/RelNotes-1.5.6.1.txt | 28 | ||||
-rw-r--r-- | Documentation/RelNotes-1.6.0.txt | 113 | ||||
-rw-r--r-- | Documentation/SubmittingPatches | 5 | ||||
-rw-r--r-- | Documentation/config.txt | 35 | ||||
-rw-r--r-- | Documentation/git-commit.txt | 25 | ||||
-rw-r--r-- | Documentation/git-fast-export.txt | 20 | ||||
-rw-r--r-- | Documentation/git-parse-remote.txt | 2 | ||||
-rw-r--r-- | Documentation/git-push.txt | 3 | ||||
-rw-r--r-- | Documentation/git-rev-parse.txt | 5 | ||||
-rw-r--r-- | Documentation/git-sh-setup.txt | 2 | ||||
-rw-r--r-- | Documentation/git-svn.txt | 5 | ||||
-rw-r--r-- | Documentation/git-update-ref.txt | 2 | ||||
-rw-r--r-- | Documentation/git.txt | 11 | ||||
-rw-r--r-- | Documentation/gitattributes.txt | 6 | ||||
-rw-r--r-- | Documentation/gitcli.txt | 37 | ||||
-rw-r--r-- | Documentation/githooks.txt | 3 | ||||
-rw-r--r-- | Documentation/gittutorial-2.txt | 10 | ||||
-rw-r--r-- | Documentation/howto/update-hook-example.txt | 88 | ||||
-rw-r--r-- | Documentation/technical/api-builtin.txt | 15 | ||||
-rw-r--r-- | Documentation/technical/api-parse-options.txt | 204 |
22 files changed, 594 insertions, 79 deletions
diff --git a/Documentation/RelNotes-1.5.4.6.txt b/Documentation/RelNotes-1.5.4.6.txt new file mode 100644 index 0000000000..3e3c3e55a3 --- /dev/null +++ b/Documentation/RelNotes-1.5.4.6.txt @@ -0,0 +1,43 @@ +GIT v1.5.4.6 Release Notes +========================== + +I personally do not think there is any reason anybody should want to +run v1.5.4.X series these days, because 'master' version is always +more stable than any tagged released version of git. + +This is primarily to futureproof "git-shell" to accept requests +without a dash between "git" and subcommand name (e.g. "git +upload-pack") which the newer client will start to make sometime in +the future. + +Fixes since v1.5.4.5 +-------------------- + + * Command line option "-n" to "git-repack" was not correctly parsed. + + * Error messages from "git-apply" when the patchfile cannot be opened + have been improved. + + * Error messages from "git-bisect" when given nonsense revisions have + been improved. + + * reflog syntax that uses time e.g. "HEAD@{10 seconds ago}:path" did not + stop parsing at the closing "}". + + * "git rev-parse --symbolic-full-name ^master^2" printed solitary "^", + but it should print nothing. + + * "git apply" did not enforce "match at the beginning" correctly. + + * a path specification "a/b" in .gitattributes file should not match + "sub/a/b", but it did. + + * "git log --date-order --topo-order" did not override the earlier + date-order with topo-order as expected. + + * "git fast-export" did not export octopus merges correctly. + + * "git archive --prefix=$path/" mishandled gitattributes. + +As usual, it also comes with many documentation fixes and clarifications. + diff --git a/Documentation/RelNotes-1.5.5.5.txt b/Documentation/RelNotes-1.5.5.5.txt new file mode 100644 index 0000000000..30fa3615c7 --- /dev/null +++ b/Documentation/RelNotes-1.5.5.5.txt @@ -0,0 +1,11 @@ +GIT v1.5.5.5 Release Notes +========================== + +I personally do not think there is any reason anybody should want to +run v1.5.5.X series these days, because 'master' version is always +more stable than any tagged released version of git. + +This is primarily to futureproof "git-shell" to accept requests +without a dash between "git" and subcommand name (e.g. "git +upload-pack") which the newer client will start to make sometime in +the future. diff --git a/Documentation/RelNotes-1.5.6.1.txt b/Documentation/RelNotes-1.5.6.1.txt new file mode 100644 index 0000000000..4864b16445 --- /dev/null +++ b/Documentation/RelNotes-1.5.6.1.txt @@ -0,0 +1,28 @@ +GIT v1.5.6.1 Release Notes +========================== + +Fixes since v1.5.6 +------------------ + +* Last minute change broke loose object creation on AIX. + +* (performance fix) We used to make $GIT_DIR absolute path early in the + programs but keeping it relative to the current directory internally + gives 1-3 per-cent performance boost. + +* bash completion knows the new --graph option to git-log family. + + +* git-diff -c/--cc showed unnecessary "deletion" lines at the context + boundary. + +* git-for-each-ref ignored %(object) and %(type) requests for tag + objects. + +* git-merge usage had a typo. + +* Rebuilding of git-svn metainfo database did not take rewriteRoot + option into account. + +* Running "git-rebase --continue/--skip/--abort" before starting a + rebase gave nonsense error messages. diff --git a/Documentation/RelNotes-1.6.0.txt b/Documentation/RelNotes-1.6.0.txt new file mode 100644 index 0000000000..03e3a59ff5 --- /dev/null +++ b/Documentation/RelNotes-1.6.0.txt @@ -0,0 +1,113 @@ +GIT v1.6.0 Release Notes +======================== + +User visible changes +-------------------- + +[[Note that none of these are not merged to 'master' as of this writing +but they will be before 1.6.0 happens]] + +With the default Makefile settings, most of the programs are now +installed outside your $PATH, except for "git", "gitk", "git-gui" and +some server side programs that need to be accessible for technical +reasons. Invoking a git subcommand as "git-xyzzy" from the command +line has been deprecated since early 2006 (and officially announced in +1.5.4 release notes); use of them from your scripts after adding +output from "git --exec-path" to the $PATH is still supported in this +release, but users are again strongly encouraged to adjust their +scripts to use "git xyzzy" form, as we will stop installing +"git-xyzzy" hardlinks for built-in commands in later releases. + +Source changes needed for porting to MinGW environment are now all in the +main git.git codebase. + + +Updates since v1.5.6 +-------------------- + +(subsystems) + +* git-p4 in contrib learned "allowSubmit" configuration to control on + which branch to allow "submit" subcommand. + +(portability) + +* Sample hook scripts shipped in templates/ are now suffixed with + *.sample. We used to prevent them from triggering by default by + relying on the fact that we install them as unexecutable, but on + some filesystems this approach does not work. Instead of running + "chmod +x" on them, the users who want to activate these samples + as-is can now rename them dropping *.sample suffix. + +* perl's in-place edit (-i) does not work well without backup files on Windows; + some tests are rewritten to cope with this. + +(documentation) + +* Updated howto/update-hook-example + +* Got rid of usage of "git-foo" from the tutorial. + +* Disambiguating "--" between revs and paths is finally documented. + +(performance, robustness, sanity etc.) + +* even more documentation pages are now accessible via "man" and "git help". + +* reduced excessive inlining to shrink size of the "git" binary. + +* verify-pack checks the object CRC when using version 2 idx files. + +* When an object is corrupt in a pack, the object became unusable even + when the same object is available in a loose form, We now try harder to + fall back to these redundant objects when able. In particular, "git + repack -a -f" can be used to fix such a corruption as long as necessary + objects are available. + +* git-clone does not create refs in loose form anymore (it behaves as + if you immediately ran git-pack-refs after cloning). This will help + repositories with insanely large number of refs. + +* core.fsyncobjectfiles configuration can be used to ensure that the loose + objects created will be fsync'ed (this is only useful on filesystems + that does not order data writes properly). + +* "git commit-tree" plumbing can make Octopus with more than 16 parents. + "git commit" has been capable of this for quite some time. + +(usability, bells and whistles) + +* git-archive can be told to omit certain paths from its output using + export-ignore attributes. + +* fast-export learned to export and import marks file; this can be used to + interface with fast-import incrementally. + +* Original SHA-1 value for "update-ref -d" is optional now. + +* You can tell "git status -u" to even more aggressively omit checking + untracked files with --untracked-files=no. + +* Error codes from gitweb are made more descriptive where possible, rather + than "403 forbidden" as we used to issue everywhere. + +(internal) + + +Fixes since v1.5.6 +------------------ + +All of the fixes in v1.5.6 maintenance series are included in +this release, unless otherwise noted. + + * diff -c/--cc showed unnecessary "deletion" lines at the context + boundary (needs backmerge to maint). + + * "git-clone <src> <dst>" did not create leading directories for <dst> + like the scripted version used to do (needs backport to maint). + +--- +exec >/var/tmp/1 +O=v1.5.6.1-104-ga08b868 +echo O=$(git describe refs/heads/master) +git shortlog --no-merges $O..refs/heads/master ^refs/heads/maint diff --git a/Documentation/SubmittingPatches b/Documentation/SubmittingPatches index 0e155c936c..b1164753e1 100644 --- a/Documentation/SubmittingPatches +++ b/Documentation/SubmittingPatches @@ -419,6 +419,11 @@ settings but I haven't tried, yet. mail.identity.default.compose_html => false mail.identity.id?.compose_html => false +(Lukas Sandström) + +There is a script in contrib/thunderbird-patch-inline which can help +you include patches with Thunderbird in an easy way. To use it, do the +steps above and then use the script as the external editor. Gnus ---- diff --git a/Documentation/config.txt b/Documentation/config.txt index 5331b450ea..6966384cef 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -372,6 +372,14 @@ core.whitespace:: does not trigger if the character before such a carriage-return is not a whitespace (not enabled by default). +core.fsyncobjectfiles:: + This boolean will enable 'fsync()' when writing object files. ++ +This is a total waste of time and effort on a filesystem that orders +data writes properly, but can be useful for filesystems that do not use +journalling (traditional UNIX filesystems) or that only journal metadata +and not file contents (OS X's HFS+, or Linux ext3 with "data=writeback"). + alias.*:: Command aliases for the linkgit:git[1] command wrapper - e.g. after defining "alias.last = cat-file commit HEAD", the invocation @@ -999,10 +1007,6 @@ repack.usedeltabaseoffset:: Allow linkgit:git-repack[1] to create packs that uses delta-base offset. Defaults to false. -show.difftree:: - The default linkgit:git-diff-tree[1] arguments to be used - for linkgit:git-show[1]. - showbranch.default:: The default set of branches for linkgit:git-show-branch[1]. See linkgit:git-show-branch[1]. @@ -1013,6 +1017,25 @@ status.relativePaths:: relative to the repository root (this was the default for git prior to v1.5.4). +status.showUntrackedFiles:: + By default, linkgit:git-status[1] and linkgit:git-commit[1] show + files which are not currently tracked by Git. Directories which + contain only untracked files, are shown with the directory name + only. Showing untracked files means that Git needs to lstat() all + all the files in the whole repository, which might be slow on some + systems. So, this variable controls how the commands displays + the untracked files. Possible values are: ++ +-- + - 'no' - Show no untracked files + - 'normal' - Shows untracked files and directories + - 'all' - Shows also individual files in untracked directories. +-- ++ +If this variable is not specified, it defaults to 'normal'. +This variable can be overridden with the -u|--untracked-files option +of linkgit:git-status[1] and linkgit:git-commit[1]. + tar.umask:: This variable can be used to restrict the permission bits of tar archive entries. The default is 0002, which turns off the @@ -1048,10 +1071,6 @@ user.signingkey:: unchanged to gpg's --local-user parameter, so you may specify a key using any method that gpg supports. -whatchanged.difftree:: - The default linkgit:git-diff-tree[1] arguments to be used - for linkgit:git-whatchanged[1]. - imap:: The configuration variables in the 'imap' section are described in linkgit:git-imap-send[1]. diff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt index 7e8b4ff72c..d0fe192fb3 100644 --- a/Documentation/git-commit.txt +++ b/Documentation/git-commit.txt @@ -8,7 +8,7 @@ git-commit - Record changes to the repository SYNOPSIS -------- [verse] -'git-commit' [-a | --interactive] [-s] [-v] [-u] [--amend] +'git-commit' [-a | --interactive] [-s] [-v] [-u<mode>] [--amend] [(-c | -C) <commit>] [-F <file> | -m <msg>] [--allow-empty] [--no-verify] [-e] [--author=<author>] [--cleanup=<mode>] [--] [[-i | -o ]<file>...] @@ -162,13 +162,22 @@ but can be used to amend a merge commit. the last commit without committing changes that have already been staged. --u:: ---untracked-files:: - Show all untracked files, also those in uninteresting - directories, in the "Untracked files:" section of commit - message template. Without this option only its name and - a trailing slash are displayed for each untracked - directory. +-u[<mode>]:: +--untracked-files[=<mode>]:: + Show untracked files (Default: 'all'). ++ +The mode parameter is optional, and is used to specify +the handling of untracked files. The possible options are: ++ +-- + - 'no' - Show no untracked files + - 'normal' - Shows untracked files and directories + - 'all' - Also shows individual files in untracked directories. +-- ++ +See linkgit:git-config[1] for configuration variable +used to change the default for when the option is not +specified. -v:: --verbose:: diff --git a/Documentation/git-fast-export.txt b/Documentation/git-fast-export.txt index 332346cc5d..277a547a02 100644 --- a/Documentation/git-fast-export.txt +++ b/Documentation/git-fast-export.txt @@ -36,6 +36,26 @@ when encountering a signed tag. With 'strip', the tags will be made unsigned, with 'verbatim', they will be silently exported and with 'warn', they will be exported, but you will see a warning. +--export-marks=<file>:: + Dumps the internal marks table to <file> when complete. + Marks are written one per line as `:markid SHA-1`. Only marks + for revisions are dumped; marks for blobs are ignored. + Backends can use this file to validate imports after they + have been completed, or to save the marks table across + incremental runs. As <file> is only opened and truncated + at completion, the same path can also be safely given to + \--import-marks. + +--import-marks=<file>:: + Before processing any input, load the marks specified in + <file>. The input file must exist, must be readable, and + must use the same format as produced by \--export-marks. ++ +Any commits that have already been marked will not be exported again. +If the backend uses a similar \--import-marks file, this allows for +incremental bidirectional exporting of the repository by keeping the +marks the same across runs. + EXAMPLES -------- diff --git a/Documentation/git-parse-remote.txt b/Documentation/git-parse-remote.txt index 951dbd6c83..421312eca9 100644 --- a/Documentation/git-parse-remote.txt +++ b/Documentation/git-parse-remote.txt @@ -8,7 +8,7 @@ git-parse-remote - Routines to help parsing remote repository access parameters SYNOPSIS -------- -'. git-parse-remote' +'. "$(git --exec-path)/git-parse-remote"' DESCRIPTION ----------- diff --git a/Documentation/git-push.txt b/Documentation/git-push.txt index 89e0049bce..f3d5d883a7 100644 --- a/Documentation/git-push.txt +++ b/Documentation/git-push.txt @@ -67,7 +67,8 @@ nor in any Push line of the corresponding remotes file---see below). --mirror:: Instead of naming each ref to push, specifies that all - refs under `$GIT_DIR/refs/heads/` and `$GIT_DIR/refs/tags/` + refs under `$GIT_DIR/refs/` (which includes but is not + limited to `refs/heads/`, `refs/remotes/`, and `refs/tags/`) be mirrored to the remote repository. Newly created local refs will be pushed to the remote end, locally updated refs will be force updated on the remote end, and deleted refs diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index 9e273bc5a6..59e95adf42 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -184,7 +184,10 @@ blobs contained in a commit. second ago\}' or '\{1979-02-26 18:30:00\}') to specify the value of the ref at a prior point in time. This suffix may only be used immediately following a ref name and the ref must have an - existing log ($GIT_DIR/logs/<ref>). + existing log ($GIT_DIR/logs/<ref>). Note that this looks up the state + of your *local* ref at a given time; e.g., what was in your local + `master` branch last week. If you want to look at commits made during + certain times, see `--since` and `--until`. * A ref followed by the suffix '@' with an ordinal specification enclosed in a brace pair (e.g. '\{1\}', '\{15\}') to specify diff --git a/Documentation/git-sh-setup.txt b/Documentation/git-sh-setup.txt index c543170342..6731f9ac4c 100644 --- a/Documentation/git-sh-setup.txt +++ b/Documentation/git-sh-setup.txt @@ -7,7 +7,7 @@ git-sh-setup - Common git shell script setup code SYNOPSIS -------- -'git-sh-setup' +'. "$(git --exec-path)/git-sh-setup"' DESCRIPTION ----------- diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt index f4cbd2f212..c350ad0f83 100644 --- a/Documentation/git-svn.txt +++ b/Documentation/git-svn.txt @@ -448,6 +448,8 @@ svn-remote.<name>.rewriteRoot:: the repository with a public http:// or svn:// URL in the metadata so users of it will see the public URL. +-- + Since the noMetadata, rewriteRoot, useSvnsyncProps and useSvmProps options all affect the metadata generated and used by git-svn; they *must* be set in the configuration file before any history is imported @@ -456,7 +458,6 @@ and these settings should never be changed once they are set. Additionally, only one of these four options can be used per-svn-remote section because they affect the 'git-svn-id:' metadata line. --- BASIC EXAMPLES -------------- @@ -512,7 +513,7 @@ have each person clone that repository with 'git clone': cd project git-init git remote add origin server:/pub/project - git config --add remote.origin.fetch=+refs/remotes/*:refs/remotes/* + git config --add remote.origin.fetch '+refs/remotes/*:refs/remotes/*' git fetch # Initialize git-svn locally (be sure to use the same URL and -T/-b/-t options as were used on server) git-svn init http://svn.foo.org/project diff --git a/Documentation/git-update-ref.txt b/Documentation/git-update-ref.txt index 7f7e3d197b..bae2c8b7ec 100644 --- a/Documentation/git-update-ref.txt +++ b/Documentation/git-update-ref.txt @@ -7,7 +7,7 @@ git-update-ref - Update the object name stored in a ref safely SYNOPSIS -------- -'git-update-ref' [-m <reason>] (-d <ref> <oldvalue> | [--no-deref] <ref> <newvalue> [<oldvalue>]) +'git-update-ref' [-m <reason>] (-d <ref> [<oldvalue>] | [--no-deref] <ref> <newvalue> [<oldvalue>]) DESCRIPTION ----------- diff --git a/Documentation/git.txt b/Documentation/git.txt index 7414238fe5..85468a154d 100644 --- a/Documentation/git.txt +++ b/Documentation/git.txt @@ -43,12 +43,13 @@ 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.6/git.html[documentation for release 1.5.6] +* link:v1.5.6.1/git.html[documentation for release 1.5.6.1] * release notes for - link:RelNotes-1.5.6.txt[1.5.6], + link:RelNotes-1.5.6.1.txt[1.5.6.1]. + link:RelNotes-1.5.6.txt[1.5.6]. -* link:v1.5.5/git.html[documentation for release 1.5.5] +* link:v1.5.5.4/git.html[documentation for release 1.5.5.4] * release notes for link:RelNotes-1.5.5.4.txt[1.5.5.4], @@ -57,8 +58,6 @@ Documentation for older releases are available here: link:RelNotes-1.5.5.1.txt[1.5.5.1], link:RelNotes-1.5.5.txt[1.5.5]. -* link:v1.5.5.4/git.html[documentation for release 1.5.5.4] - * link:v1.5.4.5/git.html[documentation for release 1.5.4.5] * release notes for @@ -82,6 +81,8 @@ Documentation for older releases are available here: link:RelNotes-1.5.3.1.txt[1.5.3.1], link:RelNotes-1.5.3.txt[1.5.3]. +* link:v1.5.2.5/git.html[documentation for release 1.5.2.5] + * release notes for link:RelNotes-1.5.2.5.txt[1.5.2.5], link:RelNotes-1.5.2.4.txt[1.5.2.4], diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 471754eb12..6e67990f64 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -502,6 +502,12 @@ frotz unspecified Creating an archive ~~~~~~~~~~~~~~~~~~~ +`export-ignore` +^^^^^^^^^^^^^^^ + +Files and directories with the attribute `export-ignore` won't be added to +archive files. + `export-subst` ^^^^^^^^^^^^^^ diff --git a/Documentation/gitcli.txt b/Documentation/gitcli.txt index 8fb5d889e5..2316049865 100644 --- a/Documentation/gitcli.txt +++ b/Documentation/gitcli.txt @@ -13,8 +13,37 @@ gitcli DESCRIPTION ----------- -This manual describes best practice in how to use git CLI. Here are -the rules that you should follow when you are scripting git: +This manual describes the convention used throughout git CLI. + +Many commands take revisions (most often "commits", but sometimes +"tree-ish", depending on the context and command) and paths as their +arguments. Here are the rules: + + * Revisions come first and then paths. + E.g. in `git diff v1.0 v2.0 arch/x86 include/asm-x86`, + `v1.0` and `v2.0` are revisions and `arch/x86` and `include/asm-x86` + are paths. + + * When an argument can be misunderstood as either a revision or a path, + they can be disambiguated by placing `\--` between them. + E.g. `git diff \-- HEAD` is, "I have a file called HEAD in my work + tree. Please show changes between the version I staged in the index + and what I have in the work tree for that file". not "show difference + between the HEAD commit and the work tree as a whole". You can say + `git diff HEAD \--` to ask for the latter. + + * Without disambiguating `\--`, git makes a reasonable guess, but errors + out and asking you to disambiguate when ambiguous. E.g. if you have a + file called HEAD in your work tree, `git diff HEAD` is ambiguous, and + you have to say either `git diff HEAD \--` or `git diff \-- HEAD` to + disambiguate. + +When writing a script that is expected to handle random user-input, it is +a good practice to make it explicit which arguments are which by placing +disambiguating `\--` at appropriate places. + +Here are the rules regarding the "flags" that you should follow when you are +scripting git: * it's preferred to use the non dashed form of git commands, which means that you should prefer `"git foo"` to `"git-foo"`. @@ -34,8 +63,8 @@ the rules that you should follow when you are scripting git: if you happen to have a file called `HEAD` in the work tree. -ENHANCED CLI ------------- +ENHANCED OPTION PARSER +---------------------- From the git 1.5.4 series and further, many git commands (not all of them at the time of the writing though) come with an enhanced option parser. diff --git a/Documentation/githooks.txt b/Documentation/githooks.txt index 4f06ae0ed4..262a4f1626 100644 --- a/Documentation/githooks.txt +++ b/Documentation/githooks.txt @@ -17,7 +17,8 @@ Hooks are little scripts you can place in `$GIT_DIR/hooks` directory to trigger action at certain points. When `git-init` is run, a handful example hooks are copied in the `hooks` directory of the new repository, but by default they are -all disabled. To enable a hook, make it executable with `chmod +x`. +all disabled. To enable a hook, rename it by removing its `.sample` +suffix. This document describes the currently defined hooks. diff --git a/Documentation/gittutorial-2.txt b/Documentation/gittutorial-2.txt index e3d5c1fbf0..31e8a23a4f 100644 --- a/Documentation/gittutorial-2.txt +++ b/Documentation/gittutorial-2.txt @@ -61,9 +61,9 @@ from your own version. Note that you can shorten it to only a few characters to save yourself typing all 40 hex digits: ------------------------------------------------ -$ git-cat-file -t 54196cc2 +$ git cat-file -t 54196cc2 commit -$ git-cat-file commit 54196cc2 +$ git cat-file commit 54196cc2 tree 92b8b694ffb1675e5975148e1121810081dbdffe author J. Bruce Fields <bfields@puzzle.fieldses.org> 1143414668 -0500 committer J. Bruce Fields <bfields@puzzle.fieldses.org> 1143414668 -0500 @@ -166,7 +166,7 @@ hello world! and the "parent" object refers to the previous commit: ------------------------------------------------ -$ git-cat-file commit 54196cc2 +$ git cat-file commit 54196cc2 tree 92b8b694ffb1675e5975148e1121810081dbdffe author J. Bruce Fields <bfields@puzzle.fieldses.org> 1143414668 -0500 committer J. Bruce Fields <bfields@puzzle.fieldses.org> 1143414668 -0500 @@ -246,7 +246,7 @@ The last diff is empty, but no new commits have been made, and the head still doesn't contain the new line: ------------------------------------------------ -$ git-diff HEAD +$ git diff HEAD diff --git a/file.txt b/file.txt index a042389..513feba 100644 --- a/file.txt @@ -273,7 +273,7 @@ hello world, again So what our "git add" did was store a new blob and then put a reference to it in the index file. If we modify the file again, -we'll see that the new modifications are reflected in the "git-diff" +we'll see that the new modifications are reflected in the "git diff" output: ------------------------------------------------ diff --git a/Documentation/howto/update-hook-example.txt b/Documentation/howto/update-hook-example.txt index 88765b5575..8b2ec502f4 100644 --- a/Documentation/howto/update-hook-example.txt +++ b/Documentation/howto/update-hook-example.txt @@ -65,10 +65,10 @@ function info { # Implement generic branch and tag policies. # - Tags should not be updated once created. -# - Branches should only be fast-forwarded. +# - Branches should only be fast-forwarded unless their pattern starts with '+' case "$1" in refs/tags/*) - [ -f "$GIT_DIR/$1" ] && + git rev-parse --verify -q "$1" && deny >/dev/null "You can't overwrite an existing tag" ;; refs/heads/*) @@ -80,7 +80,7 @@ case "$1" in mb=$(git-merge-base "$2" "$3") case "$mb,$2" in "$2,$mb") info "Update is fast-forward" ;; - *) deny >/dev/null "This is not a fast-forward update." ;; + *) noff=y; info "This is not a fast-forward update.";; esac fi ;; @@ -95,21 +95,30 @@ allowed_users_file=$GIT_DIR/info/allowed-users username=$(id -u -n) info "The user is: '$username'" -if [ -f "$allowed_users_file" ]; then +if test -f "$allowed_users_file" +then rc=$(cat $allowed_users_file | grep -v '^#' | grep -v '^$' | - while read head_pattern user_patterns; do - matchlen=$(expr "$1" : "$head_pattern") - if [ "$matchlen" == "${#1}" ]; then - info "Found matching head pattern: '$head_pattern'" - for user_pattern in $user_patterns; do - info "Checking user: '$username' against pattern: '$user_pattern'" - matchlen=$(expr "$username" : "$user_pattern") - if [ "$matchlen" == "${#username}" ]; then - grant "Allowing user: '$username' with pattern: '$user_pattern'" - fi - done - deny "The user is not in the access list for this branch" - fi + while read heads user_patterns + do + # does this rule apply to us? + head_pattern=${heads#+} + matchlen=$(expr "$1" : "${head_pattern#+}") + test "$matchlen" = ${#1} || continue + + # if non-ff, $heads must be with the '+' prefix + test -n "$noff" && + test "$head_pattern" = "$heads" && continue + + info "Found matching head pattern: '$head_pattern'" + for user_pattern in $user_patterns; do + info "Checking user: '$username' against pattern: '$user_pattern'" + matchlen=$(expr "$username" : "$user_pattern") + if test "$matchlen" = "${#username}" + then + grant "Allowing user: '$username' with pattern: '$user_pattern'" + fi + done + deny "The user is not in the access list for this branch" done ) case "$rc" in @@ -124,23 +133,32 @@ groups=$(id -G -n) info "The user belongs to the following groups:" info "'$groups'" -if [ -f "$allowed_groups_file" ]; then +if test -f "$allowed_groups_file" +then rc=$(cat $allowed_groups_file | grep -v '^#' | grep -v '^$' | - while read head_pattern group_patterns; do - matchlen=$(expr "$1" : "$head_pattern") - if [ "$matchlen" == "${#1}" ]; then - info "Found matching head pattern: '$head_pattern'" - for group_pattern in $group_patterns; do - for groupname in $groups; do - info "Checking group: '$groupname' against pattern: '$group_pattern'" - matchlen=$(expr "$groupname" : "$group_pattern") - if [ "$matchlen" == "${#groupname}" ]; then - grant "Allowing group: '$groupname' with pattern: '$group_pattern'" - fi - done + while read heads group_patterns + do + # does this rule apply to us? + head_pattern=${heads#+} + matchlen=$(expr "$1" : "${head_pattern#+}") + test "$matchlen" = ${#1} || continue + + # if non-ff, $heads must be with the '+' prefix + test -n "$noff" && + test "$head_pattern" = "$heads" && continue + + info "Found matching head pattern: '$head_pattern'" + for group_pattern in $group_patterns; do + for groupname in $groups; do + info "Checking group: '$groupname' against pattern: '$group_pattern'" + matchlen=$(expr "$groupname" : "$group_pattern") + if test "$matchlen" = "${#groupname}" + then + grant "Allowing group: '$groupname' with pattern: '$group_pattern'" + fi done - deny "None of the user's groups are in the access list for this branch" - fi + done + deny "None of the user's groups are in the access list for this branch" done ) case "$rc" in @@ -159,6 +177,7 @@ allowed-groups, to describe which heads can be pushed into by whom. The format of each file would look like this: refs/heads/master junio + +refs/heads/pu junio refs/heads/cogito$ pasky refs/heads/bw/.* linus refs/heads/tmp/.* .* @@ -166,7 +185,8 @@ whom. The format of each file would look like this: With this, Linus can push or create "bw/penguin" or "bw/zebra" or "bw/panda" branches, Pasky can do only "cogito", and JC can -do master branch and make versioned tags. And anybody can do -tmp/blah branches. +do master and pu branches and make versioned tags. And anybody +can do tmp/blah branches. The '+' sign at the pu record means +that JC can make non-fast-forward pushes on it. ------------ diff --git a/Documentation/technical/api-builtin.txt b/Documentation/technical/api-builtin.txt index 52cdb4c520..7ede1e64e5 100644 --- a/Documentation/technical/api-builtin.txt +++ b/Documentation/technical/api-builtin.txt @@ -4,7 +4,7 @@ builtin API Adding a new built-in --------------------- -There are 4 things to do to add a bulit-in command implementation to +There are 4 things to do to add a built-in command implementation to git: . Define the implementation of the built-in command `foo` with @@ -18,8 +18,8 @@ git: defined in `git.c`. The entry should look like: { "foo", cmd_foo, <options> }, - - where options is the bitwise-or of: ++ +where options is the bitwise-or of: `RUN_SETUP`:: @@ -33,6 +33,12 @@ git: If the standard output is connected to a tty, spawn a pager and feed our output to it. +`NEED_WORK_TREE`:: + + Make sure there is a work tree, i.e. the command cannot act + on bare repositories. + This makes only sense when `RUN_SETUP` is also set. + . Add `builtin-foo.o` to `BUILTIN_OBJS` in `Makefile`. Additionally, if `foo` is a new command, there are 3 more things to do: @@ -41,8 +47,7 @@ Additionally, if `foo` is a new command, there are 3 more things to do: . Write documentation in `Documentation/git-foo.txt`. -. Add an entry for `git-foo` to the list at the end of - `Documentation/cmd-list.perl`. +. Add an entry for `git-foo` to `command-list.txt`. How a built-in is called diff --git a/Documentation/technical/api-parse-options.txt b/Documentation/technical/api-parse-options.txt index b7cda94f54..539863b1f9 100644 --- a/Documentation/technical/api-parse-options.txt +++ b/Documentation/technical/api-parse-options.txt @@ -1,6 +1,206 @@ parse-options API ================= -Talk about <parse-options.h> +The parse-options API is used to parse and massage options in git +and to provide a usage help with consistent look. -(Pierre) +Basics +------ + +The argument vector `argv[]` may usually contain mandatory or optional +'non-option arguments', e.g. a filename or a branch, and 'options'. +Options are optional arguments that start with a dash and +that allow to change the behavior of a command. + +* There are basically three types of options: + 'boolean' options, + options with (mandatory) 'arguments' and + options with 'optional arguments' + (i.e. a boolean option that can be adjusted). + +* There are basically two forms of options: + 'Short options' consist of one dash (`-`) and one alphanumeric + character. + 'Long options' begin with two dashes (`\--`) and some + alphanumeric characters. + +* Options are case-sensitive. + Please define 'lower-case long options' only. + +The parse-options API allows: + +* 'sticked' and 'separate form' of options with arguments. + `-oArg` is sticked, `-o Arg` is separate form. + `\--option=Arg` is sticked, `\--option Arg` is separate form. + +* Long options may be 'abbreviated', as long as the abbreviation + is unambiguous. + +* Short options may be bundled, e.g. `-a -b` can be specified as `-ab`. + +* Boolean long options can be 'negated' (or 'unset') by prepending + `no-`, e.g. `\--no-abbrev` instead of `\--abbrev`. + +* Options and non-option arguments can clearly be separated using the `\--` + option, e.g. `-a -b \--option \-- \--this-is-a-file` indicates that + `\--this-is-a-file` must not be processed as an option. + +Steps to parse options +---------------------- + +. `#include "parse-options.h"` + +. define a NULL-terminated + `static const char * const builtin_foo_usage[]` array + containing alternative usage strings + +. define `builtin_foo_options` array as described below + in section 'Data Structure'. + +. in `cmd_foo(int argc, const char **argv, const char *prefix)` + call + + argc = parse_options(argc, argv, builtin_foo_options, builtin_foo_usage, flags); ++ +`parse_options()` will filter out the processed options of `argv[]` and leave the +non-option arguments in `argv[]`. +`argc` is updated appropriately because of the assignment. ++ +Flags are the bitwise-or of: + +`PARSE_OPT_KEEP_DASHDASH`:: + Keep the `\--` that usually separates options from + non-option arguments. + +`PARSE_OPT_STOP_AT_NON_OPTION`:: + Usually the whole argument vector is massaged and reordered. + Using this flag, processing is stopped at the first non-option + argument. + +Data Structure +-------------- + +The main data structure is an array of the `option` struct, +say `static struct option builtin_add_options[]`. +There are some macros to easily define options: + +`OPT__ABBREV(&int_var)`:: + Add `\--abbrev[=<n>]`. + +`OPT__DRY_RUN(&int_var)`:: + Add `-n, \--dry-run`. + +`OPT__QUIET(&int_var)`:: + Add `-q, \--quiet`. + +`OPT__VERBOSE(&int_var)`:: + Add `-v, \--verbose`. + +`OPT_GROUP(description)`:: + Start an option group. `description` is a short string that + describes the group or an empty string. + Start the description with an upper-case letter. + +`OPT_BOOLEAN(short, long, &int_var, description)`:: + Introduce a boolean option. + `int_var` is incremented on each use. + +`OPT_BIT(short, long, &int_var, description, mask)`:: + Introduce a boolean option. + If used, `int_var` is bitwise-ored with `mask`. + +`OPT_SET_INT(short, long, &int_var, description, integer)`:: + Introduce a boolean option. + If used, set `int_var` to `integer`. + +`OPT_SET_PTR(short, long, &ptr_var, description, ptr)`:: + Introduce a boolean option. + If used, set `ptr_var` to `ptr`. + +`OPT_STRING(short, long, &str_var, arg_str, description)`:: + Introduce an option with string argument. + The string argument is put into `str_var`. + +`OPT_INTEGER(short, long, &int_var, description)`:: + Introduce an option with integer argument. + The integer is put into `int_var`. + +`OPT_DATE(short, long, &int_var, description)`:: + Introduce an option with date argument, see `approxidate()`. + The timestamp is put into `int_var`. + +`OPT_CALLBACK(short, long, &var, arg_str, description, func_ptr)`:: + Introduce an option with argument. + The argument will be fed into the function given by `func_ptr` + and the result will be put into `var`. + See 'Option Callbacks' below for a more elaborate description. + +`OPT_ARGUMENT(long, description)`:: + Introduce a long-option argument that will be kept in `argv[]`. + + +The last element of the array must be `OPT_END()`. + +If not stated otherwise, interpret the arguments as follows: + +* `short` is a character for the short option + (e.g. `\'e\'` for `-e`, use `0` to omit), + +* `long` is a string for the long option + (e.g. `"example"` for `\--example`, use `NULL` to omit), + +* `int_var` is an integer variable, + +* `str_var` is a string variable (`char *`), + +* `arg_str` is the string that is shown as argument + (e.g. `"branch"` will result in `<branch>`). + If set to `NULL`, three dots (`...`) will be displayed. + +* `description` is a short string to describe the effect of the option. + It shall begin with a lower-case letter and a full stop (`.`) shall be + omitted at the end. + +Option Callbacks +---------------- + +The function must be defined in this form: + + int func(const struct option *opt, const char *arg, int unset) + +The callback mechanism is as follows: + +* Inside `funct`, the only interesting member of the structure + given by `opt` is the void pointer `opt->value`. + `\*opt->value` will be the value that is saved into `var`, if you + use `OPT_CALLBACK()`. + For example, do `*(unsigned long *)opt->value = 42;` to get 42 + into an `unsigned long` variable. + +* Return value `0` indicates success and non-zero return + value will invoke `usage_with_options()` and, thus, die. + +* If the user negates the option, `arg` is `NULL` and `unset` is 1. + +Sophisticated option parsing +---------------------------- + +If you need, for example, option callbacks with optional arguments +or without arguments at all, or if you need other special cases, +that are not handled by the macros above, you need to specify the +members of the `option` structure manually. + +This is not covered in this document, but well documented +in `parse-options.h` itself. + +Examples +-------- + +See `test-parse-options.c` and +`builtin-add.c`, +`builtin-clone.c`, +`builtin-commit.c`, +`builtin-fetch.c`, +`builtin-fsck.c`, +`builtin-rm.c` +for real-world examples. |