Browse Source

GIT 0.99.9a

... to contain the RPM workaround.

Signed-off-by: Junio C Hamano <junkio@cox.net>
maint v0.99.9a
Junio C Hamano 19 years ago
parent
commit
e634aec752
  1. 12
      .gitignore
  2. 4
      Documentation/Makefile
  3. 15
      Documentation/cvs-migration.txt
  4. 11
      Documentation/diff-format.txt
  5. 4
      Documentation/diff-options.txt
  6. 77
      Documentation/diffcore.txt
  7. 9
      Documentation/git-add.txt
  8. 90
      Documentation/git-am.txt
  9. 31
      Documentation/git-apply.txt
  10. 12
      Documentation/git-applymbox.txt
  11. 8
      Documentation/git-archimport.txt
  12. 1
      Documentation/git-cat-file.txt
  13. 50
      Documentation/git-check-ref-format.txt
  14. 1
      Documentation/git-checkout-index.txt
  15. 42
      Documentation/git-checkout.txt
  16. 1
      Documentation/git-cherry-pick.txt
  17. 13
      Documentation/git-clone-pack.txt
  18. 3
      Documentation/git-clone.txt
  19. 12
      Documentation/git-commit-tree.txt
  20. 3
      Documentation/git-commit.txt
  21. 5
      Documentation/git-convert-objects.txt
  22. 5
      Documentation/git-cvsimport.txt
  23. 24
      Documentation/git-daemon.txt
  24. 1
      Documentation/git-diff-files.txt
  25. 1
      Documentation/git-diff-index.txt
  26. 1
      Documentation/git-diff-stages.txt
  27. 6
      Documentation/git-diff-tree.txt
  28. 3
      Documentation/git-fetch-pack.txt
  29. 6
      Documentation/git-fetch.txt
  30. 6
      Documentation/git-format-patch.txt
  31. 11
      Documentation/git-fsck-objects.txt
  32. 1
      Documentation/git-grep.txt
  33. 1
      Documentation/git-hash-object.txt
  34. 5
      Documentation/git-http-fetch.txt
  35. 44
      Documentation/git-index-pack.txt
  36. 1
      Documentation/git-init-db.txt
  37. 5
      Documentation/git-local-fetch.txt
  38. 3
      Documentation/git-log.txt
  39. 6
      Documentation/git-ls-files.txt
  40. 1
      Documentation/git-ls-remote.txt
  41. 5
      Documentation/git-ls-tree.txt
  42. 13
      Documentation/git-mailsplit.txt
  43. 1
      Documentation/git-merge-base.txt
  44. 1
      Documentation/git-merge-index.txt
  45. 1
      Documentation/git-merge-one-file.txt
  46. 1
      Documentation/git-merge.txt
  47. 1
      Documentation/git-mktag.txt
  48. 51
      Documentation/git-mv.txt
  49. 66
      Documentation/git-name-rev.txt
  50. 1
      Documentation/git-octopus.txt
  51. 10
      Documentation/git-pack-objects.txt
  52. 6
      Documentation/git-patch-id.txt
  53. 3
      Documentation/git-peek-remote.txt
  54. 1
      Documentation/git-prune-packed.txt
  55. 1
      Documentation/git-prune.txt
  56. 5
      Documentation/git-pull.txt
  57. 9
      Documentation/git-push.txt
  58. 1
      Documentation/git-read-tree.txt
  59. 1
      Documentation/git-receive-pack.txt
  60. 1
      Documentation/git-rename.txt
  61. 1
      Documentation/git-repack.txt
  62. 3
      Documentation/git-resolve.txt
  63. 57
      Documentation/git-rev-list.txt
  64. 19
      Documentation/git-rev-parse.txt
  65. 1
      Documentation/git-send-email.txt
  66. 1
      Documentation/git-send-pack.txt
  67. 35
      Documentation/git-shell.txt
  68. 3
      Documentation/git-shortlog.txt
  69. 27
      Documentation/git-show-branch.txt
  70. 3
      Documentation/git-show-index.txt
  71. 1
      Documentation/git-ssh-fetch.txt
  72. 1
      Documentation/git-ssh-upload.txt
  73. 3
      Documentation/git-status.txt
  74. 137
      Documentation/git-svnimport.txt
  75. 22
      Documentation/git-tag.txt
  76. 1
      Documentation/git-tar-tree.txt
  77. 1
      Documentation/git-unpack-file.txt
  78. 1
      Documentation/git-unpack-objects.txt
  79. 41
      Documentation/git-update-index.txt
  80. 1
      Documentation/git-update-server-info.txt
  81. 1
      Documentation/git-upload-pack.txt
  82. 1
      Documentation/git-var.txt
  83. 5
      Documentation/git-verify-pack.txt
  84. 3
      Documentation/git-whatchanged.txt
  85. 1
      Documentation/git-write-tree.txt
  86. 72
      Documentation/git.txt
  87. 2
      Documentation/glossary.txt
  88. 3
      Documentation/hooks.txt
  89. 12
      Documentation/pull-fetch-param.txt
  90. 5
      Documentation/repository-layout.txt
  91. 98
      Documentation/tutorial.txt
  92. 168
      Makefile
  93. 180
      apply.c
  94. 62
      cache.h
  95. 9
      checkout-index.c
  96. 177
      clone-pack.c
  97. 8
      commit-tree.c
  98. 1
      commit.c
  99. 50
      compat/mmap.c
  100. 236
      config.c
  101. Some files were not shown because too many files have changed in this diff Show More

12
.gitignore vendored

@ -1,5 +1,6 @@
git git
git-add git-add
git-am
git-apply git-apply
git-applymbox git-applymbox
git-applypatch git-applypatch
@ -7,9 +8,11 @@ git-archimport
git-bisect git-bisect
git-branch git-branch
git-cat-file git-cat-file
git-check-ref-format
git-checkout git-checkout
git-checkout-index git-checkout-index
git-cherry git-cherry
git-cherry-pick
git-clone git-clone
git-clone-pack git-clone-pack
git-commit git-commit
@ -25,6 +28,7 @@ git-diff-stages
git-diff-tree git-diff-tree
git-fetch git-fetch
git-fetch-pack git-fetch-pack
git-findtags
git-fmt-merge-msg git-fmt-merge-msg
git-format-patch git-format-patch
git-fsck-objects git-fsck-objects
@ -32,6 +36,7 @@ git-get-tar-commit-id
git-grep git-grep
git-hash-object git-hash-object
git-http-fetch git-http-fetch
git-index-pack
git-init-db git-init-db
git-local-fetch git-local-fetch
git-log git-log
@ -49,6 +54,8 @@ git-merge-recursive
git-merge-resolve git-merge-resolve
git-merge-stupid git-merge-stupid
git-mktag git-mktag
git-name-rev
git-mv
git-octopus git-octopus
git-pack-objects git-pack-objects
git-parse-remote git-parse-remote
@ -73,6 +80,7 @@ git-revert
git-send-email git-send-email
git-send-pack git-send-pack
git-sh-setup git-sh-setup
git-shell
git-shortlog git-shortlog
git-show-branch git-show-branch
git-show-index git-show-index
@ -82,6 +90,7 @@ git-ssh-push
git-ssh-upload git-ssh-upload
git-status git-status
git-stripspace git-stripspace
git-svnimport
git-symbolic-ref git-symbolic-ref
git-tag git-tag
git-tar-tree git-tar-tree
@ -101,3 +110,6 @@ git-core-*/?*
*.dsc *.dsc
*.deb *.deb
git-core.spec git-core.spec
*.exe
libgit.a
*.o

4
Documentation/Makefile

@ -17,14 +17,14 @@ DOC_HTML += $(patsubst %,%.html,$(ARTICLES) $(SP_ARTICLES))
DOC_MAN1=$(patsubst %.txt,%.1,$(MAN1_TXT)) DOC_MAN1=$(patsubst %.txt,%.1,$(MAN1_TXT))
DOC_MAN7=$(patsubst %.txt,%.7,$(MAN7_TXT)) DOC_MAN7=$(patsubst %.txt,%.7,$(MAN7_TXT))


prefix=$(HOME) prefix?=$(HOME)
bin=$(prefix)/bin bin=$(prefix)/bin
mandir=$(prefix)/man mandir=$(prefix)/man
man1=$(mandir)/man1 man1=$(mandir)/man1
man7=$(mandir)/man7 man7=$(mandir)/man7
# DESTDIR= # DESTDIR=


INSTALL=install INSTALL?=install


# #
# Please note that there is a minor bug in asciidoc. # Please note that there is a minor bug in asciidoc.

15
Documentation/cvs-migration.txt

@ -1,6 +1,5 @@
Git for CVS users git for CVS users
================= =================
v0.99.5, Aug 2005


Ok, so you're a CVS user. That's ok, it's a treatable condition, and the Ok, so you're a CVS user. That's ok, it's a treatable condition, and the
first step to recovery is admitting you have a problem. The fact that first step to recovery is admitting you have a problem. The fact that
@ -8,7 +7,7 @@ you are reading this file means that you may be well on that path
already. already.


The thing about CVS is that it absolutely sucks as a source control The thing about CVS is that it absolutely sucks as a source control
manager, and you'll thus be happy with almost anything else. Git, manager, and you'll thus be happy with almost anything else. git,
however, may be a bit 'too' different (read: "good") for your taste, and however, may be a bit 'too' different (read: "good") for your taste, and
does a lot of things differently. does a lot of things differently.


@ -16,7 +15,7 @@ One particular suckage of CVS is very hard to work around: CVS is
basically a tool for tracking 'file' history, while git is a tool for basically a tool for tracking 'file' history, while git is a tool for
tracking 'project' history. This sometimes causes problems if you are tracking 'project' history. This sometimes causes problems if you are
used to doing very strange things in CVS, in particular if you're doing used to doing very strange things in CVS, in particular if you're doing
things like making branches of just a subset of the project. Git can't things like making branches of just a subset of the project. git can't
track that, since git never tracks things on the level of an individual track that, since git never tracks things on the level of an individual
file, only on the whole project level. file, only on the whole project level.


@ -33,7 +32,7 @@ and notes on converting from CVS to git.


Second: CVS has the notion of a "repository" as opposed to the thing Second: CVS has the notion of a "repository" as opposed to the thing
that you're actually working in (your working directory, or your that you're actually working in (your working directory, or your
"checked out tree"). Git does not have that notion at all, and all git "checked out tree"). git does not have that notion at all, and all git
working directories 'are' the repositories. However, you can easily working directories 'are' the repositories. However, you can easily
emulate the CVS model by having one special "global repository", which emulate the CVS model by having one special "global repository", which
people can synchronize with. See details later, but in the meantime people can synchronize with. See details later, but in the meantime
@ -50,7 +49,7 @@ gone through the git tutorial, and generally familiarized yourself with
how to commit stuff etc in git) is to create a git'ified version of your how to commit stuff etc in git) is to create a git'ified version of your
CVS archive. CVS archive.


Happily, that's very easy indeed. Git will do it for you, although git Happily, that's very easy indeed. git will do it for you, although git
will need the help of a program called "cvsps": will need the help of a program called "cvsps":


http://www.cobite.com/cvsps/ http://www.cobite.com/cvsps/
@ -136,7 +135,7 @@ technically possible, and there are at least two specialized scripts out
there that can be used to get equivalent information (see the git there that can be used to get equivalent information (see the git
mailing list archives for details). mailing list archives for details).


Git has a couple of alternatives, though, that you may find sufficient git has a couple of alternatives, though, that you may find sufficient
or even superior depending on your use. One is called "git-whatchanged" or even superior depending on your use. One is called "git-whatchanged"
(for obvious reasons) and the other one is called "pickaxe" ("a tool for (for obvious reasons) and the other one is called "pickaxe" ("a tool for
the software archeologist"). the software archeologist").
@ -209,7 +208,7 @@ show anything for commits that do not touch this "if" statement.
Also, in the original context, the same statement might have Also, in the original context, the same statement might have
appeared at first in a different file and later the file was appeared at first in a different file and later the file was
renamed to "a-file.c". CVS annotate would not help you to go renamed to "a-file.c". CVS annotate would not help you to go
back across such a rename, but GIT would still help you in such back across such a rename, but git would still help you in such
a situation. For that, you can give the -C flag to a situation. For that, you can give the -C flag to
git-diff-tree, like this: git-diff-tree, like this:



11
Documentation/diff-format.txt

@ -55,6 +55,11 @@ Example:
:100644 100644 5be4a4...... 000000...... M file.c :100644 100644 5be4a4...... 000000...... M file.c
------------------------------------------------ ------------------------------------------------


When `-z` option is not used, TAB, LF, and backslash characters
in pathnames are represented as `\t`, `\n`, and `\\`,
respectively.


Generating patches with -p Generating patches with -p
-------------------------- --------------------------


@ -106,7 +111,7 @@ For a path that is unmerged, 'GIT_EXTERNAL_DIFF' is called with 1
parameter, <path>. parameter, <path>.




Git specific extension to diff format git specific extension to diff format
------------------------------------- -------------------------------------


What -p option produces is slightly different from the What -p option produces is slightly different from the
@ -137,3 +142,7 @@ the file that rename/copy produces, respectively.
rename to <path> rename to <path>
similarity index <number> similarity index <number>
dissimilarity index <number> dissimilarity index <number>
index <hash>..<hash> <mode>

3. TAB, LF, and backslash characters in pathnames are
represented as `\t`, `\n`, and `\\`, respectively.

4
Documentation/diff-options.txt

@ -4,10 +4,6 @@
-u:: -u::
Synonym for "-p". Synonym for "-p".


-r::
Look recursively in subdirectories; only used by "git-diff-tree";
other diff commands always work recursively.

-z:: -z::
\0 line termination on output \0 line termination on output



77
Documentation/diffcore.txt

@ -6,13 +6,12 @@ June 2005
Introduction Introduction
------------ ------------


The diff commands git-diff-index, git-diff-files, and The diff commands git-diff-index, git-diff-files, git-diff-tree, and
git-diff-tree can be told to manipulate differences they find git-diff-stages can be told to manipulate differences they find in
in unconventional ways before showing diff(1) output. The unconventional ways before showing diff(1) output. The manipulation
manipulation is collectively called "diffcore transformation". is collectively called "diffcore transformation". This short note
This short note describes what they are and how to use them to describes what they are and how to use them to produce diff outputs
produce diff outputs that are easier to understand than the that are easier to understand than the conventional kind.
conventional kind.




The chain of operation The chain of operation
@ -29,7 +28,10 @@ files:
- git-diff-files compares contents of the index file and the - git-diff-files compares contents of the index file and the
working directory; working directory;


- git-diff-tree compares contents of two "tree" objects. - git-diff-tree compares contents of two "tree" objects;

- git-diff-stages compares contents of blobs at two stages in an
unmerged index file.


In all of these cases, the commands themselves compare In all of these cases, the commands themselves compare
corresponding paths in the two sets of files. The result of corresponding paths in the two sets of files. The result of
@ -65,14 +67,23 @@ format sections of the manual for git-diff-\* commands) or
diff-patch format. diff-patch format.




diffcore-pathspec diffcore-pathspec: For Ignoring Files Outside Our Consideration
----------------- ---------------------------------------------------------------


The first transformation in the chain is diffcore-pathspec, and The first transformation in the chain is diffcore-pathspec, and
is controlled by giving the pathname parameters to the is controlled by giving the pathname parameters to the
git-diff-* commands on the command line. The pathspec is used git-diff-* commands on the command line. The pathspec is used
to limit the world diff operates in. It removes the filepairs to limit the world diff operates in. It removes the filepairs
outside the specified set of pathnames. outside the specified set of pathnames. E.g. If the input set
of filepairs included:

------------------------------------------------
:100644 100644 bcd1234... 0123456... M junkfile
------------------------------------------------

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 uses the pathname parameters on the command line to cull set of
@ -80,8 +91,8 @@ filepairs it feeds the diffcore mechanism itself, and does not
use diffcore-pathspec, but the end result is the same. use diffcore-pathspec, but the end result is the same.




diffcore-break diffcore-break: For Splitting Up "Complete Rewrites"
-------------- ----------------------------------------------------


The second transformation in the chain is diffcore-break, and is 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-* commands. This is
@ -115,8 +126,8 @@ the original is used), and can be customized by giving a number
after "-B" option (e.g. "-B75" to tell it to use 75%). after "-B" option (e.g. "-B75" to tell it to use 75%).




diffcore-rename diffcore-rename: For Detection Renames and Copies
--------------- -------------------------------------------------


This transformation is used to detect renames and copies, and is This transformation is used to detect renames and copies, and is
controlled by the -M option (to detect renames) and the -C option controlled by the -M option (to detect renames) and the -C option
@ -136,16 +147,16 @@ merges these filepairs and creates:
:100644 100644 0123456... 0123456... R100 fileX file0 :100644 100644 0123456... 0123456... R100 fileX file0
------------------------------------------------ ------------------------------------------------


When the "-C" option is used, the original contents of modified When the "-C" option is used, the original contents of modified files,
files and contents of unchanged files are considered as and deleted files (and also unmodified files, if the
candidates of the source files in rename/copy operation, in "\--find-copies-harder" option is used) are considered as candidates
addition to the deleted files. If the input were like these of the source files in rename/copy operation. If the input were like
filepairs, that talk about a modified file fileY and a newly these filepairs, that talk about a modified file fileY and a newly
created file file0: created file file0:


------------------------------------------------ ------------------------------------------------
:100644 100644 0123456... 1234567... M fileY :100644 100644 0123456... 1234567... M fileY
:000000 100644 0000000... 0123456... A file0 :000000 100644 0000000... bcd3456... A file0
------------------------------------------------ ------------------------------------------------


the original contents of fileY and the resulting contents of the original contents of fileY and the resulting contents of
@ -154,14 +165,14 @@ changed to:


------------------------------------------------ ------------------------------------------------
:100644 100644 0123456... 1234567... M fileY :100644 100644 0123456... 1234567... M fileY
:100644 100644 0123456... 0123456... C100 fileY file0 :100644 100644 0123456... bcd3456... C100 fileY file0
------------------------------------------------ ------------------------------------------------


In both rename and copy detection, the same "extent of changes" In both rename and copy detection, the same "extent of changes"
algorithm used in diffcore-break is used to determine if two algorithm used in diffcore-break is used to determine if two
files are "similar enough", and can be customized to use files are "similar enough", and can be customized to use
similarity score different from the default 50% by giving a a similarity score different from the default of 50% by giving a
number after "-M" or "-C" option (e.g. "-M8" to tell it to use number after the "-M" or "-C" option (e.g. "-M8" to tell it to use
8/10 = 80%). 8/10 = 80%).


Note. When the "-C" option is used with `\--find-copies-harder` Note. When the "-C" option is used with `\--find-copies-harder`
@ -173,8 +184,8 @@ git-diff-\* commands can detect copies only if the file that was
copied happened to have been modified in the same changeset. copied happened to have been modified in the same changeset.




diffcore-merge-broken diffcore-merge-broken: For Putting "Complete Rewrites" Back Together
--------------------- --------------------------------------------------------------------


This transformation is used to merge filepairs broken by This transformation is used to merge filepairs broken by
diffcore-break, and not transformed into rename/copy by diffcore-break, and not transformed into rename/copy by
@ -215,8 +226,8 @@ prefixed with '-', followed by the entire contents of new
version prefixed with '+'. version prefixed with '+'.




diffcore-pickaxe diffcore-pickaxe: For Detecting Addition/Deletion of Specified String
---------------- ---------------------------------------------------------------------


This transformation is used to find filepairs that represent This transformation is used to find filepairs that represent
changes that touch a specified string, and is controlled by the changes that touch a specified string, and is controlled by the
@ -230,7 +241,7 @@ string appeared in this changeset". It also checks for the
opposite case that loses the specified string. opposite case that loses the specified string.


When `\--pickaxe-all` is not in effect, diffcore-pickaxe leaves When `\--pickaxe-all` is not in effect, diffcore-pickaxe leaves
only such filepairs that touches the specified string in its only such filepairs that touch the specified string in its
output. When `\--pickaxe-all` is used, diffcore-pickaxe leaves all output. When `\--pickaxe-all` is used, diffcore-pickaxe leaves all
filepairs intact if there is such a filepair, or makes the filepairs intact if there is such a filepair, or makes the
output empty otherwise. The latter behaviour is designed to output empty otherwise. The latter behaviour is designed to
@ -238,19 +249,19 @@ make reviewing of the changes in the context of the whole
changeset easier. changeset easier.




diffcore-order diffcore-order: For Sorting the Output Based on Filenames
-------------- ---------------------------------------------------------


This is used to reorder the filepairs according to the user's 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 (or project's) taste, and is controlled by the -O option to the
git-diff-* commands. git-diff-* commands.


This takes a text file each of whose line is a shell glob This takes a text file each of whose lines is a shell glob
pattern. Filepairs that match a glob pattern on an earlier line pattern. Filepairs that match a glob pattern on an earlier line
in the file are output before ones that match a later line, and in the file are output before ones that match a later line, and
filepairs that do not match any glob pattern are output last. filepairs that do not match any glob pattern are output last.


As an example, typical orderfile for the core GIT probably As an example, a typical orderfile for the core git probably
would look like this: would look like this:


------------------------------------------------ ------------------------------------------------

9
Documentation/git-add.txt

@ -7,7 +7,7 @@ git-add - Add files to the cache.


SYNOPSIS SYNOPSIS
-------- --------
'git-add' <file>... 'git-add' [-n] [-v] <file>...


DESCRIPTION DESCRIPTION
----------- -----------
@ -19,6 +19,13 @@ OPTIONS
<file>...:: <file>...::
Files to add to the cache. Files to add to the cache.


-n::
Don't actually add the file(s), just show if they exist.

-v::
Be verbose.


Author Author
------ ------
Written by Linus Torvalds <torvalds@osdl.org> Written by Linus Torvalds <torvalds@osdl.org>

90
Documentation/git-am.txt

@ -0,0 +1,90 @@
git-am(1)
=========

NAME
----
git-am - Apply a series of patches in a mailbox


SYNOPSIS
--------
'git-am' [--signoff] [--dotest=<dir>] [--utf8] [--3way] <mbox>...
'git-am' [--skip]

DESCRIPTION
-----------
Splits mail messages in a mailbox into commit log message,
authorship information and patches, and applies them to the
current branch.

OPTIONS
-------
--signoff::
Add `Signed-off-by:` line to the commit message, using
the committer identity of yourself.

--dotest=<dir>::
Instead of `.dotest` directory, use <dir> as a working
area to store extracted patches.

--utf8, --keep::
Pass `--utf8` and `--keep` flags to `git-mailinfo` (see
gitlink:git-mailinfo[1]).

--3way::
When the patch does not apply cleanly, fall back on
3-way merge, if the patch records the identity of blobs
it is supposed to apply to, and we have those blobs
locally.

--skip::
Skip the current patch. This is only meaningful when
restarting an aborted patch.

--interactive::
Run interactively, just like git-applymbox.


DISCUSSION
----------

When initially invoking it, you give it names of the mailboxes
to crunch. Upon seeing the first patch that does not apply, it
aborts in the middle, just like 'git-applymbox' does. You can
recover from this in one of two ways:

. skip the current one by re-running the command with '--skip'
option.

. hand resolve the conflict in the working directory, run 'git
diff HEAD' to extract the merge result into a patch form and
replacing the patch in .dotest/patch file. After doing this,
run `git-reset --hard HEAD` to bring the working tree to the
state before half-applying the patch, then re-run the command
without any options.

The command refuses to process new mailboxes while `.dotest`
directory exists, so if you decide to start over from scratch,
run `rm -f .dotest` before running the command with mailbox
names.


SEE ALSO
--------
gitlink:git-applymbox[1], gitlink:git-applypatch[1].


Author
------
Written by Junio C Hamano <junkio@cox.net>

Documentation
--------------
Documentation by Petr Baudis, Junio C Hamano and the git-list <git@vger.kernel.org>.

This manual page is a stub. You can help the git documentation by expanding it.

GIT
---
Part of the gitlink:git[7] suite

31
Documentation/git-apply.txt

@ -1,15 +1,14 @@
git-apply(1) git-apply(1)
============ ============
v0.1, June 2005


NAME NAME
---- ----
git-apply - Apply patch on a GIT index file and a work tree git-apply - Apply patch on a git index file and a work tree




SYNOPSIS SYNOPSIS
-------- --------
'git-apply' [--no-merge] [--stat] [--summary] [--check] [--index] [--show-files] [--apply] [<patch>...] 'git-apply' [--stat] [--numstat] [--summary] [--check] [--index] [--apply] [--index-info] [-z] [<patch>...]


DESCRIPTION DESCRIPTION
----------- -----------
@ -22,15 +21,16 @@ OPTIONS
The files to read patch from. '-' can be used to read The files to read patch from. '-' can be used to read
from the standard input. from the standard input.


--no-merge::
The default mode of operation is the merge behaviour
which is not implemented yet. This flag explicitly
tells the program not to use the merge behaviour.

--stat:: --stat::
Instead of applying the patch, output diffstat for the Instead of applying the patch, output diffstat for the
input. Turns off "apply". input. Turns off "apply".


--numstat::
Similar to \--stat, but shows number of added and
deleted lines in decimal notation and pathname without
abbreviation, to make it more machine friendly. Turns
off "apply".

--summary:: --summary::
Instead of applying the patch, output a condensed Instead of applying the patch, output a condensed
summary of information obtained from git diff extended summary of information obtained from git diff extended
@ -51,8 +51,19 @@ OPTIONS
up-to-date, it is flagged as an error. This flag also up-to-date, it is flagged as an error. This flag also
causes the index file to be updated. causes the index file to be updated.


--show-files:: --index-info::
Show summary of files that are affected by the patch. 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 version of the blob is available locally,
outputs information about them to the standard output.

-z::
When showing the index information, do not munge paths,
but use NUL terminated machine readable format. Without
this flag, the pathnames output will have TAB, LF, and
backslash characters replaced with `\t`, `\n`, and `\\`,
respectively.


--apply:: --apply::
If you use any of the options marked ``Turns off If you use any of the options marked ``Turns off

12
Documentation/git-applymbox.txt

@ -8,7 +8,7 @@ git-applymbox - Apply a series of patches in a mailbox


SYNOPSIS SYNOPSIS
-------- --------
'git-applymbox' [-u] [-k] [-q] ( -c .dotest/<num> | <mbox> ) [ <signoff> ] 'git-applymbox' [-u] [-k] [-q] [-m] ( -c .dotest/<num> | <mbox> ) [ <signoff> ]


DESCRIPTION DESCRIPTION
----------- -----------
@ -33,6 +33,14 @@ OPTIONS
munging, and is most useful when used to read back 'git munging, and is most useful when used to read back 'git
format-patch --mbox' output. format-patch --mbox' output.


-m::
Patches are applied with `git-apply` command, and unless
it cleanly applies without fuzz, the processing fails.
With this flag, if a tree that the patch applies cleanly
is found in a repository, the patch is applied to the
tree and then a 3-way merge between the resulting tree
and the current tree.

-u:: -u::
By default, the commit log message, author name and By default, the commit log message, author name and
author email are taken from the e-mail without any author email are taken from the e-mail without any
@ -67,7 +75,7 @@ OPTIONS


SEE ALSO SEE ALSO
-------- --------
gitlink:git-applypatch[1]. gitlink:git-am[1], gitlink:git-applypatch[1].




Author Author

8
Documentation/git-archimport.txt

@ -3,7 +3,7 @@ git-archimport(1)


NAME NAME
---- ----
git-archimport - Import an Arch repository into GIT git-archimport - Import an Arch repository into git




SYNOPSIS SYNOPSIS
@ -40,14 +40,14 @@ incremental imports.


MERGES MERGES
------ ------
Patch merge data from Arch is used to mark merges in GIT as well. GIT Patch merge data from Arch is used to mark merges in git as well. git
does not care much about tracking patches, and only considers a merge when a does not care much about tracking patches, and only considers a merge when a
branch incorporates all the commits since the point they forked. The end result branch incorporates all the commits since the point they forked. The end result
is that GIT will have a good idea of how far branches have diverged. So the is that git will have a good idea of how far branches have diverged. So the
import process does lose some patch-trading metadata. import process does lose some patch-trading metadata.


Fortunately, when you try and merge branches imported from Arch, Fortunately, when you try and merge branches imported from Arch,
GIT will find a good merge base, and it has a good chance of identifying git will find a good merge base, and it has a good chance of identifying
patches that have been traded out-of-sequence between the branches. patches that have been traded out-of-sequence between the branches.


OPTIONS OPTIONS

1
Documentation/git-cat-file.txt

@ -1,6 +1,5 @@
git-cat-file(1) git-cat-file(1)
=============== ===============
v0.1, May 2005


NAME NAME
---- ----

50
Documentation/git-check-ref-format.txt

@ -0,0 +1,50 @@
git-check-ref-format(1)
=======================

NAME
----
git-check-ref-format - Make sure ref name is well formed.

SYNOPSIS
--------
'git-check-ref-format' <refname>

DESCRIPTION
-----------
Checks if a given 'refname' is acceptable, and exits non-zero if
it is not.

A reference is used in git to specify branches and tags. A
branch head is stored under `$GIT_DIR/refs/heads` directory, and
a tag is stored under `$GIT_DIR/refs/tags` directory. git
imposes the following rules on how refs are named:

. It could be named hierarchically (i.e. separated with slash
`/`), but each of its component cannot begin with a dot `.`;

. It cannot have two consecutive dots `..` anywhere;

. It cannot have ASCII control character (i.e. bytes whose
values are lower than \040, or \177 `DEL`), space, tilde `~`,
caret `{caret}`, or colon `:` anywhere;

. It cannot end with a slash `/`.

These rules makes it easy for shell script based tools to parse
refnames, and also avoids ambiguities in certain refname
expressions (see gitlink:git-rev-parse[1]). Namely:

. double-dot `..` are often used as in `ref1..ref2`, and in some
context this notation means `{caret}ref1 ref2` (i.e. not in
ref1 and in ref2).

. tilde `~` and caret `{caret}` are used to introduce postfix
'nth parent' and 'peel onion' operation.

. colon `:` is used as in `srcref:dstref` to mean "use srcref\'s
value and store it in dstref" in fetch and push operations.


GIT
---
Part of the gitlink:git[7] suite

1
Documentation/git-checkout-index.txt

@ -1,6 +1,5 @@
git-checkout-index(1) git-checkout-index(1)
===================== =====================
v0.1, May 2005


NAME NAME
---- ----

42
Documentation/git-checkout.txt

@ -7,12 +7,24 @@ git-checkout - Checkout and switch to a branch.


SYNOPSIS SYNOPSIS
-------- --------
'git-checkout' [-f] [-b <new_branch>] [<branch>] 'git-checkout' [-f] [-b <new_branch>] [<branch>] [<paths>...]


DESCRIPTION DESCRIPTION
----------- -----------
Updates the index and working tree to reflect the specified branch,
<branch>. Updates HEAD to be <branch> or, if specified, <new_branch>. When <paths> are not given, this command switches branches, by
updating the index and working tree to reflect the specified
branch, <branch>, and updating HEAD to be <branch> or, if
specified, <new_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`). In
this case, `-f` and `-b` options are meaningless and giving
either of them results in an error. <branch> argument can be
used to specify a specific tree-ish to update the index for the
given paths before updating the working tree.



OPTIONS OPTIONS
------- -------
@ -29,6 +41,30 @@ OPTIONS
Branch to checkout; may be any object ID that resolves to a Branch to checkout; may be any object ID that resolves to a
commit. Defaults to HEAD. commit. Defaults to HEAD.



EXAMPLE
-------

The following sequence checks out the `master` branch, reverts
the `Makefile` to two revisions back, deletes hello.c by
mistake, and gets it back from the index.

------------
$ git checkout master
$ git checkout master~2 Makefile
$ rm -f hello.c
$ git checkout hello.c
------------

If you have an unfortunate branch that is named `hello.c`, the
last step above would be confused as an instruction to switch to
that branch. You should instead write:

------------
$ git checkout -- hello.c
------------


Author Author
------ ------
Written by Linus Torvalds <torvalds@osdl.org> Written by Linus Torvalds <torvalds@osdl.org>

1
Documentation/git-cherry-pick.txt

@ -1,6 +1,5 @@
git-cherry-pick(1) git-cherry-pick(1)
================== ==================
v0.99.5 Aug 2005


NAME NAME
---- ----

13
Documentation/git-clone-pack.txt

@ -1,6 +1,5 @@
git-clone-pack(1) git-clone-pack(1)
================= =================
v0.1, July 2005


NAME NAME
---- ----
@ -9,27 +8,23 @@ git-clone-pack - Clones a repository by receiving packed objects.


SYNOPSIS SYNOPSIS
-------- --------
'git-clone-pack' [-q] [--exec=<git-upload-pack>] [<host>:]<directory> [<head>...] 'git-clone-pack' [--exec=<git-upload-pack>] [<host>:]<directory> [<head>...]


DESCRIPTION DESCRIPTION
----------- -----------
Clones a repository into the current repository by invoking Clones a repository into the current repository by invoking
'git-upload-pack', possibly on the remote host via ssh, in 'git-upload-pack', possibly on the remote host via ssh, in
the named repository, and invoking 'git-unpack-objects' locally the named repository, and stores the sent pack in the local
to receive the pack. repository.


OPTIONS OPTIONS
------- -------
-q::
Pass '-q' flag to 'git-unpack-objects'; this makes the
cloning process less verbose.

--exec=<git-upload-pack>:: --exec=<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. remote side, if it is not found on your $PATH.
Installations of sshd ignore the user's environment Installations of sshd ignore the user's environment
setup scripts for login shells (e.g. .bash_profile) and setup scripts for login shells (e.g. .bash_profile) and
your privately installed GIT may not be found on the system your privately installed git may not be found on the system
default $PATH. Another workaround suggested is to set default $PATH. Another workaround suggested is to set
up your $PATH in ".bashrc", but this flag is for people up your $PATH in ".bashrc", but this flag is for people
who do not want to pay the overhead for non-interactive who do not want to pay the overhead for non-interactive

3
Documentation/git-clone.txt

@ -1,6 +1,5 @@
git-clone(1) git-clone(1)
============ ============
v0.1, July 2005


NAME NAME
---- ----
@ -9,7 +8,7 @@ git-clone - Clones a repository.


SYNOPSIS SYNOPSIS
-------- --------
'git clone' [-l [-s]] [-q] [-n] [-u <upload-pack>] <repository> <directory> 'git-clone' [-l [-s]] [-q] [-n] [-u <upload-pack>] <repository> <directory>


DESCRIPTION DESCRIPTION
----------- -----------

12
Documentation/git-commit-tree.txt

@ -1,6 +1,5 @@
git-commit-tree(1) git-commit-tree(1)
================== ==================
v0.1, May 2005


NAME NAME
---- ----
@ -49,8 +48,8 @@ A commit encapsulates:
- committer name and email and the commit time. - committer name and email and the commit time.


If not provided, "git-commit-tree" uses your name, hostname and domain to If not provided, "git-commit-tree" uses your name, hostname and domain to
provide author and committer info. This can be overridden using the provide author and committer info. This can be overridden by
following environment variables. either `.git/config` file, or using the following environment variables.


GIT_AUTHOR_NAME GIT_AUTHOR_NAME
GIT_AUTHOR_EMAIL GIT_AUTHOR_EMAIL
@ -60,10 +59,17 @@ following environment variables.


(nb "<", ">" and "\n"s are stripped) (nb "<", ">" and "\n"s are stripped)


In `.git/config` file, the following items are used:

[user]
name = "Your Name"
email = "your@email.address.xz"

A commit comment is read from stdin (max 999 chars). If a changelog A commit comment is read from stdin (max 999 chars). 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. for one to be entered and terminated with ^D.



Diagnostics Diagnostics
----------- -----------
You don't exist. Go away!:: You don't exist. Go away!::

3
Documentation/git-commit.txt

@ -1,6 +1,5 @@
git-commit(1) git-commit(1)
============= =============
v0.99.4, Aug 2005


NAME NAME
---- ----
@ -8,7 +7,7 @@ git-commit - Record your changes


SYNOPSIS SYNOPSIS
-------- --------
'git commit' [-a] [-s] [-v] [(-c | -C) <commit> | -F <file> | -m <msg>] [-e] <file>... 'git-commit' [-a] [-s] [-v] [(-c | -C) <commit> | -F <file> | -m <msg>] [-e] <file>...


DESCRIPTION DESCRIPTION
----------- -----------

5
Documentation/git-convert-objects.txt

@ -1,10 +1,9 @@
git-convert-objects(1) git-convert-objects(1)
====================== ======================
v0.1, May 2005


NAME NAME
---- ----
git-convert-objects - Converts old-style GIT repository git-convert-objects - Converts old-style git repository




SYNOPSIS SYNOPSIS
@ -13,7 +12,7 @@ SYNOPSIS


DESCRIPTION DESCRIPTION
----------- -----------
Converts old-style GIT repository to the latest format Converts old-style git repository to the latest format




Author Author

5
Documentation/git-cvsimport.txt

@ -1,6 +1,5 @@
git-cvsimport(1) git-cvsimport(1)
================ ================
v0.1, July 2005


NAME NAME
---- ----
@ -11,7 +10,7 @@ SYNOPSIS
-------- --------
'git-cvsimport' [ -o <branch-for-HEAD> ] [ -h ] [ -v ] 'git-cvsimport' [ -o <branch-for-HEAD> ] [ -h ] [ -v ]
[ -d <CVSROOT> ] [ -p <options-for-cvsps> ] [ -d <CVSROOT> ] [ -p <options-for-cvsps> ]
[ -C <GIT_repository> ] [ -i ] [ -k ] [ -C <git_repository> ] [ -i ] [ -k ]
[ -s <subst> ] [ -m ] [ -M regex ] [ <CVS_module> ] [ -s <subst> ] [ -m ] [ -M regex ] [ <CVS_module> ]




@ -31,7 +30,7 @@ OPTIONS
are supported. are supported.


-C <target-dir>:: -C <target-dir>::
The GIT repository to import to. If the directory doesn't The git repository to import to. If the directory doesn't
exist, it will be created. Default is the current directory. exist, it will be created. Default is the current directory.


-i:: -i::

24
Documentation/git-daemon.txt

@ -3,11 +3,12 @@ git-daemon(1)


NAME NAME
---- ----
git-daemon - A really simple server for GIT repositories. git-daemon - A really simple server for git repositories.


SYNOPSIS SYNOPSIS
-------- --------
'git-daemon' [--verbose] [--syslog] [--inetd | --port=n] 'git-daemon' [--verbose] [--syslog] [--inetd | --port=n] [--export-all]
[--timeout=n] [--init-timeout=n] [directory...]


DESCRIPTION DESCRIPTION
----------- -----------
@ -20,18 +21,35 @@ what directory to upload, and it verifies that the directory is ok.


It verifies that the directory has the magic file "git-daemon-export-ok", and 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 it will refuse to export any git directory that hasn't explicitly been marked
for export this way. 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
the offers to a whitelist comprising of those.


This is ideally suited for read-only updates, ie pulling from git repositories. This is ideally suited for read-only updates, ie pulling from git repositories.


OPTIONS OPTIONS
------- -------
--export-all::
Allow pulling from all directories that look like GIT repositories
(have the 'objects' subdirectory and a 'HEAD' file), even if they
do not have the 'git-daemon-export-ok' file.

--inetd:: --inetd::
Have the server run as an inetd service. Have the server run as an inetd service.


--port:: --port::
Listen on an alternative port. Listen on an alternative port.


--init-timeout::
Timeout between the moment the connection is established and the
client request is received (typically a rather low value, since
that should be basically immediate).

--timeout::
Timeout for specific client sub-requests. This includes the time
it takes for the server to process the sub-request and time spent
waiting for next client's request.

--syslog:: --syslog::
Log to syslog instead of stderr. Note that this option does not imply Log to syslog instead of stderr. Note that this option does not imply
--verbose, thus by default only error conditions will be logged. --verbose, thus by default only error conditions will be logged.

1
Documentation/git-diff-files.txt

@ -1,6 +1,5 @@
git-diff-files(1) git-diff-files(1)
================= =================
v0.1, May 2005


NAME NAME
---- ----

1
Documentation/git-diff-index.txt

@ -1,6 +1,5 @@
git-diff-index(1) git-diff-index(1)
================= =================
v0.1, May 2005


NAME NAME
---- ----

1
Documentation/git-diff-stages.txt

@ -1,6 +1,5 @@
git-diff-stages(1) git-diff-stages(1)
================== ==================
v0.1, June 2005


NAME NAME
---- ----

6
Documentation/git-diff-tree.txt

@ -1,6 +1,5 @@
git-diff-tree(1) git-diff-tree(1)
================ ================
v0.1, May 2005


NAME NAME
---- ----
@ -9,7 +8,7 @@ git-diff-tree - Compares the content and mode of blobs found via two tree object


SYNOPSIS SYNOPSIS
-------- --------
'git-diff-tree' [--stdin] [-m] [-s] [-v] [--pretty] [-t] [<common diff options>] <tree-ish> [<tree-ish>] [<path>...] 'git-diff-tree' [--stdin] [-m] [-s] [-v] [--pretty] [-t] [-r] [--root] [<common diff options>] <tree-ish> [<tree-ish>] [<path>...]


DESCRIPTION DESCRIPTION
----------- -----------
@ -34,6 +33,9 @@ include::diff-options.txt[]
Note that this parameter does not provide any wildcard or regexp Note that this parameter does not provide any wildcard or regexp
features. features.


-r::
recurse into sub-trees

-t:: -t::
show tree entry itself as well as subtrees. Implies -r. show tree entry itself as well as subtrees. Implies -r.



3
Documentation/git-fetch-pack.txt

@ -1,6 +1,5 @@
git-fetch-pack(1) git-fetch-pack(1)
================= =================
v0.1, July 2005


NAME NAME
---- ----
@ -35,7 +34,7 @@ OPTIONS
remote side, if is not found on your $PATH. remote side, if is not found on your $PATH.
Installations of sshd ignores the user's environment Installations of sshd ignores the user's environment
setup scripts for login shells (e.g. .bash_profile) and setup scripts for login shells (e.g. .bash_profile) and
your privately installed GIT may not be found on the system your privately installed git may not be found on the system
default $PATH. Another workaround suggested is to set default $PATH. Another workaround suggested is to set
up your $PATH in ".bashrc", but this flag is for people up your $PATH in ".bashrc", but this flag is for people
who do not want to pay the overhead for non-interactive who do not want to pay the overhead for non-interactive

6
Documentation/git-fetch.txt

@ -1,6 +1,5 @@
git-fetch(1) git-fetch(1)
============ ============
v0.99.5, Aug 2005


NAME NAME
---- ----
@ -26,6 +25,11 @@ OPTIONS
------- -------
include::pull-fetch-param.txt[] include::pull-fetch-param.txt[]


-a, \--append::
Append ref names and object names of fetched refs to the
existing contents of $GIT_DIR/FETCH_HEAD. Without this
option old data in $GIT_DIR/FETCH_HEAD will be overwritten.

-u, \--update-head-ok:: -u, \--update-head-ok::
By default 'git-fetch' refuses to update the head which By default 'git-fetch' refuses to update the head which
corresponds to the current branch. This flag disables the corresponds to the current branch. This flag disables the

6
Documentation/git-format-patch.txt

@ -8,7 +8,7 @@ git-format-patch - Prepare patches for e-mail submission.


SYNOPSIS SYNOPSIS
-------- --------
'git-format-patch' [-n][-o <dir>][-k][--mbox][--diff-options] <his> [<mine>] 'git-format-patch' [-n][-o <dir>|--stdout][-k][--mbox][--diff-options] <his> [<mine>]


DESCRIPTION DESCRIPTION
----------- -----------
@ -54,6 +54,10 @@ OPTIONS
concatenated together and fed to `git-applymbox`. concatenated together and fed to `git-applymbox`.
Implies --author and --date. Implies --author and --date.


--stdout::
This flag generates the mbox formatted output to the
standard output, instead of saving them into a file per
patch and implies --mbox.


Author Author
------ ------

11
Documentation/git-fsck-objects.txt

@ -1,6 +1,5 @@
git-fsck-objects(1) git-fsck-objects(1)
=================== ===================
v0.1, May 2005


NAME NAME
---- ----
@ -42,22 +41,22 @@ index file and all SHA1 references in .git/refs/* as heads.
($GIT_DIR/objects), making sure that it is consistent and ($GIT_DIR/objects), making sure that it is consistent and
complete without referring to objects found in alternate complete without referring to objects found in alternate
object pools listed in GIT_ALTERNATE_OBJECT_DIRECTORIES, object pools listed in GIT_ALTERNATE_OBJECT_DIRECTORIES,
nor packed GIT archives found in $GIT_DIR/objects/pack; nor packed git archives found in $GIT_DIR/objects/pack;
cannot be used with --full. cannot be used with --full.


--full:: --full::
Check not just objects in GIT_OBJECT_DIRECTORY Check not just objects in GIT_OBJECT_DIRECTORY
($GIT_DIR/objects), but also the ones found in alternate ($GIT_DIR/objects), but also the ones found in alternate
object pools listed in GIT_ALTERNATE_OBJECT_DIRECTORIES, object pools listed in GIT_ALTERNATE_OBJECT_DIRECTORIES,
and in packed GIT archives found in $GIT_DIR/objects/pack and in packed git archives found in $GIT_DIR/objects/pack
and corresponding pack subdirectories in alternate and corresponding pack subdirectories in alternate
object pools; cannot be used with --standalone. object pools; cannot be used with --standalone.


--strict:: --strict::
Enable more strict checking, namely to catch a file mode Enable more strict checking, namely to catch a file mode
recorded with g+w bit set, which was created by older recorded with g+w bit set, which was created by older
versions of GIT. Existing repositories, including the versions of git. Existing repositories, including the
Linux kernel, GIT itself, and sparse repository have old Linux kernel, git itself, and sparse repository have old
objects that triggers this check, but it is recommended objects that triggers this check, but it is recommended
to check new projects with this flag. to check new projects with this flag.


@ -81,7 +80,7 @@ Any corrupt objects you will have to find in backups or other archives
the hopes that somebody else has the object you have corrupted). 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 Of course, "valid tree" doesn't mean that it wasn't generated by some
evil person, and the end result might be crap. Git is a revision evil person, and the end result might be crap. git is a revision
tracking system, not a quality assurance system ;) tracking system, not a quality assurance system ;)


Extracted Diagnostics Extracted Diagnostics

1
Documentation/git-grep.txt

@ -1,6 +1,5 @@
git-grep(1) git-grep(1)
=========== ===========
v0.99.6, Sep 2005


NAME NAME
---- ----

1
Documentation/git-hash-object.txt

@ -1,6 +1,5 @@
git-hash-object(1) git-hash-object(1)
================== ==================
v0.1, May 2005


NAME NAME
---- ----

5
Documentation/git-http-fetch.txt

@ -1,10 +1,9 @@
git-http-fetch(1) git-http-fetch(1)
================= =================
v0.1, May 2005


NAME NAME
---- ----
git-http-fetch - Downloads a remote GIT repository via HTTP git-http-fetch - Downloads a remote git repository via HTTP




SYNOPSIS SYNOPSIS
@ -13,7 +12,7 @@ SYNOPSIS


DESCRIPTION DESCRIPTION
----------- -----------
Downloads a remote GIT repository via HTTP. Downloads a remote git repository via HTTP.


-c:: -c::
Get the commit objects. Get the commit objects.

44
Documentation/git-index-pack.txt

@ -0,0 +1,44 @@
git-index-pack(1)
=================

NAME
----
git-index-pack - Build pack index file for an existing packed archive


SYNOPSIS
--------
'git-index-pack' [-o <index-file>] <pack-file>


DESCRIPTION
-----------
Reads a packed archive (.pack) from the specified file, and
builds a pack index file (.idx) for it. The packed archive
together with the pack index can then be placed in the
objects/pack/ directory of a git repository.


OPTIONS
-------
-o <index-file>::
Write the generated pack index into the specified
file. Without this option the name of pack index
file is constructed from the name of packed archive
file by replacing .pack with .idx (and the program
fails if the name of packed archive does not end
with .pack).


Author
------
Written by Sergey Vlasov <vsu@altlinux.ru>

Documentation
-------------
Documentation by Sergey Vlasov

GIT
---
Part of the gitlink:git[7] suite

1
Documentation/git-init-db.txt

@ -1,6 +1,5 @@
git-init-db(1) git-init-db(1)
============== ==============
v0.1, May 2005


NAME NAME
---- ----

5
Documentation/git-local-fetch.txt

@ -1,10 +1,9 @@
git-local-fetch(1) git-local-fetch(1)
================== ==================
v0.1, May 2005


NAME NAME
---- ----
git-local-fetch - Duplicates another GIT repository on a local system git-local-fetch - Duplicates another git repository on a local system




SYNOPSIS SYNOPSIS
@ -13,7 +12,7 @@ SYNOPSIS


DESCRIPTION DESCRIPTION
----------- -----------
Duplicates another GIT repository on a local system. Duplicates another git repository on a local system.


OPTIONS OPTIONS
------- -------

3
Documentation/git-log.txt

@ -1,6 +1,5 @@
git-log(1) git-log(1)
========== ==========
v0.99.4, Aug 2005


NAME NAME
---- ----
@ -9,7 +8,7 @@ git-log - Show commit logs


SYNOPSIS SYNOPSIS
-------- --------
'git log' <option>... 'git-log' <option>...


DESCRIPTION DESCRIPTION
----------- -----------

6
Documentation/git-ls-files.txt

@ -54,7 +54,7 @@ OPTIONS
succeed. succeed.


-z:: -z::
\0 line termination on output \0 line termination on output.


-x|--exclude=<pattern>:: -x|--exclude=<pattern>::
Skips files matching pattern. Skips files matching pattern.
@ -100,6 +100,10 @@ the dircache records up to three such pairs; one from tree O in stage
the user (or the porcelain) to see what should eventually be recorded at the 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 git-read-tree for more information on state)


When `-z` option is not used, TAB, LF, and backslash characters
in pathnames are represented as `\t`, `\n`, and `\\`,
respectively.



Exclude Patterns Exclude Patterns
---------------- ----------------

1
Documentation/git-ls-remote.txt

@ -1,6 +1,5 @@
git-ls-remote(1) git-ls-remote(1)
================ ================
v0.1, May 2005


NAME NAME
---- ----

5
Documentation/git-ls-tree.txt

@ -1,6 +1,5 @@
git-ls-tree(1) git-ls-tree(1)
============== ==============
v0.1, May 2005


NAME NAME
---- ----
@ -39,6 +38,10 @@ Output Format
------------- -------------
<mode> SP <type> SP <object> TAB <file> <mode> SP <type> SP <object> TAB <file>


When `-z` option is not used, TAB, LF, and backslash characters
in pathnames are represented as `\t`, `\n`, and `\\`,
respectively.



Author Author
------ ------

13
Documentation/git-mailsplit.txt

@ -7,7 +7,7 @@ git-mailsplit - Totally braindamaged mbox splitter program.


SYNOPSIS SYNOPSIS
-------- --------
'git-mailsplit' <mbox> <directory> 'git-mailsplit' [-d<prec>] [<mbox>] <directory>


DESCRIPTION DESCRIPTION
----------- -----------
@ -17,14 +17,23 @@ directory so you can process them further from there.
OPTIONS OPTIONS
------- -------
<mbox>:: <mbox>::
Mbox file to split. Mbox file to split. If not given, the mbox is read from
the standard input.


<directory>:: <directory>::
Directory in which to place the individual messages. Directory in which to place the individual messages.


-d<prec>::
Instead of the default 4 digits with leading zeros,
different precision can be specified for the generated
filenames.


Author Author
------ ------
Written by Linus Torvalds <torvalds@osdl.org> Written by Linus Torvalds <torvalds@osdl.org>
and Junio C Hamano <junkio@cox.net>



Documentation Documentation
-------------- --------------

1
Documentation/git-merge-base.txt

@ -1,6 +1,5 @@
git-merge-base(1) git-merge-base(1)
================= =================
v0.1, May 2005


NAME NAME
---- ----

1
Documentation/git-merge-index.txt

@ -1,6 +1,5 @@
git-merge-index(1) git-merge-index(1)
================== ==================
v0.1, May 2005


NAME NAME
---- ----

1
Documentation/git-merge-one-file.txt

@ -1,6 +1,5 @@
git-merge-one-file(1) git-merge-one-file(1)
===================== =====================
v0.99.4, Aug 2005


NAME NAME
---- ----

1
Documentation/git-merge.txt

@ -1,6 +1,5 @@
git-merge(1) git-merge(1)
============ ============
v0.99.6, Sep 2005


NAME NAME
---- ----

1
Documentation/git-mktag.txt

@ -1,6 +1,5 @@
git-mktag(1) git-mktag(1)
============ ============
v0.1, May 2005


NAME NAME
---- ----

51
Documentation/git-mv.txt

@ -0,0 +1,51 @@
git-mv(1)
=========

NAME
----
git-mv - Script used to move or rename a file, directory or symlink.


SYNOPSIS
--------
'git-mv' [-f] [-n] <source> <destination>
'git-mv' [-f] [-k] [-n] <source> ... <destination directory>

DESCRIPTION
-----------
This script is used to move or rename a file, directory or symlink.
In the first form, it renames <source>, which must exist and be either
a file, symlink or directory, to <destination>, which must not exist.
In the second form, the last argument has to be an existing
directory; the given sources will be moved into this directory.

The index is updated after successful completion, but the change must still be
committed.

OPTIONS
-------
-f::
Force renaming or moving even targets exist
-k::
Skip move or rename actions which would lead to an error
condition. An error happens when a source is neither existing nor
controlled by GIT, or when it would overwrite an existing
file unless '-f' is given.
-n::
Do nothing; only show what would happen


Author
------
Written by Linus Torvalds <torvalds@osdl.org>
Rewritten by Ryan Anderson <ryan@michonline.com>
Move functionality added by Josef Weidendorfer <Josef.Weidendorfer@gmx.de>

Documentation
--------------
Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.

GIT
---
Part of the gitlink:git[7] suite

66
Documentation/git-name-rev.txt

@ -0,0 +1,66 @@
git-name-rev(1)
===============

NAME
----
git-name-rev - Find symbolic names for given revs.


SYNOPSIS
--------
'git-name-rev' [--tags] ( --all | --stdin | <commitish>... )

DESCRIPTION
-----------
Finds symbolic names suitable for human digestion for revisions given in any
format parsable by git-rev-parse.


OPTIONS
-------

--tags::
Do not use branch names, but only tags to name the commits

--all::
List all commits reachable from all refs

--stdin::
Read from stdin, append "(<rev_name>)" to all sha1's of name'able
commits, and pass to stdout

EXAMPLE
-------

Given a commit, find out where it is relative to the local refs. Say somebody
wrote you about that phantastic commit 33db5f4d9027a10e477ccf054b2c1ab94f74c85a.
Of course, you look into the commit, but that only tells you what happened, but
not the context.

Enter git-name-rev:

------------
% git name-rev 33db5f4d9027a10e477ccf054b2c1ab94f74c85a
------------

Now you are wiser, because you know that it happened 940 revisions before v0.99.

Another nice thing you can do is:

------------
% git log | git name-rev --stdin
------------


Author
------
Written by Johannes Schindelin <Johannes.Schindelin@gmx.de>

Documentation
--------------
Documentation by Johannes Schindelin.

GIT
---
Part of the gitlink:git[7] suite

1
Documentation/git-octopus.txt

@ -1,6 +1,5 @@
git-octopus(1) git-octopus(1)
============== ==============
v0.99.5, Aug 2005


NAME NAME
---- ----

10
Documentation/git-pack-objects.txt

@ -1,6 +1,5 @@
git-pack-objects(1) git-pack-objects(1)
=================== ===================
v0.1, July 2005


NAME NAME
---- ----
@ -9,7 +8,7 @@ git-pack-objects - Create a packed archive of objects.


SYNOPSIS SYNOPSIS
-------- --------
'git-pack-objects' [--incremental] [--window=N] [--depth=N] {--stdout | base-name} < object-list 'git-pack-objects' [--local] [--incremental] [--window=N] [--depth=N] {--stdout | base-name} < object-list




DESCRIPTION DESCRIPTION
@ -31,7 +30,7 @@ transport by their peers.


Placing both in the pack/ subdirectory of $GIT_OBJECT_DIRECTORY (or Placing both in the pack/ subdirectory of $GIT_OBJECT_DIRECTORY (or
any of the directories on $GIT_ALTERNATE_OBJECT_DIRECTORIES) any of the directories on $GIT_ALTERNATE_OBJECT_DIRECTORIES)
enables GIT to read from such an archive. enables git to read from such an archive.




OPTIONS OPTIONS
@ -65,6 +64,11 @@ base-name::
This flag causes an object already in a pack ignored This flag causes an object already in a pack ignored
even if it appears in the standard input. even if it appears in the standard input.


--local::
This flag is similar to `--incremental`; instead of
ignoring all packed objects, it only ignores objects
that are packed and not in the local object store
(i.e. borrowed from an alternate).


Author Author
------ ------

6
Documentation/git-patch-id.txt

@ -18,6 +18,12 @@ ID" are almost guaranteed to be the same thing.


IOW, you can use this thing to look for likely duplicate commits. IOW, you can use this thing to look for likely duplicate commits.


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.
This can be used to make a mapping from patch ID to commit ID.

OPTIONS OPTIONS
------- -------
<patch>:: <patch>::

3
Documentation/git-peek-remote.txt

@ -1,6 +1,5 @@
git-peek-remote(1) git-peek-remote(1)
================== ==================
v0.1, July 2005


NAME NAME
---- ----
@ -23,7 +22,7 @@ OPTIONS
remote side, if it is not found on your $PATH. Some remote side, if it is not found on your $PATH. Some
installations of sshd ignores the user's environment installations of sshd ignores the user's environment
setup scripts for login shells (e.g. .bash_profile) and setup scripts for login shells (e.g. .bash_profile) and
your privately installed GIT may not be found on the system your privately installed git may not be found on the system
default $PATH. Another workaround suggested is to set default $PATH. Another workaround suggested is to set
up your $PATH in ".bashrc", but this flag is for people up your $PATH in ".bashrc", but this flag is for people
who do not want to pay the overhead for non-interactive who do not want to pay the overhead for non-interactive

1
Documentation/git-prune-packed.txt

@ -1,6 +1,5 @@
git-prune-packed(1) git-prune-packed(1)
===================== =====================
v0.1, August 2005


NAME NAME
---- ----

1
Documentation/git-prune.txt

@ -1,6 +1,5 @@
git-prune(1) git-prune(1)
============ ============
v0.99.5, Aug 2005


NAME NAME
---- ----

5
Documentation/git-pull.txt

@ -1,6 +1,5 @@
git-pull(1) git-pull(1)
=========== ===========
v0.99.4, Aug 2005


NAME NAME
---- ----
@ -25,6 +24,10 @@ OPTIONS
------- -------
include::pull-fetch-param.txt[] include::pull-fetch-param.txt[]


-a, \--append::
Append ref names and object names of fetched refs to the
existing contents of $GIT_DIR/FETCH_HEAD. Without this
option old data in $GIT_DIR/FETCH_HEAD will be overwritten.


Author Author
------ ------

9
Documentation/git-push.txt

@ -21,6 +21,15 @@ OPTIONS
------- -------
include::pull-fetch-param.txt[] include::pull-fetch-param.txt[]


\--all::
Instead of naming each ref to push, specifies all refs
to be pushed.

-f, \--force::
Usually, the command refuses to update a local ref that is
not an ancestor of the remote ref used to overwrite it.
This flag disables the check. What this means is that the
local repository can lose commits; use it with care.


Author Author
------ ------

1
Documentation/git-read-tree.txt

@ -1,6 +1,5 @@
git-read-tree(1) git-read-tree(1)
================ ================
v0.1, May 2005


NAME NAME
---- ----

1
Documentation/git-receive-pack.txt

@ -1,6 +1,5 @@
git-receive-pack(1) git-receive-pack(1)
=================== ===================
v0.1, July 2005


NAME NAME
---- ----

1
Documentation/git-rename.txt

@ -1,6 +1,5 @@
git-rename(1) git-rename(1)
============= =============
v0.1, May 2005


NAME NAME
---- ----

1
Documentation/git-repack.txt

@ -1,6 +1,5 @@
git-repack(1) git-repack(1)
============= =============
v0.99.5, August 2005


NAME NAME
---- ----

3
Documentation/git-resolve.txt

@ -1,6 +1,5 @@
git-resolve(1) git-resolve(1)
============== ==============
v0.99.5, Aug 2005


NAME NAME
---- ----
@ -9,7 +8,7 @@ git-resolve - Merge two commits


SYNOPSIS SYNOPSIS
-------- --------
'git resolve' <current> <merged> <message> 'git-resolve' <current> <merged> <message>


DESCRIPTION DESCRIPTION
----------- -----------

57
Documentation/git-rev-list.txt

@ -1,6 +1,5 @@
git-rev-list(1) git-rev-list(1)
=============== ===============
v0.1, May 2005


NAME NAME
---- ----
@ -9,7 +8,18 @@ git-rev-list - Lists commit objects in reverse chronological order


SYNOPSIS SYNOPSIS
-------- --------
'git-rev-list' [ *--max-count*=number ] [ *--max-age*=timestamp ] [ *--min-age*=timestamp ] [ *--bisect* ] [ *--pretty* ] [ *--objects* ] [ *--merge-order* [ *--show-breaks* ] ] <commit> [ <commit> ...] [ ^<commit> ...] 'git-rev-list' [ \--max-count=number ]
[ \--max-age=timestamp ]
[ \--min-age=timestamp ]
[ \--sparse ]
[ \--no-merges ]
[ \--all ]
[ [ \--merge-order [ \--show-breaks ] ] | [ \--topo-order ] | ]
[ \--parents ]
[ \--objects [ \--unpacked ] ]
[ \--pretty | \--header | ]
[ \--bisect ]
<commit>... [ \-- <paths>... ]


DESCRIPTION DESCRIPTION
----------- -----------
@ -17,22 +27,34 @@ Lists commit objects in reverse chronological order starting at the
given commit(s), taking ancestry relationship into account. This is given commit(s), taking ancestry relationship into account. This is
useful to produce human-readable log output. useful to produce human-readable log output.


Commits which are stated with a preceding '^' cause listing to stop at Commits which are stated with a preceding '{caret}' cause listing to stop at
that point. Their parents are implied. "git-rev-list foo bar ^baz" thus that point. Their parents are implied. "git-rev-list foo bar {caret}baz" thus
means "list all the commits which are included in 'foo' and 'bar', but means "list all the commits which are included in 'foo' and 'bar', but
not in 'baz'". not in 'baz'".


A special notation <commit1>..<commit2> can be used as a
short-hand for {caret}<commit1> <commit2>.


OPTIONS OPTIONS
------- -------
--pretty:: --pretty::
Print the contents of the commit changesets in human-readable form. Print the contents of the commit changesets in human-readable form.


--header::
Print the contents of the commit in raw-format; each
record is separated with a NUL character.

--objects:: --objects::
Print the object IDs of any object referenced by the listed commits. Print the object IDs of any object referenced by the listed commits.
'git-rev-list --objects foo ^bar' thus means "send me all object IDs 'git-rev-list --objects foo ^bar' thus means "send me all object IDs
which I need to download if I have the commit object 'bar', but which I need to download if I have the commit object 'bar', but
not 'foo'". not 'foo'".


--unpacked::
Only useful with `--objects`; print the object IDs that
are not in packs.

--bisect:: --bisect::
Limit output to the one commit object which is roughly halfway Limit output to the one commit object which is roughly halfway
between the included and excluded commits. Thus, if 'git-rev-list between the included and excluded commits. Thus, if 'git-rev-list
@ -43,6 +65,30 @@ OPTIONS
repeatedly generate and test new 'midpoint's until the commit chain repeatedly generate and test new 'midpoint's until the commit chain
is of length one. is of length one.


--max-count::
Limit the number of commits output.

--max-age=timestamp, --min-age=timestamp::
Limit the commits output to specified time range.

--sparse::
When optional paths are given, the command outputs only
the commits that changes at least one of them, and also
ignores merges that do not touch the given paths. This
flag makes the command output all eligible commits
(still subject to count and age limitation), but apply
merge simplification nevertheless.

--all::
Pretend as if all the refs in `$GIT_DIR/refs/` are
listed on the command line as <commit>.

--topo-order::
By default, the commits are shown in reverse
chronological order. This option makes them appear in
topological order (i.e. descendant commits are shown
before their parents).

--merge-order:: --merge-order::
When specified the commit history is decomposed into a unique When specified the commit history is decomposed into a unique
sequence of minimal, non-linear epochs and maximal, linear epochs. sequence of minimal, non-linear epochs and maximal, linear epochs.
@ -85,7 +131,8 @@ Commits marked with (^) are not parents of the immediately preceding commit.
These "breaks" represent necessary discontinuities implied by trying to These "breaks" represent necessary discontinuities implied by trying to
represent an arbtirary DAG in a linear form. represent an arbtirary DAG in a linear form.
+ +
*--show-breaks* is only valid if *--merge-order* is also specified. `--show-breaks` is only valid if `--merge-order` is also specified.



Author Author
------ ------

19
Documentation/git-rev-parse.txt

@ -79,8 +79,9 @@ OPTIONS
SPECIFYING REVISIONS SPECIFYING REVISIONS
-------------------- --------------------


A revision parameter typically names a commit object. They use A revision parameter typically, but not necessarily, names a
what is called an 'extended SHA1' syntax. commit object. They use what is called an 'extended SHA1'
syntax.


* The full SHA1 object name (40-byte hexadecimal string), or * The full SHA1 object name (40-byte hexadecimal string), or
a substring of such that is unique within the repository. a substring of such that is unique within the repository.
@ -91,7 +92,7 @@ what is called an 'extended SHA1' syntax.
* A symbolic ref name. E.g. 'master' typically means the commit * A symbolic ref name. E.g. 'master' typically means the commit
object referenced by $GIT_DIR/refs/heads/master. If you object referenced by $GIT_DIR/refs/heads/master. If you
happen to have both heads/master and tags/master, you can happen to have both heads/master and tags/master, you can
explicitly say 'heads/master' to tell GIT which one you mean. explicitly say 'heads/master' to tell git which one you mean.


* A suffix '{caret}' to a revision parameter means the first parent of * A suffix '{caret}' to a revision parameter means the first parent of
that commit object. '{caret}<n>' means the <n>th parent (i.e. that commit object. '{caret}<n>' means the <n>th parent (i.e.
@ -106,6 +107,18 @@ what is called an 'extended SHA1' syntax.
equivalent to rev{caret}{caret}{caret} which is equivalent to\ equivalent to rev{caret}{caret}{caret} which is equivalent to\
rev{caret}1{caret}1{caret}1. rev{caret}1{caret}1{caret}1.


* A suffix '{caret}' followed by an object type name enclosed in
brace pair (e.g. `v0.99.8{caret}\{commit\}`) means the object
could be a tag, and dereference the tag recursively until an
object of that type is found or the object cannot be
dereferenced anymore (in which case, barf). `rev{caret}0`
introduced earlier is a short-hand for `rev{caret}\{commit\}`.

* A suffix '{caret}' followed by an empty brace pair
(e.g. `v0.99.8{caret}\{\}`) means the object could be a tag,
and dereference the tag recursively until a non-tag object is
found.

'git-rev-parse' also accepts a prefix '{caret}' to revision parameter, 'git-rev-parse' also accepts a prefix '{caret}' to revision parameter,
which is passed to 'git-rev-list'. Two revision parameters which is passed to 'git-rev-list'. Two revision parameters
concatenated with '..' is a short-hand for writing a range concatenated with '..' is a short-hand for writing a range

1
Documentation/git-send-email.txt

@ -1,6 +1,5 @@
git-send-email(1) git-send-email(1)
================= =================
v0.1, July 2005


NAME NAME
---- ----

1
Documentation/git-send-pack.txt

@ -1,6 +1,5 @@
git-send-pack(1) git-send-pack(1)
================ ================
v0.1, July 2005


NAME NAME
---- ----

35
Documentation/git-shell.txt

@ -0,0 +1,35 @@
git-shell(1)
============

NAME
----
git-shell - Restricted login shell for GIT over SSH only


SYNOPSIS
--------
'git-shell -c <command> <argument>'

DESCRIPTION
-----------
This is meant to be used as a login shell for SSH accounts you want
to restrict to GIT pull/push access only. It permits execution only
of server-side GIT commands implementing the pull/push functionality.
The commands can be executed only by the '-c' option; the shell is not
interactive.

Currently, only the `git-receive-pack` and `git-upload-pack` commands
are permitted to be called, with a single required argument.

Author
------
Written by Linus Torvalds <torvalds@osdl.org>

Documentation
--------------
Documentation by Petr Baudis and the git-list <git@vger.kernel.org>.

GIT
---
Part of the gitlink:git[7] suite

3
Documentation/git-shortlog.txt

@ -1,6 +1,5 @@
git-shortlog(1) git-shortlog(1)
=============== ===============
v0.99.4, Aug 2005


NAME NAME
---- ----
@ -9,7 +8,7 @@ git-shortlog - Summarize 'git log' output.


SYNOPSIS SYNOPSIS
-------- --------
'git log --pretty=short | git shortlog' 'git-log --pretty=short | git shortlog'


DESCRIPTION DESCRIPTION
----------- -----------

27
Documentation/git-show-branch.txt

@ -1,6 +1,5 @@
git-show-branch(1) git-show-branch(1)
================== ==================
v0.99.5, Aug 2005


NAME NAME
---- ----
@ -8,7 +7,7 @@ git-show-branch - Show branches and their commits.


SYNOPSIS SYNOPSIS
-------- --------
'git show-branch [--all] [--heads] [--tags] [--more=<n> | --list | --independent | --merge-base] <reference>...' 'git-show-branch [--all] [--heads] [--tags] [--more=<n> | --list | --independent | --merge-base] [--no-name | --sha1-name] <reference>...'


DESCRIPTION DESCRIPTION
----------- -----------
@ -45,6 +44,15 @@ OPTIONS
Among the <reference>s given, display only the ones that Among the <reference>s given, display only the ones that
cannot be reached from any other <reference>. cannot be reached from any other <reference>.


--no-name::
Do not show naming strings for each commit.

--sha1-name::
Instead of naming the commits using the path to reach
them from heads (e.g. "master~2" to mean the grandparent
of "master"), name them with the unique prefix of their
object names.

Note that --more, --list, --independent and --merge-base options Note that --more, --list, --independent and --merge-base options
are mutually exclusive. are mutually exclusive.


@ -89,21 +97,6 @@ whose commit message is "Add 'git show-branch'. "fixes" branch
adds one commit 'Introduce "reset type"'. "mhf" branch has many adds one commit 'Introduce "reset type"'. "mhf" branch has many
other commits. other commits.


When only one head is given, the output format changes slightly
to conserve space. The '+' sign to show which commit is
reachable from which head and the first N lines to show the list
of heads being displayed are both meaningless so they are
omitted. Also the label given to each commit does not repeat
the name of the branch because it is obvious.

------------------------------------------------
$ git show-branch --more=4 master
[master] Add 'git show-branch'.
[~1] Add a new extended SHA1 syntax <name>~<num>
[~2] Fix "git-diff A B"
[~3] git-ls-files: generalized pathspecs
[~4] Make "git-ls-files" work in subdirectories
------------------------------------------------


Author Author
------ ------

3
Documentation/git-show-index.txt

@ -1,6 +1,5 @@
git-show-index(1) git-show-index(1)
================= =================
v0.1, July 2005


NAME NAME
---- ----
@ -14,7 +13,7 @@ SYNOPSIS


DESCRIPTION DESCRIPTION
----------- -----------
Reads given idx file for packed GIT archive created with 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 The information it outputs is subset of what you can get from

1
Documentation/git-ssh-fetch.txt

@ -1,6 +1,5 @@
git-ssh-fetch(1) git-ssh-fetch(1)
================ ================
v0.1, May 2005


NAME NAME
---- ----

1
Documentation/git-ssh-upload.txt

@ -1,6 +1,5 @@
git-ssh-upload(1) git-ssh-upload(1)
================= =================
v0.1, Jun 2005


NAME NAME
---- ----

3
Documentation/git-status.txt

@ -1,6 +1,5 @@
git-status(1) git-status(1)
============= =============
v0.99.4, Aug 2005


NAME NAME
---- ----
@ -9,7 +8,7 @@ git-status - Show working tree status.


SYNOPSIS SYNOPSIS
-------- --------
'git status' 'git-status'


DESCRIPTION DESCRIPTION
----------- -----------

137
Documentation/git-svnimport.txt

@ -0,0 +1,137 @@
git-svnimport(1)
================
v0.1, July 2005

NAME
----
git-svnimport - Import a SVN repository into git


SYNOPSIS
--------
'git-svnimport' [ -o <branch-for-HEAD> ] [ -h ] [ -v ] [ -d | -D ]
[ -C <GIT_repository> ] [ -i ] [ -u ] [-l limit_nr_changes]
[ -b branch_subdir ] [ -t trunk_subdir ] [ -T tag_subdir ]
[ -s start_chg ] [ -m ] [ -M regex ]
<SVN_repository_URL> [ <path> ]


DESCRIPTION
-----------
Imports a SVN repository into git. It will either create a new
repository, or incrementally import into an existing one.

SVN access is done by the SVN:: Perl module.

git-svnimport assumes that SVN repositories are organized into one
"trunk" directory where the main development happens, "branch/FOO"
directories for branches, and "/tags/FOO" directories for tags.
Other subdirectories are ignored.

git-svnimport creates a file ".git/svn2git", which is required for
incremental SVN imports.

OPTIONS
-------
-C <target-dir>::
The GIT repository to import to. If the directory doesn't
exist, it will be created. Default is the current directory.

-s <start_rev>::
Start importing at this SVN change number. The default is 1.
+
When importing incementally, you might need to edit the .git/svn2git file.

-i::
Import-only: don't perform a checkout after importing. This option
ensures the working directory and cache remain untouched and will
not create them if they do not exist.

-t <trunk_subdir>::
Name the SVN trunk. Default "trunk".

-T <tag_subdir>::
Name the SVN subdirectory for tags. Default "tags".

-b <branch_subdir>::
Name the SVN subdirectory for branches. Default "branches".

-o <branch-for-HEAD>::
The 'trunk' branch from SVN is imported to the 'origin' branch within
the git repository. Use this option if you want to import into a
different branch.

-m::
Attempt to detect merges based on the commit message. This option
will enable default regexes that try to capture the name source
branch name from the commit message.

-M <regex>::
Attempt to detect merges based on the commit message with a custom
regex. It can be used with -m to also see the default regexes.
You must escape forward slashes.

-l <max_num_changes>::
Limit the number of SVN changesets we pull before quitting.
This option is necessary because the SVN library has serious memory
leaks; the recommended value for nontrivial imports is 100.

git-svnimport will still exit with a zero exit code. You can check
the size of the file ".git/svn2git" to determine whether to call
the importer again.

-v::
Verbosity: let 'svnimport' report what it is doing.

-d::
Use direct HTTP requests if possible. The "<path>" argument is used
only for retrieving the SVN logs; the path to the contents is
included in the SVN log.

-D::
Use direct HTTP requests if possible. The "<path>" argument is used
for retrieving the logs, as well as for the contents.
+
There's no safe way to automatically find out which of these options to
use, so you need to try both. Usually, the one that's wrong will die
with a 40x error pretty quickly.

<SVN_repository_URL>::
The URL of the SVN module you want to import. For local
repositories, use "file:///absolute/path".
+
If you're using the "-d" or "-D" option, this is the URL of the SVN
repository itself; it usually ends in "/svn".

<SVN_repository_URL>::
The URL of the SVN module you want to import. For local
repositories, use "file:///absolute/path".

<path>
The path to the module you want to check out.

-h::
Print a short usage message and exit.

OUTPUT
------
If '-v' is specified, the script reports what it is doing.

Otherwise, success is indicated the Unix way, i.e. by simply exiting with
a zero exit status.

Author
------
Written by Matthias Urlichs <smurf@smurf.noris.de>, with help from
various participants of the git-list <git@vger.kernel.org>.

Based on a cvs2git script by the same author.

Documentation
--------------
Documentation by Matthias Urlichs <smurf@smurf.noris.de>.

GIT
---
Part of the gitlink:git[7] suite

22
Documentation/git-tag.txt

@ -8,19 +8,27 @@ git-tag - Create a tag object signed with GPG


SYNOPSIS SYNOPSIS
-------- --------
'git-tag' [-a | -s] [-f] [-m <msg>] <name> [<head>] 'git-tag' [-a | -s | -u <key-id>] [-f] [-m <msg>] <name> [<head>]


DESCRIPTION DESCRIPTION
----------- -----------
Adds a "tag" reference in .git/refs/tags/ Adds a 'tag' reference in .git/refs/tags/


Unless "-f" is given, the tag must not yet exist in ".git/refs/tags" Unless `-f` is given, the tag must not yet exist in
`.git/refs/tags/` directory.


If "-s" or "-a" is passed, the user will be prompted for a tag message. If one of `-a`, `-s`, or `-u <key-id>` is passed, the command
and a tag object is created. Otherwise just the SHA1 object creates a 'tag' object, and requires the tag message. Unless
name of the commit object is written. `-m <msg>` is given, an editor is started for the user to type
in the tag message.


A GnuPG signed tag object will be created when "-s" is used. Otherwise just the SHA1 object name of the commit object is
written (i.e. an lightweight tag).

A GnuPG signed tag object will be created when `-s` or `-u
<key-id>` is used. When `-u <key-id>` is not used, the
committer identity for the current user is used to find the
GnuPG key for signing.




Author Author

1
Documentation/git-tar-tree.txt

@ -1,6 +1,5 @@
git-tar-tree(1) git-tar-tree(1)
=============== ===============
v0.1, May 2005


NAME NAME
---- ----

1
Documentation/git-unpack-file.txt

@ -1,6 +1,5 @@
git-unpack-file(1) git-unpack-file(1)
================== ==================
v0.1, May 2005


NAME NAME
---- ----

1
Documentation/git-unpack-objects.txt

@ -1,6 +1,5 @@
git-unpack-objects(1) git-unpack-objects(1)
===================== =====================
v0.1, July 2005


NAME NAME
---- ----

41
Documentation/git-update-index.txt

@ -9,12 +9,13 @@ git-update-index - Modifies the index or directory cache
SYNOPSIS SYNOPSIS
-------- --------
'git-update-index' 'git-update-index'
[--add] [--remove] [--refresh] [--replace] [--add] [--remove | --force-remove] [--replace]
[--ignore-missing] [--refresh [-q] [--unmerged] [--ignore-missing]]
[--force-remove]
[--cacheinfo <mode> <object> <file>]\* [--cacheinfo <mode> <object> <file>]\*
[--info-only] [--chmod=(+|-)x]
[--info-only] [--index-info]
[-z] [--stdin] [-z] [--stdin]
[--verbose]
[--] [<file>]\* [--] [<file>]\*


DESCRIPTION DESCRIPTION
@ -42,12 +43,28 @@ OPTIONS
Looks at the current cache and checks to see if merges or Looks at the current cache and checks to see if merges or
updates are needed by checking stat() information. updates are needed by checking stat() information.


-q::
Quiet. If --refresh finds that the cache needs an update, the
default behavior is to error out. This option makes
git-update-index continue anyway.

--unmerged::
If --refresh finds unmerged changes in the cache, the default
behavior is to error out. This option makes git-update-index
continue anyway.

--ignore-missing:: --ignore-missing::
Ignores missing files during a --refresh Ignores missing files during a --refresh


--cacheinfo <mode> <object> <path>:: --cacheinfo <mode> <object> <path>::
Directly insert the specified info into the cache. Directly insert the specified info into the cache.
--index-info::
Read index info from stdin.

--chmod=(+|-)x::
Set the execute permissions on the updated files.

--info-only:: --info-only::
Do not create objects in the object database for all Do not create objects in the object database for all
<file> arguments that follow this flag; just insert <file> arguments that follow this flag; just insert
@ -70,6 +87,9 @@ OPTIONS
read list of paths from the standard input. Paths are read list of paths from the standard input. Paths are
separated by LF (i.e. one path per line) by default. separated by LF (i.e. one path per line) by default.


--verbose::
Report what is being added and removed from index.

-z:: -z::
Only meaningful with `--stdin`; paths are separated with Only meaningful with `--stdin`; paths are separated with
NUL character instead of LF. NUL character instead of LF.
@ -79,7 +99,7 @@ OPTIONS


<file>:: <file>::
Files to act on. Files to act on.
Note that files begining with '.' are discarded. This includes Note that files beginning with '.' are discarded. This includes
`./file` and `dir/./file`. If you don't want this, then use `./file` and `dir/./file`. If you don't want this, then use
cleaner names. cleaner names.
The same applies to directories ending '/' and paths with '//' The same applies to directories ending '/' and paths with '//'
@ -121,6 +141,17 @@ 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




Configuration
-------------

The command honors `core.filemode` configuration variable. If
your repository is on an filesystem whose executable bits are
unreliable, this should be set to 'false'. This causes the
command to ignore differences in file modes recorded in the
index and the file mode on the filesystem if they differ only on
executable bit. On such an unfortunate filesystem, you may
need to use `git-update-index --chmod=`.

Author Author
------ ------
Written by Linus Torvalds <torvalds@osdl.org> Written by Linus Torvalds <torvalds@osdl.org>

1
Documentation/git-update-server-info.txt

@ -1,6 +1,5 @@
git-update-server-info(1) git-update-server-info(1)
========================= =========================
v0.1, July 2005


NAME NAME
---- ----

1
Documentation/git-upload-pack.txt

@ -1,6 +1,5 @@
git-upload-pack(1) git-upload-pack(1)
================== ==================
v0.1, July 2005


NAME NAME
---- ----

1
Documentation/git-var.txt

@ -1,6 +1,5 @@
git-var(1) git-var(1)
========== ==========
v0.1, July 2005


NAME NAME
---- ----

5
Documentation/git-verify-pack.txt

@ -1,10 +1,9 @@
git-verify-pack(1) git-verify-pack(1)
================== ==================
v0.1, June 2005


NAME NAME
---- ----
git-verify-pack - Validate packed GIT archive files. git-verify-pack - Validate packed git archive files.




SYNOPSIS SYNOPSIS
@ -14,7 +13,7 @@ SYNOPSIS


DESCRIPTION DESCRIPTION
----------- -----------
Reads given idx file for packed GIT archive created with Reads given idx file for packed git archive created with
git-pack-objects command and verifies idx file and the git-pack-objects command and verifies idx file and the
corresponding pack file. corresponding pack file.



3
Documentation/git-whatchanged.txt

@ -1,6 +1,5 @@
git-whatchanged(1) git-whatchanged(1)
================== ==================
v0.99.4, Aug 2005


NAME NAME
---- ----
@ -9,7 +8,7 @@ git-whatchanged - Show logs with difference each commit introduces.


SYNOPSIS SYNOPSIS
-------- --------
'git whatchanged' <option>... 'git-whatchanged' <option>...


DESCRIPTION DESCRIPTION
----------- -----------

1
Documentation/git-write-tree.txt

@ -1,6 +1,5 @@
git-write-tree(1) git-write-tree(1)
================= =================
v0.1, May 2005


NAME NAME
---- ----

72
Documentation/git.txt

@ -1,6 +1,5 @@
git(7) git(7)
====== ======
v0.99.6, Sep 2005


NAME NAME
---- ----
@ -69,6 +68,9 @@ gitlink:git-commit-tree[1]::
gitlink:git-hash-object[1]:: gitlink:git-hash-object[1]::
Computes the object ID from a file. Computes the object ID from a file.


gitlink:git-index-pack.html[1]::
Build pack index file for an existing packed archive.

gitlink:git-init-db[1]:: gitlink:git-init-db[1]::
Creates an empty git object database Creates an empty git object database


@ -131,6 +133,9 @@ gitlink:git-ls-tree[1]::
gitlink:git-merge-base[1]:: gitlink:git-merge-base[1]::
Finds as good a common ancestor as possible for a merge Finds as good a common ancestor as possible for a merge


gitlink:git-name-rev[1]::
Find symbolic names for given revs

gitlink:git-rev-list[1]:: gitlink:git-rev-list[1]::
Lists commit objects in reverse chronological order Lists commit objects in reverse chronological order


@ -147,7 +152,7 @@ gitlink:git-var[1]::
Displays a git logical variable Displays a git logical variable


gitlink:git-verify-pack[1]:: gitlink:git-verify-pack[1]::
Validates packed GIT archive files Validates packed git archive files


The interrogate commands may create files - and you can force them to The interrogate commands may create files - and you can force them to
touch the working file set - but in general they don't touch the working file set - but in general they don't
@ -164,11 +169,11 @@ gitlink:git-fetch-pack[1]::
Updates from a remote repository. Updates from a remote repository.


gitlink:git-http-fetch[1]:: gitlink:git-http-fetch[1]::
Downloads a remote GIT repository via HTTP Downloads a remote git repository via HTTP
Previously this command was known as git-http-pull. Previously this command was known as git-http-pull.


gitlink:git-local-fetch[1]:: gitlink:git-local-fetch[1]::
Duplicates another GIT repository on a local system Duplicates another git repository on a local system
Previously this command was known as git-local-pull. Previously this command was known as git-local-pull.


gitlink:git-peek-remote[1]:: gitlink:git-peek-remote[1]::
@ -180,6 +185,9 @@ gitlink:git-receive-pack[1]::
gitlink:git-send-pack[1]:: gitlink:git-send-pack[1]::
Pushes to a remote repository, intelligently. Pushes to a remote repository, intelligently.


gitlink:git-shell[1]::
Restricted shell for GIT-only SSH access.

gitlink:git-ssh-fetch[1]:: gitlink:git-ssh-fetch[1]::
Pulls from a remote repository over ssh connection Pulls from a remote repository over ssh connection
Previously this command was known as git-ssh-pull. Previously this command was known as git-ssh-pull.
@ -204,6 +212,9 @@ gitlink:git-add[1]::
Add paths to the index file. Add paths to the index file.
Previously this command was known as git-add-script. Previously this command was known as git-add-script.


gitlink:git-am[1]::
Apply patches from a mailbox, but cooler.

gitlink:git-applymbox[1]:: gitlink:git-applymbox[1]::
Apply patches from a mailbox. Apply patches from a mailbox.


@ -257,6 +268,9 @@ gitlink:git-ls-remote[1]::
gitlink:git-merge[1]:: gitlink:git-merge[1]::
Grand unified merge driver. Grand unified merge driver.


gitlink:git-mv[1]::
Move or rename a file, a directory, or a symlink.

gitlink:git-octopus[1]:: gitlink:git-octopus[1]::
Merge more than two commits. Merge more than two commits.
Previously this command was known as git-octopus-script. Previously this command was known as git-octopus-script.
@ -323,7 +337,7 @@ gitlink:git-archimport[1]::
Previously this command was known as git-archimport-script. Previously this command was known as git-archimport-script.


gitlink:git-convert-objects[1]:: gitlink:git-convert-objects[1]::
Converts old-style GIT repository Converts old-style git repository
Previously this command was known as git-convert-cache. Previously this command was known as git-convert-cache.


gitlink:git-cvsimport[1]:: gitlink:git-cvsimport[1]::
@ -342,17 +356,29 @@ gitlink:git-relink[1]::
Hardlink common objects in local repositories. Hardlink common objects in local repositories.
Previously this command was known as git-relink-script. Previously this command was known as git-relink-script.


gitlink:git-svnimport[1]::
Import a SVN repository into git.

gitlink:git-sh-setup[1]:: gitlink:git-sh-setup[1]::
Common git shell script setup code. Common git shell script setup code.
Previously this command was known as git-sh-setup-script. Previously this command was known as git-sh-setup-script.


gitlink:git-symbolic-ref[1]::
Read and modify symbolic refs

gitlink:git-tag[1]:: gitlink:git-tag[1]::
An example script to create a tag object signed with GPG An example script to create a tag object signed with GPG
Previously this command was known as git-tag-script. Previously this command was known as git-tag-script.


gitlink:git-update-ref[1]::
Update the object name stored in a ref safely.



Interrogators: Interrogators:


gitlink:git-check-ref-format[1]::
Make sure ref name is well formed.

gitlink:git-cherry[1]:: gitlink:git-cherry[1]::
Find commits not merged upstream. Find commits not merged upstream.


@ -361,7 +387,7 @@ gitlink:git-count-objects[1]::
Previously this command was known as git-count-objects-script. Previously this command was known as git-count-objects-script.


gitlink:git-daemon[1]:: gitlink:git-daemon[1]::
A really simple server for GIT repositories. A really simple server for git repositories.


gitlink:git-get-tar-commit-id[1]:: gitlink:git-get-tar-commit-id[1]::
Extract commit ID from an archive created using git-tar-tree. Extract commit ID from an archive created using git-tar-tree.
@ -390,6 +416,9 @@ gitlink:git-send-email[1]::
Send patch e-mails out of "format-patch --mbox" output. Send patch e-mails out of "format-patch --mbox" output.
Previously this command was known as git-send-email-script. Previously this command was known as git-send-email-script.


gitlink:git-symbolic-refs[1]::
Read and modify symbolic refs.

gitlink:git-stripspace[1]:: gitlink:git-stripspace[1]::
Filter out empty lines. Filter out empty lines.


@ -401,6 +430,37 @@ gitlink:gitk[1]::
gitk. gitk.




Configuration Mechanism
-----------------------

Starting from 0.99.9 (actually mid 0.99.8.GIT), .git/config file
is used to hold per-repository configuration options. It is a
simple text file modelled after `.ini` format familiar to some
people. Here is an example:

------------
#
# This is the config file, and
# a '#' or ';' character indicates
# a comment
#

; core variables
[core]
; Don't trust file modes
filemode = false

; user identity
[user]
name = "Junio C Hamano"
email = "junkio@twinsun.com"

------------

Various commands read from the configuration file and adjust
their operation accordingly.


Identifier Terminology Identifier Terminology
---------------------- ----------------------
<object>:: <object>::

2
Documentation/glossary.txt

@ -1,5 +1,5 @@
object:: object::
The unit of storage in GIT. It is uniquely identified by The unit of storage in git. It is uniquely identified by
the SHA1 of its contents. Consequently, an object can not the SHA1 of its contents. Consequently, an object can not
be changed. be changed.



3
Documentation/hooks.txt

@ -1,6 +1,5 @@
Hooks used by GIT Hooks used by git
================= =================
v0.99.6, Sep 2005


Hooks are little scripts you can place in `$GIT_DIR/hooks` Hooks are little scripts you can place in `$GIT_DIR/hooks`
directory to trigger action at certain points. When directory to trigger action at certain points. When

12
Documentation/pull-fetch-param.txt

@ -6,7 +6,7 @@
=============================================================== ===============================================================
- Rsync URL: rsync://remote.machine/path/to/repo.git/ - Rsync URL: rsync://remote.machine/path/to/repo.git/
- HTTP(s) URL: http://remote.machine/path/to/repo.git/ - HTTP(s) URL: http://remote.machine/path/to/repo.git/
- GIT URL: git://remote.machine/path/to/repo.git/ - git URL: git://remote.machine/path/to/repo.git/
or remote.machine:/path/to/repo.git/ or remote.machine:/path/to/repo.git/
- Local directory: /path/to/repo.git/ - Local directory: /path/to/repo.git/
=============================================================== ===============================================================
@ -75,13 +75,3 @@ Some short-cut notations are also supported.
pushing. That is, do not store it locally if pushing. That is, do not store it locally if
fetching, and update the same name if pushing. fetching, and update the same name if pushing.


-a, \--append::
Append ref names and object names of fetched refs to the
existing contents of $GIT_DIR/FETCH_HEAD. Without this
option old data in $GIT_DIR/FETCH_HEAD will be overwritten.

-f, \--force::
Usually, the command refuses to update a local ref that is
not an ancestor of the remote ref used to overwrite it.
This flag disables the check. What this means is that the
local repository can lose commits; use it with care.

5
Documentation/repository-layout.txt

@ -1,6 +1,5 @@
GIT repository layout git repository layout
===================== =====================
v0.99.5, Sep 2005


You may find these things in your git repository (`.git` You may find these things in your git repository (`.git`
directory for a repository associated with your working tree, or directory for a repository associated with your working tree, or
@ -120,7 +119,7 @@ info/grafts::
info/exclude:: info/exclude::
This file, by convention among Porcelains, stores the This file, by convention among Porcelains, stores the
exclude pattern list. `git status` looks at it, but exclude pattern list. `git status` looks at it, but
otherwise it is not looked at by any of the core GIT otherwise it is not looked at by any of the core git
commands. commands.


remotes:: remotes::

98
Documentation/tutorial.txt

@ -1,6 +1,5 @@
A short git tutorial A short git tutorial
==================== ====================
v0.99.5, Aug 2005


Introduction Introduction
------------ ------------
@ -52,7 +51,9 @@ your new project. You will now have a `.git` directory, and you can
inspect that with `ls`. For your new empty project, it should show you inspect that with `ls`. For your new empty project, it should show you
three entries, among other things: three entries, among other things:


- a symlink called `HEAD`, pointing to `refs/heads/master` - a symlink called `HEAD`, pointing to `refs/heads/master` (if your
platform does not have native symlinks, it is a file containing the
line "ref: refs/heads/master")
+ +
Don't worry about the fact that the file that the `HEAD` link points to Don't worry about the fact that the file that the `HEAD` link points to
doesn't even exist yet -- you haven't created the commit that will doesn't even exist yet -- you haven't created the commit that will
@ -161,7 +162,7 @@ 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 where the `-t` tells `git-cat-file` to tell you what the "type" of the
object is. Git will tell you that you have a "blob" object (ie just a object is. git will tell you that you have a "blob" object (ie just a
regular file), and you can see the contents with regular file), and you can see the contents with


git-cat-file "blob" 557db03 git-cat-file "blob" 557db03
@ -228,6 +229,7 @@ which will spit out


------------ ------------
diff --git a/hello b/hello diff --git a/hello b/hello
index 557db03..263414f 100644
--- a/hello --- a/hello
+++ b/hello +++ b/hello
@@ -1 +1,2 @@ @@ -1 +1,2 @@
@ -290,13 +292,16 @@ also wants to get a commit message
on its standard input, and it will write out the resulting object name for the on its standard input, and it will write out the resulting object name for the
commit to its standard output. commit to its standard output.


And this is where we start using the `.git/HEAD` file. The `HEAD` file is And this is where we create the `.git/refs/heads/master` file
supposed to contain the reference to the top-of-tree, and since that's which is pointed at by `HEAD`. This file is supposed to contain
exactly what `git-commit-tree` spits out, we can do this all with a simple the reference to the top-of-tree of the master branch, and since
shell pipeline: that's exactly what `git-commit-tree` spits out, we can do this
all with a sequence of simple shell commands:


------------------------------------------------ ------------------------------------------------
echo "Initial commit" | git-commit-tree $(git-write-tree) > .git/HEAD tree=$(git-write-tree)
commit=$(echo 'Initial commit' | git-commit-tree $tree)
git-update-ref HEAD $(commit)
------------------------------------------------ ------------------------------------------------


which will say: which will say:
@ -378,7 +383,7 @@ come from the working tree or not.


This is not hard to understand, as soon as you realize that git simply This is not hard to understand, as soon as you realize that git simply
never knows (or cares) about files that it is not told about never knows (or cares) about files that it is not told about
explicitly. Git will never go *looking* for files to compare, it explicitly. git will never go *looking* for files to compare, it
expects you to tell it what the files are, and that's what the index expects you to tell it what the files are, and that's what the index
is there for. is there for.
================ ================
@ -544,7 +549,7 @@ name for the state at that point.
Copying repositories Copying repositories
-------------------- --------------------


Git repositories are normally totally self-sufficient, and it's worth noting git repositories are normally totally self-sufficient, and it's worth noting
that unlike CVS, for example, there is no separate notion of that unlike CVS, for example, there is no separate notion of
"repository" and "working tree". A git repository normally *is* the "repository" and "working tree". A git repository normally *is* the
working tree, with the local git information hidden in the `.git` working tree, with the local git information hidden in the `.git`
@ -692,7 +697,9 @@ other point in the history than the current `HEAD`, you can do so by
just telling `git checkout` what the base of the checkout would be. just telling `git checkout` what the base of the checkout would be.
In other words, if you have an earlier tag or branch, you'd just do In other words, if you have an earlier tag or branch, you'd just do


git checkout -b mybranch earlier-commit ------------
git checkout -b mybranch earlier-commit
------------


and it would create the new branch `mybranch` at the earlier commit, and it would create the new branch `mybranch` at the earlier commit,
and check out the state at that time. and check out the state at that time.
@ -700,17 +707,29 @@ and check out the state at that time.


You can always just jump back to your original `master` branch by doing You can always just jump back to your original `master` branch by doing


git checkout master ------------
git checkout master
------------


(or any other branch-name, for that matter) and if you forget which (or any other branch-name, for that matter) and if you forget which
branch you happen to be on, a simple branch you happen to be on, a simple


ls -l .git/HEAD ------------
ls -l .git/HEAD
------------


will tell you where it's pointing. To get the list of branches will tell you where it's pointing (Note that on platforms with bad or no
you have, you can say symlink support, you have to execute


git branch ------------
cat .git/HEAD
------------

instead). To get the list of branches you have, you can say

------------
git branch
------------


which is nothing more than a simple script around `ls .git/refs/heads`. which is nothing more than a simple script around `ls .git/refs/heads`.
There will be asterisk in front of the branch you are currently on. There will be asterisk in front of the branch you are currently on.
@ -718,7 +737,9 @@ There will be asterisk in front of the branch you are currently on.
Sometimes you may wish to create a new branch _without_ actually Sometimes you may wish to create a new branch _without_ actually
checking it out and switching to it. If so, just use the command checking it out and switching to it. If so, just use the command


git branch <branchname> [startingpoint] ------------
git branch <branchname> [startingpoint]
------------


which will simply _create_ the branch, but will not do anything further. which will simply _create_ the branch, but will not do anything further.
You can then later -- once you decide that you want to actually develop You can then later -- once you decide that you want to actually develop
@ -844,7 +865,6 @@ $ git show-branch master mybranch
! [mybranch] Some work. ! [mybranch] Some work.
-- --
+ [master] Merged "mybranch" changes. + [master] Merged "mybranch" changes.
+ [master~1] Some fun.
++ [mybranch] Some work. ++ [mybranch] Some work.
------------------------------------------------ ------------------------------------------------


@ -871,8 +891,10 @@ Now, let's pretend you are the one who did all the work in
to the `master` branch. Let's go back to `mybranch`, and run to the `master` branch. Let's go back to `mybranch`, and run
resolve to get the "upstream changes" back to your branch. resolve to get the "upstream changes" back to your branch.


git checkout mybranch ------------
git resolve HEAD master "Merge upstream changes." git checkout mybranch
git resolve HEAD master "Merge upstream changes."
------------


This outputs something like this (the actual commit object names This outputs something like this (the actual commit object names
would be different) would be different)
@ -951,7 +973,7 @@ This transport is the same as SSH transport but uses `sh` to run
both ends on the local machine instead of running other end on both ends on the local machine instead of running other end on
the remote machine via `ssh`. the remote machine via `ssh`.


GIT Native:: git Native::
`git://remote.machine/path/to/repo.git/` `git://remote.machine/path/to/repo.git/`
+ +
This transport was designed for anonymous downloading. Like SSH This transport was designed for anonymous downloading. Like SSH
@ -972,13 +994,13 @@ necessary objects. Because of this behaviour, they are
sometimes also called 'commit walkers'. sometimes also called 'commit walkers'.
+ +
The 'commit walkers' are sometimes also called 'dumb The 'commit walkers' are sometimes also called 'dumb
transports', because they do not require any GIT aware smart transports', because they do not require any git aware smart
server like GIT Native transport does. Any stock HTTP server server like git Native transport does. Any stock HTTP server
would suffice. would suffice.
+ +
There are (confusingly enough) `git-ssh-fetch` and `git-ssh-upload` There are (confusingly enough) `git-ssh-fetch` and `git-ssh-upload`
programs, which are 'commit walkers'; they outlived their programs, which are 'commit walkers'; they outlived their
usefulness when GIT Native and SSH transports were introduced, usefulness when git Native and SSH transports were introduced,
and not used by `git pull` or `git push` scripts. and not used by `git pull` or `git push` scripts.


Once you fetch from the remote repository, you `resolve` that Once you fetch from the remote repository, you `resolve` that
@ -1082,19 +1104,23 @@ done only once.
on the remote machine. The communication between the two over on the remote machine. The communication between the two over
the network internally uses an SSH connection. the network internally uses an SSH connection.


Your private repository's GIT directory is usually `.git`, but Your private repository's git directory is usually `.git`, but
your public repository is often named after the project name, your public repository is often named after the project name,
i.e. `<project>.git`. Let's create such a public repository for i.e. `<project>.git`. Let's create such a public repository for
project `my-git`. After logging into the remote machine, create project `my-git`. After logging into the remote machine, create
an empty directory: an empty directory:


mkdir my-git.git ------------
mkdir my-git.git
------------


Then, make that directory into a GIT repository by running Then, make that directory into a git repository by running
`git init-db`, but this time, since its name is not the usual `git init-db`, but this time, since its name is not the usual
`.git`, we do things slightly differently: `.git`, we do things slightly differently:


GIT_DIR=my-git.git git-init-db ------------
GIT_DIR=my-git.git git-init-db
------------


Make sure this directory is available for others you want your Make sure this directory is available for others you want your
changes to be pulled by via the transport of your choice. Also changes to be pulled by via the transport of your choice. Also
@ -1118,7 +1144,9 @@ Your "public repository" is now ready to accept your changes.
Come back to the machine you have your private repository. From Come back to the machine you have your private repository. From
there, run this command: there, run this command:


git push <public-host>:/path/to/my-git.git master ------------
git push <public-host>:/path/to/my-git.git master
------------


This synchronizes your public repository to match the named This synchronizes your public repository to match the named
branch head (i.e. `master` in this case) and objects reachable branch head (i.e. `master` in this case) and objects reachable
@ -1128,7 +1156,9 @@ As a real example, this is how I update my public git
repository. Kernel.org mirror network takes care of the repository. Kernel.org mirror network takes care of the
propagation to other publicly visible machines: propagation to other publicly visible machines:


git push master.kernel.org:/pub/scm/git/git.git/ ------------
git push master.kernel.org:/pub/scm/git/git.git/
------------




Packing your repository Packing your repository
@ -1141,7 +1171,9 @@ not so convenient to transport over the network. Since git objects are
immutable once they are created, there is a way to optimize the immutable once they are created, there is a way to optimize the
storage by "packing them together". The command storage by "packing them together". The command


git repack ------------
git repack
------------


will do it for you. If you followed the tutorial examples, you will do it for you. If you followed the tutorial examples, you
would have accumulated about 17 objects in `.git/objects/??/` would have accumulated about 17 objects in `.git/objects/??/`
@ -1165,7 +1197,9 @@ Our programs are always perfect ;-).
Once you have packed objects, you do not need to leave the Once you have packed objects, you do not need to leave the
unpacked objects that are contained in the pack file anymore. unpacked objects that are contained in the pack file anymore.


git prune-packed ------------
git prune-packed
------------


would remove them for you. would remove them for you.



168
Makefile

@ -27,8 +27,12 @@
# Define NEEDS_SOCKET if linking with libc is not enough (SunOS, # Define NEEDS_SOCKET if linking with libc is not enough (SunOS,
# Patrick Mauritz). # Patrick Mauritz).
# #
# Define NO_MMAP if you want to avoid mmap.
#
# Define WITH_OWN_SUBPROCESS_PY if you want to use with python 2.3. # Define WITH_OWN_SUBPROCESS_PY if you want to use with python 2.3.
# #
# Define NO_IPV6 if you lack IPv6 support and getaddrinfo().
#
# Define COLLISION_CHECK below if you believe that SHA1's # Define COLLISION_CHECK below if you believe that SHA1's
# 1461501637330902918203684832716283019655932542976 hashes do not give you # 1461501637330902918203684832716283019655932542976 hashes do not give you
# sufficient guarantee that no collisions between objects will ever happen. # sufficient guarantee that no collisions between objects will ever happen.
@ -48,7 +52,7 @@


# DEFINES += -DUSE_STDEV # DEFINES += -DUSE_STDEV


GIT_VERSION = 0.99.8g GIT_VERSION = 0.99.9a


CFLAGS = -g -O2 -Wall CFLAGS = -g -O2 -Wall
ALL_CFLAGS = $(CFLAGS) $(PLATFORM_DEFINES) $(DEFINES) ALL_CFLAGS = $(CFLAGS) $(PLATFORM_DEFINES) $(DEFINES)
@ -83,44 +87,45 @@ SCRIPT_SH = \
git-repack.sh git-request-pull.sh git-reset.sh \ git-repack.sh git-request-pull.sh git-reset.sh \
git-resolve.sh git-revert.sh git-sh-setup.sh git-status.sh \ git-resolve.sh git-revert.sh git-sh-setup.sh git-status.sh \
git-tag.sh git-verify-tag.sh git-whatchanged.sh git.sh \ git-tag.sh git-verify-tag.sh git-whatchanged.sh git.sh \
git-applymbox.sh git-applypatch.sh \ git-applymbox.sh git-applypatch.sh git-am.sh \
git-merge.sh git-merge-stupid.sh git-merge-octopus.sh \ git-merge.sh git-merge-stupid.sh git-merge-octopus.sh \
git-merge-resolve.sh git-grep.sh git-merge-resolve.sh git-grep.sh


SCRIPT_PERL = \ SCRIPT_PERL = \
git-archimport.perl git-cvsimport.perl git-relink.perl \ git-archimport.perl git-cvsimport.perl git-relink.perl \
git-rename.perl git-shortlog.perl git-fmt-merge-msg.perl git-rename.perl git-shortlog.perl git-fmt-merge-msg.perl \
git-findtags.perl git-svnimport.perl git-mv.perl


SCRIPT_PYTHON = \ SCRIPT_PYTHON = \
git-merge-recursive.py git-merge-recursive.py


# The ones that do not have to link with lcrypto nor lz. # The ones that do not have to link with lcrypto nor lz.
SIMPLE_PROGRAMS = \ SIMPLE_PROGRAMS = \
git-get-tar-commit-id git-mailinfo git-mailsplit git-stripspace \ git-get-tar-commit-id$X git-mailinfo$X git-mailsplit$X \
git-daemon git-var git-stripspace$X git-var$X git-daemon$X


# ... and all the rest # ... and all the rest
PROGRAMS = \ PROGRAMS = \
git-apply git-cat-file \ git-apply$X git-cat-file$X \
git-checkout-index git-clone-pack git-commit-tree \ git-checkout-index$X git-clone-pack$X git-commit-tree$X \
git-convert-objects git-diff-files \ git-convert-objects$X git-diff-files$X \
git-diff-index git-diff-stages \ git-diff-index$X git-diff-stages$X \
git-diff-tree git-fetch-pack git-fsck-objects \ git-diff-tree$X git-fetch-pack$X git-fsck-objects$X \
git-hash-object git-init-db \ git-hash-object$X git-index-pack$X git-init-db$X \
git-local-fetch git-ls-files git-ls-tree git-merge-base \ git-local-fetch$X git-ls-files$X git-ls-tree$X git-merge-base$X \
git-merge-index git-mktag git-pack-objects git-patch-id \ git-merge-index$X git-mktag$X git-pack-objects$X git-patch-id$X \
git-peek-remote git-prune-packed git-read-tree \ git-peek-remote$X git-prune-packed$X git-read-tree$X \
git-receive-pack git-rev-list git-rev-parse \ git-receive-pack$X git-rev-list$X git-rev-parse$X \
git-send-pack git-show-branch \ git-send-pack$X git-show-branch$X git-shell$X \
git-show-index git-ssh-fetch \ git-show-index$X git-ssh-fetch$X \
git-ssh-upload git-tar-tree git-unpack-file \ git-ssh-upload$X git-tar-tree$X git-unpack-file$X \
git-unpack-objects git-update-index git-update-server-info \ git-unpack-objects$X git-update-index$X git-update-server-info$X \
git-upload-pack git-verify-pack git-write-tree \ git-upload-pack$X git-verify-pack$X git-write-tree$X \
git-update-ref git-symbolic-ref git-check-ref-format \ git-update-ref$X git-symbolic-ref$X git-check-ref-format$X \
$(SIMPLE_PROGRAMS) git-name-rev$X $(SIMPLE_PROGRAMS)


# Backward compatibility -- to be removed after 1.0 # Backward compatibility -- to be removed after 1.0
PROGRAMS += git-ssh-pull git-ssh-push PROGRAMS += git-ssh-pull$X git-ssh-push$X


GIT_LIST_TWEAK = GIT_LIST_TWEAK =


@ -146,7 +151,7 @@ LIB_H = \


DIFF_OBJS = \ DIFF_OBJS = \
diff.o diffcore-break.o diffcore-order.o diffcore-pathspec.o \ diff.o diffcore-break.o diffcore-order.o diffcore-pathspec.o \
diffcore-pickaxe.o diffcore-rename.o diffcore-pickaxe.o diffcore-rename.o tree-diff.o


LIB_OBJS = \ LIB_OBJS = \
blob.o commit.o connect.o count-delta.o csum-file.o \ blob.o commit.o connect.o count-delta.o csum-file.o \
@ -154,19 +159,34 @@ LIB_OBJS = \
object.o pack-check.o patch-delta.o path.o pkt-line.o \ object.o pack-check.o patch-delta.o path.o pkt-line.o \
quote.o read-cache.o refs.o run-command.o \ quote.o read-cache.o refs.o run-command.o \
server-info.o setup.o sha1_file.o sha1_name.o strbuf.o \ server-info.o setup.o sha1_file.o sha1_name.o strbuf.o \
tag.o tree.o usage.o $(DIFF_OBJS) tag.o tree.o usage.o config.o environment.o ctype.o copy.o \
$(DIFF_OBJS)


LIBS = $(LIB_FILE) LIBS = $(LIB_FILE)
LIBS += -lz LIBS += -lz


# Shell quote;
# Result of this needs to be placed inside ''
shq = $(subst ','\'',$(1))
# This has surrounding ''
shellquote = '$(call shq,$(1))'

# #
# Platform specific tweaks # Platform specific tweaks
# #
ifeq ($(shell uname -s),Darwin)
# We choose to avoid "if .. else if .. else .. endif endif"
# because maintaining the nesting to match is a pain. If
# we had "elif" things would have been much nicer...
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not')
uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')

ifeq ($(uname_S),Darwin)
NEEDS_SSL_WITH_CRYPTO = YesPlease NEEDS_SSL_WITH_CRYPTO = YesPlease
NEEDS_LIBICONV = YesPlease NEEDS_LIBICONV = YesPlease
endif endif
ifeq ($(shell uname -s),SunOS) ifeq ($(uname_S),SunOS)
NEEDS_SOCKET = YesPlease NEEDS_SOCKET = YesPlease
NEEDS_NSL = YesPlease NEEDS_NSL = YesPlease
SHELL_PATH = /bin/bash SHELL_PATH = /bin/bash
@ -176,14 +196,23 @@ ifeq ($(shell uname -s),SunOS)
TAR = gtar TAR = gtar
PLATFORM_DEFINES += -D__EXTENSIONS__ PLATFORM_DEFINES += -D__EXTENSIONS__
endif endif
ifneq (,$(findstring arm,$(shell uname -m))) ifeq ($(uname_O),Cygwin)
ARM_SHA1 = YesPlease NO_STRCASESTR = YesPlease
NEEDS_LIBICONV = YesPlease
NO_IPV6 = YesPlease
X = .exe
PLATFORM_DEFINES += -DUSE_SYMLINK_HEAD=0
endif endif
ifeq ($(shell uname -s),OpenBSD) ifeq ($(uname_S),OpenBSD)
NO_STRCASESTR = YesPlease NO_STRCASESTR = YesPlease
NEEDS_LIBICONV = YesPlease NEEDS_LIBICONV = YesPlease
PLATFORM_DEFINES += -I/usr/local/include -L/usr/local/lib PLATFORM_DEFINES += -I/usr/local/include -L/usr/local/lib
endif endif
ifneq (,$(findstring arm,$(uname_M)))
ARM_SHA1 = YesPlease
endif

-include config.mak


ifndef NO_CURL ifndef NO_CURL
ifdef CURLDIR ifdef CURLDIR
@ -193,7 +222,7 @@ ifndef NO_CURL
else else
CURL_LIBCURL = -lcurl CURL_LIBCURL = -lcurl
endif endif
PROGRAMS += git-http-fetch PROGRAMS += git-http-fetch$X
endif endif


ifndef SHELL_PATH ifndef SHELL_PATH
@ -217,7 +246,7 @@ ifndef NO_OPENSSL
OPENSSL_LINK = OPENSSL_LINK =
endif endif
else else
DEFINES += '-DNO_OPENSSL' DEFINES += -DNO_OPENSSL
MOZILLA_SHA1 = 1 MOZILLA_SHA1 = 1
OPENSSL_LIBSSL = OPENSSL_LIBSSL =
endif endif
@ -250,6 +279,13 @@ ifdef NO_STRCASESTR
DEFINES += -Dstrcasestr=gitstrcasestr -DNO_STRCASESTR=1 DEFINES += -Dstrcasestr=gitstrcasestr -DNO_STRCASESTR=1
LIB_OBJS += compat/strcasestr.o LIB_OBJS += compat/strcasestr.o
endif endif
ifdef NO_MMAP
DEFINES += -Dmmap=gitfakemmap -Dmunmap=gitfakemunmap -DNO_MMAP
LIB_OBJS += compat/mmap.o
endif
ifdef NO_IPV6
DEFINES += -DNO_IPV6 -Dsockaddr_storage=sockaddr_in
endif


ifdef PPC_SHA1 ifdef PPC_SHA1
SHA1_HEADER = "ppc/sha1.h" SHA1_HEADER = "ppc/sha1.h"
@ -269,14 +305,14 @@ endif
endif endif
endif endif


DEFINES += '-DSHA1_HEADER=$(SHA1_HEADER)' DEFINES += -DSHA1_HEADER=$(call shellquote,$(SHA1_HEADER))


SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \ SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \
$(patsubst %.perl,%,$(SCRIPT_PERL)) \ $(patsubst %.perl,%,$(SCRIPT_PERL)) \
$(patsubst %.py,%,$(SCRIPT_PYTHON)) \ $(patsubst %.py,%,$(SCRIPT_PYTHON)) \
gitk gitk git-cherry-pick


export TAR INSTALL DESTDIR SHELL_PATH export prefix TAR INSTALL DESTDIR SHELL_PATH template_dir
### Build rules ### Build rules


all: $(PROGRAMS) $(SCRIPTS) all: $(PROGRAMS) $(SCRIPTS)
@ -286,58 +322,67 @@ all:


git: git.sh Makefile git: git.sh Makefile
rm -f $@+ $@ rm -f $@+ $@
sed -e '1s|#!.*/sh|#!$(SHELL_PATH)|' \ sed -e '1s|#!.*/sh|#!$(call shq,$(SHELL_PATH))|' \
-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \ -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
-e 's/@@X@@/$(X)/g' \
$(GIT_LIST_TWEAK) <$@.sh >$@+ $(GIT_LIST_TWEAK) <$@.sh >$@+
chmod +x $@+ chmod +x $@+
mv $@+ $@ mv $@+ $@


$(filter-out git,$(patsubst %.sh,%,$(SCRIPT_SH))) : % : %.sh $(filter-out git,$(patsubst %.sh,%,$(SCRIPT_SH))) : % : %.sh
rm -f $@ rm -f $@
sed -e '1s|#!.*/sh|#!$(SHELL_PATH)|' $@.sh >$@ sed -e '1s|#!.*/sh|#!$(call shq,$(SHELL_PATH))|' \
-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
$@.sh >$@
chmod +x $@ chmod +x $@


$(patsubst %.perl,%,$(SCRIPT_PERL)) : % : %.perl $(patsubst %.perl,%,$(SCRIPT_PERL)) : % : %.perl
rm -f $@ rm -f $@
sed -e '1s|#!.*perl|#!$(PERL_PATH)|' $@.perl >$@ sed -e '1s|#!.*perl|#!$(call shq,$(PERL_PATH))|' \
-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
$@.perl >$@
chmod +x $@ chmod +x $@


$(patsubst %.py,%,$(SCRIPT_PYTHON)) : % : %.py $(patsubst %.py,%,$(SCRIPT_PYTHON)) : % : %.py
rm -f $@ rm -f $@
sed -e '1s|#!.*python|#!$(PYTHON_PATH)|' \ sed -e '1s|#!.*python|#!$(call shq,$(PYTHON_PATH))|' \
-e 's|@@GIT_PYTHON_PATH@@|$(GIT_PYTHON_DIR)|g' \ -e 's|@@GIT_PYTHON_PATH@@|$(call shq,$(GIT_PYTHON_DIR))|g' \
$@.py >$@ -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
$@.py >$@
chmod +x $@ chmod +x $@


git-cherry-pick: git-revert
cp $< $@

%.o: %.c %.o: %.c
$(CC) -o $*.o -c $(ALL_CFLAGS) $< $(CC) -o $*.o -c $(ALL_CFLAGS) $<
%.o: %.S %.o: %.S
$(CC) -o $*.o -c $(ALL_CFLAGS) $< $(CC) -o $*.o -c $(ALL_CFLAGS) $<


git-%: %.o $(LIB_FILE) git-%$X: %.o $(LIB_FILE)
$(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^) $(LIBS) $(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^) $(LIBS)


git-mailinfo : SIMPLE_LIB += $(LIB_4_ICONV) git-mailinfo$X : SIMPLE_LIB += $(LIB_4_ICONV)
$(SIMPLE_PROGRAMS) : $(LIB_FILE) $(SIMPLE_PROGRAMS) : $(LIB_FILE)
$(SIMPLE_PROGRAMS) : git-% : %.o $(SIMPLE_PROGRAMS) : git-%$X : %.o
$(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^) $(LIB_FILE) $(SIMPLE_LIB) $(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^) $(LIB_FILE) $(SIMPLE_LIB)


git-http-fetch: fetch.o git-http-fetch$X: fetch.o
git-local-fetch: fetch.o git-local-fetch$X: fetch.o
git-ssh-fetch: rsh.o fetch.o git-ssh-fetch$X: rsh.o fetch.o
git-ssh-upload: rsh.o git-ssh-upload$X: rsh.o
git-ssh-pull: rsh.o fetch.o git-ssh-pull$X: rsh.o fetch.o
git-ssh-push: rsh.o git-ssh-push$X: rsh.o


git-http-fetch: LIBS += $(CURL_LIBCURL) git-http-fetch$X: LIBS += $(CURL_LIBCURL)
git-rev-list: LIBS += $(OPENSSL_LIBSSL) git-rev-list$X: LIBS += $(OPENSSL_LIBSSL)


init-db.o: init-db.c init-db.o: init-db.c
$(CC) -c $(ALL_CFLAGS) \ $(CC) -c $(ALL_CFLAGS) \
-DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir)"' $*.c -DDEFAULT_GIT_TEMPLATE_DIR=$(call shellquote,"$(template_dir)") $*.c


$(LIB_OBJS): $(LIB_H) $(LIB_OBJS): $(LIB_H)
$(patsubst git-%,%.o,$(PROGRAMS)): $(LIB_H) $(patsubst git-%$X,%.o,$(PROGRAMS)): $(LIB_H)
$(DIFF_OBJS): diffcore.h $(DIFF_OBJS): diffcore.h


$(LIB_FILE): $(LIB_OBJS) $(LIB_FILE): $(LIB_OBJS)
@ -352,10 +397,10 @@ doc:
test: all test: all
$(MAKE) -C t/ all $(MAKE) -C t/ all


test-date: test-date.c date.o test-date$X: test-date.c date.o
$(CC) $(ALL_CFLAGS) -o $@ test-date.c date.o $(CC) $(ALL_CFLAGS) -o $@ test-date.c date.o


test-delta: test-delta.c diff-delta.o patch-delta.o test-delta$X: test-delta.c diff-delta.o patch-delta.o
$(CC) $(ALL_CFLAGS) -o $@ $^ $(CC) $(ALL_CFLAGS) -o $@ $^


check: check:
@ -366,13 +411,12 @@ check:
### Installation rules ### Installation rules


install: $(PROGRAMS) $(SCRIPTS) install: $(PROGRAMS) $(SCRIPTS)
$(INSTALL) -d -m755 $(DESTDIR)$(bindir) $(INSTALL) -d -m755 $(call shellquote,$(DESTDIR)$(bindir))
$(INSTALL) $(PROGRAMS) $(SCRIPTS) $(DESTDIR)$(bindir) $(INSTALL) $(PROGRAMS) $(SCRIPTS) $(call shellquote,$(DESTDIR)$(bindir))
$(INSTALL) git-revert $(DESTDIR)$(bindir)/git-cherry-pick sh ./cmd-rename.sh $(call shellquote,$(DESTDIR)$(bindir))
sh ./cmd-rename.sh $(DESTDIR)$(bindir)
$(MAKE) -C templates install $(MAKE) -C templates install
$(INSTALL) -d -m755 $(DESTDIR)$(GIT_PYTHON_DIR) $(INSTALL) -d -m755 $(call shellquote,$(DESTDIR)$(GIT_PYTHON_DIR))
$(INSTALL) $(PYMODULES) $(DESTDIR)$(GIT_PYTHON_DIR) $(INSTALL) $(PYMODULES) $(call shellquote,$(DESTDIR)$(GIT_PYTHON_DIR))


install-doc: install-doc:
$(MAKE) -C Documentation install $(MAKE) -C Documentation install

180
apply.c

@ -5,36 +5,28 @@
* *
* This applies patches on top of some (arbitrary) version of the SCM. * This applies patches on top of some (arbitrary) version of the SCM.
* *
* NOTE! It does all its work in the index file, and only cares about
* the files in the working directory if you tell it to "merge" the
* patch apply.
*
* Even when merging it always takes the source from the index, and
* uses the working tree as a "branch" for a 3-way merge.
*/ */
#include <ctype.h>
#include <fnmatch.h> #include <fnmatch.h>
#include "cache.h" #include "cache.h"
#include "quote.h" #include "quote.h"


// We default to the merge behaviour, since that's what most people would
// expect.
//
// --check turns on checking that the working tree matches the // --check turns on checking that the working tree matches the
// files that are being modified, but doesn't apply the patch // files that are being modified, but doesn't apply the patch
// --stat does just a diffstat, and doesn't actually apply // --stat does just a diffstat, and doesn't actually apply
// --show-files shows the directory changes // --numstat does numeric diffstat, and doesn't actually apply
// --index-info shows the old and new index info for paths if available.
// //
static int merge_patch = 1;
static int check_index = 0; static int check_index = 0;
static int write_index = 0; static int write_index = 0;
static int diffstat = 0; static int diffstat = 0;
static int numstat = 0;
static int summary = 0; static int summary = 0;
static int check = 0; static int check = 0;
static int apply = 1; static int apply = 1;
static int show_files = 0; static int show_index_info = 0;
static int line_termination = '\n';
static const char apply_usage[] = static const char apply_usage[] =
"git-apply [--no-merge] [--stat] [--summary] [--check] [--index] [--apply] [--show-files] <patch>..."; "git-apply [--stat] [--numstat] [--summary] [--check] [--index] [--apply] [--index-info] [-z] <patch>...";


/* /*
* For "diff-stat" like behaviour, we keep track of the biggest change * For "diff-stat" like behaviour, we keep track of the biggest change
@ -67,6 +59,8 @@ struct patch {
struct fragment *fragments; struct fragment *fragments;
char *result; char *result;
unsigned long resultsize; unsigned long resultsize;
char old_sha1_prefix[41];
char new_sha1_prefix[41];
struct patch *next; struct patch *next;
}; };


@ -366,6 +360,38 @@ static int gitdiff_dissimilarity(const char *line, struct patch *patch)
return 0; return 0;
} }


static int gitdiff_index(const char *line, struct patch *patch)
{
/* index line is N hexadecimal, "..", N hexadecimal,
* and optional space with octal mode.
*/
const char *ptr, *eol;
int len;

ptr = strchr(line, '.');
if (!ptr || ptr[1] != '.' || 40 <= ptr - line)
return 0;
len = ptr - line;
memcpy(patch->old_sha1_prefix, line, len);
patch->old_sha1_prefix[len] = 0;

line = ptr + 2;
ptr = strchr(line, ' ');
eol = strchr(line, '\n');

if (!ptr || eol < ptr)
ptr = eol;
len = ptr - line;

if (40 <= len)
return 0;
memcpy(patch->new_sha1_prefix, line, len);
patch->new_sha1_prefix[len] = 0;
if (*ptr == ' ')
patch->new_mode = patch->old_mode = strtoul(ptr+1, NULL, 8);
return 0;
}

/* /*
* This is normal for a diff that doesn't change anything: we'll fall through * This is normal for a diff that doesn't change anything: we'll fall through
* into the next diff. Tell the parser to break out. * into the next diff. Tell the parser to break out.
@ -565,6 +591,7 @@ static int parse_git_header(char *line, int len, unsigned int size, struct patch
{ "rename to ", gitdiff_renamedst }, { "rename to ", gitdiff_renamedst },
{ "similarity index ", gitdiff_similarity }, { "similarity index ", gitdiff_similarity },
{ "dissimilarity index ", gitdiff_dissimilarity }, { "dissimilarity index ", gitdiff_dissimilarity },
{ "index ", gitdiff_index },
{ "", gitdiff_unrecognized }, { "", gitdiff_unrecognized },
}; };
int i; int i;
@ -793,7 +820,10 @@ static int parse_fragment(char *line, unsigned long size, struct patch *patch, s
/* We allow "\ No newline at end of file". Depending /* We allow "\ No newline at end of file". Depending
* on locale settings when the patch was produced we * on locale settings when the patch was produced we
* don't know what this line looks like. The only * don't know what this line looks like. The only
* thing we do know is that it begins with "\ ". */ * thing we do know is that it begins with "\ ".
* Checking for 12 is just for sanity check -- any
* l10n of "\ No newline..." is at least that long.
*/
case '\\': case '\\':
if (len < 12 || memcmp(line, "\\ ", 2)) if (len < 12 || memcmp(line, "\\ ", 2))
return -1; return -1;
@ -1156,17 +1186,39 @@ static int check_patch(struct patch *patch)


if (old_name) { if (old_name) {
int changed; int changed;
int stat_ret = lstat(old_name, &st);


if (lstat(old_name, &st) < 0)
return error("%s: %s", old_name, strerror(errno));
if (check_index) { if (check_index) {
int pos = cache_name_pos(old_name, strlen(old_name)); int pos = cache_name_pos(old_name, strlen(old_name));
if (pos < 0) if (pos < 0)
return error("%s: does not exist in index", old_name); return error("%s: does not exist in index",
old_name);
if (stat_ret < 0) {
struct checkout costate;
if (errno != ENOENT)
return error("%s: %s", old_name,
strerror(errno));
/* checkout */
costate.base_dir = "";
costate.base_dir_len = 0;
costate.force = 0;
costate.quiet = 0;
costate.not_new = 0;
costate.refresh_cache = 1;
if (checkout_entry(active_cache[pos],
&costate) ||
lstat(old_name, &st))
return -1;
}

changed = ce_match_stat(active_cache[pos], &st); changed = ce_match_stat(active_cache[pos], &st);
if (changed) if (changed)
return error("%s: does not match index", old_name); return error("%s: does not match index",
old_name);
} }
else if (stat_ret < 0)
return error("%s: %s", old_name, strerror(errno));

if (patch->is_new < 0) if (patch->is_new < 0)
patch->is_new = 0; patch->is_new = 0;
st.st_mode = ntohl(create_ce_mode(st.st_mode)); st.st_mode = ntohl(create_ce_mode(st.st_mode));
@ -1218,32 +1270,38 @@ static int check_patch_list(struct patch *patch)
return error; return error;
} }


static void show_file(int c, unsigned int mode, const char *name) static inline int is_null_sha1(const unsigned char *sha1)
{ {
printf("%c %o %s\n", c, mode, name); return !memcmp(sha1, null_sha1, 20);
} }


static void show_file_list(struct patch *patch) static void show_index_list(struct patch *list)
{ {
for (;patch ; patch = patch->next) { struct patch *patch;
if (patch->is_rename) {
show_file('-', patch->old_mode, patch->old_name); /* Once we start supporting the reverse patch, it may be
show_file('+', patch->new_mode, patch->new_name); * worth showing the new sha1 prefix, but until then...
continue; */
} for (patch = list; patch; patch = patch->next) {
if (patch->is_copy || patch->is_new) { const unsigned char *sha1_ptr;
show_file('+', patch->new_mode, patch->new_name); unsigned char sha1[20];
continue; const char *name;
}
if (patch->is_delete) { name = patch->old_name ? patch->old_name : patch->new_name;
show_file('-', patch->old_mode, patch->old_name); if (patch->is_new)
continue; sha1_ptr = null_sha1;
} else if (get_sha1(patch->old_sha1_prefix, sha1))
if (patch->old_mode && patch->new_mode && patch->old_mode != patch->new_mode) { die("sha1 information is lacking or useless (%s).",
printf("M %o:%o %s\n", patch->old_mode, patch->new_mode, patch->old_name); name);
continue; else
} sha1_ptr = sha1;
printf("M %o %s\n", patch->old_mode, patch->old_name);
printf("%06o %s ",patch->old_mode, sha1_to_hex(sha1_ptr));
if (line_termination && quote_c_style(name, NULL, NULL, 0))
quote_c_style(name, NULL, stdout, 0);
else
fputs(name, stdout);
putchar(line_termination);
} }
} }


@ -1261,6 +1319,20 @@ static void stat_patch_list(struct patch *patch)
printf(" %d files changed, %d insertions(+), %d deletions(-)\n", files, adds, dels); printf(" %d files changed, %d insertions(+), %d deletions(-)\n", files, adds, dels);
} }


static void numstat_patch_list(struct patch *patch)
{
for ( ; patch; patch = patch->next) {
const char *name;
name = patch->old_name ? patch->old_name : patch->new_name;
printf("%d\t%d\t", patch->lines_added, patch->lines_deleted);
if (line_termination && quote_c_style(name, NULL, NULL, 0))
quote_c_style(name, NULL, stdout, 0);
else
fputs(name, stdout);
putchar('\n');
}
}

static void show_file_mode_name(const char *newdelete, unsigned int mode, const char *name) static void show_file_mode_name(const char *newdelete, unsigned int mode, const char *name)
{ {
if (mode) if (mode)
@ -1588,12 +1660,15 @@ static int apply_patch(int fd)
die("Unable to write new cachefile"); die("Unable to write new cachefile");
} }


if (show_files) if (show_index_info)
show_file_list(list); show_index_list(list);


if (diffstat) if (diffstat)
stat_patch_list(list); stat_patch_list(list);


if (numstat)
numstat_patch_list(list);

if (summary) if (summary)
summary_patch_list(list); summary_patch_list(list);


@ -1622,16 +1697,16 @@ int main(int argc, char **argv)
excludes = x; excludes = x;
continue; continue;
} }
/* NEEDSWORK: this does not do anything at this moment. */
if (!strcmp(arg, "--no-merge")) {
merge_patch = 0;
continue;
}
if (!strcmp(arg, "--stat")) { if (!strcmp(arg, "--stat")) {
apply = 0; apply = 0;
diffstat = 1; diffstat = 1;
continue; continue;
} }
if (!strcmp(arg, "--numstat")) {
apply = 0;
numstat = 1;
continue;
}
if (!strcmp(arg, "--summary")) { if (!strcmp(arg, "--summary")) {
apply = 0; apply = 0;
summary = 1; summary = 1;
@ -1650,8 +1725,13 @@ int main(int argc, char **argv)
apply = 1; apply = 1;
continue; continue;
} }
if (!strcmp(arg, "--show-files")) { if (!strcmp(arg, "--index-info")) {
show_files = 1; apply = 0;
show_index_info = 1;
continue;
}
if (!strcmp(arg, "-z")) {
line_termination = 0;
continue; continue;
} }
fd = open(arg, O_RDONLY); fd = open(arg, O_RDONLY);

62
cache.h

@ -11,7 +11,9 @@
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include <limits.h> #include <limits.h>
#ifndef NO_MMAP
#include <sys/mman.h> #include <sys/mman.h>
#endif
#include <sys/param.h> #include <sys/param.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <sys/types.h> #include <sys/types.h>
@ -165,6 +167,7 @@ extern int ce_match_stat(struct cache_entry *ce, struct stat *st);
extern int ce_modified(struct cache_entry *ce, struct stat *st); extern int ce_modified(struct cache_entry *ce, struct stat *st);
extern int ce_path_match(const struct cache_entry *ce, const char **pathspec); extern int ce_path_match(const struct cache_entry *ce, const char **pathspec);
extern int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_object, const char *type); extern int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_object, const char *type);
extern int index_path(unsigned char *sha1, const char *path, struct stat *st, int write_object);
extern void fill_stat_cache_info(struct cache_entry *ce, struct stat *st); extern void fill_stat_cache_info(struct cache_entry *ce, struct stat *st);


struct cache_file { struct cache_file {
@ -175,6 +178,8 @@ extern int hold_index_file_for_update(struct cache_file *, const char *path);
extern int commit_index_file(struct cache_file *); extern int commit_index_file(struct cache_file *);
extern void rollback_index_file(struct cache_file *); extern void rollback_index_file(struct cache_file *);


extern int trust_executable_bit;

#define MTIME_CHANGED 0x0001 #define MTIME_CHANGED 0x0001
#define CTIME_CHANGED 0x0002 #define CTIME_CHANGED 0x0002
#define OWNER_CHANGED 0x0004 #define OWNER_CHANGED 0x0004
@ -189,6 +194,7 @@ extern char *git_path(const char *fmt, ...) __attribute__((format (printf, 1, 2)
extern char *sha1_file_name(const unsigned char *sha1); extern char *sha1_file_name(const unsigned char *sha1);
extern char *sha1_pack_name(const unsigned char *sha1); extern char *sha1_pack_name(const unsigned char *sha1);
extern char *sha1_pack_index_name(const unsigned char *sha1); extern char *sha1_pack_index_name(const unsigned char *sha1);
extern const char *find_unique_abbrev(const unsigned char *sha1, int);
extern const unsigned char null_sha1[20]; extern const unsigned char null_sha1[20];


int git_mkstemp(char *path, size_t n, const char *template); int git_mkstemp(char *path, size_t n, const char *template);
@ -218,6 +224,7 @@ extern int read_tree(void *buffer, unsigned long size, int stage, const char **p
extern int write_sha1_from_fd(const unsigned char *sha1, int fd, char *buffer, extern int write_sha1_from_fd(const unsigned char *sha1, int fd, char *buffer,
size_t bufsize, size_t *bufposn); size_t bufsize, size_t *bufposn);
extern int write_sha1_to_fd(int fd, const unsigned char *sha1); extern int write_sha1_to_fd(int fd, const unsigned char *sha1);
extern int move_temp_to_file(const char *tmpfile, char *filename);


extern int has_sha1_pack(const unsigned char *sha1); extern int has_sha1_pack(const unsigned char *sha1);
extern int has_sha1_file(const unsigned char *sha1); extern int has_sha1_file(const unsigned char *sha1);
@ -306,6 +313,7 @@ extern struct packed_git {
void *pack_base; void *pack_base;
unsigned int pack_last_used; unsigned int pack_last_used;
unsigned int pack_use_cnt; unsigned int pack_use_cnt;
int pack_local;
unsigned char sha1[20]; unsigned char sha1[20];
char pack_name[0]; /* something like ".git/objects/pack/xxxxx.pack" */ char pack_name[0]; /* something like ".git/objects/pack/xxxxx.pack" */
} *packed_git; } *packed_git;
@ -332,6 +340,7 @@ extern int match_refs(struct ref *src, struct ref *dst, struct ref ***dst_tail,
int nr_refspec, char **refspec, int all); int nr_refspec, char **refspec, int all);
extern int get_ack(int fd, unsigned char *result_sha1); extern int get_ack(int fd, unsigned char *result_sha1);
extern struct ref **get_remote_heads(int in, struct ref **list, int nr_match, char **match, int ignore_funny); extern struct ref **get_remote_heads(int in, struct ref **list, int nr_match, char **match, int ignore_funny);
extern int server_supports(const char *feature);


extern struct packed_git *parse_pack_index(unsigned char *sha1); extern struct packed_git *parse_pack_index(unsigned char *sha1);
extern struct packed_git *parse_pack_index_file(const unsigned char *sha1, extern struct packed_git *parse_pack_index_file(const unsigned char *sha1,
@ -345,7 +354,7 @@ extern struct packed_git *find_sha1_pack(const unsigned char *sha1,


extern int use_packed_git(struct packed_git *); extern int use_packed_git(struct packed_git *);
extern void unuse_packed_git(struct packed_git *); extern void unuse_packed_git(struct packed_git *);
extern struct packed_git *add_packed_git(char *, int); extern struct packed_git *add_packed_git(char *, int, int);
extern int num_packed_objects(const struct packed_git *p); extern int num_packed_objects(const struct packed_git *p);
extern int nth_packed_object_sha1(const struct packed_git *, int, unsigned char*); extern int nth_packed_object_sha1(const struct packed_git *, int, unsigned char*);
extern int find_pack_entry_one(const unsigned char *, struct pack_entry *, struct packed_git *); extern int find_pack_entry_one(const unsigned char *, struct pack_entry *, struct packed_git *);
@ -355,4 +364,55 @@ extern void packed_object_info_detail(struct pack_entry *, char *, unsigned long
/* Dumb servers support */ /* Dumb servers support */
extern int update_server_info(int); extern int update_server_info(int);


#ifdef NO_MMAP

#ifndef PROT_READ
#define PROT_READ 1
#define PROT_WRITE 2
#define MAP_PRIVATE 1
#define MAP_FAILED ((void*)-1)
#endif

extern void *gitfakemmap(void *start, size_t length, int prot , int flags, int fd, off_t offset);
extern int gitfakemunmap(void *start, size_t length);

#endif

typedef int (*config_fn_t)(const char *, const char *);
extern int git_default_config(const char *, const char *);
extern int git_config(config_fn_t fn);
extern int git_config_int(const char *, const char *);
extern int git_config_bool(const char *, const char *);

#define MAX_GITNAME (1000)
extern char git_default_email[MAX_GITNAME];
extern char git_default_name[MAX_GITNAME];

/* Sane ctype - no locale, and works with signed chars */
#undef isspace
#undef isdigit
#undef isalpha
#undef isalnum
#undef tolower
#undef toupper
extern unsigned char sane_ctype[256];
#define GIT_SPACE 0x01
#define GIT_DIGIT 0x02
#define GIT_ALPHA 0x04
#define sane_istest(x,mask) ((sane_ctype[(unsigned char)(x)] & (mask)) != 0)
#define isspace(x) sane_istest(x,GIT_SPACE)
#define isdigit(x) sane_istest(x,GIT_DIGIT)
#define isalpha(x) sane_istest(x,GIT_ALPHA)
#define isalnum(x) sane_istest(x,GIT_ALPHA | GIT_DIGIT)
#define tolower(x) sane_case((unsigned char)(x), 0x20)
#define toupper(x) sane_case((unsigned char)(x), 0)

static inline int sane_case(int x, int high)
{
if (sane_istest(x, GIT_ALPHA))
x = (x & ~0x20) | high;
return x;
}

extern int copy_fd(int ifd, int ofd);
#endif /* CACHE_H */ #endif /* CACHE_H */

9
checkout-index.c

@ -63,15 +63,20 @@ static int checkout_file(const char *name)


static int checkout_all(void) static int checkout_all(void)
{ {
int i; int i, errs = 0;


for (i = 0; i < active_nr ; i++) { for (i = 0; i < active_nr ; i++) {
struct cache_entry *ce = active_cache[i]; struct cache_entry *ce = active_cache[i];
if (ce_stage(ce)) if (ce_stage(ce))
continue; continue;
if (checkout_entry(ce, &state) < 0) if (checkout_entry(ce, &state) < 0)
return -1; errs++;
} }
if (errs)
/* we have already done our error reporting.
* exit with the same code as die().
*/
exit(128);
return 0; return 0;
} }



177
clone-pack.c

@ -3,8 +3,8 @@
#include "pkt-line.h" #include "pkt-line.h"
#include <sys/wait.h> #include <sys/wait.h>


static int quiet; static const char clone_pack_usage[] =
static const char clone_pack_usage[] = "git-clone-pack [-q] [--exec=<git-upload-pack>] [<host>:]<directory> [<heads>]*"; "git-clone-pack [--exec=<git-upload-pack>] [<host>:]<directory> [<heads>]*";
static const char *exec = "git-upload-pack"; static const char *exec = "git-upload-pack";


static void clone_handshake(int fd[2], struct ref *ref) static void clone_handshake(int fd[2], struct ref *ref)
@ -112,11 +112,143 @@ static void write_refs(struct ref *ref)
free(head_path); free(head_path);
} }


static int finish_pack(const char *pack_tmp_name)
{
int pipe_fd[2];
pid_t pid;
char idx[PATH_MAX];
char final[PATH_MAX];
char hash[41];
unsigned char sha1[20];
char *cp;
int err = 0;

if (pipe(pipe_fd) < 0)
die("git-clone-pack: unable to set up pipe");

strcpy(idx, pack_tmp_name); /* ".git/objects/pack-XXXXXX" */
cp = strrchr(idx, '/');
memcpy(cp, "/pidx", 5);

pid = fork();
if (pid < 0)
die("git-clone-pack: unable to fork off git-index-pack");
if (!pid) {
close(0);
dup2(pipe_fd[1], 1);
close(pipe_fd[0]);
close(pipe_fd[1]);
execlp("git-index-pack","git-index-pack",
"-o", idx, pack_tmp_name, NULL);
error("cannot exec git-index-pack <%s> <%s>",
idx, pack_tmp_name);
exit(1);
}
close(pipe_fd[1]);
if (read(pipe_fd[0], hash, 40) != 40) {
error("git-clone-pack: unable to read from git-index-pack");
err = 1;
}
close(pipe_fd[0]);

for (;;) {
int status, code;
int retval = waitpid(pid, &status, 0);

if (retval < 0) {
if (errno == EINTR)
continue;
error("waitpid failed (%s)", strerror(retval));
goto error_die;
}
if (WIFSIGNALED(status)) {
int sig = WTERMSIG(status);
error("git-index-pack died of signal %d", sig);
goto error_die;
}
if (!WIFEXITED(status)) {
error("git-index-pack died of unnatural causes %d",
status);
goto error_die;
}
code = WEXITSTATUS(status);
if (code) {
error("git-index-pack died with error code %d", code);
goto error_die;
}
if (err)
goto error_die;
break;
}
hash[40] = 0;
if (get_sha1_hex(hash, sha1)) {
error("git-index-pack reported nonsense '%s'", hash);
goto error_die;
}
/* Now we have pack in pack_tmp_name[], and
* idx in idx[]; rename them to their final names.
*/
snprintf(final, sizeof(final),
"%s/pack/pack-%s.pack", get_object_directory(), hash);
move_temp_to_file(pack_tmp_name, final);
chmod(final, 0444);
snprintf(final, sizeof(final),
"%s/pack/pack-%s.idx", get_object_directory(), hash);
move_temp_to_file(idx, final);
chmod(final, 0444);
return 0;

error_die:
unlink(idx);
unlink(pack_tmp_name);
exit(1);
}

static int clone_without_unpack(int fd[2])
{
char tmpfile[PATH_MAX];
int ofd, ifd;

ifd = fd[0];
snprintf(tmpfile, sizeof(tmpfile),
"%s/pack/tmp-XXXXXX", get_object_directory());
ofd = mkstemp(tmpfile);
if (ofd < 0)
return error("unable to create temporary file %s", tmpfile);

while (1) {
char buf[8192];
ssize_t sz, wsz, pos;
sz = read(ifd, buf, sizeof(buf));
if (sz == 0)
break;
if (sz < 0) {
error("error reading pack (%s)", strerror(errno));
close(ofd);
unlink(tmpfile);
return -1;
}
pos = 0;
while (pos < sz) {
wsz = write(ofd, buf + pos, sz - pos);
if (wsz < 0) {
error("error writing pack (%s)",
strerror(errno));
close(ofd);
unlink(tmpfile);
return -1;
}
pos += wsz;
}
}
close(ofd);
return finish_pack(tmpfile);
}

static int clone_pack(int fd[2], int nr_match, char **match) static int clone_pack(int fd[2], int nr_match, char **match)
{ {
struct ref *refs; struct ref *refs;
int status; int status;
pid_t pid;


get_remote_heads(fd[0], &refs, nr_match, match, 1); get_remote_heads(fd[0], &refs, nr_match, match, 1);
if (!refs) { if (!refs) {
@ -124,35 +256,12 @@ static int clone_pack(int fd[2], int nr_match, char **match)
die("no matching remote head"); die("no matching remote head");
} }
clone_handshake(fd, refs); clone_handshake(fd, refs);
pid = fork();
if (pid < 0) status = clone_without_unpack(fd);
die("git-clone-pack: unable to fork off git-unpack-objects");
if (!pid) { if (!status)
dup2(fd[0], 0);
close(fd[0]);
close(fd[1]);
execlp("git-unpack-objects", "git-unpack-objects",
quiet ? "-q" : NULL, NULL);
die("git-unpack-objects exec failed");
}
close(fd[0]);
close(fd[1]);
while (waitpid(pid, &status, 0) < 0) {
if (errno != EINTR)
die("waiting for git-unpack-objects: %s", strerror(errno));
}
if (WIFEXITED(status)) {
int code = WEXITSTATUS(status);
if (code)
die("git-unpack-objects died with error code %d", code);
write_refs(refs); write_refs(refs);
return 0; return status;
}
if (WIFSIGNALED(status)) {
int sig = WTERMSIG(status);
die("git-unpack-objects died of signal %d", sig);
}
die("Sherlock Holmes! git-unpack-objects died of unnatural causes %d!", status);
} }


int main(int argc, char **argv) int main(int argc, char **argv)
@ -168,14 +277,14 @@ int main(int argc, char **argv)
char *arg = argv[i]; char *arg = argv[i];


if (*arg == '-') { if (*arg == '-') {
if (!strcmp("-q", arg)) { if (!strcmp("-q", arg))
quiet = 1;
continue; continue;
}
if (!strncmp("--exec=", arg, 7)) { if (!strncmp("--exec=", arg, 7)) {
exec = arg + 7; exec = arg + 7;
continue; continue;
} }
if (!strcmp("--keep", arg))
continue;
usage(clone_pack_usage); usage(clone_pack_usage);
} }
dest = arg; dest = arg;

8
commit-tree.c

@ -5,10 +5,6 @@
*/ */
#include "cache.h" #include "cache.h"


#include <pwd.h>
#include <time.h>
#include <ctype.h>

#define BLOCKING (1ul << 14) #define BLOCKING (1ul << 14)


/* /*
@ -89,6 +85,9 @@ int main(int argc, char **argv)
char *buffer; char *buffer;
unsigned int size; unsigned int size;


setup_ident();
git_config(git_default_config);

if (argc < 2 || get_sha1_hex(argv[1], tree_sha1) < 0) if (argc < 2 || get_sha1_hex(argv[1], tree_sha1) < 0)
usage(commit_tree_usage); usage(commit_tree_usage);


@ -104,7 +103,6 @@ int main(int argc, char **argv)
} }
if (!parents) if (!parents)
fprintf(stderr, "Committing initial tree %s\n", argv[1]); fprintf(stderr, "Committing initial tree %s\n", argv[1]);
setup_ident();


init_buffer(&buffer, &size); init_buffer(&buffer, &size);
add_buffer(&buffer, &size, "tree %s\n", sha1_to_hex(tree_sha1)); add_buffer(&buffer, &size, "tree %s\n", sha1_to_hex(tree_sha1));

1
commit.c

@ -1,4 +1,3 @@
#include <ctype.h>
#include "tag.h" #include "tag.h"
#include "commit.h" #include "commit.h"
#include "cache.h" #include "cache.h"

50
compat/mmap.c

@ -0,0 +1,50 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include "../cache.h"

void *gitfakemmap(void *start, size_t length, int prot , int flags, int fd, off_t offset)
{
int n = 0;

if (start != NULL || !(flags & MAP_PRIVATE))
die("Invalid usage of gitfakemmap.");

if (lseek(fd, offset, SEEK_SET) < 0) {
errno = EINVAL;
return MAP_FAILED;
}

start = xmalloc(length);
if (start == NULL) {
errno = ENOMEM;
return MAP_FAILED;
}

while (n < length) {
int count = read(fd, start+n, length-n);

if (count == 0) {
memset(start+n, 0, length-n);
break;
}

if (count < 0) {
free(start);
errno = EACCES;
return MAP_FAILED;
}

n += count;
}

return start;
}

int gitfakemunmap(void *start, size_t length)
{
free(start);
return 0;
}

236
config.c

@ -0,0 +1,236 @@

#include "cache.h"

#define MAXNAME (256)

static FILE *config_file;
static int config_linenr;
static int get_next_char(void)
{
int c;
FILE *f;

c = '\n';
if ((f = config_file) != NULL) {
c = fgetc(f);
if (c == '\n')
config_linenr++;
if (c == EOF) {
config_file = NULL;
c = '\n';
}
}
return c;
}

static char *parse_value(void)
{
static char value[1024];
int quote = 0, comment = 0, len = 0, space = 0;

for (;;) {
int c = get_next_char();
if (len >= sizeof(value))
return NULL;
if (c == '\n') {
if (quote)
return NULL;
value[len] = 0;
return value;
}
if (comment)
continue;
if (isspace(c) && !quote) {
space = 1;
continue;
}
if (space) {
if (len)
value[len++] = ' ';
space = 0;
}
if (c == '\\') {
c = get_next_char();
switch (c) {
case '\n':
continue;
case 't':
c = '\t';
break;
case 'b':
c = '\b';
break;
case 'n':
c = '\n';
break;
/* Some characters escape as themselves */
case '\\': case '"':
break;
/* Reject unknown escape sequences */
default:
return NULL;
}
value[len++] = c;
continue;
}
if (c == '"') {
quote = 1-quote;
continue;
}
if (!quote) {
if (c == ';' || c == '#') {
comment = 1;
continue;
}
}
value[len++] = c;
}
}

static int get_value(config_fn_t fn, char *name, unsigned int len)
{
int c;
char *value;

/* Get the full name */
for (;;) {
c = get_next_char();
if (c == EOF)
break;
if (!isalnum(c))
break;
name[len++] = tolower(c);
if (len >= MAXNAME)
return -1;
}
name[len] = 0;
while (c == ' ' || c == '\t')
c = get_next_char();

value = NULL;
if (c != '\n') {
if (c != '=')
return -1;
value = parse_value();
if (!value)
return -1;
}
return fn(name, value);
}

static int get_base_var(char *name)
{
int baselen = 0;

for (;;) {
int c = get_next_char();
if (c == EOF)
return -1;
if (c == ']')
return baselen;
if (!isalnum(c))
return -1;
if (baselen > MAXNAME / 2)
return -1;
name[baselen++] = tolower(c);
}
}

static int git_parse_file(config_fn_t fn)
{
int comment = 0;
int baselen = 0;
static char var[MAXNAME];

for (;;) {
int c = get_next_char();
if (c == '\n') {
/* EOF? */
if (!config_file)
return 0;
comment = 0;
continue;
}
if (comment || isspace(c))
continue;
if (c == '#' || c == ';') {
comment = 1;
continue;
}
if (c == '[') {
baselen = get_base_var(var);
if (baselen <= 0)
break;
var[baselen++] = '.';
var[baselen] = 0;
continue;
}
if (!isalpha(c))
break;
var[baselen] = tolower(c);
if (get_value(fn, var, baselen+1) < 0)
break;
}
die("bad config file line %d", config_linenr);
}

int git_config_int(const char *name, const char *value)
{
if (value && *value) {
char *end;
int val = strtol(value, &end, 0);
if (!*end)
return val;
}
die("bad config value for '%s'", name);
}

int git_config_bool(const char *name, const char *value)
{
if (!value)
return 1;
if (!*value)
return 0;
if (!strcasecmp(value, "true"))
return 1;
if (!strcasecmp(value, "false"))
return 0;
return git_config_int(name, value) != 0;
}

int git_default_config(const char *var, const char *value)
{
/* This needs a better name */
if (!strcmp(var, "core.filemode")) {
trust_executable_bit = git_config_bool(var, value);
return 0;
}

if (!strcmp(var, "user.name")) {
strncpy(git_default_name, value, sizeof(git_default_name));
return 0;
}

if (!strcmp(var, "user.email")) {
strncpy(git_default_email, value, sizeof(git_default_email));
return 0;
}

/* Add other config variables here.. */
return 0;
}

int git_config(config_fn_t fn)
{
int ret;
FILE *f = fopen(git_path("config"), "r");

ret = -1;
if (f) {
config_file = f;
config_linenr = 1;
ret = git_parse_file(fn);
fclose(f);
}
return ret;
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save