summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Documentation/RelNotes-1.5.4.6.txt43
-rw-r--r--Documentation/RelNotes-1.5.5.5.txt11
-rw-r--r--Documentation/RelNotes-1.5.6.1.txt28
-rw-r--r--Documentation/RelNotes-1.5.6.2.txt31
-rw-r--r--Documentation/RelNotes-1.6.0.txt134
-rw-r--r--Documentation/SubmittingPatches5
-rw-r--r--Documentation/asciidoc.conf1
-rw-r--r--Documentation/config.txt57
-rw-r--r--Documentation/diff-options.txt2
-rw-r--r--Documentation/git-add.txt4
-rw-r--r--Documentation/git-am.txt4
-rw-r--r--Documentation/git-annotate.txt2
-rw-r--r--Documentation/git-apply.txt21
-rw-r--r--Documentation/git-archimport.txt8
-rw-r--r--Documentation/git-archive.txt8
-rw-r--r--Documentation/git-bisect.txt8
-rw-r--r--Documentation/git-blame.txt6
-rw-r--r--Documentation/git-branch.txt16
-rw-r--r--Documentation/git-bundle.txt41
-rw-r--r--Documentation/git-cat-file.txt4
-rw-r--r--Documentation/git-check-attr.txt2
-rw-r--r--Documentation/git-check-ref-format.txt4
-rw-r--r--Documentation/git-checkout-index.txt22
-rw-r--r--Documentation/git-checkout.txt12
-rw-r--r--Documentation/git-cherry-pick.txt4
-rw-r--r--Documentation/git-cherry.txt10
-rw-r--r--Documentation/git-citool.txt4
-rw-r--r--Documentation/git-clean.txt6
-rw-r--r--Documentation/git-clone.txt14
-rw-r--r--Documentation/git-commit-tree.txt4
-rw-r--r--Documentation/git-commit.txt51
-rw-r--r--Documentation/git-config.txt38
-rw-r--r--Documentation/git-count-objects.txt4
-rw-r--r--Documentation/git-cvsexportcommit.txt13
-rw-r--r--Documentation/git-cvsimport.txt20
-rw-r--r--Documentation/git-cvsserver.txt45
-rw-r--r--Documentation/git-daemon.txt34
-rw-r--r--Documentation/git-describe.txt14
-rw-r--r--Documentation/git-diff-files.txt4
-rw-r--r--Documentation/git-diff-index.txt34
-rw-r--r--Documentation/git-diff-tree.txt18
-rw-r--r--Documentation/git-diff.txt18
-rw-r--r--Documentation/git-fast-export.txt30
-rw-r--r--Documentation/git-fast-import.txt24
-rw-r--r--Documentation/git-fetch-pack.txt18
-rw-r--r--Documentation/git-fetch.txt4
-rw-r--r--Documentation/git-filter-branch.txt14
-rw-r--r--Documentation/git-fmt-merge-msg.txt4
-rw-r--r--Documentation/git-for-each-ref.txt8
-rw-r--r--Documentation/git-format-patch.txt6
-rw-r--r--Documentation/git-fsck-objects.txt2
-rw-r--r--Documentation/git-fsck.txt10
-rw-r--r--Documentation/git-gc.txt16
-rw-r--r--Documentation/git-get-tar-commit-id.txt8
-rw-r--r--Documentation/git-grep.txt4
-rw-r--r--Documentation/git-gui.txt24
-rw-r--r--Documentation/git-hash-object.txt4
-rw-r--r--Documentation/git-help.txt6
-rw-r--r--Documentation/git-http-fetch.txt4
-rw-r--r--Documentation/git-http-push.txt2
-rw-r--r--Documentation/git-imap-send.txt6
-rw-r--r--Documentation/git-index-pack.txt12
-rw-r--r--Documentation/git-init-db.txt2
-rw-r--r--Documentation/git-init.txt6
-rw-r--r--Documentation/git-instaweb.txt8
-rw-r--r--Documentation/git-log.txt6
-rw-r--r--Documentation/git-lost-found.txt2
-rw-r--r--Documentation/git-ls-files.txt10
-rw-r--r--Documentation/git-ls-remote.txt4
-rw-r--r--Documentation/git-ls-tree.txt2
-rw-r--r--Documentation/git-mailinfo.txt8
-rw-r--r--Documentation/git-mailsplit.txt2
-rw-r--r--Documentation/git-merge-base.txt10
-rw-r--r--Documentation/git-merge-file.txt14
-rw-r--r--Documentation/git-merge-index.txt20
-rw-r--r--Documentation/git-merge-one-file.txt4
-rw-r--r--Documentation/git-merge-tree.txt2
-rw-r--r--Documentation/git-merge.txt24
-rw-r--r--Documentation/git-mergetool.txt18
-rw-r--r--Documentation/git-mktag.txt2
-rw-r--r--Documentation/git-mktree.txt2
-rw-r--r--Documentation/git-mv.txt6
-rw-r--r--Documentation/git-name-rev.txt8
-rw-r--r--Documentation/git-pack-objects.txt10
-rw-r--r--Documentation/git-pack-redundant.txt10
-rw-r--r--Documentation/git-pack-refs.txt4
-rw-r--r--Documentation/git-parse-remote.txt2
-rw-r--r--Documentation/git-patch-id.txt4
-rw-r--r--Documentation/git-peek-remote.txt6
-rw-r--r--Documentation/git-prune-packed.txt2
-rw-r--r--Documentation/git-prune.txt14
-rw-r--r--Documentation/git-pull.txt5
-rw-r--r--Documentation/git-push.txt7
-rw-r--r--Documentation/git-quiltimport.txt2
-rw-r--r--Documentation/git-read-tree.txt46
-rw-r--r--Documentation/git-rebase.txt38
-rw-r--r--Documentation/git-receive-pack.txt24
-rw-r--r--Documentation/git-relink.txt2
-rw-r--r--Documentation/git-remote.txt12
-rw-r--r--Documentation/git-repack.txt15
-rw-r--r--Documentation/git-repo-config.txt2
-rw-r--r--Documentation/git-request-pull.txt2
-rw-r--r--Documentation/git-rerere.txt14
-rw-r--r--Documentation/git-reset.txt2
-rw-r--r--Documentation/git-rev-list.txt16
-rw-r--r--Documentation/git-rev-parse.txt23
-rw-r--r--Documentation/git-revert.txt2
-rw-r--r--Documentation/git-rm.txt10
-rw-r--r--Documentation/git-send-email.txt18
-rw-r--r--Documentation/git-send-pack.txt16
-rw-r--r--Documentation/git-sh-setup.txt2
-rw-r--r--Documentation/git-shell.txt2
-rw-r--r--Documentation/git-shortlog.txt6
-rw-r--r--Documentation/git-show-branch.txt8
-rw-r--r--Documentation/git-show-index.txt6
-rw-r--r--Documentation/git-show-ref.txt10
-rw-r--r--Documentation/git-show.txt8
-rw-r--r--Documentation/git-stash.txt22
-rw-r--r--Documentation/git-status.txt6
-rw-r--r--Documentation/git-stripspace.txt2
-rw-r--r--Documentation/git-submodule.txt14
-rw-r--r--Documentation/git-svn.txt158
-rw-r--r--Documentation/git-symbolic-ref.txt4
-rw-r--r--Documentation/git-tag.txt18
-rw-r--r--Documentation/git-tar-tree.txt6
-rw-r--r--Documentation/git-unpack-file.txt2
-rw-r--r--Documentation/git-unpack-objects.txt4
-rw-r--r--Documentation/git-update-index.txt26
-rw-r--r--Documentation/git-update-ref.txt10
-rw-r--r--Documentation/git-update-server-info.txt4
-rw-r--r--Documentation/git-upload-archive.txt4
-rw-r--r--Documentation/git-upload-pack.txt8
-rw-r--r--Documentation/git-var.txt4
-rw-r--r--Documentation/git-verify-pack.txt6
-rw-r--r--Documentation/git-verify-tag.txt4
-rw-r--r--Documentation/git-web--browse.txt10
-rw-r--r--Documentation/git-whatchanged.txt10
-rw-r--r--Documentation/git-write-tree.txt2
-rw-r--r--Documentation/git.txt43
-rw-r--r--Documentation/gitattributes.txt24
-rw-r--r--Documentation/gitcli.txt75
-rw-r--r--Documentation/gitcore-tutorial.txt127
-rw-r--r--Documentation/gitcvs-migration.txt24
-rw-r--r--Documentation/gitdiffcore.txt34
-rw-r--r--Documentation/githooks.txt13
-rw-r--r--Documentation/gitignore.txt8
-rw-r--r--Documentation/gitk.txt3
-rw-r--r--Documentation/gitrepository-layout.txt24
-rw-r--r--Documentation/gittutorial-2.txt48
-rw-r--r--Documentation/gittutorial.txt66
-rw-r--r--Documentation/howto/update-hook-example.txt88
-rw-r--r--Documentation/technical/api-builtin.txt15
-rw-r--r--Documentation/technical/api-parse-options.txt204
-rw-r--r--Documentation/user-manual.txt85
-rwxr-xr-xGIT-VERSION-GEN2
-rw-r--r--Makefile12
l---------RelNotes2
-rw-r--r--abspath.c68
-rw-r--r--archive-tar.c2
-rw-r--r--archive-zip.c2
-rw-r--r--archive.c13
-rw-r--r--archive.h1
-rw-r--r--builtin-apply.c162
-rw-r--r--builtin-cat-file.c1
-rw-r--r--builtin-clone.c23
-rw-r--r--builtin-commit-tree.c43
-rw-r--r--builtin-commit.c21
-rw-r--r--builtin-describe.c2
-rw-r--r--builtin-fast-export.c99
-rw-r--r--builtin-fetch-pack.c4
-rw-r--r--builtin-fetch.c51
-rw-r--r--builtin-for-each-ref.c7
-rw-r--r--builtin-fsck.c2
-rw-r--r--builtin-log.c2
-rw-r--r--builtin-merge-recursive.c13
-rw-r--r--builtin-pack-objects.c24
-rw-r--r--builtin-pack-refs.c121
-rw-r--r--builtin-reset.c39
-rw-r--r--builtin-update-ref.c36
-rw-r--r--builtin-upload-archive.c2
-rw-r--r--builtin-verify-pack.c63
-rw-r--r--cache.h14
-rwxr-xr-xcheck_bindir13
-rw-r--r--combine-diff.c7
-rw-r--r--config.c84
-rw-r--r--config.mak.in2
-rwxr-xr-xcontrib/completion/git-completion.bash6
-rwxr-xr-xcontrib/fast-import/git-p44
-rw-r--r--contrib/thunderbird-patch-inline/README20
-rwxr-xr-xcontrib/thunderbird-patch-inline/appp.sh55
-rw-r--r--diff.c116
-rw-r--r--environment.c9
-rw-r--r--exec_cmd.c31
-rw-r--r--git-compat-util.h167
-rwxr-xr-xgit-merge.sh2
-rwxr-xr-xgit-mergetool.sh24
-rwxr-xr-xgit-rebase.sh14
-rwxr-xr-xgit-repack.sh6
-rwxr-xr-xgit-send-email.perl44
-rwxr-xr-xgit-svn.perl26
-rw-r--r--git.c32
-rw-r--r--git.spec.in13
-rwxr-xr-xgitweb/gitweb.perl423
-rw-r--r--help.c22
-rw-r--r--http-push.c2
-rw-r--r--http-walker.c2
-rw-r--r--pack-check.c110
-rw-r--r--pack-refs.c117
-rw-r--r--pack-refs.h18
-rw-r--r--pack-revindex.c6
-rw-r--r--pack-revindex.h1
-rw-r--r--pack-write.c2
-rw-r--r--pack.h4
-rw-r--r--parse-options.c23
-rw-r--r--path.c76
-rw-r--r--quote.c2
-rw-r--r--read-cache.c16
-rw-r--r--setup.c3
-rw-r--r--sha1_file.c136
-rw-r--r--shell.c25
-rw-r--r--t/.gitattributes1
-rw-r--r--t/.gitignore1
-rw-r--r--t/Makefile12
-rw-r--r--t/README32
-rwxr-xr-xt/aggregate-results.sh34
-rwxr-xr-xt/t0040-parse-options.sh116
-rwxr-xr-xt/t1400-update-ref.sh8
-rwxr-xr-xt/t1502-rev-parse-parseopt.sh4
-rwxr-xr-xt/t3404-rebase-interactive.sh43
-rwxr-xr-xt/t3800-mktag.sh4
-rwxr-xr-xt/t3903-stash.sh2
-rwxr-xr-xt/t4014-format-patch.sh6
-rwxr-xr-xt/t4015-diff-whitespace.sh14
-rwxr-xr-xt/t4016-diff-quote.sh14
-rwxr-xr-xt/t4017-diff-retval.sh22
-rwxr-xr-xt/t4100-apply-stat.sh62
-rwxr-xr-xt/t4109-apply-multifrag.sh132
-rw-r--r--t/t4109/patch1.patch28
-rw-r--r--t/t4109/patch2.patch30
-rw-r--r--t/t4109/patch3.patch31
-rw-r--r--t/t4109/patch4.patch30
-rwxr-xr-xt/t4119-apply-config.sh4
-rwxr-xr-xt/t4127-apply-same-fn.sh85
-rwxr-xr-xt/t4150-am.sh2
-rwxr-xr-xt/t5000-tar-tree.sh9
-rwxr-xr-xt/t5302-pack-index.sh14
-rwxr-xr-xt/t5303-pack-corruption-resilience.sh194
-rwxr-xr-xt/t5515-fetch-merge-logic.sh9
-rwxr-xr-xt/t5540-http-push.sh2
-rwxr-xr-xt/t5601-clone.sh22
-rwxr-xr-xt/t6120-describe.sh2
-rwxr-xr-xt/t6300-for-each-ref.sh87
-rwxr-xr-xt/t7102-reset.sh47
-rwxr-xr-xt/t7502-commit.sh6
-rwxr-xr-xt/t7502-status.sh98
-rwxr-xr-xt/t9106-git-svn-dcommit-clobber-series.sh8
-rwxr-xr-xt/t9123-git-svn-rebuild-with-rewriteroot.sh32
-rwxr-xr-xt/t9301-fast-export.sh23
-rwxr-xr-xt/t9700-perl-git.sh44
-rwxr-xr-xt/t9700/test.pl100
-rw-r--r--t/test-lib.sh77
-rwxr-xr-x[-rw-r--r--]templates/hooks--applypatch-msg.sample (renamed from templates/hooks--applypatch-msg)2
-rwxr-xr-x[-rw-r--r--]templates/hooks--commit-msg.sample (renamed from templates/hooks--commit-msg)2
-rwxr-xr-x[-rw-r--r--]templates/hooks--post-commit.sample (renamed from templates/hooks--post-commit)2
-rw-r--r--templates/hooks--post-receive16
-rwxr-xr-xtemplates/hooks--post-receive.sample15
-rwxr-xr-x[-rw-r--r--]templates/hooks--post-update.sample (renamed from templates/hooks--post-update)2
-rwxr-xr-x[-rw-r--r--]templates/hooks--pre-applypatch.sample (renamed from templates/hooks--pre-applypatch)2
-rw-r--r--templates/hooks--pre-commit70
-rwxr-xr-xtemplates/hooks--pre-commit.sample18
-rwxr-xr-x[-rw-r--r--]templates/hooks--pre-rebase.sample (renamed from templates/hooks--pre-rebase)27
-rwxr-xr-x[-rw-r--r--]templates/hooks--prepare-commit-msg.sample (renamed from templates/hooks--prepare-commit-msg)6
-rwxr-xr-x[-rw-r--r--]templates/hooks--update.sample (renamed from templates/hooks--update)2
-rw-r--r--test-parse-options.c39
-rw-r--r--wrapper.c160
-rw-r--r--ws.c33
-rw-r--r--wt-status.c21
-rw-r--r--wt-status.h7
278 files changed, 4746 insertions, 2393 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.5.6.2.txt b/Documentation/RelNotes-1.5.6.2.txt
new file mode 100644
index 0000000000..02d5910d5c
--- /dev/null
+++ b/Documentation/RelNotes-1.5.6.2.txt
@@ -0,0 +1,31 @@
+GIT v1.5.6.2 Release Notes
+==========================
+
+Futureproof
+-----------
+
+ * "git-shell" accepts 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.6.1
+--------------------
+
+* Optimization for a large import via "git-svn" introduced in v1.5.6 had a
+ serious memory and temporary file leak, which made it unusable for
+ moderately large import.
+
+* "git-svn" mangled remote nickname used in the configuration file
+ unnecessarily.
+
+* "git diff --check" did not report the result via its exit status
+ reliably.
+
+* "git show" segfaulted when an annotated tag that points at another
+ annotated tag was given to it.
+
+--
+exec >/var/tmp/1
+echo O=$(git describe maint)
+O=v1.5.6.1-13-g4f3dcc2
+git shortlog --no-merges $O..maint
diff --git a/Documentation/RelNotes-1.6.0.txt b/Documentation/RelNotes-1.6.0.txt
new file mode 100644
index 0000000000..e5c285f9c0
--- /dev/null
+++ b/Documentation/RelNotes-1.6.0.txt
@@ -0,0 +1,134 @@
+GIT v1.6.0 Release Notes
+========================
+
+User visible changes
+--------------------
+
+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.
+
+By default, packfiles created with this version uses delta-base-offset
+encoding introduced in v1.4.4. Pack idx files are using version 2 that
+allows larger packs and added robustness thanks to its CRC checking,
+introduced in v1.5.2.
+
+
+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-apply can handle a patch that touches the same path more than once
+ much better than before.
+
+* git-apply can be told not to trust the line counts recorded in the input
+ patch but recount, with the new --recount option.
+
+* git-archive can be told to omit certain paths from its output using
+ export-ignore attributes.
+
+* git-clone can clone from a remote whose URL would be rewritten by
+ configuration stored in $HOME/.gitconfig now.
+
+* git-diff --check now checks leftover merge conflict markers.
+
+* When remote side used to have branch 'foo' and git-fetch finds that now
+ it has branch 'foo/bar', it refuses to lose the existing remote tracking
+ branch and its reflog. The error message has been improved to suggest
+ pruning the remote if the user wants to proceed and get the latest set
+ of branches from the remote, including such 'foo/bar'.
+
+* 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.
+
+* git-send-mail can talk not just over SSL but over TLS 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-155-gaa0c1f2
+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/asciidoc.conf b/Documentation/asciidoc.conf
index 10c1a151a4..40d43b78ee 100644
--- a/Documentation/asciidoc.conf
+++ b/Documentation/asciidoc.conf
@@ -8,6 +8,7 @@
# the command.
[attributes]
+asterisk=&#42;
plus=&#43;
caret=&#94;
startsb=&#91;
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 5331b450ea..561ff645f9 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
@@ -937,9 +945,17 @@ pack.indexVersion::
legacy pack index used by Git versions prior to 1.5.2, and 2 for
the new pack index with capabilities for packs larger than 4 GB
as well as proper protection against the repacking of corrupted
- packs. Version 2 is selected and this config option ignored
- whenever the corresponding pack is larger than 2 GB. Otherwise
- the default is 1.
+ packs. Version 2 is the default. Note that version 2 is enforced
+ and this config option ignored whenever the corresponding pack is
+ larger than 2 GB.
++
+If you have an old git that does not understand the version 2 `{asterisk}.idx` file,
+cloning or fetching over a non native protocol (e.g. "http" and "rsync")
+that will copy both `{asterisk}.pack` file and corresponding `{asterisk}.idx` file from the
+other side may give you a repository that cannot be accessed with your
+older version of git. If the `{asterisk}.pack` file is smaller than 2 GB, however,
+you can use linkgit:git-index-pack[1] on the *.pack file to regenerate
+the `{asterisk}.idx` file.
pack.packSizeLimit::
The default maximum size of a pack. This setting only affects
@@ -996,12 +1012,12 @@ remotes.<group>::
<group>". See linkgit:git-remote[1].
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].
+ By default, linkgit:git-repack[1] creates packs that use
+ delta-base offset. If you need to share your repository with
+ git older than version 1.4.4, either directly or via a dumb
+ protocol such as http, then you need to set this option to
+ "false" and repack. Access from old git versions over the
+ native protocol are unaffected by this option.
showbranch.default::
The default set of branches for linkgit:git-show-branch[1].
@@ -1013,6 +1029,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 +1083,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/diff-options.txt b/Documentation/diff-options.txt
index 572154834b..cba90fd27c 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -241,4 +241,4 @@ endif::git-format-patch[]
Do not show any source or destination prefix.
For more detailed explanation on these common options, see also
-linkgit:gitdiffcore[7][diffcore documentation].
+linkgit:gitdiffcore[7].
diff --git a/Documentation/git-add.txt b/Documentation/git-add.txt
index b8e3fa6759..011a743652 100644
--- a/Documentation/git-add.txt
+++ b/Documentation/git-add.txt
@@ -8,7 +8,7 @@ git-add - Add file contents to the index
SYNOPSIS
--------
[verse]
-'git-add' [-n] [-v] [--force | -f] [--interactive | -i] [--patch | -p]
+'git add' [-n] [-v] [--force | -f] [--interactive | -i] [--patch | -p]
[--update | -u] [--refresh] [--ignore-errors] [--]
<filepattern>...
@@ -107,7 +107,7 @@ Configuration
The optional configuration variable 'core.excludesfile' indicates a path to a
file containing patterns of file names to exclude from git-add, similar to
$GIT_DIR/info/exclude. Patterns in the exclude file are used in addition to
-those in info/exclude. See linkgit:gitrepository-layout[5][repository layout].
+those in info/exclude. See linkgit:gitrepository-layout[5].
EXAMPLES
diff --git a/Documentation/git-am.txt b/Documentation/git-am.txt
index 46544a0769..1296b91172 100644
--- a/Documentation/git-am.txt
+++ b/Documentation/git-am.txt
@@ -9,11 +9,11 @@ git-am - Apply a series of patches from a mailbox
SYNOPSIS
--------
[verse]
-'git-am' [--signoff] [--keep] [--utf8 | --no-utf8]
+'git am' [--signoff] [--keep] [--utf8 | --no-utf8]
[--3way] [--interactive] [--binary]
[--whitespace=<option>] [-C<n>] [-p<n>]
<mbox>|<Maildir>...
-'git-am' [--skip | --resolved]
+'git am' [--skip | --resolved]
DESCRIPTION
-----------
diff --git a/Documentation/git-annotate.txt b/Documentation/git-annotate.txt
index da15379ae5..8b6b56a544 100644
--- a/Documentation/git-annotate.txt
+++ b/Documentation/git-annotate.txt
@@ -7,7 +7,7 @@ git-annotate - Annotate file lines with commit info
SYNOPSIS
--------
-git-annotate [options] file [revision]
+'git annotate' [options] file [revision]
DESCRIPTION
-----------
diff --git a/Documentation/git-apply.txt b/Documentation/git-apply.txt
index c8347637da..70d19f63eb 100644
--- a/Documentation/git-apply.txt
+++ b/Documentation/git-apply.txt
@@ -9,10 +9,10 @@ git-apply - Apply a patch on a git index file and a working tree
SYNOPSIS
--------
[verse]
-'git-apply' [--stat] [--numstat] [--summary] [--check] [--index]
+'git apply' [--stat] [--numstat] [--summary] [--check] [--index]
[--apply] [--no-add] [--build-fake-ancestor <file>] [-R | --reverse]
[--allow-binary-replacement | --binary] [--reject] [-z]
- [-pNUM] [-CNUM] [--inaccurate-eof] [--cached]
+ [-pNUM] [-CNUM] [--inaccurate-eof] [--recount] [--cached]
[--whitespace=<nowarn|warn|fix|error|error-all>]
[--exclude=PATH] [--verbose] [<patch>...]
@@ -64,7 +64,7 @@ OPTIONS
without using the working tree. This implies '--index'.
--build-fake-ancestor <file>::
- Newer git-diff output has embedded 'index information'
+ Newer `git-diff` output has embedded 'index information'
for each blob to help identify the original version that
the patch applies to. When this flag is given, and if
the original versions of the blobs is available locally,
@@ -78,7 +78,7 @@ the information is read from the current index instead.
Apply the patch in reverse.
--reject::
- For atomicity, linkgit:git-apply[1] by default fails the whole patch and
+ For atomicity, `git-apply` by default fails the whole patch and
does not touch the working tree when some of the hunks
do not apply. This option makes it apply
the parts of the patch that are applicable, and leave the
@@ -102,7 +102,7 @@ the information is read from the current index instead.
ever ignored.
--unidiff-zero::
- By default, linkgit:git-apply[1] expects that the patch being
+ By default, `git-apply` expects that the patch being
applied is a unified diff with at least one line of context.
This provides good safety measures, but breaks down when
applying a diff generated with --unified=0. To bypass these
@@ -113,7 +113,7 @@ discouraged.
--apply::
If you use any of the options marked "Turns off
- 'apply'" above, linkgit:git-apply[1] reads and outputs the
+ 'apply'" above, `git-apply` reads and outputs the
information you asked without actually applying the
patch. Give this flag after those flags to also apply
the patch.
@@ -147,7 +147,7 @@ discouraged.
considered whitespace errors.
+
By default, the command outputs warning messages but applies the patch.
-When linkgit:git-apply[1] is used for statistics and not applying a
+When `git-apply is used for statistics and not applying a
patch, it defaults to `nowarn`.
+
You can use different `<action>` to control this
@@ -177,6 +177,11 @@ behavior:
current patch being applied will be printed. This option will cause
additional information to be reported.
+--recount::
+ Do not trust the line counts in the hunk headers, but infer them
+ by inspecting the patch (e.g. after editing the patch without
+ adjusting the hunk headers appropriately).
+
Configuration
-------------
@@ -186,7 +191,7 @@ apply.whitespace::
Submodules
----------
-If the patch contains any changes to submodules then linkgit:git-apply[1]
+If the patch contains any changes to submodules then `git-apply`
treats these changes as follows.
If --index is specified (explicitly or implicitly), then the submodule
diff --git a/Documentation/git-archimport.txt b/Documentation/git-archimport.txt
index 603117c796..f089debaa9 100644
--- a/Documentation/git-archimport.txt
+++ b/Documentation/git-archimport.txt
@@ -9,7 +9,7 @@ git-archimport - Import an Arch repository into git
SYNOPSIS
--------
[verse]
-'git-archimport' [-h] [-v] [-o] [-a] [-f] [-T] [-D depth] [-t tempdir]
+'git archimport' [-h] [-v] [-o] [-a] [-f] [-T] [-D depth] [-t tempdir]
<archive/branch>[:<git-branch>] ...
DESCRIPTION
@@ -34,12 +34,12 @@ Arch repository.
Make sure you have a recent version of `tla` available in the path. `tla` must
know about the repositories you pass to `git-archimport`.
-For the initial import `git-archimport` expects to find itself in an empty
+For the initial import, `git-archimport` expects to find itself in an empty
directory. To follow the development of a project that uses Arch, rerun
`git-archimport` with the same parameters as the initial import to perform
incremental imports.
-While git-archimport will try to create sensible branch names for the
+While `git-archimport` will try to create sensible branch names for the
archives that it imports, it is also possible to specify git branch names
manually. To do so, write a git branch name after each <archive/branch>
parameter, separated by a colon. This way, you can shorten the Arch
@@ -84,7 +84,7 @@ OPTIONS
-o::
Use this for compatibility with old-style branch names used by
- earlier versions of git-archimport. Old-style branch names
+ earlier versions of `git-archimport`. Old-style branch names
were category--branch, whereas new-style branch names are
archive,category--branch--version. In both cases, names given
on the command-line will override the automatically-generated
diff --git a/Documentation/git-archive.txt b/Documentation/git-archive.txt
index 9b5f3ae5ed..dbe9bad2f3 100644
--- a/Documentation/git-archive.txt
+++ b/Documentation/git-archive.txt
@@ -9,7 +9,7 @@ git-archive - Create an archive of files from a named tree
SYNOPSIS
--------
[verse]
-'git-archive' --format=<fmt> [--list] [--prefix=<prefix>/] [<extra>]
+'git archive' --format=<fmt> [--list] [--prefix=<prefix>/] [<extra>]
[--remote=<repo> [--exec=<git-upload-archive>]] <tree-ish>
[path...]
@@ -20,13 +20,13 @@ structure for the named tree, and writes it out to the standard
output. If <prefix> is specified it is
prepended to the filenames in the archive.
-'git-archive' behaves differently when given a tree ID versus when
+`git-archive` behaves differently when given a tree ID versus when
given a commit ID or tag ID. In the first case the current time is
used as modification time of each file in the archive. In the latter
case the commit time as recorded in the referenced commit object is
used instead. Additionally the commit ID is stored in a global
extended pax header if the tar format is used; it can be extracted
-using 'git-get-tar-commit-id'. In ZIP files it is stored as a file
+using `git-get-tar-commit-id`. In ZIP files it is stored as a file
comment.
OPTIONS
@@ -57,7 +57,7 @@ OPTIONS
--exec=<git-upload-archive>::
Used with --remote to specify the path to the
- git-upload-archive executable on the remote side.
+ `git-upload-archive` on the remote side.
<tree-ish>::
The tree or commit to produce an archive for.
diff --git a/Documentation/git-bisect.txt b/Documentation/git-bisect.txt
index 3ca0d330ad..8bbcb940fb 100644
--- a/Documentation/git-bisect.txt
+++ b/Documentation/git-bisect.txt
@@ -26,7 +26,7 @@ on the subcommand:
git bisect log
git bisect run <cmd>...
-This command uses 'git-rev-list --bisect' option to help drive the
+This command uses `git rev-list --bisect` to help drive the
binary search process to find which change introduced a bug, given an
old "good" commit object name and a later "bad" commit object name.
@@ -215,13 +215,13 @@ tweaks (e.g., s/#define DEBUG 0/#define DEBUG 1/ in a header file, or
work around other problem this bisection is not interested in")
applied to the revision being tested.
-To cope with such a situation, after the inner git-bisect finds the
+To cope with such a situation, after the inner `git-bisect` finds the
next revision to test, with the "run" script, you can apply that tweak
before compiling, run the real test, and after the test decides if the
revision (possibly with the needed tweaks) passed the test, rewind the
tree to the pristine state. Finally the "run" script can exit with
-the status of the real test to let "git bisect run" command loop to
-know the outcome.
+the status of the real test to let the "git bisect run" command loop to
+determine the outcome.
EXAMPLES
--------
diff --git a/Documentation/git-blame.txt b/Documentation/git-blame.txt
index 8f4fb46685..443039fd94 100644
--- a/Documentation/git-blame.txt
+++ b/Documentation/git-blame.txt
@@ -8,7 +8,7 @@ git-blame - Show what revision and author last modified each line of a file
SYNOPSIS
--------
[verse]
-'git-blame' [-c] [-b] [-l] [--root] [-t] [-f] [-n] [-s] [-p] [-w] [--incremental] [-L n,m]
+'git blame' [-c] [-b] [-l] [--root] [-t] [-f] [-n] [-s] [-p] [-w] [--incremental] [-L n,m]
[-S <revs-file>] [-M] [-C] [-C] [--since=<date>]
[<rev> | --contents <file>] [--] <file>
@@ -21,7 +21,7 @@ last modified the line. Optionally, start annotating from the given revision.
Also it can limit the range of lines annotated.
This report doesn't tell you anything about lines which have been deleted or
-replaced; you need to use a tool such as linkgit:git-diff[1] or the "pickaxe"
+replaced; you need to use a tool such as `git-diff` or the "pickaxe"
interface briefly mentioned in the following paragraph.
Apart from supporting file annotation, git also supports searching the
@@ -49,7 +49,7 @@ include::blame-options.txt[]
file (see `-M`). The first number listed is the score.
This is the number of alphanumeric characters detected
to be moved between or within files. This must be above
- a certain threshold for git-blame to consider those lines
+ a certain threshold for `git-blame` to consider those lines
of code to have been moved.
-f::
diff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt
index 0fd58083eb..5e78aed7de 100644
--- a/Documentation/git-branch.txt
+++ b/Documentation/git-branch.txt
@@ -8,12 +8,12 @@ git-branch - List, create, or delete branches
SYNOPSIS
--------
[verse]
-'git-branch' [--color | --no-color] [-r | -a] [--merged | --no-merged]
+'git branch' [--color | --no-color] [-r | -a] [--merged | --no-merged]
[-v [--abbrev=<length> | --no-abbrev]]
[--contains <commit>]
-'git-branch' [--track | --no-track] [-l] [-f] <branchname> [<start-point>]
-'git-branch' (-m | -M) [<oldbranch>] <newbranch>
-'git-branch' (-d | -D) [-r] <branchname>...
+'git branch' [--track | --no-track] [-l] [-f] <branchname> [<start-point>]
+'git branch' (-m | -M) [<oldbranch>] <newbranch>
+'git branch' (-d | -D) [-r] <branchname>...
DESCRIPTION
-----------
@@ -37,7 +37,7 @@ working tree to it; use "git checkout <newbranch>" to switch to the
new branch.
When a local branch is started off a remote branch, git sets up the
-branch so that linkgit:git-pull[1] will appropriately merge from
+branch so that `git-pull` will appropriately merge from
the remote branch. This behavior may be changed via the global
`branch.autosetupmerge` configuration flag. That setting can be
overridden by using the `--track` and `--no-track` options.
@@ -54,7 +54,7 @@ has a reflog then the reflog will also be deleted.
Use -r together with -d to delete remote-tracking branches. Note, that it
only makes sense to delete remote-tracking branches if they no longer exist
-in remote repository or if linkgit:git-fetch[1] was configured not to fetch
+in remote repository or if `git-fetch` was configured not to fetch
them again. See also 'prune' subcommand of linkgit:git-remote[1] for way to
clean up all obsolete remote-tracking branches.
@@ -107,14 +107,14 @@ OPTIONS
Display the full sha1s in output listing rather than abbreviating them.
--track::
- When creating a new branch, set up configuration so that git-pull
+ When creating a new branch, set up configuration so that `git-pull`
will automatically retrieve data from the start point, which must be
a branch. Use this if you always pull from the same upstream branch
into the new branch, and if you don't want to use "git pull
<repository> <refspec>" explicitly. This behavior is the default
when the start point is a remote branch. Set the
branch.autosetupmerge configuration variable to `false` if you want
- git-checkout and git-branch to always behave as if '--no-track' were
+ `git-checkout` and `git-branch` to always behave as if '--no-track' were
given. Set it to `always` if you want this behavior when the
start-point is either a local or remote branch.
diff --git a/Documentation/git-bundle.txt b/Documentation/git-bundle.txt
index f6a06129ab..b729db7d28 100644
--- a/Documentation/git-bundle.txt
+++ b/Documentation/git-bundle.txt
@@ -9,10 +9,10 @@ git-bundle - Move objects and refs by archive
SYNOPSIS
--------
[verse]
-'git-bundle' create <file> <git-rev-list args>
-'git-bundle' verify <file>
-'git-bundle' list-heads <file> [refname...]
-'git-bundle' unbundle <file> [refname...]
+'git bundle' create <file> <git-rev-list args>
+'git bundle' verify <file>
+'git bundle' list-heads <file> [refname...]
+'git bundle' unbundle <file> [refname...]
DESCRIPTION
-----------
@@ -21,9 +21,9 @@ Some workflows require that one or more branches of development on one
machine be replicated on another machine, but the two machines cannot
be directly connected so the interactive git protocols (git, ssh,
rsync, http) cannot be used. This command provides support for
-git-fetch and git-pull to operate by packaging objects and references
+`git-fetch` and `git-pull` to operate by packaging objects and references
in an archive at the originating machine, then importing those into
-another repository using linkgit:git-fetch[1] and linkgit:git-pull[1]
+another repository using `git-fetch` and `git-pull`
after moving the archive by some means (i.e., by sneakernet). As no
direct connection between repositories exists, the user must specify a
basis for the bundle that is held by the destination repository: the
@@ -35,14 +35,14 @@ OPTIONS
create <file>::
Used to create a bundle named 'file'. This requires the
- git-rev-list arguments to define the bundle contents.
+ `git-rev-list` arguments to define the bundle contents.
verify <file>::
Used to check that a bundle file is valid and will apply
cleanly to the current repository. This includes checks on the
bundle format itself as well as checking that the prerequisite
commits exist and are fully linked in the current repository.
- git-bundle prints a list of missing commits, if any, and exits
+ `git-bundle` prints a list of missing commits, if any, and exits
with non-zero status.
list-heads <file>::
@@ -51,16 +51,15 @@ list-heads <file>::
printed out.
unbundle <file>::
- Passes the objects in the bundle to linkgit:git-index-pack[1]
+ Passes the objects in the bundle to `git-index-pack`
for storage in the repository, then prints the names of all
defined references. If a reflist is given, only references
matching those in the given list are printed. This command is
- really plumbing, intended to be called only by
- linkgit:git-fetch[1].
+ really plumbing, intended to be called only by `git-fetch`.
[git-rev-list-args...]::
- A list of arguments, acceptable to git-rev-parse and
- git-rev-list, that specify the specific objects and references
+ A list of arguments, acceptable to `git-rev-parse` and
+ `git-rev-list`, that specify the specific objects and references
to transport. For example, "master~10..master" causes the
current master reference to be packaged along with all objects
added since its 10th ancestor commit. There is no explicit
@@ -70,16 +69,16 @@ unbundle <file>::
[refname...]::
A list of references used to limit the references reported as
- available. This is principally of use to git-fetch, which
+ available. This is principally of use to `git-fetch`, which
expects to receive only those references asked for and not
- necessarily everything in the pack (in this case, git-bundle is
- acting like linkgit:git-fetch-pack[1]).
+ necessarily everything in the pack (in this case, `git-bundle` is
+ acting like `git-fetch-pack`).
SPECIFYING REFERENCES
---------------------
-git-bundle will only package references that are shown by
-git-show-ref: this includes heads, tags, and remote heads. References
+`git-bundle` will only package references that are shown by
+`git-show-ref`: this includes heads, tags, and remote heads. References
such as master~1 cannot be packaged, but are perfectly suitable for
defining the basis. More than one reference may be packaged, and more
than one basis can be specified. The objects packaged are those not
@@ -116,7 +115,7 @@ We set a tag in R1 (lastR2bundle) after the previous such transport,
and move it afterwards to help build the bundle.
------------
-$ git-bundle create mybundle master ^lastR2bundle
+$ git bundle create mybundle master ^lastR2bundle
$ git tag -f lastR2bundle master
------------
@@ -141,8 +140,8 @@ $ git bundle create mybundle master -n 10
Then you move mybundle from A to B, and in R2 on B:
------------
-$ git-bundle verify mybundle
-$ git-fetch mybundle master:localRef
+$ git bundle verify mybundle
+$ git fetch mybundle master:localRef
------------
With something like this in the config in R2:
diff --git a/Documentation/git-cat-file.txt b/Documentation/git-cat-file.txt
index f58013ca60..d35e8a04fe 100644
--- a/Documentation/git-cat-file.txt
+++ b/Documentation/git-cat-file.txt
@@ -9,8 +9,8 @@ git-cat-file - Provide content or type/size information for repository objects
SYNOPSIS
--------
[verse]
-'git-cat-file' [-t | -s | -e | -p | <type>] <object>
-'git-cat-file' [--batch | --batch-check] < <list-of-objects>
+'git cat-file' [-t | -s | -e | -p | <type>] <object>
+'git cat-file' [--batch | --batch-check] < <list-of-objects>
DESCRIPTION
-----------
diff --git a/Documentation/git-check-attr.txt b/Documentation/git-check-attr.txt
index ef16b93982..abe1f1b7dd 100644
--- a/Documentation/git-check-attr.txt
+++ b/Documentation/git-check-attr.txt
@@ -8,7 +8,7 @@ git-check-attr - Display gitattributes information.
SYNOPSIS
--------
-'git-check-attr' attr... [--] pathname...
+'git check-attr' attr... [--] pathname...
DESCRIPTION
-----------
diff --git a/Documentation/git-check-ref-format.txt b/Documentation/git-check-ref-format.txt
index c560c0aa6d..429083bb63 100644
--- a/Documentation/git-check-ref-format.txt
+++ b/Documentation/git-check-ref-format.txt
@@ -7,7 +7,7 @@ git-check-ref-format - Make sure ref name is well formed
SYNOPSIS
--------
-'git-check-ref-format' <refname>
+'git check-ref-format' <refname>
DESCRIPTION
-----------
@@ -47,7 +47,7 @@ refname expressions (see linkgit:git-rev-parse[1]). Namely:
. colon `:` is used as in `srcref:dstref` to mean "use srcref\'s
value and store it in dstref" in fetch and push operations.
It may also be used to select a specific object such as with
- linkgit:git-cat-file[1] "git-cat-file blob v1.3.3:refs.c".
+ `git-cat-file`: "git cat-file blob v1.3.3:refs.c".
GIT
diff --git a/Documentation/git-checkout-index.txt b/Documentation/git-checkout-index.txt
index 676203b2eb..a833a4dda8 100644
--- a/Documentation/git-checkout-index.txt
+++ b/Documentation/git-checkout-index.txt
@@ -9,7 +9,7 @@ git-checkout-index - Copy files from the index to the working tree
SYNOPSIS
--------
[verse]
-'git-checkout-index' [-u] [-q] [-a] [-f] [-n] [--prefix=<string>]
+'git checkout-index' [-u] [-q] [-a] [-f] [-n] [--prefix=<string>]
[--stage=<number>|all]
[--temp]
[-z] [--stdin]
@@ -73,25 +73,25 @@ OPTIONS
The order of the flags used to matter, but not anymore.
-Just doing `git-checkout-index` does nothing. You probably meant
-`git-checkout-index -a`. And if you want to force it, you want
-`git-checkout-index -f -a`.
+Just doing `git checkout-index` does nothing. You probably meant
+`git checkout-index -a`. And if you want to force it, you want
+`git checkout-index -f -a`.
Intuitiveness is not the goal here. Repeatability is. The reason for
the "no arguments means no work" behavior is that from scripts you are
supposed to be able to do:
----------------
-$ find . -name '*.h' -print0 | xargs -0 git-checkout-index -f --
+$ find . -name '*.h' -print0 | xargs -0 git checkout-index -f --
----------------
which will force all existing `*.h` files to be replaced with their
cached copies. If an empty command line implied "all", then this would
force-refresh everything in the index, which was not the point. But
-since git-checkout-index accepts --stdin it would be faster to use:
+since `git-checkout-index` accepts --stdin it would be faster to use:
----------------
-$ find . -name '*.h' -print0 | git-checkout-index -f -z --stdin
+$ find . -name '*.h' -print0 | git checkout-index -f -z --stdin
----------------
The `--` is just a good idea when you know the rest will be filenames;
@@ -144,7 +144,7 @@ EXAMPLES
To update and refresh only the files already checked out::
+
----------------
-$ git-checkout-index -n -f -a && git-update-index --ignore-missing --refresh
+$ git checkout-index -n -f -a && git update-index --ignore-missing --refresh
----------------
Using `git-checkout-index` to "export an entire tree"::
@@ -153,10 +153,10 @@ Using `git-checkout-index` to "export an entire tree"::
Just read the desired tree into the index, and do:
+
----------------
-$ git-checkout-index --prefix=git-export-dir/ -a
+$ git checkout-index --prefix=git-export-dir/ -a
----------------
+
-`git-checkout-index` will "export" the index into the specified
+`git checkout-index` will "export" the index into the specified
directory.
+
The final "/" is important. The exported name is literally just
@@ -166,7 +166,7 @@ following example.
Export files with a prefix::
+
----------------
-$ git-checkout-index --prefix=.merged- Makefile
+$ git checkout-index --prefix=.merged- Makefile
----------------
+
This will check out the currently cached copy of `Makefile`
diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt
index 3ad9760a4d..c0f9c6e88c 100644
--- a/Documentation/git-checkout.txt
+++ b/Documentation/git-checkout.txt
@@ -8,8 +8,8 @@ git-checkout - Checkout a branch or paths to the working tree
SYNOPSIS
--------
[verse]
-'git-checkout' [-q] [-f] [[--track | --no-track] -b <new_branch> [-l]] [-m] [<branch>]
-'git-checkout' [<tree-ish>] <paths>...
+'git checkout' [-q] [-f] [[--track | --no-track] -b <new_branch> [-l]] [-m] [<branch>]
+'git checkout' [<tree-ish>] <paths>...
DESCRIPTION
-----------
@@ -23,7 +23,7 @@ options, which will be passed to `git branch`.
When <paths> are given, this command does *not* switch
branches. It updates the named paths in the working tree from
-the index file (i.e. it runs `git-checkout-index -f -u`), or
+the index file (i.e. it runs `git checkout-index -f -u`), or
from a named commit. In
this case, the `-f` and `-b` options are meaningless and giving
either of them results in an error. <tree-ish> argument can be
@@ -49,14 +49,14 @@ OPTIONS
-t::
--track::
- When creating a new branch, set up configuration so that git-pull
+ When creating a new branch, set up configuration so that `git-pull`
will automatically retrieve data from the start point, which must be
a branch. Use this if you always pull from the same upstream branch
into the new branch, and if you don't want to use "git pull
<repository> <refspec>" explicitly. This behavior is the default
when the start point is a remote branch. Set the
branch.autosetupmerge configuration variable to `false` if you want
- git-checkout and git-branch to always behave as if '--no-track' were
+ `git-checkout` and `git-branch` to always behave as if '--no-track' were
given. Set it to `always` if you want this behavior when the
start-point is either a local or remote branch.
@@ -112,7 +112,7 @@ current branch and directly point at the commit named by the tag
(`v2.6.18` in the above example).
You can use usual git commands while in this state. You can use
-`git-reset --hard $othercommit` to further move around, for
+`git reset --hard $othercommit` to further move around, for
example. You can make changes and create a new commit on top of
a detached HEAD. You can even create a merge by using `git
merge $othercommit`.
diff --git a/Documentation/git-cherry-pick.txt b/Documentation/git-cherry-pick.txt
index 5ac9cfb0ef..1b864dacff 100644
--- a/Documentation/git-cherry-pick.txt
+++ b/Documentation/git-cherry-pick.txt
@@ -7,7 +7,7 @@ git-cherry-pick - Apply the change introduced by an existing commit
SYNOPSIS
--------
-'git-cherry-pick' [--edit] [-n] [-m parent-number] [-s] [-x] <commit>
+'git cherry-pick' [--edit] [-n] [-m parent-number] [-s] [-x] <commit>
DESCRIPTION
-----------
@@ -19,7 +19,7 @@ OPTIONS
-------
<commit>::
Commit to cherry-pick.
- For a more complete list of ways to spell commits, see
+ For a more complete list of ways to spell commits, see the
"SPECIFYING REVISIONS" section in linkgit:git-rev-parse[1].
-e::
diff --git a/Documentation/git-cherry.txt b/Documentation/git-cherry.txt
index ef7caf61e1..9859bc8f2f 100644
--- a/Documentation/git-cherry.txt
+++ b/Documentation/git-cherry.txt
@@ -7,14 +7,14 @@ git-cherry - Find commits not merged upstream
SYNOPSIS
--------
-'git-cherry' [-v] <upstream> [<head>] [<limit>]
+'git cherry' [-v] <upstream> [<head>] [<limit>]
DESCRIPTION
-----------
The changeset (or "diff") of each commit between the fork-point and <head>
is compared against each commit between the fork-point and <upstream>.
-The commits are compared with their 'patch id', obtained from linkgit:git-patch-id[1]
-program.
+The commits are compared with their 'patch id', obtained from
+the `git-patch-id` program.
Every commit that doesn't exist in the <upstream> branch
has its id (sha1) reported, prefixed by a symbol. The ones that have
@@ -37,8 +37,8 @@ to and including <limit> are not reported:
\__*__*__<limit>__-__+__> <head>
-Because git-cherry compares the changeset rather than the commit id
-(sha1), you can use git-cherry to find out if a commit you made locally
+Because `git-cherry` compares the changeset rather than the commit id
+(sha1), you can use `git-cherry` to find out if a commit you made locally
has been applied <upstream> under a different commit id. For example,
this will happen if you're feeding patches <upstream> via email rather
than pushing or pulling commits directly.
diff --git a/Documentation/git-citool.txt b/Documentation/git-citool.txt
index 09108d0e66..8e6c7e67cd 100644
--- a/Documentation/git-citool.txt
+++ b/Documentation/git-citool.txt
@@ -14,9 +14,9 @@ DESCRIPTION
A Tcl/Tk based graphical interface to review modified files, stage
them into the index, enter a commit message and record the new
commit onto the current branch. This interface is an alternative
-to the less interactive linkgit:git-commit[1] program.
+to the less interactive `git-commit` program.
-git-citool is actually a standard alias for 'git gui citool'.
+`git-citool` is actually a standard alias for `git gui citool`.
See linkgit:git-gui[1] for more details.
Author
diff --git a/Documentation/git-clean.txt b/Documentation/git-clean.txt
index 37a82ee4b8..8168bf3bf4 100644
--- a/Documentation/git-clean.txt
+++ b/Documentation/git-clean.txt
@@ -8,7 +8,7 @@ git-clean - Remove untracked files from the working tree
SYNOPSIS
--------
[verse]
-'git-clean' [-d] [-f] [-n] [-q] [-x | -X] [--] <paths>...
+'git clean' [-d] [-f] [-n] [-q] [-x | -X] [--] <paths>...
DESCRIPTION
-----------
@@ -27,7 +27,7 @@ OPTIONS
-f::
If the git configuration specifies clean.requireForce as true,
- git-clean will refuse to run unless given -f or -n.
+ `git-clean` will refuse to run unless given -f or -n.
-n::
--dry-run::
@@ -41,7 +41,7 @@ OPTIONS
-x::
Don't use the ignore rules. This allows removing all untracked
files, including build products. This can be used (possibly in
- conjunction with linkgit:git-reset[1]) to create a pristine
+ conjunction with `git-reset`) to create a pristine
working directory to test a clean build.
-X::
diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt
index 7973e6af4c..eef95a404a 100644
--- a/Documentation/git-clone.txt
+++ b/Documentation/git-clone.txt
@@ -9,7 +9,7 @@ git-clone - Clone a repository into a new directory
SYNOPSIS
--------
[verse]
-'git-clone' [--template=<template_directory>]
+'git clone' [--template=<template_directory>]
[-l] [-s] [--no-hardlinks] [-q] [-n] [--bare]
[-o <name>] [-u <upload-pack>] [--reference <repository>]
[--depth <depth>] [--] <repository> [<directory>]
@@ -68,10 +68,10 @@ it unless you understand what it does. If you clone your
repository using this option and then delete branches (or use any
other git command that makes any existing commit unreferenced) in the
source repository, some objects may become unreferenced (or dangling).
-These objects may be removed by normal git operations (such as git-commit[1])
-which automatically call git-gc[1]. If these objects are removed and
-were referenced by the cloned repository, then the cloned repository
-will become corrupt.
+These objects may be removed by normal git operations (such as `git-commit`)
+which automatically call `git gc --auto`. (See linkgit:git-gc[1].)
+If these objects are removed and were referenced by the cloned repository,
+then the cloned repository will become corrupt.
@@ -88,7 +88,7 @@ will become corrupt.
--quiet::
-q::
Operate quietly. This flag is passed to "rsync" and
- "git-fetch-pack" commands when given.
+ `git-fetch-pack` commands when given.
--no-checkout::
-n::
@@ -114,7 +114,7 @@ will become corrupt.
--upload-pack <upload-pack>::
-u <upload-pack>::
When given, and the repository to clone from is handled
- by 'git-fetch-pack', '--exec=<upload-pack>' is passed to
+ by `git-fetch-pack`, `--exec=<upload-pack>` is passed to
the command to specify non-default path for the command
run on the other end.
diff --git a/Documentation/git-commit-tree.txt b/Documentation/git-commit-tree.txt
index 728c2fae89..9cd8d07c8a 100644
--- a/Documentation/git-commit-tree.txt
+++ b/Documentation/git-commit-tree.txt
@@ -8,7 +8,7 @@ git-commit-tree - Create a new commit object
SYNOPSIS
--------
-'git-commit-tree' <tree> [-p <parent commit>]\* < changelog
+'git commit-tree' <tree> [-p <parent commit>]\* < changelog
DESCRIPTION
-----------
@@ -70,7 +70,7 @@ is taken from the configuration items user.name and user.email, or, if not
present, system user name and fully qualified hostname.
A commit comment is read from stdin. If a changelog
-entry is not provided via "<" redirection, "git-commit-tree" will just wait
+entry is not provided via "<" redirection, `git-commit-tree` will just wait
for one to be entered and terminated with ^D.
diff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt
index 7e8b4ff72c..03594cd5dc 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>...]
@@ -20,11 +20,11 @@ commit along with a log message describing the changes you have made.
The content to be added can be specified in several ways:
-1. by using linkgit:git-add[1] to incrementally "add" changes to the
+1. by using `git-add` to incrementally "add" changes to the
index before using the 'commit' command (Note: even modified
files must be "added");
-2. by using linkgit:git-rm[1] to remove files from the working tree
+2. by using `git-rm` to remove files from the working tree
and the index, again before using the 'commit' command;
3. by listing files as arguments to the 'commit' command, in which
@@ -41,13 +41,13 @@ The content to be added can be specified in several ways:
by one which files should be part of the commit, before finalizing the
operation. Currently, this is done by invoking `git-add --interactive`.
-The linkgit:git-status[1] command can be used to obtain a
+The `git-status` command can be used to obtain a
summary of what is included by any of the above for the next
commit by giving the same set of parameters you would give to
this command.
-If you make a commit and then found a mistake immediately after
-that, you can recover from it with linkgit:git-reset[1].
+If you make a commit and then find a mistake immediately after
+that, you can recover from it with `git-reset`.
OPTIONS
@@ -97,7 +97,7 @@ OPTIONS
-n::
--no-verify::
This option bypasses the pre-commit and commit-msg hooks.
- See also linkgit:githooks[5][hooks].
+ See also linkgit:githooks[5].
--allow-empty::
Usually recording a commit that has the exact same tree as its
@@ -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::
@@ -196,9 +205,9 @@ EXAMPLES
--------
When recording your own work, the contents of modified files in
your working tree are temporarily stored to a staging area
-called the "index" with linkgit:git-add[1]. A file can be
+called the "index" with `git-add`. A file can be
reverted back, only in the index but not in the working tree,
-to that of the last commit with `git-reset HEAD -- <file>`,
+to that of the last commit with `git reset HEAD -- <file>`,
which effectively reverts `git-add` and prevents the changes to
this file from participating in the next commit. After building
the state to be committed incrementally with these commands,
@@ -255,13 +264,13 @@ $ git commit
this second commit would record the changes to `hello.c` and
`hello.h` as expected.
-After a merge (initiated by either linkgit:git-merge[1] or
-linkgit:git-pull[1]) stops because of conflicts, cleanly merged
+After a merge (initiated by `git-merge` or `git-pull`) stops
+because of conflicts, cleanly merged
paths are already staged to be committed for you, and paths that
conflicted are left in unmerged state. You would have to first
-check which paths are conflicting with linkgit:git-status[1]
+check which paths are conflicting with `git-status`
and after fixing them manually in your working tree, you would
-stage the result as usual with linkgit:git-add[1]:
+stage the result as usual with `git-add`:
------------
$ git status | grep unmerged
@@ -307,7 +316,7 @@ order).
HOOKS
-----
This command can run `commit-msg`, `prepare-commit-msg`, `pre-commit`,
-and `post-commit` hooks. See linkgit:githooks[5][hooks] for more
+and `post-commit` hooks. See linkgit:githooks[5] for more
information.
diff --git a/Documentation/git-config.txt b/Documentation/git-config.txt
index c90421ee7f..63ddb2c2f9 100644
--- a/Documentation/git-config.txt
+++ b/Documentation/git-config.txt
@@ -9,19 +9,19 @@ git-config - Get and set repository or global options
SYNOPSIS
--------
[verse]
-'git-config' [<file-option>] [type] [-z|--null] name [value [value_regex]]
-'git-config' [<file-option>] [type] --add name value
-'git-config' [<file-option>] [type] --replace-all name [value [value_regex]]
-'git-config' [<file-option>] [type] [-z|--null] --get name [value_regex]
-'git-config' [<file-option>] [type] [-z|--null] --get-all name [value_regex]
-'git-config' [<file-option>] [type] [-z|--null] --get-regexp name_regex [value_regex]
-'git-config' [<file-option>] --unset name [value_regex]
-'git-config' [<file-option>] --unset-all name [value_regex]
-'git-config' [<file-option>] --rename-section old_name new_name
-'git-config' [<file-option>] --remove-section name
-'git-config' [<file-option>] [-z|--null] -l | --list
-'git-config' [<file-option>] --get-color name [default]
-'git-config' [<file-option>] --get-colorbool name [stdout-is-tty]
+'git config' [<file-option>] [type] [-z|--null] name [value [value_regex]]
+'git config' [<file-option>] [type] --add name value
+'git config' [<file-option>] [type] --replace-all name [value [value_regex]]
+'git config' [<file-option>] [type] [-z|--null] --get name [value_regex]
+'git config' [<file-option>] [type] [-z|--null] --get-all name [value_regex]
+'git config' [<file-option>] [type] [-z|--null] --get-regexp name_regex [value_regex]
+'git config' [<file-option>] --unset name [value_regex]
+'git config' [<file-option>] --unset-all name [value_regex]
+'git config' [<file-option>] --rename-section old_name new_name
+'git config' [<file-option>] --remove-section name
+'git config' [<file-option>] [-z|--null] -l | --list
+'git config' [<file-option>] --get-color name [default]
+'git config' [<file-option>] --get-colorbool name [stdout-is-tty]
DESCRIPTION
-----------
@@ -37,7 +37,7 @@ you want to handle the lines that do *not* match the regex, just
prepend a single exclamation mark in front (see also <<EXAMPLES>>).
The type specifier can be either '--int' or '--bool', which will make
-'git-config' ensure that the variable(s) are of the given type and
+`git-config` ensure that the variable(s) are of the given type and
convert the value to the canonical form (simple decimal number for int,
a "true" or "false" string for bool). If no type specifier is passed,
no checks or transformations are performed on the value.
@@ -122,10 +122,10 @@ See also <<FILES>>.
List all variables set in config file.
--bool::
- git-config will ensure that the output is "true" or "false"
+ `git-config` will ensure that the output is "true" or "false"
--int::
- git-config will ensure that the output is a simple
+ `git-config` will ensure that the output is a simple
decimal number. An optional value suffix of 'k', 'm', or 'g'
in the config file will cause the value to be multiplied
by 1024, 1048576, or 1073741824 prior to output.
@@ -162,7 +162,7 @@ FILES
-----
If not set explicitly with '--file', there are three files where
-git-config will search for configuration options:
+`git-config` will search for configuration options:
$GIT_DIR/config::
Repository specific configuration file. (The filename is
@@ -179,12 +179,12 @@ $(prefix)/etc/gitconfig::
If no further options are given, all reading options will read all of these
files that are available. If the global or the system-wide configuration
file are not available they will be ignored. If the repository configuration
-file is not available or readable, git-config will exit with a non-zero
+file is not available or readable, `git-config` will exit with a non-zero
error code. However, in neither case will an error message be issued.
All writing options will per default write to the repository specific
configuration file. Note that this also affects options like '--replace-all'
-and '--unset'. *git-config will only ever change one file at a time*.
+and '--unset'. *`git-config` will only ever change one file at a time*.
You can override these rules either by command line options or by environment
variables. The '--global' and the '--system' options will limit the file used
diff --git a/Documentation/git-count-objects.txt b/Documentation/git-count-objects.txt
index 1ba85a259a..c069cc8b04 100644
--- a/Documentation/git-count-objects.txt
+++ b/Documentation/git-count-objects.txt
@@ -7,7 +7,7 @@ git-count-objects - Count unpacked number of objects and their disk consumption
SYNOPSIS
--------
-'git-count-objects' [-v]
+'git count-objects' [-v]
DESCRIPTION
-----------
@@ -22,7 +22,7 @@ OPTIONS
In addition to the number of loose objects and disk
space consumed, it reports the number of in-pack
objects, number of packs, and number of objects that can be
- removed by running `git-prune-packed`.
+ removed by running `git prune-packed`.
Author
diff --git a/Documentation/git-cvsexportcommit.txt b/Documentation/git-cvsexportcommit.txt
index 5fa91e51ad..2a02ffa7c1 100644
--- a/Documentation/git-cvsexportcommit.txt
+++ b/Documentation/git-cvsexportcommit.txt
@@ -8,7 +8,8 @@ git-cvsexportcommit - Export a single commit to a CVS checkout
SYNOPSIS
--------
-'git-cvsexportcommit' [-h] [-u] [-v] [-c] [-P] [-p] [-a] [-d cvsroot] [-w cvsworkdir] [-W] [-f] [-m msgprefix] [PARENTCOMMIT] COMMITID
+'git cvsexportcommit' [-h] [-u] [-v] [-c] [-P] [-p] [-a] [-d cvsroot]
+ [-w cvsworkdir] [-W] [-f] [-m msgprefix] [PARENTCOMMIT] COMMITID
DESCRIPTION
@@ -26,8 +27,8 @@ by default.
Supports file additions, removals, and commits that affect binary files.
-If the commit is a merge commit, you must tell git-cvsexportcommit what parent
-should the changeset be done against.
+If the commit is a merge commit, you must tell `git-cvsexportcommit` what
+parent the changeset should be done against.
OPTIONS
-------
@@ -89,14 +90,14 @@ Merge one patch into CVS::
------------
$ export GIT_DIR=~/project/.git
$ cd ~/project_cvs_checkout
-$ git-cvsexportcommit -v <commit-sha1>
+$ git cvsexportcommit -v <commit-sha1>
$ cvs commit -F .msg <files>
------------
Merge one patch into CVS (-c and -w options). The working directory is within the Git Repo::
+
------------
- $ git-cvsexportcommit -v -c -w ~/project_cvs_checkout <commit-sha1>
+ $ git cvsexportcommit -v -c -w ~/project_cvs_checkout <commit-sha1>
------------
Merge pending patches into CVS automatically -- only if you really know what you are doing::
@@ -104,7 +105,7 @@ Merge pending patches into CVS automatically -- only if you really know what you
------------
$ export GIT_DIR=~/project/.git
$ cd ~/project_cvs_checkout
-$ git-cherry cvshead myhead | sed -n 's/^+ //p' | xargs -l1 git-cvsexportcommit -c -p -v
+$ git cherry cvshead myhead | sed -n 's/^+ //p' | xargs -l1 git cvsexportcommit -c -p -v
------------
Author
diff --git a/Documentation/git-cvsimport.txt b/Documentation/git-cvsimport.txt
index 2f9b35f622..ed79bb8d5b 100644
--- a/Documentation/git-cvsimport.txt
+++ b/Documentation/git-cvsimport.txt
@@ -9,7 +9,7 @@ git-cvsimport - Salvage your data out of another SCM people love to hate
SYNOPSIS
--------
[verse]
-'git-cvsimport' [-o <branch-for-HEAD>] [-h] [-v] [-d <CVSROOT>]
+'git cvsimport' [-o <branch-for-HEAD>] [-h] [-v] [-d <CVSROOT>]
[-A <author-conv-file>] [-p <options-for-cvsps>] [-P <file>]
[-C <git_repository>] [-z <fuzz>] [-i] [-k] [-u] [-s <subst>]
[-a] [-m] [-M <regex>] [-S <regex>] [-L <commitlimit>]
@@ -25,9 +25,9 @@ Splitting the CVS log into patch sets is done by 'cvsps'.
At least version 2.1 is required.
You should *never* do any work of your own on the branches that are
-created by git-cvsimport. By default initial import will create and populate a
+created by `git-cvsimport`. By default initial import will create and populate a
"master" branch from the CVS repository's main branch which you're free
-to work with; after that, you need to 'git merge' incremental imports, or
+to work with; after that, you need to `git-merge` incremental imports, or
any CVS branches, yourself. It is advisable to specify a named remote via
-r to separate and protect the incoming branches.
@@ -40,13 +40,13 @@ OPTIONS
-d <CVSROOT>::
The root of the CVS archive. May be local (a simple path) or remote;
currently, only the :local:, :ext: and :pserver: access methods
- are supported. If not given, git-cvsimport will try to read it
+ are supported. If not given, `git-cvsimport` will try to read it
from `CVS/Root`. If no such file exists, it checks for the
`CVSROOT` environment variable.
<CVS_module>::
The CVS module you want to import. Relative to <CVSROOT>.
- If not given, git-cvsimport tries to read it from
+ If not given, `git-cvsimport` tries to read it from
`CVS/Repository`.
-C <target-dir>::
@@ -56,14 +56,14 @@ OPTIONS
-r <remote>::
The git remote to import this CVS repository into.
Moves all CVS branches into remotes/<remote>/<branch>
- akin to the git-clone --use-separate-remote option.
+ akin to the `git-clone` "--use-separate-remote" option.
-o <branch-for-HEAD>::
When no remote is specified (via -r) the 'HEAD' branch
from CVS is imported to the 'origin' branch within the git
repository, as 'HEAD' already has a special meaning for git.
When a remote is specified the 'HEAD' branch is named
- remotes/<remote>/master mirroring git-clone behaviour.
+ remotes/<remote>/master mirroring `git-clone` behaviour.
Use this option if you want to import into a different
branch.
+
@@ -136,17 +136,17 @@ This option can be used several times to provide several detection regexes.
---------
+
-git-cvsimport will make it appear as those authors had
+`git-cvsimport` will make it appear as those authors had
their GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL set properly
all along.
+
For convenience, this data is saved to `$GIT_DIR/cvs-authors`
each time the '-A' option is provided and read from that same
-file each time git-cvsimport is run.
+file each time `git-cvsimport` is run.
+
It is not recommended to use this feature if you intend to
export changes back to CVS again later with
-linkgit:git-cvsexportcommit[1].
+`git-cvsexportcommit`.
-h::
Print a short usage message and exit.
diff --git a/Documentation/git-cvsserver.txt b/Documentation/git-cvsserver.txt
index 3310ae25ff..e0e35dbbb7 100644
--- a/Documentation/git-cvsserver.txt
+++ b/Documentation/git-cvsserver.txt
@@ -22,7 +22,7 @@ cvspserver stream tcp nowait nobody /usr/bin/git-cvsserver git-cvsserver pserver
Usage:
[verse]
-'git-cvsserver' [options] [pserver|server] [<directory> ...]
+'git cvsserver' [options] [pserver|server] [<directory> ...]
OPTIONS
-------
@@ -77,7 +77,7 @@ over pserver for anonymous CVS access.
CVS clients cannot tag, branch or perform GIT merges.
-git-cvsserver maps GIT branches to CVS modules. This is very different
+`git-cvsserver` maps GIT branches to CVS modules. This is very different
from what most CVS users would expect since in CVS modules usually represent
one or more directories.
@@ -103,7 +103,7 @@ looks like
------
No special setup is needed for SSH access, other than having GIT tools
in the PATH. If you have clients that do not accept the CVS_SERVER
-environment variable, you can rename git-cvsserver to cvs.
+environment variable, you can rename `git-cvsserver` to `cvs`.
Note: Newer CVS versions (>= 1.12.11) also support specifying
CVS_SERVER directly in CVSROOT like
@@ -113,9 +113,9 @@ cvs -d ":ext;CVS_SERVER=git-cvsserver:user@server/path/repo.git" co <HEAD_name>
------
This has the advantage that it will be saved in your 'CVS/Root' files and
you don't need to worry about always setting the correct environment
-variable. SSH users restricted to git-shell don't need to override the default
-with CVS_SERVER (and shouldn't) as git-shell understands `cvs` to mean
-git-cvsserver and pretends that the other end runs the real cvs better.
+variable. SSH users restricted to `git-shell` don't need to override the default
+with CVS_SERVER (and shouldn't) as `git-shell` understands `cvs` to mean
+`git-cvsserver` and pretends that the other end runs the real `cvs` better.
--
2. For each repo that you want accessible from CVS you need to edit config in
the repo and add the following section.
@@ -128,7 +128,7 @@ git-cvsserver and pretends that the other end runs the real cvs better.
logfile=/path/to/logfile
------
-Note: you need to ensure each user that is going to invoke git-cvsserver has
+Note: you need to ensure each user that is going to invoke `git-cvsserver` has
write access to the log file and to the database (see
<<dbbackend,Database Backend>>. If you want to offer write access over
SSH, the users of course also need write access to the git repository itself.
@@ -150,7 +150,7 @@ allowing access over SSH.
automatically saving it in your 'CVS/Root' files, then you need to set them
explicitly in your environment. CVSROOT should be set as per normal, but the
directory should point at the appropriate git repo. As above, for SSH clients
- _not_ restricted to git-shell, CVS_SERVER should be set to git-cvsserver.
+ _not_ restricted to `git-shell`, CVS_SERVER should be set to `git-cvsserver`.
+
--
------
@@ -178,27 +178,27 @@ allowing access over SSH.
Database Backend
----------------
-git-cvsserver uses one database per git head (i.e. CVS module) to
+`git-cvsserver` uses one database per git head (i.e. CVS module) to
store information about the repository for faster access. The
database doesn't contain any persistent data and can be completely
regenerated from the git repository at any time. The database
needs to be updated (i.e. written to) after every commit.
-If the commit is done directly by using git (as opposed to
-using git-cvsserver) the update will need to happen on the
-next repository access by git-cvsserver, independent of
+If the commit is done directly by using `git` (as opposed to
+using `git-cvsserver`) the update will need to happen on the
+next repository access by `git-cvsserver`, independent of
access method and requested operation.
That means that even if you offer only read access (e.g. by using
-the pserver method), git-cvsserver should have write access to
+the pserver method), `git-cvsserver` should have write access to
the database to work reliably (otherwise you need to make sure
-that the database is up-to-date any time git-cvsserver is executed).
+that the database is up-to-date any time `git-cvsserver` is executed).
By default it uses SQLite databases in the git directory, named
`gitcvs.<module_name>.sqlite`. Note that the SQLite backend creates
temporary files in the same directory as the database file on
write so it might not be enough to grant the users using
-git-cvsserver write access to the database file without granting
+`git-cvsserver` write access to the database file without granting
them write access to the directory, too.
You can configure the database backend with the following
@@ -207,7 +207,7 @@ configuration variables:
Configuring database backend
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-git-cvsserver uses the Perl DBI module. Please also read
+`git-cvsserver` uses the Perl DBI module. Please also read
its documentation if changing these variables, especially
about `DBI->connect()`.
@@ -259,7 +259,7 @@ In `dbdriver` and `dbuser` you can use the following variables:
%a::
access method (one of "ext" or "pserver")
%u::
- Name of the user running git-cvsserver.
+ Name of the user running `git-cvsserver`.
If no name can be determined, the
numeric uid is used.
@@ -280,13 +280,13 @@ To get a checkout with the Eclipse CVS client:
Protocol notes: If you are using anonymous access via pserver, just select that.
Those using SSH access should choose the 'ext' protocol, and configure 'ext'
access on the Preferences->Team->CVS->ExtConnection pane. Set CVS_SERVER to
-'git-cvsserver'. Note that password support is not good when using 'ext',
+`git-cvsserver`. Note that password support is not good when using 'ext',
you will definitely want to have SSH keys setup.
Alternatively, you can just use the non-standard extssh protocol that Eclipse
offer. In that case CVS_SERVER is ignored, and you will have to replace
-the cvs utility on the server with git-cvsserver or manipulate your `.bashrc`
-so that calling 'cvs' effectively calls git-cvsserver.
+the cvs utility on the server with `git-cvsserver` or manipulate your `.bashrc`
+so that calling 'cvs' effectively calls `git-cvsserver`.
Clients known to work
---------------------
@@ -328,14 +328,13 @@ is left blank. But if `gitcvs.allbinary` is set to "guess", then
the correct '-k' mode will be guessed based on the contents of
the file.
-For best consistency with cvs, it is probably best to override the
+For best consistency with `cvs`, it is probably best to override the
defaults by setting `gitcvs.usecrlfattr` to true,
and `gitcvs.allbinary` to "guess".
Dependencies
------------
-
-git-cvsserver depends on DBD::SQLite.
+`git-cvsserver` depends on DBD::SQLite.
Copyright and Authors
---------------------
diff --git a/Documentation/git-daemon.txt b/Documentation/git-daemon.txt
index 344f24ea59..3cf2d3b3d4 100644
--- a/Documentation/git-daemon.txt
+++ b/Documentation/git-daemon.txt
@@ -8,12 +8,12 @@ git-daemon - A really simple server for git repositories
SYNOPSIS
--------
[verse]
-'git-daemon' [--verbose] [--syslog] [--export-all]
- [--timeout=n] [--init-timeout=n] [--strict-paths]
- [--base-path=path] [--user-path | --user-path=path]
- [--interpolated-path=pathtemplate]
- [--reuseaddr] [--detach] [--pid-file=file]
- [--enable=service] [--disable=service]
+'git daemon' [--verbose] [--syslog] [--export-all]
+ [--timeout=n] [--init-timeout=n] [--strict-paths]
+ [--base-path=path] [--user-path | --user-path=path]
+ [--interpolated-path=pathtemplate]
+ [--reuseaddr] [--detach] [--pid-file=file]
+ [--enable=service] [--disable=service]
[--allow-override=service] [--forbid-override=service]
[--inetd | [--listen=host_or_ipaddr] [--port=n] [--user=user [--group=group]]
[directory...]
@@ -27,7 +27,7 @@ that service if it is enabled.
It verifies that the directory has the magic file "git-daemon-export-ok", and
it will refuse to export any git directory that hasn't explicitly been marked
for export this way (unless the '--export-all' parameter is specified). If you
-pass some directory paths as 'git-daemon' arguments, you can further restrict
+pass some directory paths as `git-daemon` arguments, you can further restrict
the offers to a whitelist comprising of those.
By default, only `upload-pack` service is enabled, which serves
@@ -44,12 +44,12 @@ OPTIONS
--strict-paths::
Match paths exactly (i.e. don't allow "/foo/repo" when the real path is
"/foo/repo.git" or "/foo/repo/.git") and don't do user-relative paths.
- git-daemon will refuse to start when this option is enabled and no
+ `git-daemon` will refuse to start when this option is enabled and no
whitelist is specified.
--base-path::
Remap all the path requests as relative to the given path.
- This is sort of "GIT root" - if you run git-daemon with
+ This is sort of "GIT root" - if you run `git-daemon` with
'--base-path=/srv/git' on example.com, then if you later try to pull
'git://example.com/hello.git', `git-daemon` will interpret the path
as '/srv/git/hello.git'.
@@ -199,28 +199,28 @@ $ grep 9418 /etc/services
git 9418/tcp # Git Version Control System
------------
-git-daemon as inetd server::
+`git-daemon` as inetd server::
To set up `git-daemon` as an inetd service that handles any
repository under the whitelisted set of directories, /pub/foo
and /pub/bar, place an entry like the following into
/etc/inetd all on one line:
+
------------------------------------------------
- git stream tcp nowait nobody /usr/bin/git-daemon
- git-daemon --inetd --verbose --export-all
+ git stream tcp nowait nobody /usr/bin/git
+ git daemon --inetd --verbose --export-all
/pub/foo /pub/bar
------------------------------------------------
-git-daemon as inetd server for virtual hosts::
+`git-daemon` as inetd server for virtual hosts::
To set up `git-daemon` as an inetd service that handles
repositories for different virtual hosts, `www.example.com`
and `www.example.org`, place an entry like the following into
`/etc/inetd` all on one line:
+
------------------------------------------------
- git stream tcp nowait nobody /usr/bin/git-daemon
- git-daemon --inetd --verbose --export-all
+ git stream tcp nowait nobody /usr/bin/git
+ git daemon --inetd --verbose --export-all
--interpolated-path=/pub/%H%D
/pub/www.example.org/software
/pub/www.example.com/software
@@ -235,13 +235,13 @@ clients, a symlink from `/software` into the appropriate
default repository could be made as well.
-git-daemon as regular daemon for virtual hosts::
+`git-daemon` as regular daemon for virtual hosts::
To set up `git-daemon` as a regular, non-inetd service that
handles repositories for multiple virtual hosts based on
their IP addresses, start the daemon like this:
+
------------------------------------------------
- git-daemon --verbose --export-all
+ git daemon --verbose --export-all
--interpolated-path=/pub/%IP/%D
/pub/192.168.1.200/software
/pub/10.10.220.23/software
diff --git a/Documentation/git-describe.txt b/Documentation/git-describe.txt
index 9f6f483186..51a0cc044f 100644
--- a/Documentation/git-describe.txt
+++ b/Documentation/git-describe.txt
@@ -8,7 +8,7 @@ git-describe - Show the most recent tag that is reachable from a commit
SYNOPSIS
--------
-'git-describe' [--all] [--tags] [--contains] [--abbrev=<n>] <committish>...
+'git describe' [--all] [--tags] [--contains] [--abbrev=<n>] <committish>...
DESCRIPTION
-----------
@@ -78,7 +78,7 @@ EXAMPLES
With something like git.git current tree, I get:
- [torvalds@g5 git]$ git-describe parent
+ [torvalds@g5 git]$ git describe parent
v1.0.4-14-g2414721
i.e. the current head of my "parent" branch is based on v1.0.4,
@@ -92,9 +92,9 @@ of commits which would be displayed by "git log v1.0.4..parent".
The hash suffix is "-g" + 7-char abbreviation for the tip commit
of parent (which was `2414721b194453f058079d897d13c4e377f92dc6`).
-Doing a "git-describe" on a tag-name will just show the tag name:
+Doing a `git-describe` on a tag-name will just show the tag name:
- [torvalds@g5 git]$ git-describe v1.0.4
+ [torvalds@g5 git]$ git describe v1.0.4
v1.0.4
With --all, the command can use branch heads as references, so
@@ -115,13 +115,13 @@ closest tagname without any suffix:
SEARCH STRATEGY
---------------
-For each committish supplied "git describe" will first look for
+For each committish supplied, `git-describe` will first look for
a tag which tags exactly that commit. Annotated tags will always
be preferred over lightweight tags, and tags with newer dates will
always be preferred over tags with older dates. If an exact match
is found, its name will be output and searching will stop.
-If an exact match was not found "git describe" will walk back
+If an exact match was not found, `git-describe` will walk back
through the commit history to locate an ancestor commit which
has been tagged. The ancestor's tag will be output along with an
abbreviation of the input committish's SHA1.
@@ -129,7 +129,7 @@ abbreviation of the input committish's SHA1.
If multiple tags were found during the walk then the tag which
has the fewest commits different from the input committish will be
selected and output. Here fewest commits different is defined as
-the number of commits which would be shown by "git log tag..input"
+the number of commits which would be shown by `git log tag..input`
will be the smallest number of commits possible.
diff --git a/Documentation/git-diff-files.txt b/Documentation/git-diff-files.txt
index 8a64869d27..6c65757eae 100644
--- a/Documentation/git-diff-files.txt
+++ b/Documentation/git-diff-files.txt
@@ -8,14 +8,14 @@ git-diff-files - Compares files in the working tree and the index
SYNOPSIS
--------
-'git-diff-files' [-q] [-0|-1|-2|-3|-c|--cc] [<common diff options>] [<path>...]
+'git diff-files' [-q] [-0|-1|-2|-3|-c|--cc] [<common diff options>] [<path>...]
DESCRIPTION
-----------
Compares the files in the working tree and the index. When paths
are specified, compares only those named paths. Otherwise all
entries in the index are compared. The output format is the
-same as "git-diff-index" and "git-diff-tree".
+same as for `git-diff-index` and `git-diff-tree`.
OPTIONS
-------
diff --git a/Documentation/git-diff-index.txt b/Documentation/git-diff-index.txt
index f6e844fe61..784bbf3b0d 100644
--- a/Documentation/git-diff-index.txt
+++ b/Documentation/git-diff-index.txt
@@ -8,7 +8,7 @@ git-diff-index - Compares content and mode of blobs between the index and reposi
SYNOPSIS
--------
-'git-diff-index' [-m] [--cached] [<common diff options>] <tree-ish> [<path>...]
+'git diff-index' [-m] [--cached] [<common diff options>] <tree-ish> [<path>...]
DESCRIPTION
-----------
@@ -31,7 +31,7 @@ include::diff-options.txt[]
-m::
By default, files recorded in the index but not checked
out are reported as deleted. This flag makes
- "git-diff-index" say that all non-checked-out files are up
+ `git-diff-index` say that all non-checked-out files are up
to date.
Output format
@@ -50,31 +50,31 @@ Cached Mode
If '--cached' is specified, it allows you to ask:
show me the differences between HEAD and the current index
- contents (the ones I'd write with a "git-write-tree")
+ contents (the ones I'd write using `git-write-tree`)
For example, let's say that you have worked on your working directory, updated
some files in the index and are ready to commit. You want to see exactly
*what* you are going to commit, without having to write a new tree
object and compare it that way, and to do that, you just do
- git-diff-index --cached HEAD
+ git diff-index --cached HEAD
Example: let's say I had renamed `commit.c` to `git-commit.c`, and I had
-done an "git-update-index" to make that effective in the index file.
-"git-diff-files" wouldn't show anything at all, since the index file
-matches my working directory. But doing a "git-diff-index" does:
+done an `update-index` to make that effective in the index file.
+`git diff-files` wouldn't show anything at all, since the index file
+matches my working directory. But doing a `git-diff-index` does:
- torvalds@ppc970:~/git> git-diff-index --cached HEAD
+ torvalds@ppc970:~/git> git diff-index --cached HEAD
-100644 blob 4161aecc6700a2eb579e842af0b7f22b98443f74 commit.c
+100644 blob 4161aecc6700a2eb579e842af0b7f22b98443f74 git-commit.c
You can see easily that the above is a rename.
-In fact, "git-diff-index --cached" *should* always be entirely equivalent to
-actually doing a "git-write-tree" and comparing that. Except this one is much
+In fact, `git diff-index --cached` *should* always be entirely equivalent to
+actually doing a `git-write-tree` and comparing that. Except this one is much
nicer for the case where you just want to check where you are.
-So doing a "git-diff-index --cached" is basically very useful when you are
+So doing a `git-diff-index --cached` is basically very useful when you are
asking yourself "what have I already marked for being committed, and
what's the difference to a previous tree".
@@ -82,23 +82,23 @@ Non-cached Mode
---------------
The "non-cached" mode takes a different approach, and is potentially
the more useful of the two in that what it does can't be emulated with
-a "git-write-tree" + "git-diff-tree". Thus that's the default mode.
+a `git-write-tree` + `git-diff-tree`. Thus that's the default mode.
The non-cached version asks the question:
show me the differences between HEAD and the currently checked out
tree - index contents _and_ files that aren't up-to-date
which is obviously a very useful question too, since that tells you what
-you *could* commit. Again, the output matches the "git-diff-tree -r"
+you *could* commit. Again, the output matches the `git-diff-tree -r`
output to a tee, but with a twist.
The twist is that if some file doesn't match the index, we don't have
a backing store thing for it, and we use the magic "all-zero" sha1 to
show that. So let's say that you have edited `kernel/sched.c`, but
-have not actually done a "git-update-index" on it yet - there is no
+have not actually done a `git-update-index` on it yet - there is no
"object" associated with the new state, and you get:
- torvalds@ppc970:~/v2.6/linux> git-diff-index HEAD
+ torvalds@ppc970:~/v2.6/linux> git diff-index HEAD
*100644->100664 blob 7476bb......->000000...... kernel/sched.c
i.e., it shows that the tree has changed, and that `kernel/sched.c` has is
@@ -106,11 +106,11 @@ not up-to-date and may contain new stuff. The all-zero sha1 means that to
get the real diff, you need to look at the object in the working directory
directly rather than do an object-to-object diff.
-NOTE: As with other commands of this type, "git-diff-index" does not
+NOTE: As with other commands of this type, `git-diff-index` does not
actually look at the contents of the file at all. So maybe
`kernel/sched.c` hasn't actually changed, and it's just that you
touched it. In either case, it's a note that you need to
-"git-update-index" it to make the index be in sync.
+`git-update-index` it to make the index be in sync.
NOTE: You can have a mixture of files show up as "has been updated"
and "is still dirty in the working directory" together. You can always
diff --git a/Documentation/git-diff-tree.txt b/Documentation/git-diff-tree.txt
index 56caeb2d26..68feb08172 100644
--- a/Documentation/git-diff-tree.txt
+++ b/Documentation/git-diff-tree.txt
@@ -9,7 +9,7 @@ git-diff-tree - Compares the content and mode of blobs found via two tree object
SYNOPSIS
--------
[verse]
-'git-diff-tree' [--stdin] [-m] [-s] [-v] [--no-commit-id] [--pretty]
+'git diff-tree' [--stdin] [-m] [-s] [-v] [--no-commit-id] [--pretty]
[-t] [-r] [-c | --cc] [--root] [<common diff options>]
<tree-ish> [<tree-ish>] [<path>...]
@@ -20,7 +20,7 @@ Compares the content and mode of the blobs found via two tree objects.
If there is only one <tree-ish> given, the commit is compared with its parents
(see --stdin below).
-Note that "git-diff-tree" can use the tree encapsulated in a commit object.
+Note that `git-diff-tree` can use the tree encapsulated in a commit object.
OPTIONS
-------
@@ -58,25 +58,25 @@ behavior. This does not apply to the case where two <tree-ish>
separated with a single space are given.
-m::
- By default, "git-diff-tree --stdin" does not show
+ By default, `git-diff-tree --stdin` does not show
differences for merge commits. With this flag, it shows
differences to that commit from all of its parents. See
also '-c'.
-s::
- By default, "git-diff-tree --stdin" shows differences,
+ By default, `git-diff-tree --stdin` shows differences,
either in machine-readable form (without '-p') or in patch
form (with '-p'). This output can be suppressed. It is
only useful with '-v' flag.
-v::
- This flag causes "git-diff-tree --stdin" to also show
+ This flag causes `git-diff-tree --stdin` to also show
the commit message before the differences.
include::pretty-options.txt[]
--no-commit-id::
- git-diff-tree outputs a line with the commit ID when
+ `git-diff-tree` outputs a line with the commit ID when
applicable. This flag suppressed the commit ID output.
-c::
@@ -112,13 +112,13 @@ Limiting Output
If you're only interested in differences in a subset of files, for
example some architecture-specific files, you might do:
- git-diff-tree -r <tree-ish> <tree-ish> arch/ia64 include/asm-ia64
+ git diff-tree -r <tree-ish> <tree-ish> arch/ia64 include/asm-ia64
and it will only show you what changed in those two directories.
Or if you are searching for what changed in just `kernel/sched.c`, just do
- git-diff-tree -r <tree-ish> <tree-ish> kernel/sched.c
+ git diff-tree -r <tree-ish> <tree-ish> kernel/sched.c
and it will ignore all differences to other files.
@@ -129,7 +129,7 @@ so it can be used to name subdirectories.
An example of normal usage is:
- torvalds@ppc970:~/git> git-diff-tree 5319e4......
+ torvalds@ppc970:~/git> git diff-tree 5319e4......
*100664->100664 blob ac348b.......->a01513....... git-fsck-objects.c
which tells you that the last commit changed just one file (it's from
diff --git a/Documentation/git-diff.txt b/Documentation/git-diff.txt
index 7acd428964..c53eba557d 100644
--- a/Documentation/git-diff.txt
+++ b/Documentation/git-diff.txt
@@ -8,14 +8,14 @@ git-diff - Show changes between commits, commit and working tree, etc
SYNOPSIS
--------
-'git-diff' [<common diff options>] <commit>{0,2} [--] [<path>...]
+'git diff' [<common diff options>] <commit>{0,2} [--] [<path>...]
DESCRIPTION
-----------
Show changes between two trees, a tree and the working tree, a
tree and the index file, or the index file and the working tree.
-'git-diff' [--options] [--] [<path>...]::
+'git diff' [--options] [--] [<path>...]::
This form is to view the changes you made relative to
the index (staging area for the next commit). In other
@@ -27,14 +27,14 @@ If exactly two paths are given, and at least one is untracked,
compare the two files / directories. This behavior can be
forced by --no-index.
-'git-diff' [--options] --cached [<commit>] [--] [<path>...]::
+'git diff' [--options] --cached [<commit>] [--] [<path>...]::
This form is to view the changes you staged for the next
commit relative to the named <commit>. Typically you
would want comparison with the latest commit, so if you
do not give <commit>, it defaults to HEAD.
-'git-diff' [--options] <commit> [--] [<path>...]::
+'git diff' [--options] <commit> [--] [<path>...]::
This form is to view the changes you have in your
working tree relative to the named <commit>. You can
@@ -42,23 +42,23 @@ forced by --no-index.
branch name to compare with the tip of a different
branch.
-'git-diff' [--options] <commit> <commit> [--] [<path>...]::
+'git diff' [--options] <commit> <commit> [--] [<path>...]::
This is to view the changes between two arbitrary
<commit>.
-'git-diff' [--options] <commit>..<commit> [--] [<path>...]::
+'git diff' [--options] <commit>..<commit> [--] [<path>...]::
This is synonymous to the previous form. If <commit> on
one side is omitted, it will have the same effect as
using HEAD instead.
-'git-diff' [--options] <commit>\...<commit> [--] [<path>...]::
+'git diff' [--options] <commit>\...<commit> [--] [<path>...]::
This form is to view the changes on the branch containing
and up to the second <commit>, starting at a common ancestor
- of both <commit>. "git-diff A\...B" is equivalent to
- "git-diff $(git-merge-base A B) B". You can omit any one
+ of both <commit>. "git diff A\...B" is equivalent to
+ "git diff $(git-merge-base A B) B". You can omit any one
of <commit>, which has the same effect as using HEAD instead.
Just in case if you are doing something exotic, it should be
diff --git a/Documentation/git-fast-export.txt b/Documentation/git-fast-export.txt
index 332346cc5d..dbc2b190ed 100644
--- a/Documentation/git-fast-export.txt
+++ b/Documentation/git-fast-export.txt
@@ -8,23 +8,23 @@ git-fast-export - Git data exporter
SYNOPSIS
--------
-'git-fast-export [options]' | 'git-fast-import'
+'git fast-export [options]' | 'git fast-import'
DESCRIPTION
-----------
This program dumps the given revisions in a form suitable to be piped
-into linkgit:git-fast-import[1].
+into `git-fast-import`.
You can use it as a human readable bundle replacement (see
linkgit:git-bundle[1]), or as a kind of an interactive
-linkgit:git-filter-branch[1].
+`git-filter-branch`.
OPTIONS
-------
--progress=<n>::
Insert 'progress' statements every <n> objects, to be shown by
- linkgit:git-fast-import[1] during import.
+ `git-fast-import` during import.
--signed-tags=(verbatim|warn|strip|abort)::
Specify how to handle signed tags. Since any transformation
@@ -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
--------
@@ -65,7 +85,7 @@ referenced by that revision range contains the string
Limitations
-----------
-Since linkgit:git-fast-import[1] cannot tag trees, you will not be
+Since `git-fast-import` cannot tag trees, you will not be
able to export the linux-2.6.git repository completely, as it contains
a tag referencing a tree instead of a commit.
diff --git a/Documentation/git-fast-import.txt b/Documentation/git-fast-import.txt
index 395c055f95..70cc8e831f 100644
--- a/Documentation/git-fast-import.txt
+++ b/Documentation/git-fast-import.txt
@@ -8,14 +8,14 @@ git-fast-import - Backend for fast Git data importers
SYNOPSIS
--------
-frontend | 'git-fast-import' [options]
+frontend | 'git fast-import' [options]
DESCRIPTION
-----------
This program is usually not what the end user wants to run directly.
Most end users want to use one of the existing frontend programs,
which parses a specific type of foreign source and feeds the contents
-stored there to git-fast-import.
+stored there to `git-fast-import`.
fast-import reads a mixed command/data stream from standard input and
writes one or more packfiles directly into the current repository.
@@ -24,7 +24,7 @@ updated branch and tag refs, fully updating the current repository
with the newly imported data.
The fast-import backend itself can import into an empty repository (one that
-has already been initialized by linkgit:git-init[1]) or incrementally
+has already been initialized by `git-init`) or incrementally
update an existing populated repository. Whether or not incremental
imports are supported from a particular foreign source depends on
the frontend program in use.
@@ -82,7 +82,7 @@ OPTIONS
This information may be useful after importing projects
whose total object set exceeds the 4 GiB packfile limit,
as these commits can be used as edge points during calls
- to linkgit:git-pack-objects[1].
+ to `git-pack-objects`.
--quiet::
Disable all non-fatal output, making fast-import silent when it
@@ -126,7 +126,7 @@ Parallel Operation
------------------
Like `git-push` or `git-fetch`, imports handled by fast-import are safe to
run alongside parallel `git repack -a -d` or `git gc` invocations,
-or any other Git operation (including `git prune`, as loose objects
+or any other Git operation (including `git-prune`, as loose objects
are never used by fast-import).
fast-import does not lock the branch or tag refs it is actively importing.
@@ -220,7 +220,7 @@ variation in formatting will cause fast-import to reject the value.
+
An example value is ``Tue Feb 6 11:22:18 2007 -0500''. The Git
parser is accurate, but a little on the lenient side. It is the
-same parser used by linkgit:git-am[1] when applying patches
+same parser used by `git-am` when applying patches
received from email.
+
Some malformed strings may be accepted as valid dates. In some of
@@ -256,7 +256,7 @@ timezone.
This particular format is supplied as its short to implement and
may be useful to a process that wants to create a new commit
right now, without needing to use a working directory or
-linkgit:git-update-index[1].
+`git-update-index`.
+
If separate `author` and `committer` commands are used in a `commit`
the timestamps may not match, as the system clock will be polled
@@ -654,7 +654,7 @@ recommended, as the frontend does not (easily) have access to the
complete set of bytes which normally goes into such a signature.
If signing is required, create lightweight tags from within fast-import with
`reset`, then create the annotated versions of those tags offline
-with the standard linkgit:git-tag[1] process.
+with the standard `git-tag` process.
`reset`
~~~~~~~
@@ -803,7 +803,7 @@ Callers may wish to process the output through a tool such as sed to
remove the leading part of the line, for example:
====
- frontend | git-fast-import | sed 's/^progress //'
+ frontend | git fast-import | sed 's/^progress //'
====
Placing a `progress` command immediately after a `checkpoint` will
@@ -851,7 +851,7 @@ An example crash:
M 777 inline bob
END_OF_INPUT
- $ git-fast-import <in
+ $ git fast-import <in
fatal: Corrupt mode: M 777 inline bob
fast-import: dumping crash report to .git/fast_import_crash_8434
@@ -955,7 +955,7 @@ is not `refs/heads/TAG_FIXUP`).
When committing fixups, consider using `merge` to connect the
commit(s) which are supplying file revisions to the fixup branch.
-Doing so will allow tools such as linkgit:git-blame[1] to track
+Doing so will allow tools such as `git-blame` to track
through the real commit history and properly annotate the source
files.
@@ -984,7 +984,7 @@ Repacking Historical Data
~~~~~~~~~~~~~~~~~~~~~~~~~
If you are repacking very old imported data (e.g. older than the
last year), consider expending some extra CPU time and supplying
-\--window=50 (or higher) when you run linkgit:git-repack[1].
+\--window=50 (or higher) when you run `git-repack`.
This will take longer, but will also produce a smaller packfile.
You only need to expend the effort once, and everyone using your
project will benefit from the smaller repository.
diff --git a/Documentation/git-fetch-pack.txt b/Documentation/git-fetch-pack.txt
index 282fcaf17f..a069f8d9a9 100644
--- a/Documentation/git-fetch-pack.txt
+++ b/Documentation/git-fetch-pack.txt
@@ -8,18 +8,18 @@ git-fetch-pack - Receive missing objects from another repository
SYNOPSIS
--------
-'git-fetch-pack' [--all] [--quiet|-q] [--keep|-k] [--thin] [--include-tag] [--upload-pack=<git-upload-pack>] [--depth=<n>] [--no-progress] [-v] [<host>:]<directory> [<refs>...]
+'git fetch-pack' [--all] [--quiet|-q] [--keep|-k] [--thin] [--include-tag] [--upload-pack=<git-upload-pack>] [--depth=<n>] [--no-progress] [-v] [<host>:]<directory> [<refs>...]
DESCRIPTION
-----------
-Usually you would want to use linkgit:git-fetch[1] which is a
-higher level wrapper of this command instead.
+Usually you would want to use `git-fetch`, which is a
+higher level wrapper of this command, instead.
-Invokes 'git-upload-pack' on a potentially remote repository,
+Invokes `git-upload-pack` on a possibly remote repository
and asks it to send objects missing from this repository, to
update the named heads. The list of commits available locally
is found out by scanning local $GIT_DIR/refs/ and sent to
-'git-upload-pack' running on the other end.
+`git-upload-pack` running on the other end.
This command degenerates to download everything to complete the
asked refs from the remote side when the local side does not
@@ -33,12 +33,12 @@ OPTIONS
-q::
--quiet::
- Pass '-q' flag to 'git-unpack-objects'; this makes the
+ Pass '-q' flag to `git-unpack-objects`; this makes the
cloning process less verbose.
-k::
--keep::
- Do not invoke 'git-unpack-objects' on received data, but
+ Do not invoke `git-unpack-objects` on received data, but
create a single packfile out of it instead, and store it
in the object database. If provided twice then the pack is
locked against repacking.
@@ -54,7 +54,7 @@ OPTIONS
otherwise determine the tags this option made available.
--upload-pack=<git-upload-pack>::
- Use this to specify the path to 'git-upload-pack' on the
+ Use this to specify the path to `git-upload-pack` on the
remote side, if is not found on your $PATH.
Installations of sshd ignores the user's environment
setup scripts for login shells (e.g. .bash_profile) and
@@ -79,7 +79,7 @@ OPTIONS
<host>::
A remote host that houses the repository. When this
- part is specified, 'git-upload-pack' is invoked via
+ part is specified, `git-upload-pack` is invoked via
ssh.
<directory>::
diff --git a/Documentation/git-fetch.txt b/Documentation/git-fetch.txt
index 489b2b17e6..b225566414 100644
--- a/Documentation/git-fetch.txt
+++ b/Documentation/git-fetch.txt
@@ -8,7 +8,7 @@ git-fetch - Download objects and refs from another repository
SYNOPSIS
--------
-'git-fetch' <options> <repository> <refspec>...
+'git fetch' <options> <repository> <refspec>...
DESCRIPTION
@@ -18,7 +18,7 @@ the objects necessary to complete them.
The ref names and their object names of fetched refs are stored
in `.git/FETCH_HEAD`. This information is left for a later merge
-operation done by "git merge".
+operation done by `git-merge`.
When <refspec> stores the fetched result in tracking branches,
the tags that point at these branches are automatically
diff --git a/Documentation/git-filter-branch.txt b/Documentation/git-filter-branch.txt
index ea77f1fce5..a9388e0e27 100644
--- a/Documentation/git-filter-branch.txt
+++ b/Documentation/git-filter-branch.txt
@@ -8,7 +8,7 @@ git-filter-branch - Rewrite branches
SYNOPSIS
--------
[verse]
-'git-filter-branch' [--env-filter <command>] [--tree-filter <command>]
+'git filter-branch' [--env-filter <command>] [--tree-filter <command>]
[--index-filter <command>] [--parent-filter <command>]
[--msg-filter <command>] [--commit-filter <command>]
[--tag-name-filter <command>] [--subdirectory-filter <directory>]
@@ -95,7 +95,7 @@ OPTIONS
This is the filter for rewriting the commit's parent list.
It will receive the parent string on stdin and shall output
the new parent string on stdout. The parent string is in
- a format accepted by linkgit:git-commit-tree[1]: empty for
+ the format described in linkgit:git-commit-tree[1]: empty for
the initial commit, "-p parent" for a normal commit and
"-p parent1 -p parent2 -p parent3 ..." for a merge commit.
@@ -108,7 +108,7 @@ OPTIONS
--commit-filter <command>::
This is the filter for performing the commit.
If this filter is specified, it will be called instead of the
- linkgit:git-commit-tree[1] command, with arguments of the form
+ `git-commit-tree` command, with arguments of the form
"<TREE_ID> [-p <PARENT_COMMIT_ID>]..." and the log message on
stdin. The commit id is expected on stdout.
+
@@ -119,7 +119,7 @@ have all of them as parents.
You can use the 'map' convenience function in this filter, and other
convenience functions, too. For example, calling 'skip_commit "$@"'
will leave out the current commit (but not its changes! If you want
-that, use linkgit:git-rebase[1] instead).
+that, use `git-rebase` instead).
--tag-name-filter <command>::
This is the filter for rewriting tag names. When passed,
@@ -169,7 +169,7 @@ to other tags will be rewritten to point to the underlying commit.
<rev-list-options>::
When options are given after the new branch name, they will
- be passed to linkgit:git-rev-list[1]. Only commits in the resulting
+ be passed to `git-rev-list`. Only commits in the resulting
output will be filtered, although the filtered commits can still
reference parents which are outside of that set.
@@ -266,13 +266,13 @@ git filter-branch --msg-filter '
To restrict rewriting to only part of the history, specify a revision
range in addition to the new branch name. The new branch name will
-point to the top-most revision that a 'git rev-list' of this range
+point to the top-most revision that a `git-rev-list` of this range
will print.
*NOTE* the changes introduced by the commits, and which are not reverted
by subsequent commits, will still be in the rewritten branch. If you want
to throw out _changes_ together with the commits, you should use the
-interactive mode of linkgit:git-rebase[1].
+interactive mode of `git-rebase`.
Consider this history:
diff --git a/Documentation/git-fmt-merge-msg.txt b/Documentation/git-fmt-merge-msg.txt
index 2a7cfb980b..ddb89f8d60 100644
--- a/Documentation/git-fmt-merge-msg.txt
+++ b/Documentation/git-fmt-merge-msg.txt
@@ -9,8 +9,8 @@ git-fmt-merge-msg - Produce a merge commit message
SYNOPSIS
--------
[verse]
-git-fmt-merge-msg [--log | --no-log] <$GIT_DIR/FETCH_HEAD
-git-fmt-merge-msg [--log | --no-log] -F <file>
+'git fmt-merge-msg' [--log | --no-log] <$GIT_DIR/FETCH_HEAD
+'git fmt-merge-msg' [--log | --no-log] -F <file>
DESCRIPTION
-----------
diff --git a/Documentation/git-for-each-ref.txt b/Documentation/git-for-each-ref.txt
index b347bfbb14..29c29f8830 100644
--- a/Documentation/git-for-each-ref.txt
+++ b/Documentation/git-for-each-ref.txt
@@ -8,7 +8,7 @@ git-for-each-ref - Output information on each ref
SYNOPSIS
--------
[verse]
-'git-for-each-ref' [--count=<count>] [--shell|--perl|--python|--tcl]
+'git for-each-ref' [--count=<count>] [--shell|--perl|--python|--tcl]
[--sort=<key>]\* [--format=<format>] [<pattern>...]
DESCRIPTION
@@ -119,7 +119,7 @@ An example directly producing formatted text. Show the most recent
------------
#!/bin/sh
-git-for-each-ref --count=3 --sort='-*authordate' \
+git for-each-ref --count=3 --sort='-*authordate' \
--format='From: %(*authorname) %(*authoremail)
Subject: %(*subject)
Date: %(*authordate)
@@ -135,7 +135,7 @@ demonstrating the use of --shell. List the prefixes of all heads::
------------
#!/bin/sh
-git-for-each-ref --shell --format="ref=%(refname)" refs/heads | \
+git for-each-ref --shell --format="ref=%(refname)" refs/heads | \
while read entry
do
eval "$entry"
@@ -189,7 +189,7 @@ Its message reads as:
fi
'
-eval=`git-for-each-ref --shell --format="$fmt" \
+eval=`git for-each-ref --shell --format="$fmt" \
--sort='*objecttype' \
--sort=-taggerdate \
refs/tags`
diff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt
index 4dafa39a92..894b82d6be 100644
--- a/Documentation/git-format-patch.txt
+++ b/Documentation/git-format-patch.txt
@@ -9,7 +9,7 @@ git-format-patch - Prepare patches for e-mail submission
SYNOPSIS
--------
[verse]
-'git-format-patch' [-k] [-o <dir> | --stdout] [--thread]
+'git format-patch' [-k] [-o <dir> | --stdout] [--thread]
[--attach[=<boundary>] | --inline[=<boundary>]]
[-s | --signoff] [<common diff options>]
[-n | --numbered | -N | --no-numbered]
@@ -27,7 +27,7 @@ DESCRIPTION
Prepare each commit with its patch in
one file per commit, formatted to resemble UNIX mailbox format.
The output of this command is convenient for e-mail submission or
-for use with linkgit:git-am[1].
+for use with `git-am`.
There are two ways to specify which commits to operate on.
@@ -61,7 +61,7 @@ they are created in the current working directory.
If -n is specified, instead of "[PATCH] Subject", the first line
is formatted as "[PATCH n/m] Subject".
-If given --thread, git-format-patch will generate In-Reply-To and
+If given --thread, `git-format-patch` will generate In-Reply-To and
References headers to make the second and subsequent patch mails appear
as replies to the first mail; this also generates a Message-Id header to
reference.
diff --git a/Documentation/git-fsck-objects.txt b/Documentation/git-fsck-objects.txt
index 6e9f717642..965a8279c1 100644
--- a/Documentation/git-fsck-objects.txt
+++ b/Documentation/git-fsck-objects.txt
@@ -8,7 +8,7 @@ git-fsck-objects - Verifies the connectivity and validity of the objects in the
SYNOPSIS
--------
-'git-fsck-objects' ...
+'git fsck-objects' ...
DESCRIPTION
-----------
diff --git a/Documentation/git-fsck.txt b/Documentation/git-fsck.txt
index 9846c859cf..ef4ceb3dfd 100644
--- a/Documentation/git-fsck.txt
+++ b/Documentation/git-fsck.txt
@@ -9,7 +9,7 @@ git-fsck - Verifies the connectivity and validity of the objects in the database
SYNOPSIS
--------
[verse]
-'git-fsck' [--tags] [--root] [--unreachable] [--cache] [--no-reflogs]
+'git fsck' [--tags] [--root] [--unreachable] [--cache] [--no-reflogs]
[--full] [--strict] [--verbose] [--lost-found] [<object>*]
DESCRIPTION
@@ -21,7 +21,7 @@ OPTIONS
<object>::
An object to treat as the head of an unreachability trace.
+
-If no objects are given, git-fsck defaults to using the
+If no objects are given, `git-fsck` defaults to using the
index file, all SHA1 references in .git/refs/*, and all reflogs (unless
--no-reflogs is given) as heads.
@@ -79,15 +79,15 @@ that aren't readable from any of the specified head nodes.
So for example
- git-fsck --unreachable HEAD $(cat .git/refs/heads/*)
+ git fsck --unreachable HEAD $(cat .git/refs/heads/*)
will do quite a _lot_ of verification on the tree. There are a few
extra validity tests to be added (make sure that tree objects are
-sorted properly etc), but on the whole if "git-fsck" is happy, you
+sorted properly etc), but on the whole if `git-fsck` is happy, you
do have a valid tree.
Any corrupt objects you will have to find in backups or other archives
-(i.e., you can just remove them and do an "rsync" with some other site in
+(i.e., you can just remove them and do an `rsync` with some other site in
the hopes that somebody else has the object you have corrupted).
Of course, "valid tree" doesn't mean that it wasn't generated by some
diff --git a/Documentation/git-gc.txt b/Documentation/git-gc.txt
index 6ace615d80..0cce3894cb 100644
--- a/Documentation/git-gc.txt
+++ b/Documentation/git-gc.txt
@@ -8,14 +8,14 @@ git-gc - Cleanup unnecessary files and optimize the local repository
SYNOPSIS
--------
-'git-gc' [--aggressive] [--auto] [--quiet]
+'git gc' [--aggressive] [--auto] [--quiet]
DESCRIPTION
-----------
Runs a number of housekeeping tasks within the current repository,
such as compressing file revisions (to reduce disk space and increase
performance) and removing unreachable objects which may have been
-created from prior invocations of linkgit:git-add[1].
+created from prior invocations of `git-add`.
Users are encouraged to run this task on a regular basis within
each repository to maintain good disk space utilization and good
@@ -33,15 +33,15 @@ OPTIONS
-------
--aggressive::
- Usually 'git-gc' runs very quickly while providing good disk
+ Usually `git-gc` runs very quickly while providing good disk
space utilization and performance. This option will cause
- git-gc to more aggressively optimize the repository at the expense
+ `git-gc` to more aggressively optimize the repository at the expense
of taking much more time. The effects of this optimization are
persistent, so this option only needs to be used occasionally; every
few hundred changesets or so.
--auto::
- With this option, `git gc` checks whether any housekeeping is
+ With this option, `git-gc` checks whether any housekeeping is
required; if not, it exits without performing any work.
Some git commands run `git gc --auto` after performing
operations that could create many loose objects.
@@ -89,7 +89,7 @@ how long records of conflicted merge you have not resolved are
kept. This defaults to 15 days.
The optional configuration variable 'gc.packrefs' determines if
-`git gc` runs `git-pack-refs`. This can be set to "nobare" to enable
+`git-gc` runs `git-pack-refs`. This can be set to "nobare" to enable
it within all non-bare repos or it can be set to a boolean value.
This defaults to true.
@@ -108,10 +108,10 @@ default is "2 weeks ago".
Notes
-----
-git-gc tries very hard to be safe about the garbage it collects. In
+`git-gc` tries very hard to be safe about the garbage it collects. In
particular, it will keep not only objects referenced by your current set
of branches and tags, but also objects referenced by the index, remote
-tracking branches, refs saved by linkgit:git-filter-branch[1] in
+tracking branches, refs saved by `git-filter-branch` in
refs/original/, or reflogs (which may references commits in branches
that were later amended or rewound).
diff --git a/Documentation/git-get-tar-commit-id.txt b/Documentation/git-get-tar-commit-id.txt
index c13bf98697..50dfdfa19b 100644
--- a/Documentation/git-get-tar-commit-id.txt
+++ b/Documentation/git-get-tar-commit-id.txt
@@ -8,18 +8,18 @@ git-get-tar-commit-id - Extract commit ID from an archive created using git-arch
SYNOPSIS
--------
-'git-get-tar-commit-id' < <tarfile>
+'git get-tar-commit-id' < <tarfile>
DESCRIPTION
-----------
Acts as a filter, extracting the commit ID stored in archives created by
-linkgit:git-archive[1]. It reads only the first 1024 bytes of input, thus its
+`git-archive`. It reads only the first 1024 bytes of input, thus its
runtime is not influenced by the size of <tarfile> very much.
-If no commit ID is found, git-get-tar-commit-id quietly exists with a
+If no commit ID is found, `git-get-tar-commit-id` quietly exists with a
return code of 1. This can happen if <tarfile> had not been created
-using git-archive or if the first parameter of git-archive had been
+using `git-archive` or if the first parameter of `git-archive` had been
a tree ID instead of a commit ID or tag.
diff --git a/Documentation/git-grep.txt b/Documentation/git-grep.txt
index 1b646b73f0..25cb64957c 100644
--- a/Documentation/git-grep.txt
+++ b/Documentation/git-grep.txt
@@ -9,7 +9,7 @@ git-grep - Print lines matching a pattern
SYNOPSIS
--------
[verse]
-'git-grep' [--cached]
+'git grep' [--cached]
[-a | --text] [-I] [-i | --ignore-case] [-w | --word-regexp]
[-v | --invert-match] [-h|-H] [--full-name]
[-E | --extended-regexp] [-G | --basic-regexp]
@@ -91,7 +91,7 @@ OPTIONS
--files-without-match::
Instead of showing every matched line, show only the
names of files that contain (or do not contain) matches.
- For better compatibility with git-diff, --name-only is a
+ For better compatibility with `git-diff`, --name-only is a
synonym for --files-with-matches.
-c::
diff --git a/Documentation/git-gui.txt b/Documentation/git-gui.txt
index 105397f2bd..940e43f37e 100644
--- a/Documentation/git-gui.txt
+++ b/Documentation/git-gui.txt
@@ -11,19 +11,19 @@ SYNOPSIS
DESCRIPTION
-----------
-A Tcl/Tk based graphical user interface to Git. git-gui focuses
+A Tcl/Tk based graphical user interface to Git. `git-gui` focuses
on allowing users to make changes to their repository by making
new commits, amending existing ones, creating branches, performing
local merges, and fetching/pushing to remote repositories.
-Unlike linkgit:gitk[1], git-gui focuses on commit generation
-and single file annotation, and does not show project history.
-It does however supply menu actions to start a gitk session from
-within git-gui.
+Unlike `gitk`, `git-gui` focuses on commit generation
+and single file annotation and does not show project history.
+It does however supply menu actions to start a `gitk` session from
+within `git-gui`.
-git-gui is known to work on all popular UNIX systems, Mac OS X,
+`git-gui` is known to work on all popular UNIX systems, Mac OS X,
and Windows (under both Cygwin and MSYS). To the extent possible
-OS specific user interface guidelines are followed, making git-gui
+OS specific user interface guidelines are followed, making `git-gui`
a fairly native interface for users.
COMMANDS
@@ -38,13 +38,13 @@ browser::
browser are opened in the blame viewer.
citool::
- Start git-gui and arrange to make exactly one commit before
+ Start `git-gui` and arrange to make exactly one commit before
exiting and returning to the shell. The interface is limited
to only commit actions, slightly reducing the application's
startup time and simplifying the menubar.
version::
- Display the currently running version of git-gui.
+ Display the currently running version of `git-gui`.
Examples
@@ -84,15 +84,15 @@ SEE ALSO
linkgit:gitk[1]::
The git repository browser. Shows branches, commit history
and file differences. gitk is the utility started by
- git-gui's Repository Visualize actions.
+ `git-gui`'s Repository Visualize actions.
Other
-----
-git-gui is actually maintained as an independent project, but stable
+`git-gui` is actually maintained as an independent project, but stable
versions are distributed as part of the Git suite for the convenience
of end users.
-A git-gui development repository can be obtained from:
+A `git-gui` development repository can be obtained from:
git clone git://repo.or.cz/git-gui.git
diff --git a/Documentation/git-hash-object.txt b/Documentation/git-hash-object.txt
index cf3dce8a4a..05550c5ac7 100644
--- a/Documentation/git-hash-object.txt
+++ b/Documentation/git-hash-object.txt
@@ -8,7 +8,7 @@ git-hash-object - Compute object ID and optionally creates a blob from a file
SYNOPSIS
--------
-'git-hash-object' [-t <type>] [-w] [--stdin | --stdin-paths] [--] <file>...
+'git hash-object' [-t <type>] [-w] [--stdin | --stdin-paths] [--] <file>...
DESCRIPTION
-----------
@@ -16,7 +16,7 @@ Computes the object ID value for an object with specified type
with the contents of the named file (which can be outside of the
work tree), and optionally writes the resulting object into the
object database. Reports its object ID to its standard output.
-This is used by "git-cvsimport" to update the index
+This is used by `git-cvsimport` to update the index
without modifying files in the work tree. When <type> is not
specified, it defaults to "blob".
diff --git a/Documentation/git-help.txt b/Documentation/git-help.txt
index faecd6bb90..5ace863c10 100644
--- a/Documentation/git-help.txt
+++ b/Documentation/git-help.txt
@@ -55,8 +55,8 @@ other display programs (see below).
+
The web browser can be specified using the configuration variable
'help.browser', or 'web.browser' if the former is not set. If none of
-these config variables is set, the 'git-web--browse' helper script
-(called by 'git-help') will pick a suitable default. See
+these config variables is set, the `git-web--browse` helper script
+(called by `git-help`) will pick a suitable default. See
linkgit:git-web--browse[1] for more information about this.
CONFIGURATION VARIABLES
@@ -67,7 +67,7 @@ help.format
If no command line option is passed, the 'help.format' configuration
variable will be checked. The following values are supported for this
-variable; they make 'git-help' behave as their corresponding command
+variable; they make `git-help` behave as their corresponding command
line option:
* "man" corresponds to '-m|--man',
diff --git a/Documentation/git-http-fetch.txt b/Documentation/git-http-fetch.txt
index 70fb635291..cfc5989b95 100644
--- a/Documentation/git-http-fetch.txt
+++ b/Documentation/git-http-fetch.txt
@@ -8,7 +8,7 @@ git-http-fetch - Download from a remote git repository via HTTP
SYNOPSIS
--------
-'git-http-fetch' [-c] [-t] [-a] [-d] [-v] [-w filename] [--recover] [--stdin] <commit> <url>
+'git http-fetch' [-c] [-t] [-a] [-d] [-v] [-w filename] [--recover] [--stdin] <commit> <url>
DESCRIPTION
-----------
@@ -35,7 +35,7 @@ commit-id::
--stdin::
Instead of a commit id on the command line (which is not expected in this
- case), 'git-http-fetch' expects lines on stdin in the format
+ case), `git-http-fetch` expects lines on stdin in the format
<commit-id>['\t'<filename-as-in--w>]
diff --git a/Documentation/git-http-push.txt b/Documentation/git-http-push.txt
index d69b20549b..aef383e0b1 100644
--- a/Documentation/git-http-push.txt
+++ b/Documentation/git-http-push.txt
@@ -8,7 +8,7 @@ git-http-push - Push objects over HTTP/DAV to another repository
SYNOPSIS
--------
-'git-http-push' [--all] [--dry-run] [--force] [--verbose] <url> <ref> [<ref>...]
+'git http-push' [--all] [--dry-run] [--force] [--verbose] <url> <ref> [<ref>...]
DESCRIPTION
-----------
diff --git a/Documentation/git-imap-send.txt b/Documentation/git-imap-send.txt
index f4fdc24283..776aa254da 100644
--- a/Documentation/git-imap-send.txt
+++ b/Documentation/git-imap-send.txt
@@ -8,7 +8,7 @@ git-imap-send - Dump a mailbox from stdin into an imap folder
SYNOPSIS
--------
-'git-imap-send'
+'git imap-send'
DESCRIPTION
@@ -20,13 +20,13 @@ files directly.
Typical usage is something like:
-git-format-patch --signoff --stdout --attach origin | git-imap-send
+git format-patch --signoff --stdout --attach origin | git imap-send
CONFIGURATION
-------------
-git-imap-send requires the following values in the repository
+`git-imap-send` requires the following values in the repository
configuration file (shown with examples):
..........................
diff --git a/Documentation/git-index-pack.txt b/Documentation/git-index-pack.txt
index 6409363ae5..1940237741 100644
--- a/Documentation/git-index-pack.txt
+++ b/Documentation/git-index-pack.txt
@@ -9,8 +9,8 @@ git-index-pack - Build pack index file for an existing packed archive
SYNOPSIS
--------
[verse]
-'git-index-pack' [-v] [-o <index-file>] <pack-file>
-'git-index-pack' --stdin [--fix-thin] [--keep] [-v] [-o <index-file>]
+'git index-pack' [-v] [-o <index-file>] <pack-file>
+'git index-pack' --stdin [--fix-thin] [--keep] [-v] [-o <index-file>]
[<pack-file>]
@@ -43,10 +43,10 @@ OPTIONS
a default name determined from the pack content. If
<pack-file> is not specified consider using --keep to
prevent a race condition between this process and
- linkgit:git-repack[1].
+ `git-repack`.
--fix-thin::
- It is possible for linkgit:git-pack-objects[1] to build
+ It is possible for `git-pack-objects` to build
"thin" pack, which records objects in deltified form based on
objects not included in the pack to reduce network traffic.
Those objects are expected to be present on the receiving end
@@ -59,7 +59,7 @@ OPTIONS
Before moving the index into its final destination
create an empty .keep file for the associated pack file.
This option is usually necessary with --stdin to prevent a
- simultaneous linkgit:git-repack[1] process from deleting
+ simultaneous `git-repack` process from deleting
the newly constructed pack and index before refs can be
updated to use objects contained in the pack.
@@ -86,7 +86,7 @@ Once the index has been created, the list of object names is sorted
and the SHA1 hash of that list is printed to stdout. If --stdin was
also used then this is prefixed by either "pack\t", or "keep\t" if a
new .keep file was successfully created. This is useful to remove a
-.keep file used as a lock to prevent the race with linkgit:git-repack[1]
+.keep file used as a lock to prevent the race with `git-repack`
mentioned above.
diff --git a/Documentation/git-init-db.txt b/Documentation/git-init-db.txt
index 439cabb737..1fd0ff2610 100644
--- a/Documentation/git-init-db.txt
+++ b/Documentation/git-init-db.txt
@@ -8,7 +8,7 @@ git-init-db - Creates an empty git repository
SYNOPSIS
--------
-'git-init-db' [-q | --quiet] [--template=<template_directory>] [--shared[=<permissions>]]
+'git init-db' [-q | --quiet] [--template=<template_directory>] [--shared[=<permissions>]]
DESCRIPTION
diff --git a/Documentation/git-init.txt b/Documentation/git-init.txt
index 792643c809..45244737fd 100644
--- a/Documentation/git-init.txt
+++ b/Documentation/git-init.txt
@@ -8,7 +8,7 @@ git-init - Create an empty git repository or reinitialize an existing one
SYNOPSIS
--------
-'git-init' [-q | --quiet] [--bare] [--template=<template_directory>] [--shared[=<permissions>]]
+'git init' [-q | --quiet] [--bare] [--template=<template_directory>] [--shared[=<permissions>]]
OPTIONS
@@ -105,8 +105,8 @@ Start a new git repository for an existing code base::
+
----------------
$ cd /path/to/my/codebase
-$ git-init <1>
-$ git-add . <2>
+$ git init <1>
+$ git add . <2>
----------------
+
<1> prepare /path/to/my/codebase/.git directory
diff --git a/Documentation/git-instaweb.txt b/Documentation/git-instaweb.txt
index 7da5b8d9a9..e7ca537e37 100644
--- a/Documentation/git-instaweb.txt
+++ b/Documentation/git-instaweb.txt
@@ -8,13 +8,13 @@ git-instaweb - Instantly browse your working repository in gitweb
SYNOPSIS
--------
[verse]
-'git-instaweb' [--local] [--httpd=<httpd>] [--port=<port>]
+'git instaweb' [--local] [--httpd=<httpd>] [--port=<port>]
[--browser=<browser>]
-'git-instaweb' [--start] [--stop] [--restart]
+'git instaweb' [--start] [--stop] [--restart]
DESCRIPTION
-----------
-A simple script to setup gitweb and a web server for browsing the local
+A simple script to set up `gitweb` and a web server for browsing the local
repository.
OPTIONS
@@ -44,7 +44,7 @@ OPTIONS
-b::
--browser::
The web browser that should be used to view the gitweb
- page. This will be passed to the 'git-web--browse' helper
+ page. This will be passed to the `git-web--browse` helper
script along with the URL of the gitweb instance. See
linkgit:git-web--browse[1] for more information about this. If
the script fails, the URL will be printed to stdout.
diff --git a/Documentation/git-log.txt b/Documentation/git-log.txt
index db61bc96c7..3373c2636a 100644
--- a/Documentation/git-log.txt
+++ b/Documentation/git-log.txt
@@ -8,15 +8,15 @@ git-log - Show commit logs
SYNOPSIS
--------
-'git-log' <option>...
+'git log' <option>...
DESCRIPTION
-----------
Shows the commit logs.
-The command takes options applicable to the linkgit:git-rev-list[1]
+The command takes options applicable to the `git-rev-list`
command to control what is shown and how, and options applicable to
-the linkgit:git-diff-tree[1] commands to control how the changes
+the `git-diff-*` commands to control how the changes
each commit introduces are shown.
diff --git a/Documentation/git-lost-found.txt b/Documentation/git-lost-found.txt
index 4dc475e0de..602b8d5d4d 100644
--- a/Documentation/git-lost-found.txt
+++ b/Documentation/git-lost-found.txt
@@ -7,7 +7,7 @@ git-lost-found - Recover lost refs that luckily have not yet been pruned
SYNOPSIS
--------
-'git-lost-found'
+'git lost-found'
DESCRIPTION
-----------
diff --git a/Documentation/git-ls-files.txt b/Documentation/git-ls-files.txt
index 560594e25f..a6883bf43b 100644
--- a/Documentation/git-ls-files.txt
+++ b/Documentation/git-ls-files.txt
@@ -9,7 +9,7 @@ git-ls-files - Show information about files in the index and the working tree
SYNOPSIS
--------
[verse]
-'git-ls-files' [-z] [-t] [-v]
+'git ls-files' [-z] [-t] [-v]
(--[cached|deleted|others|ignored|stage|unmerged|killed|modified])\*
(-[c|d|o|i|s|u|k|m])\*
[-x <pattern>|--exclude=<pattern>]
@@ -143,14 +143,14 @@ which case it outputs:
[<tag> ]<mode> <object> <stage> <file>
-"git-ls-files --unmerged" and "git-ls-files --stage" can be used to examine
+`git-ls-files --unmerged` and `git-ls-files --stage` can be used to examine
detailed information on unmerged paths.
For an unmerged path, instead of recording a single mode/SHA1 pair,
the index records up to three such pairs; one from tree O in stage
1, A in stage 2, and B in stage 3. This information can be used by
the user (or the porcelain) to see what should eventually be recorded at the
-path. (see git-read-tree for more information on state)
+path. (see linkgit:git-read-tree[1] for more information on state)
When `-z` option is not used, TAB, LF, and backslash characters
in pathnames are represented as `\t`, `\n`, and `\\`,
@@ -160,7 +160,7 @@ respectively.
Exclude Patterns
----------------
-'git-ls-files' can use a list of "exclude patterns" when
+`git-ls-files` can use a list of "exclude patterns" when
traversing the directory tree and finding files to show when the
flags --others or --ignored are specified. linkgit:gitignore[5]
specifies the format of exclude patterns.
@@ -176,7 +176,7 @@ These exclude patterns come from these places, in order:
in the same order they appear in the file.
3. command line flag --exclude-per-directory=<name> specifies
- a name of the file in each directory 'git-ls-files'
+ a name of the file in each directory `git-ls-files`
examines, normally `.gitignore`. Files in deeper
directories take precedence. Patterns are ordered in the
same order they appear in the files.
diff --git a/Documentation/git-ls-remote.txt b/Documentation/git-ls-remote.txt
index f92f3ca186..c267cdae4a 100644
--- a/Documentation/git-ls-remote.txt
+++ b/Documentation/git-ls-remote.txt
@@ -9,7 +9,7 @@ git-ls-remote - List references in a remote repository
SYNOPSIS
--------
[verse]
-'git-ls-remote' [--heads] [--tags] [-u <exec> | --upload-pack <exec>]
+'git ls-remote' [--heads] [--tags] [-u <exec> | --upload-pack <exec>]
<repository> <refs>...
DESCRIPTION
@@ -31,7 +31,7 @@ OPTIONS
-u <exec>::
--upload-pack=<exec>::
- Specify the full path of linkgit:git-upload-pack[1] on the remote
+ Specify the full path of `git-upload-pack` on the remote
host. This allows listing references from repositories accessed via
SSH and where the SSH daemon does not use the PATH configured by the
user.
diff --git a/Documentation/git-ls-tree.txt b/Documentation/git-ls-tree.txt
index d9881fbbbe..1cdec222a1 100644
--- a/Documentation/git-ls-tree.txt
+++ b/Documentation/git-ls-tree.txt
@@ -9,7 +9,7 @@ git-ls-tree - List the contents of a tree object
SYNOPSIS
--------
[verse]
-'git-ls-tree' [-d] [-r] [-t] [-l] [-z]
+'git ls-tree' [-d] [-r] [-t] [-l] [-z]
[--name-only] [--name-status] [--full-name] [--abbrev=[<n>]]
<tree-ish> [paths...]
diff --git a/Documentation/git-mailinfo.txt b/Documentation/git-mailinfo.txt
index 183dc1dd75..6ebdeee843 100644
--- a/Documentation/git-mailinfo.txt
+++ b/Documentation/git-mailinfo.txt
@@ -8,7 +8,7 @@ git-mailinfo - Extracts patch and authorship from a single e-mail message
SYNOPSIS
--------
-'git-mailinfo' [-k] [-u | --encoding=<encoding>] <msg> <patch>
+'git mailinfo' [-k] [-u | --encoding=<encoding>] <msg> <patch>
DESCRIPTION
@@ -16,7 +16,7 @@ DESCRIPTION
Reading a single e-mail message from the standard input, and
writes the commit log message in <msg> file, and the patches in
<patch> file. The author name, e-mail and e-mail subject are
-written out to the standard output to be used by git-am
+written out to the standard output to be used by `git-am`
to create a commit. It is usually not necessary to use this
command directly. See linkgit:git-am[1] instead.
@@ -29,8 +29,8 @@ OPTIONS
among which (1) remove 'Re:' or 're:', (2) leading
whitespaces, (3) '[' up to ']', typically '[PATCH]', and
then prepends "[PATCH] ". This flag forbids this
- munging, and is most useful when used to read back 'git
- format-patch -k' output.
+ munging, and is most useful when used to read back
+ `git-format-patch -k` output.
-u::
The commit log message, author name and author email are
diff --git a/Documentation/git-mailsplit.txt b/Documentation/git-mailsplit.txt
index 9a2aedd480..acd712b1cd 100644
--- a/Documentation/git-mailsplit.txt
+++ b/Documentation/git-mailsplit.txt
@@ -7,7 +7,7 @@ git-mailsplit - Simple UNIX mbox splitter program
SYNOPSIS
--------
-'git-mailsplit' [-b] [-f<nn>] [-d<prec>] -o<directory> [--] [<mbox>|<Maildir>...]
+'git mailsplit' [-b] [-f<nn>] [-d<prec>] -o<directory> [--] [<mbox>|<Maildir>...]
DESCRIPTION
-----------
diff --git a/Documentation/git-merge-base.txt b/Documentation/git-merge-base.txt
index bbe8512397..41fb0c76ac 100644
--- a/Documentation/git-merge-base.txt
+++ b/Documentation/git-merge-base.txt
@@ -8,20 +8,20 @@ git-merge-base - Find as good common ancestors as possible for a merge
SYNOPSIS
--------
-'git-merge-base' [--all] <commit> <commit>
+'git merge-base' [--all] <commit> <commit>
DESCRIPTION
-----------
-"git-merge-base" finds as good a common ancestor as possible between
-the two commits. That is, given two commits A and B 'git-merge-base A
-B' will output a commit which is reachable from both A and B through
+`git-merge-base` finds as good a common ancestor as possible between
+the two commits. That is, given two commits A and B, `git merge-base A
+B` will output a commit which is reachable from both A and B through
the parent relationship.
Given a selection of equally good common ancestors it should not be
relied on to decide in any particular way.
-The "git-merge-base" algorithm is still in flux - use the source...
+The `git-merge-base` algorithm is still in flux - use the source...
OPTIONS
-------
diff --git a/Documentation/git-merge-file.txt b/Documentation/git-merge-file.txt
index 149f131051..f057e49951 100644
--- a/Documentation/git-merge-file.txt
+++ b/Documentation/git-merge-file.txt
@@ -9,21 +9,21 @@ git-merge-file - Run a three-way file merge
SYNOPSIS
--------
[verse]
-'git-merge-file' [-L <current-name> [-L <base-name> [-L <other-name>]]]
+'git merge-file' [-L <current-name> [-L <base-name> [-L <other-name>]]]
[-p|--stdout] [-q|--quiet] <current-file> <base-file> <other-file>
DESCRIPTION
-----------
-git-file-merge incorporates all changes that lead from the `<base-file>`
+`git-file-merge` incorporates all changes that lead from the `<base-file>`
to `<other-file>` into `<current-file>`. The result ordinarily goes into
-`<current-file>`. git-merge-file is useful for combining separate changes
+`<current-file>`. `git-merge-file` is useful for combining separate changes
to an original. Suppose `<base-file>` is the original, and both
`<current-file>` and `<other-file>` are modifications of `<base-file>`.
-Then git-merge-file combines both changes.
+Then `git-merge-file` combines both changes.
A conflict occurs if both `<current-file>` and `<other-file>` have changes
-in a common segment of lines. If a conflict is found, git-merge-file
+in a common segment of lines. If a conflict is found, `git-merge-file`
normally outputs a warning and brackets the conflict with <<<<<<< and
>>>>>>> lines. A typical conflict will look like this:
@@ -39,7 +39,7 @@ the alternatives.
The exit value of this program is negative on error, and the number of
conflicts otherwise. If the merge was clean, the exit value is 0.
-git-merge-file is designed to be a minimal clone of RCS merge, that is, it
+`git-merge-file` is designed to be a minimal clone of RCS `merge`; that is, it
implements all of RCS merge's functionality which is needed by
linkgit:git[1].
@@ -51,7 +51,7 @@ OPTIONS
This option may be given up to three times, and
specifies labels to be used in place of the
corresponding file names in conflict reports. That is,
- `git-merge-file -L x -L y -L z a b c` generates output that
+ `git merge-file -L x -L y -L z a b c` generates output that
looks like it came from files x, y and z instead of
from files a, b and c.
diff --git a/Documentation/git-merge-index.txt b/Documentation/git-merge-index.txt
index a0ead2bbf3..43680840e1 100644
--- a/Documentation/git-merge-index.txt
+++ b/Documentation/git-merge-index.txt
@@ -8,7 +8,7 @@ git-merge-index - Run a merge for files needing merging
SYNOPSIS
--------
-'git-merge-index' [-o] [-q] <merge-program> (-a | [--] <file>\*)
+'git merge-index' [-o] [-q] <merge-program> (-a | [--] <file>\*)
DESCRIPTION
-----------
@@ -36,24 +36,24 @@ OPTIONS
failure usually indicates conflicts during merge). This is for
porcelains which might want to emit custom messages.
-If "git-merge-index" is called with multiple <file>s (or -a) then it
+If `git-merge-index` is called with multiple <file>s (or -a) then it
processes them in turn only stopping if merge returns a non-zero exit
code.
Typically this is run with a script calling git's imitation of
the merge command from the RCS package.
-A sample script called "git-merge-one-file" is included in the
+A sample script called `git-merge-one-file` is included in the
distribution.
ALERT ALERT ALERT! The git "merge object order" is different from the
-RCS "merge" program merge object order. In the above ordering, the
+RCS `merge` program merge object order. In the above ordering, the
original is first. But the argument order to the 3-way merge program
-"merge" is to have the original in the middle. Don't ask me why.
+`merge` is to have the original in the middle. Don't ask me why.
Examples:
- torvalds@ppc970:~/merge-test> git-merge-index cat MM
+ torvalds@ppc970:~/merge-test> git merge-index cat MM
This is MM from the original tree. # original
This is modified MM in the branch A. # merge1
This is modified MM in the branch B. # merge2
@@ -61,17 +61,17 @@ Examples:
or
- torvalds@ppc970:~/merge-test> git-merge-index cat AA MM
+ torvalds@ppc970:~/merge-test> git merge-index cat AA MM
cat: : No such file or directory
This is added AA in the branch A.
This is added AA in the branch B.
This is added AA in the branch B.
fatal: merge program failed
-where the latter example shows how "git-merge-index" will stop trying to
-merge once anything has returned an error (i.e., "cat" returned an error
+where the latter example shows how `git-merge-index` will stop trying to
+merge once anything has returned an error (i.e., `cat` returned an error
for the AA file, because it didn't exist in the original, and thus
-"git-merge-index" didn't even try to merge the MM thing).
+`git-merge-index` didn't even try to merge the MM thing).
Author
------
diff --git a/Documentation/git-merge-one-file.txt b/Documentation/git-merge-one-file.txt
index 5c9ce641ec..62e09afe13 100644
--- a/Documentation/git-merge-one-file.txt
+++ b/Documentation/git-merge-one-file.txt
@@ -12,8 +12,8 @@ SYNOPSIS
DESCRIPTION
-----------
-This is the standard helper program to use with "git-merge-index"
-to resolve a merge after the trivial merge done with "git-read-tree -m".
+This is the standard helper program to use with `git-merge-index`
+to resolve a merge after the trivial merge done with `git-read-tree -m`.
Author
------
diff --git a/Documentation/git-merge-tree.txt b/Documentation/git-merge-tree.txt
index b785e0f6e0..dbb0c18668 100644
--- a/Documentation/git-merge-tree.txt
+++ b/Documentation/git-merge-tree.txt
@@ -8,7 +8,7 @@ git-merge-tree - Show three-way merge without touching index
SYNOPSIS
--------
-'git-merge-tree' <base-tree> <branch1> <branch2>
+'git merge-tree' <base-tree> <branch1> <branch2>
DESCRIPTION
-----------
diff --git a/Documentation/git-merge.txt b/Documentation/git-merge.txt
index 55bc367479..e6fa2b9ae4 100644
--- a/Documentation/git-merge.txt
+++ b/Documentation/git-merge.txt
@@ -9,9 +9,9 @@ git-merge - Join two or more development histories together
SYNOPSIS
--------
[verse]
-'git-merge' [-n] [--stat] [--no-commit] [--squash] [-s <strategy>]...
+'git merge' [-n] [--stat] [--no-commit] [--squash] [-s <strategy>]...
[-m <msg>] <remote> <remote>...
-'git-merge' <msg> HEAD <remote>...
+'git merge' <msg> HEAD <remote>...
DESCRIPTION
-----------
@@ -41,8 +41,7 @@ include::merge-strategies.txt[]
If you tried a merge which resulted in a complex conflicts and
-would want to start over, you can recover with
-linkgit:git-reset[1].
+would want to start over, you can recover with `git-reset`.
CONFIGURATION
-------------
@@ -50,7 +49,7 @@ include::merge-config.txt[]
branch.<name>.mergeoptions::
Sets default options for merging into branch <name>. The syntax and
- supported options are equal to that of git-merge, but option values
+ supported options are equal to that of `git-merge`, but option values
containing whitespace characters are currently not supported.
HOW MERGE WORKS
@@ -60,7 +59,7 @@ A merge is always between the current `HEAD` and one or more
commits (usually, branch head or tag), 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
+it happens. In other words, `git diff --cached HEAD` must
report no changes.
[NOTE]
@@ -128,7 +127,7 @@ When there are conflicts, these things happen:
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
+ 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 `<<< === >>>`.
@@ -144,8 +143,8 @@ After seeing a conflict, you can do two things:
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
+ * 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-add` or `git-rm`
them, to make the index file contain what the merge result
should be, and run `git-commit` to commit the result.
@@ -154,8 +153,11 @@ After seeing a conflict, you can do two things:
SEE ALSO
--------
linkgit:git-fmt-merge-msg[1], linkgit:git-pull[1],
-linkgit:gitattributes[5]
-
+linkgit:gitattributes[5],
+linkgit:git-reset[1],
+linkgit:git-diff[1], linkgit:git-ls-files[1],
+linkgit:git-add[1], linkgit:git-rm[1],
+linkgit:git-mergetool[1]
Author
------
diff --git a/Documentation/git-mergetool.txt b/Documentation/git-mergetool.txt
index 83525609c6..fedcfa0543 100644
--- a/Documentation/git-mergetool.txt
+++ b/Documentation/git-mergetool.txt
@@ -7,17 +7,17 @@ git-mergetool - Run merge conflict resolution tools to resolve merge conflicts
SYNOPSIS
--------
-'git-mergetool' [--tool=<tool>] [<file>]...
+'git mergetool' [--tool=<tool>] [<file>]...
DESCRIPTION
-----------
Use `git mergetool` to run one of several merge utilities to resolve
-merge conflicts. It is typically run after linkgit:git-merge[1].
+merge conflicts. It is typically run after `git-merge`.
If one or more <file> parameters are given, the merge tool program will
be run to resolve differences on each file. If no <file> names are
-specified, `git mergetool` will run the merge tool program on every file
+specified, `git-mergetool` will run the merge tool program on every file
with merge conflicts.
OPTIONS
@@ -27,23 +27,23 @@ OPTIONS
Valid merge tools are:
kdiff3, tkdiff, meld, xxdiff, emerge, vimdiff, gvimdiff, ecmerge, and opendiff
+
-If a merge resolution program is not specified, `git mergetool`
+If a merge resolution program is not specified, `git-mergetool`
will use the configuration variable `merge.tool`. If the
-configuration variable `merge.tool` is not set, `git mergetool`
+configuration variable `merge.tool` is not set, `git-mergetool`
will pick a suitable default.
+
You can explicitly provide a full path to the tool by setting the
configuration variable `mergetool.<tool>.path`. For example, you
can configure the absolute path to kdiff3 by setting
-`mergetool.kdiff3.path`. Otherwise, `git mergetool` assumes the
+`mergetool.kdiff3.path`. Otherwise, `git-mergetool` assumes the
tool is available in PATH.
+
Instead of running one of the known merge tool programs
-`git mergetool` can be customized to run an alternative program
+`git-mergetool` can be customized to run an alternative program
by specifying the command line to invoke in a configration
variable `mergetool.<tool>.cmd`.
+
-When `git mergetool` is invoked with this tool (either through the
+When `git-mergetool` is invoked with this tool (either through the
`-t` or `--tool` option or the `merge.tool` configuration
variable) the configured command line will be invoked with `$BASE`
set to the name of a temporary file containing the common base for
@@ -57,7 +57,7 @@ merge resolution.
If the custom merge tool correctly indicates the success of a
merge resolution with its exit code then the configuration
variable `mergetool.<tool>.trustExitCode` can be set to `true`.
-Otherwise, `git mergetool` will prompt the user to indicate the
+Otherwise, `git-mergetool` will prompt the user to indicate the
success of the resolution after the custom tool has exited.
Author
diff --git a/Documentation/git-mktag.txt b/Documentation/git-mktag.txt
index 232bc1a338..8bcc11443d 100644
--- a/Documentation/git-mktag.txt
+++ b/Documentation/git-mktag.txt
@@ -8,7 +8,7 @@ git-mktag - Creates a tag object
SYNOPSIS
--------
-'git-mktag' < signature_file
+'git mktag' < signature_file
DESCRIPTION
-----------
diff --git a/Documentation/git-mktree.txt b/Documentation/git-mktree.txt
index 1ddbf00afc..0be32e2612 100644
--- a/Documentation/git-mktree.txt
+++ b/Documentation/git-mktree.txt
@@ -8,7 +8,7 @@ git-mktree - Build a tree-object from ls-tree formatted text
SYNOPSIS
--------
-'git-mktree' [-z]
+'git mktree' [-z]
DESCRIPTION
-----------
diff --git a/Documentation/git-mv.txt b/Documentation/git-mv.txt
index 339190600a..9c5660275b 100644
--- a/Documentation/git-mv.txt
+++ b/Documentation/git-mv.txt
@@ -8,14 +8,14 @@ git-mv - Move or rename a file, a directory, or a symlink
SYNOPSIS
--------
-'git-mv' <options>... <args>...
+'git mv' <options>... <args>...
DESCRIPTION
-----------
This script is used to move or rename a file, directory or symlink.
- git-mv [-f] [-n] <source> <destination>
- git-mv [-f] [-n] [-k] <source> ... <destination directory>
+ git mv [-f] [-n] <source> <destination>
+ git mv [-f] [-n] [-k] <source> ... <destination directory>
In the first form, it renames <source>, which must exist and be either
a file, symlink or directory, to <destination>.
diff --git a/Documentation/git-name-rev.txt b/Documentation/git-name-rev.txt
index ffac3f8f56..00b1fa4dcb 100644
--- a/Documentation/git-name-rev.txt
+++ b/Documentation/git-name-rev.txt
@@ -9,13 +9,13 @@ git-name-rev - Find symbolic names for given revs
SYNOPSIS
--------
[verse]
-'git-name-rev' [--tags] [--refs=<pattern>]
+'git name-rev' [--tags] [--refs=<pattern>]
( --all | --stdin | <committish>... )
DESCRIPTION
-----------
Finds symbolic names suitable for human digestion for revisions given in any
-format parsable by git-rev-parse.
+format parsable by `git-rev-parse`.
OPTIONS
@@ -38,7 +38,7 @@ OPTIONS
Instead of printing both the SHA-1 and the name, print only
the name. If given with --tags the usual tag prefix of
"tags/" is also omitted from the name, matching the output
- of linkgit:git-describe[1] more closely. This option
+ of `git-describe` more closely. This option
cannot be combined with --stdin.
--no-undefined::
@@ -56,7 +56,7 @@ wrote you about that fantastic commit 33db5f4d9027a10e477ccf054b2c1ab94f74c85a.
Of course, you look into the commit, but that only tells you what happened, but
not the context.
-Enter git-name-rev:
+Enter `git-name-rev`:
------------
% git name-rev 33db5f4d9027a10e477ccf054b2c1ab94f74c85a
diff --git a/Documentation/git-pack-objects.txt b/Documentation/git-pack-objects.txt
index f4d8d68e34..d9cd16ae16 100644
--- a/Documentation/git-pack-objects.txt
+++ b/Documentation/git-pack-objects.txt
@@ -9,7 +9,7 @@ git-pack-objects - Create a packed archive of objects
SYNOPSIS
--------
[verse]
-'git-pack-objects' [-q] [--no-reuse-delta] [--delta-base-offset] [--non-empty]
+'git pack-objects' [-q] [--no-reuse-delta] [--delta-base-offset] [--non-empty]
[--local] [--incremental] [--window=N] [--depth=N] [--all-progress]
[--revs [--unpacked | --all]*] [--stdout | base-name] < object-list
@@ -30,7 +30,7 @@ Placing both in the pack/ subdirectory of $GIT_OBJECT_DIRECTORY (or
any of the directories on $GIT_ALTERNATE_OBJECT_DIRECTORIES)
enables git to read from such an archive.
-'git-unpack-objects' command can read the packed archive and
+The `git-unpack-objects` command can read the packed archive and
expand the objects contained in the pack into "one-file
one-object" format; this is typically done by the smart-pull
commands when a pack is created on-the-fly for efficient network
@@ -59,7 +59,7 @@ base-name::
--revs::
Read the revision arguments from the standard input, instead of
individual object names. The revision arguments are processed
- the same way as linkgit:git-rev-list[1] with `--objects` flag
+ the same way as `git-rev-list` with the `--objects` flag
uses its `commit` arguments to build the list of objects it
outputs. The objects on the resulting list are packed.
@@ -163,14 +163,14 @@ base-name::
generated pack. If not specified, pack compression level is
determined first by pack.compression, then by core.compression,
and defaults to -1, the zlib default, if neither is set.
- Add \--no-reuse-object if you want to force a uniform compression
+ Add --no-reuse-object if you want to force a uniform compression
level on all data no matter the source.
--delta-base-offset::
A packed archive can express base object of a delta as
either 20-byte object name or as an offset in the
stream, but older version of git does not understand the
- latter. By default, git-pack-objects only uses the
+ latter. By default, `git-pack-objects` only uses the
former format for better compatibility. This option
allows the command to use the latter format for
compactness. Depending on the average delta chain
diff --git a/Documentation/git-pack-redundant.txt b/Documentation/git-pack-redundant.txt
index 6737326f0b..80fc1bae35 100644
--- a/Documentation/git-pack-redundant.txt
+++ b/Documentation/git-pack-redundant.txt
@@ -8,21 +8,21 @@ git-pack-redundant - Find redundant pack files
SYNOPSIS
--------
-'git-pack-redundant' [ --verbose ] [ --alt-odb ] < --all | .pack filename ... >
+'git pack-redundant' [ --verbose ] [ --alt-odb ] < --all | .pack filename ... >
DESCRIPTION
-----------
This program computes which packs in your repository
are redundant. The output is suitable for piping to
-'xargs rm' if you are in the root of the repository.
+`xargs rm` if you are in the root of the repository.
-git-pack-redundant accepts a list of objects on standard input. Any objects
+`git-pack-redundant` accepts a list of objects on standard input. Any objects
given will be ignored when checking which packs are required. This makes the
following command useful when wanting to remove packs which contain unreachable
objects.
-git-fsck --full --unreachable | cut -d ' ' -f3 | \
-git-pack-redundant --all | xargs rm
+git fsck --full --unreachable | cut -d ' ' -f3 | \
+git pack-redundant --all | xargs rm
OPTIONS
-------
diff --git a/Documentation/git-pack-refs.txt b/Documentation/git-pack-refs.txt
index c0718468d5..a5244d35f4 100644
--- a/Documentation/git-pack-refs.txt
+++ b/Documentation/git-pack-refs.txt
@@ -7,7 +7,7 @@ git-pack-refs - Pack heads and tags for efficient repository access
SYNOPSIS
--------
-'git-pack-refs' [--all] [--no-prune]
+'git pack-refs' [--all] [--no-prune]
DESCRIPTION
-----------
@@ -31,7 +31,7 @@ Subsequent updates to branches always creates new file under
A recommended practice to deal with a repository with too many
refs is to pack its refs with `--all --prune` once, and
-occasionally run `git-pack-refs \--prune`. Tags are by
+occasionally run `git pack-refs \--prune`. Tags are by
definition stationary and are not expected to change. Branch
heads will be packed with the initial `pack-refs --all`, but
only the currently active branch heads will become unpacked,
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-patch-id.txt b/Documentation/git-patch-id.txt
index bb8a079254..17c178f867 100644
--- a/Documentation/git-patch-id.txt
+++ b/Documentation/git-patch-id.txt
@@ -7,7 +7,7 @@ git-patch-id - Compute unique ID for a patch
SYNOPSIS
--------
-'git-patch-id' < <patch>
+'git patch-id' < <patch>
DESCRIPTION
-----------
@@ -18,7 +18,7 @@ ID" are almost guaranteed to be the same thing.
IOW, you can use this thing to look for likely duplicate commits.
-When dealing with git-diff-tree output, it takes advantage of
+When dealing with `git-diff-tree` output, it takes advantage of
the fact that the patch is prefixed with the object name of the
commit, and outputs two 40-byte hexadecimal string. The first
string is the patch ID, and the second string is the commit ID.
diff --git a/Documentation/git-peek-remote.txt b/Documentation/git-peek-remote.txt
index ffbf93a799..c3ed4a10f4 100644
--- a/Documentation/git-peek-remote.txt
+++ b/Documentation/git-peek-remote.txt
@@ -8,7 +8,7 @@ git-peek-remote - List the references in a remote repository
SYNOPSIS
--------
-'git-peek-remote' [--upload-pack=<git-upload-pack>] [<host>:]<directory>
+'git peek-remote' [--upload-pack=<git-upload-pack>] [<host>:]<directory>
DESCRIPTION
-----------
@@ -17,7 +17,7 @@ This command is deprecated; use `git-ls-remote` instead.
OPTIONS
-------
--upload-pack=<git-upload-pack>::
- Use this to specify the path to 'git-upload-pack' on the
+ Use this to specify the path to `git-upload-pack` on the
remote side, if it is not found on your $PATH. Some
installations of sshd ignores the user's environment
setup scripts for login shells (e.g. .bash_profile) and
@@ -30,7 +30,7 @@ OPTIONS
<host>::
A remote host that houses the repository. When this
- part is specified, 'git-upload-pack' is invoked via
+ part is specified, `git-upload-pack` is invoked via
ssh.
<directory>::
diff --git a/Documentation/git-prune-packed.txt b/Documentation/git-prune-packed.txt
index f330b8a5b9..b5f26cee13 100644
--- a/Documentation/git-prune-packed.txt
+++ b/Documentation/git-prune-packed.txt
@@ -8,7 +8,7 @@ git-prune-packed - Remove extra objects that are already in pack files
SYNOPSIS
--------
-'git-prune-packed' [-n] [-q]
+'git prune-packed' [-n] [-q]
DESCRIPTION
diff --git a/Documentation/git-prune.txt b/Documentation/git-prune.txt
index ec335d6fab..a4a0d56cae 100644
--- a/Documentation/git-prune.txt
+++ b/Documentation/git-prune.txt
@@ -13,8 +13,8 @@ SYNOPSIS
DESCRIPTION
-----------
-NOTE: In most cases, users should run linkgit:git-gc[1], which calls
-git-prune. See the section "NOTES", below.
+NOTE: In most cases, users should run `git-gc`, which calls
+`git-prune`. See the section "NOTES", below.
This runs `git-fsck --unreachable` using all the refs
available in `$GIT_DIR/refs`, optionally with additional set of
@@ -22,7 +22,7 @@ objects specified on the command line, and prunes all unpacked
objects unreachable from any of these head objects from the object database.
In addition, it
prunes the unpacked objects that are also found in packs by
-running `git prune-packed`.
+running `git-prune-packed`.
Note that unreachable, packed objects will remain. If this is
not desired, see linkgit:git-repack[1].
@@ -53,18 +53,18 @@ borrows from your repository via its
`.git/objects/info/alternates`:
------------
-$ git prune $(cd ../another && $(git-rev-parse --all))
+$ git prune $(cd ../another && $(git rev-parse --all))
------------
Notes
-----
-In most cases, users will not need to call git-prune directly, but
-should instead call linkgit:git-gc[1], which handles pruning along with
+In most cases, users will not need to call `git-prune` directly, but
+should instead call `git-gc`, which handles pruning along with
many other housekeeping tasks.
For a description of which objects are considered for pruning, see
-git-fsck's --unreachable option.
+`git-fsck`'s --unreachable option.
SEE ALSO
--------
diff --git a/Documentation/git-pull.txt b/Documentation/git-pull.txt
index d0f1595f7e..d9537ebc6a 100644
--- a/Documentation/git-pull.txt
+++ b/Documentation/git-pull.txt
@@ -8,7 +8,7 @@ git-pull - Fetch from and merge with another repository or a local branch
SYNOPSIS
--------
-'git-pull' <options> <repository> <refspec>...
+'git pull' <options> <repository> <refspec>...
DESCRIPTION
@@ -182,8 +182,7 @@ The final command then merges the newly fetched `tmp` into master.
If you tried a pull which resulted in a complex conflicts and
-would want to start over, you can recover with
-linkgit:git-reset[1].
+would want to start over, you can recover with `git-reset`.
SEE ALSO
diff --git a/Documentation/git-push.txt b/Documentation/git-push.txt
index 89e0049bce..1f70e72758 100644
--- a/Documentation/git-push.txt
+++ b/Documentation/git-push.txt
@@ -9,7 +9,7 @@ git-push - Update remote refs along with associated objects
SYNOPSIS
--------
[verse]
-'git-push' [--all] [--dry-run] [--tags] [--receive-pack=<git-receive-pack>]
+'git push' [--all] [--dry-run] [--tags] [--receive-pack=<git-receive-pack>]
[--repo=all] [-f | --force] [-v | --verbose] [<repository> <refspec>...]
DESCRIPTION
@@ -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
@@ -84,7 +85,7 @@ nor in any Push line of the corresponding remotes file---see below).
line.
--receive-pack=<git-receive-pack>::
- Path to the 'git-receive-pack' program on the remote
+ Path to the `git-receive-pack` program on the remote
end. Sometimes useful when pushing to a remote
repository over ssh, and you do not have the program in
a directory on the default $PATH.
diff --git a/Documentation/git-quiltimport.txt b/Documentation/git-quiltimport.txt
index 0600379394..d4037de512 100644
--- a/Documentation/git-quiltimport.txt
+++ b/Documentation/git-quiltimport.txt
@@ -9,7 +9,7 @@ git-quiltimport - Applies a quilt patchset onto the current branch
SYNOPSIS
--------
[verse]
-'git-quiltimport' [--dry-run] [--author <author>] [--patches <dir>]
+'git quiltimport' [--dry-run] [--author <author>] [--patches <dir>]
DESCRIPTION
diff --git a/Documentation/git-read-tree.txt b/Documentation/git-read-tree.txt
index 58fb906ef6..0c7cc6b940 100644
--- a/Documentation/git-read-tree.txt
+++ b/Documentation/git-read-tree.txt
@@ -8,7 +8,7 @@ git-read-tree - Reads tree information into the index
SYNOPSIS
--------
-'git-read-tree' (<tree-ish> | [[-m [--trivial] [--aggressive] | --reset | --prefix=<prefix>] [-u | -i]] [--exclude-per-directory=<gitignore>] [--index-output=<file>] <tree-ish1> [<tree-ish2> [<tree-ish3>]])
+'git read-tree' (<tree-ish> | [[-m [--trivial] [--aggressive] | --reset | --prefix=<prefix>] [-u | -i]] [--exclude-per-directory=<gitignore>] [--index-output=<file>] <tree-ish1> [<tree-ish2> [<tree-ish3>]])
DESCRIPTION
@@ -121,14 +121,14 @@ provided.
Single Tree Merge
~~~~~~~~~~~~~~~~~
-If only 1 tree is specified, git-read-tree operates as if the user did not
+If only 1 tree is specified, `git-read-tree` operates as if the user did not
specify `-m`, except that if the original index has an entry for a
given pathname, and the contents of the path matches with the tree
being read, the stat info from the index is used. (In other words, the
index's stat()s take precedence over the merged tree's).
-That means that if you do a `git-read-tree -m <newtree>` followed by a
-`git-checkout-index -f -u -a`, the `git-checkout-index` only checks out
+That means that if you do a `git read-tree -m <newtree>` followed by a
+`git checkout-index -f -u -a`, the `git-checkout-index` only checks out
the stuff that really changed.
This is used to avoid unnecessary false hits when `git-diff-files` is
@@ -138,12 +138,12 @@ run after `git-read-tree`.
Two Tree Merge
~~~~~~~~~~~~~~
-Typically, this is invoked as `git-read-tree -m $H $M`, where $H
+Typically, this is invoked as `git read-tree -m $H $M`, where $H
is the head commit of the current repository, and $M is the head
of a foreign tree, which is simply ahead of $H (i.e. we are in a
fast forward situation).
-When two trees are specified, the user is telling git-read-tree
+When two trees are specified, the user is telling `git-read-tree`
the following:
1. The current index and work tree is derived from $H, but
@@ -151,7 +151,7 @@ the following:
2. The user wants to fast-forward to $M.
-In this case, the `git-read-tree -m $H $M` command makes sure
+In this case, the `git read-tree -m $H $M` command makes sure
that no local change is lost as the result of this "merge".
Here are the "carry forward" rules:
@@ -193,18 +193,18 @@ Here are the "carry forward" rules:
In all "keep index" cases, the index entry stays as in the
original index file. If the entry were not up to date,
-git-read-tree keeps the copy in the work tree intact when
+`git-read-tree` keeps the copy in the work tree intact when
operating under the -u flag.
-When this form of git-read-tree returns successfully, you can
+When this form of `git-read-tree` returns successfully, you can
see what "local changes" you made are carried forward by running
-`git-diff-index --cached $M`. Note that this does not
-necessarily match `git-diff-index --cached $H` would have
+`git diff-index --cached $M`. Note that this does not
+necessarily match `git diff-index --cached $H` would have
produced before such a two tree merge. This is because of cases
18 and 19 --- if you already had the changes in $M (e.g. maybe
-you picked it up via e-mail in a patch form), `git-diff-index
+you picked it up via e-mail in a patch form), `git diff-index
--cached $H` would have told you about the change before this
-merge, but it would not show in `git-diff-index --cached $M`
+merge, but it would not show in `git diff-index --cached $M`
output after two-tree merge.
@@ -219,7 +219,7 @@ starts out at 1.
This means that you can do
----------------
-$ git-read-tree -m <tree1> <tree2> <tree3>
+$ git read-tree -m <tree1> <tree2> <tree3>
----------------
and you will end up with an index with all of the <tree1> entries in
@@ -261,7 +261,7 @@ start a 3-way merge with an index file that is already
populated. Here is an outline of how the algorithm works:
- if a file exists in identical format in all three trees, it will
- automatically collapse to "merged" state by git-read-tree.
+ automatically collapse to "merged" state by `git-read-tree`.
- a file that has _any_ difference what-so-ever in the three trees
will stay as separate entries in the index. It's up to "porcelain
@@ -304,16 +304,16 @@ commit. To illustrate, suppose you start from what has been
committed last to your repository:
----------------
-$ JC=`git-rev-parse --verify "HEAD^0"`
-$ git-checkout-index -f -u -a $JC
+$ JC=`git rev-parse --verify "HEAD^0"`
+$ git checkout-index -f -u -a $JC
----------------
-You do random edits, without running git-update-index. And then
+You do random edits, without running `git-update-index`. And then
you notice that the tip of your "upstream" tree has advanced
since you pulled from him:
----------------
-$ git-fetch git://.... linus
+$ git fetch git://.... linus
$ LT=`cat .git/FETCH_HEAD`
----------------
@@ -323,10 +323,10 @@ added or modified index entries since $JC, and if you haven't,
then does the right thing. So with the following sequence:
----------------
-$ git-read-tree -m -u `git-merge-base $JC $LT` $JC $LT
-$ git-merge-index git-merge-one-file -a
+$ git read-tree -m -u `git merge-base $JC $LT` $JC $LT
+$ git merge-index git-merge-one-file -a
$ echo "Merge with Linus" | \
- git-commit-tree `git-write-tree` -p $JC -p $LT
+ git commit-tree `git write-tree` -p $JC -p $LT
----------------
what you would commit is a pure merge between $JC and $LT without
@@ -334,7 +334,7 @@ your work-in-progress changes, and your work tree would be
updated to the result of the merge.
However, if you have local changes in the working tree that
-would be overwritten by this merge,`git-read-tree` will refuse
+would be overwritten by this merge, `git-read-tree` will refuse
to run to prevent your changes from being lost.
In other words, there is no need to worry about what exists only
diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
index 7166414355..754230e462 100644
--- a/Documentation/git-rebase.txt
+++ b/Documentation/git-rebase.txt
@@ -8,15 +8,15 @@ git-rebase - Forward-port local commits to the updated upstream head
SYNOPSIS
--------
[verse]
-'git-rebase' [-i | --interactive] [-v | --verbose] [-m | --merge]
+'git rebase' [-i | --interactive] [-v | --verbose] [-m | --merge]
[-s <strategy> | --strategy=<strategy>]
[-C<n>] [ --whitespace=<option>] [-p | --preserve-merges]
[--onto <newbase>] <upstream> [<branch>]
-'git-rebase' --continue | --skip | --abort
+'git rebase' --continue | --skip | --abort
DESCRIPTION
-----------
-If <branch> is specified, git-rebase will perform an automatic
+If <branch> is specified, `git-rebase` will perform an automatic
`git checkout <branch>` before doing anything else. Otherwise
it remains on the current branch.
@@ -52,8 +52,8 @@ Assume the following history exists and the current branch is "topic":
From this point, the result of either of the following commands:
- git-rebase master
- git-rebase master topic
+ git rebase master
+ git rebase master topic
would be:
@@ -68,7 +68,7 @@ followed by `git rebase master`.
If the upstream branch already contains a change you have made (e.g.,
because you mailed a patch which was applied upstream), then that commit
-will be skipped. For example, running `git-rebase master` on the
+will be skipped. For example, running `git rebase master` on the
following history (in which A' and A introduce the same set of changes,
but have different committer information):
@@ -116,7 +116,7 @@ got merged into more stable 'master' branch, like this:
We can get this using the following command:
- git-rebase --onto master next topic
+ git rebase --onto master next topic
Another example of --onto option is to rebase part of a
@@ -132,7 +132,7 @@ branch. If we have the following situation:
then the command
- git-rebase --onto master topicA topicB
+ git rebase --onto master topicA topicB
would result in:
@@ -155,7 +155,7 @@ the following situation:
then the command
- git-rebase --onto topicA~5 topicA~3 topicA
+ git rebase --onto topicA~5 topicA~3 topicA
would result in the removal of commits F and G:
@@ -167,8 +167,8 @@ This is useful if F and G were flawed in some way, or should not be
part of topicA. Note that the argument to --onto and the <upstream>
parameter can be any valid commit-ish.
-In case of conflict, git-rebase will stop at the first problematic commit
-and leave conflict markers in the tree. You can use git diff to locate
+In case of conflict, `git-rebase` will stop at the first problematic commit
+and leave conflict markers in the tree. You can use `git-diff` to locate
the markers (<<<<<<) and make edits to resolve the conflict. For each
file you edit, you need to tell git that the conflict has been resolved,
typically this would be done with
@@ -184,7 +184,7 @@ desired resolution, you can continue the rebasing process with
git rebase --continue
-Alternatively, you can undo the git-rebase with
+Alternatively, you can undo the `git-rebase` with
git rebase --abort
@@ -364,34 +364,34 @@ SPLITTING COMMITS
-----------------
In interactive mode, you can mark commits with the action "edit". However,
-this does not necessarily mean that 'git rebase' expects the result of this
+this does not necessarily mean that `git-rebase` expects the result of this
edit to be exactly one commit. Indeed, you can undo the commit, or you can
add other commits. This can be used to split a commit into two:
-- Start an interactive rebase with 'git rebase -i <commit>^', where
+- Start an interactive rebase with `git rebase -i <commit>^`, where
<commit> is the commit you want to split. In fact, any commit range
will do, as long as it contains that commit.
- Mark the commit you want to split with the action "edit".
-- When it comes to editing that commit, execute 'git reset HEAD^'. The
+- When it comes to editing that commit, execute `git reset HEAD^`. The
effect is that the HEAD is rewound by one, and the index follows suit.
However, the working tree stays the same.
- Now add the changes to the index that you want to have in the first
- commit. You can use linkgit:git-add[1] (possibly interactively) and/or
- linkgit:git-gui[1] to do that.
+ commit. You can use `git add` (possibly interactively) or
+ `git-gui` (or both) to do that.
- Commit the now-current index with whatever commit message is appropriate
now.
- Repeat the last two steps until your working tree is clean.
-- Continue the rebase with 'git rebase --continue'.
+- Continue the rebase with `git rebase --continue`.
If you are not absolutely sure that the intermediate revisions are
consistent (they compile, pass the testsuite, etc.) you should use
-linkgit:git-stash[1] to stash away the not-yet-committed changes
+`git-stash` to stash away the not-yet-committed changes
after each commit, test, and amend the commit if fixes are necessary.
diff --git a/Documentation/git-receive-pack.txt b/Documentation/git-receive-pack.txt
index a70c7168f6..207684d1c1 100644
--- a/Documentation/git-receive-pack.txt
+++ b/Documentation/git-receive-pack.txt
@@ -8,27 +8,27 @@ git-receive-pack - Receive what is pushed into the repository
SYNOPSIS
--------
-'git-receive-pack' <directory>
+'git receive-pack' <directory>
DESCRIPTION
-----------
-Invoked by 'git-send-pack' and updates the repository with the
+Invoked by `git-send-pack` and updates the repository with the
information fed from the remote end.
This command is usually not invoked directly by the end user.
-The UI for the protocol is on the 'git-send-pack' side, and the
+The UI for the protocol is on the `git-send-pack` side, and the
program pair is meant to be used to push updates to remote
-repository. For pull operations, see 'git-fetch-pack'.
+repository. For pull operations, see linkgit:git-fetch-pack[1].
The command allows for creation and fast forwarding of sha1 refs
(heads/tags) on the remote end (strictly speaking, it is the
-local end receive-pack runs, but to the user who is sitting at
+local end `git-receive-pack` runs, but to the user who is sitting at
the send-pack end, it is updating the remote. Confused?)
There are other real-world examples of using update and
post-update hooks found in the Documentation/howto directory.
-git-receive-pack honours the receive.denyNonFastForwards config
+`git-receive-pack` honours the receive.denyNonFastForwards config
option, which tells it if updates to a ref should be denied if they
are not fast-forwards.
@@ -111,10 +111,10 @@ ref listing the commits pushed to the repository:
if expr "$oval" : '0*$' >/dev/null
then
echo "Created a new ref, with the following commits:"
- git-rev-list --pretty "$nval"
+ git rev-list --pretty "$nval"
else
echo "New commits:"
- git-rev-list --pretty "$nval" "^$oval"
+ git rev-list --pretty "$nval" "^$oval"
fi |
mail -s "Changes to ref $ref" commit-list@mydomain
done
@@ -125,7 +125,7 @@ non-zero exit code will generate an error message.
Note that it is possible for refname to not have sha1-new when this
hook runs. This can easily occur if another user modifies the ref
-after it was updated by receive-pack, but before the hook was able
+after it was updated by `git-receive-pack`, but before the hook was able
to evaluate it. It is recommended that hooks rely on sha1-new
rather than the current value of refname.
@@ -137,14 +137,14 @@ post-update will called with the list of refs that have been updated.
This can be used to implement any repository wide cleanup tasks.
The exit code from this hook invocation is ignored; the only thing
-left for git-receive-pack to do at that point is to exit itself
+left for `git-receive-pack` to do at that point is to exit itself
anyway.
-This hook can be used, for example, to run "git-update-server-info"
+This hook can be used, for example, to run `git update-server-info`
if the repository is packed and is served via a dumb transport.
#!/bin/sh
- exec git-update-server-info
+ exec git update-server-info
SEE ALSO
diff --git a/Documentation/git-relink.txt b/Documentation/git-relink.txt
index f6dafd4495..25ff8f9dcb 100644
--- a/Documentation/git-relink.txt
+++ b/Documentation/git-relink.txt
@@ -7,7 +7,7 @@ git-relink - Hardlink common objects in local repositories
SYNOPSIS
--------
-'git-relink' [--safe] <dir> [<dir>]\* <master_dir>
+'git relink' [--safe] <dir> [<dir>]\* <master_dir>
DESCRIPTION
-----------
diff --git a/Documentation/git-remote.txt b/Documentation/git-remote.txt
index 345943a264..32db0aed11 100644
--- a/Documentation/git-remote.txt
+++ b/Documentation/git-remote.txt
@@ -9,12 +9,12 @@ git-remote - manage set of tracked repositories
SYNOPSIS
--------
[verse]
-'git-remote' [-v | --verbose]
-'git-remote' add [-t <branch>] [-m <master>] [-f] [--mirror] <name> <url>
-'git-remote' rm <name>
-'git-remote' show [-n] <name>
-'git-remote' prune [-n | --dry-run] <name>
-'git-remote' update [group]
+'git remote' [-v | --verbose]
+'git remote' add [-t <branch>] [-m <master>] [-f] [--mirror] <name> <url>
+'git remote' rm <name>
+'git remote' show [-n] <name>
+'git remote' prune [-n | --dry-run] <name>
+'git remote' update [group]
DESCRIPTION
-----------
diff --git a/Documentation/git-repack.txt b/Documentation/git-repack.txt
index 04d6f1fbc4..0d72e83023 100644
--- a/Documentation/git-repack.txt
+++ b/Documentation/git-repack.txt
@@ -8,7 +8,7 @@ git-repack - Pack unpacked objects in a repository
SYNOPSIS
--------
-'git-repack' [-a] [-A] [-d] [-f] [-l] [-n] [-q] [--window=N] [--depth=N]
+'git repack' [-a] [-A] [-d] [-f] [-l] [-n] [-q] [--window=N] [--depth=N]
DESCRIPTION
-----------
@@ -47,28 +47,29 @@ OPTIONS
deleted by way of being left in the old pack and then
removed. Instead, the loose unreachable objects
will be pruned according to normal expiry rules
- with the next linkgit:git-gc[1].
+ with the next `git-gc` invocation. See linkgit:git-gc[1].
-d::
After packing, if the newly created packs make some
existing packs redundant, remove the redundant packs.
- Also runs linkgit:git-prune-packed[1].
+ Also run `git-prune-packed` to remove redundant
+ loose object files.
-l::
- Pass the `--local` option to `git pack-objects`, see
+ Pass the `--local` option to `git-pack-objects`. See
linkgit:git-pack-objects[1].
-f::
- Pass the `--no-reuse-delta` option to `git pack-objects`, see
+ Pass the `--no-reuse-delta` option to `git-pack-objects`. See
linkgit:git-pack-objects[1].
-q::
- Pass the `-q` option to `git pack-objects`, see
+ Pass the `-q` option to `git-pack-objects`. See
linkgit:git-pack-objects[1].
-n::
Do not update the server information with
- `git update-server-info`. This option skips
+ `git-update-server-info`. This option skips
updating local catalog files needed to publish
this repository (or a direct copy of it)
over HTTP or FTP. See gitlink:git-update-server-info[1].
diff --git a/Documentation/git-repo-config.txt b/Documentation/git-repo-config.txt
index 2ca39946b7..e5bdb5533e 100644
--- a/Documentation/git-repo-config.txt
+++ b/Documentation/git-repo-config.txt
@@ -8,7 +8,7 @@ git-repo-config - Get and set repository or global options
SYNOPSIS
--------
-'git-repo-config' ...
+'git repo-config' ...
DESCRIPTION
diff --git a/Documentation/git-request-pull.txt b/Documentation/git-request-pull.txt
index c71d86985e..ca6843032a 100644
--- a/Documentation/git-request-pull.txt
+++ b/Documentation/git-request-pull.txt
@@ -7,7 +7,7 @@ git-request-pull - Generates a summary of pending changes
SYNOPSIS
--------
-'git-request-pull' <start> <url> [<end>]
+'git request-pull' <start> <url> [<end>]
DESCRIPTION
-----------
diff --git a/Documentation/git-rerere.txt b/Documentation/git-rerere.txt
index 8030ec4d01..3458029042 100644
--- a/Documentation/git-rerere.txt
+++ b/Documentation/git-rerere.txt
@@ -7,7 +7,7 @@ git-rerere - Reuse recorded resolution of conflicted merges
SYNOPSIS
--------
-'git-rerere' [clear|diff|status|gc]
+'git rerere' [clear|diff|status|gc]
DESCRIPTION
-----------
@@ -30,22 +30,22 @@ enable this command.
COMMANDS
--------
-Normally, git-rerere is run without arguments or user-intervention.
+Normally, `git-rerere` is run without arguments or user-intervention.
However, it has several commands that allow it to interact with
its working state.
'clear'::
This resets the metadata used by rerere if a merge resolution is to be
-is aborted. Calling linkgit:git-am[1] --skip or linkgit:git-rebase[1]
-[--skip|--abort] will automatically invoke this command.
+is aborted. Calling `git-am --skip` or `git-rebase [--skip|--abort]`
+will automatically invoke this command.
'diff'::
This displays diffs for the current state of the resolution. It is
useful for tracking what has changed while the user is resolving
conflicts. Additional arguments are passed directly to the system
-diff(1) command installed in PATH.
+`diff` command installed in PATH.
'status'::
@@ -146,7 +146,7 @@ blew away. `git-rerere` command helps you to resolve this final
conflicted merge using the information from your earlier hand
resolve.
-Running `git-rerere` command immediately after a conflicted
+Running the `git-rerere` command immediately after a conflicted
automerge records the conflicted working tree files, with the
usual conflict markers `<<<<<<<`, `=======`, and `>>>>>>>` in
them. Later, after you are done resolving the conflicts,
@@ -198,7 +198,7 @@ you could run `git rebase master topic`, to keep yourself
up-to-date even before your topic is ready to be sent upstream.
This would result in falling back to three-way merge, and it
would conflict the same way the test merge you resolved earlier.
-`git-rerere` is run by `git rebase` to help you resolve this
+`git-rerere` is run by `git-rebase` to help you resolve this
conflict.
diff --git a/Documentation/git-reset.txt b/Documentation/git-reset.txt
index 12ea9b23c5..dc05f58f18 100644
--- a/Documentation/git-reset.txt
+++ b/Documentation/git-reset.txt
@@ -37,7 +37,7 @@ OPTIONS
--soft::
Does not touch the index file nor the working tree at all, but
requires them to be in a good order. This leaves all your changed
- files "Changes to be committed", as linkgit:git-status[1] would
+ files "Changes to be committed", as `git-status` would
put it.
--hard::
diff --git a/Documentation/git-rev-list.txt b/Documentation/git-rev-list.txt
index c9b0950321..e7d736ffa4 100644
--- a/Documentation/git-rev-list.txt
+++ b/Documentation/git-rev-list.txt
@@ -59,7 +59,7 @@ stop at that point. Their parents are implied. Thus the following
command:
-----------------------------------------------------------------------
- $ git-rev-list foo bar ^baz
+ $ git rev-list foo bar ^baz
-----------------------------------------------------------------------
means "list all the commits which are included in 'foo' and 'bar', but
@@ -70,8 +70,8 @@ short-hand for "{caret}'<commit1>' '<commit2>'". For example, either of
the following may be used interchangeably:
-----------------------------------------------------------------------
- $ git-rev-list origin..HEAD
- $ git-rev-list HEAD ^origin
+ $ git rev-list origin..HEAD
+ $ git rev-list HEAD ^origin
-----------------------------------------------------------------------
Another special notation is "'<commit1>'...'<commit2>'" which is useful
@@ -79,15 +79,15 @@ for merges. The resulting set of commits is the symmetric difference
between the two operands. The following two commands are equivalent:
-----------------------------------------------------------------------
- $ git-rev-list A B --not $(git-merge-base --all A B)
- $ git-rev-list A...B
+ $ git rev-list A B --not $(git merge-base --all A B)
+ $ git rev-list A...B
-----------------------------------------------------------------------
-linkgit:git-rev-list[1] is a very essential git program, since it
+`git-rev-list` is a very essential git program, since it
provides the ability to build and traverse commit ancestry graphs. For
this reason, it has a lot of different options that enables it to be
-used by commands as different as linkgit:git-bisect[1] and
-linkgit:git-repack[1].
+used by commands as different as `git-bisect` and
+`git-repack`.
OPTIONS
-------
diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt
index 9e273bc5a6..6825ae27c4 100644
--- a/Documentation/git-rev-parse.txt
+++ b/Documentation/git-rev-parse.txt
@@ -8,15 +8,15 @@ git-rev-parse - Pick out and massage parameters
SYNOPSIS
--------
-'git-rev-parse' [ --option ] <args>...
+'git rev-parse' [ --option ] <args>...
DESCRIPTION
-----------
Many git porcelainish commands take mixture of flags
(i.e. parameters that begin with a dash '-') and parameters
-meant for underlying `git-rev-list` command they use internally
-and flags and parameters for other commands they use as the
+meant for the underlying `git-rev-list` command they use internally
+and flags and parameters for the other commands they use
downstream of `git-rev-list`. This command is used to
distinguish between them.
@@ -128,13 +128,13 @@ OPTIONS
--since=datestring::
--after=datestring::
- Parses the date string, and outputs corresponding
- --max-age= parameter for git-rev-list command.
+ Parse the date string, and output the corresponding
+ --max-age= parameter for `git-rev-list`.
--until=datestring::
--before=datestring::
- Parses the date string, and outputs corresponding
- --min-age= parameter for git-rev-list command.
+ Parse the date string, and output the corresponding
+ --min-age= parameter for `git-rev-list`.
<args>...::
Flags and parameters to be parsed.
@@ -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
@@ -293,7 +296,7 @@ reachable from `r1` from the set of commits reachable from
A similar notation "`r1\...r2`" is called symmetric difference
of `r1` and `r2` and is defined as
-"`r1 r2 --not $(git-merge-base --all r1 r2)`".
+"`r1 r2 --not $(git merge-base --all r1 r2)`".
It is the set of commits that are reachable from either one of
`r1` or `r2` but not from both.
@@ -381,7 +384,7 @@ bar= some cool option --bar with an argument
An option group Header
C? option C with an optional argument"
-eval `echo "$OPTS_SPEC" | git-rev-parse --parseopt -- "$@" || echo exit $?`
+eval `echo "$OPTS_SPEC" | git rev-parse --parseopt -- "$@" || echo exit $?`
------------
EXAMPLES
diff --git a/Documentation/git-revert.txt b/Documentation/git-revert.txt
index 5b49b81386..3d0c5aba93 100644
--- a/Documentation/git-revert.txt
+++ b/Documentation/git-revert.txt
@@ -7,7 +7,7 @@ git-revert - Revert an existing commit
SYNOPSIS
--------
-'git-revert' [--edit | --no-edit] [-n] [-m parent-number] [-s] <commit>
+'git revert' [--edit | --no-edit] [-n] [-m parent-number] [-s] <commit>
DESCRIPTION
-----------
diff --git a/Documentation/git-rm.txt b/Documentation/git-rm.txt
index d88554bedc..01b63be385 100644
--- a/Documentation/git-rm.txt
+++ b/Documentation/git-rm.txt
@@ -7,12 +7,12 @@ git-rm - Remove files from the working tree and from the index
SYNOPSIS
--------
-'git-rm' [-f] [-n] [-r] [--cached] [--ignore-unmatch] [--quiet] [--] <file>...
+'git rm' [-f] [-n] [-r] [--cached] [--ignore-unmatch] [--quiet] [--] <file>...
DESCRIPTION
-----------
Remove files from the index, or from the working tree and the index.
-`git rm` will not remove a file from just your working directory.
+`git-rm` will not remove a file from just your working directory.
(There is no option to remove a file only from the work tree
and yet keep it in the index; use `/bin/rm` if you want to do that.)
The files being removed have to be identical to the tip of the branch,
@@ -63,7 +63,7 @@ OPTIONS
-q::
--quiet::
- git-rm normally outputs one line (in the form of an "rm" command)
+ `git-rm` normally outputs one line (in the form of an "rm" command)
for each file removed. This option suppresses that output.
@@ -82,7 +82,7 @@ also remove all of directory `d2`.
EXAMPLES
--------
-git-rm Documentation/\\*.txt::
+git rm Documentation/\\*.txt::
Removes all `\*.txt` files from the index that are under the
`Documentation` directory and any of its subdirectories.
+
@@ -90,7 +90,7 @@ Note that the asterisk `\*` is quoted from the shell in this
example; this lets git, and not the shell, expand the pathnames
of files and subdirectories under the `Documentation/` directory.
-git-rm -f git-*.sh::
+git rm -f git-*.sh::
Because this example lets the shell expand the asterisk
(i.e. you are listing the files explicitly), it
does not remove `subdir/git-foo.sh`.
diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 251d661afd..afbb294a7f 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -8,7 +8,7 @@ git-send-email - Send a collection of patches as emails
SYNOPSIS
--------
-'git-send-email' [options] <file|directory> [... file|directory]
+'git send-email' [options] <file|directory> [... file|directory]
@@ -133,10 +133,13 @@ or on the command line. If a username has been specified (with
specified (with --smtp-pass or a configuration variable), then the
user is prompted for a password while the input is masked for privacy.
+--smtp-encryption::
+ Specify the encryption to use, either 'ssl' or 'tls'. Any other
+ value reverts to plain SMTP. Default is the value of
+ 'sendemail.smtpencryption'.
+
--smtp-ssl::
- If set, connects to the SMTP server using SSL.
- Default is the value of the 'sendemail.smtpssl' configuration value;
- if that is unspecified, does not use SSL.
+ Legacy alias for '--smtp-encryption=ssl'.
--subject::
Specify the initial subject of the email thread.
@@ -229,8 +232,13 @@ sendemail.smtpuser::
sendemail.smtppass::
Default SMTP-AUTH password.
+sendemail.smtpencryption::
+ Default encryption method. Use 'ssl' for SSL (and specify an
+ appropriate port), or 'tls' for TLS. Takes precedence over
+ 'smtpssl' if both are specified.
+
sendemail.smtpssl::
- Boolean value specifying the default to the '--smtp-ssl' parameter.
+ Legacy boolean that sets 'smtpencryption=ssl' if enabled.
Author
------
diff --git a/Documentation/git-send-pack.txt b/Documentation/git-send-pack.txt
index ba2fdaec08..410504df46 100644
--- a/Documentation/git-send-pack.txt
+++ b/Documentation/git-send-pack.txt
@@ -8,21 +8,21 @@ git-send-pack - Push objects over git protocol to another repository
SYNOPSIS
--------
-'git-send-pack' [--all] [--dry-run] [--force] [--receive-pack=<git-receive-pack>] [--verbose] [--thin] [<host>:]<directory> [<ref>...]
+'git send-pack' [--all] [--dry-run] [--force] [--receive-pack=<git-receive-pack>] [--verbose] [--thin] [<host>:]<directory> [<ref>...]
DESCRIPTION
-----------
-Usually you would want to use linkgit:git-push[1] which is a
-higher level wrapper of this command instead.
+Usually you would want to use `git-push`, which is a
+higher-level wrapper of this command, instead. See linkgit:git-push[1].
-Invokes 'git-receive-pack' on a possibly remote repository, and
+Invokes `git-receive-pack` on a possibly remote repository, and
updates it from the current repository, sending named refs.
OPTIONS
-------
--receive-pack=<git-receive-pack>::
- Path to the 'git-receive-pack' program on the remote
+ Path to the `git-receive-pack` program on the remote
end. Sometimes useful when pushing to a remote
repository over ssh, and you do not have the program in
a directory on the default $PATH.
@@ -53,7 +53,7 @@ OPTIONS
<host>::
A remote host to house the repository. When this
- part is specified, 'git-receive-pack' is invoked via
+ part is specified, `git-receive-pack` is invoked via
ssh.
<directory>::
@@ -86,8 +86,8 @@ and the destination side (after the colon). The ref to be
pushed is determined by finding a match that matches the source
side, and where it is pushed is determined by using the
destination side. The rules used to match a ref are the same
-rules used by linkgit:git-rev-parse[1] to resolve a symbolic ref
-name.
+rules used by `git-rev-parse` to resolve a symbolic ref
+name. See linkgit:git-rev-parse[1].
- It is an error if <src> does not match exactly one of the
local refs.
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-shell.txt b/Documentation/git-shell.txt
index bd09196acc..9b2ae7f268 100644
--- a/Documentation/git-shell.txt
+++ b/Documentation/git-shell.txt
@@ -8,7 +8,7 @@ git-shell - Restricted login shell for GIT-only SSH access
SYNOPSIS
--------
-'git-shell' -c <command> <argument>
+'$(git --exec-path)/git-shell' -c <command> <argument>
DESCRIPTION
-----------
diff --git a/Documentation/git-shortlog.txt b/Documentation/git-shortlog.txt
index daa64d4d81..6e4cbc4fdd 100644
--- a/Documentation/git-shortlog.txt
+++ b/Documentation/git-shortlog.txt
@@ -8,12 +8,12 @@ git-shortlog - Summarize 'git log' output
SYNOPSIS
--------
[verse]
-git-log --pretty=short | 'git-shortlog' [-h] [-n] [-s] [-e] [-w]
-git-shortlog [-n|--numbered] [-s|--summary] [-e|--email] [-w[<width>[,<indent1>[,<indent2>]]]] [<committish>...]
+git log --pretty=short | 'git shortlog' [-h] [-n] [-s] [-e] [-w]
+git shortlog [-n|--numbered] [-s|--summary] [-e|--email] [-w[<width>[,<indent1>[,<indent2>]]]] [<committish>...]
DESCRIPTION
-----------
-Summarizes 'git log' output in a format suitable for inclusion
+Summarizes `git-log` output in a format suitable for inclusion
in release announcements. Each commit will be grouped by author and
the first line of the commit message will be shown.
diff --git a/Documentation/git-show-branch.txt b/Documentation/git-show-branch.txt
index de9e8f885f..578bdb7850 100644
--- a/Documentation/git-show-branch.txt
+++ b/Documentation/git-show-branch.txt
@@ -8,10 +8,10 @@ git-show-branch - Show branches and their commits
SYNOPSIS
--------
[verse]
-'git-show-branch' [--all] [--remotes] [--topo-order] [--current]
+'git show-branch' [--all] [--remotes] [--topo-order] [--current]
[--more=<n> | --list | --independent | --merge-base]
[--no-name | --sha1-name] [--topics] [<rev> | <glob>]...
-'git-show-branch' (-g|--reflog)[=<n>[,<base>]] [--list] [<ref>]
+'git show-branch' (-g|--reflog)[=<n>[,<base>]] [--list] [<ref>]
DESCRIPTION
-----------
@@ -29,7 +29,7 @@ no <rev> nor <glob> is given on the command line.
OPTIONS
-------
<rev>::
- Arbitrary extended SHA1 expression (see `git-rev-parse`)
+ Arbitrary extended SHA1 expression (see linkgit:git-rev-parse[1])
that typically names a branch HEAD or a tag.
<glob>::
@@ -75,7 +75,7 @@ OPTIONS
--merge-base::
Instead of showing the commit list, just act like the
- 'git-merge-base -a' command, except that it can accept
+ `git-merge-base -a` command, except that it can accept
more than two heads.
--independent::
diff --git a/Documentation/git-show-index.txt b/Documentation/git-show-index.txt
index 891f0eff27..4ae6ede11e 100644
--- a/Documentation/git-show-index.txt
+++ b/Documentation/git-show-index.txt
@@ -8,16 +8,16 @@ git-show-index - Show packed archive index
SYNOPSIS
--------
-'git-show-index' < idx-file
+'git show-index' < idx-file
DESCRIPTION
-----------
Reads given idx file for packed git archive created with
-git-pack-objects command, and dumps its contents.
+`git-pack-objects` command, and dumps its contents.
The information it outputs is subset of what you can get from
-'git-verify-pack -v'; this command only shows the packfile
+`git-verify-pack -v`; this command only shows the packfile
offset and SHA1 of each object.
diff --git a/Documentation/git-show-ref.txt b/Documentation/git-show-ref.txt
index 6b99529b6b..a78a7dcf7a 100644
--- a/Documentation/git-show-ref.txt
+++ b/Documentation/git-show-ref.txt
@@ -8,9 +8,9 @@ git-show-ref - List references in a local repository
SYNOPSIS
--------
[verse]
-'git-show-ref' [-q|--quiet] [--verify] [-h|--head] [-d|--dereference]
+'git show-ref' [-q|--quiet] [--verify] [-h|--head] [-d|--dereference]
[-s|--hash] [--abbrev] [--tags] [--heads] [--] <pattern>...
-'git-show-ref' --exclude-existing[=pattern]
+'git show-ref' --exclude-existing[=pattern]
DESCRIPTION
-----------
@@ -74,7 +74,7 @@ OPTIONS
--exclude-existing::
--exclude-existing=pattern::
- Make git-show-ref act as a filter that reads refs from stdin of the
+ Make `git-show-ref` act as a filter that reads refs from stdin of the
form "^(?:<anything>\s)?<refname>(?:\^\{\})?$" and performs the
following actions on each:
(1) strip "^{}" at the end of line if any;
@@ -137,14 +137,14 @@ When using the '--verify' flag, the command requires an exact path:
will only match the exact branch called "master".
-If nothing matches, linkgit:git-show-ref[1] will return an error code of 1,
+If nothing matches, `git-show-ref` will return an error code of 1,
and in the case of verification, it will show an error message.
For scripting, you can ask it to be quiet with the "--quiet" flag, which
allows you to do things like
-----------------------------------------------------------------------------
- git-show-ref --quiet --verify -- "refs/heads/$headname" ||
+ git show-ref --quiet --verify -- "refs/heads/$headname" ||
echo "$headname is not a valid branch"
-----------------------------------------------------------------------------
diff --git a/Documentation/git-show.txt b/Documentation/git-show.txt
index baaf2bc8fe..70b54aec2f 100644
--- a/Documentation/git-show.txt
+++ b/Documentation/git-show.txt
@@ -8,7 +8,7 @@ git-show - Show various types of objects
SYNOPSIS
--------
-'git-show' [options] <object>...
+'git show' [options] <object>...
DESCRIPTION
-----------
@@ -16,16 +16,16 @@ Shows one or more objects (blobs, trees, tags and commits).
For commits it shows the log message and textual diff. It also
presents the merge commit in a special format as produced by
-'git-diff-tree --cc'.
+`git-diff-tree --cc`.
For tags, it shows the tag message and the referenced objects.
-For trees, it shows the names (equivalent to linkgit:git-ls-tree[1]
+For trees, it shows the names (equivalent to `git-ls-tree`
with \--name-only).
For plain blobs, it shows the plain contents.
-The command takes options applicable to the linkgit:git-diff-tree[1] command to
+The command takes options applicable to the `git-diff-tree` command to
control how the changes the commit introduces are shown.
This manual page describes only the most frequently used options.
diff --git a/Documentation/git-stash.txt b/Documentation/git-stash.txt
index baa4f55b48..23ac331295 100644
--- a/Documentation/git-stash.txt
+++ b/Documentation/git-stash.txt
@@ -8,22 +8,22 @@ git-stash - Stash the changes in a dirty working directory away
SYNOPSIS
--------
[verse]
-'git-stash' (list | show [<stash>] | apply [<stash>] | clear | drop [<stash>] | pop [<stash>])
-'git-stash' [save [<message>]]
+'git stash' (list | show [<stash>] | apply [<stash>] | clear | drop [<stash>] | pop [<stash>])
+'git stash' [save [<message>]]
DESCRIPTION
-----------
-Use 'git-stash' when you want to record the current state of the
+Use 'git stash' when you want to record the current state of the
working directory and the index, but want to go back to a clean
working directory. The command saves your local modifications away
and reverts the working directory to match the `HEAD` commit.
The modifications stashed away by this command can be listed with
-`git-stash list`, inspected with `git-stash show`, and restored
-(potentially on top of a different commit) with `git-stash apply`.
-Calling git-stash without any arguments is equivalent to `git-stash
-save`. A stash is by default listed as "WIP on 'branchname' ...", but
+`git stash list`, inspected with `git stash show`, and restored
+(potentially on top of a different commit) with `git stash apply`.
+Calling `git stash` without any arguments is equivalent to `git stash save`.
+A stash is by default listed as "WIP on 'branchname' ...", but
you can give a more descriptive message on the command line when
you create one.
@@ -38,7 +38,7 @@ OPTIONS
save [<message>]::
- Save your local modifications to a new 'stash', and run `git-reset
+ Save your local modifications to a new 'stash', and run `git reset
--hard` to revert them. This is the default action when no
subcommand is given. The <message> part is optional and gives
the description along with the stashed state.
@@ -56,15 +56,15 @@ stash@{0}: WIP on submit: 6ebd0e2... Update git-stash documentation
stash@{1}: On master: 9cc0589... Add git-stash
----------------------------------------------------------------
+
-The command takes options applicable to the linkgit:git-log[1]
-command to control what is shown and how.
+The command takes options applicable to the `git-log`
+command to control what is shown and how. See linkgit:git-log[1].
show [<stash>]::
Show the changes recorded in the stash as a diff between the
stashed state and its original parent. When no `<stash>` is given,
shows the latest one. By default, the command shows the diffstat, but
- it will accept any format known to `git-diff` (e.g., `git-stash show
+ it will accept any format known to `git-diff` (e.g., `git stash show
-p stash@\{1}` to view the second most recent stash in patch form).
apply [--index] [<stash>]::
diff --git a/Documentation/git-status.txt b/Documentation/git-status.txt
index fef62b16df..c9d4a046c7 100644
--- a/Documentation/git-status.txt
+++ b/Documentation/git-status.txt
@@ -8,7 +8,7 @@ git-status - Show the working tree status
SYNOPSIS
--------
-'git-status' <options>...
+'git status' <options>...
DESCRIPTION
-----------
@@ -17,7 +17,7 @@ current HEAD commit, paths that have differences between the working
tree and the index file, and paths in the working tree that are not
tracked by git (and are not ignored by linkgit:gitignore[5]). The first
are what you _would_ commit by running `git commit`; the second and
-third are what you _could_ commit by running `git add` before running
+third are what you _could_ commit by running `git-add` before running
`git commit`.
The command takes the same set of options as `git-commit`; it
@@ -26,7 +26,7 @@ shows what would be committed if the same options are given to
If there is no path that is different between the index file and
the current HEAD commit (i.e., there is nothing to commit by running
-`git-commit`), the command exits with non-zero status.
+`git commit`), the command exits with non-zero status.
OUTPUT
diff --git a/Documentation/git-stripspace.txt b/Documentation/git-stripspace.txt
index 8421a39f26..7508c0e42d 100644
--- a/Documentation/git-stripspace.txt
+++ b/Documentation/git-stripspace.txt
@@ -8,7 +8,7 @@ git-stripspace - Filter out empty lines
SYNOPSIS
--------
-'git-stripspace' [-s | --strip-comments] < <stream>
+'git stripspace' [-s | --strip-comments] < <stream>
DESCRIPTION
-----------
diff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt
index 441ae1483b..9c4052c58a 100644
--- a/Documentation/git-submodule.txt
+++ b/Documentation/git-submodule.txt
@@ -9,11 +9,11 @@ git-submodule - Initialize, update or inspect submodules
SYNOPSIS
--------
[verse]
-'git-submodule' [--quiet] add [-b branch] [--] <repository> [<path>]
-'git-submodule' [--quiet] status [--cached] [--] [<path>...]
-'git-submodule' [--quiet] init [--] [<path>...]
-'git-submodule' [--quiet] update [--init] [--] [<path>...]
-'git-submodule' [--quiet] summary [--summary-limit <n>] [commit] [--] [<path>...]
+'git submodule' [--quiet] add [-b branch] [--] <repository> [<path>]
+'git submodule' [--quiet] status [--cached] [--] [<path>...]
+'git submodule' [--quiet] init [--] [<path>...]
+'git submodule' [--quiet] update [--init] [--] [<path>...]
+'git submodule' [--quiet] summary [--summary-limit <n>] [commit] [--] [<path>...]
COMMANDS
@@ -32,11 +32,11 @@ add::
status::
Show the status of the submodules. This will print the SHA-1 of the
currently checked out commit for each submodule, along with the
- submodule path and the output of linkgit:git-describe[1] for the
+ submodule path and the output of `git-describe` for the
SHA-1. Each SHA-1 will be prefixed with `-` if the submodule is not
initialized and `+` if the currently checked out submodule commit
does not match the SHA-1 found in the index of the containing
- repository. This command is the default command for git-submodule.
+ repository. This command is the default command for `git-submodule`.
init::
Initialize the submodules, i.e. register in .git/config each submodule
diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
index f4cbd2f212..6caa130611 100644
--- a/Documentation/git-svn.txt
+++ b/Documentation/git-svn.txt
@@ -7,21 +7,21 @@ git-svn - Bidirectional operation between a single Subversion branch and git
SYNOPSIS
--------
-'git-svn' <command> [options] [arguments]
+'git svn' <command> [options] [arguments]
DESCRIPTION
-----------
-git-svn is a simple conduit for changesets between Subversion and git.
+`git-svn` is a simple conduit for changesets between Subversion and git.
It is not to be confused with linkgit:git-svnimport[1], which is
read-only.
-git-svn was originally designed for an individual developer who wants a
+`git-svn` was originally designed for an individual developer who wants a
bidirectional flow of changesets between a single branch in Subversion
and an arbitrary number of branches in git. Since its inception,
-git-svn has gained the ability to track multiple branches in a manner
-similar to git-svnimport.
+`git-svn` has gained the ability to track multiple branches in a manner
+similar to `git-svnimport`.
-git-svn is especially useful when it comes to tracking repositories
+`git-svn` is especially useful when it comes to tracking repositories
not organized in the way Subversion developers recommend (trunk,
branches, tags directories).
@@ -31,7 +31,7 @@ COMMANDS
'init'::
Initializes an empty git repository with additional
- metadata directories for git-svn. The Subversion URL
+ metadata directories for `git-svn`. The Subversion URL
may be specified as a command-line argument, or as full
URL arguments to -T/-t/-b. Optionally, the target
directory to operate on can be specified as a second
@@ -107,20 +107,20 @@ COMMANDS
This fetches revisions from the SVN parent of the current HEAD
and rebases the current (uncommitted to SVN) work against it.
-This works similarly to 'svn update' or 'git-pull' except that
-it preserves linear history with 'git-rebase' instead of
-'git-merge' for ease of dcommiting with git-svn.
+This works similarly to `svn update` or `git-pull` except that
+it preserves linear history with `git-rebase` instead of
+`git-merge` for ease of dcommiting with `git-svn`.
-This accepts all options that 'git-svn fetch' and 'git-rebase'
-accepts. However '--fetch-all' only fetches from the current
+This accepts all options that `git-svn fetch` and `git-rebase`
+accept. However, '--fetch-all' only fetches from the current
[svn-remote], and not all [svn-remote] definitions.
-Like 'git-rebase'; this requires that the working tree be clean
+Like `git-rebase`; this requires that the working tree be clean
and have no uncommitted changes.
-l;;
--local;;
- Do not fetch remotely; only run 'git-rebase' against the
+ Do not fetch remotely; only run `git-rebase` against the
last fetched commit from the upstream SVN.
'dcommit'::
@@ -128,7 +128,7 @@ and have no uncommitted changes.
repository, and then rebase or reset (depending on whether or
not there is a diff between SVN and head). This will create
a revision in SVN for each commit in git.
- It is recommended that you run git-svn fetch and rebase (not
+ It is recommended that you run `git-svn` fetch and rebase (not
pull or merge) your commits against the latest changes in the
SVN repository.
An optional command-line argument may be specified as an
@@ -173,7 +173,7 @@ NOTE: SVN itself only stores times in UTC and nothing else. The regular svn
client converts the UTC time to the local time (or based on the TZ=
environment). This command has the same behaviour.
+
-Any other arguments are passed directly to `git log'
+Any other arguments are passed directly to `git-log`
'blame'::
Show what revision and author last modified each line of a file. The
@@ -181,10 +181,10 @@ Any other arguments are passed directly to `git log'
`svn blame' by default. Like the SVN blame command,
local uncommitted changes in the working copy are ignored;
the version of the file in the HEAD revision is annotated. Unknown
- arguments are passed directly to git-blame.
+ arguments are passed directly to `git-blame`.
+
--git-format;;
- Produce output in the same format as `git blame', but with
+ Produce output in the same format as `git-blame`, but with
SVN revision numbers instead of git commit hashes. In this mode,
changes that haven't been committed to SVN (including local
working-copy edits) are shown as revision 0.
@@ -203,7 +203,7 @@ Any other arguments are passed directly to `git log'
absolutely no attempts to do patching when committing to SVN, it
simply overwrites files with those specified in the tree or
commit. All merging is assumed to have taken place
- independently of git-svn functions.
+ independently of `git-svn` functions.
'create-ignore'::
Recursively finds the svn:ignore property on directories and
@@ -219,12 +219,12 @@ Any other arguments are passed directly to `git log'
'commit-diff'::
Commits the diff of two tree-ish arguments from the
command-line. This command is intended for interoperability with
- git-svnimport and does not rely on being inside an git-svn
- init-ed repository. This command takes three arguments, (a) the
+ `git-svnimport` and does not rely on being inside an `git-svn
+ init`-ed repository. This command takes three arguments, (a) the
original tree to diff against, (b) the new tree result, (c) the
URL of the target Subversion repository. The final argument
- (URL) may be omitted if you are working from a git-svn-aware
- repository (that has been init-ed with git-svn).
+ (URL) may be omitted if you are working from a `git-svn`-aware
+ repository (that has been `init`-ed with `git-svn`).
The -r<revision> option is required for this.
'info'::
@@ -255,7 +255,7 @@ OPTIONS
--shared[={false|true|umask|group|all|world|everybody}]::
--template=<template_directory>::
Only used with the 'init' command.
- These are passed directly to linkgit:git-init[1].
+ These are passed directly to `git-init`.
-r <ARG>::
--revision <ARG>::
@@ -277,7 +277,7 @@ Only used with the 'set-tree' command.
Read a list of commits from stdin and commit them in reverse
order. Only the leading sha1 is read from each line, so
-git-rev-list --pretty=oneline output can be used.
+`git-rev-list --pretty=oneline` output can be used.
--rmdir::
@@ -307,7 +307,7 @@ config key: svn.edit
Only used with the 'dcommit', 'set-tree' and 'commit-diff' commands.
-They are both passed directly to git-diff-tree see
+They are both passed directly to `git-diff-tree`; see
linkgit:git-diff-tree[1] for more information.
[verse]
@@ -317,24 +317,24 @@ config key: svn.findcopiesharder
-A<filename>::
--authors-file=<filename>::
-Syntax is compatible with the files used by git-svnimport and
-git-cvsimport:
+Syntax is compatible with the files used by `git-svnimport` and
+`git-cvsimport`:
------------------------------------------------------------------------
loginname = Joe User <user@example.com>
------------------------------------------------------------------------
-If this option is specified and git-svn encounters an SVN
-committer name that does not exist in the authors-file, git-svn
+If this option is specified and `git-svn` encounters an SVN
+committer name that does not exist in the authors-file, `git-svn`
will abort operation. The user will then have to add the
-appropriate entry. Re-running the previous git-svn command
+appropriate entry. Re-running the previous `git-svn` command
after the authors-file is modified should continue operation.
config key: svn.authorsfile
-q::
--quiet::
- Make git-svn less verbose.
+ Make `git-svn` less verbose.
--repack[=<n>]::
--repack-flags=<flags>::
@@ -346,7 +346,7 @@ with many revisions.
to fetch before repacking. This defaults to repacking every
1000 commits fetched if no argument is specified.
---repack-flags are passed directly to linkgit:git-repack[1].
+--repack-flags are passed directly to `git-repack`.
[verse]
config key: svn.repack
@@ -359,8 +359,8 @@ config key: svn.repackflags
These are only used with the 'dcommit' and 'rebase' commands.
-Passed directly to git-rebase when using 'dcommit' if a
-'git-reset' cannot be used (see dcommit).
+Passed directly to `git-rebase` when using 'dcommit' if a
+`git-reset` cannot be used (see 'dcommit').
-n::
--dry-run::
@@ -411,20 +411,20 @@ CONFIG FILE-ONLY OPTIONS
svn.noMetadata::
svn-remote.<name>.noMetadata::
-This gets rid of the git-svn-id: lines at the end of every commit.
+This gets rid of the 'git-svn-id:' lines at the end of every commit.
-If you lose your .git/svn/git-svn/.rev_db file, git-svn will not
+If you lose your .git/svn/git-svn/.rev_db file, `git-svn` will not
be able to rebuild it and you won't be able to fetch again,
either. This is fine for one-shot imports.
-The 'git-svn log' command will not work on repositories using
+The `git-svn log` command will not work on repositories using
this, either. Using this conflicts with the 'useSvmProps'
option for (hopefully) obvious reasons.
svn.useSvmProps::
svn-remote.<name>.useSvmProps::
-This allows git-svn to re-map repository URLs and UUIDs from
+This allows `git-svn` to re-map repository URLs and UUIDs from
mirrors created using SVN::Mirror (or svk) for metadata.
If an SVN revision has a property, "svm:headrev", it is likely
@@ -443,20 +443,21 @@ svn-remote.<name>.useSvnsyncprops::
svn-remote.<name>.rewriteRoot::
This allows users to create repositories from alternate
- URLs. For example, an administrator could run git-svn on the
+ URLs. For example, an administrator could run `git-svn` on the
server locally (accessing via file://) but wish to distribute
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
+options all affect the metadata generated and used by `git-svn`; they
*must* be set in the configuration file before any history is imported
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
--------------
@@ -465,7 +466,7 @@ Tracking and contributing to the trunk of a Subversion-managed project:
------------------------------------------------------------------------
# Clone a repo (like git clone):
- git-svn clone http://svn.foo.org/project/trunk
+ git svn clone http://svn.foo.org/project/trunk
# Enter the newly cloned directory:
cd trunk
# You should be on master branch, double-check with git-branch
@@ -474,12 +475,12 @@ Tracking and contributing to the trunk of a Subversion-managed project:
git commit ...
# Something is committed to SVN, rebase your local changes against the
# latest changes in SVN:
- git-svn rebase
+ git svn rebase
# Now commit your changes (that were committed previously using git) to SVN,
# as well as automatically updating your working HEAD:
- git-svn dcommit
+ git svn dcommit
# Append svn:ignore settings to the default git exclude file:
- git-svn show-ignore >> .git/info/exclude
+ git svn show-ignore >> .git/info/exclude
------------------------------------------------------------------------
Tracking and contributing to an entire Subversion-managed project
@@ -487,7 +488,7 @@ Tracking and contributing to an entire Subversion-managed project
------------------------------------------------------------------------
# Clone a repo (like git clone):
- git-svn clone http://svn.foo.org/project -T trunk -b branches -t tags
+ git svn clone http://svn.foo.org/project -T trunk -b branches -t tags
# View all branches and tags you have cloned:
git branch -r
# Reset your master to trunk (or any other branch, replacing 'trunk'
@@ -497,48 +498,48 @@ Tracking and contributing to an entire Subversion-managed project
# of dcommit/rebase/show-ignore should be the same as above.
------------------------------------------------------------------------
-The initial 'git-svn clone' can be quite time-consuming
+The initial `git-svn clone` can be quite time-consuming
(especially for large Subversion repositories). If multiple
people (or one person with multiple machines) want to use
-git-svn to interact with the same Subversion repository, you can
-do the initial 'git-svn clone' to a repository on a server and
-have each person clone that repository with 'git clone':
+`git-svn` to interact with the same Subversion repository, you can
+do the initial `git-svn clone` to a repository on a server and
+have each person clone that repository with `git-clone`:
------------------------------------------------------------------------
# Do the initial import on a server
- ssh server "cd /pub && git-svn clone http://svn.foo.org/project
+ ssh server "cd /pub && git svn clone http://svn.foo.org/project
# Clone locally - make sure the refs/remotes/ space matches the server
mkdir project
cd project
- git-init
+ 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
+ git svn init http://svn.foo.org/project
# Pull the latest changes from Subversion
- git-svn rebase
+ git svn rebase
------------------------------------------------------------------------
REBASE VS. PULL/MERGE
---------------------
-Originally, git-svn recommended that the remotes/git-svn branch be
+Originally, `git-svn` recommended that the 'remotes/git-svn' branch be
pulled or merged from. This is because the author favored
-'git-svn set-tree B' to commit a single head rather than the
-'git-svn set-tree A..B' notation to commit multiple commits.
+`git svn set-tree B` to commit a single head rather than the
+`git svn set-tree A..B` notation to commit multiple commits.
-If you use 'git-svn set-tree A..B' to commit several diffs and you do
+If you use `git svn set-tree A..B` to commit several diffs and you do
not have the latest remotes/git-svn merged into my-branch, you should
-use 'git-svn rebase' to update your work branch instead of 'git pull' or
-'git merge'. 'pull/merge' can cause non-linear history to be flattened
+use `git svn rebase` to update your work branch instead of `git pull` or
+`git merge`. `pull`/`merge' can cause non-linear history to be flattened
when committing into SVN, which can lead to merge commits reversing
previous commits in SVN.
DESIGN PHILOSOPHY
-----------------
Merge tracking in Subversion is lacking and doing branched development
-with Subversion can be cumbersome as a result. While git-svn can track
+with Subversion can be cumbersome as a result. While `git-svn` can track
copy history (including branches and tags) for repositories adopting a
standard layout, it cannot yet represent merge history that happened
inside git back upstream to SVN users. Therefore it is advised that
@@ -549,30 +550,30 @@ CAVEATS
-------
For the sake of simplicity and interoperating with a less-capable system
-(SVN), it is recommended that all git-svn users clone, fetch and dcommit
-directly from the SVN server, and avoid all git-clone/pull/merge/push
+(SVN), it is recommended that all `git-svn` users clone, fetch and dcommit
+directly from the SVN server, and avoid all `git-clone`/`pull`/`merge`/`push`
operations between git repositories and branches. The recommended
method of exchanging code between git branches and users is
-git-format-patch and git-am, or just dcommiting to the SVN repository.
+`git-format-patch` and `git-am`, or just 'dcommit'ing to the SVN repository.
-Running 'git-merge' or 'git-pull' is NOT recommended on a branch you
-plan to dcommit from. Subversion does not represent merges in any
+Running `git-merge` or `git-pull` is NOT recommended on a branch you
+plan to 'dcommit' from. Subversion does not represent merges in any
reasonable or useful fashion; so users using Subversion cannot see any
merges you've made. Furthermore, if you merge or pull from a git branch
-that is a mirror of an SVN branch, dcommit may commit to the wrong
+that is a mirror of an SVN branch, 'dcommit' may commit to the wrong
branch.
-'git-clone' does not clone branches under the refs/remotes/ hierarchy or
-any git-svn metadata, or config. So repositories created and managed with
-using git-svn should use rsync(1) for cloning, if cloning is to be done
+`git-clone` does not clone branches under the refs/remotes/ hierarchy or
+any `git-svn` metadata, or config. So repositories created and managed with
+using `git-svn` should use `rsync` for cloning, if cloning is to be done
at all.
-Since 'dcommit' uses rebase internally, any git branches you git-push to
-before dcommit on will require forcing an overwrite of the existing ref
+Since 'dcommit' uses rebase internally, any git branches you `git-push` to
+before 'dcommit' on will require forcing an overwrite of the existing ref
on the remote repository. This is generally considered bad practice,
-see the git-push(1) documentation for details.
+see the linkgit:git-push[1] documentation for details.
-Do not use the --amend option of git-commit(1) on a change you've
+Do not use the --amend option of linkgit:git-commit[1] on a change you've
already dcommitted. It is considered bad practice to --amend commits
you've already pushed to a remote repository for other users, and
dcommit with SVN is analogous to that.
@@ -593,7 +594,7 @@ for git to detect them.
CONFIGURATION
-------------
-git-svn stores [svn-remote] configuration information in the
+`git-svn` stores [svn-remote] configuration information in the
repository .git/config file. It is similar the core git
[remote] sections except 'fetch' keys do not accept glob
arguments; but they are instead handled by the 'branches'
@@ -614,8 +615,7 @@ Keep in mind that the '*' (asterisk) wildcard of the local ref
however the remote wildcard may be anywhere as long as it's own
independent path component (surrounded by '/' or EOL). This
type of configuration is not automatically created by 'init' and
-should be manually entered with a text-editor or using
-linkgit:git-config[1]
+should be manually entered with a text-editor or using `git-config`.
SEE ALSO
--------
diff --git a/Documentation/git-symbolic-ref.txt b/Documentation/git-symbolic-ref.txt
index 3d3a059c5e..a4962413d3 100644
--- a/Documentation/git-symbolic-ref.txt
+++ b/Documentation/git-symbolic-ref.txt
@@ -7,7 +7,7 @@ git-symbolic-ref - Read and modify symbolic refs
SYNOPSIS
--------
-'git-symbolic-ref' [-q] [-m <reason>] <name> [<ref>]
+'git symbolic-ref' [-q] [-m <reason>] <name> [<ref>]
DESCRIPTION
-----------
@@ -49,7 +49,7 @@ cumbersome. On some platforms, `ln -sf` does not even work as
advertised (horrors). Therefore symbolic links are now deprecated
and symbolic refs are used by default.
-git-symbolic-ref will exit with status 0 if the contents of the
+`git-symbolic-ref` will exit with status 0 if the contents of the
symbolic ref were printed correctly, with status 1 if the requested
name is not a symbolic ref, or 128 if another error occurs.
diff --git a/Documentation/git-tag.txt b/Documentation/git-tag.txt
index 8f40f4bf0d..1db98e2d0d 100644
--- a/Documentation/git-tag.txt
+++ b/Documentation/git-tag.txt
@@ -9,10 +9,10 @@ git-tag - Create, list, delete or verify a tag object signed with GPG
SYNOPSIS
--------
[verse]
-'git-tag' [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>] <name> [<head>]
-'git-tag' -d <name>...
-'git-tag' [-n[<num>]] -l [<pattern>]
-'git-tag' -v <name>...
+'git tag' [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>] <name> [<head>]
+'git tag' -d <name>...
+'git tag' [-n[<num>]] -l [<pattern>]
+'git tag' -v <name>...
DESCRIPTION
-----------
@@ -82,7 +82,7 @@ OPTIONS
CONFIGURATION
-------------
-By default, git-tag in sign-with-default mode (-s) will use your
+By default, `git-tag` in sign-with-default mode (-s) will use your
committer identity (of the form "Your Name <your@email.address>") to
find a key. If you want to use a different default key, you can specify
it in the repository configuration as follows:
@@ -118,12 +118,12 @@ and be done with it.
. The insane thing.
You really want to call the new version "X" too, 'even though'
-others have already seen the old one. So just use "git tag -f"
+others have already seen the old one. So just use `git-tag -f`
again, as if you hadn't already published the old one.
However, Git does *not* (and it should not) change tags behind
-users back. So if somebody already got the old tag, doing a "git
-pull" on your tree shouldn't just make them overwrite the old
+users back. So if somebody already got the old tag, doing a
+`git-pull` on your tree shouldn't just make them overwrite the old
one.
If somebody got a release tag from you, you cannot just change
@@ -177,7 +177,7 @@ private anchor point tags from the other person.
You would notice "please pull" messages on the mailing list says
repo URL and branch name alone. This is designed to be easily
-cut&pasted to "git fetch" command line:
+cut&pasted to a `git-fetch` command line:
------------
Linus, please pull from
diff --git a/Documentation/git-tar-tree.txt b/Documentation/git-tar-tree.txt
index 74ed06525e..b3097aa79c 100644
--- a/Documentation/git-tar-tree.txt
+++ b/Documentation/git-tar-tree.txt
@@ -8,7 +8,7 @@ git-tar-tree - Create a tar archive of the files in the named tree object
SYNOPSIS
--------
-'git-tar-tree' [--remote=<repo>] <tree-ish> [ <base> ]
+'git tar-tree' [--remote=<repo>] <tree-ish> [ <base> ]
DESCRIPTION
-----------
@@ -19,12 +19,12 @@ Creates a tar archive containing the tree structure for the named tree.
When <base> is specified it is added as a leading path to the files in the
generated tar archive.
-git-tar-tree behaves differently when given a tree ID versus when given
+`git-tar-tree` behaves differently when given a tree ID versus when given
a commit ID or tag ID. In the first case the current time is used as
modification time of each file in the archive. In the latter case the
commit time as recorded in the referenced commit object is used instead.
Additionally the commit ID is stored in a global extended pax header.
-It can be extracted using git-get-tar-commit-id.
+It can be extracted using `git-get-tar-commit-id`.
OPTIONS
-------
diff --git a/Documentation/git-unpack-file.txt b/Documentation/git-unpack-file.txt
index d0552b2c74..995db9fead 100644
--- a/Documentation/git-unpack-file.txt
+++ b/Documentation/git-unpack-file.txt
@@ -9,7 +9,7 @@ git-unpack-file - Creates a temporary file with a blob's contents
SYNOPSIS
--------
-'git-unpack-file' <blob>
+'git unpack-file' <blob>
DESCRIPTION
-----------
diff --git a/Documentation/git-unpack-objects.txt b/Documentation/git-unpack-objects.txt
index b9c4279a88..36d1038056 100644
--- a/Documentation/git-unpack-objects.txt
+++ b/Documentation/git-unpack-objects.txt
@@ -8,7 +8,7 @@ git-unpack-objects - Unpack objects from a packed archive
SYNOPSIS
--------
-'git-unpack-objects' [-n] [-q] [-r] [--strict] <pack-file
+'git unpack-objects' [-n] [-q] [-r] [--strict] <pack-file
DESCRIPTION
@@ -21,7 +21,7 @@ Objects that already exist in the repository will *not* be unpacked
from the pack-file. Therefore, nothing will be unpacked if you use
this command on a pack-file that exists within the target repository.
-Please see the `git-repack` documentation for options to generate
+See linkgit:git-repack[1] for options to generate
new packs and replace existing ones.
OPTIONS
diff --git a/Documentation/git-update-index.txt b/Documentation/git-update-index.txt
index bbb0a6ad57..999e9a7c84 100644
--- a/Documentation/git-update-index.txt
+++ b/Documentation/git-update-index.txt
@@ -9,7 +9,7 @@ git-update-index - Register file contents in the working tree to the index
SYNOPSIS
--------
[verse]
-'git-update-index'
+'git update-index'
[--add] [--remove | --force-remove] [--replace]
[--refresh] [-q] [--unmerged] [--ignore-missing]
[--cacheinfo <mode> <object> <file>]\*
@@ -31,7 +31,7 @@ cleared.
See also linkgit:git-add[1] for a more user-friendly way to do some of
the most common operations on the index.
-The way "git-update-index" handles files it is told about can be modified
+The way `git-update-index` handles files it is told about can be modified
using the various options:
OPTIONS
@@ -53,7 +53,7 @@ OPTIONS
-q::
Quiet. If --refresh finds that the index needs an update, the
default behavior is to error out. This option makes
- git-update-index continue anyway.
+ `git-update-index` continue anyway.
--ignore-submodules:
Do not try to update submodules. This option is only respected
@@ -61,7 +61,7 @@ OPTIONS
--unmerged::
If --refresh finds unmerged changes in the index, the default
- behavior is to error out. This option makes git-update-index
+ behavior is to error out. This option makes `git-update-index`
continue anyway.
--ignore-missing::
@@ -109,7 +109,7 @@ OPTIONS
--replace::
By default, when a file `path` exists in the index,
- git-update-index refuses an attempt to add `path/file`.
+ `git-update-index` refuses an attempt to add `path/file`.
Similarly if a file `path/file` exists, a file `path`
cannot be added. With --replace flag, existing entries
that conflicts with the entry being added are
@@ -145,7 +145,7 @@ up-to-date for mode/content changes. But what it *does* do is to
can refresh the index for a file that hasn't been changed but where
the stat entry is out of date.
-For example, you'd want to do this after doing a "git-read-tree", to link
+For example, you'd want to do this after doing a `git-read-tree`, to link
up the stat index details with the proper files.
Using --cacheinfo or --info-only
@@ -157,7 +157,7 @@ merging.
To pretend you have a file with mode and sha1 at path, say:
----------------
-$ git-update-index --cacheinfo mode sha1 path
+$ git update-index --cacheinfo mode sha1 path
----------------
'--info-only' is used to register files without placing them in the object
@@ -186,13 +186,13 @@ back on 3-way merge.
. mode SP type SP sha1 TAB path
+
-The second format is to stuff git-ls-tree output
+The second format is to stuff `git-ls-tree` output
into the index file.
. mode SP sha1 SP stage TAB path
+
This format is to put higher order stages into the
-index file and matches git-ls-files --stage output.
+index file and matches `git-ls-files --stage` output.
To place a higher stage entry to the index, the path should
first be removed by feeding a mode=0 entry for the path, and
@@ -247,13 +247,13 @@ In order to set "assume unchanged" bit, use `--assume-unchanged`
option. To unset, use `--no-assume-unchanged`.
The command looks at `core.ignorestat` configuration variable. When
-this is true, paths updated with `git-update-index paths...` and
+this is true, paths updated with `git update-index paths...` and
paths updated with other git commands that update both index and
working tree (e.g. `git-apply --index`, `git-checkout-index -u`,
and `git-read-tree -u`) are automatically marked as "assume
unchanged". Note that "assume unchanged" bit is *not* set if
-`git-update-index --refresh` finds the working tree file matches
-the index (use `git-update-index --really-refresh` if you want
+`git update-index --refresh` finds the working tree file matches
+the index (use `git update-index --really-refresh` if you want
to mark them as "assume unchanged").
@@ -262,7 +262,7 @@ Examples
To update and refresh only the files already checked out:
----------------
-$ git-checkout-index -n -f -a && git-update-index --ignore-missing --refresh
+$ git checkout-index -n -f -a && git update-index --ignore-missing --refresh
----------------
On an inefficient filesystem with `core.ignorestat` set::
diff --git a/Documentation/git-update-ref.txt b/Documentation/git-update-ref.txt
index 7f7e3d197b..9639f705af 100644
--- a/Documentation/git-update-ref.txt
+++ b/Documentation/git-update-ref.txt
@@ -7,18 +7,18 @@ 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
-----------
Given two arguments, stores the <newvalue> in the <ref>, possibly
-dereferencing the symbolic refs. E.g. `git-update-ref HEAD
+dereferencing the symbolic refs. E.g. `git update-ref HEAD
<newvalue>` updates the current branch head to the new object.
Given three arguments, stores the <newvalue> in the <ref>,
possibly dereferencing the symbolic refs, after verifying that
the current value of the <ref> matches <oldvalue>.
-E.g. `git-update-ref refs/heads/master <newvalue> <oldvalue>`
+E.g. `git update-ref refs/heads/master <newvalue> <oldvalue>`
updates the master branch head to <newvalue> only if its current
value is <oldvalue>. You can specify 40 "0" or an empty string
as <oldvalue> to make sure that the ref you are creating does
@@ -41,7 +41,7 @@ the result of following the symbolic pointers.
In general, using
- git-update-ref HEAD "$head"
+ git update-ref HEAD "$head"
should be a _lot_ safer than doing
@@ -61,7 +61,7 @@ still contains <oldvalue>.
Logging Updates
---------------
If config parameter "core.logAllRefUpdates" is true or the file
-"$GIT_DIR/logs/<ref>" exists then `git-update-ref` will append
+"$GIT_DIR/logs/<ref>" exists then `git update-ref` will append
a line to the log file "$GIT_DIR/logs/<ref>" (dereferencing all
symbolic refs before creating the log name) describing the change
in ref value. Log lines are formatted as:
diff --git a/Documentation/git-update-server-info.txt b/Documentation/git-update-server-info.txt
index d21be41d06..bc1207a317 100644
--- a/Documentation/git-update-server-info.txt
+++ b/Documentation/git-update-server-info.txt
@@ -8,7 +8,7 @@ git-update-server-info - Update auxiliary info file to help dumb servers
SYNOPSIS
--------
-'git-update-server-info' [--force]
+'git update-server-info' [--force]
DESCRIPTION
-----------
@@ -31,7 +31,7 @@ OUTPUT
------
Currently the command updates the following files. Please see
-linkgit:gitrepository-layout[5][repository-layout] for description of
+linkgit:gitrepository-layout[5] for description of
what they are for:
* objects/info/packs
diff --git a/Documentation/git-upload-archive.txt b/Documentation/git-upload-archive.txt
index e49f68f68e..526e5bdd22 100644
--- a/Documentation/git-upload-archive.txt
+++ b/Documentation/git-upload-archive.txt
@@ -8,7 +8,7 @@ git-upload-archive - Send archive back to git-archive
SYNOPSIS
--------
-'git-upload-archive' <directory>
+'git upload-archive' <directory>
DESCRIPTION
-----------
@@ -16,7 +16,7 @@ Invoked by 'git-archive --remote' and sends a generated archive to the
other end over the git protocol.
This command is usually not invoked directly by the end user. The UI
-for the protocol is on the 'git-archive' side, and the program pair
+for the protocol is on the `git-archive` side, and the program pair
is meant to be used to get an archive from a remote repository.
OPTIONS
diff --git a/Documentation/git-upload-pack.txt b/Documentation/git-upload-pack.txt
index bac465e13f..52724d4c65 100644
--- a/Documentation/git-upload-pack.txt
+++ b/Documentation/git-upload-pack.txt
@@ -8,17 +8,17 @@ git-upload-pack - Send objects packed back to git-fetch-pack
SYNOPSIS
--------
-'git-upload-pack' [--strict] [--timeout=<n>] <directory>
+'git upload-pack' [--strict] [--timeout=<n>] <directory>
DESCRIPTION
-----------
-Invoked by 'git-fetch-pack', learns what
+Invoked by `git-fetch-pack`, learns what
objects the other side is missing, and sends them after packing.
This command is usually not invoked directly by the end user.
-The UI for the protocol is on the 'git-fetch-pack' side, and the
+The UI for the protocol is on the `git-fetch-pack` side, and the
program pair is meant to be used to pull updates from a remote
-repository. For push operations, see 'git-send-pack'.
+repository. For push operations, see `git-send-pack`.
OPTIONS
diff --git a/Documentation/git-var.txt b/Documentation/git-var.txt
index 67e8e1f93a..10d1e19cc0 100644
--- a/Documentation/git-var.txt
+++ b/Documentation/git-var.txt
@@ -8,7 +8,7 @@ git-var - Show a git logical variable
SYNOPSIS
--------
-'git-var' [ -l | <variable> ]
+'git var' [ -l | <variable> ]
DESCRIPTION
-----------
@@ -24,7 +24,7 @@ OPTIONS
EXAMPLE
--------
- $ git-var GIT_AUTHOR_IDENT
+ $ git var GIT_AUTHOR_IDENT
Eric W. Biederman <ebiederm@lnxi.com> 1121223278 -0600
diff --git a/Documentation/git-verify-pack.txt b/Documentation/git-verify-pack.txt
index 478f236996..4d95c6c891 100644
--- a/Documentation/git-verify-pack.txt
+++ b/Documentation/git-verify-pack.txt
@@ -8,13 +8,13 @@ git-verify-pack - Validate packed git archive files
SYNOPSIS
--------
-'git-verify-pack' [-v] [--] <pack>.idx ...
+'git verify-pack' [-v] [--] <pack>.idx ...
DESCRIPTION
-----------
-Reads given idx file for packed git archive created with
-git-pack-objects command and verifies idx file and the
+Reads given idx file for packed git archive created with the
+`git-pack-objects` command and verifies idx file and the
corresponding pack file.
OPTIONS
diff --git a/Documentation/git-verify-tag.txt b/Documentation/git-verify-tag.txt
index dffba8906a..de4a89a105 100644
--- a/Documentation/git-verify-tag.txt
+++ b/Documentation/git-verify-tag.txt
@@ -7,11 +7,11 @@ git-verify-tag - Check the GPG signature of tags
SYNOPSIS
--------
-'git-verify-tag' <tag>...
+'git verify-tag' <tag>...
DESCRIPTION
-----------
-Validates the gpg signature created by git-tag.
+Validates the gpg signature created by `git-tag`.
OPTIONS
-------
diff --git a/Documentation/git-web--browse.txt b/Documentation/git-web--browse.txt
index e80a7c1cc4..fefa6fd38b 100644
--- a/Documentation/git-web--browse.txt
+++ b/Documentation/git-web--browse.txt
@@ -7,7 +7,7 @@ git-web--browse - git helper script to launch a web browser
SYNOPSIS
--------
-'git-web--browse' [OPTIONS] URL/FILE ...
+'git web--browse' [OPTIONS] URL/FILE ...
DESCRIPTION
-----------
@@ -61,7 +61,7 @@ browser.<tool>.path
You can explicitly provide a full path to your preferred browser by
setting the configuration variable 'browser.<tool>.path'. For example,
you can configure the absolute path to firefox by setting
-'browser.firefox.path'. Otherwise, 'git-web--browse' assumes the tool
+'browser.firefox.path'. Otherwise, `git-web--browse` assumes the tool
is available in PATH.
browser.<tool>.cmd
@@ -70,7 +70,7 @@ browser.<tool>.cmd
When the browser, specified by options or configuration variables, is
not among the supported ones, then the corresponding
'browser.<tool>.cmd' configuration variable will be looked up. If this
-variable exists then "git web--browse" will treat the specified tool
+variable exists then `git-web--browse` will treat the specified tool
as a custom command and will use a shell eval to run the command with
the URLs passed as arguments.
@@ -96,7 +96,7 @@ the following:
cmd = A_PATH_TO/konqueror
------------------------------------------------
-Note about git config --global
+Note about git-config --global
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Note that these configuration variables should probably be set using
@@ -112,7 +112,7 @@ See linkgit:git-config[1] for more information about this.
Author
------
Written by Christian Couder <chriscool@tuxfamily.org> and the git-list
-<git@vger.kernel.org>, based on git-mergetool by Theodore Y. Ts'o.
+<git@vger.kernel.org>, based on `git-mergetool` by Theodore Y. Ts'o.
Documentation
-------------
diff --git a/Documentation/git-whatchanged.txt b/Documentation/git-whatchanged.txt
index f5d39c7870..3b0ea2c591 100644
--- a/Documentation/git-whatchanged.txt
+++ b/Documentation/git-whatchanged.txt
@@ -8,13 +8,13 @@ git-whatchanged - Show logs with difference each commit introduces
SYNOPSIS
--------
-'git-whatchanged' <option>...
+'git whatchanged' <option>...
DESCRIPTION
-----------
Shows commit logs and diff output each commit introduces. The
-command internally invokes 'git-rev-list' piped to
-'git-diff-tree', and takes command line options for both of
+command internally invokes `git-rev-list` piped to
+`git-diff-tree`, and takes command line options for both of
these commands.
This manual page describes only the most frequently used options.
@@ -52,12 +52,12 @@ include::pretty-formats.txt[]
Examples
--------
-git-whatchanged -p v2.6.12.. include/scsi drivers/scsi::
+git whatchanged -p v2.6.12.. include/scsi drivers/scsi::
Show as patches the commits since version 'v2.6.12' that changed
any file in the include/scsi or drivers/scsi subdirectories
-git-whatchanged --since="2 weeks ago" \-- gitk::
+git whatchanged --since="2 weeks ago" \-- gitk::
Show the changes during the last two weeks to the file 'gitk'.
The "--" is necessary to avoid confusion with the *branch* named
diff --git a/Documentation/git-write-tree.txt b/Documentation/git-write-tree.txt
index 8744f6535d..19d979bcc7 100644
--- a/Documentation/git-write-tree.txt
+++ b/Documentation/git-write-tree.txt
@@ -8,7 +8,7 @@ git-write-tree - Create a tree object from the current index
SYNOPSIS
--------
-'git-write-tree' [--missing-ok] [--prefix=<prefix>/]
+'git write-tree' [--missing-ok] [--prefix=<prefix>/]
DESCRIPTION
-----------
diff --git a/Documentation/git.txt b/Documentation/git.txt
index 4e4bd6ddb1..22702c260c 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -20,11 +20,11 @@ Git is a fast, scalable, distributed revision control system with an
unusually rich command set that provides both high-level operations
and full access to internals.
-See this linkgit:gittutorial[7][tutorial] to get started, then see
+See linkgit:gittutorial[7] to get started, then see
link:everyday.html[Everyday Git] for a useful minimum set of commands, and
"man git-commandname" for documentation of each command. CVS users may
-also want to read linkgit:gitcvs-migration[7][CVS migration]. See
-link:user-manual.html[Git User's Manual] for a more in-depth
+also want to read linkgit:gitcvs-migration[7]. See
+the link:user-manual.html[Git User's Manual] for a more in-depth
introduction.
The COMMAND is either a name of a Git command (see below) or an alias
@@ -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],
@@ -181,13 +182,14 @@ See the references above to get started using git. The following is
probably more detail than necessary for a first-time user.
The link:user-manual.html#git-concepts[git concepts chapter of the
-user-manual] and the linkgit:gitcore-tutorial[7][Core tutorial] both provide
+user-manual] and linkgit:gitcore-tutorial[7] both provide
introductions to the underlying git architecture.
See also the link:howto-index.html[howto] documents for some useful
examples.
-The internals are documented link:technical/api-index.html[here].
+The internals are documented in the
+link:technical/api-index.html[GIT API documentation].
GIT COMMANDS
------------
@@ -371,10 +373,9 @@ For a more complete list of ways to spell object names, see
File/Directory Structure
------------------------
-Please see the linkgit:gitrepository-layout[5][repository layout]
-document.
+Please see the linkgit:gitrepository-layout[5] document.
-Read linkgit:githooks[5][hooks] for more details about each hook.
+Read linkgit:githooks[5] for more details about each hook.
Higher level SCMs may provide and manage additional information in the
`$GIT_DIR`.
@@ -382,7 +383,7 @@ Higher level SCMs may provide and manage additional information in the
Terminology
-----------
-Please see the linkgit:gitglossary[7][glossary] document.
+Please see linkgit:gitglossary[7].
Environment Variables
@@ -482,10 +483,10 @@ other
a pager.
'GIT_SSH'::
- If this environment variable is set then linkgit:git-fetch[1]
- and linkgit:git-push[1] will use this command instead
+ If this environment variable is set then `git-fetch`
+ and `git-push` will use this command instead
of `ssh` when they need to connect to a remote system.
- The 'GIT_SSH' command will be given exactly two arguments:
+ The '$GIT_SSH' command will be given exactly two arguments:
the 'username@host' (or just 'host') from the URL and the
shell command to execute on that remote system.
+
@@ -499,8 +500,8 @@ for further details.
'GIT_FLUSH'::
If this environment variable is set to "1", then commands such
- as git-blame (in incremental mode), git-rev-list, git-log,
- git-whatchanged, etc., will force a flush of the output stream
+ as `git-blame` (in incremental mode), `git-rev-list`, `git-log`,
+ and `git-whatchanged` will force a flush of the output stream
after each commit-oriented record have been flushed. If this
variable is set to "0", the output of these commands will be done
using completely buffered I/O. If this environment variable is
@@ -526,7 +527,7 @@ Discussion[[Discussion]]
More detail on the following is available from the
link:user-manual.html#git-concepts[git concepts chapter of the
-user-manual] and the linkgit:gitcore-tutorial[7][Core tutorial].
+user-manual] and linkgit:gitcore-tutorial[7].
A git project normally consists of a working directory with a ".git"
subdirectory at the top level. The .git directory contains, among other
@@ -592,7 +593,7 @@ SEE ALSO
linkgit:gittutorial[7], linkgit:gittutorial-2[7],
linkgit:giteveryday[7], linkgit:gitcvs-migration[7],
linkgit:gitglossary[7], linkgit:gitcore-tutorial[7],
-link:user-manual.html[The Git User's Manual]
+linkgit:gitcli[7], link:user-manual.html[The Git User's Manual]
GIT
---
diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt
index 471754eb12..124170a967 100644
--- a/Documentation/gitattributes.txt
+++ b/Documentation/gitattributes.txt
@@ -87,9 +87,9 @@ Checking-out and checking-in
These attributes affect how the contents stored in the
repository are copied to the working tree files when commands
-such as `git checkout` and `git merge` run. They also affect how
+such as `git-checkout` and `git-merge` run. They also affect how
git stores the contents you prepare in the working tree in the
-repository upon `git add` and `git commit`.
+repository upon `git-add` and `git-commit`.
`crlf`
^^^^^^
@@ -148,16 +148,16 @@ an irreversible conversion. The safety triggers to prevent such
a conversion done to the files in the work tree, but there are a
few exceptions. Even though...
-- "git add" itself does not touch the files in the work tree, the
+- `git-add` itself does not touch the files in the work tree, the
next checkout would, so the safety triggers;
-- "git apply" to update a text file with a patch does touch the files
+- `git-apply` to update a text file with a patch does touch the files
in the work tree, but the operation is about text files and CRLF
conversion is about fixing the line ending inconsistencies, so the
safety does not trigger;
-- "git diff" itself does not touch the files in the work tree, it is
- often run to inspect the changes you intend to next "git add". To
+- `git-diff` itself does not touch the files in the work tree, it is
+ often run to inspect the changes you intend to next `git-add`. To
catch potential problems early, safety triggers.
@@ -214,7 +214,7 @@ with `crlf`, and then `ident` and fed to `filter`.
Generating diff text
~~~~~~~~~~~~~~~~~~~~
-The attribute `diff` affects if `git diff` generates textual
+The attribute `diff` affects if `git-diff` generates textual
patch for the path or just says `Binary files differ`. It also
can affect what line is shown on the hunk header `@@ -k,l +n,m @@`
line.
@@ -502,13 +502,19 @@ frotz unspecified
Creating an archive
~~~~~~~~~~~~~~~~~~~
+`export-ignore`
+^^^^^^^^^^^^^^^
+
+Files and directories with the attribute `export-ignore` won't be added to
+archive files.
+
`export-subst`
^^^^^^^^^^^^^^
If the attribute `export-subst` is set for a file then git will expand
several placeholders when adding this file to an archive. The
-expansion depends on the availability of a commit ID, i.e. if
-linkgit:git-archive[1] has been given a tree instead of a commit or a
+expansion depends on the availability of a commit ID, i.e., if
+`git-archive` has been given a tree instead of a commit or a
tag then no replacement will be done. The placeholders are the same
as those for the option `--pretty=format:` of linkgit:git-log[1],
except that they need to be wrapped like this: `$Format:PLACEHOLDERS$`
diff --git a/Documentation/gitcli.txt b/Documentation/gitcli.txt
index 8fb5d889e5..29e5929db2 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.
@@ -104,9 +133,45 @@ $ git describe --abbrev 10 HEAD # NOT WHAT YOU MEANT
----------------------------
+NOTES ON FREQUENTLY CONFUSED OPTIONS
+------------------------------------
+
+Many commands that can work on files in the working tree
+and/or in the index can take `--cached` and/or `--index`
+options. Sometimes people incorrectly think that, because
+the index was originally called cache, these two are
+synonyms. They are *not* -- these two options mean very
+different things.
+
+ * The `--cached` option is used to ask a command that
+ usually works on files in the working tree to *only* work
+ with the index. For example, `git grep`, when used
+ without a commit to specify from which commit to look for
+ strings in, usually works on files in the working tree,
+ but with the `--cached` option, it looks for strings in
+ the index.
+
+ * The `--index` option is used to ask a command that
+ usually works on files in the working tree to *also*
+ affect the index. For example, `git stash apply` usually
+ merges changes recorded in a stash to the working tree,
+ but with the `--index` option, it also merges changes to
+ the index as well.
+
+`git apply` command can be used with `--cached` and
+`--index` (but not at the same time). Usually the command
+only affects the files in the working tree, but with
+`--index`, it patches both the files and their index
+entries, and with `--cached`, it modifies only the index
+entries.
+
+See also http://marc.info/?l=git&m=116563135620359 and
+http://marc.info/?l=git&m=119150393620273 for further
+information.
+
Documentation
-------------
-Documentation by Pierre Habouzit.
+Documentation by Pierre Habouzit and the git-list <git@vger.kernel.org>.
GIT
---
diff --git a/Documentation/gitcore-tutorial.txt b/Documentation/gitcore-tutorial.txt
index cb4ec40440..7d721c5b08 100644
--- a/Documentation/gitcore-tutorial.txt
+++ b/Documentation/gitcore-tutorial.txt
@@ -16,8 +16,8 @@ This tutorial explains how to use the "core" git programs to set up and
work with a git repository.
If you just need to use git as a revision control system you may prefer
-to start with linkgit:gittutorial[7][a tutorial introduction to git] or
-link:user-manual.html[the git user manual].
+to start with "A Tutorial Introduction to GIT" (linkgit:gittutorial[7]) or
+link:user-manual.html[the GIT User Manual].
However, an understanding of these low-level tools can be helpful if
you want to understand git's internals.
@@ -49,7 +49,7 @@ subdirectory, and initialize the git infrastructure with `git-init`:
------------------------------------------------
$ mkdir git-tutorial
$ cd git-tutorial
-$ git-init
+$ git init
------------------------------------------------
to which git will reply
@@ -108,8 +108,7 @@ references in these `refs` subdirectories when you actually start
populating your tree.
[NOTE]
-An advanced user may want to take a look at the
-linkgit:gitrepository-layout[5][repository layout] document
+An advanced user may want to take a look at linkgit:gitrepository-layout[5]
after finishing this tutorial.
You have now created your first git repository. Of course, since it's
@@ -150,7 +149,7 @@ adding a new entry with the `\--add` flag (or removing an entry with the
So to populate the index with the two files you just created, you can do
------------------------------------------------
-$ git-update-index --add hello example
+$ git update-index --add hello example
------------------------------------------------
and you have now told git to track those two files.
@@ -178,7 +177,7 @@ If you want to, you can use `git-cat-file` to look at those objects, but
you'll have to use the object name, not the filename of the object:
----------------
-$ git-cat-file -t 557db03de997c86a4a028e1ebd3a1ceb225be238
+$ git cat-file -t 557db03de997c86a4a028e1ebd3a1ceb225be238
----------------
where the `-t` tells `git-cat-file` to tell you what the "type" of the
@@ -186,7 +185,7 @@ object is. git will tell you that you have a "blob" object (i.e., just a
regular file), and you can see the contents with
----------------
-$ git-cat-file "blob" 557db03
+$ git cat-file "blob" 557db03
----------------
which will print out "Hello World". The object `557db03` is nothing
@@ -232,7 +231,7 @@ git what has changed in the tree compared to your old index, using the
`git-diff-files` command:
------------
-$ git-diff-files
+$ git diff-files
------------
Oops. That wasn't very readable. It just spit out its own internal
@@ -240,11 +239,11 @@ version of a `diff`, but that internal version really just tells you
that it has noticed that "hello" has been modified, and that the old object
contents it had have been replaced with something else.
-To make it readable, we can tell git-diff-files to output the
+To make it readable, we can tell `git-diff-files` to output the
differences as a patch, using the `-p` flag:
------------
-$ git-diff-files -p
+$ git diff-files -p
diff --git a/hello b/hello
index 557db03..263414f 100644
--- a/hello
@@ -260,7 +259,7 @@ In other words, `git-diff-files` always shows us the difference between
what is recorded in the index, and what is currently in the working
tree. That's very useful.
-A common shorthand for `git-diff-files -p` is to just write `git
+A common shorthand for `git diff-files -p` is to just write `git
diff`, which will do the same thing.
------------
@@ -285,14 +284,14 @@ object as a 'commit' object together with an explanation of what the
tree was all about, along with information of how we came to that state.
Creating a tree object is trivial, and is done with `git-write-tree`.
-There are no options or other input: git-write-tree will take the
+There are no options or other input: `git write-tree` will take the
current index state, and write an object that describes that whole
index. In other words, we're now tying together all the different
filenames with their contents (and their permissions), and we're
creating the equivalent of a git "directory" object:
------------------------------------------------
-$ git-write-tree
+$ git write-tree
------------------------------------------------
and this will just output the name of the resulting tree, in this case
@@ -303,9 +302,9 @@ and this will just output the name of the resulting tree, in this case
----------------
which is another incomprehensible object name. Again, if you want to,
-you can use `git-cat-file -t 8988d\...` to see that this time the object
+you can use `git cat-file -t 8988d\...` to see that this time the object
is not a "blob" object, but a "tree" object (you can also use
-`git-cat-file` to actually output the raw object contents, but you'll see
+`git cat-file` to actually output the raw object contents, but you'll see
mainly a binary mess, so that's less interesting).
However -- normally you'd never use `git-write-tree` on its own, because
@@ -328,9 +327,9 @@ that's exactly what `git-commit-tree` spits out, we can do this
all with a sequence of simple shell commands:
------------------------------------------------
-$ tree=$(git-write-tree)
-$ commit=$(echo 'Initial commit' | git-commit-tree $tree)
-$ git-update-ref HEAD $commit
+$ tree=$(git write-tree)
+$ commit=$(echo 'Initial commit' | git commit-tree $tree)
+$ git update-ref HEAD $commit
------------------------------------------------
In this case this creates a totally new commit that is not related to
@@ -357,7 +356,7 @@ that on purpose, to show the difference between the index state, and the
state in the working tree, and how they don't have to match, even
when we commit things.
-As before, if we do `git-diff-files -p` in our git-tutorial project,
+As before, if we do `git diff-files -p` in our git-tutorial project,
we'll still see the same difference we saw last time: the index file
hasn't changed by the act of committing anything. However, now that we
have committed something, we can also learn to use a new command:
@@ -373,7 +372,7 @@ didn't have anything to diff against.
But now we can do
----------------
-$ git-diff-index -p HEAD
+$ git diff-index -p HEAD
----------------
(where `-p` has the same meaning as it did in `git-diff-files`), and it
@@ -395,7 +394,7 @@ In other words, `git-diff-index` normally compares a tree against the
working tree, but when given the `\--cached` flag, it is told to
instead compare against just the index cache contents, and ignore the
current working tree state entirely. Since we just wrote the index
-file to HEAD, doing `git-diff-index \--cached -p HEAD` should thus return
+file to HEAD, doing `git diff-index \--cached -p HEAD` should thus return
an empty set of differences, and that's exactly what it does.
[NOTE]
@@ -423,15 +422,15 @@ work through the index file, so the first thing we need to do is to
update the index cache:
------------------------------------------------
-$ git-update-index hello
+$ git update-index hello
------------------------------------------------
(note how we didn't need the `\--add` flag this time, since git knew
about the file already).
Note what happens to the different `git-diff-\*` versions here. After
-we've updated `hello` in the index, `git-diff-files -p` now shows no
-differences, but `git-diff-index -p HEAD` still *does* show that the
+we've updated `hello` in the index, `git diff-files -p` now shows no
+differences, but `git diff-index -p HEAD` still *does* show that the
current state is different from the state we committed. In fact, now
`git-diff-index` shows the same difference whether we use the `--cached`
flag or not, since now the index is coherent with the working tree.
@@ -478,7 +477,7 @@ of that commit itself, and show the difference directly. Thus, to get
the same diff that we've already seen several times, we can now do
----------------
-$ git-diff-tree -p HEAD
+$ git diff-tree -p HEAD
----------------
(again, `-p` means to show the difference as a human-readable patch),
@@ -543,7 +542,7 @@ with the associated patches use the more complex (and much more
powerful)
----------------
-$ git-whatchanged -p
+$ git whatchanged -p
----------------
and you will see exactly what has changed in the repository over its
@@ -654,7 +653,7 @@ information for the files involved) will likely need to be refreshed.
So after you do a `cp -a` to create a new copy, you'll want to do
+
----------------
-$ git-update-index --refresh
+$ git update-index --refresh
----------------
+
in the new repository to make sure that the index file is up-to-date.
@@ -670,15 +669,15 @@ known state (you don't know *what* they've done and not yet checked in),
so usually you'll precede the `git-update-index` with a
----------------
-$ git-read-tree --reset HEAD
-$ git-update-index --refresh
+$ git read-tree --reset HEAD
+$ git update-index --refresh
----------------
which will force a total index re-build from the tree pointed to by `HEAD`.
It resets the index contents to `HEAD`, and then the `git-update-index`
makes sure to match up all index entries with the checked-out files.
If the original repository had uncommitted changes in its
-working tree, `git-update-index --refresh` notices them and
+working tree, `git update-index --refresh` notices them and
tells you they need to be updated.
The above can also be written as simply
@@ -691,7 +690,7 @@ and in fact a lot of the common git command combinations can be scripted
with the `git xyz` interfaces. You can learn things by just looking
at what the various git scripts do. For example, `git reset` used to be
the above two lines implemented in `git-reset`, but some things like
-`git status` and `git commit` are slightly more complex scripts around
+`git-status` and `git-commit` are slightly more complex scripts around
the basic git commands.
Many (most?) public remote repositories will not contain any of
@@ -714,7 +713,7 @@ $ rsync -rL rsync://rsync.kernel.org/pub/scm/git/git.git/ .git
followed by
----------------
-$ git-read-tree HEAD
+$ git read-tree HEAD
----------------
to populate the index. However, now you have populated the index, and
@@ -723,14 +722,14 @@ actually have any of the working tree files to work on. To get
those, you'd check them out with
----------------
-$ git-checkout-index -u -a
+$ git checkout-index -u -a
----------------
where the `-u` flag means that you want the checkout to keep the index
up-to-date (so that you don't have to refresh it afterward), and the
`-a` flag means "check out all files" (if you have a stale copy or an
older version of a checked out tree you may also need to add the `-f`
-flag first, to tell git-checkout-index to *force* overwriting of any old
+flag first, to tell `git-checkout-index` to *force* overwriting of any old
files).
Again, this can all be simplified with
@@ -840,7 +839,7 @@ $ git commit -m "Some work." -i hello
------------------------------------------------
Here, we just added another line to `hello`, and we used a shorthand for
-doing both `git-update-index hello` and `git commit` by just giving the
+doing both `git update-index hello` and `git commit` by just giving the
filename directly to `git commit`, with an `-i` flag (it tells
git to 'include' that file in addition to what you have done to
the index file so far when making the commit). The `-m` flag is to give the
@@ -926,7 +925,7 @@ $ git commit -i hello
which will very loudly warn you that you're now committing a merge
(which is correct, so never mind), and you can write a small merge
-message about your adventures in git-merge-land.
+message about your adventures in `git-merge`-land.
After you're done, start up `gitk \--all` to see graphically what the
history looks like. Notice that `mybranch` still exists, and you can
@@ -939,7 +938,7 @@ Another useful tool, especially if you do not always work in X-Window
environment, is `git show-branch`.
------------------------------------------------
-$ git-show-branch --topo-order --more=1 master mybranch
+$ git show-branch --topo-order --more=1 master mybranch
* [master] Merge work in mybranch
! [mybranch] Some work.
--
@@ -964,25 +963,25 @@ commits from the master branch. The string inside brackets
before the commit log message is a short name you can use to
name the commit. In the above example, 'master' and 'mybranch'
are branch heads. 'master^' is the first parent of 'master'
-branch head. Please see 'git-rev-parse' documentation if you
+branch head. Please see linkgit:git-rev-parse[1] if you want to
see more complex cases.
[NOTE]
-Without the '--more=1' option, 'git-show-branch' would not output the
+Without the '--more=1' option, `git-show-branch` would not output the
'[master^]' commit, as '[mybranch]' commit is a common ancestor of
-both 'master' and 'mybranch' tips. Please see 'git-show-branch'
-documentation for details.
+both 'master' and 'mybranch' tips. Please see linkgit:git-show-branch[1]
+for details.
[NOTE]
If there were more commits on the 'master' branch after the merge, the
-merge commit itself would not be shown by 'git-show-branch' by
+merge commit itself would not be shown by `git-show-branch` by
default. You would need to provide '--sparse' option to make the
merge commit visible in this case.
Now, let's pretend you are the one who did all the work in
`mybranch`, and the fruit of your hard work has finally been merged
to the `master` branch. Let's go back to `mybranch`, and run
-`git merge` to get the "upstream changes" back to your branch.
+`git-merge` to get the "upstream changes" back to your branch.
------------
$ git checkout mybranch
@@ -1199,7 +1198,7 @@ algorithm. First, it finds the common ancestor between them.
The command it uses is `git-merge-base`:
------------
-$ mb=$(git-merge-base HEAD mybranch)
+$ mb=$(git merge-base HEAD mybranch)
------------
The command writes the commit object name of the common ancestor
@@ -1209,7 +1208,7 @@ ancestor commit is the "New day." commit in this case. You can
tell it by:
------------
-$ git-name-rev $mb
+$ git name-rev $mb
my-first-tag
------------
@@ -1217,7 +1216,7 @@ After finding out a common ancestor commit, the second step is
this:
------------
-$ git-read-tree -m -u $mb HEAD mybranch
+$ git read-tree -m -u $mb HEAD mybranch
------------
This is the same `git-read-tree` command we have already seen,
@@ -1236,7 +1235,7 @@ trees are left in non-zero stages. At this point, you can
inspect the index file with this command:
------------
-$ git-ls-files --stage
+$ git ls-files --stage
100644 7f8b141b65fdcee47321e399a2598a235a032422 0 example
100644 263414f423d0e4d70dae8fe53fa34614ff3e2860 1 hello
100644 06fa6a24256dc7e560efa5687fa84b51f0263c3a 2 hello
@@ -1253,7 +1252,7 @@ stages.
To look at only non-zero stages, use `\--unmerged` flag:
------------
-$ git-ls-files --unmerged
+$ git ls-files --unmerged
100644 263414f423d0e4d70dae8fe53fa34614ff3e2860 1 hello
100644 06fa6a24256dc7e560efa5687fa84b51f0263c3a 2 hello
100644 cc44c73eb783565da5831b4d820c962954019b69 3 hello
@@ -1265,7 +1264,7 @@ file, using 3-way merge. This is done by giving
`git-merge-index` command:
------------
-$ git-merge-index git-merge-one-file hello
+$ git merge-index git-merge-one-file hello
Auto-merging hello.
merge: warning: conflicts during merge
ERROR: Merge conflict in hello.
@@ -1283,7 +1282,7 @@ the working tree.. This can be seen if you run `ls-files
--stage` again at this point:
------------
-$ git-ls-files --stage
+$ git ls-files --stage
100644 7f8b141b65fdcee47321e399a2598a235a032422 0 example
100644 263414f423d0e4d70dae8fe53fa34614ff3e2860 1 hello
100644 06fa6a24256dc7e560efa5687fa84b51f0263c3a 2 hello
@@ -1291,9 +1290,9 @@ $ git-ls-files --stage
------------
This is the state of the index file and the working file after
-`git merge` returns control back to you, leaving the conflicting
+`git-merge` returns control back to you, leaving the conflicting
merge for you to resolve. Notice that the path `hello` is still
-unmerged, and what you see with `git diff` at this point is
+unmerged, and what you see with `git-diff` at this point is
differences since stage 2 (i.e. your version).
@@ -1330,7 +1329,7 @@ into it later. Obviously, this repository creation needs to be
done only once.
[NOTE]
-`git push` uses a pair of programs,
+`git-push` uses a pair of programs,
`git-send-pack` on your local machine, and `git-receive-pack`
on the remote machine. The communication between the two over
the network internally uses an SSH connection.
@@ -1350,7 +1349,7 @@ Then, make that directory into a git repository by running
`.git`, we do things slightly differently:
------------
-$ GIT_DIR=my-git.git git-init
+$ GIT_DIR=my-git.git git init
------------
Make sure this directory is available for others you want your
@@ -1369,7 +1368,7 @@ your login shell is `bash`, only `.bashrc` is read and not
If you plan to publish this repository to be accessed over http,
you should do `chmod +x my-git.git/hooks/post-update` at this
point. This makes sure that every time you push into this
-repository, `git-update-server-info` is run.
+repository, `git update-server-info` is run.
Your "public repository" is now ready to accept your changes.
Come back to the machine you have your private repository. From
@@ -1496,9 +1495,9 @@ keeps the necessary files up-to-date.
3. Push into the public repository from your primary
repository.
-4. `git repack` the public repository. This establishes a big
+4. `git-repack` the public repository. This establishes a big
pack that contains the initial set of objects as the
- baseline, and possibly `git prune` if the transport
+ baseline, and possibly `git-prune` if the transport
used for pulling from your repository supports packed
repositories.
@@ -1512,14 +1511,14 @@ You can repack this private repository whenever you feel like.
6. Push your changes to the public repository, and announce it
to the public.
-7. Every once in a while, "git repack" the public repository.
+7. Every once in a while, "git-repack" the public repository.
Go back to step 5. and continue working.
A recommended work cycle for a "subsystem maintainer" who works
on that project and has an own "public repository" goes like this:
-1. Prepare your work repository, by `git clone` the public
+1. Prepare your work repository, by `git-clone` the public
repository of the "project lead". The URL used for the
initial cloning is stored in the remote.origin.url
configuration variable.
@@ -1534,7 +1533,7 @@ on that project and has an own "public repository" goes like this:
point at the repository you are borrowing from.
4. Push into the public repository from your primary
- repository. Run `git repack`, and possibly `git prune` if the
+ repository. Run `git-repack`, and possibly `git-prune` if the
transport used for pulling from your repository supports
packed repositories.
@@ -1551,7 +1550,7 @@ like.
"project lead" and possibly your "sub-subsystem
maintainers" to pull from it.
-7. Every once in a while, `git repack` the public repository.
+7. Every once in a while, `git-repack` the public repository.
Go back to step 5. and continue working.
@@ -1559,7 +1558,7 @@ A recommended work cycle for an "individual developer" who does
not have a "public" repository is somewhat different. It goes
like this:
-1. Prepare your work repository, by `git clone` the public
+1. Prepare your work repository, by `git-clone` the public
repository of the "project lead" (or a "subsystem
maintainer", if you work on a subsystem). The URL used for
the initial cloning is stored in the remote.origin.url
@@ -1589,7 +1588,7 @@ suggested in the previous section may be new to you. You do not
have to worry. git supports "shared public repository" style of
cooperation you are probably more familiar with as well.
-See linkgit:gitcvs-migration[7][git for CVS users] for the details.
+See linkgit:gitcvs-migration[7] for the details.
Bundling your work together
---------------------------
diff --git a/Documentation/gitcvs-migration.txt b/Documentation/gitcvs-migration.txt
index 1db3f52945..4dc7ec5407 100644
--- a/Documentation/gitcvs-migration.txt
+++ b/Documentation/gitcvs-migration.txt
@@ -18,9 +18,9 @@ important than any other. However, you can emulate the CVS model by
designating a single shared repository which people can synchronize with;
this document explains how to do that.
-Some basic familiarity with git is required. This
-linkgit:gittutorial[7][tutorial introduction to git] and the
-linkgit:gitglossary[7][git glossary] should be sufficient.
+Some basic familiarity with git is required. Having gone through
+linkgit:gittutorial[7] and
+linkgit:gitglossary[7] should be sufficient.
Developing against a shared repository
--------------------------------------
@@ -47,25 +47,25 @@ them first before running git pull.
[NOTE]
================================
The `pull` command knows where to get updates from because of certain
-configuration variables that were set by the first `git clone`
+configuration variables that were set by the first `git-clone`
command; see `git config -l` and the linkgit:git-config[1] man
page for details.
================================
You can update the shared repository with your changes by first committing
-your changes, and then using the linkgit:git-push[1] command:
+your changes, and then using the `git-push` command:
------------------------------------------------
$ git push origin master
------------------------------------------------
to "push" those commits to the shared repository. If someone else has
-updated the repository more recently, `git push`, like `cvs commit`, will
+updated the repository more recently, `git-push`, like `cvs commit`, will
complain, in which case you must pull any changes before attempting the
push again.
-In the `git push` command above we specify the name of the remote branch
-to update (`master`). If we leave that out, `git push` tries to update
+In the `git-push` command above we specify the name of the remote branch
+to update (`master`). If we leave that out, `git-push` tries to update
any branches in the remote repository that have the same name as a branch
in the local repository. So the last `push` can be done with either of:
@@ -81,8 +81,8 @@ Setting Up a Shared Repository
------------------------------
We assume you have already created a git repository for your project,
-possibly created from scratch or from a tarball (see the
-linkgit:gittutorial[7][tutorial]), or imported from an already existing CVS
+possibly created from scratch or from a tarball (see
+linkgit:gittutorial[7]), or imported from an already existing CVS
repository (see the next section).
Assume your existing repo is at /home/alice/myproject. Create a new "bare"
@@ -118,7 +118,7 @@ Importing a CVS archive
First, install version 2.1 or higher of cvsps from
link:http://www.cobite.com/cvsps/[http://www.cobite.com/cvsps/] and make
sure it is in your path. Then cd to a checked out CVS working directory
-of the project you are interested in and run linkgit:git-cvsimport[1]:
+of the project you are interested in and run `git-cvsimport`:
-------------------------------------------
$ git cvsimport -C <destination> <module>
@@ -148,7 +148,7 @@ Advanced Shared Repository Management
Git allows you to specify scripts called "hooks" to be run at certain
points. You can use these, for example, to send all commits to the shared
-repository to a mailing list. See linkgit:githooks[5][Hooks used by git].
+repository to a mailing list. See linkgit:githooks[5].
You can enforce finer grained permissions using update hooks. See
link:howto/update-hook-example.txt[Controlling access to branches using
diff --git a/Documentation/gitdiffcore.txt b/Documentation/gitdiffcore.txt
index 4d56c85260..0b7daeda2d 100644
--- a/Documentation/gitdiffcore.txt
+++ b/Documentation/gitdiffcore.txt
@@ -12,9 +12,9 @@ git diff *
DESCRIPTION
-----------
-The diff commands git-diff-index, git-diff-files, and git-diff-tree
+The diff commands `git-diff-index`, `git-diff-files`, and `git-diff-tree`
can be told to manipulate differences they find in
-unconventional ways before showing diff(1) output. The manipulation
+unconventional ways before showing `diff` output. The manipulation
is collectively called "diffcore transformation". This short note
describes what they are and how to use them to produce diff outputs
that are easier to understand than the conventional kind.
@@ -23,18 +23,18 @@ that are easier to understand than the conventional kind.
The chain of operation
----------------------
-The git-diff-* family works by first comparing two sets of
+The `git-diff-{asterisk}` family works by first comparing two sets of
files:
- - git-diff-index compares contents of a "tree" object and the
+ - `git-diff-index` compares contents of a "tree" object and the
working directory (when '\--cached' flag is not used) or a
"tree" object and the index file (when '\--cached' flag is
used);
- - git-diff-files compares contents of the index file and the
+ - `git-diff-files` compares contents of the index file and the
working directory;
- - git-diff-tree compares contents of two "tree" objects;
+ - `git-diff-tree` compares contents of two "tree" objects;
In all of these cases, the commands themselves compare
corresponding paths in the two sets of files. The result of
@@ -61,12 +61,12 @@ into another list. There are currently 6 such transformations:
- diffcore-pickaxe
- diffcore-order
-These are applied in sequence. The set of filepairs git-diff-\*
+These are applied in sequence. The set of filepairs `git-diff-{asterisk}`
commands find are used as the input to diffcore-pathspec, and
the output from diffcore-pathspec is used as the input to the
next transformation. The final result is then passed to the
output routine and generates either diff-raw format (see Output
-format sections of the manual for git-diff-\* commands) or
+format sections of the manual for `git-diff-{asterisk}` commands) or
diff-patch format.
@@ -75,7 +75,7 @@ diffcore-pathspec: For Ignoring Files Outside Our Consideration
The first transformation in the chain is diffcore-pathspec, and
is controlled by giving the pathname parameters to the
-git-diff-* commands on the command line. The pathspec is used
+`git-diff-{asterisk}` commands on the command line. The pathspec is used
to limit the world diff operates in. It removes the filepairs
outside the specified set of pathnames. E.g. If the input set
of filepairs included:
@@ -84,11 +84,11 @@ of filepairs included:
:100644 100644 bcd1234... 0123456... M junkfile
------------------------------------------------
-but the command invocation was "git-diff-files myfile", then the
+but the command invocation was `git diff-files myfile`, then the
junkfile entry would be removed from the list because only "myfile"
is under consideration.
-Implementation note. For performance reasons, git-diff-tree
+Implementation note. For performance reasons, `git-diff-tree`
uses the pathname parameters on the command line to cull set of
filepairs it feeds the diffcore mechanism itself, and does not
use diffcore-pathspec, but the end result is the same.
@@ -98,7 +98,7 @@ diffcore-break: For Splitting Up "Complete Rewrites"
----------------------------------------------------
The second transformation in the chain is diffcore-break, and is
-controlled by the -B option to the git-diff-* commands. This is
+controlled by the -B option to the `git-diff-{asterisk}` commands. This is
used to detect a filepair that represents "complete rewrite" and
break such filepair into two filepairs that represent delete and
create. E.g. If the input contained this filepair:
@@ -134,7 +134,7 @@ diffcore-rename: For Detection Renames and Copies
This transformation is used to detect renames and copies, and is
controlled by the -M option (to detect renames) and the -C option
-(to detect copies as well) to the git-diff-* commands. If the
+(to detect copies as well) to the `git-diff-{asterisk}` commands. If the
input contained these filepairs:
------------------------------------------------
@@ -179,11 +179,11 @@ number after the "-M" or "-C" option (e.g. "-M8" to tell it to use
8/10 = 80%).
Note. When the "-C" option is used with `\--find-copies-harder`
-option, git-diff-\* commands feed unmodified filepairs to
+option, `git-diff-{asterisk}` commands feed unmodified filepairs to
diffcore mechanism as well as modified ones. This lets the copy
detector consider unmodified files as copy source candidates at
the expense of making it slower. Without `\--find-copies-harder`,
-git-diff-\* commands can detect copies only if the file that was
+`git-diff-{asterisk}` commands can detect copies only if the file that was
copied happened to have been modified in the same changeset.
@@ -234,7 +234,7 @@ diffcore-pickaxe: For Detecting Addition/Deletion of Specified String
This transformation is used to find filepairs that represent
changes that touch a specified string, and is controlled by the
--S option and the `\--pickaxe-all` option to the git-diff-*
+-S option and the `\--pickaxe-all` option to the `git-diff-{asterisk}`
commands.
When diffcore-pickaxe is in use, it checks if there are
@@ -257,7 +257,7 @@ diffcore-order: For Sorting the Output Based on Filenames
This is used to reorder the filepairs according to the user's
(or project's) taste, and is controlled by the -O option to the
-git-diff-* commands.
+`git-diff-{asterisk}` commands.
This takes a text file each of whose lines is a shell glob
pattern. Filepairs that match a glob pattern on an earlier line
diff --git a/Documentation/githooks.txt b/Documentation/githooks.txt
index 4f06ae0ed4..6a0d098f7c 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.
@@ -146,7 +147,7 @@ properties.
post-merge
-----------
-This hook is invoked by `git-merge`, which happens when a `git pull`
+This hook is invoked by `git-merge`, which happens when a `git-pull`
is done on a local repository. The hook takes a single parameter, a status
flag specifying whether or not the merge being done was a squash merge.
This hook cannot affect the outcome of `git-merge` and is not executed,
@@ -162,7 +163,7 @@ pre-receive
-----------
This hook is invoked by `git-receive-pack` on the remote repository,
-which happens when a `git push` is done on a local repository.
+which happens when a `git-push` is done on a local repository.
Just before starting to update refs on the remote repository, the
pre-receive hook is invoked. Its exit status determines the success
or failure of the update.
@@ -191,7 +192,7 @@ update
------
This hook is invoked by `git-receive-pack` on the remote repository,
-which happens when a `git push` is done on a local repository.
+which happens when a `git-push` is done on a local repository.
Just before updating the ref on the remote repository, the update hook
is invoked. Its exit status determines the success or failure of
the ref update.
@@ -234,7 +235,7 @@ post-receive
------------
This hook is invoked by `git-receive-pack` on the remote repository,
-which happens when a `git push` is done on a local repository.
+which happens when a `git-push` is done on a local repository.
It executes on the remote repository once after all the refs have
been updated.
@@ -264,7 +265,7 @@ post-update
-----------
This hook is invoked by `git-receive-pack` on the remote repository,
-which happens when a `git push` is done on a local repository.
+which happens when a `git-push` is done on a local repository.
It executes on the remote repository once after all the refs have
been updated.
diff --git a/Documentation/gitignore.txt b/Documentation/gitignore.txt
index 2881c9cb92..cafdac7e3d 100644
--- a/Documentation/gitignore.txt
+++ b/Documentation/gitignore.txt
@@ -51,10 +51,10 @@ 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
+`git-ls-files` and `git-read-tree`, read
`gitignore` patterns specified by command-line options, or from
files specified by command-line options. Higher-level git
-tools, such as linkgit:git-status[1] and linkgit:git-add[1],
+tools, such as `git-status` and `git-add`,
use patterns from the sources specified above.
Patterns have the following format:
@@ -92,7 +92,7 @@ Patterns have the following format:
An example:
--------------------------------------------------------------
- $ git-status
+ $ git status
[...]
# Untracked files:
[...]
@@ -110,7 +110,7 @@ An example:
*.html
# except foo.html which is maintained by hand
!foo.html
- $ git-status
+ $ git status
[...]
# Untracked files:
[...]
diff --git a/Documentation/gitk.txt b/Documentation/gitk.txt
index f843f39bf2..03688bfa6b 100644
--- a/Documentation/gitk.txt
+++ b/Documentation/gitk.txt
@@ -22,7 +22,8 @@ git repository.
OPTIONS
-------
To control which revisions to shown, the command takes options applicable to
-the linkgit:git-rev-list[1] command. This manual page describes only the most
+the `git-rev-list` command (see linkgit:git-rev-list[1]).
+This manual page describes only the most
frequently used options.
-n <number>::
diff --git a/Documentation/gitrepository-layout.txt b/Documentation/gitrepository-layout.txt
index 03c52ff526..ade812e0e6 100644
--- a/Documentation/gitrepository-layout.txt
+++ b/Documentation/gitrepository-layout.txt
@@ -64,7 +64,7 @@ objects/info/packs::
are available in this object store. Whenever a pack is
added or removed, `git update-server-info` should be run
to keep this file up-to-date if the repository is
- published for dumb transports. `git repack` does this
+ published for dumb transports. `git-repack` does this
by default.
objects/info/alternates::
@@ -85,7 +85,7 @@ objects/info/http-alternates::
refs::
References are stored in subdirectories of this
- directory. The `git prune` command knows to keep
+ directory. The `git-prune` command knows to keep
objects reachable from refs found in this directory and
its subdirectories.
@@ -125,7 +125,7 @@ details.
branches::
A slightly deprecated way to store shorthands to be used
- to specify URL to `git fetch`, `git pull` and `git push`
+ to specify URL to `git-fetch`, `git-pull` and `git-push`
commands is to store a file in `branches/<name>` and
give 'name' to these commands in place of 'repository'
argument.
@@ -133,9 +133,9 @@ branches::
hooks::
Hooks are customization scripts used by various git
commands. A handful of sample hooks are installed when
- `git init` is run, but all of them are disabled by
+ `git-init` is run, but all of them are disabled by
default. To enable, they need to be made executable.
- Read linkgit:githooks[5][hooks] for more details about
+ Read linkgit:githooks[5] for more details about
each hook.
index::
@@ -150,10 +150,10 @@ info/refs::
This file helps dumb transports discover what refs are
available in this repository. If the repository is
published for dumb transports, this file should be
- regenerated by `git update-server-info` every time a tag
+ regenerated by `git-update-server-info` every time a tag
or branch is created or modified. This is normally done
from the `hooks/update` hook, which is run by the
- `git-receive-pack` command when you `git push` into the
+ `git-receive-pack` command when you `git-push` into the
repository.
info/grafts::
@@ -167,18 +167,18 @@ info/grafts::
info/exclude::
This file, by convention among Porcelains, stores the
exclude pattern list. `.gitignore` is the per-directory
- ignore file. `git status`, `git add`, `git rm` and `git
- clean` look at it but the core git commands do not look
+ ignore file. `git-status`, `git-add`, `git-rm` and
+ `git-clean` look at it but the core git commands do not look
at it. See also: linkgit:gitignore[5].
remotes::
Stores shorthands to be used to give URL and default
- refnames to interact with remote repository to `git
- fetch`, `git pull` and `git push` commands.
+ refnames to interact with remote repository to
+ `git-fetch`, `git-pull` and `git-push` commands.
logs::
Records of changes made to refs are stored in this
- directory. See the documentation on git-update-ref
+ directory. See linkgit:git-update-ref[1]
for more information.
logs/refs/heads/`name`::
diff --git a/Documentation/gittutorial-2.txt b/Documentation/gittutorial-2.txt
index e3d5c1fbf0..6c93445cc1 100644
--- a/Documentation/gittutorial-2.txt
+++ b/Documentation/gittutorial-2.txt
@@ -12,8 +12,7 @@ git *
DESCRIPTION
-----------
-You should work through linkgit:gittutorial[7][A tutorial introduction to
-git] before reading this tutorial.
+You should work through linkgit:gittutorial[7] before reading this tutorial.
The goal of this tutorial is to introduce two fundamental pieces of
git's architecture--the object database and the index file--and to
@@ -55,15 +54,15 @@ following the example above generates a different SHA1 hash than
the one shown above because the commit object records the time when
it was created and the name of the person performing the commit.
-We can ask git about this particular object with the cat-file
+We can ask git about this particular object with the `cat-file`
command. Don't copy the 40 hex digits from this example but use those
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 +165,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
@@ -213,8 +212,8 @@ designate such an argument.
The index file
--------------
-The primary tool we've been using to create commits is "git commit
--a", which creates a commit including every change you've made to
+The primary tool we've been using to create commits is `git-commit
+-a`, which creates a commit including every change you've made to
your working tree. But what if you want to commit changes only to
certain files? Or only certain changes to certain files?
@@ -246,7 +245,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
@@ -256,7 +255,7 @@ index a042389..513feba 100644
+hello world, again
------------------------------------------------
-So "git diff" is comparing against something other than the head.
+So `git-diff` is comparing against something other than the head.
The thing that it's comparing against is actually the index file,
which is stored in .git/index in a binary format, but whose contents
we can examine with ls-files:
@@ -271,9 +270,9 @@ hello world!
hello world, again
------------------------------------------------
-So what our "git add" did was store a new blob and then put
+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:
------------------------------------------------
@@ -288,7 +287,7 @@ index 513feba..ba3da7b 100644
+again?
------------------------------------------------
-With the right arguments, git diff can also show us the difference
+With the right arguments, `git-diff` can also show us the difference
between the working directory and the last commit, or between the
index and the last commit:
@@ -312,8 +311,8 @@ index a042389..513feba 100644
+hello world, again
------------------------------------------------
-At any time, we can create a new commit using "git commit" (without
-the -a option), and verify that the state committed only includes the
+At any time, we can create a new commit using `git-commit` (without
+the "-a" option), and verify that the state committed only includes the
changes stored in the index file, not the additional change that is
still only in our working tree:
@@ -330,11 +329,11 @@ index 513feba..ba3da7b 100644
+again?
------------------------------------------------
-So by default "git commit" uses the index to create the commit, not
-the working tree; the -a option to commit tells it to first update
+So by default `git-commit` uses the index to create the commit, not
+the working tree; the "-a" option to commit tells it to first update
the index with all changes in the working tree.
-Finally, it's worth looking at the effect of "git add" on the index
+Finally, it's worth looking at the effect of `git-add` on the index
file:
------------------------------------------------
@@ -342,7 +341,7 @@ $ echo "goodbye, world" >closing.txt
$ git add closing.txt
------------------------------------------------
-The effect of the "git add" was to add one entry to the index file:
+The effect of the `git-add` was to add one entry to the index file:
------------------------------------------------
$ git ls-files --stage
@@ -383,14 +382,14 @@ it is marked "changed but not updated". At this point, running "git
commit" would create a commit that added closing.txt (with its new
contents), but that didn't modify file.txt.
-Also, note that a bare "git diff" shows the changes to file.txt, but
+Also, note that a bare `git diff` shows the changes to file.txt, but
not the addition of closing.txt, because the version of closing.txt
in the index file is identical to the one in the working directory.
In addition to being the staging area for new commits, the index file
is also populated from the object database when checking out a
branch, and is used to hold the trees involved in a merge operation.
-See the linkgit:gitcore-tutorial[7][core tutorial] and the relevant man
+See linkgit:gitcore-tutorial[7] and the relevant man
pages for details.
What next?
@@ -399,20 +398,19 @@ What next?
At this point you should know everything necessary to read the man
pages for any of the git commands; one good place to start would be
with the commands mentioned in link:everyday.html[Everyday git]. You
-should be able to find any unknown jargon in the
-linkgit:gitglossary[7][Glossary].
+should be able to find any unknown jargon in linkgit:gitglossary[7].
The link:user-manual.html[Git User's Manual] provides a more
comprehensive introduction to git.
-The linkgit:gitcvs-migration[7][CVS migration] document explains how to
+linkgit:gitcvs-migration[7] explains how to
import a CVS repository into git, and shows how to use git in a
CVS-like way.
For some interesting examples of git use, see the
link:howto-index.html[howtos].
-For git developers, the linkgit:gitcore-tutorial[7][Core tutorial] goes
+For git developers, linkgit:gitcore-tutorial[7] goes
into detail on the lower-level git mechanisms involved in, for
example, creating a new commit.
diff --git a/Documentation/gittutorial.txt b/Documentation/gittutorial.txt
index d465aab64e..036a27c41c 100644
--- a/Documentation/gittutorial.txt
+++ b/Documentation/gittutorial.txt
@@ -19,11 +19,11 @@ If you are instead primarily interested in using git to fetch a project,
for example, to test the latest version, you may prefer to start with
the first two chapters of link:user-manual.html[The Git User's Manual].
-First, note that you can get documentation for a command such as "git
-diff" with:
+First, note that you can get documentation for a command such as
+`git log --graph` with:
------------------------------------------------
-$ man git-diff
+$ man git-log
------------------------------------------------
It is a good idea to introduce yourself to git with your name and
@@ -58,7 +58,7 @@ You've now initialized the working directory--you may notice a new
directory created, named ".git".
Next, tell git to take a snapshot of the contents of all files under the
-current directory (note the '.'), with linkgit:git-add[1]:
+current directory (note the '.'), with `git-add`:
------------------------------------------------
$ git add .
@@ -66,7 +66,7 @@ $ git add .
This snapshot is now stored in a temporary staging area which git calls
the "index". You can permanently store the contents of the index in the
-repository with linkgit:git-commit[1]:
+repository with `git-commit`:
------------------------------------------------
$ git commit
@@ -85,15 +85,15 @@ $ git add file1 file2 file3
------------------------------------------------
You are now ready to commit. You can see what is about to be committed
-using linkgit:git-diff[1] with the --cached option:
+using `git-diff` with the --cached option:
------------------------------------------------
$ git diff --cached
------------------------------------------------
-(Without --cached, linkgit:git-diff[1] will show you any changes that
+(Without --cached, `git-diff` will show you any changes that
you've made but not yet added to the index.) You can also get a brief
-summary of the situation with linkgit:git-status[1]:
+summary of the situation with `git-status`:
------------------------------------------------
$ git status
@@ -117,7 +117,7 @@ $ git commit
This will again prompt you for a message describing the change, and then
record a new version of the project.
-Alternatively, instead of running `git add` beforehand, you can use
+Alternatively, instead of running `git-add` beforehand, you can use
------------------------------------------------
$ git commit -a
@@ -136,9 +136,9 @@ commit in the body.
Git tracks content not files
----------------------------
-Many revision control systems provide an "add" command that tells the
-system to start tracking changes to a new file. Git's "add" command
-does something simpler and more powerful: `git add` is used both for new
+Many revision control systems provide an `add` command that tells the
+system to start tracking changes to a new file. Git's `add` command
+does something simpler and more powerful: `git-add` is used both for new
and newly modified files, and in both cases it takes a snapshot of the
given files and stages that content in the index, ready for inclusion in
the next commit.
@@ -316,7 +316,7 @@ $ git remote add bob /home/bob/myrepo
------------------------------------------------
With this, Alice can perform the first operation alone using the
-"git fetch" command without merging them with her own branch,
+`git-fetch` command without merging them with her own branch,
using:
-------------------------------------
@@ -324,7 +324,7 @@ $ git fetch bob
-------------------------------------
Unlike the longhand form, when Alice fetches from Bob using a
-remote repository shorthand set up with `git remote`, what was
+remote repository shorthand set up with `git-remote`, what was
fetched is stored in a remote tracking branch, in this case
`bob/master`. So after this:
@@ -368,8 +368,8 @@ $ git config --get remote.origin.url
/home/alice/project
-------------------------------------
-(The complete configuration created by git-clone is visible using
-"git config -l", and the linkgit:git-config[1] man page
+(The complete configuration created by `git-clone` is visible using
+`git config -l`, and the linkgit:git-config[1] man page
explains the meaning of each option.)
Git also keeps a pristine copy of Alice's master branch under the
@@ -392,13 +392,13 @@ see linkgit:git-pull[1] for details.
Git can also be used in a CVS-like mode, with a central repository
that various users push changes to; see linkgit:git-push[1] and
-linkgit:gitcvs-migration[7][git for CVS users].
+linkgit:gitcvs-migration[7].
Exploring history
-----------------
Git history is represented as a series of interrelated commits. We
-have already seen that the git log command can list those commits.
+have already seen that the `git-log` command can list those commits.
Note that first line of each git log entry also gives a name for the
commit:
@@ -411,7 +411,7 @@ Date: Tue May 16 17:18:22 2006 -0700
merge-base: Clarify the comments on post processing.
-------------------------------------
-We can give this name to git show to see the details about this
+We can give this name to `git-show` to see the details about this
commit.
-------------------------------------
@@ -447,7 +447,7 @@ $ git show HEAD^2 # show the second parent of HEAD
You can also give commits names of your own; after running
-------------------------------------
-$ git-tag v2.5 1b2e1d63ff
+$ git tag v2.5 1b2e1d63ff
-------------------------------------
you can refer to 1b2e1d63ff by the name "v2.5". If you intend to
@@ -469,13 +469,13 @@ $ git reset --hard HEAD^ # reset your current branch and working
Be careful with that last command: in addition to losing any changes
in the working directory, it will also remove all later commits from
this branch. If this branch is the only branch containing those
-commits, they will be lost. Also, don't use "git reset" on a
+commits, they will be lost. Also, don't use `git-reset` on a
publicly-visible branch that other developers pull from, as it will
force needless merges on other developers to clean up the history.
-If you need to undo changes that you have pushed, use linkgit:git-revert[1]
+If you need to undo changes that you have pushed, use `git-revert`
instead.
-The git grep command can search for strings in any version of your
+The `git-grep` command can search for strings in any version of your
project, so
-------------------------------------
@@ -484,7 +484,7 @@ $ git grep "hello" v2.5
searches for all occurrences of "hello" in v2.5.
-If you leave out the commit name, git grep will search any of the
+If you leave out the commit name, `git-grep` will search any of the
files it manages in your current directory. So
-------------------------------------
@@ -494,7 +494,7 @@ $ git grep "hello"
is a quick way to search just the files that are tracked by git.
Many git commands also take sets of commits, which can be specified
-in a number of ways. Here are some examples with git log:
+in a number of ways. Here are some examples with `git-log`:
-------------------------------------
$ git log v2.5..v2.6 # commits between v2.5 and v2.6
@@ -504,7 +504,7 @@ $ git log v2.5.. Makefile # commits since v2.5 which modify
# Makefile
-------------------------------------
-You can also give git log a "range" of commits where the first is not
+You can also give `git-log` a "range" of commits where the first is not
necessarily an ancestor of the second; for example, if the tips of
the branches "stable-release" and "master" diverged from a common
commit some time ago, then
@@ -523,13 +523,13 @@ $ git log experimental..stable
will show the list of commits made on the stable branch but not
the experimental branch.
-The "git log" command has a weakness: it must present commits in a
+The `git-log` command has a weakness: it must present commits in a
list. When the history has lines of development that diverged and
-then merged back together, the order in which "git log" presents
+then merged back together, the order in which `git-log` presents
those commits is meaningless.
Most projects with multiple contributors (such as the linux kernel,
-or git itself) have frequent merges, and gitk does a better job of
+or git itself) have frequent merges, and `gitk` does a better job of
visualizing their history. For example,
-------------------------------------
@@ -549,7 +549,7 @@ of the file:
$ git diff v2.5:Makefile HEAD:Makefile.in
-------------------------------------
-You can also use "git show" to see any such file:
+You can also use `git-show` to see any such file:
-------------------------------------
$ git show v2.5:Makefile
@@ -571,9 +571,9 @@ is based:
used to create commits, check out working directories, and
hold the various trees involved in a merge.
-linkgit:gittutorial-2[7][Part two of this tutorial] explains the object
+Part two of this tutorial explains the object
database, the index file, and a few other odds and ends that you'll
-need to make the most of git.
+need to make the most of git. You can find it at linkgit:gittutorial-2[7].
If you don't want to continue with that right away, a few other
digressions that may be interesting at this point are:
@@ -592,7 +592,7 @@ digressions that may be interesting at this point are:
* link:everyday.html[Everyday GIT with 20 Commands Or So]
- * linkgit:gitcvs-migration[7][git for CVS users].
+ * linkgit:gitcvs-migration[7]: Git for CVS users.
SEE ALSO
--------
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.
diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt
index 64a820bf60..ca13266b11 100644
--- a/Documentation/user-manual.txt
+++ b/Documentation/user-manual.txt
@@ -18,7 +18,7 @@ People needing to do actual development will also want to read
Further chapters cover more specialized topics.
Comprehensive reference documentation is available through the man
-pages. For a command such as "git clone", just use
+pages. For a command such as "git clone <repo>", just use
------------------------------------------------
$ man git-clone
@@ -178,7 +178,7 @@ As you can see, a commit shows who made the latest change, what they
did, and why.
Every commit has a 40-hexdigit id, sometimes called the "object name" or the
-"SHA1 id", shown on the first line of the "git show" output. You can usually
+"SHA1 id", shown on the first line of the "git-show" output. You can usually
refer to a commit by a shorter name, such as a tag or a branch name, but this
longer name can also be useful. Most importantly, it is a globally unique
name for this commit: so if you tell somebody else the object name (for
@@ -390,7 +390,7 @@ references with the same shorthand name, see the "SPECIFYING
REVISIONS" section of linkgit:git-rev-parse[1].
[[Updating-a-repository-with-git-fetch]]
-Updating a repository with git fetch
+Updating a repository with git-fetch
------------------------------------
Eventually the developer cloned from will do additional work in her
@@ -417,7 +417,7 @@ $ git fetch linux-nfs
-------------------------------------------------
New remote-tracking branches will be stored under the shorthand name
-that you gave "git remote add", in this case linux-nfs:
+that you gave "git-remote add", in this case linux-nfs:
-------------------------------------------------
$ git branch -r
@@ -1048,7 +1048,7 @@ $ git diff
shows the difference between the working tree and the index file.
-Note that "git add" always adds just the current contents of a file
+Note that "git-add" always adds just the current contents of a file
to the index; further changes to the same file will be ignored unless
you run git-add on the file again.
@@ -1111,7 +1111,7 @@ Ignoring files
A project will often generate files that you do 'not' want to track with git.
This typically includes files generated by a build process or temporary
backup files made by your editor. Of course, 'not' tracking files with git
-is just a matter of 'not' calling "`git add`" on them. But it quickly becomes
+is just a matter of 'not' calling "`git-add`" on them. But it quickly becomes
annoying to have these untracked files lying around; e.g. they make
"`git add .`" and "`git commit -a`" practically useless, and they keep
showing up in the output of "`git status`".
@@ -1449,7 +1449,7 @@ Checking out an old version of a file
In the process of undoing a previous bad change, you may find it
useful to check out an older version of a particular file using
-linkgit:git-checkout[1]. We've used git checkout before to switch
+linkgit:git-checkout[1]. We've used git-checkout before to switch
branches, but it has quite different behavior if it is given a path
name: the command
@@ -1651,7 +1651,7 @@ Sharing development with others
===============================
[[getting-updates-with-git-pull]]
-Getting updates with git pull
+Getting updates with git-pull
-----------------------------
After you clone a repository and make a few changes of your own, you
@@ -1770,7 +1770,7 @@ Public git repositories
Another way to submit changes to a project is to tell the maintainer
of that project to pull the changes from your repository using
linkgit:git-pull[1]. In the section "<<getting-updates-with-git-pull,
-Getting updates with git pull>>" we described this as a way to get
+Getting updates with git-pull>>" we described this as a way to get
updates from the "main" repository, but it works just as well in the
other direction.
@@ -1879,8 +1879,7 @@ $ chmod a+x hooks/post-update
-------------------------------------------------
(For an explanation of the last two lines, see
-linkgit:git-update-server-info[1], and the documentation
-linkgit:githooks[5][Hooks used by git].)
+linkgit:git-update-server-info[1] and linkgit:githooks[5].)
Advertise the URL of proj.git. Anybody else should then be able to
clone or pull from that URL, for example with a command line like:
@@ -1992,7 +1991,7 @@ the right to push to the same repository. In that case, the correct
solution is to retry the push after first updating your work by either a
pull or a fetch followed by a rebase; see the
<<setting-up-a-shared-repository,next section>> and
-linkgit:gitcvs-migration[7][git for CVS users] for more.
+linkgit:gitcvs-migration[7] for more.
[[setting-up-a-shared-repository]]
Setting up a shared repository
@@ -2001,7 +2000,7 @@ Setting up a shared repository
Another way to collaborate is by using a model similar to that
commonly used in CVS, where several developers with special rights
all push to and pull from a single shared repository. See
-linkgit:gitcvs-migration[7][git for CVS users] for instructions on how to
+linkgit:gitcvs-migration[7] for instructions on how to
set this up.
However, while there is nothing wrong with git's support for shared
@@ -2736,7 +2735,7 @@ unless you've already created a reference of your own pointing to
them.
[[forcing-fetch]]
-Forcing git fetch to do non-fast-forward updates
+Forcing git-fetch to do non-fast-forward updates
------------------------------------------------
If git fetch fails because the new head of a branch is not a
@@ -2811,7 +2810,7 @@ You can also add a "+" to force the update each time:
$ git config remote.example.fetch +master:ref/remotes/example/master
-------------------------------------------------
-Don't do this unless you're sure you won't mind "git fetch" possibly
+Don't do this unless you're sure you won't mind "git-fetch" possibly
throwing away commits on mybranch.
Also note that all of the above configuration can be performed by
@@ -3235,7 +3234,7 @@ it is with linkgit:git-fsck[1]; this may be time-consuming.
Assume the output looks like this:
------------------------------------------------
-$ git-fsck --full
+$ git fsck --full
broken link from tree 2d9263c6d23595e7cb2a21e5ebbb53655278dff8
to blob 4b9458b3786228369c63936db65827de3cc06200
missing blob 4b9458b3786228369c63936db65827de3cc06200
@@ -3465,14 +3464,14 @@ done
NOTE: Do not use local URLs here if you plan to publish your superproject!
-See what files `git submodule` created:
+See what files `git-submodule` created:
-------------------------------------------------
$ ls -a
. .. .git .gitmodules a b c d
-------------------------------------------------
-The `git submodule add` command does a couple of things:
+The `git-submodule add` command does a couple of things:
- It clones the submodule under the current directory and by default checks out
the master branch.
@@ -3518,7 +3517,7 @@ init` to add the submodule repository URLs to `.git/config`:
$ git submodule init
-------------------------------------------------
-Now use `git submodule update` to clone the repositories and check out the
+Now use `git-submodule update` to clone the repositories and check out the
commits specified in the superproject:
-------------------------------------------------
@@ -3528,8 +3527,8 @@ $ ls -a
. .. .git a.txt
-------------------------------------------------
-One major difference between `git submodule update` and `git submodule add` is
-that `git submodule update` checks out a specific commit, rather than the tip
+One major difference between `git-submodule update` and `git-submodule add` is
+that `git-submodule update` checks out a specific commit, rather than the tip
of a branch. It's like checking out a tag: the head is detached, so you're not
working on a branch.
@@ -3730,7 +3729,7 @@ unsaved state that you might want to restore later!) your current
index. Normal operation is just
-------------------------------------------------
-$ git-read-tree <sha1 of tree>
+$ git read-tree <sha1 of tree>
-------------------------------------------------
and your index file will now be equivalent to the tree that you saved
@@ -3753,7 +3752,7 @@ index file with read-tree, and then you need to check out the result
with
-------------------------------------------------
-$ git-checkout-index filename
+$ git checkout-index filename
-------------------------------------------------
or, if you want to check out all of the index, use `-a`.
@@ -3790,7 +3789,7 @@ You create a commit object by giving it the tree that describes the
state at the time of the commit, and a list of parents:
-------------------------------------------------
-$ git-commit-tree <tree> -p <parent> [-p <parent2> ..]
+$ git commit-tree <tree> -p <parent> [-p <parent2> ..]
-------------------------------------------------
and then giving the reason for the commit on stdin (either through
@@ -3853,14 +3852,14 @@ linkgit:git-cat-file[1] to examine details about the
object:
-------------------------------------------------
-$ git-cat-file -t <objectname>
+$ git cat-file -t <objectname>
-------------------------------------------------
shows the type of the object, and once you have the type (which is
usually implicit in where you find the object), you can use
-------------------------------------------------
-$ git-cat-file blob|tree|commit|tag <objectname>
+$ git cat-file blob|tree|commit|tag <objectname>
-------------------------------------------------
to show its contents. NOTE! Trees have binary content, and as a result
@@ -3874,7 +3873,7 @@ follow the convention of having the top commit name in `.git/HEAD`,
you can do
-------------------------------------------------
-$ git-cat-file commit HEAD
+$ git cat-file commit HEAD
-------------------------------------------------
to see what the top commit was.
@@ -3898,7 +3897,7 @@ To get the "base" for the merge, you first look up the common parent
of two commits with
-------------------------------------------------
-$ git-merge-base <commit1> <commit2>
+$ git merge-base <commit1> <commit2>
-------------------------------------------------
which will return you the commit they are both based on. You should
@@ -3906,7 +3905,7 @@ now look up the "tree" objects of those commits, which you can easily
do with (for example)
-------------------------------------------------
-$ git-cat-file commit <commitname> | head -1
+$ git cat-file commit <commitname> | head -1
-------------------------------------------------
since the tree object information is always the first line in a commit
@@ -3923,7 +3922,7 @@ you have in your current index anyway).
To do the merge, do
-------------------------------------------------
-$ git-read-tree -m -u <origtree> <yourtree> <targettree>
+$ git read-tree -m -u <origtree> <yourtree> <targettree>
-------------------------------------------------
which will do all trivial merge operations for you directly in the
@@ -3942,18 +3941,18 @@ entries" in it. Such an index tree can 'NOT' be written out to a tree
object, and you will have to resolve any such merge clashes using
other tools before you can write out the result.
-You can examine such index state with `git-ls-files --unmerged`
+You can examine such index state with `git ls-files --unmerged`
command. An example:
------------------------------------------------
-$ git-read-tree -m $orig HEAD $target
-$ git-ls-files --unmerged
+$ git read-tree -m $orig HEAD $target
+$ git ls-files --unmerged
100644 263414f423d0e4d70dae8fe53fa34614ff3e2860 1 hello.c
100644 06fa6a24256dc7e560efa5687fa84b51f0263c3a 2 hello.c
100644 cc44c73eb783565da5831b4d820c962954019b69 3 hello.c
------------------------------------------------
-Each line of the `git-ls-files --unmerged` output begins with
+Each line of the `git ls-files --unmerged` output begins with
the blob mode bits, blob SHA1, 'stage number', and the
filename. The 'stage number' is git's way to say which tree it
came from: stage 1 corresponds to `$orig` tree, stage 2 `HEAD`
@@ -3971,9 +3970,9 @@ program, e.g. `diff3`, `merge`, or git's own merge-file, on
the blob objects from these three stages yourself, like this:
------------------------------------------------
-$ git-cat-file blob 263414f... >hello.c~1
-$ git-cat-file blob 06fa6a2... >hello.c~2
-$ git-cat-file blob cc44c73... >hello.c~3
+$ git cat-file blob 263414f... >hello.c~1
+$ git cat-file blob 06fa6a2... >hello.c~2
+$ git cat-file blob cc44c73... >hello.c~3
$ git merge-file hello.c~2 hello.c~1 hello.c~3
------------------------------------------------
@@ -3984,7 +3983,7 @@ merge result for this file is by:
-------------------------------------------------
$ mv -f hello.c~2 hello.c
-$ git-update-index hello.c
+$ git update-index hello.c
-------------------------------------------------
When a path is in unmerged state, running `git-update-index` for
@@ -3997,10 +3996,10 @@ for this. There is `git-merge-index` program that extracts the
stages to temporary files and calls a "merge" script on it:
-------------------------------------------------
-$ git-merge-index git-merge-one-file hello.c
+$ git merge-index git-merge-one-file hello.c
-------------------------------------------------
-and that is what higher level `git merge -s resolve` is implemented with.
+and that is what higher level `git-merge -s resolve` is implemented with.
[[hacking-git]]
Hacking git
@@ -4128,7 +4127,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{tilde}155^2{tilde}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
@@ -4219,10 +4218,10 @@ To find out how the result can be used, just read on in `cmd_cat_file()`:
-----------------------------------
Sometimes, you do not know where to look for a feature. In many such cases,
-it helps to search through the output of `git log`, and then `git show` the
+it helps to search through the output of `git log`, and then `git-show` the
corresponding commit.
-Example: If you know that there was some test case for `git bundle`, but
+Example: If you know that there was some test case for `git-bundle`, but
do not remember where it was (yes, you _could_ `git grep bundle t/`, but that
does not illustrate the point!):
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index f221447478..cb7cd4b538 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -16,7 +16,7 @@ elif test -d .git -o -f .git &&
case "$VN" in
*$LF*) (exit 1) ;;
v[0-9]*)
- test -z "$(git diff-index --name-only HEAD)" ||
+ test -z "$(git diff-index --name-only HEAD --)" ||
VN="$VN-dirty" ;;
esac
then
diff --git a/Makefile b/Makefile
index a2a19a85f0..78e08d3745 100644
--- a/Makefile
+++ b/Makefile
@@ -174,7 +174,7 @@ prefix = $(HOME)
bindir = $(prefix)/bin
mandir = $(prefix)/share/man
infodir = $(prefix)/share/info
-gitexecdir = $(bindir)
+gitexecdir = $(prefix)/libexec/git-core
sharedir = $(prefix)/share
template_dir = $(sharedir)/git-core/templates
htmldir=$(sharedir)/doc/git-doc
@@ -353,6 +353,7 @@ LIB_H += log-tree.h
LIB_H += mailmap.h
LIB_H += object.h
LIB_H += pack.h
+LIB_H += pack-refs.h
LIB_H += pack-revindex.h
LIB_H += parse-options.h
LIB_H += patch-ids.h
@@ -376,6 +377,7 @@ LIB_H += unpack-trees.h
LIB_H += utf8.h
LIB_H += wt-status.h
+LIB_OBJS += abspath.o
LIB_OBJS += alias.o
LIB_OBJS += alloc.o
LIB_OBJS += archive.o
@@ -428,6 +430,7 @@ LIB_OBJS += merge-file.o
LIB_OBJS += name-hash.o
LIB_OBJS += object.o
LIB_OBJS += pack-check.o
+LIB_OBJS += pack-refs.o
LIB_OBJS += pack-revindex.o
LIB_OBJS += pack-write.o
LIB_OBJS += pager.o
@@ -466,6 +469,7 @@ LIB_OBJS += unpack-trees.o
LIB_OBJS += usage.o
LIB_OBJS += utf8.o
LIB_OBJS += walker.o
+LIB_OBJS += wrapper.o
LIB_OBJS += write_or_die.o
LIB_OBJS += ws.o
LIB_OBJS += wt-status.o
@@ -1308,7 +1312,7 @@ install: all
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexecdir_SQ)'
$(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
- $(INSTALL) git$X '$(DESTDIR_SQ)$(bindir_SQ)'
+ $(INSTALL) git$X git-upload-pack$X git-receive-pack$X git-upload-archive$X '$(DESTDIR_SQ)$(bindir_SQ)'
$(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
$(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install
ifndef NO_TCLTK
@@ -1326,10 +1330,14 @@ endif
ifneq (,$X)
$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), $(RM) '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p';)
endif
+ ./check_bindir 'z$(bindir_SQ)' 'z$(gitexecdir_SQ)' '$(DESTDIR_SQ)$(bindir_SQ)/git-shell$X'
install-doc:
$(MAKE) -C Documentation install
+install-html:
+ $(MAKE) -C Documentation install-html
+
install-info:
$(MAKE) -C Documentation install-info
diff --git a/RelNotes b/RelNotes
index e29d6504d9..b9a53c3416 120000
--- a/RelNotes
+++ b/RelNotes
@@ -1 +1 @@
-Documentation/RelNotes-1.5.6.txt \ No newline at end of file
+Documentation/RelNotes-1.6.0.txt \ No newline at end of file
diff --git a/abspath.c b/abspath.c
new file mode 100644
index 0000000000..4f95a954d5
--- /dev/null
+++ b/abspath.c
@@ -0,0 +1,68 @@
+#include "cache.h"
+
+/* We allow "recursive" symbolic links. Only within reason, though. */
+#define MAXDEPTH 5
+
+const char *make_absolute_path(const char *path)
+{
+ static char bufs[2][PATH_MAX + 1], *buf = bufs[0], *next_buf = bufs[1];
+ char cwd[1024] = "";
+ int buf_index = 1, len;
+
+ int depth = MAXDEPTH;
+ char *last_elem = NULL;
+ struct stat st;
+
+ if (strlcpy(buf, path, PATH_MAX) >= PATH_MAX)
+ die ("Too long path: %.*s", 60, path);
+
+ while (depth--) {
+ if (stat(buf, &st) || !S_ISDIR(st.st_mode)) {
+ char *last_slash = strrchr(buf, '/');
+ if (last_slash) {
+ *last_slash = '\0';
+ last_elem = xstrdup(last_slash + 1);
+ } else {
+ last_elem = xstrdup(buf);
+ *buf = '\0';
+ }
+ }
+
+ if (*buf) {
+ if (!*cwd && !getcwd(cwd, sizeof(cwd)))
+ die ("Could not get current working directory");
+
+ if (chdir(buf))
+ die ("Could not switch to '%s'", buf);
+ }
+ if (!getcwd(buf, PATH_MAX))
+ die ("Could not get current working directory");
+
+ if (last_elem) {
+ int len = strlen(buf);
+ if (len + strlen(last_elem) + 2 > PATH_MAX)
+ die ("Too long path name: '%s/%s'",
+ buf, last_elem);
+ buf[len] = '/';
+ strcpy(buf + len + 1, last_elem);
+ free(last_elem);
+ last_elem = NULL;
+ }
+
+ if (!lstat(buf, &st) && S_ISLNK(st.st_mode)) {
+ len = readlink(buf, next_buf, PATH_MAX);
+ if (len < 0)
+ die ("Invalid symlink: %s", buf);
+ next_buf[len] = '\0';
+ buf = next_buf;
+ buf_index = 1 - buf_index;
+ next_buf = bufs[buf_index];
+ } else
+ break;
+ }
+
+ if (*cwd && chdir(cwd))
+ die ("Could not change back to '%s'", cwd);
+
+ return buf;
+}
diff --git a/archive-tar.c b/archive-tar.c
index d7598f907d..99db58f1cf 100644
--- a/archive-tar.c
+++ b/archive-tar.c
@@ -247,6 +247,8 @@ static int write_tar_entry(const unsigned char *sha1,
strbuf_grow(&path, PATH_MAX);
strbuf_add(&path, base, baselen);
strbuf_addstr(&path, filename);
+ if (is_archive_path_ignored(path.buf + base_len))
+ return 0;
if (S_ISDIR(mode) || S_ISGITLINK(mode)) {
strbuf_addch(&path, '/');
buffer = NULL;
diff --git a/archive-zip.c b/archive-zip.c
index 18c0f8710c..5742762ac3 100644
--- a/archive-zip.c
+++ b/archive-zip.c
@@ -176,6 +176,8 @@ static int write_zip_entry(const unsigned char *sha1,
crc = crc32(0, NULL, 0);
path = construct_path(base, baselen, filename, S_ISDIR(mode), &pathlen);
+ if (is_archive_path_ignored(path + base_len))
+ return 0;
if (verbose)
fprintf(stderr, "%s\n", path);
if (pathlen > 0xffff) {
diff --git a/archive.c b/archive.c
index 7a32c19d3c..6502b76ef1 100644
--- a/archive.c
+++ b/archive.c
@@ -82,3 +82,16 @@ void *sha1_file_to_archive(const char *path, const unsigned char *sha1,
return buffer;
}
+int is_archive_path_ignored(const char *path)
+{
+ static struct git_attr *attr_export_ignore;
+ struct git_attr_check check[1];
+
+ if (!attr_export_ignore)
+ attr_export_ignore = git_attr("export-ignore", 13);
+
+ check[0].attr = attr_export_ignore;
+ if (git_checkattr(path, ARRAY_SIZE(check), check))
+ return 0;
+ return ATTR_TRUE(check[0].value);
+}
diff --git a/archive.h b/archive.h
index 5791e657e9..ddf004acdf 100644
--- a/archive.h
+++ b/archive.h
@@ -44,5 +44,6 @@ extern int write_zip_archive(struct archiver_args *);
extern void *parse_extra_zip_args(int argc, const char **argv);
extern void *sha1_file_to_archive(const char *path, const unsigned char *sha1, unsigned int mode, enum object_type *type, unsigned long *size, const struct commit *commit);
+extern int is_archive_path_ignored(const char *path);
#endif /* ARCHIVE_H */
diff --git a/builtin-apply.c b/builtin-apply.c
index c497889312..9fcfe3955d 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -12,6 +12,7 @@
#include "blob.h"
#include "delta.h"
#include "builtin.h"
+#include "path-list.h"
/*
* --check turns on checking that the working tree matches the
@@ -153,6 +154,7 @@ struct patch {
unsigned int is_binary:1;
unsigned int is_copy:1;
unsigned int is_rename:1;
+ unsigned int recount:1;
struct fragment *fragments;
char *result;
size_t resultsize;
@@ -185,6 +187,13 @@ struct image {
struct line *line;
};
+/*
+ * Records filenames that have been touched, in order to handle
+ * the case where more than one patches touch the same file.
+ */
+
+static struct path_list fn_table;
+
static uint32_t hash_line(const char *cp, size_t len)
{
size_t i;
@@ -882,6 +891,56 @@ static int parse_range(const char *line, int len, int offset, const char *expect
return offset + ex;
}
+static void recount_diff(char *line, int size, struct fragment *fragment)
+{
+ int oldlines = 0, newlines = 0, ret = 0;
+
+ if (size < 1) {
+ warning("recount: ignore empty hunk");
+ return;
+ }
+
+ for (;;) {
+ int len = linelen(line, size);
+ size -= len;
+ line += len;
+
+ if (size < 1)
+ break;
+
+ switch (*line) {
+ case ' ': case '\n':
+ newlines++;
+ /* fall through */
+ case '-':
+ oldlines++;
+ continue;
+ case '+':
+ newlines++;
+ continue;
+ case '\\':
+ break;
+ case '@':
+ ret = size < 3 || prefixcmp(line, "@@ ");
+ break;
+ case 'd':
+ ret = size < 5 || prefixcmp(line, "diff ");
+ break;
+ default:
+ ret = -1;
+ break;
+ }
+ if (ret) {
+ warning("recount: unexpected line: %.*s",
+ (int)linelen(line, size), line);
+ return;
+ }
+ break;
+ }
+ fragment->oldlines = oldlines;
+ fragment->newlines = newlines;
+}
+
/*
* Parse a unified diff fragment header of the
* form "@@ -a,b +c,d @@"
@@ -979,8 +1038,7 @@ static int find_header(char *line, unsigned long size, int *hdrsize, struct patc
static void check_whitespace(const char *line, int len, unsigned ws_rule)
{
char *err;
- unsigned result = check_and_emit_line(line + 1, len - 1, ws_rule,
- NULL, NULL, NULL, NULL);
+ unsigned result = ws_check(line + 1, len - 1, ws_rule);
if (!result)
return;
@@ -991,7 +1049,7 @@ static void check_whitespace(const char *line, int len, unsigned ws_rule)
else {
err = whitespace_error_string(result);
fprintf(stderr, "%s:%d: %s.\n%.*s\n",
- patch_input_file, linenr, err, len - 2, line + 1);
+ patch_input_file, linenr, err, len - 2, line + 1);
free(err);
}
}
@@ -1013,6 +1071,8 @@ static int parse_fragment(char *line, unsigned long size,
offset = parse_fragment_header(line, len, fragment);
if (offset < 0)
return -1;
+ if (offset > 0 && patch->recount)
+ recount_diff(line + offset, size - offset, fragment);
oldlines = fragment->oldlines;
newlines = fragment->newlines;
leading = 0;
@@ -2176,15 +2236,62 @@ static int read_file_or_gitlink(struct cache_entry *ce, struct strbuf *buf)
return 0;
}
+static struct patch *in_fn_table(const char *name)
+{
+ struct path_list_item *item;
+
+ if (name == NULL)
+ return NULL;
+
+ item = path_list_lookup(name, &fn_table);
+ if (item != NULL)
+ return (struct patch *)item->util;
+
+ return NULL;
+}
+
+static void add_to_fn_table(struct patch *patch)
+{
+ struct path_list_item *item;
+
+ /*
+ * Always add new_name unless patch is a deletion
+ * This should cover the cases for normal diffs,
+ * file creations and copies
+ */
+ if (patch->new_name != NULL) {
+ item = path_list_insert(patch->new_name, &fn_table);
+ item->util = patch;
+ }
+
+ /*
+ * store a failure on rename/deletion cases because
+ * later chunks shouldn't patch old names
+ */
+ if ((patch->new_name == NULL) || (patch->is_rename)) {
+ item = path_list_insert(patch->old_name, &fn_table);
+ item->util = (struct patch *) -1;
+ }
+}
+
static int apply_data(struct patch *patch, struct stat *st, struct cache_entry *ce)
{
struct strbuf buf;
struct image image;
size_t len;
char *img;
+ struct patch *tpatch;
strbuf_init(&buf, 0);
- if (cached) {
+
+ if ((tpatch = in_fn_table(patch->old_name)) != NULL) {
+ if (tpatch == (struct patch *) -1) {
+ return error("patch %s has been renamed/deleted",
+ patch->old_name);
+ }
+ /* We have a patched copy in memory use that */
+ strbuf_add(&buf, tpatch->result, tpatch->resultsize);
+ } else if (cached) {
if (read_file_or_gitlink(ce, &buf))
return error("read of %s failed", patch->old_name);
} else if (patch->old_name) {
@@ -2211,6 +2318,7 @@ static int apply_data(struct patch *patch, struct stat *st, struct cache_entry *
return -1; /* note with --reject this succeeds. */
patch->result = image.buf;
patch->resultsize = image.len;
+ add_to_fn_table(patch);
free(image.line_allocated);
if (0 < patch->is_delete && patch->resultsize)
@@ -2255,6 +2363,7 @@ static int verify_index_match(struct cache_entry *ce, struct stat *st)
static int check_preimage(struct patch *patch, struct cache_entry **ce, struct stat *st)
{
const char *old_name = patch->old_name;
+ struct patch *tpatch;
int stat_ret = 0;
unsigned st_mode = 0;
@@ -2268,12 +2377,17 @@ static int check_preimage(struct patch *patch, struct cache_entry **ce, struct s
return 0;
assert(patch->is_new <= 0);
- if (!cached) {
+ if ((tpatch = in_fn_table(old_name)) != NULL) {
+ if (tpatch == (struct patch *) -1) {
+ return error("%s: has been deleted/renamed", old_name);
+ }
+ st_mode = tpatch->new_mode;
+ } else if (!cached) {
stat_ret = lstat(old_name, st);
if (stat_ret && errno != ENOENT)
return error("%s: %s", old_name, strerror(errno));
}
- if (check_index) {
+ if (check_index && !tpatch) {
int pos = cache_name_pos(old_name, strlen(old_name));
if (pos < 0) {
if (patch->is_new < 0)
@@ -2325,7 +2439,7 @@ static int check_preimage(struct patch *patch, struct cache_entry **ce, struct s
return 0;
}
-static int check_patch(struct patch *patch, struct patch *prev_patch)
+static int check_patch(struct patch *patch)
{
struct stat st;
const char *old_name = patch->old_name;
@@ -2342,8 +2456,7 @@ static int check_patch(struct patch *patch, struct patch *prev_patch)
return status;
old_name = patch->old_name;
- if (new_name && prev_patch && 0 < prev_patch->is_delete &&
- !strcmp(prev_patch->old_name, new_name))
+ if (in_fn_table(new_name) == (struct patch *) -1)
/*
* A type-change diff is always split into a patch to
* delete old, immediately followed by a patch to
@@ -2393,15 +2506,14 @@ static int check_patch(struct patch *patch, struct patch *prev_patch)
static int check_patch_list(struct patch *patch)
{
- struct patch *prev_patch = NULL;
int err = 0;
- for (prev_patch = NULL; patch ; patch = patch->next) {
+ while (patch) {
if (apply_verbosely)
say_patch_name(stderr,
"Checking patch ", patch, "...\n");
- err |= check_patch(patch, prev_patch);
- prev_patch = patch;
+ err |= check_patch(patch);
+ patch = patch->next;
}
return err;
}
@@ -2912,13 +3024,18 @@ static void prefix_patches(struct patch *p)
}
}
-static int apply_patch(int fd, const char *filename, int inaccurate_eof)
+#define INACCURATE_EOF (1<<0)
+#define RECOUNT (1<<1)
+
+static int apply_patch(int fd, const char *filename, int options)
{
size_t offset;
struct strbuf buf;
struct patch *list = NULL, **listp = &list;
int skipped_patch = 0;
+ /* FIXME - memory leak when using multiple patch files as inputs */
+ memset(&fn_table, 0, sizeof(struct path_list));
strbuf_init(&buf, 0);
patch_input_file = filename;
read_patch_file(&buf, fd);
@@ -2928,7 +3045,8 @@ static int apply_patch(int fd, const char *filename, int inaccurate_eof)
int nr;
patch = xcalloc(1, sizeof(*patch));
- patch->inaccurate_eof = inaccurate_eof;
+ patch->inaccurate_eof = !!(options & INACCURATE_EOF);
+ patch->recount = !!(options & RECOUNT);
nr = parse_chunk(buf.buf + offset, buf.len - offset, patch);
if (nr < 0)
break;
@@ -2997,7 +3115,7 @@ int cmd_apply(int argc, const char **argv, const char *unused_prefix)
{
int i;
int read_stdin = 1;
- int inaccurate_eof = 0;
+ int options = 0;
int errs = 0;
int is_not_gitdir;
@@ -3015,7 +3133,7 @@ int cmd_apply(int argc, const char **argv, const char *unused_prefix)
int fd;
if (!strcmp(arg, "-")) {
- errs |= apply_patch(0, "<stdin>", inaccurate_eof);
+ errs |= apply_patch(0, "<stdin>", options);
read_stdin = 0;
continue;
}
@@ -3115,7 +3233,11 @@ int cmd_apply(int argc, const char **argv, const char *unused_prefix)
continue;
}
if (!strcmp(arg, "--inaccurate-eof")) {
- inaccurate_eof = 1;
+ options |= INACCURATE_EOF;
+ continue;
+ }
+ if (!strcmp(arg, "--recount")) {
+ options |= RECOUNT;
continue;
}
if (0 < prefix_length)
@@ -3126,12 +3248,12 @@ int cmd_apply(int argc, const char **argv, const char *unused_prefix)
die("can't open patch '%s': %s", arg, strerror(errno));
read_stdin = 0;
set_default_whitespace_mode(whitespace_option);
- errs |= apply_patch(fd, arg, inaccurate_eof);
+ errs |= apply_patch(fd, arg, options);
close(fd);
}
set_default_whitespace_mode(whitespace_option);
if (read_stdin)
- errs |= apply_patch(0, "<stdin>", inaccurate_eof);
+ errs |= apply_patch(0, "<stdin>", options);
if (whitespace_error) {
if (squelch_whitespace_errors &&
squelch_whitespace_errors < whitespace_error) {
diff --git a/builtin-cat-file.c b/builtin-cat-file.c
index bd343efae7..880e75af5e 100644
--- a/builtin-cat-file.c
+++ b/builtin-cat-file.c
@@ -181,6 +181,7 @@ static int batch_one_object(const char *obj_name, int print_contents)
write_or_die(1, contents, size);
printf("\n");
fflush(stdout);
+ free(contents);
}
return 0;
diff --git a/builtin-clone.c b/builtin-clone.c
index 7190952071..643c7d4169 100644
--- a/builtin-clone.c
+++ b/builtin-clone.c
@@ -18,6 +18,7 @@
#include "transport.h"
#include "strbuf.h"
#include "dir.h"
+#include "pack-refs.h"
/*
* Overall FIXMEs:
@@ -321,8 +322,11 @@ static struct ref *write_remote_refs(const struct ref *refs,
get_fetch_map(refs, tag_refspec, &tail, 0);
for (r = local_refs; r; r = r->next)
- update_ref(reflog,
- r->peer_ref->name, r->old_sha1, NULL, 0, DIE_ON_ERR);
+ add_extra_ref(r->peer_ref->name, r->old_sha1, 0);
+
+ pack_refs(PACK_REFS_ALL);
+ clear_extra_refs();
+
return local_refs;
}
@@ -400,6 +404,9 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
if (!option_bare) {
junk_work_tree = work_tree;
+ if (safe_create_leading_directories_const(work_tree) < 0)
+ die("could not create leading directories of '%s'",
+ work_tree);
if (mkdir(work_tree, 0755))
die("could not create work tree dir '%s'.", work_tree);
set_git_work_tree(work_tree);
@@ -410,11 +417,20 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
setenv(CONFIG_ENVIRONMENT, xstrdup(mkpath("%s/config", git_dir)), 1);
+ if (safe_create_leading_directories_const(git_dir) < 0)
+ die("could not create leading directories of '%s'", git_dir);
set_git_dir(make_absolute_path(git_dir));
fprintf(stderr, "Initialize %s\n", git_dir);
init_db(option_template, option_quiet ? INIT_DB_QUIET : 0);
+ /*
+ * At this point, the config exists, so we do not need the
+ * environment variable. We actually need to unset it, too, to
+ * re-enable parsing of the global configs.
+ */
+ unsetenv(CONFIG_ENVIRONMENT);
+
if (option_reference)
setup_reference(git_dir);
@@ -447,7 +463,8 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
refs = clone_local(path, git_dir);
else {
struct remote *remote = remote_get(argv[0]);
- struct transport *transport = transport_get(remote, argv[0]);
+ struct transport *transport =
+ transport_get(remote, remote->url[0]);
if (!transport->get_refs_list || !transport->fetch)
die("Don't know how to clone %s", transport->url);
diff --git a/builtin-commit-tree.c b/builtin-commit-tree.c
index e5e4bdbe86..3881f6c2f5 100644
--- a/builtin-commit-tree.c
+++ b/builtin-commit-tree.c
@@ -24,26 +24,20 @@ static void check_valid(unsigned char *sha1, enum object_type expect)
typename(expect));
}
-/*
- * Having more than two parents is not strange at all, and this is
- * how multi-way merges are represented.
- */
-#define MAXPARENT (16)
-static unsigned char parent_sha1[MAXPARENT][20];
-
static const char commit_tree_usage[] = "git-commit-tree <sha1> [-p <sha1>]* < changelog";
-static int new_parent(int idx)
+static void new_parent(struct commit *parent, struct commit_list **parents_p)
{
- int i;
- unsigned char *sha1 = parent_sha1[idx];
- for (i = 0; i < idx; i++) {
- if (!hashcmp(parent_sha1[i], sha1)) {
+ unsigned char *sha1 = parent->object.sha1;
+ struct commit_list *parents;
+ for (parents = *parents_p; parents; parents = parents->next) {
+ if (parents->item == parent) {
error("duplicate parent %s ignored", sha1_to_hex(sha1));
- return 0;
+ return;
}
+ parents_p = &parents->next;
}
- return 1;
+ commit_list_insert(parent, parents_p);
}
static const char commit_utf8_warn[] =
@@ -54,7 +48,7 @@ static const char commit_utf8_warn[] =
int cmd_commit_tree(int argc, const char **argv, const char *prefix)
{
int i;
- int parents = 0;
+ struct commit_list *parents = NULL;
unsigned char tree_sha1[20];
unsigned char commit_sha1[20];
struct strbuf buffer;
@@ -69,18 +63,16 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix)
check_valid(tree_sha1, OBJ_TREE);
for (i = 2; i < argc; i += 2) {
+ unsigned char sha1[20];
const char *a, *b;
a = argv[i]; b = argv[i+1];
if (!b || strcmp(a, "-p"))
usage(commit_tree_usage);
- if (parents >= MAXPARENT)
- die("Too many parents (%d max)", MAXPARENT);
- if (get_sha1(b, parent_sha1[parents]))
+ if (get_sha1(b, sha1))
die("Not a valid object name %s", b);
- check_valid(parent_sha1[parents], OBJ_COMMIT);
- if (new_parent(parents))
- parents++;
+ check_valid(sha1, OBJ_COMMIT);
+ new_parent(lookup_commit(sha1), &parents);
}
/* Not having i18n.commitencoding is the same as having utf-8 */
@@ -94,8 +86,13 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix)
* different order of parents will be a _different_ changeset even
* if everything else stays the same.
*/
- for (i = 0; i < parents; i++)
- strbuf_addf(&buffer, "parent %s\n", sha1_to_hex(parent_sha1[i]));
+ while (parents) {
+ struct commit_list *next = parents->next;
+ strbuf_addf(&buffer, "parent %s\n",
+ sha1_to_hex(parents->item->object.sha1));
+ free(parents);
+ parents = next;
+ }
/* Person/date information */
strbuf_addf(&buffer, "author %s\n", git_author_info(IDENT_ERROR_ON_NO_NAME));
diff --git a/builtin-commit.c b/builtin-commit.c
index 90200ed643..e3ad38b3bd 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -49,7 +49,8 @@ static char *logfile, *force_author, *template_file;
static char *edit_message, *use_message;
static char *author_name, *author_email, *author_date;
static int all, edit_flag, also, interactive, only, amend, signoff;
-static int quiet, verbose, untracked_files, no_verify, allow_empty;
+static int quiet, verbose, no_verify, allow_empty;
+static char *untracked_files_arg;
/*
* The default commit message cleanup mode will remove the lines
* beginning with # (shell comments) and leading and trailing
@@ -102,7 +103,7 @@ static struct option builtin_commit_options[] = {
OPT_BOOLEAN('o', "only", &only, "commit only specified files"),
OPT_BOOLEAN('n', "no-verify", &no_verify, "bypass pre-commit hook"),
OPT_BOOLEAN(0, "amend", &amend, "amend previous commit"),
- OPT_BOOLEAN('u', "untracked-files", &untracked_files, "show all untracked files"),
+ { OPTION_STRING, 'u', "untracked-files", &untracked_files_arg, "mode", "show untracked files, optional modes: all, normal, no. (Default: all)", PARSE_OPT_OPTARG, NULL, (intptr_t)"all" },
OPT_BOOLEAN(0, "allow-empty", &allow_empty, "ok to record an empty change"),
OPT_STRING(0, "cleanup", &cleanup_arg, "default", "how to strip spaces and #comments from message"),
@@ -347,7 +348,7 @@ static int run_status(FILE *fp, const char *index_file, const char *prefix, int
s.reference = "HEAD^1";
}
s.verbose = verbose;
- s.untracked = untracked_files;
+ s.untracked = (show_untracked_files == SHOW_ALL_UNTRACKED_FILES);
s.index_file = index_file;
s.fp = fp;
s.nowarn = nowarn;
@@ -502,7 +503,8 @@ static int prepare_to_commit(const char *index_file, const char *prefix)
fp = fopen(git_path(commit_editmsg), "w");
if (fp == NULL)
- die("could not open %s", git_path(commit_editmsg));
+ die("could not open %s: %s",
+ git_path(commit_editmsg), strerror(errno));
if (cleanup_mode != CLEANUP_NONE)
stripspace(&sb, 0);
@@ -795,6 +797,17 @@ static int parse_and_validate_options(int argc, const char *argv[],
else
die("Invalid cleanup mode %s", cleanup_arg);
+ if (!untracked_files_arg)
+ ; /* default already initialized */
+ else if (!strcmp(untracked_files_arg, "no"))
+ show_untracked_files = SHOW_NO_UNTRACKED_FILES;
+ else if (!strcmp(untracked_files_arg, "normal"))
+ show_untracked_files = SHOW_NORMAL_UNTRACKED_FILES;
+ else if (!strcmp(untracked_files_arg, "all"))
+ show_untracked_files = SHOW_ALL_UNTRACKED_FILES;
+ else
+ die("Invalid untracked files mode '%s'", untracked_files_arg);
+
if (all && argc > 0)
die("Paths with -a does not make sense.");
else if (interactive && argc > 0)
diff --git a/builtin-describe.c b/builtin-describe.c
index 3da99c1d06..e515f9ca9b 100644
--- a/builtin-describe.c
+++ b/builtin-describe.c
@@ -204,7 +204,7 @@ static void describe(const char *arg, int last_one)
*/
display_name(n);
if (longformat)
- show_suffix(0, n->tag->tagged->sha1);
+ show_suffix(0, n->tag ? n->tag->tagged->sha1 : sha1);
printf("\n");
return;
}
diff --git a/builtin-fast-export.c b/builtin-fast-export.c
index d0a462ff8b..45786ef1b7 100644
--- a/builtin-fast-export.c
+++ b/builtin-fast-export.c
@@ -56,10 +56,24 @@ static int has_unshown_parent(struct commit *commit)
}
/* Since intptr_t is C99, we do not use it here */
-static void mark_object(struct object *object)
+static inline uint32_t *mark_to_ptr(uint32_t mark)
{
- last_idnum++;
- add_decoration(&idnums, object, ((uint32_t *)NULL) + last_idnum);
+ return ((uint32_t *)NULL) + mark;
+}
+
+static inline uint32_t ptr_to_mark(void * mark)
+{
+ return (uint32_t *)mark - (uint32_t *)NULL;
+}
+
+static inline void mark_object(struct object *object, uint32_t mark)
+{
+ add_decoration(&idnums, object, mark_to_ptr(mark));
+}
+
+static inline void mark_next_object(struct object *object)
+{
+ mark_object(object, ++last_idnum);
}
static int get_object_mark(struct object *object)
@@ -67,7 +81,7 @@ static int get_object_mark(struct object *object)
void *decoration = lookup_decoration(&idnums, object);
if (!decoration)
return 0;
- return (uint32_t *)decoration - (uint32_t *)NULL;
+ return ptr_to_mark(decoration);
}
static void show_progress(void)
@@ -100,7 +114,7 @@ static void handle_object(const unsigned char *sha1)
if (!buf)
die ("Could not read blob %s", sha1_to_hex(sha1));
- mark_object(object);
+ mark_next_object(object);
printf("blob\nmark :%d\ndata %lu\n", last_idnum, size);
if (size && fwrite(buf, size, 1, stdout) != 1)
@@ -185,7 +199,7 @@ static void handle_commit(struct commit *commit, struct rev_info *rev)
for (i = 0; i < diff_queued_diff.nr; i++)
handle_object(diff_queued_diff.queue[i]->two->sha1);
- mark_object(&commit->object);
+ mark_next_object(&commit->object);
if (!is_encoding_utf8(encoding))
reencoded = reencode_string(message, "UTF-8", encoding);
if (!commit->parents)
@@ -354,18 +368,85 @@ static void handle_tags_and_duplicates(struct path_list *extra_refs)
}
}
+static void export_marks(char *file)
+{
+ unsigned int i;
+ uint32_t mark;
+ struct object_decoration *deco = idnums.hash;
+ FILE *f;
+
+ f = fopen(file, "w");
+ if (!f)
+ error("Unable to open marks file %s for writing", file);
+
+ for (i = 0; i < idnums.size; ++i) {
+ deco++;
+ if (deco && deco->base && deco->base->type == 1) {
+ mark = ptr_to_mark(deco->decoration);
+ fprintf(f, ":%u %s\n", mark, sha1_to_hex(deco->base->sha1));
+ }
+ }
+
+ if (ferror(f) || fclose(f))
+ error("Unable to write marks file %s.", file);
+}
+
+static void import_marks(char * input_file)
+{
+ char line[512];
+ FILE *f = fopen(input_file, "r");
+ if (!f)
+ die("cannot read %s: %s", input_file, strerror(errno));
+
+ while (fgets(line, sizeof(line), f)) {
+ uint32_t mark;
+ char *line_end, *mark_end;
+ unsigned char sha1[20];
+ struct object *object;
+
+ line_end = strchr(line, '\n');
+ if (line[0] != ':' || !line_end)
+ die("corrupt mark line: %s", line);
+ *line_end = 0;
+
+ mark = strtoumax(line + 1, &mark_end, 10);
+ if (!mark || mark_end == line + 1
+ || *mark_end != ' ' || get_sha1(mark_end + 1, sha1))
+ die("corrupt mark line: %s", line);
+
+ object = parse_object(sha1);
+ if (!object)
+ die ("Could not read blob %s", sha1_to_hex(sha1));
+
+ if (object->flags & SHOWN)
+ error("Object %s already has a mark", sha1);
+
+ mark_object(object, mark);
+ if (last_idnum < mark)
+ last_idnum = mark;
+
+ object->flags |= SHOWN;
+ }
+ fclose(f);
+}
+
int cmd_fast_export(int argc, const char **argv, const char *prefix)
{
struct rev_info revs;
struct object_array commits = { 0, 0, NULL };
struct path_list extra_refs = { NULL, 0, 0, 0 };
struct commit *commit;
+ char *export_filename = NULL, *import_filename = NULL;
struct option options[] = {
OPT_INTEGER(0, "progress", &progress,
"show progress after <n> objects"),
OPT_CALLBACK(0, "signed-tags", &signed_tag_mode, "mode",
"select handling of signed tags",
parse_opt_signed_tag_mode),
+ OPT_STRING(0, "export-marks", &export_filename, "FILE",
+ "Dump marks to this file"),
+ OPT_STRING(0, "import-marks", &import_filename, "FILE",
+ "Import marks from this file"),
OPT_END()
};
@@ -378,6 +459,9 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)
if (argc > 1)
usage_with_options (fast_export_usage, options);
+ if (import_filename)
+ import_marks(import_filename);
+
get_tags_and_duplicates(&revs.pending, &extra_refs);
if (prepare_revision_walk(&revs))
@@ -400,5 +484,8 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)
handle_tags_and_duplicates(&extra_refs);
+ if (export_filename)
+ export_marks(export_filename);
+
return 0;
}
diff --git a/builtin-fetch-pack.c b/builtin-fetch-pack.c
index de1e8d1365..2175c6d0d6 100644
--- a/builtin-fetch-pack.c
+++ b/builtin-fetch-pack.c
@@ -309,7 +309,8 @@ done:
}
flushes--;
}
- return retval;
+ /* it is no error to fetch into a completely empty repo */
+ return count ? retval : 0;
}
static struct commit_list *complete;
@@ -820,5 +821,6 @@ struct ref *fetch_pack(struct fetch_pack_args *my_args,
}
}
+ reprepare_packed_git();
return ref_cpy;
}
diff --git a/builtin-fetch.c b/builtin-fetch.c
index e81ee2d02b..97fdc51e31 100644
--- a/builtin-fetch.c
+++ b/builtin-fetch.c
@@ -181,9 +181,9 @@ static int s_update_ref(const char *action,
lock = lock_any_ref_for_update(ref->name,
check_old ? ref->old_sha1 : NULL, 0);
if (!lock)
- return 1;
+ return 2;
if (write_ref_sha1(lock, ref->new_sha1, msg) < 0)
- return 1;
+ return 2;
return 0;
}
@@ -233,10 +233,12 @@ static int update_local_ref(struct ref *ref,
if (!is_null_sha1(ref->old_sha1) &&
!prefixcmp(ref->name, "refs/tags/")) {
- sprintf(display, "- %-*s %-*s -> %s",
+ int r;
+ r = s_update_ref("updating tag", ref, 0);
+ sprintf(display, "%c %-*s %-*s -> %s%s", r ? '!' : '-',
SUMMARY_WIDTH, "[tag update]", REFCOL_WIDTH, remote,
- pretty_ref);
- return s_update_ref("updating tag", ref, 0);
+ pretty_ref, r ? " (unable to update local ref)" : "");
+ return r;
}
current = lookup_commit_reference_gently(ref->old_sha1, 1);
@@ -244,6 +246,7 @@ static int update_local_ref(struct ref *ref,
if (!current || !updated) {
const char *msg;
const char *what;
+ int r;
if (!strncmp(ref->name, "refs/tags/", 10)) {
msg = "storing tag";
what = "[new tag]";
@@ -253,27 +256,36 @@ static int update_local_ref(struct ref *ref,
what = "[new branch]";
}
- sprintf(display, "* %-*s %-*s -> %s", SUMMARY_WIDTH, what,
- REFCOL_WIDTH, remote, pretty_ref);
- return s_update_ref(msg, ref, 0);
+ r = s_update_ref(msg, ref, 0);
+ sprintf(display, "%c %-*s %-*s -> %s%s", r ? '!' : '*',
+ SUMMARY_WIDTH, what, REFCOL_WIDTH, remote, pretty_ref,
+ r ? " (unable to update local ref)" : "");
+ return r;
}
if (in_merge_bases(current, &updated, 1)) {
char quickref[83];
+ int r;
strcpy(quickref, find_unique_abbrev(current->object.sha1, DEFAULT_ABBREV));
strcat(quickref, "..");
strcat(quickref, find_unique_abbrev(ref->new_sha1, DEFAULT_ABBREV));
- sprintf(display, " %-*s %-*s -> %s", SUMMARY_WIDTH, quickref,
- REFCOL_WIDTH, remote, pretty_ref);
- return s_update_ref("fast forward", ref, 1);
+ r = s_update_ref("fast forward", ref, 1);
+ sprintf(display, "%c %-*s %-*s -> %s%s", r ? '!' : ' ',
+ SUMMARY_WIDTH, quickref, REFCOL_WIDTH, remote,
+ pretty_ref, r ? " (unable to update local ref)" : "");
+ return r;
} else if (force || ref->force) {
char quickref[84];
+ int r;
strcpy(quickref, find_unique_abbrev(current->object.sha1, DEFAULT_ABBREV));
strcat(quickref, "...");
strcat(quickref, find_unique_abbrev(ref->new_sha1, DEFAULT_ABBREV));
- sprintf(display, "+ %-*s %-*s -> %s (forced update)",
- SUMMARY_WIDTH, quickref, REFCOL_WIDTH, remote, pretty_ref);
- return s_update_ref("forced-update", ref, 1);
+ r = s_update_ref("forced-update", ref, 1);
+ sprintf(display, "%c %-*s %-*s -> %s (%s)", r ? '!' : '+',
+ SUMMARY_WIDTH, quickref, REFCOL_WIDTH, remote,
+ pretty_ref,
+ r ? "unable to update local ref" : "forced update");
+ return r;
} else {
sprintf(display, "! %-*s %-*s -> %s (non fast forward)",
SUMMARY_WIDTH, "[rejected]", REFCOL_WIDTH, remote,
@@ -282,7 +294,8 @@ static int update_local_ref(struct ref *ref,
}
}
-static int store_updated_refs(const char *url, struct ref *ref_map)
+static int store_updated_refs(const char *url, const char *remote_name,
+ struct ref *ref_map)
{
FILE *fp;
struct commit *commit;
@@ -368,6 +381,10 @@ static int store_updated_refs(const char *url, struct ref *ref_map)
}
}
fclose(fp);
+ if (rc & 2)
+ error("some local refs could not be updated; try running\n"
+ " 'git remote prune %s' to remove any old, conflicting "
+ "branches", remote_name);
return rc;
}
@@ -438,7 +455,9 @@ static int fetch_refs(struct transport *transport, struct ref *ref_map)
if (ret)
ret = transport_fetch_refs(transport, ref_map);
if (!ret)
- ret |= store_updated_refs(transport->url, ref_map);
+ ret |= store_updated_refs(transport->url,
+ transport->remote->name,
+ ref_map);
transport_unlock_pack(transport);
return ret;
}
diff --git a/builtin-for-each-ref.c b/builtin-for-each-ref.c
index 07d9c57212..fef93d7488 100644
--- a/builtin-for-each-ref.c
+++ b/builtin-for-each-ref.c
@@ -234,6 +234,13 @@ static void grab_tag_values(struct atom_value *val, int deref, struct object *ob
name++;
if (!strcmp(name, "tag"))
v->s = tag->tag;
+ else if (!strcmp(name, "type") && tag->tagged)
+ v->s = typename(tag->tagged->type);
+ else if (!strcmp(name, "object") && tag->tagged) {
+ char *s = xmalloc(41);
+ strcpy(s, sha1_to_hex(tag->tagged->sha1));
+ v->s = s;
+ }
}
}
diff --git a/builtin-fsck.c b/builtin-fsck.c
index 78a6e1ff71..b0f9648f86 100644
--- a/builtin-fsck.c
+++ b/builtin-fsck.c
@@ -585,7 +585,7 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)
prepare_packed_git();
for (p = packed_git; p; p = p->next)
/* verify gives error messages itself */
- verify_pack(p, 0);
+ verify_pack(p);
for (p = packed_git; p; p = p->next) {
uint32_t j, num;
diff --git a/builtin-log.c b/builtin-log.c
index 9817d6fbeb..9979e37f38 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -360,7 +360,7 @@ int cmd_show(int argc, const char **argv, const char *prefix)
t->tag,
diff_get_color_opt(&rev.diffopt, DIFF_RESET));
ret = show_object(o->sha1, 1, &rev);
- objects[i].item = (struct object *)t->tagged;
+ objects[i].item = parse_object(t->tagged->sha1);
i--;
break;
}
diff --git a/builtin-merge-recursive.c b/builtin-merge-recursive.c
index 4aa28a1bab..43bf6aa45e 100644
--- a/builtin-merge-recursive.c
+++ b/builtin-merge-recursive.c
@@ -481,15 +481,6 @@ static char *unique_path(const char *path, const char *branch)
return newpath;
}
-static int mkdir_p(const char *path, unsigned long mode)
-{
- /* path points to cache entries, so xstrdup before messing with it */
- char *buf = xstrdup(path);
- int result = safe_create_leading_directories(buf);
- free(buf);
- return result;
-}
-
static void flush_buffer(int fd, const char *buf, unsigned long size)
{
while (size > 0) {
@@ -512,7 +503,7 @@ static int make_room_for_path(const char *path)
int status;
const char *msg = "failed to create path '%s'%s";
- status = mkdir_p(path, 0777);
+ status = safe_create_leading_directories_const(path);
if (status) {
if (status == -3) {
/* something else exists */
@@ -583,7 +574,7 @@ static void update_file_flags(const unsigned char *sha,
close(fd);
} else if (S_ISLNK(mode)) {
char *lnk = xmemdupz(buf, size);
- mkdir_p(path, 0777);
+ safe_create_leading_directories_const(path);
unlink(path);
symlink(lnk, path);
free(lnk);
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index 447d492dbb..28207d9b3a 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -209,28 +209,6 @@ static int check_pack_inflate(struct packed_git *p,
stream.total_in == len) ? 0 : -1;
}
-static int check_pack_crc(struct packed_git *p, struct pack_window **w_curs,
- off_t offset, off_t len, unsigned int nr)
-{
- const uint32_t *index_crc;
- uint32_t data_crc = crc32(0, Z_NULL, 0);
-
- do {
- unsigned int avail;
- void *data = use_pack(p, w_curs, offset, &avail);
- if (avail > len)
- avail = len;
- data_crc = crc32(data_crc, data, avail);
- offset += avail;
- len -= avail;
- } while (len);
-
- index_crc = p->index_data;
- index_crc += 2 + 256 + p->num_objects * (20/4) + nr;
-
- return data_crc != ntohl(*index_crc);
-}
-
static void copy_pack_data(struct sha1file *f,
struct packed_git *p,
struct pack_window **w_curs,
@@ -1148,8 +1126,6 @@ static void get_object_details(void)
sorted_by_offset[i] = objects + i;
qsort(sorted_by_offset, nr_objects, sizeof(*sorted_by_offset), pack_offset_sort);
- init_pack_revindex();
-
for (i = 0; i < nr_objects; i++)
check_object(sorted_by_offset[i]);
diff --git a/builtin-pack-refs.c b/builtin-pack-refs.c
index 1aaa76dd1f..ff90aefa1c 100644
--- a/builtin-pack-refs.c
+++ b/builtin-pack-refs.c
@@ -1,125 +1,6 @@
-#include "builtin.h"
#include "cache.h"
-#include "refs.h"
-#include "object.h"
-#include "tag.h"
#include "parse-options.h"
-
-struct ref_to_prune {
- struct ref_to_prune *next;
- unsigned char sha1[20];
- char name[FLEX_ARRAY];
-};
-
-#define PACK_REFS_PRUNE 0x0001
-#define PACK_REFS_ALL 0x0002
-
-struct pack_refs_cb_data {
- unsigned int flags;
- struct ref_to_prune *ref_to_prune;
- FILE *refs_file;
-};
-
-static int do_not_prune(int flags)
-{
- /* If it is already packed or if it is a symref,
- * do not prune it.
- */
- return (flags & (REF_ISSYMREF|REF_ISPACKED));
-}
-
-static int handle_one_ref(const char *path, const unsigned char *sha1,
- int flags, void *cb_data)
-{
- struct pack_refs_cb_data *cb = cb_data;
- int is_tag_ref;
-
- /* Do not pack the symbolic refs */
- if ((flags & REF_ISSYMREF))
- return 0;
- is_tag_ref = !prefixcmp(path, "refs/tags/");
-
- /* ALWAYS pack refs that were already packed or are tags */
- if (!(cb->flags & PACK_REFS_ALL) && !is_tag_ref && !(flags & REF_ISPACKED))
- return 0;
-
- fprintf(cb->refs_file, "%s %s\n", sha1_to_hex(sha1), path);
- if (is_tag_ref) {
- struct object *o = parse_object(sha1);
- if (o->type == OBJ_TAG) {
- o = deref_tag(o, path, 0);
- if (o)
- fprintf(cb->refs_file, "^%s\n",
- sha1_to_hex(o->sha1));
- }
- }
-
- if ((cb->flags & PACK_REFS_PRUNE) && !do_not_prune(flags)) {
- int namelen = strlen(path) + 1;
- struct ref_to_prune *n = xcalloc(1, sizeof(*n) + namelen);
- hashcpy(n->sha1, sha1);
- strcpy(n->name, path);
- n->next = cb->ref_to_prune;
- cb->ref_to_prune = n;
- }
- return 0;
-}
-
-/* make sure nobody touched the ref, and unlink */
-static void prune_ref(struct ref_to_prune *r)
-{
- struct ref_lock *lock = lock_ref_sha1(r->name + 5, r->sha1);
-
- if (lock) {
- unlink(git_path("%s", r->name));
- unlock_ref(lock);
- }
-}
-
-static void prune_refs(struct ref_to_prune *r)
-{
- while (r) {
- prune_ref(r);
- r = r->next;
- }
-}
-
-static struct lock_file packed;
-
-static int pack_refs(unsigned int flags)
-{
- int fd;
- struct pack_refs_cb_data cbdata;
-
- memset(&cbdata, 0, sizeof(cbdata));
- cbdata.flags = flags;
-
- fd = hold_lock_file_for_update(&packed, git_path("packed-refs"), 1);
- cbdata.refs_file = fdopen(fd, "w");
- if (!cbdata.refs_file)
- die("unable to create ref-pack file structure (%s)",
- strerror(errno));
-
- /* perhaps other traits later as well */
- fprintf(cbdata.refs_file, "# pack-refs with: peeled \n");
-
- for_each_ref(handle_one_ref, &cbdata);
- if (ferror(cbdata.refs_file))
- die("failed to write ref-pack file");
- if (fflush(cbdata.refs_file) || fsync(fd) || fclose(cbdata.refs_file))
- die("failed to write ref-pack file (%s)", strerror(errno));
- /*
- * Since the lock file was fdopen()'ed and then fclose()'ed above,
- * assign -1 to the lock file descriptor so that commit_lock_file()
- * won't try to close() it.
- */
- packed.fd = -1;
- if (commit_lock_file(&packed) < 0)
- die("unable to overwrite old ref-pack file (%s)", strerror(errno));
- if (cbdata.flags & PACK_REFS_PRUNE)
- prune_refs(cbdata.ref_to_prune);
- return 0;
-}
+#include "pack-refs.h"
static char const * const pack_refs_usage[] = {
"git-pack-refs [options]",
diff --git a/builtin-reset.c b/builtin-reset.c
index f34acb1915..a0321694c5 100644
--- a/builtin-reset.c
+++ b/builtin-reset.c
@@ -194,8 +194,40 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
reflog_action = args_to_str(argv);
setenv("GIT_REFLOG_ACTION", reflog_action, 0);
- if (i < argc && strcmp(argv[i], "--"))
- rev = argv[i++];
+ /*
+ * Possible arguments are:
+ *
+ * git reset [-opts] <rev> <paths>...
+ * git reset [-opts] <rev> -- <paths>...
+ * git reset [-opts] -- <paths>...
+ * git reset [-opts] <paths>...
+ *
+ * At this point, argv[i] points immediately after [-opts].
+ */
+
+ if (i < argc) {
+ if (!strcmp(argv[i], "--")) {
+ i++; /* reset to HEAD, possibly with paths */
+ } else if (i + 1 < argc && !strcmp(argv[i+1], "--")) {
+ rev = argv[i];
+ i += 2;
+ }
+ /*
+ * Otherwise, argv[i] could be either <rev> or <paths> and
+ * has to be unambigous.
+ */
+ else if (!get_sha1(argv[i], sha1)) {
+ /*
+ * Ok, argv[i] looks like a rev; it should not
+ * be a filename.
+ */
+ verify_non_filename(prefix, argv[i]);
+ rev = argv[i++];
+ } else {
+ /* Otherwise we treat this as a filename */
+ verify_filename(prefix, argv[i]);
+ }
+ }
if (get_sha1(rev, sha1))
die("Failed to resolve '%s' as a valid ref.", rev);
@@ -205,9 +237,6 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
die("Could not parse object '%s'.", rev);
hashcpy(sha1, commit->object.sha1);
- if (i < argc && !strcmp(argv[i], "--"))
- i++;
-
/* git reset tree [--] paths... can be used to
* load chosen paths from the tree into the index without
* affecting the working tree nor HEAD. */
diff --git a/builtin-update-ref.c b/builtin-update-ref.c
index 93c127196d..d90d11d2e3 100644
--- a/builtin-update-ref.c
+++ b/builtin-update-ref.c
@@ -4,14 +4,14 @@
#include "parse-options.h"
static const char * const git_update_ref_usage[] = {
- "git-update-ref [options] -d <refname> <oldval>",
+ "git-update-ref [options] -d <refname> [<oldval>]",
"git-update-ref [options] <refname> <newval> [<oldval>]",
NULL
};
int cmd_update_ref(int argc, const char **argv, const char *prefix)
{
- const char *refname, *value, *oldval, *msg=NULL;
+ const char *refname, *oldval, *msg=NULL;
unsigned char sha1[20], oldsha1[20];
int delete = 0, no_deref = 0;
struct option options[] = {
@@ -27,25 +27,29 @@ int cmd_update_ref(int argc, const char **argv, const char *prefix)
if (msg && !*msg)
die("Refusing to perform update with empty message.");
- if (argc < 2 || argc > 3)
- usage_with_options(git_update_ref_usage, options);
- refname = argv[0];
- value = argv[1];
- oldval = argv[2];
-
- if (get_sha1(value, sha1))
- die("%s: not a valid SHA1", value);
-
if (delete) {
- if (oldval)
+ if (argc < 1 || argc > 2)
+ usage_with_options(git_update_ref_usage, options);
+ refname = argv[0];
+ oldval = argv[1];
+ } else {
+ const char *value;
+ if (argc < 2 || argc > 3)
usage_with_options(git_update_ref_usage, options);
- return delete_ref(refname, sha1);
+ refname = argv[0];
+ value = argv[1];
+ oldval = argv[2];
+ if (get_sha1(value, sha1))
+ die("%s: not a valid SHA1", value);
}
- hashclr(oldsha1);
+ hashclr(oldsha1); /* all-zero hash in case oldval is the empty string */
if (oldval && *oldval && get_sha1(oldval, oldsha1))
die("%s: not a valid old SHA1", oldval);
- return update_ref(msg, refname, sha1, oldval ? oldsha1 : NULL,
- no_deref ? REF_NODEREF : 0, DIE_ON_ERR);
+ if (delete)
+ return delete_ref(refname, oldval ? oldsha1 : NULL);
+ else
+ return update_ref(msg, refname, sha1, oldval ? oldsha1 : NULL,
+ no_deref ? REF_NODEREF : 0, DIE_ON_ERR);
}
diff --git a/builtin-upload-archive.c b/builtin-upload-archive.c
index 48ae09e9b5..371400d49a 100644
--- a/builtin-upload-archive.c
+++ b/builtin-upload-archive.c
@@ -30,7 +30,7 @@ static int run_upload_archive(int argc, const char **argv, const char *prefix)
if (argc != 2)
usage(upload_archive_usage);
- if (strlen(argv[1]) > sizeof(buf))
+ if (strlen(argv[1]) + 1 > sizeof(buf))
die("insanely long repository name");
strcpy(buf, argv[1]); /* enter-repo smudges its argument */
diff --git a/builtin-verify-pack.c b/builtin-verify-pack.c
index 4c515a0570..222c39e7ed 100644
--- a/builtin-verify-pack.c
+++ b/builtin-verify-pack.c
@@ -2,6 +2,58 @@
#include "cache.h"
#include "pack.h"
+
+#define MAX_CHAIN 50
+
+static void show_pack_info(struct packed_git *p)
+{
+ uint32_t nr_objects, i, chain_histogram[MAX_CHAIN+1];
+
+ nr_objects = p->num_objects;
+ memset(chain_histogram, 0, sizeof(chain_histogram));
+
+ for (i = 0; i < nr_objects; i++) {
+ const unsigned char *sha1;
+ unsigned char base_sha1[20];
+ const char *type;
+ unsigned long size;
+ unsigned long store_size;
+ off_t offset;
+ unsigned int delta_chain_length;
+
+ sha1 = nth_packed_object_sha1(p, i);
+ if (!sha1)
+ die("internal error pack-check nth-packed-object");
+ offset = nth_packed_object_offset(p, i);
+ type = packed_object_info_detail(p, offset, &size, &store_size,
+ &delta_chain_length,
+ base_sha1);
+ printf("%s ", sha1_to_hex(sha1));
+ if (!delta_chain_length)
+ printf("%-6s %lu %lu %"PRIuMAX"\n",
+ type, size, store_size, (uintmax_t)offset);
+ else {
+ printf("%-6s %lu %lu %"PRIuMAX" %u %s\n",
+ type, size, store_size, (uintmax_t)offset,
+ delta_chain_length, sha1_to_hex(base_sha1));
+ if (delta_chain_length <= MAX_CHAIN)
+ chain_histogram[delta_chain_length]++;
+ else
+ chain_histogram[0]++;
+ }
+ }
+
+ for (i = 0; i <= MAX_CHAIN; i++) {
+ if (!chain_histogram[i])
+ continue;
+ printf("chain length = %d: %d object%s\n", i,
+ chain_histogram[i], chain_histogram[i] > 1 ? "s" : "");
+ }
+ if (chain_histogram[0])
+ printf("chain length > %d: %d object%s\n", MAX_CHAIN,
+ chain_histogram[0], chain_histogram[0] > 1 ? "s" : "");
+}
+
static int verify_one_pack(const char *path, int verbose)
{
char arg[PATH_MAX];
@@ -41,7 +93,16 @@ static int verify_one_pack(const char *path, int verbose)
return error("packfile %s not found.", arg);
install_packed_git(pack);
- err = verify_pack(pack, verbose);
+ err = verify_pack(pack);
+
+ if (verbose) {
+ if (err)
+ printf("%s: bad\n", pack->pack_name);
+ else {
+ show_pack_info(pack);
+ printf("%s: ok\n", pack->pack_name);
+ }
+ }
return err;
}
diff --git a/cache.h b/cache.h
index 72544de4ce..35a91320a5 100644
--- a/cache.h
+++ b/cache.h
@@ -311,7 +311,6 @@ extern char *git_work_tree_cfg;
extern int is_inside_work_tree(void);
extern const char *get_git_dir(void);
extern char *get_object_directory(void);
-extern char *get_refs_directory(void);
extern char *get_index_file(void);
extern char *get_graft_file(void);
extern int set_git_dir(const char *path);
@@ -435,6 +434,7 @@ extern size_t packed_git_window_size;
extern size_t packed_git_limit;
extern size_t delta_base_cache_limit;
extern int auto_crlf;
+extern int fsync_object_files;
enum safe_crlf {
SAFE_CRLF_FALSE = 0,
@@ -518,6 +518,7 @@ enum sharedrepo {
int git_config_perm(const char *var, const char *value);
int adjust_shared_perm(const char *path);
int safe_create_leading_directories(char *path);
+int safe_create_leading_directories_const(const char *path);
char *enter_repo(char *path, int strict);
static inline int is_absolute_path(const char *path)
{
@@ -525,6 +526,7 @@ static inline int is_absolute_path(const char *path)
}
const char *make_absolute_path(const char *path);
const char *make_nonrelative_path(const char *path);
+const char *make_relative_path(const char *abs, const char *base);
/* Read and unpack a sha1 file into memory, write memory to a sha1 file */
extern int sha1_object_info(const unsigned char *, unsigned long *);
@@ -641,6 +643,8 @@ extern struct packed_git {
const void *index_data;
size_t index_size;
uint32_t num_objects;
+ uint32_t num_bad_objects;
+ unsigned char *bad_object_sha1;
int index_version;
time_t mtime;
int pack_fd;
@@ -709,6 +713,7 @@ extern void close_pack_windows(struct packed_git *);
extern void unuse_pack(struct pack_window **);
extern struct packed_git *add_packed_git(const char *, int, int);
extern const unsigned char *nth_packed_object_sha1(struct packed_git *, uint32_t);
+extern off_t nth_packed_object_offset(const struct packed_git *, uint32_t);
extern off_t find_pack_entry_one(const unsigned char *, struct packed_git *);
extern void *unpack_entry(struct packed_git *, off_t, enum object_type *, unsigned long *);
extern unsigned long unpack_object_header_gently(const unsigned char *buf, unsigned long len, enum object_type *type, unsigned long *sizep);
@@ -735,7 +740,6 @@ extern int git_config_set_multivar(const char *, const char *, const char *, int
extern int git_config_rename_section(const char *, const char *);
extern const char *git_etc_gitconfig(void);
extern int check_repository_format_version(const char *var, const char *value, void *cb);
-extern int git_env_bool(const char *, int);
extern int git_config_system(void);
extern int git_config_global(void);
extern int config_error_nonbool(const char *);
@@ -815,11 +819,11 @@ void shift_tree(const unsigned char *, const unsigned char *, unsigned char *, i
extern unsigned whitespace_rule_cfg;
extern unsigned whitespace_rule(const char *);
extern unsigned parse_whitespace_rule(const char *);
-extern unsigned check_and_emit_line(const char *line, int len, unsigned ws_rule,
- FILE *stream, const char *set,
- const char *reset, const char *ws);
+extern unsigned ws_check(const char *line, int len, unsigned ws_rule);
+extern void ws_check_emit(const char *line, int len, unsigned ws_rule, FILE *stream, const char *set, const char *reset, const char *ws);
extern char *whitespace_error_string(unsigned ws);
extern int ws_fix_copy(char *, const char *, int, unsigned, int *);
+extern int ws_blank_line(const char *line, int len, unsigned ws_rule);
/* ls-files */
int pathspec_match(const char **spec, char *matched, const char *filename, int skiplen);
diff --git a/check_bindir b/check_bindir
new file mode 100755
index 0000000000..a1c4c3e8d8
--- /dev/null
+++ b/check_bindir
@@ -0,0 +1,13 @@
+#!/bin/sh
+bindir="$1"
+gitexecdir="$2"
+gitcmd="$3"
+if test "$bindir" != "$gitexecdir" -a -x "$gitcmd"
+then
+ echo
+ echo "!! You have installed git-* commands to new gitexecdir."
+ echo "!! Old version git-* commands still remain in bindir."
+ echo "!! Mixing two versions of Git will lead to problems."
+ echo "!! Please remove old version commands in bindir now."
+ echo
+fi
diff --git a/combine-diff.c b/combine-diff.c
index 588c58bc55..9f80a1c5e3 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -84,6 +84,7 @@ struct sline {
/* bit 0 up to (N-1) are on if the parent has this line (i.e.
* we did not change it).
* bit N is used for "interesting" lines, including context.
+ * bit (N+1) is used for "do not show deletion before this".
*/
unsigned long flag;
unsigned long *p_lno;
@@ -308,6 +309,7 @@ static int give_context(struct sline *sline, unsigned long cnt, int num_parent)
{
unsigned long all_mask = (1UL<<num_parent) - 1;
unsigned long mark = (1UL<<num_parent);
+ unsigned long no_pre_delete = (2UL<<num_parent);
unsigned long i;
/* Two groups of interesting lines may have a short gap of
@@ -329,7 +331,7 @@ static int give_context(struct sline *sline, unsigned long cnt, int num_parent)
/* Paint a few lines before the first interesting line. */
while (j < i)
- sline[j++].flag |= mark;
+ sline[j++].flag |= mark | no_pre_delete;
again:
/* we know up to i is to be included. where does the
@@ -502,6 +504,7 @@ static void dump_sline(struct sline *sline, unsigned long cnt, int num_parent,
int use_color)
{
unsigned long mark = (1UL<<num_parent);
+ unsigned long no_pre_delete = (2UL<<num_parent);
int i;
unsigned long lno = 0;
const char *c_frag = diff_get_color(use_color, DIFF_FRAGINFO);
@@ -581,7 +584,7 @@ static void dump_sline(struct sline *sline, unsigned long cnt, int num_parent,
int j;
unsigned long p_mask;
sl = &sline[lno++];
- ll = sl->lost_head;
+ ll = (sl->flag & no_pre_delete) ? NULL : sl->lost_head;
while (ll) {
fputs(c_old, stdout);
for (j = 0; j < num_parent; j++) {
diff --git a/config.c b/config.c
index c2f2bbb000..58749bf416 100644
--- a/config.c
+++ b/config.c
@@ -332,7 +332,7 @@ int git_config_string(const char **dest, const char *var, const char *value)
return 0;
}
-int git_default_config(const char *var, const char *value, void *dummy)
+static int git_default_core_config(const char *var, const char *value)
{
/* This needs a better name */
if (!strcmp(var, "core.filemode")) {
@@ -444,6 +444,33 @@ int git_default_config(const char *var, const char *value, void *dummy)
return 0;
}
+ if (!strcmp(var, "core.pager"))
+ return git_config_string(&pager_program, var, value);
+
+ if (!strcmp(var, "core.editor"))
+ return git_config_string(&editor_program, var, value);
+
+ if (!strcmp(var, "core.excludesfile"))
+ return git_config_string(&excludes_file, var, value);
+
+ if (!strcmp(var, "core.whitespace")) {
+ if (!value)
+ return config_error_nonbool(var);
+ whitespace_rule_cfg = parse_whitespace_rule(value);
+ return 0;
+ }
+
+ if (!strcmp(var, "core.fsyncobjectfiles")) {
+ fsync_object_files = git_config_bool(var, value);
+ return 0;
+ }
+
+ /* Add other config variables here and to Documentation/config.txt. */
+ return 0;
+}
+
+static int git_default_user_config(const char *var, const char *value)
+{
if (!strcmp(var, "user.name")) {
if (!value)
return config_error_nonbool(var);
@@ -462,32 +489,24 @@ int git_default_config(const char *var, const char *value, void *dummy)
return 0;
}
+ /* Add other config variables here and to Documentation/config.txt. */
+ return 0;
+}
+
+static int git_default_i18n_config(const char *var, const char *value)
+{
if (!strcmp(var, "i18n.commitencoding"))
return git_config_string(&git_commit_encoding, var, value);
if (!strcmp(var, "i18n.logoutputencoding"))
return git_config_string(&git_log_output_encoding, var, value);
- if (!strcmp(var, "pager.color") || !strcmp(var, "color.pager")) {
- pager_use_color = git_config_bool(var,value);
- return 0;
- }
-
- if (!strcmp(var, "core.pager"))
- return git_config_string(&pager_program, var, value);
-
- if (!strcmp(var, "core.editor"))
- return git_config_string(&editor_program, var, value);
-
- if (!strcmp(var, "core.excludesfile"))
- return git_config_string(&excludes_file, var, value);
+ /* Add other config variables here and to Documentation/config.txt. */
+ return 0;
+}
- if (!strcmp(var, "core.whitespace")) {
- if (!value)
- return config_error_nonbool(var);
- whitespace_rule_cfg = parse_whitespace_rule(value);
- return 0;
- }
+static int git_default_branch_config(const char *var, const char *value)
+{
if (!strcmp(var, "branch.autosetupmerge")) {
if (value && !strcasecmp(value, "always")) {
git_branch_track = BRANCH_TRACK_ALWAYS;
@@ -516,6 +535,29 @@ int git_default_config(const char *var, const char *value, void *dummy)
return 0;
}
+int git_default_config(const char *var, const char *value, void *dummy)
+{
+ if (!prefixcmp(var, "core."))
+ return git_default_core_config(var, value);
+
+ if (!prefixcmp(var, "user."))
+ return git_default_user_config(var, value);
+
+ if (!prefixcmp(var, "i18n."))
+ return git_default_i18n_config(var, value);
+
+ if (!prefixcmp(var, "branch."))
+ return git_default_branch_config(var, value);
+
+ if (!strcmp(var, "pager.color") || !strcmp(var, "color.pager")) {
+ pager_use_color = git_config_bool(var,value);
+ return 0;
+ }
+
+ /* Add other config variables here and to Documentation/config.txt. */
+ return 0;
+}
+
int git_config_from_file(config_fn_t fn, const char *filename, void *data)
{
int ret;
@@ -549,7 +591,7 @@ const char *git_etc_gitconfig(void)
return system_wide;
}
-int git_env_bool(const char *k, int def)
+static int git_env_bool(const char *k, int def)
{
const char *v = getenv(k);
return v ? git_config_bool(k, v) : def;
diff --git a/config.mak.in b/config.mak.in
index 7868dfd93a..b776149531 100644
--- a/config.mak.in
+++ b/config.mak.in
@@ -11,7 +11,7 @@ TCLTK_PATH = @TCLTK_PATH@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
-#gitexecdir = @libexecdir@/git-core/
+gitexecdir = @libexecdir@/git-core/
datarootdir = @datarootdir@
template_dir = @datadir@/git-core/templates/
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 2141b6b6ba..3f46149853 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -761,6 +761,10 @@ _git_log ()
--pretty= --name-status --name-only --raw
--not --all
--left-right --cherry-pick
+ --graph
+ --stat --numstat --shortstat
+ --decorate --diff-filter=
+ --color-words --walk-reflogs
"
return
;;
@@ -1037,7 +1041,6 @@ _git_config ()
pull.octopus
pull.twohead
repack.useDeltaBaseOffset
- show.difftree
showbranch.default
tar.umask
transfer.unpackLimit
@@ -1046,7 +1049,6 @@ _git_config ()
user.name
user.email
user.signingkey
- whatchanged.difftree
branch. remote.
"
}
diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index d8de9f6c25..87ca51e401 100755
--- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -687,6 +687,10 @@ class P4Submit(Command):
else:
return False
+ allowSubmit = gitConfig("git-p4.allowSubmit")
+ if len(allowSubmit) > 0 and not self.master in allowSubmit.split(","):
+ die("%s is not in git-p4.allowSubmit" % self.master)
+
[upstream, settings] = findUpstreamBranchPoint()
self.depotPath = settings['depot-paths'][0]
if len(self.origin) == 0:
diff --git a/contrib/thunderbird-patch-inline/README b/contrib/thunderbird-patch-inline/README
new file mode 100644
index 0000000000..39f96aa115
--- /dev/null
+++ b/contrib/thunderbird-patch-inline/README
@@ -0,0 +1,20 @@
+appp.sh is a script that is supposed to be used together with ExternalEditor
+for Mozilla Thundebird. It will let you include patches inline in e-mails
+in an easy way.
+
+Usage:
+- Generate the patch with git format-patch.
+- Start writing a new e-mail in Thunderbird.
+- Press the external editor button (or Ctrl-E) to run appp.sh
+- Select the previosly generated patch file.
+- Finish editing the e-mail.
+
+Any text that is entered into the message editor before appp.sh is called
+will be moved to the section between the --- and the diffstat.
+
+All S-O-B:s and Cc:s in the patch will be added to the CC list.
+
+To set it up, just install External Editor and tell it to use appp.sh as the
+editor.
+
+Zenity is a required dependency.
diff --git a/contrib/thunderbird-patch-inline/appp.sh b/contrib/thunderbird-patch-inline/appp.sh
new file mode 100755
index 0000000000..cc518f3c89
--- /dev/null
+++ b/contrib/thunderbird-patch-inline/appp.sh
@@ -0,0 +1,55 @@
+#!/bin/bash
+# Copyright 2008 Lukas Sandström <luksan@gmail.com>
+#
+# AppendPatch - A script to be used together with ExternalEditor
+# for Mozilla Thunderbird to properly include pathes inline i e-mails.
+
+# ExternalEditor can be downloaded at http://globs.org/articles.php?lng=en&pg=2
+
+CONFFILE=~/.appprc
+
+SEP="-=-=-=-=-=-=-=-=-=# Don't remove this line #=-=-=-=-=-=-=-=-=-"
+if [ -e "$CONFFILE" ] ; then
+ LAST_DIR=`grep -m 1 "^LAST_DIR=" "${CONFFILE}"|sed -e 's/^LAST_DIR=//'`
+ cd "${LAST_DIR}"
+else
+ cd > /dev/null
+fi
+
+PATCH=$(zenity --file-selection)
+
+if [ "$?" != "0" ] ; then
+ #zenity --error --text "No patchfile given."
+ exit 1
+fi
+
+cd - > /dev/null
+
+SUBJECT=`sed -n -e '/^Subject: /p' "${PATCH}"`
+HEADERS=`sed -e '/^'"${SEP}"'$/,$d' $1`
+BODY=`sed -e "1,/${SEP}/d" $1`
+CMT_MSG=`sed -e '1,/^$/d' -e '/^---$/,$d' "${PATCH}"`
+DIFF=`sed -e '1,/^---$/d' "${PATCH}"`
+
+CCS=`echo -e "$CMT_MSG\n$HEADERS" | sed -n -e 's/^Cc: \(.*\)$/\1,/gp' \
+ -e 's/^Signed-off-by: \(.*\)/\1,/gp'`
+
+echo "$SUBJECT" > $1
+echo "Cc: $CCS" >> $1
+echo "$HEADERS" | sed -e '/^Subject: /d' -e '/^Cc: /d' >> $1
+echo "$SEP" >> $1
+
+echo "$CMT_MSG" >> $1
+echo "---" >> $1
+if [ "x${BODY}x" != "xx" ] ; then
+ echo >> $1
+ echo "$BODY" >> $1
+ echo >> $1
+fi
+echo "$DIFF" >> $1
+
+LAST_DIR=`dirname "${PATCH}"`
+
+grep -v "^LAST_DIR=" "${CONFFILE}" > "${CONFFILE}_"
+echo "LAST_DIR=${LAST_DIR}" >> "${CONFFILE}_"
+mv "${CONFFILE}_" "${CONFFILE}"
diff --git a/diff.c b/diff.c
index 5262490086..803fbba451 100644
--- a/diff.c
+++ b/diff.c
@@ -535,9 +535,9 @@ static void emit_add_line(const char *reset, struct emit_callback *ecbdata, cons
else {
/* Emit just the prefix, then the rest. */
emit_line(ecbdata->file, set, reset, line, ecbdata->nparents);
- (void)check_and_emit_line(line + ecbdata->nparents,
- len - ecbdata->nparents, ecbdata->ws_rule,
- ecbdata->file, set, reset, ws);
+ ws_check_emit(line + ecbdata->nparents,
+ len - ecbdata->nparents, ecbdata->ws_rule,
+ ecbdata->file, set, reset, ws);
}
}
@@ -830,12 +830,12 @@ static void show_stats(struct diffstat_t* data, struct diff_options *options)
/* Sanity: give at least 5 columns to the graph,
* but leave at least 10 columns for the name.
*/
- if (width < name_width + 15) {
- if (name_width <= 25)
- width = name_width + 15;
- else
- name_width = width - 15;
- }
+ if (width < 25)
+ width = 25;
+ if (name_width < 10)
+ name_width = 10;
+ else if (width < name_width + 15)
+ name_width = width - 15;
/* Find the longest filename and max number of changes */
reset = diff_get_color_opt(options, DIFF_RESET);
@@ -928,7 +928,8 @@ static void show_stats(struct diffstat_t* data, struct diff_options *options)
total = add + del;
}
show_name(options->file, prefix, name, len, reset, set);
- fprintf(options->file, "%5d ", added + deleted);
+ fprintf(options->file, "%5d%s", added + deleted,
+ added + deleted ? " " : "");
show_graph(options->file, '+', add, add_c, reset);
show_graph(options->file, '-', del, del_c, reset);
fprintf(options->file, "\n");
@@ -1135,40 +1136,85 @@ static void free_diffstat_info(struct diffstat_t *diffstat)
struct checkdiff_t {
struct xdiff_emit_state xm;
const char *filename;
- int lineno, color_diff;
+ int lineno;
+ struct diff_options *o;
unsigned ws_rule;
unsigned status;
- FILE *file;
+ int trailing_blanks_start;
};
+static int is_conflict_marker(const char *line, unsigned long len)
+{
+ char firstchar;
+ int cnt;
+
+ if (len < 8)
+ return 0;
+ firstchar = line[0];
+ switch (firstchar) {
+ case '=': case '>': case '<':
+ break;
+ default:
+ return 0;
+ }
+ for (cnt = 1; cnt < 7; cnt++)
+ if (line[cnt] != firstchar)
+ return 0;
+ /* line[0] thru line[6] are same as firstchar */
+ if (firstchar == '=') {
+ /* divider between ours and theirs? */
+ if (len != 8 || line[7] != '\n')
+ return 0;
+ } else if (len < 8 || !isspace(line[7])) {
+ /* not divider before ours nor after theirs */
+ return 0;
+ }
+ return 1;
+}
+
static void checkdiff_consume(void *priv, char *line, unsigned long len)
{
struct checkdiff_t *data = priv;
- const char *ws = diff_get_color(data->color_diff, DIFF_WHITESPACE);
- const char *reset = diff_get_color(data->color_diff, DIFF_RESET);
- const char *set = diff_get_color(data->color_diff, DIFF_FILE_NEW);
+ int color_diff = DIFF_OPT_TST(data->o, COLOR_DIFF);
+ const char *ws = diff_get_color(color_diff, DIFF_WHITESPACE);
+ const char *reset = diff_get_color(color_diff, DIFF_RESET);
+ const char *set = diff_get_color(color_diff, DIFF_FILE_NEW);
char *err;
if (line[0] == '+') {
+ unsigned bad;
data->lineno++;
- data->status = check_and_emit_line(line + 1, len - 1,
- data->ws_rule, NULL, NULL, NULL, NULL);
- if (!data->status)
+ if (!ws_blank_line(line + 1, len - 1, data->ws_rule))
+ data->trailing_blanks_start = 0;
+ else if (!data->trailing_blanks_start)
+ data->trailing_blanks_start = data->lineno;
+ if (is_conflict_marker(line + 1, len - 1)) {
+ data->status |= 1;
+ fprintf(data->o->file,
+ "%s:%d: leftover conflict marker\n",
+ data->filename, data->lineno);
+ }
+ bad = ws_check(line + 1, len - 1, data->ws_rule);
+ if (!bad)
return;
- err = whitespace_error_string(data->status);
- fprintf(data->file, "%s:%d: %s.\n", data->filename, data->lineno, err);
+ data->status |= bad;
+ err = whitespace_error_string(bad);
+ fprintf(data->o->file, "%s:%d: %s.\n",
+ data->filename, data->lineno, err);
free(err);
- emit_line(data->file, set, reset, line, 1);
- (void)check_and_emit_line(line + 1, len - 1, data->ws_rule,
- data->file, set, reset, ws);
- } else if (line[0] == ' ')
+ emit_line(data->o->file, set, reset, line, 1);
+ ws_check_emit(line + 1, len - 1, data->ws_rule,
+ data->o->file, set, reset, ws);
+ } else if (line[0] == ' ') {
data->lineno++;
- else if (line[0] == '@') {
+ data->trailing_blanks_start = 0;
+ } else if (line[0] == '@') {
char *plus = strchr(line, '+');
if (plus)
data->lineno = strtol(plus, NULL, 10) - 1;
else
die("invalid diff");
+ data->trailing_blanks_start = 0;
}
}
@@ -1541,8 +1587,9 @@ static void builtin_diffstat(const char *name_a, const char *name_b,
static void builtin_checkdiff(const char *name_a, const char *name_b,
const char *attr_path,
- struct diff_filespec *one,
- struct diff_filespec *two, struct diff_options *o)
+ struct diff_filespec *one,
+ struct diff_filespec *two,
+ struct diff_options *o)
{
mmfile_t mf1, mf2;
struct checkdiff_t data;
@@ -1554,13 +1601,18 @@ static void builtin_checkdiff(const char *name_a, const char *name_b,
data.xm.consume = checkdiff_consume;
data.filename = name_b ? name_b : name_a;
data.lineno = 0;
- data.color_diff = DIFF_OPT_TST(o, COLOR_DIFF);
+ data.o = o;
data.ws_rule = whitespace_rule(attr_path);
- data.file = o->file;
if (fill_mmfile(&mf1, one) < 0 || fill_mmfile(&mf2, two) < 0)
die("unable to read files to diff");
+ /*
+ * All the other codepaths check both sides, but not checking
+ * the "old" side here is deliberate. We are checking the newly
+ * introduced changes, and as long as the "new" side is text, we
+ * can and should check what it introduces.
+ */
if (diff_filespec_is_binary(two))
goto free_and_return;
else {
@@ -1574,6 +1626,12 @@ static void builtin_checkdiff(const char *name_a, const char *name_b,
ecb.outf = xdiff_outf;
ecb.priv = &data;
xdi_diff(&mf1, &mf2, &xpp, &xecfg, &ecb);
+
+ if (data.trailing_blanks_start) {
+ fprintf(o->file, "%s:%d: ends with blank lines.\n",
+ data.filename, data.trailing_blanks_start);
+ data.status = 1; /* report errors */
+ }
}
free_and_return:
diff_free_filespec_data(one);
diff --git a/environment.c b/environment.c
index 73feb2d03a..4a88a17d54 100644
--- a/environment.c
+++ b/environment.c
@@ -13,7 +13,6 @@ char git_default_email[MAX_GITNAME];
char git_default_name[MAX_GITNAME];
int user_ident_explicitly_given;
int trust_executable_bit = 1;
-int quote_path_fully = 1;
int has_symlinks = 1;
int ignore_case;
int assume_unchanged;
@@ -29,6 +28,7 @@ const char *apply_default_whitespace;
int zlib_compression_level = Z_BEST_SPEED;
int core_compression_level;
int core_compression_seen;
+int fsync_object_files;
size_t packed_git_window_size = DEFAULT_PACKED_GIT_WINDOW_SIZE;
size_t packed_git_limit = DEFAULT_PACKED_GIT_LIMIT;
size_t delta_base_cache_limit = 16 * 1024 * 1024;
@@ -129,13 +129,6 @@ char *get_object_directory(void)
return git_object_dir;
}
-char *get_refs_directory(void)
-{
- if (!git_refs_dir)
- setup_git_env();
- return git_refs_dir;
-}
-
char *get_index_file(void)
{
if (!git_index_file)
diff --git a/exec_cmd.c b/exec_cmd.c
index 84db7ee664..da04efe951 100644
--- a/exec_cmd.c
+++ b/exec_cmd.c
@@ -98,32 +98,25 @@ void setup_path(const char *cmd_path)
int execv_git_cmd(const char **argv)
{
- struct strbuf cmd;
- const char *tmp;
-
- strbuf_init(&cmd, 0);
- strbuf_addf(&cmd, "git-%s", argv[0]);
+ int argc;
+ const char **nargv;
- /*
- * argv[0] must be the git command, but the argv array
- * belongs to the caller, and may be reused in
- * subsequent loop iterations. Save argv[0] and
- * restore it on error.
- */
- tmp = argv[0];
- argv[0] = cmd.buf;
+ for (argc = 0; argv[argc]; argc++)
+ ; /* just counting */
+ nargv = xmalloc(sizeof(*nargv) * (argc + 2));
- trace_argv_printf(argv, "trace: exec:");
+ nargv[0] = "git";
+ for (argc = 0; argv[argc]; argc++)
+ nargv[argc + 1] = argv[argc];
+ nargv[argc + 1] = NULL;
+ trace_argv_printf(nargv, "trace: exec:");
/* execvp() can only ever return if it fails */
- execvp(cmd.buf, (char **)argv);
+ execvp("git", (char **)nargv);
trace_printf("trace: exec failed: %s\n", strerror(errno));
- argv[0] = tmp;
-
- strbuf_release(&cmd);
-
+ free(nargv);
return -1;
}
diff --git a/git-compat-util.h b/git-compat-util.h
index 51823ae7af..545df59242 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -268,161 +268,18 @@ static inline char *gitstrchrnul(const char *s, int c)
extern void release_pack_memory(size_t, int);
-static inline char* xstrdup(const char *str)
-{
- char *ret = strdup(str);
- if (!ret) {
- release_pack_memory(strlen(str) + 1, -1);
- ret = strdup(str);
- if (!ret)
- die("Out of memory, strdup failed");
- }
- return ret;
-}
-
-static inline void *xmalloc(size_t size)
-{
- void *ret = malloc(size);
- if (!ret && !size)
- ret = malloc(1);
- if (!ret) {
- release_pack_memory(size, -1);
- ret = malloc(size);
- if (!ret && !size)
- ret = malloc(1);
- if (!ret)
- die("Out of memory, malloc failed");
- }
-#ifdef XMALLOC_POISON
- memset(ret, 0xA5, size);
-#endif
- return ret;
-}
-
-/*
- * xmemdupz() allocates (len + 1) bytes of memory, duplicates "len" bytes of
- * "data" to the allocated memory, zero terminates the allocated memory,
- * and returns a pointer to the allocated memory. If the allocation fails,
- * the program dies.
- */
-static inline void *xmemdupz(const void *data, size_t len)
-{
- char *p = xmalloc(len + 1);
- memcpy(p, data, len);
- p[len] = '\0';
- return p;
-}
-
-static inline char *xstrndup(const char *str, size_t len)
-{
- char *p = memchr(str, '\0', len);
- return xmemdupz(str, p ? p - str : len);
-}
-
-static inline void *xrealloc(void *ptr, size_t size)
-{
- void *ret = realloc(ptr, size);
- if (!ret && !size)
- ret = realloc(ptr, 1);
- if (!ret) {
- release_pack_memory(size, -1);
- ret = realloc(ptr, size);
- if (!ret && !size)
- ret = realloc(ptr, 1);
- if (!ret)
- die("Out of memory, realloc failed");
- }
- return ret;
-}
-
-static inline void *xcalloc(size_t nmemb, size_t size)
-{
- void *ret = calloc(nmemb, size);
- if (!ret && (!nmemb || !size))
- ret = calloc(1, 1);
- if (!ret) {
- release_pack_memory(nmemb * size, -1);
- ret = calloc(nmemb, size);
- if (!ret && (!nmemb || !size))
- ret = calloc(1, 1);
- if (!ret)
- die("Out of memory, calloc failed");
- }
- return ret;
-}
-
-static inline void *xmmap(void *start, size_t length,
- int prot, int flags, int fd, off_t offset)
-{
- void *ret = mmap(start, length, prot, flags, fd, offset);
- if (ret == MAP_FAILED) {
- if (!length)
- return NULL;
- release_pack_memory(length, fd);
- ret = mmap(start, length, prot, flags, fd, offset);
- if (ret == MAP_FAILED)
- die("Out of memory? mmap failed: %s", strerror(errno));
- }
- return ret;
-}
-
-/*
- * xread() is the same a read(), but it automatically restarts read()
- * operations with a recoverable error (EAGAIN and EINTR). xread()
- * DOES NOT GUARANTEE that "len" bytes is read even if the data is available.
- */
-static inline ssize_t xread(int fd, void *buf, size_t len)
-{
- ssize_t nr;
- while (1) {
- nr = read(fd, buf, len);
- if ((nr < 0) && (errno == EAGAIN || errno == EINTR))
- continue;
- return nr;
- }
-}
-
-/*
- * xwrite() is the same a write(), but it automatically restarts write()
- * operations with a recoverable error (EAGAIN and EINTR). xwrite() DOES NOT
- * GUARANTEE that "len" bytes is written even if the operation is successful.
- */
-static inline ssize_t xwrite(int fd, const void *buf, size_t len)
-{
- ssize_t nr;
- while (1) {
- nr = write(fd, buf, len);
- if ((nr < 0) && (errno == EAGAIN || errno == EINTR))
- continue;
- return nr;
- }
-}
-
-static inline int xdup(int fd)
-{
- int ret = dup(fd);
- if (ret < 0)
- die("dup failed: %s", strerror(errno));
- return ret;
-}
-
-static inline FILE *xfdopen(int fd, const char *mode)
-{
- FILE *stream = fdopen(fd, mode);
- if (stream == NULL)
- die("Out of memory? fdopen failed: %s", strerror(errno));
- return stream;
-}
-
-static inline int xmkstemp(char *template)
-{
- int fd;
-
- fd = mkstemp(template);
- if (fd < 0)
- die("Unable to create temporary file: %s", strerror(errno));
- return fd;
-}
+extern char *xstrdup(const char *str);
+extern void *xmalloc(size_t size);
+extern void *xmemdupz(const void *data, size_t len);
+extern char *xstrndup(const char *str, size_t len);
+extern void *xrealloc(void *ptr, size_t size);
+extern void *xcalloc(size_t nmemb, size_t size);
+extern void *xmmap(void *start, size_t length, int prot, int flags, int fd, off_t offset);
+extern ssize_t xread(int fd, void *buf, size_t len);
+extern ssize_t xwrite(int fd, const void *buf, size_t len);
+extern int xdup(int fd);
+extern FILE *xfdopen(int fd, const char *mode);
+extern int xmkstemp(char *template);
static inline size_t xsize_t(off_t len)
{
diff --git a/git-merge.sh b/git-merge.sh
index 5fc5f5201f..8026ccff4a 100755
--- a/git-merge.sh
+++ b/git-merge.sh
@@ -13,7 +13,7 @@ n don't show a diffstat at the end of the merge
summary (synonym to --stat)
log add list of one-line log to merge commit message
squash create a single commit instead of doing a merge
-commit perform a commit if the merge sucesses (default)
+commit perform a commit if the merge succeeds (default)
ff allow fast forward (default)
s,strategy= merge strategy to use
m,message= message to be used for the merge commit (if any)
diff --git a/git-mergetool.sh b/git-mergetool.sh
index fcdec4a504..94187c306c 100755
--- a/git-mergetool.sh
+++ b/git-mergetool.sh
@@ -141,10 +141,10 @@ merge_file () {
fi
ext="$$$(expr "$MERGED" : '.*\(\.[^/]*\)$')"
- BACKUP="$MERGED.BACKUP.$ext"
- LOCAL="$MERGED.LOCAL.$ext"
- REMOTE="$MERGED.REMOTE.$ext"
- BASE="$MERGED.BASE.$ext"
+ BACKUP="./$MERGED.BACKUP.$ext"
+ LOCAL="./$MERGED.LOCAL.$ext"
+ REMOTE="./$MERGED.REMOTE.$ext"
+ BASE="./$MERGED.BASE.$ext"
mv -- "$MERGED" "$BACKUP"
cp -- "$BACKUP" "$MERGED"
@@ -183,29 +183,29 @@ merge_file () {
kdiff3)
if base_present ; then
("$merge_tool_path" --auto --L1 "$MERGED (Base)" --L2 "$MERGED (Local)" --L3 "$MERGED (Remote)" \
- -o "$MERGED" -- "$BASE" "$LOCAL" "$REMOTE" > /dev/null 2>&1)
+ -o "$MERGED" "$BASE" "$LOCAL" "$REMOTE" > /dev/null 2>&1)
else
("$merge_tool_path" --auto --L1 "$MERGED (Local)" --L2 "$MERGED (Remote)" \
- -o "$MERGED" -- "$LOCAL" "$REMOTE" > /dev/null 2>&1)
+ -o "$MERGED" "$LOCAL" "$REMOTE" > /dev/null 2>&1)
fi
status=$?
;;
tkdiff)
if base_present ; then
- "$merge_tool_path" -a "$BASE" -o "$MERGED" -- "$LOCAL" "$REMOTE"
+ "$merge_tool_path" -a "$BASE" -o "$MERGED" "$LOCAL" "$REMOTE"
else
- "$merge_tool_path" -o "$MERGED" -- "$LOCAL" "$REMOTE"
+ "$merge_tool_path" -o "$MERGED" "$LOCAL" "$REMOTE"
fi
status=$?
;;
meld|vimdiff)
touch "$BACKUP"
- "$merge_tool_path" -- "$LOCAL" "$MERGED" "$REMOTE"
+ "$merge_tool_path" "$LOCAL" "$MERGED" "$REMOTE"
check_unchanged
;;
gvimdiff)
touch "$BACKUP"
- "$merge_tool_path" -f -- "$LOCAL" "$MERGED" "$REMOTE"
+ "$merge_tool_path" -f "$LOCAL" "$MERGED" "$REMOTE"
check_unchanged
;;
xxdiff)
@@ -215,13 +215,13 @@ merge_file () {
-R 'Accel.SaveAsMerged: "Ctrl-S"' \
-R 'Accel.Search: "Ctrl+F"' \
-R 'Accel.SearchForward: "Ctrl-G"' \
- --merged-file "$MERGED" -- "$LOCAL" "$BASE" "$REMOTE"
+ --merged-file "$MERGED" "$LOCAL" "$BASE" "$REMOTE"
else
"$merge_tool_path" -X --show-merged-pane \
-R 'Accel.SaveAsMerged: "Ctrl-S"' \
-R 'Accel.Search: "Ctrl+F"' \
-R 'Accel.SearchForward: "Ctrl-G"' \
- --merged-file "$MERGED" -- "$LOCAL" "$REMOTE"
+ --merged-file "$MERGED" "$LOCAL" "$REMOTE"
fi
check_unchanged
;;
diff --git a/git-rebase.sh b/git-rebase.sh
index dd7dfe123c..e2d85eeeab 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -150,6 +150,9 @@ while test $# != 0
do
case "$1" in
--continue)
+ test -d "$dotest" -o -d .dotest ||
+ die "No rebase in progress?"
+
git diff-files --quiet --ignore-submodules || {
echo "You must edit all merge conflicts and then"
echo "mark them as resolved using git add"
@@ -178,6 +181,9 @@ do
exit
;;
--skip)
+ test -d "$dotest" -o -d .dotest ||
+ die "No rebase in progress?"
+
git reset --hard HEAD || exit $?
if test -d "$dotest"
then
@@ -203,16 +209,16 @@ do
exit
;;
--abort)
+ test -d "$dotest" -o -d .dotest ||
+ die "No rebase in progress?"
+
git rerere clear
if test -d "$dotest"
then
move_to_original_branch
- elif test -d .dotest
- then
+ else
dotest=.dotest
move_to_original_branch
- else
- die "No rebase in progress?"
fi
git reset --hard $(cat "$dotest/orig-head")
rm -r "$dotest"
diff --git a/git-repack.sh b/git-repack.sh
index 072d1b40f7..8c3bc134ad 100755
--- a/git-repack.sh
+++ b/git-repack.sh
@@ -44,11 +44,7 @@ do
shift
done
-# Later we will default repack.UseDeltaBaseOffset to true
-default_dbo=false
-
-case "`git config --bool repack.usedeltabaseoffset ||
- echo $default_dbo`" in
+case "`git config --bool repack.usedeltabaseoffset || echo true`" in
true)
extra="$extra --delta-base-offset" ;;
esac
diff --git a/git-send-email.perl b/git-send-email.perl
index 0b04ba32f0..a047b016e3 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -84,7 +84,10 @@ Options:
--smtp-pass The password for SMTP-AUTH.
- --smtp-ssl If set, connects to the SMTP server using SSL.
+ --smtp-encryption Specify 'tls' for STARTTLS encryption, or 'ssl' for SSL.
+ Any other value disables the feature.
+
+ --smtp-ssl Synonym for '--smtp-encryption=ssl'. Deprecated.
--suppress-cc Suppress the specified category of auto-CC. The category
can be one of 'author' for the patch author, 'self' to
@@ -184,7 +187,7 @@ my ($quiet, $dry_run) = (0, 0);
# Variables with corresponding config settings
my ($thread, $chain_reply_to, $suppress_from, $signed_off_cc, $cc_cmd);
-my ($smtp_server, $smtp_server_port, $smtp_authuser, $smtp_ssl);
+my ($smtp_server, $smtp_server_port, $smtp_authuser, $smtp_encryption);
my ($identity, $aliasfiletype, @alias_files, @smtp_host_parts);
my ($no_validate);
my (@suppress_cc);
@@ -194,7 +197,6 @@ my %config_bool_settings = (
"chainreplyto" => [\$chain_reply_to, 1],
"suppressfrom" => [\$suppress_from, undef],
"signedoffcc" => [\$signed_off_cc, undef],
- "smtpssl" => [\$smtp_ssl, 0],
);
my %config_settings = (
@@ -249,7 +251,8 @@ my $rc = GetOptions("sender|from=s" => \$sender,
"smtp-server-port=s" => \$smtp_server_port,
"smtp-user=s" => \$smtp_authuser,
"smtp-pass:s" => \$smtp_authpass,
- "smtp-ssl!" => \$smtp_ssl,
+ "smtp-ssl" => sub { $smtp_encryption = 'ssl' },
+ "smtp-encryption=s" => \$smtp_encryption,
"identity=s" => \$identity,
"compose" => \$compose,
"quiet" => \$quiet,
@@ -289,6 +292,15 @@ sub read_config {
$$target = Git::config(@repo, "$prefix.$setting") unless (defined $$target);
}
}
+
+ if (!defined $smtp_encryption) {
+ my $enc = Git::config(@repo, "$prefix.smtpencryption");
+ if (defined $enc) {
+ $smtp_encryption = $enc;
+ } elsif (Git::config_bool(@repo, "$prefix.smtpssl")) {
+ $smtp_encryption = 'ssl';
+ }
+ }
}
# read configuration from [sendemail "$identity"], fall back on [sendemail]
@@ -301,6 +313,9 @@ foreach my $setting (values %config_bool_settings) {
${$setting->[0]} = $setting->[1] unless (defined (${$setting->[0]}));
}
+# 'default' encryption is none -- this only prevents a warning
+$smtp_encryption = '' unless (defined $smtp_encryption);
+
# Set CC suppressions
my(%suppress_cc);
if (@suppress_cc) {
@@ -393,7 +408,7 @@ for my $f (@ARGV) {
push @files, grep { -f $_ } map { +$f . "/" . $_ }
sort readdir(DH);
- } elsif (-f $f) {
+ } elsif (-f $f or -p $f) {
push @files, $f;
} else {
@@ -403,8 +418,10 @@ for my $f (@ARGV) {
if (!$no_validate) {
foreach my $f (@files) {
- my $error = validate_patch($f);
- $error and die "fatal: $f: $error\nwarning: no patches were sent\n";
+ unless (-p $f) {
+ my $error = validate_patch($f);
+ $error and die "fatal: $f: $error\nwarning: no patches were sent\n";
+ }
}
}
@@ -738,7 +755,7 @@ X-Mailer: git-send-email $gitversion
die "The required SMTP server is not properly defined."
}
- if ($smtp_ssl) {
+ if ($smtp_encryption eq 'ssl') {
$smtp_server_port ||= 465; # ssmtp
require Net::SMTP::SSL;
$smtp ||= Net::SMTP::SSL->new($smtp_server, Port => $smtp_server_port);
@@ -748,6 +765,17 @@ X-Mailer: git-send-email $gitversion
$smtp ||= Net::SMTP->new((defined $smtp_server_port)
? "$smtp_server:$smtp_server_port"
: $smtp_server);
+ if ($smtp_encryption eq 'tls') {
+ require Net::SMTP::SSL;
+ $smtp->command('STARTTLS');
+ $smtp->response();
+ if ($smtp->code == 220) {
+ $smtp = Net::SMTP::SSL->start_SSL($smtp)
+ or die "STARTTLS failed! ".$smtp->message;
+ } else {
+ die "Server does not support STARTTLS! ".$smtp->message;
+ }
+ }
}
if (!$smtp) {
diff --git a/git-svn.perl b/git-svn.perl
index a54979dc51..f789a6eeca 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -1462,13 +1462,6 @@ sub verify_remotes_sanity {
}
}
-# we allow more chars than remotes2config.sh...
-sub sanitize_remote_name {
- my ($name) = @_;
- $name =~ tr{A-Za-z0-9:,/+-}{.}c;
- $name;
-}
-
sub find_existing_remote {
my ($url, $remotes) = @_;
return undef if $no_reuse_existing;
@@ -2577,8 +2570,8 @@ sub rebuild {
my ($log, $ctx) =
command_output_pipe(qw/rev-list --pretty=raw --no-color --reverse/,
$self->refname, '--');
- my $full_url = $self->full_url;
- remove_username($full_url);
+ my $metadata_url = $self->metadata_url;
+ remove_username($metadata_url);
my $svn_uuid = $self->ra_uuid;
my $c;
while (<$log>) {
@@ -2596,7 +2589,7 @@ sub rebuild {
# if we merged or otherwise started elsewhere, this is
# how we break out of it
if (($uuid ne $svn_uuid) ||
- ($full_url && $url && ($url ne $full_url))) {
+ ($metadata_url && $url && ($url ne $metadata_url))) {
next;
}
@@ -2853,7 +2846,7 @@ sub _new {
unless (defined $ref_id && length $ref_id) {
$_[2] = $ref_id = $Git::SVN::default_ref_id;
}
- $_[1] = $repo_id = sanitize_remote_name($repo_id);
+ $_[1] = $repo_id;
my $dir = "$ENV{GIT_DIR}/svn/$ref_id";
$_[3] = $path = '' unless (defined $path);
mkpath(["$ENV{GIT_DIR}/svn"]);
@@ -3243,7 +3236,9 @@ sub close_file {
my ($tmp_fh, $tmp_filename) = File::Temp::tempfile(UNLINK => 1);
my $result;
while ($result = sysread($fh, my $string, 1024)) {
- syswrite($tmp_fh, $string, $result);
+ my $wrote = syswrite($tmp_fh, $string, $result);
+ defined($wrote) && $wrote == $result
+ or croak("write $tmp_filename: $!\n");
}
defined $result or croak $!;
close $tmp_fh or croak $!;
@@ -3251,6 +3246,7 @@ sub close_file {
close $fh or croak $!;
$hash = $::_repository->hash_and_insert_object($tmp_filename);
+ unlink($tmp_filename);
$hash =~ /^[a-f\d]{40}$/ or die "not a sha1: $hash\n";
close $fb->{base} or croak $!;
} else {
@@ -4704,8 +4700,7 @@ sub minimize_connections {
# skip existing cases where we already connect to the root
if (($ra->{url} eq $ra->{repos_root}) ||
- (Git::SVN::sanitize_remote_name($ra->{repos_root}) eq
- $repo_id)) {
+ ($ra->{repos_root} eq $repo_id)) {
$root_repos->{$ra->{url}} = $repo_id;
next;
}
@@ -4744,8 +4739,7 @@ sub minimize_connections {
foreach my $url (keys %$new_urls) {
# see if we can re-use an existing [svn-remote "repo_id"]
# instead of creating a(n ugly) new section:
- my $repo_id = $root_repos->{$url} ||
- Git::SVN::sanitize_remote_name($url);
+ my $repo_id = $root_repos->{$url} || $url;
my $fetch = $new_urls->{$url};
foreach my $path (keys %$fetch) {
diff --git a/git.c b/git.c
index 871b93ca7e..3307c078e5 100644
--- a/git.c
+++ b/git.c
@@ -394,6 +394,36 @@ static void handle_internal_command(int argc, const char **argv)
}
}
+static void execv_dashed_external(const char **argv)
+{
+ struct strbuf cmd;
+ const char *tmp;
+
+ strbuf_init(&cmd, 0);
+ strbuf_addf(&cmd, "git-%s", argv[0]);
+
+ /*
+ * argv[0] must be the git command, but the argv array
+ * belongs to the caller, and may be reused in
+ * subsequent loop iterations. Save argv[0] and
+ * restore it on error.
+ */
+ tmp = argv[0];
+ argv[0] = cmd.buf;
+
+ trace_argv_printf(argv, "trace: exec:");
+
+ /* execvp() can only ever return if it fails */
+ execvp(cmd.buf, (char **)argv);
+
+ trace_printf("trace: exec failed: %s\n", strerror(errno));
+
+ argv[0] = tmp;
+
+ strbuf_release(&cmd);
+}
+
+
int main(int argc, const char **argv)
{
const char *cmd = argv[0] && *argv[0] ? argv[0] : "git-help";
@@ -461,7 +491,7 @@ int main(int argc, const char **argv)
handle_internal_command(argc, argv);
/* .. then try the external ones */
- execv_git_cmd(argv);
+ execv_dashed_external(argv);
/* It could be an alias -- this works around the insanity
* of overriding "git log" with "git show" by having
diff --git a/git.spec.in b/git.spec.in
index 3d7f3ef4af..c6492e5be2 100644
--- a/git.spec.in
+++ b/git.spec.in
@@ -117,6 +117,7 @@ find $RPM_BUILD_ROOT -type f -name '*.bs' -empty -exec rm -f {} ';'
find $RPM_BUILD_ROOT -type f -name perllocal.pod -exec rm -f {} ';'
(find $RPM_BUILD_ROOT%{_bindir} -type f | grep -vE "archimport|svn|cvs|email|gitk|git-gui|git-citool" | sed -e s@^$RPM_BUILD_ROOT@@) > bin-man-doc-files
+(find $RPM_BUILD_ROOT%{_libexecdir}/git-core -type f | grep -vE "archimport|svn|cvs|email|gitk|git-gui|git-citool" | sed -e s@^$RPM_BUILD_ROOT@@) >> bin-man-doc-files
(find $RPM_BUILD_ROOT%{perl_vendorlib} -type f | sed -e s@^$RPM_BUILD_ROOT@@) >> perl-files
%if %{!?_without_docs:1}0
(find $RPM_BUILD_ROOT%{_mandir} $RPM_BUILD_ROOT/Documentation -type f | grep -vE "archimport|svn|git-cvs|email|gitk|git-gui|git-citool" | sed -e s@^$RPM_BUILD_ROOT@@ -e 's/$/*/' ) >> bin-man-doc-files
@@ -136,7 +137,7 @@ rm -rf $RPM_BUILD_ROOT
%files svn
%defattr(-,root,root)
-%{_bindir}/*svn*
+%{_libexecdir}/git-core/*svn*
%doc Documentation/*svn*.txt
%{!?_without_docs: %{_mandir}/man1/*svn*.1*}
%{!?_without_docs: %doc Documentation/*svn*.html }
@@ -144,28 +145,28 @@ rm -rf $RPM_BUILD_ROOT
%files cvs
%defattr(-,root,root)
%doc Documentation/*git-cvs*.txt
-%{_bindir}/*cvs*
+%{_libexecdir}/git-core/*cvs*
%{!?_without_docs: %{_mandir}/man1/*cvs*.1*}
%{!?_without_docs: %doc Documentation/*git-cvs*.html }
%files arch
%defattr(-,root,root)
%doc Documentation/git-archimport.txt
-%{_bindir}/git-archimport
+%{_libexecdir}/git-core/git-archimport
%{!?_without_docs: %{_mandir}/man1/git-archimport.1*}
%{!?_without_docs: %doc Documentation/git-archimport.html }
%files email
%defattr(-,root,root)
%doc Documentation/*email*.txt
-%{_bindir}/*email*
+%{_libexecdir}/git-core/*email*
%{!?_without_docs: %{_mandir}/man1/*email*.1*}
%{!?_without_docs: %doc Documentation/*email*.html }
%files gui
%defattr(-,root,root)
-%{_bindir}/git-gui
-%{_bindir}/git-citool
+%{_libexecdir}/git-core/git-gui
+%{_libexecdir}/git-core/git-citool
%{_datadir}/git-gui/
%{!?_without_docs: %{_mandir}/man1/git-gui.1*}
%{!?_without_docs: %doc Documentation/git-gui.html}
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 49b01d8c25..90cd99bf91 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -386,7 +386,7 @@ $projects_list ||= $projectroot;
our $action = $cgi->param('a');
if (defined $action) {
if ($action =~ m/[^0-9a-zA-Z\.\-_]/) {
- die_error(undef, "Invalid action parameter");
+ die_error(400, "Invalid action parameter");
}
}
@@ -399,21 +399,21 @@ if (defined $project) {
($export_ok && !(-e "$projectroot/$project/$export_ok")) ||
($strict_export && !project_in_list($project))) {
undef $project;
- die_error(undef, "No such project");
+ die_error(404, "No such project");
}
}
our $file_name = $cgi->param('f');
if (defined $file_name) {
if (!validate_pathname($file_name)) {
- die_error(undef, "Invalid file parameter");
+ die_error(400, "Invalid file parameter");
}
}
our $file_parent = $cgi->param('fp');
if (defined $file_parent) {
if (!validate_pathname($file_parent)) {
- die_error(undef, "Invalid file parent parameter");
+ die_error(400, "Invalid file parent parameter");
}
}
@@ -421,21 +421,21 @@ if (defined $file_parent) {
our $hash = $cgi->param('h');
if (defined $hash) {
if (!validate_refname($hash)) {
- die_error(undef, "Invalid hash parameter");
+ die_error(400, "Invalid hash parameter");
}
}
our $hash_parent = $cgi->param('hp');
if (defined $hash_parent) {
if (!validate_refname($hash_parent)) {
- die_error(undef, "Invalid hash parent parameter");
+ die_error(400, "Invalid hash parent parameter");
}
}
our $hash_base = $cgi->param('hb');
if (defined $hash_base) {
if (!validate_refname($hash_base)) {
- die_error(undef, "Invalid hash base parameter");
+ die_error(400, "Invalid hash base parameter");
}
}
@@ -447,10 +447,10 @@ our @extra_options = $cgi->param('opt');
if (defined @extra_options) {
foreach my $opt (@extra_options) {
if (not exists $allowed_options{$opt}) {
- die_error(undef, "Invalid option parameter");
+ die_error(400, "Invalid option parameter");
}
if (not grep(/^$action$/, @{$allowed_options{$opt}})) {
- die_error(undef, "Invalid option parameter for this action");
+ die_error(400, "Invalid option parameter for this action");
}
}
}
@@ -458,7 +458,7 @@ if (defined @extra_options) {
our $hash_parent_base = $cgi->param('hpb');
if (defined $hash_parent_base) {
if (!validate_refname($hash_parent_base)) {
- die_error(undef, "Invalid hash parent base parameter");
+ die_error(400, "Invalid hash parent base parameter");
}
}
@@ -466,14 +466,14 @@ if (defined $hash_parent_base) {
our $page = $cgi->param('pg');
if (defined $page) {
if ($page =~ m/[^0-9]/) {
- die_error(undef, "Invalid page parameter");
+ die_error(400, "Invalid page parameter");
}
}
our $searchtype = $cgi->param('st');
if (defined $searchtype) {
if ($searchtype =~ m/[^a-z]/) {
- die_error(undef, "Invalid searchtype parameter");
+ die_error(400, "Invalid searchtype parameter");
}
}
@@ -483,7 +483,7 @@ our $searchtext = $cgi->param('s');
our $search_regexp;
if (defined $searchtext) {
if (length($searchtext) < 2) {
- die_error(undef, "At least two characters are required for search parameter");
+ die_error(403, "At least two characters are required for search parameter");
}
$search_regexp = $search_use_regexp ? $searchtext : quotemeta $searchtext;
}
@@ -539,7 +539,7 @@ $git_dir = "$projectroot/$project" if $project;
# dispatch
my %actions = (
- "blame" => \&git_blame2,
+ "blame" => \&git_blame,
"blobdiff" => \&git_blobdiff,
"blobdiff_plain" => \&git_blobdiff_plain,
"blob" => \&git_blob,
@@ -580,11 +580,11 @@ if (!defined $action) {
}
}
if (!defined($actions{$action})) {
- die_error(undef, "Unknown action");
+ die_error(400, "Unknown action");
}
if ($action !~ m/^(opml|project_list|project_index)$/ &&
!$project) {
- die_error(undef, "Project needed");
+ die_error(400, "Project needed");
}
$actions{$action}->();
exit;
@@ -1665,7 +1665,7 @@ sub git_get_hash_by_path {
$path =~ s,/+$,,;
open my $fd, "-|", git_cmd(), "ls-tree", $base, "--", $path
- or die_error(undef, "Open git-ls-tree failed");
+ or die_error(500, "Open git-ls-tree failed");
my $line = <$fd>;
close $fd or return undef;
@@ -2127,7 +2127,7 @@ sub parse_commit {
"--max-count=1",
$commit_id,
"--",
- or die_error(undef, "Open git-rev-list failed");
+ or die_error(500, "Open git-rev-list failed");
%co = parse_commit_text(<$fd>, 1);
close $fd;
@@ -2152,7 +2152,7 @@ sub parse_commits {
$commit_id,
"--",
($filename ? ($filename) : ())
- or die_error(undef, "Open git-rev-list failed");
+ or die_error(500, "Open git-rev-list failed");
while (my $line = <$fd>) {
my %co = parse_commit_text($line);
push @cos, \%co;
@@ -2672,11 +2672,26 @@ sub git_footer_html {
"</html>";
}
+# die_error(<http_status_code>, <error_message>)
+# Example: die_error(404, 'Hash not found')
+# By convention, use the following status codes (as defined in RFC 2616):
+# 400: Invalid or missing CGI parameters, or
+# requested object exists but has wrong type.
+# 403: Requested feature (like "pickaxe" or "snapshot") not enabled on
+# this server or project.
+# 404: Requested object/revision/project doesn't exist.
+# 500: The server isn't configured properly, or
+# an internal error occurred (e.g. failed assertions caused by bugs), or
+# an unknown error occurred (e.g. the git binary died unexpectedly).
sub die_error {
- my $status = shift || "403 Forbidden";
- my $error = shift || "Malformed query, file missing or permission denied";
-
- git_header_html($status);
+ my $status = shift || 500;
+ my $error = shift || "Internal server error";
+
+ my %http_responses = (400 => '400 Bad Request',
+ 403 => '403 Forbidden',
+ 404 => '404 Not Found',
+ 500 => '500 Internal Server Error');
+ git_header_html($http_responses{$status});
print <<EOF;
<div class="page_body">
<br /><br />
@@ -3520,21 +3535,24 @@ sub git_patchset_body {
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
-sub git_project_list_body {
- my ($projlist, $order, $from, $to, $extra, $no_header) = @_;
-
- my ($check_forks) = gitweb_check_feature('forks');
-
+# fills project list info (age, description, owner, forks) for each
+# project in the list, removing invalid projects from returned list
+# NOTE: modifies $projlist, but does not remove entries from it
+sub fill_project_list_info {
+ my ($projlist, $check_forks) = @_;
my @projects;
+
+ PROJECT:
foreach my $pr (@$projlist) {
- my (@aa) = git_get_last_activity($pr->{'path'});
- unless (@aa) {
- next;
+ my (@activity) = git_get_last_activity($pr->{'path'});
+ unless (@activity) {
+ next PROJECT;
}
- ($pr->{'age'}, $pr->{'age_string'}) = @aa;
+ ($pr->{'age'}, $pr->{'age_string'}) = @activity;
if (!defined $pr->{'descr'}) {
my $descr = git_get_project_description($pr->{'path'}) || "";
- $pr->{'descr_long'} = to_utf8($descr);
+ $descr = to_utf8($descr);
+ $pr->{'descr_long'} = $descr;
$pr->{'descr'} = chop_str($descr, $projects_list_description_width, 5);
}
if (!defined $pr->{'owner'}) {
@@ -3546,14 +3564,52 @@ sub git_project_list_body {
($pname !~ /\/$/) &&
(-d "$projectroot/$pname")) {
$pr->{'forks'} = "-d $projectroot/$pname";
- }
- else {
+ } else {
$pr->{'forks'} = 0;
}
}
push @projects, $pr;
}
+ return @projects;
+}
+
+# print 'sort by' <th> element, either sorting by $key if $name eq $order
+# (changing $list), or generating 'sort by $name' replay link otherwise
+sub print_sort_th {
+ my ($str_sort, $name, $order, $key, $header, $list) = @_;
+ $key ||= $name;
+ $header ||= ucfirst($name);
+
+ if ($order eq $name) {
+ if ($str_sort) {
+ @$list = sort {$a->{$key} cmp $b->{$key}} @$list;
+ } else {
+ @$list = sort {$a->{$key} <=> $b->{$key}} @$list;
+ }
+ print "<th>$header</th>\n";
+ } else {
+ print "<th>" .
+ $cgi->a({-href => href(-replay=>1, order=>$name),
+ -class => "header"}, $header) .
+ "</th>\n";
+ }
+}
+
+sub print_sort_th_str {
+ print_sort_th(1, @_);
+}
+
+sub print_sort_th_num {
+ print_sort_th(0, @_);
+}
+
+sub git_project_list_body {
+ my ($projlist, $order, $from, $to, $extra, $no_header) = @_;
+
+ my ($check_forks) = gitweb_check_feature('forks');
+ my @projects = fill_project_list_info($projlist, $check_forks);
+
$order ||= $default_projects_order;
$from = 0 unless defined $from;
$to = $#projects if (!defined $to || $#projects < $to);
@@ -3564,43 +3620,15 @@ sub git_project_list_body {
if ($check_forks) {
print "<th></th>\n";
}
- if ($order eq "project") {
- @projects = sort {$a->{'path'} cmp $b->{'path'}} @projects;
- print "<th>Project</th>\n";
- } else {
- print "<th>" .
- $cgi->a({-href => href(project=>undef, order=>'project'),
- -class => "header"}, "Project") .
- "</th>\n";
- }
- if ($order eq "descr") {
- @projects = sort {$a->{'descr'} cmp $b->{'descr'}} @projects;
- print "<th>Description</th>\n";
- } else {
- print "<th>" .
- $cgi->a({-href => href(project=>undef, order=>'descr'),
- -class => "header"}, "Description") .
- "</th>\n";
- }
- if ($order eq "owner") {
- @projects = sort {$a->{'owner'} cmp $b->{'owner'}} @projects;
- print "<th>Owner</th>\n";
- } else {
- print "<th>" .
- $cgi->a({-href => href(project=>undef, order=>'owner'),
- -class => "header"}, "Owner") .
- "</th>\n";
- }
- if ($order eq "age") {
- @projects = sort {$a->{'age'} <=> $b->{'age'}} @projects;
- print "<th>Last Change</th>\n";
- } else {
- print "<th>" .
- $cgi->a({-href => href(project=>undef, order=>'age'),
- -class => "header"}, "Last Change") .
- "</th>\n";
- }
- print "<th></th>\n" .
+ print_sort_th_str('project', $order, 'path',
+ 'Project', \@projects);
+ print_sort_th_str('descr', $order, 'descr_long',
+ 'Description', \@projects);
+ print_sort_th_str('owner', $order, 'owner',
+ 'Owner', \@projects);
+ print_sort_th_num('age', $order, 'age',
+ 'Last Change', \@projects);
+ print "<th></th>\n" . # for links
"</tr>\n";
}
my $alternate = 1;
@@ -3924,12 +3952,12 @@ sub git_search_grep_body {
sub git_project_list {
my $order = $cgi->param('o');
if (defined $order && $order !~ m/none|project|descr|owner|age/) {
- die_error(undef, "Unknown order parameter");
+ die_error(400, "Unknown order parameter");
}
my @list = git_get_projects_list();
if (!@list) {
- die_error(undef, "No projects found");
+ die_error(404, "No projects found");
}
git_header_html();
@@ -3947,12 +3975,12 @@ sub git_project_list {
sub git_forks {
my $order = $cgi->param('o');
if (defined $order && $order !~ m/none|project|descr|owner|age/) {
- die_error(undef, "Unknown order parameter");
+ die_error(400, "Unknown order parameter");
}
my @list = git_get_projects_list($project);
if (!@list) {
- die_error(undef, "No forks found");
+ die_error(404, "No forks found");
}
git_header_html();
@@ -4081,7 +4109,7 @@ sub git_tag {
my %tag = parse_tag($hash);
if (! %tag) {
- die_error(undef, "Unknown tag object");
+ die_error(404, "Unknown tag object");
}
git_print_header_div('commit', esc_html($tag{'name'}), $hash);
@@ -4113,30 +4141,29 @@ sub git_tag {
git_footer_html();
}
-sub git_blame2 {
+sub git_blame {
my $fd;
my $ftype;
- my ($have_blame) = gitweb_check_feature('blame');
- if (!$have_blame) {
- die_error('403 Permission denied', "Permission denied");
- }
- die_error('404 Not Found', "File name not defined") if (!$file_name);
+ gitweb_check_feature('blame')
+ or die_error(403, "Blame view not allowed");
+
+ die_error(400, "No file name given") unless $file_name;
$hash_base ||= git_get_head_hash($project);
- die_error(undef, "Couldn't find base commit") unless ($hash_base);
+ die_error(404, "Couldn't find base commit") unless ($hash_base);
my %co = parse_commit($hash_base)
- or die_error(undef, "Reading commit failed");
+ or die_error(404, "Commit not found");
if (!defined $hash) {
$hash = git_get_hash_by_path($hash_base, $file_name, "blob")
- or die_error(undef, "Error looking up file");
+ or die_error(404, "Error looking up file");
}
$ftype = git_get_type($hash);
if ($ftype !~ "blob") {
- die_error('400 Bad Request', "Object is not a blob");
+ die_error(400, "Object is not a blob");
}
open ($fd, "-|", git_cmd(), "blame", '-p', '--',
$file_name, $hash_base)
- or die_error(undef, "Open git-blame failed");
+ or die_error(500, "Open git-blame failed");
git_header_html();
my $formats_nav =
$cgi->a({-href => href(action=>"blob", -replay=>1)},
@@ -4198,7 +4225,7 @@ HTML
print "</td>\n";
}
open (my $dd, "-|", git_cmd(), "rev-parse", "$full_rev^")
- or die_error(undef, "Open git-rev-parse failed");
+ or die_error(500, "Open git-rev-parse failed");
my $parent_commit = <$dd>;
close $dd;
chomp($parent_commit);
@@ -4221,103 +4248,6 @@ HTML
git_footer_html();
}
-sub git_blame {
- my $fd;
-
- my ($have_blame) = gitweb_check_feature('blame');
- if (!$have_blame) {
- die_error('403 Permission denied', "Permission denied");
- }
- die_error('404 Not Found', "File name not defined") if (!$file_name);
- $hash_base ||= git_get_head_hash($project);
- die_error(undef, "Couldn't find base commit") unless ($hash_base);
- my %co = parse_commit($hash_base)
- or die_error(undef, "Reading commit failed");
- if (!defined $hash) {
- $hash = git_get_hash_by_path($hash_base, $file_name, "blob")
- or die_error(undef, "Error lookup file");
- }
- open ($fd, "-|", git_cmd(), "annotate", '-l', '-t', '-r', $file_name, $hash_base)
- or die_error(undef, "Open git-annotate failed");
- git_header_html();
- my $formats_nav =
- $cgi->a({-href => href(action=>"blob", hash=>$hash, hash_base=>$hash_base, file_name=>$file_name)},
- "blob") .
- " | " .
- $cgi->a({-href => href(action=>"history", hash=>$hash, hash_base=>$hash_base, file_name=>$file_name)},
- "history") .
- " | " .
- $cgi->a({-href => href(action=>"blame", file_name=>$file_name)},
- "HEAD");
- git_print_page_nav('','', $hash_base,$co{'tree'},$hash_base, $formats_nav);
- git_print_header_div('commit', esc_html($co{'title'}), $hash_base);
- git_print_page_path($file_name, 'blob', $hash_base);
- print "<div class=\"page_body\">\n";
- print <<HTML;
-<table class="blame">
- <tr>
- <th>Commit</th>
- <th>Age</th>
- <th>Author</th>
- <th>Line</th>
- <th>Data</th>
- </tr>
-HTML
- my @line_class = (qw(light dark));
- my $line_class_len = scalar (@line_class);
- my $line_class_num = $#line_class;
- while (my $line = <$fd>) {
- my $long_rev;
- my $short_rev;
- my $author;
- my $time;
- my $lineno;
- my $data;
- my $age;
- my $age_str;
- my $age_class;
-
- chomp $line;
- $line_class_num = ($line_class_num + 1) % $line_class_len;
-
- if ($line =~ m/^([0-9a-fA-F]{40})\t\(\s*([^\t]+)\t(\d+) [+-]\d\d\d\d\t(\d+)\)(.*)$/) {
- $long_rev = $1;
- $author = $2;
- $time = $3;
- $lineno = $4;
- $data = $5;
- } else {
- print qq( <tr><td colspan="5" class="error">Unable to parse: $line</td></tr>\n);
- next;
- }
- $short_rev = substr ($long_rev, 0, 8);
- $age = time () - $time;
- $age_str = age_string ($age);
- $age_str =~ s/ /&nbsp;/g;
- $age_class = age_class($age);
- $author = esc_html ($author);
- $author =~ s/ /&nbsp;/g;
-
- $data = untabify($data);
- $data = esc_html ($data);
-
- print <<HTML;
- <tr class="$line_class[$line_class_num]">
- <td class="sha1"><a href="${\href (action=>"commit", hash=>$long_rev)}" class="text">$short_rev..</a></td>
- <td class="$age_class">$age_str</td>
- <td>$author</td>
- <td class="linenr"><a id="$lineno" href="#$lineno" class="linenr">$lineno</a></td>
- <td class="pre">$data</td>
- </tr>
-HTML
- } # while (my $line = <$fd>)
- print "</table>\n\n";
- close $fd
- or print "Reading blob failed.\n";
- print "</div>";
- git_footer_html();
-}
-
sub git_tags {
my $head = git_get_head_hash($project);
git_header_html();
@@ -4352,9 +4282,9 @@ sub git_blob_plain {
if (defined $file_name) {
my $base = $hash_base || git_get_head_hash($project);
$hash = git_get_hash_by_path($base, $file_name, "blob")
- or die_error(undef, "Error lookup file");
+ or die_error(404, "Cannot find file");
} else {
- die_error(undef, "No file name defined");
+ die_error(400, "No file name defined");
}
} elsif ($hash =~ m/^[0-9a-fA-F]{40}$/) {
# blobs defined by non-textual hash id's can be cached
@@ -4362,7 +4292,7 @@ sub git_blob_plain {
}
open my $fd, "-|", git_cmd(), "cat-file", "blob", $hash
- or die_error(undef, "Open git-cat-file blob '$hash' failed");
+ or die_error(500, "Open git-cat-file blob '$hash' failed");
# content-type (can include charset)
$type = blob_contenttype($fd, $file_name, $type);
@@ -4394,9 +4324,9 @@ sub git_blob {
if (defined $file_name) {
my $base = $hash_base || git_get_head_hash($project);
$hash = git_get_hash_by_path($base, $file_name, "blob")
- or die_error(undef, "Error lookup file");
+ or die_error(404, "Cannot find file");
} else {
- die_error(undef, "No file name defined");
+ die_error(400, "No file name defined");
}
} elsif ($hash =~ m/^[0-9a-fA-F]{40}$/) {
# blobs defined by non-textual hash id's can be cached
@@ -4405,7 +4335,7 @@ sub git_blob {
my ($have_blame) = gitweb_check_feature('blame');
open my $fd, "-|", git_cmd(), "cat-file", "blob", $hash
- or die_error(undef, "Couldn't cat $file_name, $hash");
+ or die_error(500, "Couldn't cat $file_name, $hash");
my $mimetype = blob_mimetype($fd, $file_name);
if ($mimetype !~ m!^(?:text/|image/(?:gif|png|jpeg)$)! && -B $fd) {
close $fd;
@@ -4486,9 +4416,9 @@ sub git_tree {
}
$/ = "\0";
open my $fd, "-|", git_cmd(), "ls-tree", '-z', $hash
- or die_error(undef, "Open git-ls-tree failed");
+ or die_error(500, "Open git-ls-tree failed");
my @entries = map { chomp; $_ } <$fd>;
- close $fd or die_error(undef, "Reading tree failed");
+ close $fd or die_error(404, "Reading tree failed");
$/ = "\n";
my $refs = git_get_references();
@@ -4578,16 +4508,16 @@ sub git_snapshot {
my $format = $cgi->param('sf');
if (!@supported_fmts) {
- die_error('403 Permission denied', "Permission denied");
+ die_error(403, "Snapshots not allowed");
}
# default to first supported snapshot format
$format ||= $supported_fmts[0];
if ($format !~ m/^[a-z0-9]+$/) {
- die_error(undef, "Invalid snapshot format parameter");
+ die_error(400, "Invalid snapshot format parameter");
} elsif (!exists($known_snapshot_formats{$format})) {
- die_error(undef, "Unknown snapshot format");
+ die_error(400, "Unknown snapshot format");
} elsif (!grep($_ eq $format, @supported_fmts)) {
- die_error(undef, "Unsupported snapshot format");
+ die_error(403, "Unsupported snapshot format");
}
if (!defined $hash) {
@@ -4615,7 +4545,7 @@ sub git_snapshot {
-status => '200 OK');
open my $fd, "-|", $cmd
- or die_error(undef, "Execute git-archive failed");
+ or die_error(500, "Execute git-archive failed");
binmode STDOUT, ':raw';
print <$fd>;
binmode STDOUT, ':utf8'; # as set at the beginning of gitweb.cgi
@@ -4683,10 +4613,8 @@ sub git_log {
sub git_commit {
$hash ||= $hash_base || "HEAD";
- my %co = parse_commit($hash);
- if (!%co) {
- die_error(undef, "Unknown commit object");
- }
+ my %co = parse_commit($hash)
+ or die_error(404, "Unknown commit object");
my %ad = parse_date($co{'author_epoch'}, $co{'author_tz'});
my %cd = parse_date($co{'committer_epoch'}, $co{'committer_tz'});
@@ -4726,9 +4654,9 @@ sub git_commit {
@diff_opts,
(@$parents <= 1 ? $parent : '-c'),
$hash, "--"
- or die_error(undef, "Open git-diff-tree failed");
+ or die_error(500, "Open git-diff-tree failed");
@difftree = map { chomp; $_ } <$fd>;
- close $fd or die_error(undef, "Reading git-diff-tree failed");
+ close $fd or die_error(404, "Reading git-diff-tree failed");
# non-textual hash id's can be cached
my $expires;
@@ -4821,33 +4749,33 @@ sub git_object {
open my $fd, "-|", quote_command(
git_cmd(), 'cat-file', '-t', $object_id) . ' 2> /dev/null'
- or die_error('404 Not Found', "Object does not exist");
+ or die_error(404, "Object does not exist");
$type = <$fd>;
chomp $type;
close $fd
- or die_error('404 Not Found', "Object does not exist");
+ or die_error(404, "Object does not exist");
# - hash_base and file_name
} elsif ($hash_base && defined $file_name) {
$file_name =~ s,/+$,,;
system(git_cmd(), "cat-file", '-e', $hash_base) == 0
- or die_error('404 Not Found', "Base object does not exist");
+ or die_error(404, "Base object does not exist");
# here errors should not hapen
open my $fd, "-|", git_cmd(), "ls-tree", $hash_base, "--", $file_name
- or die_error(undef, "Open git-ls-tree failed");
+ or die_error(500, "Open git-ls-tree failed");
my $line = <$fd>;
close $fd;
#'100644 blob 0fa3f3a66fb6a137f6ec2c19351ed4d807070ffa panic.c'
unless ($line && $line =~ m/^([0-9]+) (.+) ([0-9a-fA-F]{40})\t/) {
- die_error('404 Not Found', "File or directory for given base does not exist");
+ die_error(404, "File or directory for given base does not exist");
}
$type = $2;
$hash = $3;
} else {
- die_error('404 Not Found', "Not enough information to find object");
+ die_error(400, "Not enough information to find object");
}
print $cgi->redirect(-uri => href(action=>$type, -full=>1,
@@ -4872,12 +4800,12 @@ sub git_blobdiff {
open $fd, "-|", git_cmd(), "diff-tree", '-r', @diff_opts,
$hash_parent_base, $hash_base,
"--", (defined $file_parent ? $file_parent : ()), $file_name
- or die_error(undef, "Open git-diff-tree failed");
+ or die_error(500, "Open git-diff-tree failed");
@difftree = map { chomp; $_ } <$fd>;
close $fd
- or die_error(undef, "Reading git-diff-tree failed");
+ or die_error(404, "Reading git-diff-tree failed");
@difftree
- or die_error('404 Not Found', "Blob diff not found");
+ or die_error(404, "Blob diff not found");
} elsif (defined $hash &&
$hash =~ /[0-9a-fA-F]{40}/) {
@@ -4886,23 +4814,23 @@ sub git_blobdiff {
# read filtered raw output
open $fd, "-|", git_cmd(), "diff-tree", '-r', @diff_opts,
$hash_parent_base, $hash_base, "--"
- or die_error(undef, "Open git-diff-tree failed");
+ or die_error(500, "Open git-diff-tree failed");
@difftree =
# ':100644 100644 03b21826... 3b93d5e7... M ls-files.c'
# $hash == to_id
grep { /^:[0-7]{6} [0-7]{6} [0-9a-fA-F]{40} $hash/ }
map { chomp; $_ } <$fd>;
close $fd
- or die_error(undef, "Reading git-diff-tree failed");
+ or die_error(404, "Reading git-diff-tree failed");
@difftree
- or die_error('404 Not Found', "Blob diff not found");
+ or die_error(404, "Blob diff not found");
} else {
- die_error('404 Not Found', "Missing one of the blob diff parameters");
+ die_error(400, "Missing one of the blob diff parameters");
}
if (@difftree > 1) {
- die_error('404 Not Found', "Ambiguous blob diff specification");
+ die_error(400, "Ambiguous blob diff specification");
}
%diffinfo = parse_difftree_raw_line($difftree[0]);
@@ -4923,7 +4851,7 @@ sub git_blobdiff {
'-p', ($format eq 'html' ? "--full-index" : ()),
$hash_parent_base, $hash_base,
"--", (defined $file_parent ? $file_parent : ()), $file_name
- or die_error(undef, "Open git-diff-tree failed");
+ or die_error(500, "Open git-diff-tree failed");
}
# old/legacy style URI
@@ -4959,9 +4887,9 @@ sub git_blobdiff {
open $fd, "-|", git_cmd(), "diff", @diff_opts,
'-p', ($format eq 'html' ? "--full-index" : ()),
$hash_parent, $hash, "--"
- or die_error(undef, "Open git-diff failed");
+ or die_error(500, "Open git-diff failed");
} else {
- die_error('404 Not Found', "Missing one of the blob diff parameters")
+ die_error(400, "Missing one of the blob diff parameters")
unless %diffinfo;
}
@@ -4994,7 +4922,7 @@ sub git_blobdiff {
print "X-Git-Url: " . $cgi->self_url() . "\n\n";
} else {
- die_error(undef, "Unknown blobdiff format");
+ die_error(400, "Unknown blobdiff format");
}
# patch
@@ -5029,10 +4957,8 @@ sub git_blobdiff_plain {
sub git_commitdiff {
my $format = shift || 'html';
$hash ||= $hash_base || "HEAD";
- my %co = parse_commit($hash);
- if (!%co) {
- die_error(undef, "Unknown commit object");
- }
+ my %co = parse_commit($hash)
+ or die_error(404, "Unknown commit object");
# choose format for commitdiff for merge
if (! defined $hash_parent && @{$co{'parents'}} > 1) {
@@ -5114,7 +5040,7 @@ sub git_commitdiff {
open $fd, "-|", git_cmd(), "diff-tree", '-r', @diff_opts,
"--no-commit-id", "--patch-with-raw", "--full-index",
$hash_parent_param, $hash, "--"
- or die_error(undef, "Open git-diff-tree failed");
+ or die_error(500, "Open git-diff-tree failed");
while (my $line = <$fd>) {
chomp $line;
@@ -5126,10 +5052,10 @@ sub git_commitdiff {
} elsif ($format eq 'plain') {
open $fd, "-|", git_cmd(), "diff-tree", '-r', @diff_opts,
'-p', $hash_parent_param, $hash, "--"
- or die_error(undef, "Open git-diff-tree failed");
+ or die_error(500, "Open git-diff-tree failed");
} else {
- die_error(undef, "Unknown commitdiff format");
+ die_error(400, "Unknown commitdiff format");
}
# non-textual hash id's can be cached
@@ -5212,19 +5138,15 @@ sub git_history {
$page = 0;
}
my $ftype;
- my %co = parse_commit($hash_base);
- if (!%co) {
- die_error(undef, "Unknown commit object");
- }
+ my %co = parse_commit($hash_base)
+ or die_error(404, "Unknown commit object");
my $refs = git_get_references();
my $limit = sprintf("--max-count=%i", (100 * ($page+1)));
my @commitlist = parse_commits($hash_base, 101, (100 * $page),
- $file_name, "--full-history");
- if (!@commitlist) {
- die_error('404 Not Found', "No such file or directory on given branch");
- }
+ $file_name, "--full-history")
+ or die_error(404, "No such file or directory on given branch");
if (!defined $hash && defined $file_name) {
# some commits could have deleted file in question,
@@ -5238,7 +5160,7 @@ sub git_history {
$ftype = git_get_type($hash);
}
if (!defined $ftype) {
- die_error(undef, "Unknown type of object");
+ die_error(500, "Unknown type of object");
}
my $paging_nav = '';
@@ -5276,19 +5198,16 @@ sub git_history {
}
sub git_search {
- my ($have_search) = gitweb_check_feature('search');
- if (!$have_search) {
- die_error('403 Permission denied', "Permission denied");
- }
+ gitweb_check_feature('search') or die_error(403, "Search is disabled");
if (!defined $searchtext) {
- die_error(undef, "Text field empty");
+ die_error(400, "Text field is empty");
}
if (!defined $hash) {
$hash = git_get_head_hash($project);
}
my %co = parse_commit($hash);
if (!%co) {
- die_error(undef, "Unknown commit object");
+ die_error(404, "Unknown commit object");
}
if (!defined $page) {
$page = 0;
@@ -5298,16 +5217,12 @@ sub git_search {
if ($searchtype eq 'pickaxe') {
# pickaxe may take all resources of your box and run for several minutes
# with every query - so decide by yourself how public you make this feature
- my ($have_pickaxe) = gitweb_check_feature('pickaxe');
- if (!$have_pickaxe) {
- die_error('403 Permission denied', "Permission denied");
- }
+ gitweb_check_feature('pickaxe')
+ or die_error(403, "Pickaxe is disabled");
}
if ($searchtype eq 'grep') {
- my ($have_grep) = gitweb_check_feature('grep');
- if (!$have_grep) {
- die_error('403 Permission denied', "Permission denied");
- }
+ gitweb_check_feature('grep')
+ or die_error(403, "Grep is disabled");
}
git_header_html();
@@ -5581,7 +5496,7 @@ sub git_feed {
# Atom: http://www.atomenabled.org/developers/syndication/
# RSS: http://www.notestips.com/80256B3A007F2692/1/NAMO5P9UPQ
if ($format ne 'rss' && $format ne 'atom') {
- die_error(undef, "Unknown web feed format");
+ die_error(400, "Unknown web feed format");
}
# log/feed of current (HEAD) branch, log of given branch, history of file/directory
diff --git a/help.c b/help.c
index 6c16fb4aa1..ca9632b6c5 100644
--- a/help.c
+++ b/help.c
@@ -550,20 +550,26 @@ static int is_git_command(const char *s)
is_in_cmdlist(&other_cmds, s);
}
+static const char *prepend(const char *prefix, const char *cmd)
+{
+ size_t pre_len = strlen(prefix);
+ size_t cmd_len = strlen(cmd);
+ char *p = xmalloc(pre_len + cmd_len + 1);
+ memcpy(p, prefix, pre_len);
+ strcpy(p + pre_len, cmd);
+ return p;
+}
+
static const char *cmd_to_page(const char *git_cmd)
{
if (!git_cmd)
return "git";
else if (!prefixcmp(git_cmd, "git"))
return git_cmd;
- else {
- int page_len = strlen(git_cmd) + 4;
- char *p = xmalloc(page_len + 1);
- strcpy(p, "git-");
- strcpy(p + 4, git_cmd);
- p[page_len] = 0;
- return p;
- }
+ else if (is_git_command(git_cmd))
+ return prepend("git-", git_cmd);
+ else
+ return prepend("git", git_cmd);
}
static void setup_man_path(void)
diff --git a/http-push.c b/http-push.c
index 665712a85d..2cd068a6f1 100644
--- a/http-push.c
+++ b/http-push.c
@@ -783,7 +783,7 @@ static void finish_request(struct transfer_request *request)
lst = &((*lst)->next);
*lst = (*lst)->next;
- if (!verify_pack(target, 0))
+ if (!verify_pack(target))
install_packed_git(target);
else
remote->can_update_info_refs = 0;
diff --git a/http-walker.c b/http-walker.c
index 99f397e32b..51c18f2685 100644
--- a/http-walker.c
+++ b/http-walker.c
@@ -795,7 +795,7 @@ static int fetch_pack(struct walker *walker, struct alt_base *repo, unsigned cha
lst = &((*lst)->next);
*lst = (*lst)->next;
- if (verify_pack(target, 0))
+ if (verify_pack(target))
return -1;
install_packed_git(target);
diff --git a/pack-check.c b/pack-check.c
index f4898732dd..f596bf2db5 100644
--- a/pack-check.c
+++ b/pack-check.c
@@ -4,8 +4,9 @@
struct idx_entry
{
- const unsigned char *sha1;
off_t offset;
+ const unsigned char *sha1;
+ unsigned int nr;
};
static int compare_entries(const void *e1, const void *e2)
@@ -19,6 +20,28 @@ static int compare_entries(const void *e1, const void *e2)
return 0;
}
+int check_pack_crc(struct packed_git *p, struct pack_window **w_curs,
+ off_t offset, off_t len, unsigned int nr)
+{
+ const uint32_t *index_crc;
+ uint32_t data_crc = crc32(0, Z_NULL, 0);
+
+ do {
+ unsigned int avail;
+ void *data = use_pack(p, w_curs, offset, &avail);
+ if (avail > len)
+ avail = len;
+ data_crc = crc32(data_crc, data, avail);
+ offset += avail;
+ len -= avail;
+ } while (len);
+
+ index_crc = p->index_data;
+ index_crc += 2 + 256 + p->num_objects * (20/4) + nr;
+
+ return data_crc != ntohl(*index_crc);
+}
+
static int verify_packfile(struct packed_git *p,
struct pack_window **w_curs)
{
@@ -61,15 +84,15 @@ static int verify_packfile(struct packed_git *p,
* we do not do scan-streaming check on the pack file.
*/
nr_objects = p->num_objects;
- entries = xmalloc(nr_objects * sizeof(*entries));
+ entries = xmalloc((nr_objects + 1) * sizeof(*entries));
+ entries[nr_objects].offset = pack_sig_ofs;
/* first sort entries by pack offset, since unpacking them is more efficient that way */
for (i = 0; i < nr_objects; i++) {
entries[i].sha1 = nth_packed_object_sha1(p, i);
if (!entries[i].sha1)
die("internal error pack-check nth-packed-object");
- entries[i].offset = find_pack_entry_one(entries[i].sha1, p);
- if (!entries[i].offset)
- die("internal error pack-check find-pack-entry-one");
+ entries[i].offset = nth_packed_object_offset(p, i);
+ entries[i].nr = i;
}
qsort(entries, nr_objects, sizeof(*entries), compare_entries);
@@ -78,6 +101,16 @@ static int verify_packfile(struct packed_git *p,
enum object_type type;
unsigned long size;
+ if (p->index_version > 1) {
+ off_t offset = entries[i].offset;
+ off_t len = entries[i+1].offset - offset;
+ unsigned int nr = entries[i].nr;
+ if (check_pack_crc(p, w_curs, offset, len, nr))
+ err = error("index CRC mismatch for object %s "
+ "from %s at offset %"PRIuMAX"",
+ sha1_to_hex(entries[i].sha1),
+ p->pack_name, (uintmax_t)offset);
+ }
data = unpack_entry(p, entries[i].offset, &type, &size);
if (!data) {
err = error("cannot unpack %s from %s at offset %"PRIuMAX"",
@@ -98,63 +131,7 @@ static int verify_packfile(struct packed_git *p,
return err;
}
-
-#define MAX_CHAIN 50
-
-static void show_pack_info(struct packed_git *p)
-{
- uint32_t nr_objects, i, chain_histogram[MAX_CHAIN+1];
-
- nr_objects = p->num_objects;
- memset(chain_histogram, 0, sizeof(chain_histogram));
- init_pack_revindex();
-
- for (i = 0; i < nr_objects; i++) {
- const unsigned char *sha1;
- unsigned char base_sha1[20];
- const char *type;
- unsigned long size;
- unsigned long store_size;
- off_t offset;
- unsigned int delta_chain_length;
-
- sha1 = nth_packed_object_sha1(p, i);
- if (!sha1)
- die("internal error pack-check nth-packed-object");
- offset = find_pack_entry_one(sha1, p);
- if (!offset)
- die("internal error pack-check find-pack-entry-one");
-
- type = packed_object_info_detail(p, offset, &size, &store_size,
- &delta_chain_length,
- base_sha1);
- printf("%s ", sha1_to_hex(sha1));
- if (!delta_chain_length)
- printf("%-6s %lu %lu %"PRIuMAX"\n",
- type, size, store_size, (uintmax_t)offset);
- else {
- printf("%-6s %lu %lu %"PRIuMAX" %u %s\n",
- type, size, store_size, (uintmax_t)offset,
- delta_chain_length, sha1_to_hex(base_sha1));
- if (delta_chain_length <= MAX_CHAIN)
- chain_histogram[delta_chain_length]++;
- else
- chain_histogram[0]++;
- }
- }
-
- for (i = 0; i <= MAX_CHAIN; i++) {
- if (!chain_histogram[i])
- continue;
- printf("chain length = %d: %d object%s\n", i,
- chain_histogram[i], chain_histogram[i] > 1 ? "s" : "");
- }
- if (chain_histogram[0])
- printf("chain length > %d: %d object%s\n", MAX_CHAIN,
- chain_histogram[0], chain_histogram[0] > 1 ? "s" : "");
-}
-
-int verify_pack(struct packed_git *p, int verbose)
+int verify_pack(struct packed_git *p)
{
off_t index_size;
const unsigned char *index_base;
@@ -180,14 +157,5 @@ int verify_pack(struct packed_git *p, int verbose)
err |= verify_packfile(p, &w_curs);
unuse_pack(&w_curs);
- if (verbose) {
- if (err)
- printf("%s: bad\n", p->pack_name);
- else {
- show_pack_info(p);
- printf("%s: ok\n", p->pack_name);
- }
- }
-
return err;
}
diff --git a/pack-refs.c b/pack-refs.c
new file mode 100644
index 0000000000..848d311c2b
--- /dev/null
+++ b/pack-refs.c
@@ -0,0 +1,117 @@
+#include "cache.h"
+#include "refs.h"
+#include "tag.h"
+#include "pack-refs.h"
+
+struct ref_to_prune {
+ struct ref_to_prune *next;
+ unsigned char sha1[20];
+ char name[FLEX_ARRAY];
+};
+
+struct pack_refs_cb_data {
+ unsigned int flags;
+ struct ref_to_prune *ref_to_prune;
+ FILE *refs_file;
+};
+
+static int do_not_prune(int flags)
+{
+ /* If it is already packed or if it is a symref,
+ * do not prune it.
+ */
+ return (flags & (REF_ISSYMREF|REF_ISPACKED));
+}
+
+static int handle_one_ref(const char *path, const unsigned char *sha1,
+ int flags, void *cb_data)
+{
+ struct pack_refs_cb_data *cb = cb_data;
+ int is_tag_ref;
+
+ /* Do not pack the symbolic refs */
+ if ((flags & REF_ISSYMREF))
+ return 0;
+ is_tag_ref = !prefixcmp(path, "refs/tags/");
+
+ /* ALWAYS pack refs that were already packed or are tags */
+ if (!(cb->flags & PACK_REFS_ALL) && !is_tag_ref && !(flags & REF_ISPACKED))
+ return 0;
+
+ fprintf(cb->refs_file, "%s %s\n", sha1_to_hex(sha1), path);
+ if (is_tag_ref) {
+ struct object *o = parse_object(sha1);
+ if (o->type == OBJ_TAG) {
+ o = deref_tag(o, path, 0);
+ if (o)
+ fprintf(cb->refs_file, "^%s\n",
+ sha1_to_hex(o->sha1));
+ }
+ }
+
+ if ((cb->flags & PACK_REFS_PRUNE) && !do_not_prune(flags)) {
+ int namelen = strlen(path) + 1;
+ struct ref_to_prune *n = xcalloc(1, sizeof(*n) + namelen);
+ hashcpy(n->sha1, sha1);
+ strcpy(n->name, path);
+ n->next = cb->ref_to_prune;
+ cb->ref_to_prune = n;
+ }
+ return 0;
+}
+
+/* make sure nobody touched the ref, and unlink */
+static void prune_ref(struct ref_to_prune *r)
+{
+ struct ref_lock *lock = lock_ref_sha1(r->name + 5, r->sha1);
+
+ if (lock) {
+ unlink(git_path("%s", r->name));
+ unlock_ref(lock);
+ }
+}
+
+static void prune_refs(struct ref_to_prune *r)
+{
+ while (r) {
+ prune_ref(r);
+ r = r->next;
+ }
+}
+
+static struct lock_file packed;
+
+int pack_refs(unsigned int flags)
+{
+ int fd;
+ struct pack_refs_cb_data cbdata;
+
+ memset(&cbdata, 0, sizeof(cbdata));
+ cbdata.flags = flags;
+
+ fd = hold_lock_file_for_update(&packed, git_path("packed-refs"), 1);
+ cbdata.refs_file = fdopen(fd, "w");
+ if (!cbdata.refs_file)
+ die("unable to create ref-pack file structure (%s)",
+ strerror(errno));
+
+ /* perhaps other traits later as well */
+ fprintf(cbdata.refs_file, "# pack-refs with: peeled \n");
+
+ for_each_ref(handle_one_ref, &cbdata);
+ if (ferror(cbdata.refs_file))
+ die("failed to write ref-pack file");
+ if (fflush(cbdata.refs_file) || fsync(fd) || fclose(cbdata.refs_file))
+ die("failed to write ref-pack file (%s)", strerror(errno));
+ /*
+ * Since the lock file was fdopen()'ed and then fclose()'ed above,
+ * assign -1 to the lock file descriptor so that commit_lock_file()
+ * won't try to close() it.
+ */
+ packed.fd = -1;
+ if (commit_lock_file(&packed) < 0)
+ die("unable to overwrite old ref-pack file (%s)", strerror(errno));
+ if (cbdata.flags & PACK_REFS_PRUNE)
+ prune_refs(cbdata.ref_to_prune);
+ return 0;
+}
diff --git a/pack-refs.h b/pack-refs.h
new file mode 100644
index 0000000000..518acfb370
--- /dev/null
+++ b/pack-refs.h
@@ -0,0 +1,18 @@
+#ifndef PACK_REFS_H
+#define PACK_REFS_H
+
+/*
+ * Flags for controlling behaviour of pack_refs()
+ * PACK_REFS_PRUNE: Prune loose refs after packing
+ * PACK_REFS_ALL: Pack _all_ refs, not just tags and already packed refs
+ */
+#define PACK_REFS_PRUNE 0x0001
+#define PACK_REFS_ALL 0x0002
+
+/*
+ * Write a packed-refs file for the current repository.
+ * flags: Combination of the above PACK_REFS_* flags.
+ */
+int pack_refs(unsigned int flags);
+
+#endif /* PACK_REFS_H */
diff --git a/pack-revindex.c b/pack-revindex.c
index a8aa2cd6ca..cd300bdff5 100644
--- a/pack-revindex.c
+++ b/pack-revindex.c
@@ -40,7 +40,7 @@ static int pack_revindex_ix(struct packed_git *p)
return -1 - i;
}
-void init_pack_revindex(void)
+static void init_pack_revindex(void)
{
int num;
struct packed_git *p;
@@ -118,9 +118,11 @@ struct revindex_entry *find_pack_revindex(struct packed_git *p, off_t ofs)
struct pack_revindex *rix;
struct revindex_entry *revindex;
+ if (!pack_revindex_hashsz)
+ init_pack_revindex();
num = pack_revindex_ix(p);
if (num < 0)
- die("internal error: pack revindex uninitialized");
+ die("internal error: pack revindex fubar");
rix = &pack_revindex[num];
if (!rix->revindex)
diff --git a/pack-revindex.h b/pack-revindex.h
index c3527a7565..36a514a6cf 100644
--- a/pack-revindex.h
+++ b/pack-revindex.h
@@ -6,7 +6,6 @@ struct revindex_entry {
unsigned int nr;
};
-void init_pack_revindex(void);
struct revindex_entry *find_pack_revindex(struct packed_git *p, off_t ofs);
#endif
diff --git a/pack-write.c b/pack-write.c
index f52cabe838..a8f0269936 100644
--- a/pack-write.c
+++ b/pack-write.c
@@ -2,7 +2,7 @@
#include "pack.h"
#include "csum-file.h"
-uint32_t pack_idx_default_version = 1;
+uint32_t pack_idx_default_version = 2;
uint32_t pack_idx_off32_limit = 0x7fffffff;
static int sha1_compare(const void *_a, const void *_b)
diff --git a/pack.h b/pack.h
index b31b37608d..76e6aa2aad 100644
--- a/pack.h
+++ b/pack.h
@@ -56,8 +56,8 @@ struct pack_idx_entry {
};
extern char *write_idx_file(char *index_name, struct pack_idx_entry **objects, int nr_objects, unsigned char *sha1);
-
-extern int verify_pack(struct packed_git *, int);
+extern int check_pack_crc(struct packed_git *p, struct pack_window **w_curs, off_t offset, off_t len, unsigned int nr);
+extern int verify_pack(struct packed_git *);
extern void fixup_pack_header_footer(int, unsigned char *, const char *, uint32_t);
extern char *index_pack_lockfile(int fd);
diff --git a/parse-options.c b/parse-options.c
index acf3fe3a1a..b8bde2b04a 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -312,8 +312,12 @@ void usage_with_options_internal(const char * const *usagestr,
fprintf(stderr, "usage: %s\n", *usagestr++);
while (*usagestr && **usagestr)
fprintf(stderr, " or: %s\n", *usagestr++);
- while (*usagestr)
- fprintf(stderr, " %s\n", *usagestr++);
+ while (*usagestr) {
+ fprintf(stderr, "%s%s\n",
+ **usagestr ? " " : "",
+ *usagestr);
+ usagestr++;
+ }
if (opts->type != OPTION_GROUP)
fputc('\n', stderr);
@@ -344,7 +348,10 @@ void usage_with_options_internal(const char * const *usagestr,
break;
case OPTION_INTEGER:
if (opts->flags & PARSE_OPT_OPTARG)
- pos += fprintf(stderr, "[<n>]");
+ if (opts->long_name)
+ pos += fprintf(stderr, "[=<n>]");
+ else
+ pos += fprintf(stderr, "[<n>]");
else
pos += fprintf(stderr, " <n>");
break;
@@ -355,12 +362,18 @@ void usage_with_options_internal(const char * const *usagestr,
case OPTION_STRING:
if (opts->argh) {
if (opts->flags & PARSE_OPT_OPTARG)
- pos += fprintf(stderr, " [<%s>]", opts->argh);
+ if (opts->long_name)
+ pos += fprintf(stderr, "[=<%s>]", opts->argh);
+ else
+ pos += fprintf(stderr, "[<%s>]", opts->argh);
else
pos += fprintf(stderr, " <%s>", opts->argh);
} else {
if (opts->flags & PARSE_OPT_OPTARG)
- pos += fprintf(stderr, " [...]");
+ if (opts->long_name)
+ pos += fprintf(stderr, "[=...]");
+ else
+ pos += fprintf(stderr, "[...]");
else
pos += fprintf(stderr, " ...");
}
diff --git a/path.c b/path.c
index 7a35a26a16..496123ca55 100644
--- a/path.c
+++ b/path.c
@@ -327,69 +327,19 @@ const char *make_nonrelative_path(const char *path)
return buf;
}
-/* We allow "recursive" symbolic links. Only within reason, though. */
-#define MAXDEPTH 5
-
-const char *make_absolute_path(const char *path)
+const char *make_relative_path(const char *abs, const char *base)
{
- static char bufs[2][PATH_MAX + 1], *buf = bufs[0], *next_buf = bufs[1];
- char cwd[1024] = "";
- int buf_index = 1, len;
-
- int depth = MAXDEPTH;
- char *last_elem = NULL;
- struct stat st;
-
- if (strlcpy(buf, path, PATH_MAX) >= PATH_MAX)
- die ("Too long path: %.*s", 60, path);
-
- while (depth--) {
- if (stat(buf, &st) || !S_ISDIR(st.st_mode)) {
- char *last_slash = strrchr(buf, '/');
- if (last_slash) {
- *last_slash = '\0';
- last_elem = xstrdup(last_slash + 1);
- } else {
- last_elem = xstrdup(buf);
- *buf = '\0';
- }
- }
-
- if (*buf) {
- if (!*cwd && !getcwd(cwd, sizeof(cwd)))
- die ("Could not get current working directory");
-
- if (chdir(buf))
- die ("Could not switch to '%s'", buf);
- }
- if (!getcwd(buf, PATH_MAX))
- die ("Could not get current working directory");
-
- if (last_elem) {
- int len = strlen(buf);
- if (len + strlen(last_elem) + 2 > PATH_MAX)
- die ("Too long path name: '%s/%s'",
- buf, last_elem);
- buf[len] = '/';
- strcpy(buf + len + 1, last_elem);
- free(last_elem);
- last_elem = NULL;
- }
-
- if (!lstat(buf, &st) && S_ISLNK(st.st_mode)) {
- len = readlink(buf, next_buf, PATH_MAX);
- if (len < 0)
- die ("Invalid symlink: %s", buf);
- next_buf[len] = '\0';
- buf = next_buf;
- buf_index = 1 - buf_index;
- next_buf = bufs[buf_index];
- } else
- break;
- }
-
- if (*cwd && chdir(cwd))
- die ("Could not change back to '%s'", cwd);
-
+ static char buf[PATH_MAX + 1];
+ int baselen;
+ if (!base)
+ return abs;
+ baselen = strlen(base);
+ if (prefixcmp(abs, base))
+ return abs;
+ if (abs[baselen] == '/')
+ baselen++;
+ else if (base[baselen - 1] != '/')
+ return abs;
+ strcpy(buf, abs + baselen);
return buf;
}
diff --git a/quote.c b/quote.c
index d5cf9d8f94..6a520855d6 100644
--- a/quote.c
+++ b/quote.c
@@ -1,6 +1,8 @@
#include "cache.h"
#include "quote.h"
+int quote_path_fully = 1;
+
/* Help to copy the thing properly quoted for the shell safety.
* any single quote is replaced with '\'', any exclamation point
* is replaced with '\!', and the whole thing is enclosed in a
diff --git a/read-cache.c b/read-cache.c
index 8e5fbb6192..f83de8c415 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -138,6 +138,16 @@ static int ce_modified_check_fs(struct cache_entry *ce, struct stat *st)
return 0;
}
+static int is_empty_blob_sha1(const unsigned char *sha1)
+{
+ static const unsigned char empty_blob_sha1[20] = {
+ 0xe6,0x9d,0xe2,0x9b,0xb2,0xd1,0xd6,0x43,0x4b,0x8b,
+ 0x29,0xae,0x77,0x5a,0xd8,0xc2,0xe4,0x8c,0x53,0x91
+ };
+
+ return !hashcmp(sha1, empty_blob_sha1);
+}
+
static int ce_match_stat_basic(struct cache_entry *ce, struct stat *st)
{
unsigned int changed = 0;
@@ -193,6 +203,12 @@ static int ce_match_stat_basic(struct cache_entry *ce, struct stat *st)
if (ce->ce_size != (unsigned int) st->st_size)
changed |= DATA_CHANGED;
+ /* Racily smudged entry? */
+ if (!ce->ce_size) {
+ if (!is_empty_blob_sha1(ce->sha1))
+ changed |= DATA_CHANGED;
+ }
+
return changed;
}
diff --git a/setup.c b/setup.c
index 8bb7b10174..cc3fb380c1 100644
--- a/setup.c
+++ b/setup.c
@@ -308,9 +308,10 @@ void setup_work_tree(void)
work_tree = get_git_work_tree();
git_dir = get_git_dir();
if (!is_absolute_path(git_dir))
- set_git_dir(make_absolute_path(git_dir));
+ git_dir = make_absolute_path(git_dir);
if (!work_tree || chdir(work_tree))
die("This operation must be run in a work tree");
+ set_git_dir(make_relative_path(git_dir, work_tree));
initialized = 1;
}
diff --git a/sha1_file.c b/sha1_file.c
index 0a54eed761..2187e6caed 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -120,6 +120,15 @@ int safe_create_leading_directories(char *path)
return 0;
}
+int safe_create_leading_directories_const(const char *path)
+{
+ /* path points to cache entries, so xstrdup before messing with it */
+ char *buf = xstrdup(path);
+ int result = safe_create_leading_directories(buf);
+ free(buf);
+ return result;
+}
+
char *sha1_to_hex(const unsigned char *sha1)
{
static int bufno;
@@ -796,18 +805,28 @@ unsigned char* use_pack(struct packed_git *p,
return win->base + offset;
}
+static struct packed_git *alloc_packed_git(int extra)
+{
+ struct packed_git *p = xmalloc(sizeof(*p) + extra);
+ memset(p, 0, sizeof(*p));
+ p->pack_fd = -1;
+ return p;
+}
+
struct packed_git *add_packed_git(const char *path, int path_len, int local)
{
struct stat st;
- struct packed_git *p = xmalloc(sizeof(*p) + path_len + 2);
+ struct packed_git *p = alloc_packed_git(path_len + 2);
/*
* Make sure a corresponding .pack file exists and that
* the index looks sane.
*/
path_len -= strlen(".idx");
- if (path_len < 1)
+ if (path_len < 1) {
+ free(p);
return NULL;
+ }
memcpy(p->pack_name, path, path_len);
strcpy(p->pack_name + path_len, ".pack");
if (stat(p->pack_name, &st) || !S_ISREG(st.st_mode)) {
@@ -818,14 +837,7 @@ struct packed_git *add_packed_git(const char *path, int path_len, int local)
/* ok, it looks sane as far as we can check without
* actually mapping the pack file.
*/
- p->index_version = 0;
- p->index_data = NULL;
- p->index_size = 0;
- p->num_objects = 0;
p->pack_size = st.st_size;
- p->next = NULL;
- p->windows = NULL;
- p->pack_fd = -1;
p->pack_local = local;
p->mtime = st.st_mtime;
if (path_len < 40 || get_sha1_hex(path + path_len - 40, p->sha1))
@@ -837,19 +849,15 @@ struct packed_git *parse_pack_index(unsigned char *sha1)
{
const char *idx_path = sha1_pack_index_name(sha1);
const char *path = sha1_pack_name(sha1);
- struct packed_git *p = xmalloc(sizeof(*p) + strlen(path) + 2);
+ struct packed_git *p = alloc_packed_git(strlen(path) + 1);
+ strcpy(p->pack_name, path);
+ hashcpy(p->sha1, sha1);
if (check_packed_git_idx(idx_path, p)) {
free(p);
return NULL;
}
- strcpy(p->pack_name, path);
- p->pack_size = 0;
- p->next = NULL;
- p->windows = NULL;
- p->pack_fd = -1;
- hashcpy(p->sha1, sha1);
return p;
}
@@ -986,6 +994,18 @@ void reprepare_packed_git(void)
prepare_packed_git();
}
+static void mark_bad_packed_object(struct packed_git *p,
+ const unsigned char *sha1)
+{
+ unsigned i;
+ for (i = 0; i < p->num_bad_objects; i++)
+ if (!hashcmp(sha1, p->bad_object_sha1 + 20 * i))
+ return;
+ p->bad_object_sha1 = xrealloc(p->bad_object_sha1, 20 * (p->num_bad_objects + 1));
+ hashcpy(p->bad_object_sha1 + 20 * p->num_bad_objects, sha1);
+ p->num_bad_objects++;
+}
+
int check_sha1_signature(const unsigned char *sha1, void *map, unsigned long size, const char *type)
{
unsigned char real_sha1[20];
@@ -1304,20 +1324,17 @@ static off_t get_delta_base(struct packed_git *p,
while (c & 128) {
base_offset += 1;
if (!base_offset || MSB(base_offset, 7))
- die("offset value overflow for delta base object");
+ return 0; /* overflow */
c = base_info[used++];
base_offset = (base_offset << 7) + (c & 127);
}
base_offset = delta_obj_offset - base_offset;
if (base_offset >= delta_obj_offset)
- die("delta base offset out of bound");
+ return 0; /* out of bound */
*curpos += used;
} else if (type == OBJ_REF_DELTA) {
/* The base entry _must_ be in the same pack */
base_offset = find_pack_entry_one(base_info, p);
- if (!base_offset)
- die("failed to find delta-pack base object %s",
- sha1_to_hex(base_info));
*curpos += 20;
} else
die("I am totally screwed");
@@ -1410,6 +1427,9 @@ const char *packed_object_info_detail(struct packed_git *p,
return typename(type);
case OBJ_OFS_DELTA:
obj_offset = get_delta_base(p, &w_curs, &curpos, type, obj_offset);
+ if (!obj_offset)
+ die("pack %s contains bad delta base reference of type %s",
+ p->pack_name, typename(type));
if (*delta_chain_length == 0) {
revidx = find_pack_revindex(p, obj_offset);
hashcpy(base_sha1, nth_packed_object_sha1(p, revidx->nr));
@@ -1604,17 +1624,41 @@ static void *unpack_delta_entry(struct packed_git *p,
off_t base_offset;
base_offset = get_delta_base(p, w_curs, &curpos, *type, obj_offset);
+ if (!base_offset) {
+ error("failed to validate delta base reference "
+ "at offset %"PRIuMAX" from %s",
+ (uintmax_t)curpos, p->pack_name);
+ return NULL;
+ }
base = cache_or_unpack_entry(p, base_offset, &base_size, type, 0);
- if (!base)
- die("failed to read delta base object"
- " at %"PRIuMAX" from %s",
- (uintmax_t)base_offset, p->pack_name);
+ if (!base) {
+ /*
+ * We're probably in deep shit, but let's try to fetch
+ * the required base anyway from another pack or loose.
+ * This is costly but should happen only in the presence
+ * of a corrupted pack, and is better than failing outright.
+ */
+ struct revindex_entry *revidx = find_pack_revindex(p, base_offset);
+ const unsigned char *base_sha1 =
+ nth_packed_object_sha1(p, revidx->nr);
+ error("failed to read delta base object %s"
+ " at offset %"PRIuMAX" from %s",
+ sha1_to_hex(base_sha1), (uintmax_t)base_offset,
+ p->pack_name);
+ mark_bad_packed_object(p, base_sha1);
+ base = read_sha1_file(base_sha1, type, &base_size);
+ if (!base)
+ return NULL;
+ }
delta_data = unpack_compressed_entry(p, w_curs, curpos, delta_size);
- if (!delta_data)
- die("failed to unpack compressed delta"
- " at %"PRIuMAX" from %s",
- (uintmax_t)curpos, p->pack_name);
+ if (!delta_data) {
+ error("failed to unpack compressed delta "
+ "at offset %"PRIuMAX" from %s",
+ (uintmax_t)curpos, p->pack_name);
+ free(base);
+ return NULL;
+ }
result = patch_delta(base, base_size,
delta_data, delta_size,
sizep);
@@ -1646,7 +1690,9 @@ void *unpack_entry(struct packed_git *p, off_t obj_offset,
data = unpack_compressed_entry(p, &w_curs, curpos, *sizep);
break;
default:
- die("unknown object type %i in %s", *type, p->pack_name);
+ data = NULL;
+ error("unknown object type %i at offset %"PRIuMAX" in %s",
+ *type, (uintmax_t)obj_offset, p->pack_name);
}
unuse_pack(&w_curs);
return data;
@@ -1672,7 +1718,7 @@ const unsigned char *nth_packed_object_sha1(struct packed_git *p,
}
}
-static off_t nth_packed_object_offset(const struct packed_git *p, uint32_t n)
+off_t nth_packed_object_offset(const struct packed_git *p, uint32_t n)
{
const unsigned char *index = p->index_data;
index += 4 * 256;
@@ -1792,6 +1838,13 @@ static int find_pack_entry(const unsigned char *sha1, struct pack_entry *e, cons
goto next;
}
+ if (p->num_bad_objects) {
+ unsigned i;
+ for (i = 0; i < p->num_bad_objects; i++)
+ if (!hashcmp(sha1, p->bad_object_sha1 + 20 * i))
+ goto next;
+ }
+
offset = find_pack_entry_one(sha1, p);
if (offset) {
/*
@@ -1876,11 +1929,24 @@ static void *read_packed_sha1(const unsigned char *sha1,
enum object_type *type, unsigned long *size)
{
struct pack_entry e;
+ void *data;
if (!find_pack_entry(sha1, &e, NULL))
return NULL;
- else
- return cache_or_unpack_entry(e.p, e.offset, size, type, 1);
+ data = cache_or_unpack_entry(e.p, e.offset, size, type, 1);
+ if (!data) {
+ /*
+ * We're probably in deep shit, but let's try to fetch
+ * the required object anyway from another pack or loose.
+ * This should happen only in the presence of a corrupted
+ * pack, and is better than failing outright.
+ */
+ error("failed to read object %s at offset %"PRIuMAX" from %s",
+ sha1_to_hex(sha1), (uintmax_t)e.offset, e.p->pack_name);
+ mark_bad_packed_object(e.p, sha1);
+ data = read_sha1_file(sha1, type, size);
+ }
+ return data;
}
/*
@@ -2087,7 +2153,8 @@ int hash_sha1_file(const void *buf, unsigned long len, const char *type,
/* Finalize a file on disk, and close it. */
static void close_sha1_file(int fd)
{
- /* For safe-mode, we could fsync_or_die(fd, "sha1 file") here */
+ if (fsync_object_files)
+ fsync_or_die(fd, "sha1 file");
fchmod(fd, 0444);
if (close(fd) != 0)
die("unable to write sha1 file");
@@ -2122,6 +2189,7 @@ static int create_tmpfile(char *buffer, size_t bufsiz, const char *filename)
fd = mkstemp(buffer);
if (fd < 0 && dirlen) {
/* Make sure the directory exists */
+ memcpy(buffer, filename, dirlen);
buffer[dirlen-1] = 0;
if (mkdir(buffer, 0777) || adjust_shared_perm(buffer))
return -1;
diff --git a/shell.c b/shell.c
index 9826109d5b..91ca7de082 100644
--- a/shell.c
+++ b/shell.c
@@ -3,10 +3,19 @@
#include "exec_cmd.h"
#include "strbuf.h"
+/* Stubs for functions that make no sense for git-shell. These stubs
+ * are provided here to avoid linking in external redundant modules.
+ */
+void release_pack_memory(size_t need, int fd){}
+void trace_argv_printf(const char **argv, const char *fmt, ...){}
+void trace_printf(const char *fmt, ...){}
+
+
static int do_generic_cmd(const char *me, char *arg)
{
const char *my_argv[4];
+ setup_path(NULL);
if (!arg || !(arg = sq_dequote(arg)))
die("bad argument");
if (prefixcmp(me, "git-"))
@@ -29,7 +38,6 @@ static int do_cvs_cmd(const char *me, char *arg)
die("git-cvsserver only handles server: %s", arg);
setup_path(NULL);
-
return execv_git_cmd(cvsserver_argv);
}
@@ -49,15 +57,24 @@ int main(int argc, char **argv)
char *prog;
struct commands *cmd;
+ /*
+ * Special hack to pretend to be a CVS server
+ */
if (argc == 2 && !strcmp(argv[1], "cvs server"))
argv--;
- /* We want to see "-c cmd args", and nothing else */
+
+ /*
+ * We do not accept anything but "-c" followed by "cmd arg",
+ * where "cmd" is a very limited subset of git commands.
+ */
else if (argc != 3 || strcmp(argv[1], "-c"))
die("What do you think I am? A shell?");
prog = argv[2];
- argv += 2;
- argc -= 2;
+ if (!strncmp(prog, "git", 3) && isspace(prog[3]))
+ /* Accept "git foo" as if the caller said "git-foo". */
+ prog[3] = '-';
+
for (cmd = cmd_list ; cmd->name ; cmd++) {
int len = strlen(cmd->name);
char *arg;
diff --git a/t/.gitattributes b/t/.gitattributes
index ab6edbf19e..1b97c5465b 100644
--- a/t/.gitattributes
+++ b/t/.gitattributes
@@ -1,2 +1 @@
-t[0-9][0-9][0-9][0-9]-*.sh -whitespace
t[0-9][0-9][0-9][0-9]/* -whitespace
diff --git a/t/.gitignore b/t/.gitignore
index 11ffd910c1..b27e280083 100644
--- a/t/.gitignore
+++ b/t/.gitignore
@@ -1 +1,2 @@
/trash directory
+/test-results
diff --git a/t/Makefile b/t/Makefile
index c6a60ab165..a778865ae7 100644
--- a/t/Makefile
+++ b/t/Makefile
@@ -14,18 +14,24 @@ SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
T = $(wildcard t[0-9][0-9][0-9][0-9]-*.sh)
TSVN = $(wildcard t91[0-9][0-9]-*.sh)
-all: $(T) clean
+all: pre-clean $(T) aggregate-results clean
$(T):
@echo "*** $@ ***"; GIT_CONFIG=.git/config '$(SHELL_PATH_SQ)' $@ $(GIT_TEST_OPTS)
+pre-clean:
+ $(RM) -r test-results
+
clean:
- $(RM) -r 'trash directory'
+ $(RM) -r 'trash directory' test-results
+
+aggregate-results:
+ ./aggregate-results.sh test-results/t*-*
# we can test NO_OPTIMIZE_COMMITS independently of LC_ALL
full-svn-test:
$(MAKE) $(TSVN) GIT_SVN_NO_OPTIMIZE_COMMITS=1 LC_ALL=C
$(MAKE) $(TSVN) GIT_SVN_NO_OPTIMIZE_COMMITS=0 LC_ALL=en_US.UTF-8
-.PHONY: $(T) clean
+.PHONY: pre-clean $(T) aggregate-results clean
.NOTPARALLEL:
diff --git a/t/README b/t/README
index 70841a4645..8f12d48fe8 100644
--- a/t/README
+++ b/t/README
@@ -54,6 +54,38 @@ You can pass --verbose (or -v), --debug (or -d), and --immediate
This causes the test to immediately exit upon the first
failed test.
+--long-tests::
+ This causes additional long-running tests to be run (where
+ available), for more exhaustive testing.
+
+
+Skipping Tests
+--------------
+
+In some environments, certain tests have no way of succeeding
+due to platform limitation, such as lack of 'unzip' program, or
+filesystem that do not allow arbitrary sequence of non-NUL bytes
+as pathnames.
+
+You should be able to say something like
+
+ $ GIT_SKIP_TESTS=t9200.8 sh ./t9200-git-cvsexport-commit.sh
+
+and even:
+
+ $ GIT_SKIP_TESTS='t[0-4]??? t91?? t9200.8' make
+
+to omit such tests. The value of the environment variable is a
+SP separated list of patterns that tells which tests to skip,
+and either can match the "t[0-9]{4}" part to skip the whole
+test, or t[0-9]{4} followed by ".$number" to say which
+particular test to skip.
+
+Note that some tests in the existing test suite rely on previous
+test item, so you cannot arbitrarily disable one and expect the
+remainder of test to check what the test originally was intended
+to check.
+
Naming Tests
------------
diff --git a/t/aggregate-results.sh b/t/aggregate-results.sh
new file mode 100755
index 0000000000..52e88e3046
--- /dev/null
+++ b/t/aggregate-results.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+fixed=0
+success=0
+failed=0
+broken=0
+total=0
+
+for file
+do
+ while read type value
+ do
+ case $type in
+ '')
+ continue ;;
+ fixed)
+ fixed=$(($fixed + $value)) ;;
+ success)
+ success=$(($success + $value)) ;;
+ failed)
+ failed=$(($failed + $value)) ;;
+ broken)
+ broken=$(( $broken + $value)) ;;
+ total)
+ total=$(( $total + $value)) ;;
+ esac
+ done <"$file"
+done
+
+printf "%-8s%d\n" fixed $fixed
+printf "%-8s%d\n" success $success
+printf "%-8s%d\n" failed $failed
+printf "%-8s%d\n" broken $broken
+printf "%-8s%d\n" total $total
diff --git a/t/t0040-parse-options.sh b/t/t0040-parse-options.sh
index 9965cfa1dc..6309aed451 100755
--- a/t/t0040-parse-options.sh
+++ b/t/t0040-parse-options.sh
@@ -11,23 +11,35 @@ cat > expect.err << EOF
usage: test-parse-options <options>
-b, --boolean get a boolean
+ -4, --or4 bitwise-or boolean with ...0100
+
-i, --integer <n> get a integer
-j <n> get a integer, too
+ --set23 set integer to 23
+ -t <time> get timestamp of <time>
+ -L, --length <str> get length of <str>
-string options
+String options
-s, --string <string>
get a string
--string2 <str> get another string
--st <st> get another string (pervert ordering)
-o <str> get another string
+ --default-string set string to default
-magic arguments
+Magic arguments
--quux means --quux
+Standard options
+ --abbrev[=<n>] use <n> digits to display SHA-1s
+ -v, --verbose be verbose
+ -n, --dry-run dry run
+ -q, --quiet be quiet
+
EOF
test_expect_success 'test help' '
- ! test-parse-options -h > output 2> output.err &&
+ test_must_fail test-parse-options -h > output 2> output.err &&
test ! -s output &&
test_cmp expect.err output.err
'
@@ -36,21 +48,31 @@ cat > expect << EOF
boolean: 2
integer: 1729
string: 123
+abbrev: 7
+verbose: 2
+quiet: no
+dry run: yes
EOF
test_expect_success 'short options' '
- test-parse-options -s123 -b -i 1729 -b > output 2> output.err &&
+ test-parse-options -s123 -b -i 1729 -b -vv -n > output 2> output.err &&
test_cmp expect output &&
test ! -s output.err
'
+
cat > expect << EOF
boolean: 2
integer: 1729
string: 321
+abbrev: 10
+verbose: 2
+quiet: no
+dry run: no
EOF
test_expect_success 'long options' '
test-parse-options --boolean --integer 1729 --boolean --string2=321 \
+ --verbose --verbose --no-dry-run --abbrev=10 \
> output 2> output.err &&
test ! -s output.err &&
test_cmp expect output
@@ -60,6 +82,10 @@ cat > expect << EOF
boolean: 1
integer: 13
string: 123
+abbrev: 7
+verbose: 0
+quiet: no
+dry run: no
arg 00: a1
arg 01: b1
arg 02: --boolean
@@ -76,6 +102,10 @@ cat > expect << EOF
boolean: 0
integer: 2
string: (not set)
+abbrev: 7
+verbose: 0
+quiet: no
+dry run: no
EOF
test_expect_success 'unambiguously abbreviated option' '
@@ -99,6 +129,10 @@ cat > expect << EOF
boolean: 0
integer: 0
string: 123
+abbrev: 7
+verbose: 0
+quiet: no
+dry run: no
EOF
test_expect_success 'non ambiguous option (after two options it abbreviates)' '
@@ -107,20 +141,24 @@ test_expect_success 'non ambiguous option (after two options it abbreviates)' '
test_cmp expect output
'
-cat > expect.err << EOF
+cat > typo.err << EOF
error: did you mean \`--boolean\` (with two dashes ?)
EOF
test_expect_success 'detect possible typos' '
- ! test-parse-options -boolean > output 2> output.err &&
+ test_must_fail test-parse-options -boolean > output 2> output.err &&
test ! -s output &&
- test_cmp expect.err output.err
+ test_cmp typo.err output.err
'
cat > expect <<EOF
boolean: 0
integer: 0
string: (not set)
+abbrev: 7
+verbose: 0
+quiet: no
+dry run: no
arg 00: --quux
EOF
@@ -130,4 +168,68 @@ test_expect_success 'keep some options as arguments' '
test_cmp expect output
'
+cat > expect <<EOF
+boolean: 0
+integer: 1
+string: default
+abbrev: 7
+verbose: 0
+quiet: yes
+dry run: no
+arg 00: foo
+EOF
+
+test_expect_success 'OPT_DATE() and OPT_SET_PTR() work' '
+ test-parse-options -t "1970-01-01 00:00:01 +0000" --default-string \
+ foo -q > output 2> output.err &&
+ test ! -s output.err &&
+ test_cmp expect output
+'
+
+cat > expect <<EOF
+Callback: "four", 0
+boolean: 5
+integer: 4
+string: (not set)
+abbrev: 7
+verbose: 0
+quiet: no
+dry run: no
+EOF
+
+test_expect_success 'OPT_CALLBACK() and OPT_BIT() work' '
+ test-parse-options --length=four -b -4 > output 2> output.err &&
+ test ! -s output.err &&
+ test_cmp expect output
+'
+
+cat > expect <<EOF
+Callback: "not set", 1
+EOF
+
+test_expect_success 'OPT_CALLBACK() and callback errors work' '
+ test_must_fail test-parse-options --no-length > output 2> output.err &&
+ test_cmp expect output &&
+ test_cmp expect.err output.err
+'
+
+cat > expect <<EOF
+boolean: 1
+integer: 23
+string: (not set)
+abbrev: 7
+verbose: 0
+quiet: no
+dry run: no
+EOF
+
+test_expect_success 'OPT_BIT() and OPT_SET_INT() work' '
+ test-parse-options --set23 -bbbbb --no-or4 > output 2> output.err &&
+ test ! -s output.err &&
+ test_cmp expect output
+'
+
+# --or4
+# --no-or4
+
test_done
diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh
index b8b7ab4103..f387d46f1a 100755
--- a/t/t1400-update-ref.sh
+++ b/t/t1400-update-ref.sh
@@ -42,6 +42,14 @@ test_expect_success "delete $m" '
'
rm -f .git/$m
+test_expect_success "delete $m without oldvalue verification" "
+ git update-ref $m $A &&
+ test $A = \$(cat .git/$m) &&
+ git update-ref -d $m &&
+ ! test -f .git/$m
+"
+rm -f .git/$m
+
test_expect_success \
"fail to create $n" \
"touch .git/$n_dir
diff --git a/t/t1502-rev-parse-parseopt.sh b/t/t1502-rev-parse-parseopt.sh
index d24a47d114..997002d4c4 100755
--- a/t/t1502-rev-parse-parseopt.sh
+++ b/t/t1502-rev-parse-parseopt.sh
@@ -5,7 +5,7 @@ test_description='test git rev-parse --parseopt'
cat > expect.err <<EOF
usage: some-command [options] <args>...
-
+
some-command does foo and bar!
-h, --help show the help
@@ -13,7 +13,7 @@ usage: some-command [options] <args>...
--bar ... some cool option --bar with an argument
An option group Header
- -C [...] option C with an optional argument
+ -C[...] option C with an optional argument
Extras
--extra1 line above used to cause a segfault but no longer does
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index b9e3dbd242..1c80148dd5 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -96,6 +96,7 @@ chmod a+x fake-editor.sh
test_expect_success 'no changes are a nop' '
git rebase -i F &&
+ test "$(git symbolic-ref -q HEAD)" = "refs/heads/branch2" &&
test $(git rev-parse I) = $(git rev-parse HEAD)
'
@@ -104,14 +105,26 @@ test_expect_success 'test the [branch] option' '
git rm file6 &&
git commit -m "stop here" &&
git rebase -i F branch2 &&
+ test "$(git symbolic-ref -q HEAD)" = "refs/heads/branch2" &&
+ test $(git rev-parse I) = $(git rev-parse branch2) &&
test $(git rev-parse I) = $(git rev-parse HEAD)
'
+test_expect_success 'test --onto <branch>' '
+ git checkout -b test-onto branch2 &&
+ git rebase -i --onto branch1 F &&
+ test "$(git symbolic-ref -q HEAD)" = "refs/heads/test-onto" &&
+ test $(git rev-parse HEAD^) = $(git rev-parse branch1) &&
+ test $(git rev-parse I) = $(git rev-parse branch2)
+'
+
test_expect_success 'rebase on top of a non-conflicting commit' '
git checkout branch1 &&
git tag original-branch1 &&
git rebase -i branch2 &&
test file6 = $(git diff --name-only original-branch1) &&
+ test "$(git symbolic-ref -q HEAD)" = "refs/heads/branch1" &&
+ test $(git rev-parse I) = $(git rev-parse branch2) &&
test $(git rev-parse I) = $(git rev-parse HEAD~2)
'
@@ -144,9 +157,12 @@ EOF
test_expect_success 'stop on conflicting pick' '
git tag new-branch1 &&
- ! git rebase -i master &&
+ test_must_fail git rebase -i master &&
+ test "$(git rev-parse HEAD~3)" = "$(git rev-parse master)" &&
test_cmp expect .git/.dotest-merge/patch &&
test_cmp expect2 file1 &&
+ test "$(git-diff --name-status |
+ sed -n -e "/^U/s/^U[^a-z]*//p")" = file1 &&
test 4 = $(grep -v "^#" < .git/.dotest-merge/done | wc -l) &&
test 0 = $(grep -c "^[^#]" < .git/.dotest-merge/git-rebase-todo)
'
@@ -154,6 +170,7 @@ test_expect_success 'stop on conflicting pick' '
test_expect_success 'abort' '
git rebase --abort &&
test $(git rev-parse new-branch1) = $(git rev-parse HEAD) &&
+ test "$(git symbolic-ref -q HEAD)" = "refs/heads/branch1" &&
! test -d .git/.dotest-merge
'
@@ -213,7 +230,7 @@ test_expect_success 'preserve merges with -p' '
test_expect_success '--continue tries to commit' '
test_tick &&
- ! git rebase -i --onto new-branch1 HEAD^ &&
+ test_must_fail git rebase -i --onto new-branch1 HEAD^ &&
echo resolved > file1 &&
git add file1 &&
FAKE_COMMIT_MESSAGE="chouette!" git rebase --continue &&
@@ -224,7 +241,7 @@ test_expect_success '--continue tries to commit' '
test_expect_success 'verbose flag is heeded, even after --continue' '
git reset --hard HEAD@{1} &&
test_tick &&
- ! git rebase -v -i --onto new-branch1 HEAD^ &&
+ test_must_fail git rebase -v -i --onto new-branch1 HEAD^ &&
echo resolved > file1 &&
git add file1 &&
git rebase --continue > output &&
@@ -259,10 +276,14 @@ test_expect_success 'interrupted squash works as expected' '
git commit -m $n
done &&
one=$(git rev-parse HEAD~3) &&
- ! FAKE_LINES="1 squash 3 2" git rebase -i HEAD~3 &&
+ (
+ FAKE_LINES="1 squash 3 2" &&
+ export FAKE_LINES &&
+ test_must_fail git rebase -i HEAD~3
+ ) &&
(echo one; echo two; echo four) > conflict &&
git add conflict &&
- ! git rebase --continue &&
+ test_must_fail git rebase --continue &&
echo resolved > conflict &&
git add conflict &&
git rebase --continue &&
@@ -277,13 +298,17 @@ test_expect_success 'interrupted squash works as expected (case 2)' '
git commit -m $n
done &&
one=$(git rev-parse HEAD~3) &&
- ! FAKE_LINES="3 squash 1 2" git rebase -i HEAD~3 &&
+ (
+ FAKE_LINES="3 squash 1 2" &&
+ export FAKE_LINES &&
+ test_must_fail git rebase -i HEAD~3
+ ) &&
(echo one; echo four) > conflict &&
git add conflict &&
- ! git rebase --continue &&
+ test_must_fail git rebase --continue &&
(echo one; echo two; echo four) > conflict &&
git add conflict &&
- ! git rebase --continue &&
+ test_must_fail git rebase --continue &&
echo resolved > conflict &&
git add conflict &&
git rebase --continue &&
@@ -331,7 +356,7 @@ test_expect_success 'rebase a commit violating pre-commit' '
chmod a+x $PRE_COMMIT &&
echo "monde! " >> file1 &&
test_tick &&
- ! git commit -m doesnt-verify file1 &&
+ test_must_fail git commit -m doesnt-verify file1 &&
git commit -m doesnt-verify --no-verify file1 &&
test_tick &&
FAKE_LINES=2 git rebase -i HEAD~2
diff --git a/t/t3800-mktag.sh b/t/t3800-mktag.sh
index df1fd6f86f..c851db8ca9 100755
--- a/t/t3800-mktag.sh
+++ b/t/t3800-mktag.sh
@@ -241,11 +241,11 @@ check_verify_failure 'disallow spaces in tag email' \
############################################################
# 17. disallow missing tag timestamp
-cat >tag.sig <<EOF
+tr '_' ' ' >tag.sig <<EOF
object $head
type commit
tag mytag
-tagger T A Gger <tagger@example.com>
+tagger T A Gger <tagger@example.com>__
EOF
diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
index 2d3ee3b78c..54d99ed0c3 100755
--- a/t/t3903-stash.sh
+++ b/t/t3903-stash.sh
@@ -41,7 +41,7 @@ test_expect_success 'apply needs clean working directory' '
echo 4 > other-file &&
git add other-file &&
echo 5 > other-file &&
- test_must_fail git stash apply
+ test_must_fail git stash apply
'
test_expect_success 'apply stashed changes' '
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index 3583e68e92..7fe853c20d 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -98,7 +98,7 @@ test_expect_success 'extra headers' '
sed -e "/^$/q" patch2 > hdrs2 &&
grep "^To: R. E. Cipient <rcipient@example.com>$" hdrs2 &&
grep "^Cc: S. E. Cipient <scipient@example.com>$" hdrs2
-
+
'
test_expect_success 'extra headers without newlines' '
@@ -109,7 +109,7 @@ test_expect_success 'extra headers without newlines' '
sed -e "/^$/q" patch3 > hdrs3 &&
grep "^To: R. E. Cipient <rcipient@example.com>$" hdrs3 &&
grep "^Cc: S. E. Cipient <scipient@example.com>$" hdrs3
-
+
'
test_expect_success 'extra headers with multiple To:s' '
@@ -170,7 +170,7 @@ test_expect_success 'thread cover-letter' '
git checkout side &&
git format-patch --cover-letter --thread -o patches/ master &&
FIRST_MID=$(grep "Message-Id:" patches/0000-* | sed "s/^[^<]*\(<[^>]*>\).*$/\1/") &&
- for i in patches/0001-* patches/0002-* patches/0003-*
+ for i in patches/0001-* patches/0002-* patches/0003-*
do
grep "References: $FIRST_MID" $i &&
grep "In-Reply-To: $FIRST_MID" $i || break
diff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh
index ca0302f41b..0922c708f1 100755
--- a/t/t4015-diff-whitespace.sh
+++ b/t/t4015-diff-whitespace.sh
@@ -62,16 +62,16 @@ EOF
git update-index x
-cat << EOF > x
+tr '_' ' ' << EOF > x
whitespace at beginning
whitespace change
white space in the middle
-whitespace at end
+whitespace at end__
unchanged line
CR at end
EOF
-tr 'Q' '\015' << EOF > expect
+tr 'Q_' '\015 ' << EOF > expect
diff --git a/x b/x
index d99af23..8b32fb5 100644
--- a/x
@@ -84,7 +84,7 @@ index d99af23..8b32fb5 100644
+ whitespace at beginning
+whitespace change
+white space in the middle
-+whitespace at end
++whitespace at end__
unchanged line
-CR at endQ
+CR at end
@@ -335,4 +335,10 @@ test_expect_success 'line numbers in --check output are correct' '
'
+test_expect_success 'checkdiff detects trailing blank lines' '
+ echo "foo();" >x &&
+ echo "" >>x &&
+ git diff --check | grep "ends with blank"
+'
+
test_done
diff --git a/t/t4016-diff-quote.sh b/t/t4016-diff-quote.sh
index 0950250c9b..f07035ab7e 100755
--- a/t/t4016-diff-quote.sh
+++ b/t/t4016-diff-quote.sh
@@ -53,13 +53,13 @@ test_expect_success 'git diff --summary -M HEAD' '
'
cat >expect <<\EOF
- pathname.1 => "Rpathname\twith HT.0" | 0
- pathname.3 => "Rpathname\nwith LF.0" | 0
- "pathname\twith HT.3" => "Rpathname\nwith LF.1" | 0
- pathname.2 => Rpathname with SP.0 | 0
- "pathname\twith HT.2" => Rpathname with SP.1 | 0
- pathname.0 => Rpathname.0 | 0
- "pathname\twith HT.0" => Rpathname.1 | 0
+ pathname.1 => "Rpathname\twith HT.0" | 0
+ pathname.3 => "Rpathname\nwith LF.0" | 0
+ "pathname\twith HT.3" => "Rpathname\nwith LF.1" | 0
+ pathname.2 => Rpathname with SP.0 | 0
+ "pathname\twith HT.2" => Rpathname with SP.1 | 0
+ pathname.0 => Rpathname.0 | 0
+ "pathname\twith HT.0" => Rpathname.1 | 0
7 files changed, 0 insertions(+), 0 deletions(-)
EOF
test_expect_success 'git diff --stat -M HEAD' '
diff --git a/t/t4017-diff-retval.sh b/t/t4017-diff-retval.sh
index dc0b7126cc..60dd2014d5 100755
--- a/t/t4017-diff-retval.sh
+++ b/t/t4017-diff-retval.sh
@@ -105,4 +105,26 @@ test_expect_success '--check with --no-pager returns 2 for dirty difference' '
'
+
+test_expect_success 'check should test not just the last line' '
+ echo "" >>a &&
+ git --no-pager diff --check
+ test $? = 2
+
+'
+
+test_expect_success 'check detects leftover conflict markers' '
+ git reset --hard &&
+ git checkout HEAD^ &&
+ echo binary >>b &&
+ git commit -m "side" b &&
+ test_must_fail git merge master &&
+ git add b && (
+ git --no-pager diff --cached --check >test.out
+ test $? = 2
+ ) &&
+ test 3 = $(grep "conflict marker" test.out | wc -l) &&
+ git reset --hard
+'
+
test_done
diff --git a/t/t4100-apply-stat.sh b/t/t4100-apply-stat.sh
index 8073a5a1f2..be837bb98d 100755
--- a/t/t4100-apply-stat.sh
+++ b/t/t4100-apply-stat.sh
@@ -3,44 +3,36 @@
# Copyright (c) 2005 Junio C Hamano
#
-test_description='git apply --stat --summary test.
+test_description='git apply --stat --summary test, with --recount
'
. ./test-lib.sh
-test_expect_success \
- 'rename' \
- 'git apply --stat --summary <../t4100/t-apply-1.patch >current &&
- test_cmp ../t4100/t-apply-1.expect current'
-
-test_expect_success \
- 'copy' \
- 'git apply --stat --summary <../t4100/t-apply-2.patch >current &&
- test_cmp ../t4100/t-apply-2.expect current'
-
-test_expect_success \
- 'rewrite' \
- 'git apply --stat --summary <../t4100/t-apply-3.patch >current &&
- test_cmp ../t4100/t-apply-3.expect current'
-
-test_expect_success \
- 'mode' \
- 'git apply --stat --summary <../t4100/t-apply-4.patch >current &&
- test_cmp ../t4100/t-apply-4.expect current'
-
-test_expect_success \
- 'non git' \
- 'git apply --stat --summary <../t4100/t-apply-5.patch >current &&
- test_cmp ../t4100/t-apply-5.expect current'
-
-test_expect_success \
- 'non git' \
- 'git apply --stat --summary <../t4100/t-apply-6.patch >current &&
- test_cmp ../t4100/t-apply-6.expect current'
-
-test_expect_success \
- 'non git' \
- 'git apply --stat --summary <../t4100/t-apply-7.patch >current &&
- test_cmp ../t4100/t-apply-7.expect current'
+UNC='s/^\(@@ -[1-9][0-9]*\),[0-9]* \(+[1-9][0-9]*\),[0-9]* @@/\1,999 \2,999 @@/'
+
+num=0
+while read title
+do
+ num=$(( $num + 1 ))
+ test_expect_success "$title" '
+ git apply --stat --summary \
+ <"$TEST_DIRECTORY/t4100/t-apply-$num.patch" >current &&
+ test_cmp ../t4100/t-apply-$num.expect current
+ '
+
+ test_expect_success "$title with recount" '
+ sed -e "$UNC" <"$TEST_DIRECTORY/t4100/t-apply-$num.patch" |
+ git apply --recount --stat --summary >current &&
+ test_cmp ../t4100/t-apply-$num.expect current
+ '
+done <<\EOF
+rename
+copy
+rewrite
+mode
+non git (1)
+non git (2)
+non git (3)
+EOF
test_done
diff --git a/t/t4109-apply-multifrag.sh b/t/t4109-apply-multifrag.sh
index bd40a218cd..ff5fdf35f9 100755
--- a/t/t4109-apply-multifrag.sh
+++ b/t/t4109-apply-multifrag.sh
@@ -9,134 +9,10 @@ test_description='git apply test patches with multiple fragments.
'
. ./test-lib.sh
-# setup
-
-cat > patch1.patch <<\EOF
-diff --git a/main.c b/main.c
-new file mode 100644
---- /dev/null
-+++ b/main.c
-@@ -0,0 +1,23 @@
-+#include <stdio.h>
-+
-+int func(int num);
-+void print_int(int num);
-+
-+int main() {
-+ int i;
-+
-+ for (i = 0; i < 10; i++) {
-+ print_int(func(i));
-+ }
-+
-+ return 0;
-+}
-+
-+int func(int num) {
-+ return num * num;
-+}
-+
-+void print_int(int num) {
-+ printf("%d", num);
-+}
-+
-EOF
-cat > patch2.patch <<\EOF
-diff --git a/main.c b/main.c
---- a/main.c
-+++ b/main.c
-@@ -1,7 +1,9 @@
-+#include <stdlib.h>
- #include <stdio.h>
-
- int func(int num);
- void print_int(int num);
-+void print_ln();
-
- int main() {
- int i;
-@@ -10,6 +12,8 @@
- print_int(func(i));
- }
-
-+ print_ln();
-+
- return 0;
- }
-
-@@ -21,3 +25,7 @@
- printf("%d", num);
- }
-
-+void print_ln() {
-+ printf("\n");
-+}
-+
-EOF
-cat > patch3.patch <<\EOF
-diff --git a/main.c b/main.c
---- a/main.c
-+++ b/main.c
-@@ -1,9 +1,7 @@
--#include <stdlib.h>
- #include <stdio.h>
-
- int func(int num);
- void print_int(int num);
--void print_ln();
-
- int main() {
- int i;
-@@ -12,8 +10,6 @@
- print_int(func(i));
- }
-
-- print_ln();
--
- return 0;
- }
-
-@@ -25,7 +21,3 @@
- printf("%d", num);
- }
-
--void print_ln() {
-- printf("\n");
--}
--
-EOF
-cat > patch4.patch <<\EOF
-diff --git a/main.c b/main.c
---- a/main.c
-+++ b/main.c
-@@ -1,13 +1,14 @@
- #include <stdio.h>
-
- int func(int num);
--void print_int(int num);
-+int func2(int num);
-
- int main() {
- int i;
-
- for (i = 0; i < 10; i++) {
-- print_int(func(i));
-+ printf("%d", func(i));
-+ printf("%d", func3(i));
- }
-
- return 0;
-@@ -17,7 +18,7 @@
- return num * num;
- }
-
--void print_int(int num) {
-- printf("%d", num);
-+int func2(int num) {
-+ return num * num * num;
- }
-
-EOF
+cp ../t4109/patch1.patch .
+cp ../t4109/patch2.patch .
+cp ../t4109/patch3.patch .
+cp ../t4109/patch4.patch .
test_expect_success "S = git apply (1)" \
'git apply patch1.patch patch2.patch'
diff --git a/t/t4109/patch1.patch b/t/t4109/patch1.patch
new file mode 100644
index 0000000000..1d411fc3cc
--- /dev/null
+++ b/t/t4109/patch1.patch
@@ -0,0 +1,28 @@
+diff --git a/main.c b/main.c
+new file mode 100644
+--- /dev/null
++++ b/main.c
+@@ -0,0 +1,23 @@
++#include <stdio.h>
++
++int func(int num);
++void print_int(int num);
++
++int main() {
++ int i;
++
++ for (i = 0; i < 10; i++) {
++ print_int(func(i));
++ }
++
++ return 0;
++}
++
++int func(int num) {
++ return num * num;
++}
++
++void print_int(int num) {
++ printf("%d", num);
++}
++
diff --git a/t/t4109/patch2.patch b/t/t4109/patch2.patch
new file mode 100644
index 0000000000..8c6b06d536
--- /dev/null
+++ b/t/t4109/patch2.patch
@@ -0,0 +1,30 @@
+diff --git a/main.c b/main.c
+--- a/main.c
++++ b/main.c
+@@ -1,7 +1,9 @@
++#include <stdlib.h>
+ #include <stdio.h>
+
+ int func(int num);
+ void print_int(int num);
++void print_ln();
+
+ int main() {
+ int i;
+@@ -10,6 +12,8 @@
+ print_int(func(i));
+ }
+
++ print_ln();
++
+ return 0;
+ }
+
+@@ -21,3 +25,7 @@
+ printf("%d", num);
+ }
+
++void print_ln() {
++ printf("\n");
++}
++
diff --git a/t/t4109/patch3.patch b/t/t4109/patch3.patch
new file mode 100644
index 0000000000..d696c55a75
--- /dev/null
+++ b/t/t4109/patch3.patch
@@ -0,0 +1,31 @@
+cat > patch3.patch <<\EOF
+diff --git a/main.c b/main.c
+--- a/main.c
++++ b/main.c
+@@ -1,9 +1,7 @@
+-#include <stdlib.h>
+ #include <stdio.h>
+
+ int func(int num);
+ void print_int(int num);
+-void print_ln();
+
+ int main() {
+ int i;
+@@ -12,8 +10,6 @@
+ print_int(func(i));
+ }
+
+- print_ln();
+-
+ return 0;
+ }
+
+@@ -25,7 +21,3 @@
+ printf("%d", num);
+ }
+
+-void print_ln() {
+- printf("\n");
+-}
+-
diff --git a/t/t4109/patch4.patch b/t/t4109/patch4.patch
new file mode 100644
index 0000000000..4b085909b1
--- /dev/null
+++ b/t/t4109/patch4.patch
@@ -0,0 +1,30 @@
+diff --git a/main.c b/main.c
+--- a/main.c
++++ b/main.c
+@@ -1,13 +1,14 @@
+ #include <stdio.h>
+
+ int func(int num);
+-void print_int(int num);
++int func2(int num);
+
+ int main() {
+ int i;
+
+ for (i = 0; i < 10; i++) {
+- print_int(func(i));
++ printf("%d", func(i));
++ printf("%d", func3(i));
+ }
+
+ return 0;
+@@ -17,7 +18,7 @@
+ return num * num;
+ }
+
+-void print_int(int num) {
+- printf("%d", num);
++int func2(int num) {
++ return num * num * num;
+ }
+
diff --git a/t/t4119-apply-config.sh b/t/t4119-apply-config.sh
index b540f7295a..3c73a783a7 100755
--- a/t/t4119-apply-config.sh
+++ b/t/t4119-apply-config.sh
@@ -19,12 +19,12 @@ test_expect_success setup '
'
# Also handcraft GNU diff output; note this has trailing whitespace.
-cat >gpatch.file <<\EOF &&
+tr '_' ' ' >gpatch.file <<\EOF &&
--- file1 2007-02-21 01:04:24.000000000 -0800
+++ file1+ 2007-02-21 01:07:44.000000000 -0800
@@ -1 +1 @@
-A
-+B
++B_
EOF
sed -e 's|file1|sub/&|' gpatch.file >gpatch-sub.file &&
diff --git a/t/t4127-apply-same-fn.sh b/t/t4127-apply-same-fn.sh
new file mode 100755
index 0000000000..2a6ed77c65
--- /dev/null
+++ b/t/t4127-apply-same-fn.sh
@@ -0,0 +1,85 @@
+#!/bin/sh
+
+test_description='apply same filename'
+
+. ./test-lib.sh
+
+test_expect_success setup '
+ for i in a b c d e f g h i j k l m
+ do
+ echo $i
+ done >same_fn &&
+ cp same_fn other_fn &&
+ git add same_fn other_fn &&
+ git commit -m initial
+'
+test_expect_success 'apply same filename with independent changes' '
+ sed -i -e "s/^d/z/" same_fn &&
+ git diff > patch0 &&
+ git add same_fn &&
+ sed -i -e "s/^i/y/" same_fn &&
+ git diff >> patch0 &&
+ cp same_fn same_fn2 &&
+ git reset --hard &&
+ git-apply patch0 &&
+ diff same_fn same_fn2
+'
+
+test_expect_success 'apply same filename with overlapping changes' '
+ git reset --hard
+ sed -i -e "s/^d/z/" same_fn &&
+ git diff > patch0 &&
+ git add same_fn &&
+ sed -i -e "s/^e/y/" same_fn &&
+ git diff >> patch0 &&
+ cp same_fn same_fn2 &&
+ git reset --hard &&
+ git-apply patch0 &&
+ diff same_fn same_fn2
+'
+
+test_expect_success 'apply same new filename after rename' '
+ git reset --hard
+ git mv same_fn new_fn
+ sed -i -e "s/^d/z/" new_fn &&
+ git add new_fn &&
+ git diff -M --cached > patch1 &&
+ sed -i -e "s/^e/y/" new_fn &&
+ git diff >> patch1 &&
+ cp new_fn new_fn2 &&
+ git reset --hard &&
+ git apply --index patch1 &&
+ diff new_fn new_fn2
+'
+
+test_expect_success 'apply same old filename after rename -- should fail.' '
+ git reset --hard
+ git mv same_fn new_fn
+ sed -i -e "s/^d/z/" new_fn &&
+ git add new_fn &&
+ git diff -M --cached > patch1 &&
+ git mv new_fn same_fn
+ sed -i -e "s/^e/y/" same_fn &&
+ git diff >> patch1 &&
+ git reset --hard &&
+ test_must_fail git apply patch1
+'
+
+test_expect_success 'apply A->B (rename), C->A (rename), A->A -- should pass.' '
+ git reset --hard
+ git mv same_fn new_fn
+ sed -i -e "s/^d/z/" new_fn &&
+ git add new_fn &&
+ git diff -M --cached > patch1 &&
+ git commit -m "a rename" &&
+ git mv other_fn same_fn
+ sed -i -e "s/^e/y/" same_fn &&
+ git add same_fn &&
+ git diff -M --cached >> patch1 &&
+ sed -i -e "s/^g/x/" same_fn &&
+ git diff >> patch1 &&
+ git reset --hard HEAD^ &&
+ git apply patch1
+'
+
+test_done
diff --git a/t/t4150-am.sh b/t/t4150-am.sh
index 722ae96cd5..bc982607d0 100755
--- a/t/t4150-am.sh
+++ b/t/t4150-am.sh
@@ -110,7 +110,7 @@ test_expect_success 'am applies patch correctly' '
GIT_AUTHOR_NAME="Another Thor"
GIT_AUTHOR_EMAIL="a.thor@example.com"
-GIT_COMMITTER_NAME="Co M Miter"
+GIT_COMMITTER_NAME="Co M Miter"
GIT_COMMITTER_EMAIL="c.miter@example.com"
export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL
diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh
index 9b0baac8db..3f1e25d921 100755
--- a/t/t5000-tar-tree.sh
+++ b/t/t5000-tar-tree.sh
@@ -45,6 +45,11 @@ test_expect_success \
(cd a && find .) | sort >a.lst'
test_expect_success \
+ 'add ignored file' \
+ 'echo ignore me >a/ignored &&
+ echo ignored export-ignore >.gitattributes'
+
+test_expect_success \
'add files to repository' \
'find a -type f | xargs git update-index --add &&
find a -type l | xargs git update-index --add &&
@@ -54,6 +59,10 @@ test_expect_success \
git commit-tree $treeid </dev/null)'
test_expect_success \
+ 'remove ignored file' \
+ 'rm a/ignored'
+
+test_expect_success \
'git archive' \
'git archive HEAD >b.tar'
diff --git a/t/t5302-pack-index.sh b/t/t5302-pack-index.sh
index 09fd917672..ecec591634 100755
--- a/t/t5302-pack-index.sh
+++ b/t/t5302-pack-index.sh
@@ -162,4 +162,18 @@ test_expect_success \
'[index v2] 5) pack-objects refuses to reuse corrupted data' \
'! git pack-objects test-5 <obj-list'
+test_expect_success \
+ '[index v2] 6) verify-pack detects CRC mismatch' \
+ 'rm -f .git/objects/pack/* &&
+ git-index-pack --index-version=2 --stdin < "test-1-${pack1}.pack" &&
+ git verify-pack ".git/objects/pack/pack-${pack1}.pack" &&
+ chmod +w ".git/objects/pack/pack-${pack1}.idx" &&
+ dd if=/dev/zero of=".git/objects/pack/pack-${pack1}.idx" conv=notrunc \
+ bs=1 count=4 seek=$((8 + 256 * 4 + `wc -l <obj-list` * 20 + 0)) &&
+ ( while read obj
+ do git cat-file -p $obj >/dev/null || exit 1
+ done <obj-list ) &&
+ err=$(! git verify-pack ".git/objects/pack/pack-${pack1}.pack" 2>&1) &&
+ echo "$err" | grep "CRC mismatch"'
+
test_done
diff --git a/t/t5303-pack-corruption-resilience.sh b/t/t5303-pack-corruption-resilience.sh
new file mode 100755
index 0000000000..31b20b21d2
--- /dev/null
+++ b/t/t5303-pack-corruption-resilience.sh
@@ -0,0 +1,194 @@
+#!/bin/sh
+#
+# Copyright (c) 2008 Nicolas Pitre
+#
+
+test_description='resilience to pack corruptions with redundant objects'
+. ./test-lib.sh
+
+# Note: the test objects are created with knowledge of their pack encoding
+# to ensure good code path coverage, and to facilitate direct alteration
+# later on. The assumed characteristics are:
+#
+# 1) blob_2 is a delta with blob_1 for base and blob_3 is a delta with blob2
+# for base, such that blob_3 delta depth is 2;
+#
+# 2) the bulk of object data is uncompressible so the text part remains
+# visible;
+#
+# 3) object header is always 2 bytes.
+
+create_test_files() {
+ test-genrandom "foo" 2000 > file_1 &&
+ test-genrandom "foo" 1800 > file_2 &&
+ test-genrandom "foo" 1800 > file_3 &&
+ echo " base " >> file_1 &&
+ echo " delta1 " >> file_2 &&
+ echo " delta delta2 " >> file_3 &&
+ test-genrandom "bar" 150 >> file_2 &&
+ test-genrandom "baz" 100 >> file_3
+}
+
+create_new_pack() {
+ rm -rf .git &&
+ git init &&
+ blob_1=`git hash-object -t blob -w file_1` &&
+ blob_2=`git hash-object -t blob -w file_2` &&
+ blob_3=`git hash-object -t blob -w file_3` &&
+ pack=`printf "$blob_1\n$blob_2\n$blob_3\n" |
+ git pack-objects $@ .git/objects/pack/pack` &&
+ pack=".git/objects/pack/pack-${pack}" &&
+ git verify-pack -v ${pack}.pack
+}
+
+do_corrupt_object() {
+ ofs=`git show-index < ${pack}.idx | grep $1 | cut -f1 -d" "` &&
+ ofs=$(($ofs + $2)) &&
+ chmod +w ${pack}.pack &&
+ dd if=/dev/zero of=${pack}.pack count=1 bs=1 conv=notrunc seek=$ofs &&
+ test_must_fail git verify-pack ${pack}.pack
+}
+
+test_expect_success \
+ 'initial setup validation' \
+ 'create_test_files &&
+ create_new_pack &&
+ git prune-packed &&
+ git cat-file blob $blob_1 > /dev/null &&
+ git cat-file blob $blob_2 > /dev/null &&
+ git cat-file blob $blob_3 > /dev/null'
+
+test_expect_success \
+ 'create corruption in header of first object' \
+ 'do_corrupt_object $blob_1 0 &&
+ test_must_fail git cat-file blob $blob_1 > /dev/null &&
+ test_must_fail git cat-file blob $blob_2 > /dev/null &&
+ test_must_fail git cat-file blob $blob_3 > /dev/null'
+
+test_expect_success \
+ '... but having a loose copy allows for full recovery' \
+ 'mv ${pack}.idx tmp &&
+ git hash-object -t blob -w file_1 &&
+ mv tmp ${pack}.idx &&
+ git cat-file blob $blob_1 > /dev/null &&
+ git cat-file blob $blob_2 > /dev/null &&
+ git cat-file blob $blob_3 > /dev/null'
+
+test_expect_success \
+ '... and loose copy of first delta allows for partial recovery' \
+ 'git prune-packed &&
+ test_must_fail git cat-file blob $blob_2 > /dev/null &&
+ mv ${pack}.idx tmp &&
+ git hash-object -t blob -w file_2 &&
+ mv tmp ${pack}.idx &&
+ test_must_fail git cat-file blob $blob_1 > /dev/null &&
+ git cat-file blob $blob_2 > /dev/null &&
+ git cat-file blob $blob_3 > /dev/null'
+
+test_expect_success \
+ 'create corruption in data of first object' \
+ 'create_new_pack &&
+ git prune-packed &&
+ chmod +w ${pack}.pack &&
+ perl -i.bak -pe "s/ base /abcdef/" ${pack}.pack &&
+ test_must_fail git cat-file blob $blob_1 > /dev/null &&
+ test_must_fail git cat-file blob $blob_2 > /dev/null &&
+ test_must_fail git cat-file blob $blob_3 > /dev/null'
+
+test_expect_success \
+ '... but having a loose copy allows for full recovery' \
+ 'mv ${pack}.idx tmp &&
+ git hash-object -t blob -w file_1 &&
+ mv tmp ${pack}.idx &&
+ git cat-file blob $blob_1 > /dev/null &&
+ git cat-file blob $blob_2 > /dev/null &&
+ git cat-file blob $blob_3 > /dev/null'
+
+test_expect_success \
+ '... and loose copy of second object allows for partial recovery' \
+ 'git prune-packed &&
+ test_must_fail git cat-file blob $blob_2 > /dev/null &&
+ mv ${pack}.idx tmp &&
+ git hash-object -t blob -w file_2 &&
+ mv tmp ${pack}.idx &&
+ test_must_fail git cat-file blob $blob_1 > /dev/null &&
+ git cat-file blob $blob_2 > /dev/null &&
+ git cat-file blob $blob_3 > /dev/null'
+
+test_expect_success \
+ 'create corruption in header of first delta' \
+ 'create_new_pack &&
+ git prune-packed &&
+ do_corrupt_object $blob_2 0 &&
+ git cat-file blob $blob_1 > /dev/null &&
+ test_must_fail git cat-file blob $blob_2 > /dev/null &&
+ test_must_fail git cat-file blob $blob_3 > /dev/null'
+
+test_expect_success \
+ '... but having a loose copy allows for full recovery' \
+ 'mv ${pack}.idx tmp &&
+ git hash-object -t blob -w file_2 &&
+ mv tmp ${pack}.idx &&
+ git cat-file blob $blob_1 > /dev/null &&
+ git cat-file blob $blob_2 > /dev/null &&
+ git cat-file blob $blob_3 > /dev/null'
+
+test_expect_success \
+ 'create corruption in data of first delta' \
+ 'create_new_pack &&
+ git prune-packed &&
+ chmod +w ${pack}.pack &&
+ perl -i.bak -pe "s/ delta1 /abcdefgh/" ${pack}.pack &&
+ git cat-file blob $blob_1 > /dev/null &&
+ test_must_fail git cat-file blob $blob_2 > /dev/null &&
+ test_must_fail git cat-file blob $blob_3 > /dev/null'
+
+test_expect_success \
+ '... but having a loose copy allows for full recovery' \
+ 'mv ${pack}.idx tmp &&
+ git hash-object -t blob -w file_2 &&
+ mv tmp ${pack}.idx &&
+ git cat-file blob $blob_1 > /dev/null &&
+ git cat-file blob $blob_2 > /dev/null &&
+ git cat-file blob $blob_3 > /dev/null'
+
+test_expect_success \
+ 'corruption in delta base reference of first delta (OBJ_REF_DELTA)' \
+ 'create_new_pack &&
+ git prune-packed &&
+ do_corrupt_object $blob_2 2 &&
+ git cat-file blob $blob_1 > /dev/null &&
+ test_must_fail git cat-file blob $blob_2 > /dev/null &&
+ test_must_fail git cat-file blob $blob_3 > /dev/null'
+
+test_expect_success \
+ '... but having a loose copy allows for full recovery' \
+ 'mv ${pack}.idx tmp &&
+ git hash-object -t blob -w file_2 &&
+ mv tmp ${pack}.idx &&
+ git cat-file blob $blob_1 > /dev/null &&
+ git cat-file blob $blob_2 > /dev/null &&
+ git cat-file blob $blob_3 > /dev/null'
+
+test_expect_success \
+ 'corruption in delta base reference of first delta (OBJ_OFS_DELTA)' \
+ 'create_new_pack --delta-base-offset &&
+ git prune-packed &&
+ do_corrupt_object $blob_2 2 &&
+ git cat-file blob $blob_1 > /dev/null &&
+ test_must_fail git cat-file blob $blob_2 > /dev/null &&
+ test_must_fail git cat-file blob $blob_3 > /dev/null'
+
+test_expect_success \
+ '... and a redundant pack allows for full recovery too' \
+ 'mv ${pack}.idx tmp &&
+ git hash-object -t blob -w file_1 &&
+ git hash-object -t blob -w file_2 &&
+ printf "$blob_1\n$blob_2\n" | git pack-objects .git/objects/pack/pack &&
+ git prune-packed &&
+ mv tmp ${pack}.idx &&
+ git cat-file blob $blob_1 > /dev/null &&
+ git cat-file blob $blob_2 > /dev/null &&
+ git cat-file blob $blob_3 > /dev/null'
+
+test_done
diff --git a/t/t5515-fetch-merge-logic.sh b/t/t5515-fetch-merge-logic.sh
index 3def75eeb2..8becbc3f38 100755
--- a/t/t5515-fetch-merge-logic.sh
+++ b/t/t5515-fetch-merge-logic.sh
@@ -142,9 +142,12 @@ do
set x $cmd; shift
git symbolic-ref HEAD refs/heads/$1 ; shift
rm -f .git/FETCH_HEAD
- rm -f .git/refs/heads/*
- rm -f .git/refs/remotes/rem/*
- rm -f .git/refs/tags/*
+ git for-each-ref \
+ refs/heads refs/remotes/rem refs/tags |
+ while read val type refname
+ do
+ git update-ref -d "$refname" "$val"
+ done
git fetch "$@" >/dev/null
cat .git/FETCH_HEAD
} >"$actual_f" &&
diff --git a/t/t5540-http-push.sh b/t/t5540-http-push.sh
index 7372439164..f15dd03e4d 100755
--- a/t/t5540-http-push.sh
+++ b/t/t5540-http-push.sh
@@ -38,7 +38,7 @@ test_expect_success 'setup remote repository' '
cd - &&
mv test_repo.git $HTTPD_DOCUMENT_ROOT_PATH
'
-
+
test_expect_success 'clone remote repository' '
cd "$ROOT_PATH" &&
git clone $HTTPD_URL/test_repo.git test_repo_clone
diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh
index 593d1a3877..b642fb260b 100755
--- a/t/t5601-clone.sh
+++ b/t/t5601-clone.sh
@@ -30,4 +30,26 @@ test_expect_success 'clone checks out files' '
'
+test_expect_success 'clone respects GIT_WORK_TREE' '
+
+ GIT_WORK_TREE=worktree git clone src bare &&
+ test -f bare/config &&
+ test -f worktree/file
+
+'
+
+test_expect_success 'clone creates intermediate directories' '
+
+ git clone src long/path/to/dst &&
+ test -f long/path/to/dst/file
+
+'
+
+test_expect_success 'clone creates intermediate directories for bare repo' '
+
+ git clone --bare src long/path/to/bare/dst &&
+ test -f long/path/to/bare/dst/config
+
+'
+
test_done
diff --git a/t/t6120-describe.sh b/t/t6120-describe.sh
index c6be2597f7..2fb672c3b4 100755
--- a/t/t6120-describe.sh
+++ b/t/t6120-describe.sh
@@ -139,4 +139,6 @@ check_describe "test1-lightweight-*" --tags --match="test1-*"
check_describe "test2-lightweight-*" --tags --match="test2-*"
+check_describe "test2-lightweight-*" --long --tags --match="test2-*" HEAD^
+
test_done
diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh
index 91ea85d99b..a3c8941c72 100755
--- a/t/t6300-for-each-ref.sh
+++ b/t/t6300-for-each-ref.sh
@@ -26,25 +26,78 @@ test_expect_success 'Create sample commit with known timestamp' '
git tag -a -m "Tagging at $datestamp" testtag
'
-test_expect_success 'Check atom names are valid' '
- bad=
- for token in \
- refname objecttype objectsize objectname tree parent \
- numparent object type author authorname authoremail \
- authordate committer committername committeremail \
- committerdate tag tagger taggername taggeremail \
- taggerdate creator creatordate subject body contents
- do
- git for-each-ref --format="$token=%($token)" refs/heads || {
- bad=$token
- break
- }
- done
- test -z "$bad"
+test_atom() {
+ case "$1" in
+ head) ref=refs/heads/master ;;
+ tag) ref=refs/tags/testtag ;;
+ esac
+ printf '%s\n' "$3" >expected
+ test_expect_${4:-success} "basic atom: $1 $2" "
+ git for-each-ref --format='%($2)' $ref >actual &&
+ test_cmp expected actual
+ "
+}
+
+test_atom head refname refs/heads/master
+test_atom head objecttype commit
+test_atom head objectsize 171
+test_atom head objectname 67a36f10722846e891fbada1ba48ed035de75581
+test_atom head tree 0e51c00fcb93dffc755546f27593d511e1bdb46f
+test_atom head parent ''
+test_atom head numparent 0
+test_atom head object ''
+test_atom head type ''
+test_atom head author 'A U Thor <author@example.com> 1151939924 +0200'
+test_atom head authorname 'A U Thor'
+test_atom head authoremail '<author@example.com>'
+test_atom head authordate 'Mon Jul 3 17:18:44 2006 +0200'
+test_atom head committer 'C O Mitter <committer@example.com> 1151939923 +0200'
+test_atom head committername 'C O Mitter'
+test_atom head committeremail '<committer@example.com>'
+test_atom head committerdate 'Mon Jul 3 17:18:43 2006 +0200'
+test_atom head tag ''
+test_atom head tagger ''
+test_atom head taggername ''
+test_atom head taggeremail ''
+test_atom head taggerdate ''
+test_atom head creator 'C O Mitter <committer@example.com> 1151939923 +0200'
+test_atom head creatordate 'Mon Jul 3 17:18:43 2006 +0200'
+test_atom head subject 'Initial'
+test_atom head body ''
+test_atom head contents 'Initial
+'
+
+test_atom tag refname refs/tags/testtag
+test_atom tag objecttype tag
+test_atom tag objectsize 154
+test_atom tag objectname 98b46b1d36e5b07909de1b3886224e3e81e87322
+test_atom tag tree ''
+test_atom tag parent ''
+test_atom tag numparent ''
+test_atom tag object '67a36f10722846e891fbada1ba48ed035de75581'
+test_atom tag type 'commit'
+test_atom tag author ''
+test_atom tag authorname ''
+test_atom tag authoremail ''
+test_atom tag authordate ''
+test_atom tag committer ''
+test_atom tag committername ''
+test_atom tag committeremail ''
+test_atom tag committerdate ''
+test_atom tag tag 'testtag'
+test_atom tag tagger 'C O Mitter <committer@example.com> 1151939925 +0200'
+test_atom tag taggername 'C O Mitter'
+test_atom tag taggeremail '<committer@example.com>'
+test_atom tag taggerdate 'Mon Jul 3 17:18:45 2006 +0200'
+test_atom tag creator 'C O Mitter <committer@example.com> 1151939925 +0200'
+test_atom tag creatordate 'Mon Jul 3 17:18:45 2006 +0200'
+test_atom tag subject 'Tagging at 1151939927'
+test_atom tag body ''
+test_atom tag contents 'Tagging at 1151939927
'
test_expect_success 'Check invalid atoms names are errors' '
- ! git-for-each-ref --format="%(INVALID)" refs/heads
+ test_must_fail git-for-each-ref --format="%(INVALID)" refs/heads
'
test_expect_success 'Check format specifiers are ignored in naming date atoms' '
@@ -64,7 +117,7 @@ test_expect_success 'Check valid format specifiers for date fields' '
'
test_expect_success 'Check invalid format specifiers are errors' '
- ! git-for-each-ref --format="%(authordate:INVALID)" refs/heads
+ test_must_fail git-for-each-ref --format="%(authordate:INVALID)" refs/heads
'
cat >expected <<\EOF
diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh
index 39ba14148c..96d15083fb 100755
--- a/t/t7102-reset.sh
+++ b/t/t7102-reset.sh
@@ -428,4 +428,51 @@ test_expect_success '--mixed refreshes the index' '
test_cmp expect output
'
+test_expect_success 'disambiguation (1)' '
+
+ git reset --hard &&
+ >secondfile &&
+ git add secondfile &&
+ test_must_fail git reset secondfile &&
+ test -z "$(git diff --cached --name-only)" &&
+ test -f secondfile &&
+ test ! -s secondfile
+
+'
+
+test_expect_success 'disambiguation (2)' '
+
+ git reset --hard &&
+ >secondfile &&
+ git add secondfile &&
+ rm -f secondfile &&
+ test_must_fail git reset secondfile &&
+ test -n "$(git diff --cached --name-only -- secondfile)" &&
+ test ! -f secondfile
+
+'
+
+test_expect_success 'disambiguation (3)' '
+
+ git reset --hard &&
+ >secondfile &&
+ git add secondfile &&
+ rm -f secondfile &&
+ test_must_fail git reset HEAD secondfile &&
+ test -z "$(git diff --cached --name-only)" &&
+ test ! -f secondfile
+
+'
+
+test_expect_success 'disambiguation (4)' '
+
+ git reset --hard &&
+ >secondfile &&
+ git add secondfile &&
+ rm -f secondfile &&
+ test_must_fail git reset -- secondfile &&
+ test -z "$(git diff --cached --name-only)" &&
+ test ! -f secondfile
+'
+
test_done
diff --git a/t/t7502-commit.sh b/t/t7502-commit.sh
index ed871a6b4d..c25eff9e46 100755
--- a/t/t7502-commit.sh
+++ b/t/t7502-commit.sh
@@ -212,7 +212,11 @@ test_expect_success 'do not fire editor in the presence of conflicts' '
# Must fail due to conflict
test_must_fail git cherry-pick -n master &&
echo "editor not started" >.git/result &&
- test_must_fail GIT_EDITOR="$(pwd)/.git/FAKE_EDITOR" git commit &&
+ (
+ GIT_EDITOR="$(pwd)/.git/FAKE_EDITOR" &&
+ export GIT_EDITOR &&
+ test_must_fail git commit
+ ) &&
test "$(cat .git/result)" = "editor not started"
'
diff --git a/t/t7502-status.sh b/t/t7502-status.sh
index 80a438d4d9..38a48b57c7 100755
--- a/t/t7502-status.sh
+++ b/t/t7502-status.sh
@@ -67,6 +67,104 @@ test_expect_success 'status (2)' '
'
+cat >expect <<EOF
+# On branch master
+# Changes to be committed:
+# (use "git reset HEAD <file>..." to unstage)
+#
+# new file: dir2/added
+#
+# Changed but not updated:
+# (use "git add <file>..." to update what will be committed)
+#
+# modified: dir1/modified
+#
+# Untracked files not listed (use -u option to show untracked files)
+EOF
+test_expect_success 'status -uno' '
+ mkdir dir3 &&
+ : > dir3/untracked1 &&
+ : > dir3/untracked2 &&
+ git status -uno >output &&
+ test_cmp expect output
+'
+
+test_expect_success 'status (status.showUntrackedFiles no)' '
+ git config status.showuntrackedfiles no
+ git status >output &&
+ test_cmp expect output
+'
+
+cat >expect <<EOF
+# On branch master
+# Changes to be committed:
+# (use "git reset HEAD <file>..." to unstage)
+#
+# new file: dir2/added
+#
+# Changed but not updated:
+# (use "git add <file>..." to update what will be committed)
+#
+# modified: dir1/modified
+#
+# Untracked files:
+# (use "git add <file>..." to include in what will be committed)
+#
+# dir1/untracked
+# dir2/modified
+# dir2/untracked
+# dir3/
+# expect
+# output
+# untracked
+EOF
+test_expect_success 'status -unormal' '
+ git status -unormal >output &&
+ test_cmp expect output
+'
+
+test_expect_success 'status (status.showUntrackedFiles normal)' '
+ git config status.showuntrackedfiles normal
+ git status >output &&
+ test_cmp expect output
+'
+
+cat >expect <<EOF
+# On branch master
+# Changes to be committed:
+# (use "git reset HEAD <file>..." to unstage)
+#
+# new file: dir2/added
+#
+# Changed but not updated:
+# (use "git add <file>..." to update what will be committed)
+#
+# modified: dir1/modified
+#
+# Untracked files:
+# (use "git add <file>..." to include in what will be committed)
+#
+# dir1/untracked
+# dir2/modified
+# dir2/untracked
+# dir3/untracked1
+# dir3/untracked2
+# expect
+# output
+# untracked
+EOF
+test_expect_success 'status -uall' '
+ git status -uall >output &&
+ test_cmp expect output
+'
+test_expect_success 'status (status.showUntrackedFiles all)' '
+ git config status.showuntrackedfiles all
+ git status >output &&
+ rm -rf dir3 &&
+ git config --unset status.showuntrackedfiles &&
+ test_cmp expect output
+'
+
cat > expect << \EOF
# On branch master
# Changes to be committed:
diff --git a/t/t9106-git-svn-dcommit-clobber-series.sh b/t/t9106-git-svn-dcommit-clobber-series.sh
index a400dc7966..f8f4718c36 100755
--- a/t/t9106-git-svn-dcommit-clobber-series.sh
+++ b/t/t9106-git-svn-dcommit-clobber-series.sh
@@ -20,8 +20,8 @@ test_expect_success '(supposedly) non-conflicting change from SVN' '
test x"`sed -n -e 61p < file`" = x61 &&
svn co "$svnrepo" tmp &&
cd tmp &&
- perl -i -p -e "s/^58$/5588/" file &&
- perl -i -p -e "s/^61$/6611/" file &&
+ perl -i.bak -p -e "s/^58$/5588/" file &&
+ perl -i.bak -p -e "s/^61$/6611/" file &&
poke file &&
test x"`sed -n -e 58p < file`" = x5588 &&
test x"`sed -n -e 61p < file`" = x6611 &&
@@ -40,8 +40,8 @@ test_expect_success 'some unrelated changes to git' "
test_expect_success 'change file but in unrelated area' "
test x\"\`sed -n -e 4p < file\`\" = x4 &&
test x\"\`sed -n -e 7p < file\`\" = x7 &&
- perl -i -p -e 's/^4\$/4444/' file &&
- perl -i -p -e 's/^7\$/7777/' file &&
+ perl -i.bak -p -e 's/^4\$/4444/' file &&
+ perl -i.bak -p -e 's/^7\$/7777/' file &&
test x\"\`sed -n -e 4p < file\`\" = x4444 &&
test x\"\`sed -n -e 7p < file\`\" = x7777 &&
git commit -m '4 => 4444, 7 => 7777' file &&
diff --git a/t/t9123-git-svn-rebuild-with-rewriteroot.sh b/t/t9123-git-svn-rebuild-with-rewriteroot.sh
new file mode 100755
index 0000000000..c18878fad1
--- /dev/null
+++ b/t/t9123-git-svn-rebuild-with-rewriteroot.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+#
+# Copyright (c) 2008 Jan Krüger
+#
+
+test_description='git-svn respects rewriteRoot during rebuild'
+
+. ./lib-git-svn.sh
+
+mkdir import
+cd import
+ touch foo
+ svn import -m 'import for git-svn' . "$svnrepo" >/dev/null
+cd ..
+rm -rf import
+
+test_expect_success 'init, fetch and checkout repository' '
+ git svn init --rewrite-root=http://invalid.invalid/ "$svnrepo" &&
+ git svn fetch
+ git checkout -b mybranch remotes/git-svn
+ '
+
+test_expect_success 'remove rev_map' '
+ rm "$GIT_SVN_DIR"/.rev_map.*
+ '
+
+test_expect_success 'rebuild rev_map' '
+ git svn rebase >/dev/null
+ '
+
+test_done
+
diff --git a/t/t9301-fast-export.sh b/t/t9301-fast-export.sh
index f09bfb1117..f1bc5ceef0 100755
--- a/t/t9301-fast-export.sh
+++ b/t/t9301-fast-export.sh
@@ -78,6 +78,29 @@ test_expect_success 'iso-8859-1' '
git cat-file commit i18n | grep "Áéí óú")
'
+test_expect_success 'import/export-marks' '
+
+ git checkout -b marks master &&
+ git fast-export --export-marks=tmp-marks HEAD &&
+ test -s tmp-marks &&
+ test $(wc -l < tmp-marks) -eq 3 &&
+ test $(
+ git fast-export --import-marks=tmp-marks\
+ --export-marks=tmp-marks HEAD |
+ grep ^commit |
+ wc -l) \
+ -eq 0 &&
+ echo change > file &&
+ git commit -m "last commit" file &&
+ test $(
+ git fast-export --import-marks=tmp-marks \
+ --export-marks=tmp-marks HEAD |
+ grep ^commit\ |
+ wc -l) \
+ -eq 1 &&
+ test $(wc -l < tmp-marks) -eq 4
+
+'
cat > signed-tag-import << EOF
tag sign-your-name
diff --git a/t/t9700-perl-git.sh b/t/t9700-perl-git.sh
new file mode 100755
index 0000000000..9706ee5773
--- /dev/null
+++ b/t/t9700-perl-git.sh
@@ -0,0 +1,44 @@
+#!/bin/sh
+#
+# Copyright (c) 2008 Lea Wiemann
+#
+
+test_description='perl interface (Git.pm)'
+. ./test-lib.sh
+
+perl -MTest::More -e 0 2>/dev/null || {
+ say_color skip "Perl Test::More unavailable, skipping test"
+ test_done
+}
+
+# set up test repository
+
+test_expect_success \
+ 'set up test repository' \
+ 'echo "test file 1" > file1 &&
+ echo "test file 2" > file2 &&
+ mkdir directory1 &&
+ echo "in directory1" >> directory1/file &&
+ mkdir directory2 &&
+ echo "in directory2" >> directory2/file &&
+ git add . &&
+ git commit -m "first commit" &&
+
+ echo "changed file 1" > file1 &&
+ git commit -a -m "second commit" &&
+
+ git-config --add color.test.slot1 green &&
+ git-config --add test.string value &&
+ git-config --add test.dupstring value1 &&
+ git-config --add test.dupstring value2 &&
+ git-config --add test.booltrue true &&
+ git-config --add test.boolfalse no &&
+ git-config --add test.boolother other &&
+ git-config --add test.int 2k
+ '
+
+test_external_without_stderr \
+ 'Perl API' \
+ perl ../t9700/test.pl
+
+test_done
diff --git a/t/t9700/test.pl b/t/t9700/test.pl
new file mode 100755
index 0000000000..4d2312548a
--- /dev/null
+++ b/t/t9700/test.pl
@@ -0,0 +1,100 @@
+#!/usr/bin/perl
+use lib (split(/:/, $ENV{GITPERLLIB}));
+
+use 5.006002;
+use warnings;
+use strict;
+
+use Test::More qw(no_plan);
+
+use Cwd;
+use File::Basename;
+use File::Temp;
+
+BEGIN { use_ok('Git') }
+
+# set up
+our $repo_dir = "trash directory";
+our $abs_repo_dir = Cwd->cwd;
+die "this must be run by calling the t/t97* shell script(s)\n"
+ if basename(Cwd->cwd) ne $repo_dir;
+ok(our $r = Git->repository(Directory => "."), "open repository");
+
+# config
+is($r->config("test.string"), "value", "config scalar: string");
+is_deeply([$r->config("test.dupstring")], ["value1", "value2"],
+ "config array: string");
+is($r->config("test.nonexistent"), undef, "config scalar: nonexistent");
+is_deeply([$r->config("test.nonexistent")], [], "config array: nonexistent");
+is($r->config_int("test.int"), 2048, "config_int: integer");
+is($r->config_int("test.nonexistent"), undef, "config_int: nonexistent");
+ok($r->config_bool("test.booltrue"), "config_bool: true");
+ok(!$r->config_bool("test.boolfalse"), "config_bool: false");
+our $ansi_green = "\x1b[32m";
+is($r->get_color("color.test.slot1", "red"), $ansi_green, "get_color");
+# Cannot test $r->get_colorbool("color.foo")) because we do not
+# control whether our STDOUT is a terminal.
+
+# Failure cases for config:
+# Save and restore STDERR; we will probably extract this into a
+# "dies_ok" method and possibly move the STDERR handling to Git.pm.
+open our $tmpstderr, ">&", STDERR or die "cannot save STDERR"; close STDERR;
+eval { $r->config("test.dupstring") };
+ok($@, "config: duplicate entry in scalar context fails");
+eval { $r->config_bool("test.boolother") };
+ok($@, "config_bool: non-boolean values fail");
+open STDERR, ">&", $tmpstderr or die "cannot restore STDERR";
+
+# ident
+like($r->ident("aUthor"), qr/^A U Thor <author\@example.com> [0-9]+ \+0000$/,
+ "ident scalar: author (type)");
+like($r->ident("cOmmitter"), qr/^C O Mitter <committer\@example.com> [0-9]+ \+0000$/,
+ "ident scalar: committer (type)");
+is($r->ident("invalid"), "invalid", "ident scalar: invalid ident string (no parsing)");
+my ($name, $email, $time_tz) = $r->ident('author');
+is_deeply([$name, $email], ["A U Thor", "author\@example.com"],
+ "ident array: author");
+like($time_tz, qr/[0-9]+ \+0000/, "ident array: author");
+is_deeply([$r->ident("Name <email> 123 +0000")], ["Name", "email", "123 +0000"],
+ "ident array: ident string");
+is_deeply([$r->ident("invalid")], [], "ident array: invalid ident string");
+
+# ident_person
+is($r->ident_person("aUthor"), "A U Thor <author\@example.com>",
+ "ident_person: author (type)");
+is($r->ident_person("Name <email> 123 +0000"), "Name <email>",
+ "ident_person: ident string");
+is($r->ident_person("Name", "email", "123 +0000"), "Name <email>",
+ "ident_person: array");
+
+# objects and hashes
+ok(our $file1hash = $r->command_oneline('rev-parse', "HEAD:file1"), "(get file hash)");
+our $tmpfile = File::Temp->new;
+is($r->cat_blob($file1hash, $tmpfile), 15, "cat_blob: size");
+our $blobcontents;
+{ local $/; seek $tmpfile, 0, 0; $blobcontents = <$tmpfile>; }
+is($blobcontents, "changed file 1\n", "cat_blob: data");
+seek $tmpfile, 0, 0;
+is(Git::hash_object("blob", $tmpfile), $file1hash, "hash_object: roundtrip");
+$tmpfile = File::Temp->new();
+print $tmpfile my $test_text = "test blob, to be inserted\n";
+like(our $newhash = $r->hash_and_insert_object($tmpfile), qr/[0-9a-fA-F]{40}/,
+ "hash_and_insert_object: returns hash");
+$tmpfile = File::Temp->new;
+is($r->cat_blob($newhash, $tmpfile), length $test_text, "cat_blob: roundtrip size");
+{ local $/; seek $tmpfile, 0, 0; $blobcontents = <$tmpfile>; }
+is($blobcontents, $test_text, "cat_blob: roundtrip data");
+
+# paths
+is($r->repo_path, "./.git", "repo_path");
+is($r->wc_path, $abs_repo_dir . "/", "wc_path");
+is($r->wc_subdir, "", "wc_subdir initial");
+$r->wc_chdir("directory1");
+is($r->wc_subdir, "directory1", "wc_subdir after wc_chdir");
+TODO: {
+ local $TODO = "commands do not work after wc_chdir";
+ # Failure output is active even in non-verbose mode and thus
+ # annoying. Hence we skip these tests as long as they fail.
+ todo_skip 'config after wc_chdir', 1;
+ is($r->config("color.string"), "value", "config after wc_chdir");
+}
diff --git a/t/test-lib.sh b/t/test-lib.sh
index c861141667..c0c5e0e83b 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -80,6 +80,8 @@ do
debug=t; shift ;;
-i|--i|--im|--imm|--imme|--immed|--immedi|--immedia|--immediat|--immediate)
immediate=t; shift ;;
+ -l|--l|--lo|--lon|--long|--long-|--long-t|--long-te|--long-tes|--long-test|--long-tests)
+ export GIT_TEST_LONG=t; shift ;;
-h|--h|--he|--hel|--help)
help=t; shift ;;
-v|--v|--ve|--ver|--verb|--verbo|--verbos|--verbose)
@@ -152,6 +154,7 @@ test_failure=0
test_count=0
test_fixed=0
test_broken=0
+test_success=0
die () {
echo >&5 "FATAL: Unexpected exit with code $?"
@@ -193,6 +196,7 @@ test_tick () {
test_ok_ () {
test_count=$(expr "$test_count" + 1)
+ test_success=$(expr "$test_success" + 1)
say_color "" " ok $test_count: $@"
}
@@ -302,6 +306,64 @@ test_expect_code () {
echo >&3 ""
}
+# test_external runs external test scripts that provide continuous
+# test output about their progress, and succeeds/fails on
+# zero/non-zero exit code. It outputs the test output on stdout even
+# in non-verbose mode, and announces the external script with "* run
+# <n>: ..." before running it. When providing relative paths, keep in
+# mind that all scripts run in "trash directory".
+# Usage: test_external description command arguments...
+# Example: test_external 'Perl API' perl ../path/to/test.pl
+test_external () {
+ test "$#" -eq 3 ||
+ error >&5 "bug in the test script: not 3 parameters to test_external"
+ descr="$1"
+ shift
+ if ! test_skip "$descr" "$@"
+ then
+ # Announce the script to reduce confusion about the
+ # test output that follows.
+ say_color "" " run $(expr "$test_count" + 1): $descr ($*)"
+ # Run command; redirect its stderr to &4 as in
+ # test_run_, but keep its stdout on our stdout even in
+ # non-verbose mode.
+ "$@" 2>&4
+ if [ "$?" = 0 ]
+ then
+ test_ok_ "$descr"
+ else
+ test_failure_ "$descr" "$@"
+ fi
+ fi
+}
+
+# Like test_external, but in addition tests that the command generated
+# no output on stderr.
+test_external_without_stderr () {
+ # The temporary file has no (and must have no) security
+ # implications.
+ tmp="$TMPDIR"; if [ -z "$tmp" ]; then tmp=/tmp; fi
+ stderr="$tmp/git-external-stderr.$$.tmp"
+ test_external "$@" 4> "$stderr"
+ [ -f "$stderr" ] || error "Internal error: $stderr disappeared."
+ descr="no stderr: $1"
+ shift
+ say >&3 "expecting no stderr from previous command"
+ if [ ! -s "$stderr" ]; then
+ rm "$stderr"
+ test_ok_ "$descr"
+ else
+ if [ "$verbose" = t ]; then
+ output=`echo; echo Stderr is:; cat "$stderr"`
+ else
+ output=
+ fi
+ # rm first in case test_failure exits.
+ rm "$stderr"
+ test_failure_ "$descr" "$@" "$output"
+ fi
+}
+
# This is not among top-level (test_expect_success | test_expect_failure)
# but is a prefix that can be used in the test script, like:
#
@@ -345,7 +407,7 @@ test_create_repo () {
repo="$1"
mkdir "$repo"
cd "$repo" || error "Cannot setup test environment"
- "$GIT_EXEC_PATH/git" init "--template=$GIT_EXEC_PATH/templates/blt/" >/dev/null 2>&1 ||
+ "$GIT_EXEC_PATH/git" init "--template=$GIT_EXEC_PATH/templates/blt/" >&3 2>&4 ||
error "cannot run git init -- have you built things yet?"
mv .git/hooks .git/hooks-disabled
cd "$owd"
@@ -353,6 +415,16 @@ test_create_repo () {
test_done () {
trap - exit
+ test_results_dir="$TEST_DIRECTORY/test-results"
+ mkdir -p "$test_results_dir"
+ test_results_path="$test_results_dir/${0%-*}-$$"
+
+ echo "total $test_count" >> $test_results_path
+ echo "success $test_success" >> $test_results_path
+ echo "fixed $test_fixed" >> $test_results_path
+ echo "broken $test_broken" >> $test_results_path
+ echo "failed $test_failure" >> $test_results_path
+ echo "" >> $test_results_path
if test "$test_fixed" != 0
then
@@ -387,7 +459,8 @@ test_done () {
# Test the binaries we have just built. The tests are kept in
# t/ subdirectory and are run in 'trash directory' subdirectory.
-PATH=$(pwd)/..:$PATH
+TEST_DIRECTORY=$(pwd)
+PATH=$TEST_DIRECTORY/..:$PATH
GIT_EXEC_PATH=$(pwd)/..
GIT_TEMPLATE_DIR=$(pwd)/../templates/blt
unset GIT_CONFIG
diff --git a/templates/hooks--applypatch-msg b/templates/hooks--applypatch-msg.sample
index 02de1ef84c..8b2a2fe84f 100644..100755
--- a/templates/hooks--applypatch-msg
+++ b/templates/hooks--applypatch-msg.sample
@@ -7,7 +7,7 @@
# appropriate message if it wants to stop the commit. The hook is
# allowed to edit the commit message file.
#
-# To enable this hook, make this file executable.
+# To enable this hook, rename this file to "applypatch-msg".
. git-sh-setup
test -x "$GIT_DIR/hooks/commit-msg" &&
diff --git a/templates/hooks--commit-msg b/templates/hooks--commit-msg.sample
index 4ef86eb244..6ef1d29d09 100644..100755
--- a/templates/hooks--commit-msg
+++ b/templates/hooks--commit-msg.sample
@@ -6,7 +6,7 @@
# status after issuing an appropriate message if it wants to stop the
# commit. The hook is allowed to edit the commit message file.
#
-# To enable this hook, make this file executable.
+# To enable this hook, rename this file to "commit-msg".
# Uncomment the below to add a Signed-off-by line to the message.
# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
diff --git a/templates/hooks--post-commit b/templates/hooks--post-commit.sample
index 8be6f34ad9..22668216a3 100644..100755
--- a/templates/hooks--post-commit
+++ b/templates/hooks--post-commit.sample
@@ -3,6 +3,6 @@
# An example hook script that is called after a successful
# commit is made.
#
-# To enable this hook, make this file executable.
+# To enable this hook, rename this file to "post-commit".
: Nothing
diff --git a/templates/hooks--post-receive b/templates/hooks--post-receive
deleted file mode 100644
index b70c8fd364..0000000000
--- a/templates/hooks--post-receive
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/sh
-#
-# An example hook script for the post-receive event
-#
-# This script is run after receive-pack has accepted a pack and the
-# repository has been updated. It is passed arguments in through stdin
-# in the form
-# <oldrev> <newrev> <refname>
-# For example:
-# aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master
-#
-# see contrib/hooks/ for an sample, or uncomment the next line (on debian)
-#
-
-
-#. /usr/share/doc/git-core/contrib/hooks/post-receive-email
diff --git a/templates/hooks--post-receive.sample b/templates/hooks--post-receive.sample
new file mode 100755
index 0000000000..18d2e0f727
--- /dev/null
+++ b/templates/hooks--post-receive.sample
@@ -0,0 +1,15 @@
+#!/bin/sh
+#
+# An example hook script for the "post-receive" event.
+#
+# The "post-receive" script is run after receive-pack has accepted a pack
+# and the repository has been updated. It is passed arguments in through
+# stdin in the form
+# <oldrev> <newrev> <refname>
+# For example:
+# aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master
+#
+# see contrib/hooks/ for an sample, or uncomment the next line and
+# rename the file to "post-receive".
+
+#. /usr/share/doc/git-core/contrib/hooks/post-receive-email
diff --git a/templates/hooks--post-update b/templates/hooks--post-update.sample
index bcba8937bb..5323b56b81 100644..100755
--- a/templates/hooks--post-update
+++ b/templates/hooks--post-update.sample
@@ -3,6 +3,6 @@
# An example hook script to prepare a packed repository for use over
# dumb transports.
#
-# To enable this hook, make this file executable by "chmod +x post-update".
+# To enable this hook, rename this file to "post-update".
exec git-update-server-info
diff --git a/templates/hooks--pre-applypatch b/templates/hooks--pre-applypatch.sample
index eeccc934ca..b1f187c2e9 100644..100755
--- a/templates/hooks--pre-applypatch
+++ b/templates/hooks--pre-applypatch.sample
@@ -6,7 +6,7 @@
# The hook should exit with non-zero status after issuing an
# appropriate message if it wants to stop the commit.
#
-# To enable this hook, make this file executable.
+# To enable this hook, rename this file to "pre-applypatch".
. git-sh-setup
test -x "$GIT_DIR/hooks/pre-commit" &&
diff --git a/templates/hooks--pre-commit b/templates/hooks--pre-commit
deleted file mode 100644
index b25dce6bbf..0000000000
--- a/templates/hooks--pre-commit
+++ /dev/null
@@ -1,70 +0,0 @@
-#!/bin/sh
-#
-# An example hook script to verify what is about to be committed.
-# Called by git-commit with no arguments. The hook should
-# exit with non-zero status after issuing an appropriate message if
-# it wants to stop the commit.
-#
-# To enable this hook, make this file executable.
-
-# This is slightly modified from Andrew Morton's Perfect Patch.
-# Lines you introduce should not have trailing whitespace.
-# Also check for an indentation that has SP before a TAB.
-
-if git-rev-parse --verify HEAD 2>/dev/null
-then
- git-diff-index -p -M --cached HEAD --
-else
- # NEEDSWORK: we should produce a diff with an empty tree here
- # if we want to do the same verification for the initial import.
- :
-fi |
-perl -e '
- my $found_bad = 0;
- my $filename;
- my $reported_filename = "";
- my $lineno;
- sub bad_line {
- my ($why, $line) = @_;
- if (!$found_bad) {
- print STDERR "*\n";
- print STDERR "* You have some suspicious patch lines:\n";
- print STDERR "*\n";
- $found_bad = 1;
- }
- if ($reported_filename ne $filename) {
- print STDERR "* In $filename\n";
- $reported_filename = $filename;
- }
- print STDERR "* $why (line $lineno)\n";
- print STDERR "$filename:$lineno:$line\n";
- }
- while (<>) {
- if (m|^diff --git a/(.*) b/\1$|) {
- $filename = $1;
- next;
- }
- if (/^@@ -\S+ \+(\d+)/) {
- $lineno = $1 - 1;
- next;
- }
- if (/^ /) {
- $lineno++;
- next;
- }
- if (s/^\+//) {
- $lineno++;
- chomp;
- if (/\s$/) {
- bad_line("trailing whitespace", $_);
- }
- if (/^\s* \t/) {
- bad_line("indent SP followed by a TAB", $_);
- }
- if (/^([<>])\1{6} |^={7}$/) {
- bad_line("unresolved merge conflict", $_);
- }
- }
- }
- exit($found_bad);
-'
diff --git a/templates/hooks--pre-commit.sample b/templates/hooks--pre-commit.sample
new file mode 100755
index 0000000000..0e49279c7f
--- /dev/null
+++ b/templates/hooks--pre-commit.sample
@@ -0,0 +1,18 @@
+#!/bin/sh
+#
+# An example hook script to verify what is about to be committed.
+# Called by git-commit with no arguments. The hook should
+# exit with non-zero status after issuing an appropriate message if
+# it wants to stop the commit.
+#
+# To enable this hook, rename this file to "pre-commit".
+
+if git-rev-parse --verify HEAD 2>/dev/null
+then
+ against=HEAD
+else
+ # Initial commit: diff against an empty tree object
+ against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
+fi
+
+exec git diff-index --check --cached $against --
diff --git a/templates/hooks--pre-rebase b/templates/hooks--pre-rebase.sample
index 981c454cda..be1b06e250 100644..100755
--- a/templates/hooks--pre-rebase
+++ b/templates/hooks--pre-rebase.sample
@@ -1,7 +1,19 @@
#!/bin/sh
#
-# Copyright (c) 2006 Junio C Hamano
+# Copyright (c) 2006, 2008 Junio C Hamano
#
+# The "pre-rebase" hook is run just before "git-rebase" starts doing
+# its job, and can prevent the command from running by exiting with
+# non-zero status.
+#
+# The hook is called with the following parameters:
+#
+# $1 -- the upstream the series was forked from.
+# $2 -- the branch being rebased (or empty when rebasing the current branch).
+#
+# This sample shows how to prevent topic branches that are already
+# merged to 'next' branch from getting rebased, because allowing it
+# would result in rebasing already published history.
publish=next
basebranch="$1"
@@ -9,11 +21,12 @@ if test "$#" = 2
then
topic="refs/heads/$2"
else
- topic=`git symbolic-ref HEAD`
+ topic=`git symbolic-ref HEAD` ||
+ exit 0 ;# we do not interrupt rebasing detached HEAD
fi
-case "$basebranch,$topic" in
-master,refs/heads/??/*)
+case "$topic" in
+refs/heads/??/*)
;;
*)
exit 0 ;# we do not interrupt others.
@@ -23,6 +36,12 @@ esac
# Now we are dealing with a topic branch being rebased
# on top of master. Is it OK to rebase it?
+# Does the topic really exist?
+git show-ref -q "$topic" || {
+ echo >&2 "No such branch $topic"
+ exit 1
+}
+
# Is topic fully merged to master?
not_in_master=`git-rev-list --pretty=oneline ^master "$topic"`
if test -z "$not_in_master"
diff --git a/templates/hooks--prepare-commit-msg b/templates/hooks--prepare-commit-msg.sample
index d3c1da34d2..365242499d 100644..100755
--- a/templates/hooks--prepare-commit-msg
+++ b/templates/hooks--prepare-commit-msg.sample
@@ -7,7 +7,7 @@
# message file. If the hook fails with a non-zero status,
# the commit is aborted.
#
-# To enable this hook, make this file executable.
+# To enable this hook, rename this file to "prepare-commit-msg".
# This hook includes three examples. The first comments out the
# "Conflicts:" part of a merge commit.
@@ -22,10 +22,10 @@
case "$2,$3" in
merge,)
- perl -i -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;;
+ perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;;
# ,|template,)
-# perl -i -pe '
+# perl -i.bak -pe '
# print "\n" . `git diff --cached --name-status -r`
# if /^#/ && $first++ == 0' "$1" ;;
diff --git a/templates/hooks--update b/templates/hooks--update.sample
index 4b69268fd0..93c605594f 100644..100755
--- a/templates/hooks--update
+++ b/templates/hooks--update.sample
@@ -3,7 +3,7 @@
# An example hook script to blocks unannotated tags from entering.
# Called by git-receive-pack with arguments: refname sha1-old sha1-new
#
-# To enable this hook, make this file executable by "chmod +x update".
+# To enable this hook, rename this file to "update".
#
# Config
# ------
diff --git a/test-parse-options.c b/test-parse-options.c
index 73360d7512..2a79e729a4 100644
--- a/test-parse-options.c
+++ b/test-parse-options.c
@@ -2,9 +2,22 @@
#include "parse-options.h"
static int boolean = 0;
-static int integer = 0;
+static unsigned long integer = 0;
+static int abbrev = 7;
+static int verbose = 0, dry_run = 0, quiet = 0;
static char *string = NULL;
+int length_callback(const struct option *opt, const char *arg, int unset)
+{
+ printf("Callback: \"%s\", %d\n",
+ (arg ? arg : "not set"), unset);
+ if (unset)
+ return 1; /* do not support unset */
+
+ *(unsigned long *)opt->value = strlen(arg);
+ return 0;
+}
+
int main(int argc, const char **argv)
{
const char *usage[] = {
@@ -13,15 +26,29 @@ int main(int argc, const char **argv)
};
struct option options[] = {
OPT_BOOLEAN('b', "boolean", &boolean, "get a boolean"),
+ OPT_BIT('4', "or4", &boolean,
+ "bitwise-or boolean with ...0100", 4),
+ OPT_GROUP(""),
OPT_INTEGER('i', "integer", &integer, "get a integer"),
OPT_INTEGER('j', NULL, &integer, "get a integer, too"),
- OPT_GROUP("string options"),
+ OPT_SET_INT(0, "set23", &integer, "set integer to 23", 23),
+ OPT_DATE('t', NULL, &integer, "get timestamp of <time>"),
+ OPT_CALLBACK('L', "length", &integer, "str",
+ "get length of <str>", length_callback),
+ OPT_GROUP("String options"),
OPT_STRING('s', "string", &string, "string", "get a string"),
OPT_STRING(0, "string2", &string, "str", "get another string"),
OPT_STRING(0, "st", &string, "st", "get another string (pervert ordering)"),
OPT_STRING('o', NULL, &string, "str", "get another string"),
- OPT_GROUP("magic arguments"),
+ OPT_SET_PTR(0, "default-string", &string,
+ "set string to default", (unsigned long)"default"),
+ OPT_GROUP("Magic arguments"),
OPT_ARGUMENT("quux", "means --quux"),
+ OPT_GROUP("Standard options"),
+ OPT__ABBREV(&abbrev),
+ OPT__VERBOSE(&verbose),
+ OPT__DRY_RUN(&dry_run),
+ OPT__QUIET(&quiet),
OPT_END(),
};
int i;
@@ -29,8 +56,12 @@ int main(int argc, const char **argv)
argc = parse_options(argc, argv, options, usage, 0);
printf("boolean: %d\n", boolean);
- printf("integer: %d\n", integer);
+ printf("integer: %lu\n", integer);
printf("string: %s\n", string ? string : "(not set)");
+ printf("abbrev: %d\n", abbrev);
+ printf("verbose: %d\n", verbose);
+ printf("quiet: %s\n", quiet ? "yes" : "no");
+ printf("dry run: %s\n", dry_run ? "yes" : "no");
for (i = 0; i < argc; i++)
printf("arg %02d: %s\n", i, argv[i]);
diff --git a/wrapper.c b/wrapper.c
new file mode 100644
index 0000000000..4e04f7661b
--- /dev/null
+++ b/wrapper.c
@@ -0,0 +1,160 @@
+/*
+ * Various trivial helper wrappers around standard functions
+ */
+#include "cache.h"
+
+char *xstrdup(const char *str)
+{
+ char *ret = strdup(str);
+ if (!ret) {
+ release_pack_memory(strlen(str) + 1, -1);
+ ret = strdup(str);
+ if (!ret)
+ die("Out of memory, strdup failed");
+ }
+ return ret;
+}
+
+void *xmalloc(size_t size)
+{
+ void *ret = malloc(size);
+ if (!ret && !size)
+ ret = malloc(1);
+ if (!ret) {
+ release_pack_memory(size, -1);
+ ret = malloc(size);
+ if (!ret && !size)
+ ret = malloc(1);
+ if (!ret)
+ die("Out of memory, malloc failed");
+ }
+#ifdef XMALLOC_POISON
+ memset(ret, 0xA5, size);
+#endif
+ return ret;
+}
+
+/*
+ * xmemdupz() allocates (len + 1) bytes of memory, duplicates "len" bytes of
+ * "data" to the allocated memory, zero terminates the allocated memory,
+ * and returns a pointer to the allocated memory. If the allocation fails,
+ * the program dies.
+ */
+void *xmemdupz(const void *data, size_t len)
+{
+ char *p = xmalloc(len + 1);
+ memcpy(p, data, len);
+ p[len] = '\0';
+ return p;
+}
+
+char *xstrndup(const char *str, size_t len)
+{
+ char *p = memchr(str, '\0', len);
+ return xmemdupz(str, p ? p - str : len);
+}
+
+void *xrealloc(void *ptr, size_t size)
+{
+ void *ret = realloc(ptr, size);
+ if (!ret && !size)
+ ret = realloc(ptr, 1);
+ if (!ret) {
+ release_pack_memory(size, -1);
+ ret = realloc(ptr, size);
+ if (!ret && !size)
+ ret = realloc(ptr, 1);
+ if (!ret)
+ die("Out of memory, realloc failed");
+ }
+ return ret;
+}
+
+void *xcalloc(size_t nmemb, size_t size)
+{
+ void *ret = calloc(nmemb, size);
+ if (!ret && (!nmemb || !size))
+ ret = calloc(1, 1);
+ if (!ret) {
+ release_pack_memory(nmemb * size, -1);
+ ret = calloc(nmemb, size);
+ if (!ret && (!nmemb || !size))
+ ret = calloc(1, 1);
+ if (!ret)
+ die("Out of memory, calloc failed");
+ }
+ return ret;
+}
+
+void *xmmap(void *start, size_t length,
+ int prot, int flags, int fd, off_t offset)
+{
+ void *ret = mmap(start, length, prot, flags, fd, offset);
+ if (ret == MAP_FAILED) {
+ if (!length)
+ return NULL;
+ release_pack_memory(length, fd);
+ ret = mmap(start, length, prot, flags, fd, offset);
+ if (ret == MAP_FAILED)
+ die("Out of memory? mmap failed: %s", strerror(errno));
+ }
+ return ret;
+}
+
+/*
+ * xread() is the same a read(), but it automatically restarts read()
+ * operations with a recoverable error (EAGAIN and EINTR). xread()
+ * DOES NOT GUARANTEE that "len" bytes is read even if the data is available.
+ */
+ssize_t xread(int fd, void *buf, size_t len)
+{
+ ssize_t nr;
+ while (1) {
+ nr = read(fd, buf, len);
+ if ((nr < 0) && (errno == EAGAIN || errno == EINTR))
+ continue;
+ return nr;
+ }
+}
+
+/*
+ * xwrite() is the same a write(), but it automatically restarts write()
+ * operations with a recoverable error (EAGAIN and EINTR). xwrite() DOES NOT
+ * GUARANTEE that "len" bytes is written even if the operation is successful.
+ */
+ssize_t xwrite(int fd, const void *buf, size_t len)
+{
+ ssize_t nr;
+ while (1) {
+ nr = write(fd, buf, len);
+ if ((nr < 0) && (errno == EAGAIN || errno == EINTR))
+ continue;
+ return nr;
+ }
+}
+
+int xdup(int fd)
+{
+ int ret = dup(fd);
+ if (ret < 0)
+ die("dup failed: %s", strerror(errno));
+ return ret;
+}
+
+FILE *xfdopen(int fd, const char *mode)
+{
+ FILE *stream = fdopen(fd, mode);
+ if (stream == NULL)
+ die("Out of memory? fdopen failed: %s", strerror(errno));
+ return stream;
+}
+
+int xmkstemp(char *template)
+{
+ int fd;
+
+ fd = mkstemp(template);
+ if (fd < 0)
+ die("Unable to create temporary file: %s", strerror(errno));
+ return fd;
+}
diff --git a/ws.c b/ws.c
index ba7e834ca8..7a7ff130a3 100644
--- a/ws.c
+++ b/ws.c
@@ -117,9 +117,9 @@ char *whitespace_error_string(unsigned ws)
}
/* If stream is non-NULL, emits the line after checking. */
-unsigned check_and_emit_line(const char *line, int len, unsigned ws_rule,
- FILE *stream, const char *set,
- const char *reset, const char *ws)
+static unsigned ws_check_emit_1(const char *line, int len, unsigned ws_rule,
+ FILE *stream, const char *set,
+ const char *reset, const char *ws)
{
unsigned result = 0;
int written = 0;
@@ -213,6 +213,33 @@ unsigned check_and_emit_line(const char *line, int len, unsigned ws_rule,
return result;
}
+void ws_check_emit(const char *line, int len, unsigned ws_rule,
+ FILE *stream, const char *set,
+ const char *reset, const char *ws)
+{
+ (void)ws_check_emit_1(line, len, ws_rule, stream, set, reset, ws);
+}
+
+unsigned ws_check(const char *line, int len, unsigned ws_rule)
+{
+ return ws_check_emit_1(line, len, ws_rule, NULL, NULL, NULL, NULL);
+}
+
+int ws_blank_line(const char *line, int len, unsigned ws_rule)
+{
+ /*
+ * We _might_ want to treat CR differently from other
+ * whitespace characters when ws_rule has WS_CR_AT_EOL, but
+ * for now we just use this stupid definition.
+ */
+ while (len-- > 0) {
+ if (!isspace(*line))
+ return 0;
+ line++;
+ }
+ return 1;
+}
+
/* Copy the line to the buffer while fixing whitespaces */
int ws_fix_copy(char *dst, const char *src, int len, unsigned ws_rule, int *error_count)
{
diff --git a/wt-status.c b/wt-status.c
index 5b4d74c1f3..28c9e637e3 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -27,6 +27,7 @@ static const char use_add_rm_msg[] =
"use \"git add/rm <file>...\" to update what will be committed";
static const char use_add_to_include_msg[] =
"use \"git add <file>...\" to include in what will be committed";
+enum untracked_status_type show_untracked_files = SHOW_NORMAL_UNTRACKED_FILES;
static int parse_status_slot(const char *var, int offset)
{
@@ -347,7 +348,10 @@ void wt_status_print(struct wt_status *s)
wt_status_print_changed(s);
if (wt_status_submodule_summary)
wt_status_print_submodule_summary(s);
- wt_status_print_untracked(s);
+ if (show_untracked_files)
+ wt_status_print_untracked(s);
+ else if (s->commitable)
+ fprintf(s->fp, "# Untracked files not listed (use -u option to show untracked files)\n");
if (s->verbose && !s->is_initial)
wt_status_print_verbose(s);
@@ -362,6 +366,8 @@ void wt_status_print(struct wt_status *s)
printf("nothing added to commit but untracked files present (use \"git add\" to track)\n");
else if (s->is_initial)
printf("nothing to commit (create/copy files and use \"git add\" to track)\n");
+ else if (!show_untracked_files)
+ printf("nothing to commit (use -u to show untracked files)\n");
else
printf("nothing to commit (working directory clean)\n");
}
@@ -391,5 +397,18 @@ int git_status_config(const char *k, const char *v, void *cb)
wt_status_relative_paths = git_config_bool(k, v);
return 0;
}
+ if (!strcmp(k, "status.showuntrackedfiles")) {
+ if (!v)
+ return config_error_nonbool(v);
+ else if (!strcmp(v, "no"))
+ show_untracked_files = SHOW_NO_UNTRACKED_FILES;
+ else if (!strcmp(v, "normal"))
+ show_untracked_files = SHOW_NORMAL_UNTRACKED_FILES;
+ else if (!strcmp(v, "all"))
+ show_untracked_files = SHOW_ALL_UNTRACKED_FILES;
+ else
+ return error("Invalid untracked files mode '%s'", v);
+ return 0;
+ }
return git_color_default_config(k, v, cb);
}
diff --git a/wt-status.h b/wt-status.h
index 597c7ea988..78add09bd6 100644
--- a/wt-status.h
+++ b/wt-status.h
@@ -11,6 +11,13 @@ enum color_wt_status {
WT_STATUS_NOBRANCH,
};
+enum untracked_status_type {
+ SHOW_NO_UNTRACKED_FILES,
+ SHOW_NORMAL_UNTRACKED_FILES,
+ SHOW_ALL_UNTRACKED_FILES
+};
+extern enum untracked_status_type show_untracked_files;
+
struct wt_status {
int is_initial;
char *branch;