diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Documentation/Makefile | 1 | ||||
-rw-r--r-- | Documentation/SubmittingPatches | 4 | ||||
-rw-r--r-- | Documentation/git-add.txt | 5 | ||||
-rw-r--r-- | Documentation/git-branch.txt | 3 | ||||
-rw-r--r-- | Documentation/git-check-ref-format.txt | 2 | ||||
-rw-r--r-- | Documentation/git-checkout.txt | 5 | ||||
-rw-r--r-- | Documentation/git-quiltimport.txt | 61 | ||||
-rwxr-xr-x | Documentation/install-webdoc.sh | 8 | ||||
-rw-r--r-- | Documentation/tutorial-2.txt | 391 | ||||
-rw-r--r-- | Documentation/tutorial.txt | 199 | ||||
-rwxr-xr-x | GIT-VERSION-GEN | 4 | ||||
-rw-r--r-- | Makefile | 89 | ||||
-rw-r--r-- | builtin-add.c | 187 | ||||
-rw-r--r-- | builtin-apply.c (renamed from apply.c) | 85 | ||||
-rw-r--r-- | builtin-cat-file.c (renamed from cat-file.c) | 3 | ||||
-rw-r--r-- | builtin-check-ref-format.c | 14 | ||||
-rw-r--r-- | builtin-commit-tree.c (renamed from commit-tree.c) | 5 | ||||
-rw-r--r-- | builtin-diff-files.c (renamed from diff-files.c) | 3 | ||||
-rw-r--r-- | builtin-diff-index.c (renamed from diff-index.c) | 3 | ||||
-rw-r--r-- | builtin-diff-stages.c (renamed from diff-stages.c) | 3 | ||||
-rw-r--r-- | builtin-diff-tree.c (renamed from diff-tree.c) | 8 | ||||
-rw-r--r-- | builtin-diff.c | 4 | ||||
-rw-r--r-- | builtin-grep.c | 23 | ||||
-rw-r--r-- | builtin-init-db.c (renamed from init-db.c) | 12 | ||||
-rw-r--r-- | builtin-log.c | 146 | ||||
-rw-r--r-- | builtin-ls-files.c (renamed from ls-files.c) | 384 | ||||
-rw-r--r-- | builtin-ls-tree.c (renamed from ls-tree.c) | 5 | ||||
-rw-r--r-- | builtin-read-tree.c (renamed from read-tree.c) | 48 | ||||
-rw-r--r-- | builtin-rev-list.c (renamed from rev-list.c) | 7 | ||||
-rw-r--r-- | builtin-rm.c | 150 | ||||
-rw-r--r-- | builtin-show-branch.c (renamed from show-branch.c) | 9 | ||||
-rw-r--r-- | builtin-tar-tree.c (renamed from tar-tree.c) | 62 | ||||
-rw-r--r-- | builtin-upload-tar.c | 74 | ||||
-rw-r--r-- | builtin.h | 18 | ||||
-rw-r--r-- | cache.h | 8 | ||||
-rw-r--r-- | check-ref-format.c | 17 | ||||
-rw-r--r-- | commit.c | 105 | ||||
-rw-r--r-- | commit.h | 2 | ||||
-rw-r--r-- | compat/inet_ntop.c | 200 | ||||
-rw-r--r-- | connect.c | 2 | ||||
-rw-r--r-- | contrib/git-svn/Makefile | 1 | ||||
-rwxr-xr-x | contrib/git-svn/git-svn.perl | 108 | ||||
-rw-r--r-- | contrib/git-svn/t/lib-git-svn.sh | 39 | ||||
-rw-r--r-- | contrib/git-svn/t/t0000-contrib-git-svn.sh | 43 | ||||
-rw-r--r-- | contrib/git-svn/t/t0001-contrib-git-svn-props.sh | 125 | ||||
-rw-r--r-- | contrib/remotes2config.sh | 35 | ||||
-rw-r--r-- | diff.c | 136 | ||||
-rw-r--r-- | diff.h | 4 | ||||
-rw-r--r-- | dir.c | 401 | ||||
-rw-r--r-- | dir.h | 51 | ||||
-rw-r--r-- | fetch-pack.c | 66 | ||||
-rw-r--r-- | fetch.c | 7 | ||||
-rw-r--r-- | fetch.h | 3 | ||||
-rwxr-xr-x | generate-cmdlist.sh | 1 | ||||
-rwxr-xr-x | git-add.sh | 56 | ||||
-rwxr-xr-x | git-am.sh | 38 | ||||
-rwxr-xr-x | git-clone.sh | 4 | ||||
-rwxr-xr-x | git-commit.sh | 17 | ||||
-rwxr-xr-x | git-cvsimport.perl | 230 | ||||
-rwxr-xr-x | git-format-patch.sh | 344 | ||||
-rwxr-xr-x | git-parse-remote.sh | 28 | ||||
-rwxr-xr-x | git-quiltimport.sh | 118 | ||||
-rwxr-xr-x | git-rebase.sh | 2 | ||||
-rwxr-xr-x | git-rm.sh | 70 | ||||
-rw-r--r-- | git.c | 21 | ||||
-rw-r--r-- | log-tree.c | 51 | ||||
-rw-r--r-- | mktag.c | 45 | ||||
-rw-r--r-- | read-cache.c | 183 | ||||
-rw-r--r-- | revision.h | 2 | ||||
-rw-r--r-- | sha1_file.c | 185 | ||||
-rwxr-xr-x | t/t1002-read-tree-m-u-2way.sh | 66 | ||||
-rwxr-xr-x | t/t3500-cherry.sh | 1 | ||||
-rwxr-xr-x | t/t4002-diff-basic.sh | 6 | ||||
-rwxr-xr-x | t/t6022-merge-rename.sh | 1 | ||||
-rw-r--r-- | update-index.c | 192 |
76 files changed, 3457 insertions, 1583 deletions
diff --git a/.gitignore b/.gitignore index b5959d6311..199cc310a2 100644 --- a/.gitignore +++ b/.gitignore @@ -77,6 +77,7 @@ git-prune git-prune-packed git-pull git-push +git-quiltimport git-read-tree git-rebase git-receive-pack diff --git a/Documentation/Makefile b/Documentation/Makefile index c1af22ce04..2a08f592d9 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile @@ -7,6 +7,7 @@ MAN7_TXT=git.txt DOC_HTML=$(patsubst %.txt,%.html,$(MAN1_TXT) $(MAN7_TXT)) ARTICLES = tutorial +ARTICLES += tutorial-2 ARTICLES += core-tutorial ARTICLES += cvs-migration ARTICLES += diffcore diff --git a/Documentation/SubmittingPatches b/Documentation/SubmittingPatches index 318b04fdeb..8601949e80 100644 --- a/Documentation/SubmittingPatches +++ b/Documentation/SubmittingPatches @@ -266,8 +266,8 @@ This recipe appears to work with the current [*1*] Thunderbird from Suse. The following Thunderbird extensions are needed: AboutConfig 0.5 http://aboutconfig.mozdev.org/ - External Editor 0.5.4 - http://extensionroom.mozdev.org/more-info/exteditor + External Editor 0.7.2 + http://globs.org/articles.php?lng=en&pg=8 1) Prepare the patch as a text file using your method of choice. diff --git a/Documentation/git-add.txt b/Documentation/git-add.txt index 5e3112943d..6342ea33e4 100644 --- a/Documentation/git-add.txt +++ b/Documentation/git-add.txt @@ -14,11 +14,13 @@ DESCRIPTION A simple wrapper for git-update-index to add files to the index, for people used to do "cvs add". +It only adds non-ignored files, to add ignored files use +"git update-index --add". OPTIONS ------- <file>...:: - Files to add to the index. + Files to add to the index (see gitlink:git-ls-files[1]). -n:: Don't actually add the file(s), just show if they exist. @@ -68,6 +70,7 @@ git-add git-*.sh:: See Also -------- gitlink:git-rm[1] +gitlink:git-ls-files[1] Author ------ diff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt index a7bec3c101..d43ef1dec4 100644 --- a/Documentation/git-branch.txt +++ b/Documentation/git-branch.txt @@ -49,6 +49,9 @@ OPTIONS <branchname>:: The name of the branch to create or delete. + The new branch name must pass all checks defined by + gitlink:git-check-ref-format[1]. Some of these checks + may restrict the characters allowed in a branch name. <start-point>:: The new branch will be created with a HEAD equal to this. It may diff --git a/Documentation/git-check-ref-format.txt b/Documentation/git-check-ref-format.txt index 7dc1bdb6ef..3ea720dd00 100644 --- a/Documentation/git-check-ref-format.txt +++ b/Documentation/git-check-ref-format.txt @@ -45,6 +45,8 @@ refname expressions (see gitlink:git-rev-parse[1]). Namely: . colon `:` is used as in `srcref:dstref` to mean "use srcref\'s value and store it in dstref" in fetch and push operations. + It may also be used to select a specific object such as with + gitlink:git-cat-file[1] "git-cat-file blob v1.3.3:refs.c". GIT diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt index 0643943854..fbdbadc74f 100644 --- a/Documentation/git-checkout.txt +++ b/Documentation/git-checkout.txt @@ -35,7 +35,10 @@ OPTIONS Force a re-read of everything. -b:: - Create a new branch and start it at <branch>. + Create a new branch named <new_branch> and start it at + <branch>. The new branch name must pass all checks defined + by gitlink:git-check-ref-format[1]. Some of these checks + may restrict the characters allowed in a branch name. -l:: Create the new branch's ref log. This activates recording of diff --git a/Documentation/git-quiltimport.txt b/Documentation/git-quiltimport.txt new file mode 100644 index 0000000000..6e9a8c369a --- /dev/null +++ b/Documentation/git-quiltimport.txt @@ -0,0 +1,61 @@ +git-quiltimport(1) +================ + +NAME +---- +git-quiltimport - Applies a quilt patchset onto the current branch + + +SYNOPSIS +-------- +[verse] +'git-quiltimport' [--dry-run] [--author <author>] [--patches <dir>] + + +DESCRIPTION +----------- +Applies a quilt patchset onto the current git branch, preserving +the patch boundaries, patch order, and patch descriptions present +in the quilt patchset. + +For each patch the code attempts to extract the author from the +patch description. If that fails it falls back to the author +specified with --author. If the --author flag was not given +the patch description is displayed and the user is asked to +interactively enter the author of the patch. + +If a subject is not found in the patch description the patch name is +preserved as the 1 line subject in the git description. + +OPTIONS +------- +--dry-run:: + Walk through the patches in the series and warn + if we cannot find all of the necessary information to commit + a patch. At the time of this writing only missing author + information is warned about. + +--author Author Name <Author Email>:: + The author name and email address to use when no author + information can be found in the patch description. + +--patches <dir>:: + The directory to find the quilt patches and the + quilt series file. + + The default for the patch directory is patches + or the value of the $QUILT_PATCHES environment + variable. + +Author +------ +Written by Eric Biederman <ebiederm@lnxi.com> + +Documentation +-------------- +Documentation by Eric Biederman <ebiederm@lnxi.com> + +GIT +--- +Part of the gitlink:git[7] suite + diff --git a/Documentation/install-webdoc.sh b/Documentation/install-webdoc.sh index 50638c78d5..60211a5058 100755 --- a/Documentation/install-webdoc.sh +++ b/Documentation/install-webdoc.sh @@ -4,12 +4,16 @@ T="$1" for h in *.html *.txt howto/*.txt howto/*.html do - diff -u -I'Last updated [0-9][0-9]-[A-Z][a-z][a-z]-' "$T/$h" "$h" || { + if test -f "$T/$h" && + diff -u -I'Last updated [0-9][0-9]-[A-Z][a-z][a-z]-' "$T/$h" "$h" + then + :; # up to date + else echo >&2 "# install $h $T/$h" rm -f "$T/$h" mkdir -p `dirname "$T/$h"` cp "$h" "$T/$h" - } + fi done strip_leading=`echo "$T/" | sed -e 's|.|.|g'` for th in "$T"/*.html "$T"/*.txt "$T"/howto/*.txt "$T"/howto/*.html diff --git a/Documentation/tutorial-2.txt b/Documentation/tutorial-2.txt new file mode 100644 index 0000000000..08d3453e5c --- /dev/null +++ b/Documentation/tutorial-2.txt @@ -0,0 +1,391 @@ +A tutorial introduction to git: part two +======================================== + +You should work through link:tutorial.html[A tutorial introduction to +git] before reading this tutorial. + +The goal of this tutorial is to introduce two fundamental pieces of +git's architecture--the object database and the index file--and to +provide the reader with everything necessary to understand the rest +of the git documentation. + +The git object database +----------------------- + +Let's start a new project and create a small amount of history: + +------------------------------------------------ +$ mkdir test-project +$ cd test-project +$ git init-db +defaulting to local storage area +$ echo 'hello world' > file.txt +$ git add . +$ git commit -a -m "initial commit" +Committing initial tree 92b8b694ffb1675e5975148e1121810081dbdffe +$ echo 'hello world!' >file.txt +$ git commit -a -m "add emphasis" +------------------------------------------------ + +What are the 40 digits of hex that git responded to the first commit +with? + +We saw in part one of the tutorial that commits have names like this. +It turns out that every object in the git history is stored under +such a 40-digit hex name. That name is the SHA1 hash of the object's +contents; among other things, this ensures that git will never store +the same data twice (since identical data is given an identical SHA1 +name), and that the contents of a git object will never change (since +that would change the object's name as well). + +We can ask git about this particular object with the cat-file +command--just cut-and-paste from the reply to the initial commit, to +save yourself typing all 40 hex digits: + +------------------------------------------------ +$ git cat-file -t 92b8b694ffb1675e5975148e1121810081dbdffe +tree +------------------------------------------------ + +A tree can refer to one or more "blob" objects, each corresponding to +a file. In addition, a tree can also refer to other tree objects, +thus creating a directory heirarchy. You can examine the contents of +any tree using ls-tree (remember that a long enough initial portion +of the SHA1 will also work): + +------------------------------------------------ +$ git ls-tree 92b8b694 +100644 blob 3b18e512dba79e4c8300dd08aeb37f8e728b8dad file.txt +------------------------------------------------ + +Thus we see that this tree has one file in it. The SHA1 hash is a +reference to that file's data: + +------------------------------------------------ +$ git cat-file -t 3b18e512 +blob +------------------------------------------------ + +A "blob" is just file data, which we can also examine with cat-file: + +------------------------------------------------ +$ git cat-file blob 3b18e512 +hello world +------------------------------------------------ + +Note that this is the old file data; so the object that git named in +its response to the initial tree was a tree with a snapshot of the +directory state that was recorded by the first commit. + +All of these objects are stored under their SHA1 names inside the git +directory: + +------------------------------------------------ +$ find .git/objects/ +.git/objects/ +.git/objects/pack +.git/objects/info +.git/objects/3b +.git/objects/3b/18e512dba79e4c8300dd08aeb37f8e728b8dad +.git/objects/92 +.git/objects/92/b8b694ffb1675e5975148e1121810081dbdffe +.git/objects/54 +.git/objects/54/196cc2703dc165cbd373a65a4dcf22d50ae7f7 +.git/objects/a0 +.git/objects/a0/423896973644771497bdc03eb99d5281615b51 +.git/objects/d0 +.git/objects/d0/492b368b66bdabf2ac1fd8c92b39d3db916e59 +.git/objects/c4 +.git/objects/c4/d59f390b9cfd4318117afde11d601c1085f241 +------------------------------------------------ + +and the contents of these files is just the compressed data plus a +header identifying their length and their type. The type is either a +blob, a tree, a commit, or a tag. We've seen a blob and a tree now, +so next we should look at a commit. + +The simplest commit to find is the HEAD commit, which we can find +from .git/HEAD: + +------------------------------------------------ +$ cat .git/HEAD +ref: refs/heads/master +------------------------------------------------ + +As you can see, this tells us which branch we're currently on, and it +tells us this by naming a file under the .git directory, which itself +contains a SHA1 name referring to a commit object, which we can +examine with cat-file: + +------------------------------------------------ +$ cat .git/refs/heads/master +c4d59f390b9cfd4318117afde11d601c1085f241 +$ git cat-file -t c4d59f39 +commit +$ git cat-file commit c4d59f39 +tree d0492b368b66bdabf2ac1fd8c92b39d3db916e59 +parent 54196cc2703dc165cbd373a65a4dcf22d50ae7f7 +author J. Bruce Fields <bfields@puzzle.fieldses.org> 1143418702 -0500 +committer J. Bruce Fields <bfields@puzzle.fieldses.org> 1143418702 -0500 + +add emphasis +------------------------------------------------ + +The "tree" object here refers to the new state of the tree: + +------------------------------------------------ +$ git ls-tree d0492b36 +100644 blob a0423896973644771497bdc03eb99d5281615b51 file.txt +$ git cat-file commit a0423896 +hello world! +------------------------------------------------ + +and the "parent" object refers to the previous commit: + +------------------------------------------------ +$ git-cat-file commit 54196cc2 +tree 92b8b694ffb1675e5975148e1121810081dbdffe +author J. Bruce Fields <bfields@puzzle.fieldses.org> 1143414668 -0500 +committer J. Bruce Fields <bfields@puzzle.fieldses.org> 1143414668 -0500 + +initial commit +------------------------------------------------ + +The tree object is the tree we examined first, and this commit is +unusual in that it lacks any parent. + +Most commits have only one parent, but it is also common for a commit +to have multiple parents. In that case the commit represents a +merge, with the parent references pointing to the heads of the merged +branches. + +Besides blobs, trees, and commits, the only remaining type of object +is a "tag", which we won't discuss here; refer to gitlink:git-tag[1] +for details. + +So now we know how git uses the object database to represent a +project's history: + + * "commit" objects refer to "tree" objects representing the + snapshot of a directory tree at a particular point in the + history, and refer to "parent" commits to show how they're + connected into the project history. + * "tree" objects represent the state of a single directory, + associating directory names to "blob" objects containing file + data and "tree" objects containing subdirectory information. + * "blob" objects contain file data without any other structure. + * References to commit objects at the head of each branch are + stored in files under .git/refs/heads/. + * The name of the current branch is stored in .git/HEAD. + +Note, by the way, that lots of commands take a tree as an argument. +But as we can see above, a tree can be referred to in many different +ways--by the SHA1 name for that tree, by the name of a commit that +refers to the tree, by the name of a branch whose head refers to that +tree, etc.--and most such commands can accept any of these names. + +In command synopses, the word "tree-ish" is sometimes used to +designate such an argument. + +The index file +-------------- + +The primary tool we've been using to create commits is "git commit +-a", which creates a commit including every change you've made to +your working tree. But what if you want to commit changes only to +certain files? Or only certain changes to certain files? + +If we look at the way commits are created under the cover, we'll see +that there are more flexible ways creating commits. + +Continuing with our test-project, let's modify file.txt again: + +------------------------------------------------ +$ echo "hello world, again" >>file.txt +------------------------------------------------ + +but this time instead of immediately making the commit, let's take an +intermediate step, and ask for diffs along the way to keep track of +what's happening: + +------------------------------------------------ +$ git diff +--- a/file.txt ++++ b/file.txt +@@ -1 +1,2 @@ + hello world! ++hello world, again +$ git update-index file.txt +$ git diff +------------------------------------------------ + +The last diff is empty, but no new commits have been made, and the +head still doesn't contain the new line: + +------------------------------------------------ +$ git-diff HEAD +diff --git a/file.txt b/file.txt +index a042389..513feba 100644 +--- a/file.txt ++++ b/file.txt +@@ -1 +1,2 @@ + hello world! ++hello world, again +------------------------------------------------ + +So "git diff" is comparing against something other than the head. +The thing that it's comparing against is actually the index file, +which is stored in .git/index in a binary format, but whose contents +we can examine with ls-files: + +------------------------------------------------ +$ git ls-files --stage +100644 513feba2e53ebbd2532419ded848ba19de88ba00 0 file.txt +$ git cat-file -t 513feba2 +blob +$ git cat-file blob 513feba2 +hello world, again +------------------------------------------------ + +So what our "git update-index" did was store a new blob and then put +a reference to it in the index file. If we modify the file again, +we'll see that the new modifications are reflected in the "git-diff" +output: + +------------------------------------------------ +$ echo 'again?' >>file.txt +$ git diff +index 513feba..ba3da7b 100644 +--- a/file.txt ++++ b/file.txt +@@ -1,2 +1,3 @@ + hello world! + hello world, again ++again? +------------------------------------------------ + +With the right arguments, git diff can also show us the difference +between the working directory and the last commit, or between the +index and the last commit: + +------------------------------------------------ +$ git diff HEAD +diff --git a/file.txt b/file.txt +index a042389..ba3da7b 100644 +--- a/file.txt ++++ b/file.txt +@@ -1 +1,3 @@ + hello world! ++hello world, again ++again? +$ git diff --cached +diff --git a/file.txt b/file.txt +index a042389..513feba 100644 +--- a/file.txt ++++ b/file.txt +@@ -1 +1,2 @@ + hello world! ++hello world, again +------------------------------------------------ + +At any time, we can create a new commit using "git commit" (without +the -a option), and verify that the state committed only includes the +changes stored in the index file, not the additional change that is +still only in our working tree: + +------------------------------------------------ +$ git commit -m "repeat" +$ git diff HEAD +diff --git a/file.txt b/file.txt +index 513feba..ba3da7b 100644 +--- a/file.txt ++++ b/file.txt +@@ -1,2 +1,3 @@ + hello world! + hello world, again< |