Compare commits

...

145 Commits

Author SHA1 Message Date
9529a2524a GIT 1.5.0.6 2007-03-28 15:28:14 -07:00
d0e50cb4cb commit: fix pretty-printing of messages with "\nencoding "
The function replace_encoding_header is given the whole
commit buffer, including the commit message. When looking
for the encoding header, if none was found in the header, it
would locate any line in the commit message matching
"\nencoding " and remove it.

Instead, we now make sure to search only to the end of the
header.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-28 15:06:18 -07:00
75c962c99a t4118: be nice to non-GNU sed
Elias Pipping:
> I'm on a mac, hence /usr/bin/sed is not gnu sed, which makes
> t4118 fail.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Ack'd-by: Elias Pipping <pipping@macports.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-28 14:54:30 -07:00
d3e41ebff4 git-commit: "read-tree -m HEAD" is not the right way to read-tree quickly
It still looks at the working tree and checks for locally
modified paths.  When are preparing a temporary index from HEAD,
we do not want any of that.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-28 03:34:55 -07:00
fd2a75972e Merge branch 'maint' of git://linux-nfs.org/~bfields/git into maint
* 'maint' of git://linux-nfs.org/~bfields/git:
  user-manual: introduce "branch" and "branch head" differently
  glossary: clean up cross-references
  glossary: stop generating automatically
  user-manual: Use def_ instead of ref_ for glossary references.
  user-manual.txt: fix a tiny typo.
  user-manual: run xsltproc without --nonet option
2007-03-25 15:07:27 -07:00
cd67c8e0bc gitweb: Add some installation notes in gitweb/INSTALL
Add some installation and configuration notes for gitweb in
gitweb/INSTALL. Make use of filling gitweb configuration by
Makefile.

It does not cover (yet?) all the configuration variables and
options.

Some of contents duplicates information in gitweb/README file
(it is referred from gitweb/INSTALL).

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-24 22:26:33 -07:00
4ae89b7625 gitweb: Fix not marking signoff lines in "log" view
The CSS selector for signoff lines style was too strict: in the "log"
view the commit message is not encompassed in container "page_body"
div.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-24 22:25:55 -07:00
346d5e1835 gitweb: Don't escape attributes in CGI.pm HTML methods
There is no need to escape HTML tag's attributes in CGI.pm
HTML methods (like CGI::a()), because CGI.pm does attribute
escaping automatically.

  $cgi->a({ ... -attribute => atribute_value }, tag_contents)

is translated to

  <a ... attribute="attribute_value">tag_contents</a>

The rules for escaping attribute values (which are string contents) are
different. For example you have to take care about escaping embedded '"'
and "'" characters; CGI::a() does that for us automatically.

CGI::a() does not HTML escape tag_contents; we would need to write

  <a href="URL">some <b>bold</b> text</a>

for example. So we use esc_html (or esc_path) to escape tag_contents
as needed.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-24 22:25:47 -07:00
290b1467a3 gitweb: Change to use explicitly function call cgi->escapHTML()
Change to use explicitly function call cgi->escapHTML().
This fix the problem on some systems that escapeHTML() is not
functioning, as default CGI is not setting 'escape' parameter.

Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-24 22:25:40 -07:00
f9308a182e gitweb: Fix "next" link in commit view
Fix copy'n'paste error in commit c9d193df which caused that "next"
link for merge commits in "commit" view
  (merge: _commit_ _commit_ ...)
was to "commitdiff" view instead of being to "commit" view.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-23 14:54:52 -07:00
979ea5856c Documentation/pack-format.txt: Clear up description of types.
Signed-off-by: Peter Eriksen <s022018@student.dtu.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-22 03:05:19 -07:00
a947ab79d4 fix typo in git-am manpage
Fix typo in git-am manpage

Signed-off-by: Michael S. Tsirkin <mst@dev.mellanox.co.il>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-21 02:22:28 -07:00
81b6c950de user-manual: introduce "branch" and "branch head" differently
I was using "branch" to mean "head", but that's perhaps a little
sloppy; so instead start by using the terms "branch head" and "head",
while still quickly falling back on "branch", since that's what
people actually say more frequently.

Also include glossary references on the first uses of "head" and "tag".

Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
2007-03-18 23:06:00 -04:00
cbd919221f glossary: clean up cross-references
Manual clean-up of cross-references, and also clean up a few definitions (e.g.
git-rebase).

Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
2007-03-18 23:06:00 -04:00
f562e6f316 glossary: stop generating automatically
The sort_glossary.pl script sorts the glossary, checks for duplicates,
and automatically adds cross-references.

But it's not so hard to do all that by hand, and sometimes the automatic
cross-references are a little wrong; so let's run the script one last
time and check in its output.

Note: to make the output fit better into the user manual I also deleted
the acknowledgements at the end, which was maybe a little rude; feel
free to object and I can find a different solution.

Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
2007-03-18 23:06:00 -04:00
06e7ea3787 user-manual: Use def_ instead of ref_ for glossary references.
I'd like to start using references to the glossary in the user manual.
The "ref_" prefix for these references seems a little generic; so
replace with "def_".

Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
2007-03-18 21:53:50 -04:00
21f13ee203 user-manual.txt: fix a tiny typo.
"file patch" was doubtless intended to be "file path",
but "directory name" is clearer.

Signed-off-by: Jim Meyering <jim@meyering.net>
Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
2007-03-18 21:53:29 -04:00
0a3985dcfb user-manual: run xsltproc without --nonet option
The --nonet option prevents xsltproc from going to the network to find
anything.  But it always tries to find them locally first, so for a
user with the necessary docbook stylesheets installed the build will
work just fine without xsltproc attempting to use the network; all
--nonet does is make it fail rather than falling back on that.  That
doesn't seem particularly helpful.

Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
2007-03-18 21:53:19 -04:00
6bf035f278 GIT 1.5.0.5
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-18 14:43:29 -07:00
2be08a84ba git-merge: finish when git-read-tree fails
The message formating (commit v1.5.0.3-28-gbe242d5) broke the && chain.

Noticed by Dmitry Torokhov.

Signed-off-by: Santi Béjar <sbejar@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-16 04:34:17 -07:00
3d4e1932f2 GIT 1.5.0.4
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-14 15:56:49 -07:00
9debca9aac Clarify doc for git-config --unset-all.
Previous formulation could make it appear as removing all lines
matching a regexp (at least, I was looking for such a flag, and
confused this flag for what I was looking for).

Signed-off-by: Yann Dirson <ydirson@altern.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-14 14:38:38 -07:00
41f5d73391 git-checkout: fix "eval" used for merge labelling.
The symbolic notation of the fork point can contain whitespaces (e.g.
"git checkout -m 'HEAD@{9 hours ago}'").  Quote strings properly
when using eval to prepare GITHEAD_$new

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-14 09:48:13 -07:00
ad0f8c9ea7 cvsserver: asciidoc formatting changes
Format some lists really as lists. Improves both html and man
output.

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-13 21:16:05 -07:00
65d61e5f51 Merge branch 'maint' of git://repo.or.cz/git/fastimport into maint
* 'maint' of git://repo.or.cz/git/fastimport:
  fast-import: grow tree storage more aggressively
2007-03-12 23:08:27 -07:00
f022f85f6d fast-import: grow tree storage more aggressively
When building up a tree for a commit, fast-import
dynamically allocates memory for the tree entries. When more
space is needed, the allocated memory is increased by a
constant amount. For very large trees, this means
re-allocating and memcpy()ing the memory O(n) times.

To compound this problem, releasing the previous tree
resource does not free the memory; it is kept in a pool
for future trees. This means that each of the O(n)
allocations will consume increasing amounts of memory,
giving O(n^2) memory consumption.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-03-12 15:01:44 -04:00
115f0fe499 Don't package the git-gui credits file anymore
Since git-gui 0.6.4 the credits file is no longer produced.
This file was removed from git-gui due to build issues that
a lot of users and Git developers have reported running into.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-12 11:44:46 -07:00
3ed02de2f4 Merge branch 'maint' of git://repo.or.cz/git-gui into maint
* 'maint' of git://repo.or.cz/git-gui:
  git-gui: Allow 'git gui version' outside of a repository
  git-gui: Revert "git-gui: Display all authors of git-gui."
  git-gui: Revert "Don't modify CREDITS-FILE if it hasn't changed."
  git-gui: Allow committing empty merges
2007-03-12 11:43:22 -07:00
756d846fea git-gui: Allow 'git gui version' outside of a repository
I got a little surprise one day when I tried to run 'git gui version'
outside of a Git repository to determine what version of git-gui was
installed on that system.  Turns out we were doing the repository
check long before we got around to command line argument handling.

We now look to see if the only argument we have been given is
'version' or '--version', and if so, print out the version and
exit immediately; long before we consider looking at the Git
version or working directory.  This way users can still get to
the git-gui version number even if Git's version cannot be read.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-03-12 13:26:06 -04:00
bb616ddd15 git-gui: Revert "git-gui: Display all authors of git-gui."
This reverts commit 871f4c97ad.

Too many users have complained about the credits generator in
git-gui, so I'm backing the entire thing out.  This revert will
finish that series.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-03-12 13:26:04 -04:00
56a7fde16e git-gui: Revert "Don't modify CREDITS-FILE if it hasn't changed."
This reverts commit 92446aba47.

Too many users have complained about the credits generator in
git-gui, so I'm backing the entire thing out.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-03-12 13:25:58 -04:00
c7bafad10d git-gui: Allow committing empty merges
Johannes Sixt noticed that git-gui would not let the user commit
a merge created by `git merge -s ours` as the ours strategy does
not alter the tree (that is HEAD^1^{tree} = HEAD^{tree} after the
merge).  The same issue arises from amending such a merge commit.

We now permit an empty commit (no changed files) if we are doing
a merge commit.  Core Git does this with its command line based
git-commit tool, so it makes sense for the GUI to do the same.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-03-12 13:03:47 -04:00
fc095242b1 git-send-email: Document configuration options
Wishing to implement an email aliases file, I found that they were already
implmented.  Document them for the next user.

Signed-off-by: Avi Kivity <avi@qumranet.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-11 23:52:03 -07:00
be242d576c git-merge: warn when -m provided on a fast forward
Warn the user that the "-m" option is ignored in the case of a fast
forward.  That may save some confusion in the case where the user
doesn't know about fast forwards yet and may not realize that the
behavior here is intentional.

Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-11 23:49:20 -07:00
60fa08ed61 git.el: Retrieve commit log information from .dotest directory.
If a git-am or git-rebase is in progress, fill the commit log buffer
from the commit information found in the various files in the .dotest
directory.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-10 21:58:26 -08:00
3844814755 git.el: Avoid appending a signoff line that is already present.
Also avoid inserting an extra newline if other signoff lines are
present.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-10 21:58:21 -08:00
96a5702409 setup_git_directory_gently: fix off-by-one error
don't tell getcwd that the buffer has one spare byte for an extra /

Signed-off-by: Matthias Lederhofer <matled@gmx.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-10 21:47:45 -08:00
8bb2b516d5 Merge branch 'maint' of git://linux-nfs.org/~bfields/git into maint
* 'maint' of git://linux-nfs.org/~bfields/git:
  user-manual: install user manual stylesheet with other web documents
  user-manual: fix rendering of history diagrams
  user-manual: fix missing colon in git-show example
  user-manual: fix inconsistent use of pull and merge
  user-manual: fix inconsistent example
  glossary: fix overoptimistic automatic linking of defined terms
2007-03-10 21:47:01 -08:00
8ce9d83b78 user-manual: install user manual stylesheet with other web documents
Install the stylesheet needed for the user manual.  This should solve
the problem of, e.g.,

	http://www.kernel.org/pub/software/scm/git/docs/user-manual.html

lacking a lot of formatting.

Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
2007-03-10 23:05:02 -05:00
1dc71a9155 user-manual: fix rendering of history diagrams
Asciidoc appears to interpret a backslash at the end of a line as
escaping the end-of-line character, which screws up the display of
history diagrams like

 o--o--o
	\
	 o--...

The obvious fix (replacing "\" by "\\") doesn't work.  The only
workaround I've found is to include all such diagrams in a LiteralBlock.
Asciidoc claims that should be equivalent to a literal paragraph, so I
don't understand why the difference--perhaps it's an asciidoc bug.

Cc: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
2007-03-10 23:05:01 -05:00
ed4eb0d8f3 user-manual: fix missing colon in git-show example
There should be a colon in this git-show example.

Cc: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
2007-03-10 23:05:01 -05:00
fabbd8f6ca user-manual: fix inconsistent use of pull and merge
I used "git pull ." instead of "git merge" here without any explanation.
Stick instead to "git merge" for now (the equivalent pull syntax is
still covered in a later chapter).

Cc: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
2007-03-10 23:05:01 -05:00
923642fe1b user-manual: fix inconsistent example
The configuration file fragment here is inconsistent with the text
above.  Thanks to Ramsay Jones for the correction.

Cc: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
2007-03-10 23:05:01 -05:00
c816eb1784 glossary: fix overoptimistic automatic linking of defined terms
The script sort_glossary.pl turns each use of "term" into a link to the
definition of "term".  To avoid mangling links like

	gitlink:git-term[1]

it doesn't replace any occurence of "term" preceded by "link:git-".
This fails for gitlink:git-symbolic-ref[1] when substituting for "ref".

So instead just refuse to replace anything preceded by a "-".
That could result in missing some opportunities, but that's a less
annoying error.

Actually I find the automatic substitution a little distracting; some
day maybe we should just run it once and commit the result, so it can
be hand-tuned.

Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
2007-03-10 23:05:01 -05:00
c4431d380c Documentation: s/seperator/separator/
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-09 17:27:43 -08:00
443b92b6e5 Adjust reflog filemode in shared repository
Without this, committing in a group-shared repository would not work
even though all developers are in the same group.

Signed-off-by: Matthias Kestenholz <matthias@spinlock.ch>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-09 16:46:53 -08:00
ef203f0856 Catch write_ref_sha1 failure in receive-pack
This failure to catch the failure of write_ref_sha1 was noticed
by Bill Lear.  The ref will not update if the log file could not
be appended to (due to file permissions problems).  Such a failure
should be flagged as a failure to update the ref, so that the client
knows the push did not succeed.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-07 10:01:44 -08:00
58db64f73c make t8001 work on Mac OS X again
The test was recently broken to expect sed to leave the
incomplete line at the end without newline.

POSIX says that output of the pattern space is to be followed by
a newline, while GNU adds the newline back only when it was
stripped when input.  GNU behaviour is arguably more intuitive
and nicer, but we should not depend on it.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-06 17:09:53 -08:00
eec102524f Merge branch 'master' of git://repo.or.cz/git-gui into maint
* 'master' of git://repo.or.cz/git-gui:
  git-gui: Make 'make' quieter by default
  git-gui: Remove unnecessary /dev/null redirection.
  git-gui: Don't create empty (same tree as parent) commits.
  git-gui: Add Reset to the Branch menu.
  git-gui: Relocate the menu/transport menu code.
2007-03-06 00:39:52 -08:00
0b5ea163d2 git-gui: Make 'make' quieter by default
To fit nicely into the output of the git.git project's own quieter
Makefile, we want to make the git-gui Makefile nice and quiet too.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-03-06 02:13:23 -05:00
c93d88a574 git-commit: cd to top before showing the final stat
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-05 23:11:19 -08:00
b8105375ab Fix diff-options references in git-diff and git-format-patch
Most of the git-diff-* documentation used [<common diff options>]
instead of [--diff-options], so make that change in git-diff and
git-format-patch.

In addition, git-format-patch didn't include the meanings of the diff
options.

Signed-off-by: Brian Gernhardt <benji@silverinsanity.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-05 21:21:39 -08:00
043d76050d Add definition of <commit-ish> to the main git man page.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-05 21:21:09 -08:00
c2d4eb7e04 Merge branch 'maint-for-junio' of git://repo.or.cz/git/fastimport into maint
* 'maint-for-junio' of git://repo.or.cz/git/fastimport:
  fast-import: Fail if a non-existant commit is used for merge
  fast-import: Avoid infinite loop after reset
2007-03-05 17:07:17 -08:00
56333bac66 Begin SubmittingPatches with a check list
It seems that some people prefer a short list to a long text. But even for
the latter group, a quick reminder list is useful. So, add a check list to
Documentation/SubmittingPatches of what to do to get your patch accepted.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-05 14:49:22 -08:00
2f6dc35d2a fast-import: Fail if a non-existant commit is used for merge
Johannes Sixt noticed during one of his own imports that fast-import
did not fail if a non-existant commit is referenced by SHA-1 value
as an argument to the 'merge' command.  This allowed the user to
unknowingly create commits that would fail in fsck, as the commit
contents would not be completely reachable.

A side effect of this bug was that a frontend process could mark
any SHA-1 object (blob, tree, tag) as a parent of a merge commit.
This should also fail in fsck, as the commit is not a valid commit.

We now use the same rule as the 'from' command.  If a commit is
referenced in the 'merge' command by hex formatted SHA-1 then the
SHA-1 must be a commit or a tag that can be peeled back to a commit,
the commit must already exist, and must be readable by the core Git
infrastructure code.  This requirement means that the commit must
have existed prior to fast-import starting, or the commit must have
been flushed out by a prior 'checkpoint' command.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-03-05 12:43:14 -05:00
734c91f9e2 fast-import: Avoid infinite loop after reset
Johannes Sixt noticed that a 'reset' command applied to a branch that
is already active in the branch LRU cache can cause fast-import to
relink the same branch into the LRU cache twice.  This will cause
the LRU cache to contain a cycle, making unload_one_branch run in an
infinite loop as it tries to select the oldest branch for eviction.

I have trivially fixed the problem by adding an active bit to
each branch object; this bit indicates if the branch is already
in the LRU and allows us to avoid trying to add it a second time.
Converting the pack_id field into a bitfield makes this change take
up no additional memory.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-03-05 12:31:09 -05:00
7193db3685 GIT 1.5.0.3
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-04 17:20:38 -08:00
2aa54fa872 glossary: Add definitions for dangling and unreachable objects
Define "dangling" and "unreachable" objects.  Modified from original
text proposed by Yasushi Shoji.

Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-04 16:47:33 -08:00
ef561ac738 user-manual: more detailed merge discussion
Add more details on conflict, including brief discussion of file stages.

Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-04 16:47:32 -08:00
365aa19919 user-manual: how to replace commits older than most recent
"Modifying" an old commit by checking it out, --amend'ing it, then
rebasing on top of it, is a slightly cumbersome technique, but I've
found it useful frequently enough to make it seem worth documenting.

Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-04 16:47:32 -08:00
3512193034 user-manual: insert earlier of mention content-addressable architecture
The content-addressable design is too important not to be worth at least
a brief mention a little earlier on.

Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-04 16:47:32 -08:00
1c95c565c2 user-manual: ensure generated manual references stylesheet
The generated user manual is rather hard to read thanks to the lack of
the css that's supposed to be included from docbook-xsl.css.

I'm totally ignorant of the toolchain; grubbing through xmlto and
related scripts, the easiest way I could find to ensure that the
generated html links to the stylesheet is by calling xsltproc directly.
Maybe there's some better way.

Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-04 16:47:32 -08:00
1c73bb0ef7 user-manual: reset to ORIG_HEAD not HEAD to undo merge
As Linus pointed out recently on the mailing list,

	git reset --hard HEAD^

doesn't undo a merge in the case where the merge did a fast-forward.  So
the rcommendation here is a little dangerous.

Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-04 16:47:32 -08:00
0bc25a7842 Documentation: mention module option to git-cvsimport
The git-cvsimport argument that specifies a cvs module to import should
probably be included in the default example.

Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-04 16:47:32 -08:00
7943b3a94f Unset NO_C99_FORMAT on Cygwin.
This should only be set based on the capability of your
compiler/library to support c99 format specifiers. In this
case the version of gcc/newlib and indirectly the version
of Cygwin. It should probably only be set in your config.mak
file.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-03 19:35:17 -08:00
fd547a972a Fix a "pointer type missmatch" warning.
In particular, the second parameter in the call to iconv() will
cause this warning if your library declares iconv() with the
second (input buffer pointer) parameter of type const char **.
This is the old prototype, which is none-the-less used by the
current version of newlib on Cygwin. (It appears in old versions
of glibc too).

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-03 18:55:17 -08:00
2832114532 Fix some "comparison is always true/false" warnings.
On Cygwin the wchar_t type is an unsigned short (16-bit) int.
This results in the above warnings from the return statement in
the wcwidth() function (in particular, the expressions involving
constants with values larger than 0xffff). Simply replace the
use of wchar_t with an unsigned int, typedef-ed as ucs_char_t.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-03 18:55:10 -08:00
41b200179d Fix an "implicit function definition" warning.
The function at issue being initgroups() from the <grp.h> header
file. On Cygwin, setting _XOPEN_SOURCE suppresses the definition
of initgroups(), which causes the warning while compiling daemon.c.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-03 18:55:04 -08:00
ee96d11beb Fix a "label defined but unreferenced" warning.
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-03 18:43:25 -08:00
78cb59c8e5 Document the config variable format.suffix
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-03 17:45:48 -08:00
7d79c860a6 git-merge: fail correctly when we cannot fast forward.
When we cannot fast forward the working tree and the current
branch, git-merge did not exit with non-zero status.

Noticed by Larry Streepy, the section to be fixed identfied by
Johannes Schindelin.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-03 13:04:54 -08:00
64edf4b2eb builtin-archive: use RUN_SETUP
It used to roll its own setup.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-03 12:26:50 -08:00
81035bba0a Fix git-gc usage note
Signed-off-by: Matthias Kestenholz <matthias@spinlock.ch>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-03 12:11:22 -08:00
b8ac23bcf8 Fix quoting in update hook template
By default allowunannotated is unset in the repo config, hence
$allowunannotated is empty, and must be quoted to not break the syntax.

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-02 15:11:52 -08:00
eecc8367f4 Another memory overrun in http-push.c
Use of strlcpy() are wrong, as the source buffer at these
locations may not be NUL-terminated.
2007-03-02 00:10:12 -08:00
0df56eabf2 fetch.o depends on the headers, too.
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-01 13:26:57 -08:00
3e4e8c03ca Documentation: Correct minor typo in git-add documentation.
Signed-off-by: Christian Schlotter <schlotter@users.sourceforge.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-01 13:26:18 -08:00
5ef1f8d488 Documentation/git-send-email.txt: Fix labeled list formatting
Mark continuation paragraphs of list entries as such to avoid
getting literal paragraphs instead.

Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-01 13:25:24 -08:00
d53ebb429a Documentation/git-quiltimport.txt: Fix labeled list formatting
Mark the continuation paragraph of a list entry as such to avoid
getting a literal paragraph instead.

Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-01 13:25:14 -08:00
2ba91e9698 Documentation/build-docdep.perl: Fix dependencies for included asciidoc files
Adding dependencies on included files to the generated man pages is
wrong - includes are processed by asciidoc, therefore the intermediate
Docbook XML files really depend on included files.  Because of these
wrong dependencies the man pages were not rebuilt properly if the
intermediate XML files were left in the tree.

Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-01 13:24:54 -08:00
c3e8a0a4dd git-gui: Remove unnecessary /dev/null redirection.
Git 1.5.0 and later no longer output useless messages to standard
error when making the initial (or what looks to be) commit of a
repository.  Since /dev/null does not exist on Windows in the
MinGW environment we can't redirect there anyway.  Since Git
does not output anymore, I'm removing the redirection.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-03-01 14:37:34 -05:00
a1367d1219 Start preparing Release Notes for 1.5.0.3 2007-02-28 14:17:45 -08:00
db554bf0a7 Documentation: git-remote add [-t <branch>] [-m <branch>] [-f] name url
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-28 14:05:42 -08:00
4fa96e1557 Include config.mak in doc/Makefile
config.mak.autogen is already there.  Without this change it is not
possible to override mandir in config.mak.

Signed-off-by: Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-28 13:48:10 -08:00
14b4f2dbd1 git.el: Set the default commit coding system from the repository config.
If not otherwise specified, take the default coding system for commits
from the 'i18n.commitencoding' repository configuration value.

Also set the buffer-file-coding-system variable in the log buffer to
make the selected coding system visible on the modeline.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-28 12:39:14 -08:00
a94f457e89 git-archimport: support empty summaries, put summary on a single line.
Don't fail if the summary line in an arch commit is empty.  In this case,
try to use the first line in the commit message followed by an ellipsis.
In addition, if the summary is multi-line, it is joined on a single line.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-28 12:38:08 -08:00
2c46759db7 http-push.c::lock_remote(): validate all remote refs.
Starting from offset 11 might have been good back when it was
only used for updating "refs/heads/*", but it is used to update
"info/refs" and "refs/tags/*" as well.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-28 12:12:02 -08:00
cf70c16fc0 git-cvsexportcommit: don't cleanup .msg if not yet committed to cvs.
Unless the -c option is given, and the commit to cvs was successful,
.msg shouldn't be deleted to be able to run the command suggested by
git-cvsexportcommit.

See http://bugs.debian.org/412732

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-28 10:22:50 -08:00
163d7b9b85 builtin-fmt-merge-msg: fix bugs in --file option
If --file's argument is missing, don't crash.  If it cannot be opened,
die with an error message.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-27 22:02:41 -08:00
a91d49cd36 index-pack: Loop over pread until data loading is complete.
A filesystem might not be able to completely supply our pread
request in one system call, such as if we are reading data from a
network file system and the requested length is just simply huge.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-27 21:58:46 -08:00
ae64860622 blameview: Fix the browse behavior in blameview
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-27 21:41:48 -08:00
79c96c5733 Fix minor typos/grammar in user-manual.txt
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-27 21:24:56 -08:00
0a43acbe85 Correct ordering in git-cvsimport's option documentation
A pair of commits on January 8th added option documentation (for -a,
-S and -L) in the middle of the documentation for the -A option.  This
makes -A's documentation contiguous again.

Signed-off-by: Michael Poole <mdpoole@troilus.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-27 20:44:52 -08:00
aa27e46111 git-show: Reject native ref
So when we do

	git show v1.4.4..v1.5.0

that's an illogical thing to do, since "git show" is defined to be a
non-revision-walking action, which means the range operator be pointless
and wrong. The fact that we happily accept it (and then _only_ show
v1.5.0, which is the positive end of the range) is quite arguably not very
logical.

We should complain, and say that you can only do "no_walk" with positive
refs. Negative object refs really don't make any sense unless you walk
the obejct list (or you're "git diff" and know about ranges explicitly).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-27 17:09:55 -08:00
7ee70a7119 Fix git-show man page formatting in the EXAMPLES section
Fix asciidoc markup so that the man page is properly formatted in the
EXAMPLES section.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-27 15:38:05 -08:00
63e50d492c git-apply: do not fix whitespaces on context lines.
Internal function apply_line() is called to copy both context lines
and added lines to the output buffer, while possibly fixing the
whitespace breakages depending on --whitespace=strip settings.
However, it did its fix-up on both context lines and added lines.

This resulted in two symptoms:

 (1) The number of lines reported to have been fixed up included
     these context lines.

 (2) However, the lines actually shown were limited to the added
     lines that had whitespace breakages.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-27 01:33:14 -08:00
ee24ee55c2 diff --cc: integer overflow given a 2GB-or-larger file
Few of us use git to compare or even version-control 2GB files,
but when we do, we'll want it to work.

Reading a recent patch, I noticed two lines like this:

   int len = st.st_size;

Instead of "int", that should be "size_t".  Otherwise, in the
non-symlink case, with 64-bit size_t, if the file's size is 2GB,
the following xmalloc will fail:

   result = xmalloc(len + 1);

trying to allocate 2^64 - 2^31 + 1 bytes (assuming sign-extension
in the int-to-size_t promotion).  And even if it didn't fail, the
subsequent "result[len] = 0;" would be equivalent to an unpleasant
"result[-2147483648] = 0;"

The other nearby "int"-declared size variable, sz, should also be of
type size_t, for the same reason.  If sz ever wraps around and becomes
negative, xread will corrupt memory _before_ the "result" buffer.

Signed-off-by: Jim Meyering <jim@meyering.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-27 01:03:37 -08:00
34fc5cefa7 mailinfo: do not get confused with logical lines that are too long.
It basically considers all the continuation lines to be lines of their
own, and if the total line is bigger than what we can fit in it, we just
truncate the result rather than stop in the middle and then get confused
when we try to parse the "next" line (which is just the remainder of the
first line).

[jc: added test, and tightened boundary a bit per list discussion.]

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-27 01:02:32 -08:00
51bd9d7b8c git-gui: Don't create empty (same tree as parent) commits.
Mark Levedahl noticed that git-gui will let you create an empty
normal (non-merge) commit if the file state in the index is out
of whack.  The case Mark was looking at was with the new autoCRLF
feature in git enabled and is actually somewhat difficult to create.

I found a different way to create an empty commit:  turn on the
Trust File Modifications flag, touch a file, rescan, then move
the file into the "Changes To Be Committed" list without looking
at the file's diff.  This makes git-gui think there are files
staged for commit, yet the update-index call did nothing other
than refresh the stat information for the affected file.  In
this case git-gui allowed the user to make a commit that did
not actually change anything in the repository.

Creating empty commits is usually a pointless operation; rarely
does it record useful information.  More often than not an empty
commit is actually an indication that the user did not properly
update their index prior to commit.  We should help the user out
by detecting this possible mistake and guiding them through it,
rather than blindly recording it.

After we get the new tree name back from write-tree we compare
it to the parent commit's tree; if they are the same string and
this is a normal (non-merge, non-amend) commit then something
fishy is going on.  The user is making an empty commit, but they
most likely don't want to do that.  We now pop an informational
dialog and start a rescan, aborting the commit.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-02-26 11:47:14 -05:00
fd234dfdb7 git-gui: Add Reset to the Branch menu.
cehteh on #git noticed that there was no way to perform a reset --hard
from within git-gui.  When I pointed out this was Merge->Abort Merge
cehteh said this is not very understandable, and that most users would
never guess to try that option unless they were actually in a merge.

So Branch->Reset is now also a way to cause a reset --hard from within
the UI.  Right now the confirmation dialog is the same as the one used
in Merge->Abort Merge.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-02-26 11:22:10 -05:00
9b28a8b9c2 git-gui: Relocate the menu/transport menu code.
This code doesn't belong down in the main window UI creation,
its really part of the menu system and probably should be
located with it.  I'm moving it because I could not find
the code when I was looking for it earlier today, as it was
not where I expected it to be found.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-02-26 11:17:11 -05:00
0d9b9ab128 GIT 1.5.0.2
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-26 00:26:06 -08:00
4e5104c1fc git-remote: support remotes with a dot in the name
[jc: the original from Pavel was limiting the variable names to only
 fetch and url, but I loosened it to take valid variable names.]
[jc: cherry-picked from 'master', since people seem to be reinventing
 this many times.]

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-26 00:24:41 -08:00
c5ddca1fff Documentation: describe "-f/-t/-m" options to "git-remote add"
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-25 23:50:29 -08:00
4fc970c438 diff --cc: fix display of symlink conflicts during a merge.
"git-diff-files --cc" to show conflicts during merge did not pass
the correct mode information for the working tree down, and showed
bogus combined diff.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-25 22:25:30 -08:00
0b1f647557 Merge branch 'jc/merge-symlink' into maint
* jc/merge-symlink:
  merge-recursive: fix longstanding bug in merging symlinks
  merge-index: fix longstanding bug in merging symlinks
2007-02-25 19:09:59 -08:00
17cd29b25c merge-recursive: fix longstanding bug in merging symlinks
Commit 3af244ca added unlink(2) before running symlink(2) to
update the working tree with the merge result, but it was
unlinking a wrong path.  This resulted in loss of the path
pointed by a symlink.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-25 19:08:48 -08:00
308efc10d8 merge-index: fix longstanding bug in merging symlinks
Ancient commit e2b6a9d0 added code to pass "file modes" from
merge-index to merge-one-file, and then later commit 54dd99a1
wanted to make sure we do not end up creating a nonsense symlink
that points at a path whose name contains conflict markers.

However, nobody noticed that the code in merge-index added by
e2b6a9d0 were stripping the S_IFMT bits and the code in 54dd99a1
was meaningless.  This fixes it.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-25 19:08:48 -08:00
d2dc6222d4 Add Release Notes to prepare for 1.5.0.2
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-25 10:53:42 -08:00
ffa84ffb77 Allow arbitrary number of arguments to git-pack-objects
If a repository ever gets in a situation where there are too many
packs (more than 60 or so), perhaps because of frequent use of
git-fetch -k or incremental git-repack, then it becomes impossible to
fully repack the repository with git-repack -a.  That command just
dies with the cryptic message

    fatal: too many internal rev-list options

This message comes from git-pack-objects, which is passed one command
line option like --unpacked=pack-<SHA1>.pack for each pack file to be
repacked.  However, the current code has a static limit of 64 command
line arguments and just aborts if more arguments are passed to it.

Fix this by dynamically allocating the array of command line
arguments, and doubling the size each time it overflows.

Signed-off-by: Roland Dreier <roland@digitalvampire.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-25 10:50:12 -08:00
1289172749 rerere: do not deal with symlinks.
Who would use multi-line symlinks that would benefit from rerere?
Just ignore them.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-25 01:29:43 -08:00
ab242f809a rerere: do not skip two conflicted paths next to each other.
The code forgot to take the for (;;) loop control into account,
incrementing the index once too many.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-25 01:28:44 -08:00
cef19c7af5 Merge git://repo.or.cz/git-gui into maint
* git://repo.or.cz/git-gui:
  Don't modify CREDITS-FILE if it hasn't changed.
2007-02-24 23:33:12 -08:00
92446aba47 Don't modify CREDITS-FILE if it hasn't changed.
We should always avoid rewriting a built file during `make install`
if nothing has changed since `make all`.  This is to help support
the typical installation process of compiling a package as yourself,
then installing it as root.

Forcing CREDITS-FILE to be always be rebuilt in the Makefile means
that CREDITS-GEN needs to check for a change and only update
CREDITS-FILE if the file content actually differs.  After all,
content is king in Git.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-02-25 02:18:26 -05:00
5089277718 diff-patch: Avoid emitting double-slashes in textual patch.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-24 01:26:52 -08:00
b1440cc806 Reword git-am 3-way fallback failure message.
When the blobs recorded on the index lines in the patch as pre-image
blobs are not found in the repository, "git-am" punted saying
that the index line does not record anything useful.  This was not
clear enough -- the index line does have something useful but the
problem was that it was not useful in _that_ repository.

Reword the message as Francis Moreau suggests.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-24 01:06:19 -08:00
c06d2daa12 Limit filename for format-patch
Badly formatted commits may have very long comments. This causes
git-format-patch to fail. To avoid that, truncate the filename
to a value we believe will always work.

Err out if the patch file cannot be created.

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-24 00:55:56 -08:00
bdd69c2f64 core.legacyheaders: Use the description used in RelNotes-1.5.0
It explains what it does and why, and says how to use the new format.

Signed-off-by: Santi Béjar <sbejar@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-24 00:25:05 -08:00
8ab40a2005 git-show-ref --verify: Fail if called without a reference
builtin-show-ref.c (cmd_show_ref): Fail if called with --verify option but
without a reference.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-24 00:17:38 -08:00
75b62b489a git-diff: fix combined diff
The code forgets that typecast binds tighter than addition, in
other words:

    (cast *)array + i  === ((cast *)array) + i

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-22 21:24:34 -08:00
755b99d815 Fix 'git commit -a' in a newly initialized repository
With current git:

$ git init
$ git commit -a
cp: cannot stat `.git/index': No such file or directory

Output a nice error message instead.

Signed-off-by: Fredrik Kuivinen <frekui@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-22 21:02:39 -08:00
4917d2a66e Include git-gui credits file in dist.
The Makefile for the git-gui subproject will fail to execute if run
outside of a git.git directory, such as when building from a .tar.gz
or .tar.bz2.  This is because it is looking for the credits file,
which was created but omitted from the tarball by the toplevel
Makefile.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-21 21:47:42 -08:00
e4a15f40bc Document the new core.bare configuration option.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-21 16:39:09 -08:00
5bac4a6719 Merge branch 'master' of git://repo.or.cz/git-gui into maint
* 'master' of git://repo.or.cz/git-gui:
  git-gui: Don't crash in citool mode on initial commit.
  git-gui: Remove TODO list.
  git-gui: Include browser in our usage message.
  git-gui: Change summary of git-gui.
  git-gui: Display all authors of git-gui.
  git-gui: Use mixed path for docs on Cygwin.
  git-gui: Correct crash when saving options in blame mode.
  git-gui: Expose the browser as a subcommand.
  git-gui: Create new branches from a tag.
  git-gui: Prefer version file over git-describe.
  git-gui: Print version on the console.
  git-gui: More consistently display the application name.
  git-gui: Permit merging tags into the current branch.
  git-gui: Basic version check to ensure git 1.5.0 or later is used.
  git-gui: Refactor 'exec git subcmd' idiom.
2007-02-21 11:09:57 -08:00
c750da256a Use gunzip -c over gzcat in import-tars example.
Not everyone has gzcat or bzcat installed on their system, but
gunzip -c and bunzip2 -c perform the same task and are available
if the user has installed gzip support or bzip2 support.

Signed-off-by: Michael Loeffler <zvpunry@zvpunry.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-02-21 11:09:57 -05:00
981193786f git-gui: Don't crash in citool mode on initial commit.
Attempting to use `git citool` to create an initial commit caused
git-gui to crash with a Tcl error as it tried to add the newly
born branch to the non-existant branch menu.  Moving this code
to after the normal commit cleanup logic resolves the issue, as
we only have a branch menu if we are not in singlecommit mode.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-02-21 01:33:59 -05:00
7391b2e999 git-gui: Remove TODO list.
I'm apparently not very good at keeping my own TODO file current.
I its also somewhat strange to keep the TODO list as part of the
software branch, as its meta-information that is not directly
related to the code.  I'm pulling the TODO list from git-gui and
moving it into a seperate branch.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-02-21 01:29:05 -05:00
c0f7a6c33d git-gui: Include browser in our usage message.
Now that the 'browser' subcommand can be used to startup the tree
browser, it should be listed as a possible subcommand option in
our usage message.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-02-21 01:24:57 -05:00
019f42a4ff git-gui: Change summary of git-gui.
Since git-gui does more than create commits, it is unfair to call
it "a commit creation tool".  Instead lets just call it a graphical
user interface.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-02-21 00:11:02 -05:00
871f4c97ad git-gui: Display all authors of git-gui.
Now that git-gui has been released to the public as part of Git 1.5.0
I am starting to see some work from other people beyond myself and
Paul.  Consequently the copyright for git-gui is not strictly the
two of us anymore, and these others deserve to have some credit
given to them.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-02-21 00:11:01 -05:00
ee40599330 git-gui: Use mixed path for docs on Cygwin.
The Firefox browser requires that a URL use / to delimit directories.
This is instead of \, as \ gets escaped by the browser into its hex
escape code and then relative URLs are incorrectly resolved, Firefox
no longer sees the directories for what they are.  Since we are
handing the browser a true URL, we better use the standard / for
directories.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-02-21 00:11:01 -05:00
3efb1f343a Check for PRIuMAX rather than NO_C99_FORMAT in fast-import.c.
Thanks to Simon 'corecode' Schubert <corecode@fs.ei.tum.de> for
the clean-up.  Defining the C99 standard PRIuMAX when necessary
replaces UM_FMT and the awkward UM10_FMT.  There are no direct
C99 translations for other uses of NO_C99_FORMAT in git, alas.

Signed-off-by: Jason Riedy <ejr@cs.berkeley.edu>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-20 19:10:57 -08:00
e326bce65c Obey NO_C99_FORMAT in fast-import.c.
Define UM_FMT and UM10_FMT and use in place of %ju and %10ju,
respectively.  Both format as unsigned long long, so this
assumes the compiler supports long long.

Signed-off-by: Jason Riedy <jason@acm.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-19 18:20:49 -08:00
bc6b4f52fc Add a compat/strtoumax.c for Solaris 8.
Solaris 8 was pre-c99, and they weren't willing to commit to
the strtoumax definition according to /usr/include/inttypes.h.

This adds NO_STRTOUMAX and NO_STRTOULL for ancient systems.
If NO_STRTOUMAX is defined, the routine in compat/strtoumax.c
will be used instead.  That routine passes its arguments to
strtoull unless NO_STRTOULL is defined.  If NO_STRTOULL, then
the routine uses strtoul (unsigned long).

Signed-off-by: Jason Riedy <ejr@cs.berkeley.edu>
Acked-by: Shawn O Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-19 18:20:30 -08:00
f496454e0f git-clone: Sync documentation to usage note.
Documentation advertises the new `--depth <n>' parameter with an equal
sign, while the usage notes (shown after `git-clone --help') do not.  If I
understood git-clone's source code correctly, the version without the
equal sign is correct, which is why this patch syncs documentation to the
usage note.

Signed-off-by: Christian Schlotter <schlotter@users.sourceforge.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-19 18:14:29 -08:00
372ef954a1 git-gui: Correct crash when saving options in blame mode.
Martin Waitz noticed that git-gui crashed while saving the user's
options out if the application was started in blame mode.  This
was caused by the do_save_config procedure invoking reshow_diff
incase the number of context lines was modified by the user.
Because we bypassed main window UI setup to enter blame mode we
did not set many of the globals which were accessed by reshow_diff,
and reading unset variables is an error in Tcl.

Aside from moving the globals to be set earlier, I also modified
reshow_diff to not invoke clear_diff if there is no path currently
in the diff viewer.  This way reshow_diff does not crash when in
blame mode due to the $ui_diff command not being defined.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-02-18 02:12:32 -05:00
b90d479255 git-gui: Expose the browser as a subcommand.
Some users may find being able to browse around an arbitrary
branch to be handy, so we now expose our graphical browser
through `git gui browse <committish>`.

Yes, I'm being somewhat lazy and making the user give us
the name of the branch to browse.  They can always enter
HEAD.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-02-16 00:24:03 -05:00
101e3ae7a6 git-gui: Create new branches from a tag.
I'm missing the possibility to base a new branch on a tag.
The following adds a tag drop down to the new branch dialog.

Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-02-15 01:34:40 -05:00
26370f73c0 git-gui: Prefer version file over git-describe.
Some distributions are using Git for part of their package
management system, but unpack Git's own source code for
delivery from the .tar.gz.  This means that when we walk
up the directory tree with git-describe to locate a Git
repository, the repository we find is for the distribution
and *not* for git-gui.  Consequently any tag we might find
there is bogus and does not apply to us.

In this case the version file should always exist and be
readable, as the packager is working from the released
.tar.gz sources.  So we should always favor the version
file over anything git-describe guess for us.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-02-14 01:55:16 -05:00
ed3adde081 git-gui: Print version on the console.
Like `git version`, `git gui version` (or `git gui --version`) shows
the version of git-gui, in case the user needs to know this, without
looking at it in the GUI about dialog.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-02-14 00:28:00 -05:00
5ac58f5ba1 git-gui: More consistently display the application name.
I started to find it confusing that git-gui would refer to itself
as git-citool when it was started through the citool hardlink, or
with the citool subcommand.  What was especially confusing was the
options dialog and the about dialog, as both seemed to imply they
were somehow different from the git-gui versions.  In actuality
there is no difference at all.

Now we just call our options menu item 'Options...' (skipping the
application name) and our About dialog now always shows git-gui
within the short description (above the copyleft notice) and in
the version field.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-02-14 00:10:20 -05:00
cdf6e08880 git-gui: Permit merging tags into the current branch.
It was pointed out on the git mailing list by Martin Koegler that
we did not show tags as possible things to merge into the current
branch.  They actually are, and core Git's Grand Unified Merge
Driver will accept them just like any other commit.

So our merge dialog now requests all refs/heads, refs/remotes and
refs/tags named refs and attempts to match them against the commits
not in HEAD.  One complicating factor here is that we must use the
%(*objectname) field when talking about an annotated tag, as they
will not appear in the output of rev-list.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-02-13 23:43:48 -05:00
54acdd95b8 git-gui: Basic version check to ensure git 1.5.0 or later is used.
This is a very crude (but hopefully effective) check against the
`git` executable found in our PATH.  Some of the subcommands and
options that git-gui requires to be present to operate were created
during the 1.5.0 development cycle, so 1.5 is the minimum version
of git that we can expect to support.

There actually are early releases of 1.5 (e.g. 1.5.0-rc0) that
don't have everything we expect (like `blame --incremental`) but
these are purely academic at this point.  1.5.0 final was tagged
and released just a few hours ago.  The release candidates will
(hopefully) fade into the dark quickly.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-02-13 23:15:25 -05:00
8134722306 git-gui: Refactor 'exec git subcmd' idiom.
As we frequently need to execute a Git subcommand and obtain
its returned output we are making heavy use of [exec git foo]
to run foo.  As I'm concerned about possibly needing to carry
environment data through a shell on Cygwin for at least some
subcommands, I'm migrating all current calls to a new git
proc.  This actually makes the code look cleaner too, as
we aren't saying 'exec git' everywhere.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-02-13 21:32:52 -05:00
85 changed files with 1816 additions and 807 deletions

View File

@ -16,8 +16,9 @@ ARTICLES += repository-layout
ARTICLES += hooks
ARTICLES += everyday
ARTICLES += git-tools
ARTICLES += glossary
# with their own formatting rules.
SP_ARTICLES = glossary howto/revert-branch-rebase user-manual
SP_ARTICLES = howto/revert-branch-rebase user-manual
DOC_HTML += $(patsubst %,%.html,$(ARTICLES) $(SP_ARTICLES))
@ -37,6 +38,7 @@ INSTALL?=install
DOC_REF = origin/man
-include ../config.mak.autogen
-include ../config.mak
#
# Please note that there is a minor bug in asciidoc.
@ -104,13 +106,11 @@ clean:
user-manual.xml: user-manual.txt user-manual.conf
$(ASCIIDOC) -b docbook -d book $<
user-manual.html: user-manual.xml
xmlto html-nochunks $<
XSLT = http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl
XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css
glossary.html : glossary.txt sort_glossary.pl
cat $< | \
perl sort_glossary.pl | \
$(ASCIIDOC) -b xhtml11 - > glossary.html
user-manual.html: user-manual.xml
xsltproc $(XSLTOPTS) -o $@ $(XSLT) $<
howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
rm -f $@+ $@

View File

@ -0,0 +1,65 @@
GIT v1.5.0.2 Release Notes
==========================
Fixes since v1.5.0.1
--------------------
* Bugfixes
- Automated merge conflict handling when changes to symbolic
links conflicted were completely broken. The merge-resolve
strategy created a regular file with conflict markers in it
in place of the symbolic link. The default strategy,
merge-recursive was even more broken. It removed the path
that was pointed at by the symbolic link. Both of these
problems have been fixed.
- 'git diff maint master next' did not correctly give combined
diff across three trees.
- 'git fast-import' portability fix for Solaris.
- 'git show-ref --verify' without arguments did not error out
but segfaulted.
- 'git diff :tracked-file `pwd`/an-untracked-file' gave an extra
slashes after a/ and b/.
- 'git format-patch' produced too long filenames if the commit
message had too long line at the beginning.
- Running 'make all' and then without changing anything
running 'make install' still rebuilt some files. This
was inconvenient when building as yourself and then
installing as root (especially problematic when the source
directory is on NFS and root is mapped to nobody).
- 'git-rerere' failed to deal with two unconflicted paths that
sorted next to each other.
- 'git-rerere' attempted to open(2) a symlink and failed if
there was a conflict. Since a conflicting change to a
symlink would not benefit from rerere anyway, the command
now ignores conflicting changes to symlinks.
- 'git-repack' did not like to pass more than 64 arguments
internally to underlying 'rev-list' logic, which made it
impossible to repack after accumulating many (small) packs
in the repository.
- 'git-diff' to review the combined diff during a conflicted
merge were not reading the working tree version correctly
when changes to a symbolic link conflicted. It should have
read the data using readlink(2) but read from the regular
file the symbolic link pointed at.
- 'git-remote' did not like period in a remote's name.
* Documentation updates
- added and clarified core.bare, core.legacyheaders configurations.
- updated "git-clone --depth" documentation.
* Assorted git-gui fixes.

View File

@ -0,0 +1,58 @@
GIT v1.5.0.3 Release Notes
==========================
Fixes since v1.5.0.2
--------------------
* Bugfixes
- 'git.el' honors the commit coding system from the configuration.
- 'blameview' in contrib/ correctly digs deeper when a line is
clicked.
- 'http-push' correctly makes sure the remote side has leading
path. Earlier it started in the middle of the path, and
incorrectly.
- 'git-merge' did not exit with non-zero status when the
working tree was dirty and cannot fast forward. It does
now.
- 'cvsexportcommit' does not lose yet-to-be-used message file.
- int-vs-size_t typefix when running combined diff on files
over 2GB long.
- 'git apply --whitespace=strip' should not touch unmodified
lines.
- 'git-mailinfo' choke when a logical header line was too long.
- 'git show A..B' did not error out. Negative ref ("not A" in
this example) does not make sense for the purpose of the
command, so now it errors out.
- 'git fmt-merge-msg --file' without file parameter did not
correctly error out.
- 'git archimport' barfed upon encountering a commit without
summary.
- 'git index-pack' did not protect itself from getting a short
read out of pread(2).
- 'git http-push' had a few buffer overruns.
- Build dependency fixes to rebuild fetch.o when other headers
change.
* Documentation updates
- user-manual updates.
- Options to 'git remote add' were described insufficiently.
- Configuration format.suffix was not documented.
- Other formatting and spelling fixes.

View File

@ -0,0 +1,24 @@
GIT v1.5.0.4 Release Notes
==========================
Fixes since v1.5.0.3
--------------------
* Bugfixes
- git.el does not add duplicate sign-off lines.
- git-commit shows the full stat of the resulting commit, not
just about the files in the current directory, when run from
a subdirectory.
- "git-checkout -m '@{8 hours ago}'" had a funny failure from
eval; fixed.
- git-gui updates.
* Documentation updates
* User manual updates

View File

@ -0,0 +1,28 @@
GIT v1.5.0.5 Release Notes
==========================
Fixes since v1.5.0.3
--------------------
* Bugfixes
- git-merge (hence git-pull) did not refuse fast-forwarding
when the working tree had local changes that would have
conflicted with it.
- git.el does not add duplicate sign-off lines.
- git-commit shows the full stat of the resulting commit, not
just about the files in the current directory, when run from
a subdirectory.
- "git-checkout -m '@{8 hours ago}'" had a funny failure from
eval; fixed.
- git-gui updates.
* Documentation updates
* User manual updates

View File

@ -0,0 +1,22 @@
GIT v1.5.0.6 Release Notes
==========================
Fixes since v1.5.0.5
--------------------
* Bugfixes
- a handful small fixes to gitweb.
- build procedure for user-manual is fixed not to require locally
installed stylesheets.
- "git commit $paths" on paths whose earlier contents were
already updated in the index were failing out.
* Documentation
- user-manual has better cross references.
- gitweb installation/deployment procedure is now documented.

View File

@ -448,7 +448,7 @@ Updates in v1.5.0 since v1.4.4 series
- There is a partial support for 'shallow' repositories that
keeps only recent history. A 'shallow clone' is created by
specifying how deep that truncated history should be
(e.g. "git clone --depth=5 git://some.where/repo.git").
(e.g. "git clone --depth 5 git://some.where/repo.git").
Currently a shallow repository has number of limitations:

View File

@ -1,3 +1,30 @@
Checklist (and a short version for the impatient):
- make commits of logical units
- check for unnecessary whitespace with "git diff --check"
before committing
- do not check in commented out code or unneeded files
- provide a meaningful commit message
- the first line of the commit message should be a short
description and should skip the full stop
- if you want your work included in git.git, add a
"Signed-off-by: Your Name <your@email.com>" line to the
commit message (or just use the option "-s" when
committing) to confirm that you agree to the Developer's
Certificate of Origin
- do not PGP sign your patch
- use "git format-patch -M" to create the patch
- do not attach your patch, but read in the mail
body, unless you cannot teach your mailer to
leave the formatting of the patch alone.
- be careful doing cut & paste into your mailer, not to
corrupt whitespaces.
- provide additional information (which is unsuitable for
the commit message) between the "---" and the diffstat
- send the patch to the list _and_ the maintainer
Long version:
I started reading over the SubmittingPatches document for Linux
kernel, primarily because I wanted to have a document similar to
it for the core GIT to make sure people understand what they are

View File

@ -41,10 +41,6 @@ while ($changed) {
while (my ($text, $included) = each %include) {
if (! exists $included{$text} &&
(my $base = $text) =~ s/\.txt$//) {
my ($suffix) = '1';
if ($base eq 'git') {
$suffix = '7'; # yuck...
}
print "$base.html $base.$suffix : ", join(" ", keys %$included), "\n";
print "$base.html $base.xml : ", join(" ", keys %$included), "\n";
}
}

View File

@ -142,6 +142,18 @@ core.preferSymlinkRefs::
This is sometimes needed to work with old scripts that
expect HEAD to be a symbolic link.
core.bare::
If true this repository is assumed to be 'bare' and has no
working directory associated with it. If this is the case a
number of commands that require a working directory will be
disabled, such as gitlink:git-add[1] or gitlink:git-merge[1].
+
This setting is automatically guessed by gitlink:git-clone[1] or
gitlink:git-init[1] when the repository was created. By default a
repository that ends in "/.git" is assumed to be not bare (bare =
false), while all other repositories are assumed to be bare (bare
= true).
core.logAllRefUpdates::
Updates to a ref <ref> is logged to the file
"$GIT_DIR/logs/<ref>", by appending the new and old
@ -180,10 +192,17 @@ core.compression::
slowest.
core.legacyheaders::
A boolean which enables the legacy object header format in case
you want to interoperate with old clients accessing the object
database directly (where the "http://" and "rsync://" protocols
count as direct access).
A boolean which
changes the format of loose objects so that they are more
efficient to pack and to send out of the repository over git
native protocol, since v1.4.2. However, loose objects
written in the new format cannot be read by git older than
that version; people fetching from your repository using
older versions of git over dumb transports (e.g. http)
will also be affected.
+
To let git use the new loose object format, you have to
set core.legacyheaders to false.
core.packedGitWindowSize::
Number of bytes of a pack file to map into memory in a
@ -321,6 +340,11 @@ format.headers::
Additional email headers to include in a patch to be submitted
by mail. See gitlink:git-format-patch[1].
format.suffix::
The default for format-patch is to output files with the suffix
`.patch`. Use this variable to change that suffix (make sure to
include the dot if you want it).
gc.packrefs::
`git gc` does not run `git pack-refs` in a bare repository by
default so that older dumb-transport clients can still fetch

View File

@ -109,7 +109,7 @@ sure it is in your path. Then cd to a checked out CVS working directory
of the project you are interested in and run gitlink:git-cvsimport[1]:
-------------------------------------------
$ git cvsimport -C <destination>
$ git cvsimport -C <destination> <module>
-------------------------------------------
This puts a git archive of the named CVS module in the directory

View File

@ -52,7 +52,7 @@ OPTIONS
-f::
Allow adding otherwise ignored files.
\i, \--interactive::
-i, \--interactive::
Add modified contents in the working tree interactively to
the index.

View File

@ -70,7 +70,7 @@ default. You could use `--no-utf8` to override this.
the patch.
-C<n>, -p<n>::
These flag are passed to the `git-apply` program that applies
These flags are passed to the `git-apply` program that applies
the patch.
--interactive::

View File

@ -11,7 +11,7 @@ SYNOPSIS
[verse]
'git-clone' [--template=<template_directory>] [-l [-s]] [-q] [-n] [--bare]
[-o <name>] [-u <upload-pack>] [--reference <repository>]
[--depth=<depth>] <repository> [<directory>]
[--depth <depth>] <repository> [<directory>]
DESCRIPTION
-----------
@ -96,7 +96,7 @@ OPTIONS
if unset the templates are taken from the installation
defined default, typically `/usr/share/git-core/templates`.
--depth=<depth>::
--depth <depth>::
Create a 'shallow' clone with a history truncated to the
specified number of revs. A shallow repository has
number of limitations (you cannot clone or fetch from

View File

@ -78,7 +78,7 @@ OPTIONS
Remove the line matching the key from config file.
--unset-all::
Remove all matching lines from config file.
Remove all lines matching the key from config file.
-l, --list::
List all variables set in config file.

View File

@ -96,11 +96,6 @@ If you need to pass multiple options, separate them with a comma.
-s <subst>::
Substitute the character "/" in branch names with <subst>
-A <author-conv-file>::
CVS by default uses the Unix username when writing its
commit logs. Using this option and an author-conv-file
in this format
-a::
Import all commits, including recent ones. cvsimport by default
skips commits that have a timestamp less than 10 minutes ago.
@ -112,6 +107,10 @@ If you need to pass multiple options, separate them with a comma.
Limit the number of commits imported. Workaround for cases where
cvsimport leaks memory.
-A <author-conv-file>::
CVS by default uses the Unix username when writing its
commit logs. Using this option and an author-conv-file
in this format
+
---------
exon=Andreas Ericsson <ae@op5.se>

View File

@ -121,10 +121,10 @@ so that calling 'cvs' effectively calls git-cvsserver.
Clients known to work
---------------------
CVS 1.12.9 on Debian
CVS 1.11.17 on MacOSX (from Fink package)
Eclipse 3.0, 3.1.2 on MacOSX (see Eclipse CVS Client Notes)
TortoiseCVS
- CVS 1.12.9 on Debian
- CVS 1.11.17 on MacOSX (from Fink package)
- Eclipse 3.0, 3.1.2 on MacOSX (see Eclipse CVS Client Notes)
- TortoiseCVS
Operations supported
--------------------
@ -148,13 +148,16 @@ Copyright and Authors
This program is copyright The Open University UK - 2006.
Authors: Martyn Smith <martyn@catalyst.net.nz>
Martin Langhoff <martin@catalyst.net.nz>
with ideas and patches from participants of the git-list <git@vger.kernel.org>.
Authors:
- Martyn Smith <martyn@catalyst.net.nz>
- Martin Langhoff <martin@catalyst.net.nz>
with ideas and patches from participants of the git-list <git@vger.kernel.org>.
Documentation
--------------
Documentation by Martyn Smith <martyn@catalyst.net.nz> and Martin Langhoff <martin@catalyst.net.nz> Matthias Urlichs <smurf@smurf.noris.de>.
Documentation by Martyn Smith <martyn@catalyst.net.nz>, Martin Langhoff <martin@catalyst.net.nz>, and Matthias Urlichs <smurf@smurf.noris.de>.
GIT
---

View File

@ -8,7 +8,7 @@ git-diff - Show changes between commits, commit and working tree, etc
SYNOPSIS
--------
'git-diff' [ --diff-options ] <commit>{0,2} [--] [<path>...]
'git-diff' [<common diff options>] <commit>{0,2} [--] [<path>...]
DESCRIPTION
-----------

View File

@ -451,7 +451,7 @@ in octal. Git only supports the following modes:
In both formats `<path>` is the complete path of the file to be added
(if not already existing) or modified (if already existing).
A `<path>` string must use UNIX-style directory seperators (forward
A `<path>` string must use UNIX-style directory separators (forward
slash `/`), may contain any byte other than `LF`, and must not
start with double quote (`"`).
@ -461,8 +461,8 @@ quoting should be used, e.g. `"path/with\n and \" in it"`.
The value of `<path>` must be in canoncial form. That is it must not:
* contain an empty directory component (e.g. `foo//bar` is invalid),
* end with a directory seperator (e.g. `foo/` is invalid),
* start with a directory seperator (e.g. `/foo` is invalid),
* end with a directory separator (e.g. `foo/` is invalid),
* start with a directory separator (e.g. `/foo` is invalid),
* contain the special component `.` or `..` (e.g. `foo/./bar` and
`foo/../bar` are invalid).

View File

@ -9,8 +9,8 @@ git-format-patch - Prepare patches for e-mail submission
SYNOPSIS
--------
[verse]
'git-format-patch' [-n | -k] [-o <dir> | --stdout] [--attach] [--thread]
[-s | --signoff] [--diff-options] [--start-number <n>]
'git-format-patch' [<common diff options>] [-n | -k] [-o <dir> | --stdout]
[--attach] [--thread] [-s | --signoff] [--start-number <n>]
[--in-reply-to=Message-Id] [--suffix=.<sfx>]
[--ignore-if-in-upstream]
<since>[..<until>]
@ -46,6 +46,8 @@ reference.
OPTIONS
-------
include::diff-options.txt[]
-o|--output-directory <dir>::
Use <dir> to store the resulting files, instead of the
current working directory.

View File

@ -42,10 +42,10 @@ OPTIONS
--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.
+
The default for the patch directory is patches
or the value of the $QUILT_PATCHES environment
variable.
Author
------

View File

@ -10,7 +10,7 @@ SYNOPSIS
--------
[verse]
'git-remote'
'git-remote' add <name> <url>
'git-remote' add [-t <branch>] [-m <branch>] [-f] <name> <url>
'git-remote' show <name>
'git-remote' prune <name>
@ -31,6 +31,19 @@ subcommands are available to perform operations on the remotes.
Adds a remote named <name> for the repository at
<url>. The command `git fetch <name>` can then be used to create and
update remote-tracking branches <name>/<branch>.
+
With `-f` option, `git fetch <name>` is run immediately after
the remote information is set up.
+
With `-t <branch>` option, instead of the default glob
refspec for the remote to track all branches under
`$GIT_DIR/remotes/<name>/`, a refspec to track only `<branch>`
is created. You can give more than one `-t <branch>` to track
multiple branche without grabbing all branches.
+
With `-m <master>` option, `$GIT_DIR/remotes/<name>/HEAD` is set
up to point at remote's `<master>` branch instead of whatever
branch the `HEAD` at the remote repository actually points at.
'show'::
@ -53,8 +66,8 @@ gitlink:git-config[1]).
Examples
--------
Add a new remote, fetch, and check out a branch from it:
* Add a new remote, fetch, and check out a branch from it
+
------------
$ git remote
origin
@ -74,6 +87,17 @@ $ git checkout -b nfs linux-nfs/master
...
------------
* Imitate 'git clone' but track only selected branches
+
------------
$ mkdir project.git
$ cd project.git
$ git init
$ git remote add -f -t master -m master origin git://example.com/git.git/
$ git merge origin
------------
See Also
--------
gitlink:git-fetch[1]

View File

@ -26,13 +26,13 @@ The options available are:
--bcc::
Specify a "Bcc:" value for each email.
The --bcc option must be repeated for each user you want on the bcc list.
+
The --bcc option must be repeated for each user you want on the bcc list.
--cc::
Specify a starting "Cc:" value for each email.
The --cc option must be repeated for each user you want on the cc list.
+
The --cc option must be repeated for each user you want on the cc list.
--chain-reply-to, --no-chain-reply-to::
If this is set, each email will be sent as a reply to the previous
@ -87,9 +87,22 @@ The options available are:
Specify the primary recipient of the emails generated.
Generally, this will be the upstream maintainer of the
project involved.
+
The --to option must be repeated for each user you want on the to list.
The --to option must be repeated for each user you want on the to list.
CONFIGURATION
-------------
sendemail.aliasesfile::
To avoid typing long email addresses, point this to one or more
email aliases files. You must also supply 'sendemail.aliasfiletype'.
sendemail.aliasfiletype::
Format of the file(s) specified in sendemail.aliasesfile. Must be
one of 'mutt', 'mailrc', 'pine', or 'gnus'.
sendemail.smtpserver::
Default smtp server to use.
Author
------

View File

@ -48,15 +48,15 @@ git show v1.0.0::
Shows the tag `v1.0.0`, along with the object the tags
points at.
git show v1.0.0^{tree}::
git show v1.0.0^\{tree\}::
Shows the tree pointed to by the tag `v1.0.0`.
git show next~10:Documentation/README
git show next~10:Documentation/README::
Shows the contents of the file `Documentation/README` as
they were current in the 10th last commit of the branch
`next`.
git show master:Makefile master:t/Makefile
git show master:Makefile master:t/Makefile::
Concatenates the contents of said Makefiles in the head
of the branch `master`.

View File

@ -231,6 +231,12 @@ Identifier Terminology
operate on a <tree> object but automatically dereferences
<commit> and <tag> objects that point at a <tree>.
<commit-ish>::
Indicates a commit or tag object name. A
command that takes a <commit-ish> argument ultimately wants to
operate on a <commit> object but automatically dereferences
<tag> objects that point at a <commit>.
<type>::
Indicates that an object type is required.
Currently one of: `blob`, `tree`, `commit`, or `tag`.

View File

@ -1,356 +1,405 @@
alternate object database::
Via the alternates mechanism, a repository can inherit part of its
object database from another object database, which is called
"alternate".
GIT Glossary
============
bare repository::
A bare repository is normally an appropriately named
directory with a `.git` suffix that does not have a
locally checked-out copy of any of the files under revision
control. That is, all of the `git` administrative and
control files that would normally be present in the
hidden `.git` sub-directory are directly present in
the `repository.git` directory instead, and no other files
are present and checked out. Usually publishers of public
repositories make bare repositories available.
[[def_alternate_object_database]]alternate object database::
Via the alternates mechanism, a <<def_repository,repository>> can
inherit part of its <<def_object_database,object database>> from another
<<def_object_database,object database>>, which is called "alternate".
blob object::
Untyped object, e.g. the contents of a file.
[[def_bare_repository]]bare repository::
A <<def_bare_repository,bare repository>> is normally an appropriately
named <<def_directory,directory>> with a `.git` suffix that does not
have a locally checked-out copy of any of the files under
<<def_revision,revision>> control. That is, all of the `git`
administrative and control files that would normally be present in the
hidden `.git` sub-directory are directly present in the
`repository.git` directory instead,
and no other files are present and checked out. Usually publishers of
public repositories make bare repositories available.
branch::
A non-cyclical graph of revisions, i.e. the complete history of
a particular revision, which is called the branch head. The
branch heads are stored in `$GIT_DIR/refs/heads/`.
[[def_blob_object]]blob object::
Untyped <<def_object,object>>, e.g. the contents of a file.
cache::
Obsolete for: index.
[[def_branch]]branch::
A non-cyclical graph of revisions, i.e. the complete history of a
particular <<def_revision,revision>>, which is called the
branch <<def_head,head>>. The heads
are stored in `$GIT_DIR/refs/heads/`.
chain::
A list of objects, where each object in the list contains a
reference to its successor (for example, the successor of a commit
could be one of its parents).
[[def_cache]]cache::
Obsolete for: <<def_index,index>>.
changeset::
BitKeeper/cvsps speak for "commit". Since git does not store
changes, but states, it really does not make sense to use
the term "changesets" with git.
[[def_chain]]chain::
A list of objects, where each <<def_object,object>> in the list contains
a reference to its successor (for example, the successor of a
<<def_commit,commit>> could be one of its parents).
checkout::
The action of updating the working tree to a revision which was
stored in the object database.
[[def_changeset]]changeset::
BitKeeper/cvsps speak for "<<def_commit,commit>>". Since git does not
store changes, but states, it really does not make sense to use the term
"changesets" with git.
cherry-picking::
In SCM jargon, "cherry pick" means to choose a subset of
changes out of a series of changes (typically commits)
and record them as a new series of changes on top of
different codebase. In GIT, this is performed by
"git cherry-pick" command to extract the change
introduced by an existing commit and to record it based
on the tip of the current branch as a new commit.
[[def_checkout]]checkout::
The action of updating the <<def_working_tree,working tree>> to a
<<def_revision,revision>> which was stored in the
<<def_object_database,object database>>.
clean::
A working tree is clean, if it corresponds to the revision
referenced by the current head. Also see "dirty".
[[def_cherry-picking]]cherry-picking::
In <<def_SCM,SCM>> jargon, "cherry pick" means to choose a subset of
changes out of a series of changes (typically commits) and record them
as a new series of changes on top of different codebase. In GIT, this is
performed by "git cherry-pick" command to extract the change introduced
by an existing <<def_commit,commit>> and to record it based on the tip
of the current <<def_branch,branch>> as a new <<def_commit,commit>>.
commit::
As a verb: The action of storing the current state of the index in the
object database. The result is a revision.
As a noun: Short hand for commit object.
[[def_clean]]clean::
A <<def_working_tree,working tree>> is <<def_clean,clean>>, if it
corresponds to the <<def_revision,revision>> referenced by the current
<<def_head,head>>. Also see "<<def_dirty,dirty>>".
commit object::
An object which contains the information about a particular
revision, such as parents, committer, author, date and the
tree object which corresponds to the top directory of the
stored revision.
[[def_commit]]commit::
As a verb: The action of storing the current state of the
<<def_index,index>> in the <<def_object_database,object database>>. The
result is a <<def_revision,revision>>. As a noun: Short hand for
<<def_commit_object,commit object>>.
core git::
Fundamental data structures and utilities of git. Exposes only
limited source code management tools.
[[def_commit_object]]commit object::
An <<def_object,object>> which contains the information about a
particular <<def_revision,revision>>, such as parents, committer,
author, date and the <<def_tree_object,tree object>> which corresponds
to the top <<def_directory,directory>> of the stored
<<def_revision,revision>>.
DAG::
Directed acyclic graph. The commit objects form a directed acyclic
graph, because they have parents (directed), and the graph of commit
objects is acyclic (there is no chain which begins and ends with the
same object).
[[def_core_git]]core git::
Fundamental data structures and utilities of git. Exposes only limited
source code management tools.
dircache::
[[def_DAG]]DAG::
Directed acyclic graph. The <<def_commit,commit>> objects form a
directed acyclic graph, because they have parents (directed), and the
graph of <<def_commit,commit>> objects is acyclic (there is no
<<def_chain,chain>> which begins and ends with the same
<<def_object,object>>).
[[def_dangling_object]]dangling object::
An <<def_unreachable_object,unreachable object>> which is not
<<def_reachable,reachable>> even from other unreachable objects; a
<<def_dangling_object,dangling object>> has no references to it from any
reference or <<def_object,object>> in the <<def_repository,repository>>.
[[def_dircache]]dircache::
You are *waaaaay* behind.
dirty::
A working tree is said to be dirty if it contains modifications
which have not been committed to the current branch.
directory::
[[def_directory]]directory::
The list you get with "ls" :-)
ent::
Favorite synonym to "tree-ish" by some total geeks. See
[[def_dirty]]dirty::
A <<def_working_tree,working tree>> is said to be <<def_dirty,dirty>> if
it contains modifications which have not been committed to the current
<<def_branch,branch>>.
[[def_ent]]ent::
Favorite synonym to "<<def_tree-ish,tree-ish>>" by some total geeks. See
`http://en.wikipedia.org/wiki/Ent_(Middle-earth)` for an in-depth
explanation. Avoid this term, not to confuse people.
fast forward::
A fast-forward is a special type of merge where you have
a revision and you are "merging" another branch's changes
that happen to be a descendant of what you have.
In such these cases, you do not make a new merge commit but
instead just update to his revision. This will happen
frequently on a tracking branch of a remote repository.
[[def_fast_forward]]fast forward::
A fast-forward is a special type of <<def_merge,merge>> where you have a
<<def_revision,revision>> and you are "merging" another
<<def_branch,branch>>'s changes that happen to be a descendant of what
you have. In such these cases, you do not make a new <<def_merge,merge>>
<<def_commit,commit>> but instead just update to his
<<def_revision,revision>>. This will happen frequently on a
<<def_tracking_branch,tracking branch>> of a remote
<<def_repository,repository>>.
fetch::
Fetching a branch means to get the branch's head ref from a
remote repository, to find out which objects are missing from
the local object database, and to get them, too.
[[def_fetch]]fetch::
Fetching a <<def_branch,branch>> means to get the
<<def_branch,branch>>'s <<def_head_ref,head ref>> from a remote
<<def_repository,repository>>, to find out which objects are missing
from the local <<def_object_database,object database>>, and to get them,
too.
file system::
Linus Torvalds originally designed git to be a user space file
system, i.e. the infrastructure to hold files and directories.
That ensured the efficiency and speed of git.
[[def_file_system]]file system::
Linus Torvalds originally designed git to be a user space file system,
i.e. the infrastructure to hold files and directories. That ensured the
efficiency and speed of git.
git archive::
Synonym for repository (for arch people).
[[def_git_archive]]git archive::
Synonym for <<def_repository,repository>> (for arch people).
grafts::
Grafts enables two otherwise different lines of development to be
joined together by recording fake ancestry information for commits.
This way you can make git pretend the set of parents a commit
has is different from what was recorded when the commit was created.
Configured via the `.git/info/grafts` file.
[[def_grafts]]grafts::
Grafts enables two otherwise different lines of development to be joined
together by recording fake ancestry information for commits. This way
you can make git pretend the set of parents a <<def_commit,commit>> has
is different from what was recorded when the <<def_commit,commit>> was
created. Configured via the `.git/info/grafts` file.
hash::
In git's context, synonym to object name.
[[def_hash]]hash::
In git's context, synonym to <<def_object_name,object name>>.
head::
The top of a branch. It contains a ref to the corresponding
commit object.
[[def_head]]head::
The top of a <<def_branch,branch>>. It contains a <<def_ref,ref>> to the
corresponding <<def_commit_object,commit object>>.
head ref::
A ref pointing to a head. Often, this is abbreviated to "head".
Head refs are stored in `$GIT_DIR/refs/heads/`.
[[def_head_ref]]head ref::
A <<def_ref,ref>> pointing to a <<def_head,head>>. Often, this is
abbreviated to "<<def_head,head>>". Head refs are stored in
`$GIT_DIR/refs/heads/`.
hook::
During the normal execution of several git commands,
call-outs are made to optional scripts that allow
a developer to add functionality or checking.
Typically, the hooks allow for a command to be pre-verified
and potentially aborted, and allow for a post-notification
after the operation is done.
The hook scripts are found in the `$GIT_DIR/hooks/` directory,
and are enabled by simply making them executable.
[[def_hook]]hook::
During the normal execution of several git commands, call-outs are made
to optional scripts that allow a developer to add functionality or
checking. Typically, the hooks allow for a command to be pre-verified
and potentially aborted, and allow for a post-notification after the
operation is done. The <<def_hook,hook>> scripts are found in the
`$GIT_DIR/hooks/` <<def_directory,directory>>, and are enabled by simply
making them executable.
index::
A collection of files with stat information, whose contents are
stored as objects. The index is a stored version of your working
tree. Truth be told, it can also contain a second, and even a third
version of a working tree, which are used when merging.
[[def_index]]index::
A collection of files with stat information, whose contents are stored
as objects. The <<def_index,index>> is a stored version of your working
<<def_tree,tree>>. Truth be told, it can also contain a second, and even
a third version of a <<def_working_tree,working tree>>, which are used
when merging.
index entry::
The information regarding a particular file, stored in the index.
An index entry can be unmerged, if a merge was started, but not
yet finished (i.e. if the index contains multiple versions of
that file).
[[def_index_entry]]index entry::
The information regarding a particular file, stored in the
<<def_index,index>>. An <<def_index_entry,index entry>> can be unmerged,
if a <<def_merge,merge>> was started, but not yet finished (i.e. if the
<<def_index,index>> contains multiple versions of that file).
master::
The default development branch. Whenever you create a git
repository, a branch named "master" is created, and becomes
the active branch. In most cases, this contains the local
[[def_master]]master::
The default development <<def_branch,branch>>. Whenever you create a git
<<def_repository,repository>>, a <<def_branch,branch>> named
"<<def_master,master>>" is created, and becomes the active
<<def_branch,branch>>. In most cases, this contains the local
development, though that is purely conventional and not required.
merge::
To merge branches means to try to accumulate the changes since a
common ancestor and apply them to the first branch. An automatic
merge uses heuristics to accomplish that. Evidently, an automatic
merge can fail.
[[def_merge]]merge::
To <<def_merge,merge>> branches means to try to accumulate the changes
since a common ancestor and apply them to the first
<<def_branch,branch>>. An automatic <<def_merge,merge>> uses heuristics
to accomplish that. Evidently, an automatic <<def_merge,merge>> can
fail.
object::
The unit of storage in git. It is uniquely identified by
the SHA1 of its contents. Consequently, an object can not
be changed.
[[def_object]]object::
The unit of storage in git. It is uniquely identified by the
<<def_SHA1,SHA1>> of its contents. Consequently, an
<<def_object,object>> can not be changed.
object database::
Stores a set of "objects", and an individual object is identified
by its object name. The objects usually live in `$GIT_DIR/objects/`.
[[def_object_database]]object database::
Stores a set of "objects", and an individual <<def_object,object>> is
identified by its <<def_object_name,object name>>. The objects usually
live in `$GIT_DIR/objects/`.
object identifier::
Synonym for object name.
[[def_object_identifier]]object identifier::
Synonym for <<def_object_name,object name>>.
object name::
The unique identifier of an object. The hash of the object's contents
using the Secure Hash Algorithm 1 and usually represented by the 40
character hexadecimal encoding of the hash of the object (possibly
followed by a white space).
[[def_object_name]]object name::
The unique identifier of an <<def_object,object>>. The <<def_hash,hash>>
of the <<def_object,object>>'s contents using the Secure Hash Algorithm
1 and usually represented by the 40 character hexadecimal encoding of
the <<def_hash,hash>> of the <<def_object,object>> (possibly followed by
a white space).
object type::
One of the identifiers "commit","tree","tag" and "blob" describing
the type of an object.
[[def_object_type]]object type::
One of the identifiers
"<<def_commit,commit>>","<<def_tree,tree>>","<<def_tag,tag>>" or "<<def_blob_object,blob>>"
describing the type of an <<def_object,object>>.
octopus::
To merge more than two branches. Also denotes an intelligent
predator.
[[def_octopus]]octopus::
To <<def_merge,merge>> more than two branches. Also denotes an
intelligent predator.
origin::
The default upstream repository. Most projects have at
least one upstream project which they track. By default
'origin' is used for that purpose. New upstream updates
[[def_origin]]origin::
The default upstream <<def_repository,repository>>. Most projects have
at least one upstream project which they track. By default
'<<def_origin,origin>>' is used for that purpose. New upstream updates
will be fetched into remote tracking branches named
origin/name-of-upstream-branch, which you can see using
"git branch -r".
"git <<def_branch,branch>> -r".
pack::
A set of objects which have been compressed into one file (to save
space or to transmit them efficiently).
[[def_pack]]pack::
A set of objects which have been compressed into one file (to save space
or to transmit them efficiently).
pack index::
[[def_pack_index]]pack index::
The list of identifiers, and other information, of the objects in a
pack, to assist in efficiently accessing the contents of a pack.
<<def_pack,pack>>, to assist in efficiently accessing the contents of a
<<def_pack,pack>>.
parent::
A commit object contains a (possibly empty) list of the logical
predecessor(s) in the line of development, i.e. its parents.
[[def_parent]]parent::
A <<def_commit_object,commit object>> contains a (possibly empty) list
of the logical predecessor(s) in the line of development, i.e. its
parents.
pickaxe::
The term pickaxe refers to an option to the diffcore routines
that help select changes that add or delete a given text string.
With the --pickaxe-all option, it can be used to view the
full changeset that introduced or removed, say, a particular
line of text. See gitlink:git-diff[1].
[[def_pickaxe]]pickaxe::
The term <<def_pickaxe,pickaxe>> refers to an option to the diffcore
routines that help select changes that add or delete a given text
string. With the --pickaxe-all option, it can be used to view the full
<<def_changeset,changeset>> that introduced or removed, say, a
particular line of text. See gitlink:git-diff[1].
plumbing::
Cute name for core git.
[[def_plumbing]]plumbing::
Cute name for <<def_core_git,core git>>.
porcelain::
Cute name for programs and program suites depending on core git,
presenting a high level access to core git. Porcelains expose
more of a SCM interface than the plumbing.
[[def_porcelain]]porcelain::
Cute name for programs and program suites depending on
<<def_core_git,core git>>, presenting a high level access to
<<def_core_git,core git>>. Porcelains expose more of a <<def_SCM,SCM>>
interface than the <<def_plumbing,plumbing>>.
pull::
Pulling a branch means to fetch it and merge it.
[[def_pull]]pull::
Pulling a <<def_branch,branch>> means to <<def_fetch,fetch>> it and
<<def_merge,merge>> it.
push::
Pushing a branch means to get the branch's head ref from a remote
repository, find out if it is an ancestor to the branch's local
head ref is a direct, and in that case, putting all objects, which
are reachable from the local head ref, and which are missing from
the remote repository, into the remote object database, and updating
the remote head ref. If the remote head is not an ancestor to the
local head, the push fails.
[[def_push]]push::
Pushing a <<def_branch,branch>> means to get the <<def_branch,branch>>'s
<<def_head_ref,head ref>> from a remote <<def_repository,repository>>,
find out if it is an ancestor to the <<def_branch,branch>>'s local
<<def_head_ref,head ref>> is a direct, and in that case, putting all
objects, which are <<def_reachable,reachable>> from the local
<<def_head_ref,head ref>>, and which are missing from the remote
<<def_repository,repository>>, into the remote
<<def_object_database,object database>>, and updating the remote
<<def_head_ref,head ref>>. If the remote <<def_head,head>> is not an
ancestor to the local <<def_head,head>>, the <<def_push,push>> fails.
reachable::
All of the ancestors of a given commit are said to be reachable from
that commit. More generally, one object is reachable from another if
we can reach the one from the other by a chain that follows tags to
whatever they tag, commits to their parents or trees, and trees to the
trees or blobs that they contain.
[[def_reachable]]reachable::
All of the ancestors of a given <<def_commit,commit>> are said to be
<<def_reachable,reachable>> from that <<def_commit,commit>>. More
generally, one <<def_object,object>> is <<def_reachable,reachable>> from
another if we can reach the one from the other by a <<def_chain,chain>>
that follows <<def_tag,tags>> to whatever they tag,
<<def_commit_object,commits>> to their parents or trees, and
<<def_tree_object,trees>> to the trees or <<def_blob_object,blobs>>
that they contain.
rebase::
To clean a branch by starting from the head of the main line of
development ("master"), and reapply the (possibly cherry-picked)
changes from that branch.
[[def_rebase]]rebase::
To reapply a series of changes from a <<def_branch,branch>> to a
different base, and reset the <<def_head,head>> of that branch
to the result.
ref::
A 40-byte hex representation of a SHA1 or a name that denotes
a particular object. These may be stored in `$GIT_DIR/refs/`.
[[def_ref]]ref::
A 40-byte hex representation of a <<def_SHA1,SHA1>> or a name that
denotes a particular <<def_object,object>>. These may be stored in
`$GIT_DIR/refs/`.
refspec::
A refspec is used by fetch and push to describe the mapping
between remote ref and local ref. They are combined with
a colon in the format <src>:<dst>, preceded by an optional
plus sign, +. For example:
`git fetch $URL refs/heads/master:refs/heads/origin`
means "grab the master branch head from the $URL and store
it as my origin branch head".
And `git push $URL refs/heads/master:refs/heads/to-upstream`
means "publish my master branch head as to-upstream branch
at $URL". See also gitlink:git-push[1]
[[def_refspec]]refspec::
A <<def_refspec,refspec>> is used by <<def_fetch,fetch>> and
<<def_push,push>> to describe the mapping between remote <<def_ref,ref>>
and local <<def_ref,ref>>. They are combined with a colon in the format
<src>:<dst>, preceded by an optional plus sign, +. For example: `git
fetch $URL refs/heads/master:refs/heads/origin` means
"grab the master <<def_branch,branch>> <<def_head,head>>
from the $URL and store it as my origin
<<def_branch,branch>> <<def_head,head>>". And `git <<def_push,push>>
$URL refs/heads/master:refs/heads/to-upstream` means
"publish my master <<def_branch,branch>>
<<def_head,head>> as to-upstream <<def_branch,branch>> at $URL". See
also gitlink:git-push[1]
repository::
A collection of refs together with an object database containing
all objects, which are reachable from the refs, possibly accompanied
by meta data from one or more porcelains. A repository can
share an object database with other repositories.
[[def_repository]]repository::
A collection of refs together with an <<def_object_database,object
database>> containing all objects which are <<def_reachable,reachable>>
from the refs, possibly accompanied by meta data from one or more
porcelains. A <<def_repository,repository>> can share an
<<def_object_database,object database>> with other repositories.
resolve::
The action of fixing up manually what a failed automatic merge
left behind.
[[def_resolve]]resolve::
The action of fixing up manually what a failed automatic
<<def_merge,merge>> left behind.
revision::
A particular state of files and directories which was stored in
the object database. It is referenced by a commit object.
[[def_revision]]revision::
A particular state of files and directories which was stored in the
<<def_object_database,object database>>. It is referenced by a
<<def_commit_object,commit object>>.
rewind::
To throw away part of the development, i.e. to assign the head to
an earlier revision.
[[def_rewind]]rewind::
To throw away part of the development, i.e. to assign the
<<def_head,head>> to an earlier <<def_revision,revision>>.
SCM::
[[def_SCM]]SCM::
Source code management (tool).
SHA1::
Synonym for object name.
[[def_SHA1]]SHA1::
Synonym for <<def_object_name,object name>>.
shallow repository::
A shallow repository has an incomplete history some of
whose commits have parents cauterized away (in other
words, git is told to pretend that these commits do not
have the parents, even though they are recorded in the
commit object). This is sometimes useful when you are
interested only in the recent history of a project even
though the real history recorded in the upstream is
much larger. A shallow repository is created by giving
`--depth` option to gitlink:git-clone[1], and its
history can be later deepened with gitlink:git-fetch[1].
[[def_shallow_repository]]shallow repository::
A <<def_shallow_repository,shallow repository>> has an incomplete
history some of whose commits have parents cauterized away (in other
words, git is told to pretend that these commits do not have the
parents, even though they are recorded in the <<def_commit_object,commit
object>>). This is sometimes useful when you are interested only in the
recent history of a project even though the real history recorded in the
upstream is much larger. A <<def_shallow_repository,shallow repository>>
is created by giving the `--depth` option to gitlink:git-clone[1], and
its history can be later deepened with gitlink:git-fetch[1].
symref::
Symbolic reference: instead of containing the SHA1 id itself, it
is of the format 'ref: refs/some/thing' and when referenced, it
recursively dereferences to this reference. 'HEAD' is a prime
example of a symref. Symbolic references are manipulated with
the gitlink:git-symbolic-ref[1] command.
[[def_symref]]symref::
Symbolic reference: instead of containing the <<def_SHA1,SHA1>> id
itself, it is of the format 'ref: refs/some/thing' and when
referenced, it recursively dereferences to this reference. 'HEAD' is a
prime example of a <<def_symref,symref>>. Symbolic references are
manipulated with the gitlink:git-symbolic-ref[1] command.
topic branch::
A regular git branch that is used by a developer to
identify a conceptual line of development. Since branches
are very easy and inexpensive, it is often desirable to
have several small branches that each contain very well
defined concepts or small incremental yet related changes.
[[def_tag]]tag::
A <<def_ref,ref>> pointing to a <<def_tag,tag>> or
<<def_commit_object,commit object>>. In contrast to a <<def_head,head>>,
a tag is not changed by a <<def_commit,commit>>. Tags (not
<<def_tag_object,tag objects>>) are stored in `$GIT_DIR/refs/tags/`. A
git tag has nothing to do with a Lisp tag (which would be
called an <<def_object_type,object type>> in git's context). A
tag is most typically used to mark a particular point in the
<<def_commit,commit>> ancestry <<def_chain,chain>>.
tracking branch::
A regular git branch that is used to follow changes from
another repository. A tracking branch should not contain
direct modifications or have local commits made to it.
A tracking branch can usually be identified as the
right-hand-side ref in a Pull: refspec.
[[def_tag_object]]tag object::
An <<def_object,object>> containing a <<def_ref,ref>> pointing to
another <<def_object,object>>, which can contain a message just like a
<<def_commit_object,commit object>>. It can also contain a (PGP)
signature, in which case it is called a "signed <<def_tag_object,tag
object>>".
tree object::
An object containing a list of file names and modes along with refs
to the associated blob and/or tree objects. A tree is equivalent
to a directory.
[[def_topic_branch]]topic branch::
A regular git <<def_branch,branch>> that is used by a developer to
identify a conceptual line of development. Since branches are very easy
and inexpensive, it is often desirable to have several small branches
that each contain very well defined concepts or small incremental yet
related changes.
tree::
Either a working tree, or a tree object together with the
dependent blob and tree objects (i.e. a stored representation
of a working tree).
[[def_tracking_branch]]tracking branch::
A regular git <<def_branch,branch>> that is used to follow changes from
another <<def_repository,repository>>. A <<def_tracking_branch,tracking
branch>> should not contain direct modifications or have local commits
made to it. A <<def_tracking_branch,tracking branch>> can usually be
identified as the right-hand-side <<def_ref,ref>> in a Pull:
<<def_refspec,refspec>>.
tree-ish::
A ref pointing to either a commit object, a tree object, or a
tag object pointing to a tag or commit or tree object.
[[def_tree]]tree::
Either a <<def_working_tree,working tree>>, or a <<def_tree_object,tree
object>> together with the dependent blob and <<def_tree,tree>> objects
(i.e. a stored representation of a <<def_working_tree,working tree>>).
tag object::
An object containing a ref pointing to another object, which can
contain a message just like a commit object. It can also
contain a (PGP) signature, in which case it is called a "signed
tag object".
[[def_tree_object]]tree object::
An <<def_object,object>> containing a list of file names and modes along
with refs to the associated blob and/or tree objects. A
<<def_tree,tree>> is equivalent to a <<def_directory,directory>>.
tag::
A ref pointing to a tag or commit object. In contrast to a head,
a tag is not changed by a commit. Tags (not tag objects) are
stored in `$GIT_DIR/refs/tags/`. A git tag has nothing to do with
a Lisp tag (which is called object type in git's context).
A tag is most typically used to mark a particular point in the
commit ancestry chain.
[[def_tree-ish]]tree-ish::
A <<def_ref,ref>> pointing to either a <<def_commit_object,commit
object>>, a <<def_tree_object,tree object>>, or a <<def_tag_object,tag
object>> pointing to a <<def_tag,tag>> or <<def_commit,commit>> or
<<def_tree_object,tree object>>.
unmerged index::
An index which contains unmerged index entries.
[[def_unmerged_index]]unmerged index::
An <<def_index,index>> which contains unmerged
<<def_index_entry,index entries>>.
working tree::
The set of files and directories currently being worked on,
i.e. you can work in your working tree without using git at all.
[[def_unreachable_object]]unreachable object::
An <<def_object,object>> which is not <<def_reachable,reachable>> from a
<<def_branch,branch>>, <<def_tag,tag>>, or any other reference.
[[def_working_tree]]working tree::
The set of files and directories currently being worked on, i.e. you can
work in your <<def_working_tree,working tree>> without using git at all.

View File

@ -2,7 +2,7 @@
T="$1"
for h in *.html *.txt howto/*.txt howto/*.html RelNotes-*.txt
for h in *.html *.txt howto/*.txt howto/*.html RelNotes-*.txt *.css
do
if test -f "$T/$h" &&
diff -u -I'Last updated [0-9][0-9]-[A-Z][a-z][a-z]-' "$T/$h" "$h"

View File

@ -1,69 +0,0 @@
#!/usr/bin/perl
%terms=();
while(<>) {
if(/^(\S.*)::$/) {
my $term=$1;
if(defined($terms{$term})) {
die "$1 defined twice\n";
}
$terms{$term}="";
LOOP: while(<>) {
if(/^$/) {
last LOOP;
}
if(/^ \S/) {
$terms{$term}.=$_;
} else {
die "Error 1: $_";
}
}
}
}
sub format_tab_80 ($) {
my $text=$_[0];
my $result="";
$text=~s/\s+/ /g;
$text=~s/^\s+//;
while($text=~/^(.{1,72})(|\s+(\S.*)?)$/) {
$result.=" ".$1."\n";
$text=$3;
}
return $result;
}
sub no_spaces ($) {
my $result=$_[0];
$result=~tr/ /_/;
return $result;
}
print 'GIT Glossary
============
This list is sorted alphabetically:
';
@keys=sort {uc($a) cmp uc($b)} keys %terms;
$pattern='(\b(?<!link:git-)'.join('\b|\b(?<!link:git-)',reverse @keys).'\b)';
foreach $key (@keys) {
$terms{$key}=~s/$pattern/sprintf "<<ref_".no_spaces($1).",$1>>";/eg;
print '[[ref_'.no_spaces($key).']]'.$key."::\n"
.format_tab_80($terms{$key})."\n";
}
print '
Author
------
Written by Johannes Schindelin <Johannes.Schindelin@gmx.de> and
the git-list <git@vger.kernel.org>.
GIT
---
Part of the link:git.html[git] suite
';

View File

@ -21,11 +21,11 @@ GIT pack format
which looks like this:
(undeltified representation)
n-byte type and length (4-bit type, (n-1)*7+4-bit length)
n-byte type and length (3-bit type, (n-1)*7+4-bit length)
compressed data
(deltified representation)
n-byte type and length (4-bit type, (n-1)*7+4-bit length)
n-byte type and length (3-bit type, (n-1)*7+4-bit length)
20-byte base object name
compressed delta data
@ -102,11 +102,13 @@ trailer | | packfile checksum |
Pack file entry: <+
packed object header:
1-byte type (upper 4-bit)
1-byte size extension bit (MSB)
type (next 3 bit)
size0 (lower 4-bit)
n-byte sizeN (as long as MSB is set, each 7-bit)
size0..sizeN form 4+7+7+..+7 bit integer, size0
is the most significant part.
is the least significant part, and sizeN is the
most significant part.
packed object data:
If it is not DELTA, then deflated bytes (the size above
is the size before compression).

View File

@ -2,7 +2,7 @@ Git User's Manual
_________________
This manual is designed to be readable by someone with basic unix
commandline skills, but no previous knowledge of git.
command-line skills, but no previous knowledge of git.
Chapter 1 gives a brief overview of git commands, without any
explanation; you may prefer to skip to chapter 2 on a first reading.
@ -288,21 +288,22 @@ collection of files. It stores the history as a compressed
collection of interrelated snapshots (versions) of the project's
contents.
A single git repository may contain multiple branches. Each branch
is a bookmark referencing a particular point in the project history.
The gitlink:git-branch[1] command shows you the list of branches:
A single git repository may contain multiple branches. It keeps track
of them by keeping a list of <<def_head,heads>> which reference the
latest version on each branch; the gitlink:git-branch[1] command shows
you the list of branch heads:
------------------------------------------------
$ git branch
* master
------------------------------------------------
A freshly cloned repository contains a single branch, named "master",
and the working directory contains the version of the project
referred to by the master branch.
A freshly cloned repository contains a single branch head, named
"master", and working directory is initialized to the state of
the project referred to by "master".
Most projects also use tags. Tags, like branches, are references
into the project's history, and can be listed using the
Most projects also use <<def_tag,tags>>. Tags, like heads, are
references into the project's history, and can be listed using the
gitlink:git-tag[1] command:
------------------------------------------------
@ -320,9 +321,9 @@ v2.6.13
------------------------------------------------
Tags are expected to always point at the same version of a project,
while branches are expected to advance as development progresses.
while heads are expected to advance as development progresses.
Create a new branch pointing to one of these versions and check it
Create a new branch head pointing to one of these versions and check it
out using gitlink:git-checkout[1]:
------------------------------------------------
@ -346,10 +347,10 @@ the current branch to point at v2.6.17 instead, with
$ git reset --hard v2.6.17
------------------------------------------------
Note that if the current branch was your only reference to a
Note that if the current branch head was your only reference to a
particular point in history, then resetting that branch may leave you
with no way to find the history it used to point to; so use this
command carefully.
with no way to find the history it used to point to; so use this command
carefully.
Understanding History: Commits
------------------------------
@ -391,15 +392,20 @@ index 8be626f..d7aac9d 100644
As you can see, a commit shows who made the latest change, what they
did, and why.
Every commit has a 40-hexdigit id, sometimes called the "object name"
or the "SHA1 id", shown on the first line of the "git show" output.
You can usually refer to a commit by a shorter name, such as a tag or a
branch name, but this longer name can also be useful. Most
importantly, it is a globally unique name for this commit: so if you
tell somebody else the object name (for example in email), then you are
guaranteed that name will refer to the same commit in their repository
that it does in yours (assuming their repository has that commit at
all).
Every commit has a 40-hexdigit id, sometimes called the "object name" or the
"SHA1 id", shown on the first line of the "git show" output. You can usually
refer to a commit by a shorter name, such as a tag or a branch name, but this
longer name can also be useful. Most importantly, it is a globally unique
name for this commit: so if you tell somebody else the object name (for
example in email), then you are guaranteed that name will refer to the same
commit in their repository that it does in yours (assuming their repository
has that commit at all). Since the object name is computed as a hash over the
contents of the commit, you are guaranteed that the commit can never change
without its name also changing.
In fact, in <<git-internals>> we shall see that everything stored in git
history, including file data and directory contents, is stored in an object
with a name that is a hash of its contents.
Understanding history: commits, parents, and reachability
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -432,11 +438,14 @@ We will sometimes represent git history using diagrams like the one
below. Commits are shown as "o", and the links between them with
lines drawn with - / and \. Time goes left to right:
................................................
o--o--o <-- Branch A
/
o--o--o <-- master
\
o--o--o <-- Branch B
................................................
If we need to talk about a particular commit, the character "o" may
be replaced with another letter or number.
@ -444,17 +453,15 @@ be replaced with another letter or number.
Understanding history: What is a branch?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Though we've been using the word "branch" to mean a kind of reference
to a particular commit, the word branch is also commonly used to
refer to the line of commits leading up to that point. In the
example above, git may think of the branch named "A" as just a
pointer to one particular commit, but we may refer informally to the
line of three commits leading up to that point as all being part of
When we need to be precise, we will use the word "branch" to mean a line
of development, and "branch head" (or just "head") to mean a reference
to the most recent commit on a branch. In the example above, the branch
head named "A" is a pointer to one particular commit, but we refer to
the line of three commits leading up to that point as all being part of
"branch A".
If we need to make it clear that we're just talking about the most
recent commit on the branch, we may refer to that commit as the
"head" of the branch.
However, when no confusion will result, we often just use the term
"branch" both for branches and for branch heads.
Manipulating branches
---------------------
@ -596,8 +603,8 @@ a new stanza:
$ cat .git/config
...
[remote "linux-nfs"]
url = git://linux-nfs.org/~bfields/git.git
fetch = +refs/heads/*:refs/remotes/linux-nfs-read/*
url = git://linux-nfs.org/pub/nfs-2.6.git
fetch = +refs/heads/*:refs/remotes/linux-nfs/*
...
-------------------------------------------------
@ -1128,17 +1135,9 @@ modified in two different ways in the remote branch and the local
branch--then you are warned; the output may look something like this:
-------------------------------------------------
$ git pull . next
Trying really trivial in-index merge...
fatal: Merge requires file-level merging
Nope.
Merging HEAD with 77976da35a11db4580b80ae27e8d65caf5208086
Merging:
15e2162 world
77976da goodbye
found 1 common ancestor(s):
d122ed4 initial
Auto-merging file.txt
$ git merge next
100% (4/4) done
Auto-merged file.txt
CONFLICT (content): Merge conflict in file.txt
Automatic merge failed; fix conflicts and then commit the result.
-------------------------------------------------
@ -1163,18 +1162,46 @@ the working tree in a special state that gives you all the
information you need to help resolve the merge.
Files with conflicts are marked specially in the index, so until you
resolve the problem and update the index, git commit will fail:
resolve the problem and update the index, gitlink:git-commit[1] will
fail:
-------------------------------------------------
$ git commit
file.txt: needs merge
-------------------------------------------------
Also, git status will list those files as "unmerged".
Also, gitlink:git-status[1] will list those files as "unmerged", and the
files with conflicts will have conflict markers added, like this:
-------------------------------------------------
<<<<<<< HEAD:file.txt
Hello world
=======
Goodbye
>>>>>>> 77976da35a11db4580b80ae27e8d65caf5208086:file.txt
-------------------------------------------------
All you need to do is edit the files to resolve the conflicts, and then
-------------------------------------------------
$ git add file.txt
$ git commit
-------------------------------------------------
Note that the commit message will already be filled in for you with
some information about the merge. Normally you can just use this
default message unchanged, but you may add additional commentary of
your own if desired.
The above is all you need to know to resolve a simple merge. But git
also provides more information to help resolve conflicts:
Getting conflict-resolution help during a merge
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All of the changes that git was able to merge automatically are
already added to the index file, so gitlink:git-diff[1] shows only
the conflicts. Also, it uses a somewhat unusual syntax:
the conflicts. It uses an unusual syntax:
-------------------------------------------------
$ git diff
@ -1195,14 +1222,32 @@ conflict will have two parents instead of the usual one: one parent
will be HEAD, the tip of the current branch; the other will be the
tip of the other branch, which is stored temporarily in MERGE_HEAD.
The diff above shows the differences between the working-tree version
of file.txt and two previous version: one version from HEAD, and one
from MERGE_HEAD. So instead of preceding each line by a single "+"
or "-", it now uses two columns: the first column is used for
differences between the first parent and the working directory copy,
and the second for differences between the second parent and the
working directory copy. Thus after resolving the conflict in the
obvious way, the diff will look like:
During the merge, the index holds three versions of each file. Each of
these three "file stages" represents a different version of the file:
-------------------------------------------------
$ git show :1:file.txt # the file in a common ancestor of both branches
$ git show :2:file.txt # the version from HEAD, but including any
# nonconflicting changes from MERGE_HEAD
$ git show :3:file.txt # the version from MERGE_HEAD, but including any
# nonconflicting changes from HEAD.
-------------------------------------------------
Since the stage 2 and stage 3 versions have already been updated with
nonconflicting changes, the only remaining differences between them are
the important ones; thus gitlink:git-diff[1] can use the information in
the index to show only those conflicts.
The diff above shows the differences between the working-tree version of
file.txt and the stage 2 and stage 3 versions. So instead of preceding
each line by a single "+" or "-", it now uses two columns: the first
column is used for differences between the first parent and the working
directory copy, and the second for differences between the second parent
and the working directory copy. (See the "COMBINED DIFF FORMAT" section
of gitlink:git-diff-files[1] for a details of the format.)
After resolving the conflict in the obvious way (but before updating the
index), the diff will look like:
-------------------------------------------------
$ git diff
@ -1220,26 +1265,37 @@ This shows that our resolved version deleted "Hello world" from the
first parent, deleted "Goodbye" from the second parent, and added
"Goodbye world", which was previously absent from both.
The gitlink:git-log[1] command also provides special help for merges:
Some special diff options allow diffing the working directory against
any of these stages:
-------------------------------------------------
$ git diff -1 file.txt # diff against stage 1
$ git diff --base file.txt # same as the above
$ git diff -2 file.txt # diff against stage 2
$ git diff --ours file.txt # same as the above
$ git diff -3 file.txt # diff against stage 3
$ git diff --theirs file.txt # same as the above.
-------------------------------------------------
The gitlink:git-log[1] and gitk[1] commands also provide special help
for merges:
-------------------------------------------------
$ git log --merge
$ gitk --merge
-------------------------------------------------
This will list all commits which exist only on HEAD or on MERGE_HEAD,
and which touch an unmerged file.
These will display all commits which exist only on HEAD or on
MERGE_HEAD, and which touch an unmerged file.
We can now add the resolved version to the index and commit:
Each time you resolve the conflicts in a file and update the index:
-------------------------------------------------
$ git add file.txt
$ git commit
-------------------------------------------------
Note that the commit message will already be filled in for you with
some information about the merge. Normally you can just use this
default message unchanged, but you may add additional commentary of
your own if desired.
the different stages of that file will be "collapsed", after which
git-diff will (by default) no longer show diffs for that file.
[[undoing-a-merge]]
undoing a merge
@ -1255,7 +1311,7 @@ $ git reset --hard HEAD
Or, if you've already commited the merge that you want to throw away,
-------------------------------------------------
$ git reset --hard HEAD^
$ git reset --hard ORIG_HEAD
-------------------------------------------------
However, this last command can be dangerous in some cases--never
@ -1328,6 +1384,7 @@ with the changes to be reverted, then you will be asked to fix
conflicts manually, just as in the case of <<resolving-a-merge,
resolving a merge>>.
[[fixing-a-mistake-by-editing-history]]
Fixing a mistake by editing history
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -1376,7 +1433,7 @@ modifying the working directory, you can do that with
gitlink:git-show[1]:
-------------------------------------------------
$ git show HEAD^ path/to/file
$ git show HEAD^:path/to/file
-------------------------------------------------
which will display the given version of the file.
@ -1479,7 +1536,7 @@ Examining dangling objects
In some situations the reflog may not be able to save you. For
example, suppose you delete a branch, then realize you need the history
it pointed you. The reflog is also deleted; however, if you have not
it contained. The reflog is also deleted; however, if you have not
yet pruned the repository, then you may still be able to find
the lost commits; run git-fsck and watch for output that mentions
"dangling commits":
@ -1505,7 +1562,7 @@ history that is described by all your existing branches and tags. Thus
you get exactly the history reachable from that commit that is lost.
(And notice that it might not be just one commit: we only report the
"tip of the line" as being dangling, but there might be a whole deep
and complex commit history that was gotten dropped.)
and complex commit history that was dropped.)
If you decide you want the history back, you can always create a new
reference pointing to it, for example, a new branch:
@ -1561,7 +1618,7 @@ repository that you pulled from.
(But note that no such commit will be created in the case of a
<<fast-forwards,fast forward>>; instead, your branch will just be
updated to point to the latest commit from the upstream branch).
updated to point to the latest commit from the upstream branch.)
The git-pull command can also be given "." as the "remote" repository,
in which case it just merges in a branch from the current repository; so
@ -1638,9 +1695,9 @@ updates with git pull>>".
If you and maintainer both have accounts on the same machine, then
then you can just pull changes from each other's repositories
directly; note that all of the command (gitlink:git-clone[1],
git-fetch[1], git-pull[1], etc.) which accept a URL as an argument
will also accept a local file patch; so, for example, you can
directly; note that all of the commands (gitlink:git-clone[1],
git-fetch[1], git-pull[1], etc.) that accept a URL as an argument
will also accept a local directory name; so, for example, you can
use
-------------------------------------------------
@ -1832,7 +1889,7 @@ that makes it easy for them to read your changes, verify that they are
correct, and understand why you made each change.
If you present all of your changes as a single patch (or commit), they
may find it is too much to digest all at once.
may find that it is too much to digest all at once.
If you present them with the entire history of your work, complete with
mistakes, corrections, and dead ends, they may be overwhelmed.
@ -1858,11 +1915,8 @@ you are rewriting history.
Keeping a patch series up to date using git-rebase
--------------------------------------------------
Suppose you have a series of commits in a branch "mywork", which
originally branched off from "origin".
Suppose you create a branch "mywork" on a remote-tracking branch
"origin", and created some commits on top of it:
Suppose that you create a branch "mywork" on a remote-tracking branch
"origin", and create some commits on top of it:
-------------------------------------------------
$ git checkout -b mywork origin
@ -1876,25 +1930,29 @@ $ git commit
You have performed no merges into mywork, so it is just a simple linear
sequence of patches on top of "origin":
................................................
o--o--o <-- origin
\
o--o--o <-- mywork
................................................
Some more interesting work has been done in the upstream project, and
"origin" has advanced:
................................................
o--o--O--o--o--o <-- origin
\
a--b--c <-- mywork
................................................
At this point, you could use "pull" to merge your changes back in;
the result would create a new merge commit, like this:
................................................
o--o--O--o--o--o <-- origin
\ \
a--b--c--m <-- mywork
................................................
However, if you prefer to keep the history in mywork a simple series of
commits without any merges, you may instead choose to use
@ -1911,9 +1969,11 @@ point at the latest version of origin, then apply each of the saved
patches to the new mywork. The result will look like:
................................................
o--o--O--o--o--o <-- origin
\
a'--b'--c' <-- mywork
................................................
In the process, it may discover conflicts. In that case it will stop
and allow you to fix the conflicts; after fixing conflicts, use "git
@ -1933,6 +1993,51 @@ return mywork to the state it had before you started the rebase:
$ git rebase --abort
-------------------------------------------------
Modifying a single commit
-------------------------
We saw in <<fixing-a-mistake-by-editing-history>> that you can replace the
most recent commit using
-------------------------------------------------
$ git commit --amend
-------------------------------------------------
which will replace the old commit by a new commit incorporating your
changes, giving you a chance to edit the old commit message first.
You can also use a combination of this and gitlink:git-rebase[1] to edit
commits further back in your history. First, tag the problematic commit with
-------------------------------------------------
$ git tag bad mywork~5
-------------------------------------------------
(Either gitk or git-log may be useful for finding the commit.)
Then check out a new branch at that commit, edit it, and rebase the rest of
the series on top of it:
-------------------------------------------------
$ git checkout -b TMP bad
$ # make changes here and update the index
$ git commit --amend
$ git rebase --onto TMP bad mywork
-------------------------------------------------
When you're done, you'll be left with mywork checked out, with the top patches
on mywork reapplied on top of the modified commit you created in TMP. You can
then clean up with
-------------------------------------------------
$ git branch -d TMP
$ git tag -d bad
-------------------------------------------------
Note that the immutable nature of git history means that you haven't really
"modified" existing commits; instead, you have replaced the old commits with
new commits having new object names.
Reordering or selecting from a patch series
-------------------------------------------
@ -1966,7 +2071,7 @@ Other tools
-----------
There are numerous other tools, such as stgit, which exist for the
purpose of maintaining a patch series. These are out of the scope of
purpose of maintaining a patch series. These are outside of the scope of
this manual.
Problems with rewriting history
@ -1976,24 +2081,30 @@ The primary problem with rewriting the history of a branch has to do
with merging. Suppose somebody fetches your branch and merges it into
their branch, with a result something like this:
................................................
o--o--O--o--o--o <-- origin
\ \
t--t--t--m <-- their branch:
................................................
Then suppose you modify the last three commits:
................................................
o--o--o <-- new head of origin
/
o--o--O--o--o--o <-- old head of origin
................................................
If we examined all this history together in one repository, it will
look like:
................................................
o--o--o <-- new head of origin
/
o--o--O--o--o--o <-- old head of origin
\ \
t--t--t--m <-- their branch:
................................................
Git has no way of knowing that the new head is an updated version of
the old head; it treats this situation exactly the same as it would if
@ -2054,9 +2165,11 @@ commit. Git calls this process a "fast forward".
A fast forward looks something like this:
................................................
o--o--o--o <-- old head of the branch
\
o--o--o <-- new head of the branch
................................................
In some cases it is possible that the new head will *not* actually be
@ -2064,11 +2177,11 @@ a descendant of the old head. For example, the developer may have
realized she made a serious mistake, and decided to backtrack,
resulting in a situation like:
................................................
o--o--o--o--a--b <-- old head of the branch
\
o--o--o <-- new head of the branch
................................................
In this case, "git fetch" will fail, and print out a warning.
@ -2088,7 +2201,7 @@ descendant of the old head, you may force the update with:
$ git fetch git://example.com/proj.git +master:refs/remotes/example/master
-------------------------------------------------
Note the addition of the "+" sign. Be aware that commits which the
Note the addition of the "+" sign. Be aware that commits that the
old version of example/master pointed at may be lost, as we saw in
the previous section.
@ -2096,7 +2209,7 @@ Configuring remote branches
---------------------------
We saw above that "origin" is just a shortcut to refer to the
repository which you originally cloned from. This information is
repository that you originally cloned from. This information is
stored in git configuration variables, which you can see using
gitlink:git-config[1]:
@ -2158,6 +2271,7 @@ See gitlink:git-config[1] for more details on the configuration
options mentioned above.
[[git-internals]]
Git internals
=============
@ -2407,7 +2521,7 @@ conflicts between different tree objects, allowing each pathname to be
associated with sufficient information about the trees involved that
you can create a three-way merge between them.'
Those are the three ONLY things that the directory cache does. It's a
Those are the ONLY three things that the directory cache does. It's a
cache, and the normal operation is to re-generate it completely from a
known tree object, or update/compare it with a live tree that is being
developed. If you blow the directory cache away entirely, you generally
@ -2898,9 +3012,6 @@ confusing and scary messages, but it won't actually do anything bad. In
contrast, running "git prune" while somebody is actively changing the
repository is a *BAD* idea).
Glossary of git terms
=====================
include::glossary.txt[]
Notes and todo list for this manual
@ -2939,11 +3050,6 @@ provides.
Simplify beginning by suggesting disconnected head instead of
temporary branch creation?
Explain how to refer to file stages in the "how to resolve a merge"
section: diff -1, -2, -3, --ours, --theirs :1:/path notation. The
"git ls-files --unmerged --stage" thing is sorta useful too,
actually. And note gitk --merge.
Add more good examples. Entire sections of just cookbook examples
might be a good idea; maybe make an "advanced examples" section a
standard end-of-chapter section?

View File

@ -1,7 +1,7 @@
#!/bin/sh
GVF=GIT-VERSION-FILE
DEF_VER=v1.5.0.1.GIT
DEF_VER=v1.5.0.6.GIT
LF='
'

View File

@ -28,6 +28,10 @@ all::
#
# Define NO_STRLCPY if you don't have strlcpy.
#
# Define NO_STRTOUMAX if you don't have strtoumax in the C library.
# If your compiler also does not support long long or does not have
# strtoull, define NO_STRTOULL.
#
# Define NO_SETENV if you don't have setenv in the C library.
#
# Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link.
@ -85,6 +89,9 @@ all::
#
# Define NO_ICONV if your libc does not properly support iconv.
#
# Define OLD_ICONV if your library has an old iconv(), where the second
# (input buffer pointer) parameter is declared with type (const char **).
#
# Define NO_R_TO_GCC if your gcc does not like "-R/path/lib" that
# tells runtime paths to dynamic libraries; "-Wl,-rpath=/path/lib"
# is used instead.
@ -353,11 +360,13 @@ ifeq ($(uname_S),SunOS)
NO_UNSETENV = YesPlease
NO_SETENV = YesPlease
NO_C99_FORMAT = YesPlease
NO_STRTOUMAX = YesPlease
endif
ifeq ($(uname_R),5.9)
NO_UNSETENV = YesPlease
NO_SETENV = YesPlease
NO_C99_FORMAT = YesPlease
NO_STRTOUMAX = YesPlease
endif
INSTALL = ginstall
TAR = gtar
@ -369,7 +378,6 @@ ifeq ($(uname_O),Cygwin)
NO_STRCASESTR = YesPlease
NO_SYMLINK_HEAD = YesPlease
NEEDS_LIBICONV = YesPlease
NO_C99_FORMAT = YesPlease
NO_FAST_WORKING_DIRECTORY = UnfortunatelyYes
NO_TRUSTABLE_FILEMODE = UnfortunatelyYes
# There are conflicting reports about this.
@ -517,6 +525,13 @@ ifdef NO_STRLCPY
COMPAT_CFLAGS += -DNO_STRLCPY
COMPAT_OBJS += compat/strlcpy.o
endif
ifdef NO_STRTOUMAX
COMPAT_CFLAGS += -DNO_STRTOUMAX
COMPAT_OBJS += compat/strtoumax.o
endif
ifdef NO_STRTOULL
COMPAT_CFLAGS += -DNO_STRTOULL
endif
ifdef NO_SETENV
COMPAT_CFLAGS += -DNO_SETENV
COMPAT_OBJS += compat/setenv.o
@ -560,6 +575,10 @@ ifdef NO_ICONV
BASIC_CFLAGS += -DNO_ICONV
endif
ifdef OLD_ICONV
BASIC_CFLAGS += -DOLD_ICONV
endif
ifdef PPC_SHA1
SHA1_HEADER = "ppc/sha1.h"
LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o
@ -762,7 +781,7 @@ git-http-push$X: revision.o http.o http-push.o $(GITLIBS)
$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
$(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H)
$(LIB_OBJS) $(BUILTIN_OBJS) fetch.o: $(LIB_H)
$(patsubst git-%$X,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h)
$(DIFF_OBJS): diffcore.h

View File

@ -1 +1 @@
Documentation/RelNotes-1.5.0.1.txt
Documentation/RelNotes-1.5.0.6.txt

View File

@ -1539,7 +1539,8 @@ static int apply_line(char *output, const char *patch, int plen)
int need_fix_leading_space = 0;
char *buf;
if ((new_whitespace != strip_whitespace) || !whitespace_error) {
if ((new_whitespace != strip_whitespace) || !whitespace_error ||
*patch != '+') {
memcpy(output, patch + 1, plen);
return plen;
}

View File

@ -252,8 +252,6 @@ int cmd_archive(int argc, const char **argv, const char *prefix)
memset(&ar, 0, sizeof(ar));
tree_idx = parse_archive_args(argc, argv, &ar);
if (prefix == NULL)
prefix = setup_git_directory();
argv += tree_idx;
parse_treeish_arg(argv, &ar.args, prefix);

View File

@ -192,7 +192,8 @@ static int builtin_diff_combined(struct rev_info *revs,
parent = xmalloc(ents * sizeof(*parent));
/* Again, the revs are all reverse */
for (i = 0; i < ents; i++)
hashcpy((unsigned char*)parent + i, ent[ents - 1 - i].item->sha1);
hashcpy((unsigned char *)(parent + i),
ent[ents - 1 - i].item->sha1);
diff_tree_combined(parent[0], parent + 1, ents - 1,
revs->dense_combined_merges, revs);
return 0;

View File

@ -259,13 +259,15 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)
else if (!strcmp(argv[1], "--no-summary"))
merge_summary = 0;
else if (!strcmp(argv[1], "-F") || !strcmp(argv[1], "--file")) {
if (argc < 2)
if (argc < 3)
die ("Which file?");
if (!strcmp(argv[2], "-"))
in = stdin;
else {
fclose(in);
in = fopen(argv[2], "r");
if (!in)
die("cannot open %s", argv[2]);
}
argc--; argv++;
} else

View File

@ -224,6 +224,9 @@ int cmd_log(int argc, const char **argv, const char *prefix)
return cmd_log_walk(&rev);
}
/* format-patch */
#define FORMAT_PATCH_NAME_MAX 64
static int istitlechar(char c)
{
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') ||
@ -264,15 +267,18 @@ static int git_format_config(const char *var, const char *value)
static FILE *realstdout = NULL;
static const char *output_directory = NULL;
static void reopen_stdout(struct commit *commit, int nr, int keep_subject)
static int reopen_stdout(struct commit *commit, int nr, int keep_subject)
{
char filename[1024];
char filename[PATH_MAX];
char *sol;
int len = 0;
int suffix_len = strlen(fmt_patch_suffix) + 10; /* ., NUL and slop */
int suffix_len = strlen(fmt_patch_suffix) + 1;
if (output_directory) {
strlcpy(filename, output_directory, 1000);
if (strlen(output_directory) >=
sizeof(filename) - FORMAT_PATCH_NAME_MAX - suffix_len)
return error("name of output directory is too long");
strlcpy(filename, output_directory, sizeof(filename) - suffix_len);
len = strlen(filename);
if (filename[len - 1] != '/')
filename[len++] = '/';
@ -297,6 +303,7 @@ static void reopen_stdout(struct commit *commit, int nr, int keep_subject)
}
for (j = 0;
j < FORMAT_PATCH_NAME_MAX - suffix_len - 5 &&
len < sizeof(filename) - suffix_len &&
sol[j] && sol[j] != '\n';
j++) {
@ -314,10 +321,16 @@ static void reopen_stdout(struct commit *commit, int nr, int keep_subject)
}
while (filename[len - 1] == '.' || filename[len - 1] == '-')
len--;
filename[len] = 0;
}
if (len + suffix_len >= sizeof(filename))
return error("Patch pathname too long");
strcpy(filename + len, fmt_patch_suffix);
fprintf(realstdout, "%s\n", filename);
freopen(filename, "w", stdout);
if (freopen(filename, "w", stdout) == NULL)
return error("Cannot open patch file %s",filename);
return 0;
}
static int get_patch_id(struct commit *commit, struct diff_options *options,
@ -573,7 +586,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
rev.message_id = message_id;
}
if (!use_stdout)
reopen_stdout(commit, rev.nr, keep_subject);
if (reopen_stdout(commit, rev.nr, keep_subject))
die("Failed to create output files");
shown = log_tree_commit(&rev, commit);
free(commit->buffer);
commit->buffer = NULL;

View File

@ -406,6 +406,11 @@ static int is_rfc2822_header(char *line)
*/
int ch;
char *cp = line;
/* Count mbox From headers as headers */
if (!memcmp(line, "From ", 5) || !memcmp(line, ">From ", 6))
return 1;
while ((ch = *cp++)) {
if (ch == ':')
return cp != line;
@ -417,30 +422,61 @@ static int is_rfc2822_header(char *line)
return 0;
}
/*
* sz is size of 'line' buffer in bytes. Must be reasonably
* long enough to hold one physical real-world e-mail line.
*/
static int read_one_header_line(char *line, int sz, FILE *in)
{
int ofs = 0;
while (ofs < sz) {
int peek, len;
if (fgets(line + ofs, sz - ofs, in) == NULL)
break;
len = eatspace(line + ofs);
if ((len == 0) || !is_rfc2822_header(line)) {
int len;
/*
* We will read at most (sz-1) bytes and then potentially
* re-add NUL after it. Accessing line[sz] after this is safe
* and we can allow len to grow up to and including sz.
*/
sz--;
/* Get the first part of the line. */
if (!fgets(line, sz, in))
return 0;
/*
* Is it an empty line or not a valid rfc2822 header?
* If so, stop here, and return false ("not a header")
*/
len = eatspace(line);
if (!len || !is_rfc2822_header(line)) {
/* Re-add the newline */
line[ofs + len] = '\n';
line[ofs + len + 1] = '\0';
break;
line[len] = '\n';
line[len + 1] = '\0';
return 0;
}
ofs += len;
/* Yuck, 2822 header "folding" */
/*
* Now we need to eat all the continuation lines..
* Yuck, 2822 header "folding"
*/
for (;;) {
int peek, addlen;
static char continuation[1000];
peek = fgetc(in); ungetc(peek, in);
if (peek != ' ' && peek != '\t')
break;
if (!fgets(continuation, sizeof(continuation), in))
break;
addlen = eatspace(continuation);
if (len < sz - 1) {
if (addlen >= sz - len)
addlen = sz - len - 1;
memcpy(line + len, continuation, addlen);
len += addlen;
}
/* Count mbox From headers as headers */
if (!ofs && (!memcmp(line, "From ", 5) || !memcmp(line, ">From ", 6)))
ofs = 1;
return ofs;
}
line[len] = 0;
return 1;
}
static int decode_q_segment(char *in, char *ot, char *ep, int rfc2047)

View File

@ -1551,9 +1551,12 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
int use_internal_rev_list = 0;
int thin = 0;
int i;
const char *rp_av[64];
const char **rp_av;
int rp_ac_alloc = 64;
int rp_ac;
rp_av = xcalloc(rp_ac_alloc, sizeof(*rp_av));
rp_av[0] = "pack-objects";
rp_av[1] = "--objects"; /* --thin will make it --objects-edge */
rp_ac = 2;
@ -1626,8 +1629,11 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
!strcmp("--reflog", arg) ||
!strcmp("--all", arg)) {
use_internal_rev_list = 1;
if (ARRAY_SIZE(rp_av) - 1 <= rp_ac)
die("too many internal rev-list options");
if (rp_ac >= rp_ac_alloc - 1) {
rp_ac_alloc = alloc_nr(rp_ac_alloc);
rp_av = xrealloc(rp_av,
rp_ac_alloc * sizeof(*rp_av));
}
rp_av[rp_ac++] = arg;
continue;
}

View File

@ -154,13 +154,17 @@ static int find_conflict(struct path_list *conflict)
return error("Could not read index");
for (i = 0; i + 2 < active_nr; i++) {
struct cache_entry *e1 = active_cache[i];
struct cache_entry *e2 = active_cache[i + 1];
struct cache_entry *e3 = active_cache[i + 2];
if (ce_stage(e1) == 1 && ce_stage(e2) == 2 &&
ce_stage(e3) == 3 && ce_same_name(e1, e2) &&
ce_same_name(e1, e3)) {
struct cache_entry *e2 = active_cache[i+1];
struct cache_entry *e3 = active_cache[i+2];
if (ce_stage(e1) == 1 &&
ce_stage(e2) == 2 &&
ce_stage(e3) == 3 &&
ce_same_name(e1, e2) && ce_same_name(e1, e3) &&
S_ISREG(ntohl(e1->ce_mode)) &&
S_ISREG(ntohl(e2->ce_mode)) &&
S_ISREG(ntohl(e3->ce_mode))) {
path_list_insert((const char *)e1->name, conflict);
i += 3;
i += 2;
}
}
return 0;

View File

@ -221,9 +221,11 @@ int cmd_show_ref(int argc, const char **argv, const char *prefix)
}
if (verify) {
if (!pattern)
die("--verify requires a reference");
while (*pattern) {
unsigned char sha1[20];
while (*pattern) {
if (!strncmp(*pattern, "refs/", 5) &&
resolve_ref(*pattern, sha1, 1, NULL)) {
if (!quiet)

View File

@ -678,11 +678,27 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
else {
/* Used by diff-tree to read from the working tree */
struct stat st;
int fd;
if (0 <= (fd = open(elem->path, O_RDONLY)) &&
int fd = -1;
if (lstat(elem->path, &st) < 0)
goto deleted_file;
if (S_ISLNK(st.st_mode)) {
size_t len = st.st_size;
result_size = len;
result = xmalloc(len + 1);
if (result_size != readlink(elem->path, result, len)) {
error("readlink(%s): %s", elem->path,
strerror(errno));
return;
}
result[len] = 0;
elem->mode = canon_mode(st.st_mode);
}
else if (0 <= (fd = open(elem->path, O_RDONLY)) &&
!fstat(fd, &st)) {
int len = st.st_size;
int sz = 0;
size_t len = st.st_size;
size_t sz = 0;
elem->mode = canon_mode(st.st_mode);
result_size = len;
@ -698,11 +714,12 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
result[len] = 0;
}
else {
/* deleted file */
deleted_file:
result_size = 0;
elem->mode = 0;
result = xcalloc(1, 1);
}
if (0 <= fd)
close(fd);
}

View File

@ -644,6 +644,7 @@ static char *get_header(const struct commit *commit, const char *key)
static char *replace_encoding_header(char *buf, char *encoding)
{
char *encoding_header = strstr(buf, "\nencoding ");
char *header_end = strstr(buf, "\n\n");
char *end_of_encoding_header;
int encoding_header_pos;
int encoding_header_len;
@ -651,8 +652,10 @@ static char *replace_encoding_header(char *buf, char *encoding)
int need_len;
int buflen = strlen(buf) + 1;
if (!encoding_header)
return buf; /* should not happen but be defensive */
if (!header_end)
header_end = buf + buflen;
if (!encoding_header || encoding_header >= header_end)
return buf;
encoding_header++;
end_of_encoding_header = strchr(encoding_header, '\n');
if (!end_of_encoding_header)

10
compat/strtoumax.c Normal file
View File

@ -0,0 +1,10 @@
#include "../git-compat-util.h"
uintmax_t gitstrtoumax (const char *nptr, char **endptr, int base)
{
#if defined(NO_STRTOULL)
return strtoul(nptr, endptr, base);
#else
return strtoull(nptr, endptr, base);
#endif
}

View File

@ -41,7 +41,7 @@ $fileview->set_rules_hint(1);
$fileview->signal_connect (row_activated => sub {
my ($sl, $path, $column) = @_;
my $row_ref = $sl->get_row_data_from_path ($path);
system("blameview @$row_ref[0] $fn &");
system("blameview @$row_ref[0]~1 $fn &");
});
my $commitwindow = Gtk2::ScrolledWindow->new();

View File

@ -75,10 +75,11 @@ then to `add-log-mailing-address' and then to `user-mail-address'."
:type '(choice (const :tag "Default" nil)
(string :tag "Email")))
(defcustom git-commits-coding-system 'utf-8
(defcustom git-commits-coding-system nil
"Default coding system for the log message of git commits."
:group 'git
:type 'coding-system)
:type '(choice (const :tag "From repository config" nil)
(coding-system)))
(defcustom git-append-signed-off-by nil
"Whether to append a Signed-off-by line to the commit message before editing."
@ -236,6 +237,15 @@ and returns the process output as a string."
(and (fboundp 'user-mail-address) (user-mail-address))
(and (boundp 'user-mail-address) user-mail-address)))
(defun git-get-commits-coding-system ()
"Return the coding system to use for commits."
(let ((repo-config (git-config "i18n.commitencoding")))
(or git-commits-coding-system
(and repo-config
(fboundp 'locale-charset-to-coding-system)
(locale-charset-to-coding-system repo-config))
'utf-8)))
(defun git-escape-file-name (name)
"Escape a file name if necessary."
(if (string-match "[\n\t\"\\]" name)
@ -327,7 +337,7 @@ and returns the process output as a string."
"Call git-commit-tree with buffer as input and return the resulting commit SHA1."
(let ((author-name (git-get-committer-name))
(author-email (git-get-committer-email))
author-date log-start log-end args)
author-date log-start log-end args coding-system-for-write)
(when head
(push "-p" args)
(push head args))
@ -350,12 +360,12 @@ and returns the process output as a string."
(push "-p" args)
(push (match-string 1) args))))
(setq log-start (point-min)))
(setq log-end (point-max)))
(setq log-end (point-max))
(setq coding-system-for-write buffer-file-coding-system))
(git-get-string-sha1
(with-output-to-string
(with-current-buffer standard-output
(let ((coding-system-for-write git-commits-coding-system)
(env `(("GIT_AUTHOR_NAME" . ,author-name)
(let ((env `(("GIT_AUTHOR_NAME" . ,author-name)
("GIT_AUTHOR_EMAIL" . ,author-email)
("GIT_COMMITTER_NAME" . ,(git-get-committer-name))
("GIT_COMMITTER_EMAIL" . ,(git-get-committer-email)))))
@ -881,22 +891,35 @@ and returns the process output as a string."
(with-current-buffer log-edit-parent-buffer
(git-get-filenames (git-marked-files-state 'added 'deleted 'modified))))
(defun git-commit-file ()
"Commit the marked file(s), asking for a commit message."
(interactive)
(defun git-append-sign-off (name email)
"Append a Signed-off-by entry to the current buffer, avoiding duplicates."
(let ((sign-off (format "Signed-off-by: %s <%s>" name email))
(case-fold-search t))
(goto-char (point-min))
(unless (re-search-forward (concat "^" (regexp-quote sign-off)) nil t)
(goto-char (point-min))
(unless (re-search-forward "^Signed-off-by: " nil t)
(setq sign-off (concat "\n" sign-off)))
(goto-char (point-max))
(insert sign-off "\n"))))
(defun git-setup-log-buffer (buffer &optional author-name author-email subject date msg)
"Setup the log buffer for a commit."
(unless git-status (error "Not in git-status buffer."))
(let ((buffer (get-buffer-create "*git-commit*"))
(merge-heads (git-get-merge-heads))
(let ((merge-heads (git-get-merge-heads))
(dir default-directory)
(committer-name (git-get-committer-name))
(committer-email (git-get-committer-email))
(sign-off git-append-signed-off-by))
(with-current-buffer buffer
(when (eq 0 (buffer-size))
(cd dir)
(erase-buffer)
(insert
(propertize
(format "Author: %s <%s>\n%s"
(git-get-committer-name) (git-get-committer-email)
(format "Author: %s <%s>\n%s%s"
(or author-name committer-name)
(or author-email committer-email)
(if date (format "Date: %s\n" date) "")
(if merge-heads
(format "Parent: %s\n%s\n"
(git-rev-parse "HEAD")
@ -905,13 +928,43 @@ and returns the process output as a string."
'face 'git-header-face)
(propertize git-log-msg-separator 'face 'git-separator-face)
"\n")
(cond ((file-readable-p ".git/MERGE_MSG")
(insert-file-contents ".git/MERGE_MSG"))
(sign-off
(insert (format "\n\nSigned-off-by: %s <%s>\n"
(git-get-committer-name) (git-get-committer-email)))))))
(when subject (insert subject "\n\n"))
(cond (msg (insert msg "\n"))
((file-readable-p ".dotest/msg")
(insert-file-contents ".dotest/msg"))
((file-readable-p ".git/MERGE_MSG")
(insert-file-contents ".git/MERGE_MSG")))
; delete empty lines at end
(goto-char (point-min))
(when (re-search-forward "\n+\\'" nil t)
(replace-match "\n" t t))
(when sign-off (git-append-sign-off committer-name committer-email)))))
(defun git-commit-file ()
"Commit the marked file(s), asking for a commit message."
(interactive)
(unless git-status (error "Not in git-status buffer."))
(let ((buffer (get-buffer-create "*git-commit*"))
(coding-system (git-get-commits-coding-system))
author-name author-email subject date)
(when (eq 0 (buffer-size buffer))
(when (file-readable-p ".dotest/info")
(with-temp-buffer
(insert-file-contents ".dotest/info")
(goto-char (point-min))
(when (re-search-forward "^Author: \\(.*\\)\nEmail: \\(.*\\)$" nil t)
(setq author-name (match-string 1))
(setq author-email (match-string 2)))
(goto-char (point-min))
(when (re-search-forward "^Subject: \\(.*\\)$" nil t)
(setq subject (match-string 1)))
(goto-char (point-min))
(when (re-search-forward "^Date: \\(.*\\)$" nil t)
(setq date (match-string 1)))))
(git-setup-log-buffer buffer author-name author-email subject date))
(log-edit #'git-do-commit nil #'git-log-edit-files buffer)
(setq font-lock-keywords (font-lock-compile-keywords git-log-edit-font-lock-keywords))
(setq buffer-file-coding-system coding-system)
(re-search-forward (regexp-quote (concat git-log-msg-separator "\n")) nil t)))
(defun git-find-file ()

View File

@ -25,11 +25,14 @@ foreach my $tar_file (@ARGV)
my $tar_name = $1;
if ($tar_name =~ s/\.(tar\.gz|tgz)$//) {
open(I, '-|', 'gzcat', $tar_file) or die "Unable to gzcat $tar_file: $!\n";
open(I, '-|', 'gunzip', '-c', $tar_file)
or die "Unable to gunzip -c $tar_file: $!\n";
} elsif ($tar_name =~ s/\.(tar\.bz2|tbz2)$//) {
open(I, '-|', 'bzcat', $tar_file) or die "Unable to bzcat $tar_file: $!\n";
open(I, '-|', 'bunzip2', '-c', $tar_file)
or die "Unable to bunzip2 -c $tar_file: $!\n";
} elsif ($tar_name =~ s/\.tar\.Z$//) {
open(I, '-|', 'zcat', $tar_file) or die "Unable to zcat $tar_file: $!\n";
open(I, '-|', 'uncompress', '-c', $tar_file)
or die "Unable to uncompress -c $tar_file: $!\n";
} elsif ($tar_name =~ s/\.tar$//) {
open(I, $tar_file) or die "Unable to open $tar_file: $!\n";
} else {

View File

@ -41,18 +41,28 @@ int run_diff_files(struct rev_info *revs, int silent_on_removed)
path_len = ce_namelen(ce);
dpath = xmalloc (combine_diff_path_size (5, path_len));
dpath = xmalloc(combine_diff_path_size(5, path_len));
dpath->path = (char *) &(dpath->parent[5]);
dpath->next = NULL;
dpath->len = path_len;
memcpy(dpath->path, ce->name, path_len);
dpath->path[path_len] = '\0';
dpath->mode = 0;
hashclr(dpath->sha1);
memset(&(dpath->parent[0]), 0,
sizeof(struct combine_diff_parent)*5);
if (lstat(ce->name, &st) < 0) {
if (errno != ENOENT && errno != ENOTDIR) {
perror(ce->name);
continue;
}
if (silent_on_removed)
continue;
}
else
dpath->mode = canon_mode(st.st_mode);
while (i < entries) {
struct cache_entry *nce = active_cache[i];
int stage;

6
diff.c
View File

@ -211,6 +211,8 @@ static void emit_rewrite_diff(const char *name_a,
diff_populate_filespec(two, 0);
lc_a = count_lines(one->data, one->size);
lc_b = count_lines(two->data, two->size);
name_a += (*name_a == '/');
name_b += (*name_b == '/');
printf("--- a/%s\n+++ b/%s\n@@ -", name_a, name_b);
print_line_count(lc_a);
printf(" +");
@ -1020,8 +1022,8 @@ static void builtin_diff(const char *name_a,
const char *set = diff_get_color(o->color_diff, DIFF_METAINFO);
const char *reset = diff_get_color(o->color_diff, DIFF_RESET);
a_one = quote_two("a/", name_a);
b_two = quote_two("b/", name_b);
a_one = quote_two("a/", name_a + (*name_a == '/'));
b_two = quote_two("b/", name_b + (*name_b == '/'));
lbl[0] = DIFF_FILE_VALID(one) ? a_one : "/dev/null";
lbl[1] = DIFF_FILE_VALID(two) ? b_two : "/dev/null";
printf("%sdiff --git %s %s%s\n", set, a_one, b_two, reset);

View File

@ -133,6 +133,10 @@ Format of STDIN stream:
#define PACK_ID_BITS 16
#define MAX_PACK_ID ((1<<PACK_ID_BITS)-1)
#ifndef PRIuMAX
#define PRIuMAX "llu"
#endif
struct object_entry
{
struct object_entry *next;
@ -216,7 +220,8 @@ struct branch
const char *name;
struct tree_entry branch_tree;
uintmax_t last_commit;
unsigned int pack_id;
unsigned active : 1;
unsigned pack_id : PACK_ID_BITS;
unsigned char sha1[20];
};
@ -475,7 +480,7 @@ static struct object_entry *find_mark(uintmax_t idnum)
oe = s->data.marked[idnum];
}
if (!oe)
die("mark :%ju not declared", orig_idnum);
die("mark :%" PRIuMAX " not declared", orig_idnum);
return oe;
}
@ -524,6 +529,7 @@ static struct branch *new_branch(const char *name)
b->table_next_branch = branch_table[hc];
b->branch_tree.versions[0].mode = S_IFDIR;
b->branch_tree.versions[1].mode = S_IFDIR;
b->active = 0;
b->pack_id = MAX_PACK_ID;
branch_table[hc] = b;
branch_count++;
@ -1056,7 +1062,7 @@ static void load_tree(struct tree_entry *root)
struct tree_entry *e = new_tree_entry();
if (t->entry_count == t->entry_capacity)
root->tree = t = grow_tree_content(t, 8);
root->tree = t = grow_tree_content(t, t->entry_count);
t->entries[t->entry_count++] = e;
e->tree = NULL;
@ -1223,7 +1229,7 @@ static int tree_content_set(
}
if (t->entry_count == t->entry_capacity)
root->tree = t = grow_tree_content(t, 8);
root->tree = t = grow_tree_content(t, t->entry_count);
e = new_tree_entry();
e->name = to_atom(p, (unsigned short)n);
e->versions[0].mode = 0;
@ -1361,7 +1367,7 @@ static void dump_marks_helper(FILE *f,
} else {
for (k = 0; k < 1024; k++) {
if (m->data.marked[k])
fprintf(f, ":%ju %s\n", base + k,
fprintf(f, ":%" PRIuMAX " %s\n", base + k,
sha1_to_hex(m->data.marked[k]->sha1));
}
}
@ -1543,6 +1549,7 @@ static void unload_one_branch(void)
e = active_branches;
active_branches = e->active_next_branch;
}
e->active = 0;
e->active_next_branch = NULL;
if (e->branch_tree.tree) {
release_tree_content_recursive(e->branch_tree.tree);
@ -1555,10 +1562,13 @@ static void unload_one_branch(void)
static void load_branch(struct branch *b)
{
load_tree(&b->branch_tree);
if (!b->active) {
b->active = 1;
b->active_next_branch = active_branches;
active_branches = b;
cur_active_branches++;
branch_load_count++;
}
}
static void file_change_m(struct branch *b)
@ -1687,7 +1697,7 @@ static void cmd_from(struct branch *b)
unsigned long size;
char *buf;
if (oe->type != OBJ_COMMIT)
die("Mark :%ju not a commit", idnum);
die("Mark :%" PRIuMAX " not a commit", idnum);
hashcpy(b->sha1, oe->sha1);
buf = gfi_unpack_entry(oe, &size);
if (!buf || size < 46)
@ -1740,9 +1750,16 @@ static struct hash_list *cmd_merge(unsigned int *count)
uintmax_t idnum = strtoumax(from + 1, NULL, 10);
struct object_entry *oe = find_mark(idnum);
if (oe->type != OBJ_COMMIT)
die("Mark :%ju not a commit", idnum);
die("Mark :%" PRIuMAX " not a commit", idnum);
hashcpy(n->sha1, oe->sha1);
} else if (get_sha1(from, n->sha1))
} else if (!get_sha1(from, n->sha1)) {
unsigned long size;
char *buf = read_object_with_reference(n->sha1,
type_names[OBJ_COMMIT], &size, n->sha1);
if (!buf || size < 46)
die("Not a valid commit: %s", from);
free(buf);
} else
die("Invalid ref name or SHA1 expression: %s", from);
n->next = NULL;
@ -1884,7 +1901,7 @@ static void cmd_new_tag(void)
from_mark = strtoumax(from + 1, NULL, 10);
oe = find_mark(from_mark);
if (oe->type != OBJ_COMMIT)
die("Mark :%ju not a commit", from_mark);
die("Mark :%" PRIuMAX " not a commit", from_mark);
hashcpy(sha1, oe->sha1);
} else if (!get_sha1(from, sha1)) {
unsigned long size;
@ -2059,18 +2076,18 @@ int main(int argc, const char **argv)
fprintf(stderr, "%s statistics:\n", argv[0]);
fprintf(stderr, "---------------------------------------------------------------------\n");
fprintf(stderr, "Alloc'd objects: %10ju\n", alloc_count);
fprintf(stderr, "Total objects: %10ju (%10ju duplicates )\n", total_count, duplicate_count);
fprintf(stderr, " blobs : %10ju (%10ju duplicates %10ju deltas)\n", object_count_by_type[OBJ_BLOB], duplicate_count_by_type[OBJ_BLOB], delta_count_by_type[OBJ_BLOB]);
fprintf(stderr, " trees : %10ju (%10ju duplicates %10ju deltas)\n", object_count_by_type[OBJ_TREE], duplicate_count_by_type[OBJ_TREE], delta_count_by_type[OBJ_TREE]);
fprintf(stderr, " commits: %10ju (%10ju duplicates %10ju deltas)\n", object_count_by_type[OBJ_COMMIT], duplicate_count_by_type[OBJ_COMMIT], delta_count_by_type[OBJ_COMMIT]);
fprintf(stderr, " tags : %10ju (%10ju duplicates %10ju deltas)\n", object_count_by_type[OBJ_TAG], duplicate_count_by_type[OBJ_TAG], delta_count_by_type[OBJ_TAG]);
fprintf(stderr, "Alloc'd objects: %10" PRIuMAX "\n", alloc_count);
fprintf(stderr, "Total objects: %10" PRIuMAX " (%10" PRIuMAX " duplicates )\n", total_count, duplicate_count);
fprintf(stderr, " blobs : %10" PRIuMAX " (%10" PRIuMAX " duplicates %10" PRIuMAX " deltas)\n", object_count_by_type[OBJ_BLOB], duplicate_count_by_type[OBJ_BLOB], delta_count_by_type[OBJ_BLOB]);
fprintf(stderr, " trees : %10" PRIuMAX " (%10" PRIuMAX " duplicates %10" PRIuMAX " deltas)\n", object_count_by_type[OBJ_TREE], duplicate_count_by_type[OBJ_TREE], delta_count_by_type[OBJ_TREE]);
fprintf(stderr, " commits: %10" PRIuMAX " (%10" PRIuMAX " duplicates %10" PRIuMAX " deltas)\n", object_count_by_type[OBJ_COMMIT], duplicate_count_by_type[OBJ_COMMIT], delta_count_by_type[OBJ_COMMIT]);
fprintf(stderr, " tags : %10" PRIuMAX " (%10" PRIuMAX " duplicates %10" PRIuMAX " deltas)\n", object_count_by_type[OBJ_TAG], duplicate_count_by_type[OBJ_TAG], delta_count_by_type[OBJ_TAG]);
fprintf(stderr, "Total branches: %10lu (%10lu loads )\n", branch_count, branch_load_count);
fprintf(stderr, " marks: %10ju (%10ju unique )\n", (((uintmax_t)1) << marks->shift) * 1024, marks_set_count);
fprintf(stderr, " marks: %10" PRIuMAX " (%10" PRIuMAX " unique )\n", (((uintmax_t)1) << marks->shift) * 1024, marks_set_count);
fprintf(stderr, " atoms: %10u\n", atom_cnt);
fprintf(stderr, "Memory total: %10ju KiB\n", (total_allocd + alloc_count*sizeof(struct object_entry))/1024);
fprintf(stderr, "Memory total: %10" PRIuMAX " KiB\n", (total_allocd + alloc_count*sizeof(struct object_entry))/1024);
fprintf(stderr, " pools: %10lu KiB\n", (unsigned long)(total_allocd/1024));
fprintf(stderr, " objects: %10ju KiB\n", (alloc_count*sizeof(struct object_entry))/1024);
fprintf(stderr, " objects: %10" PRIuMAX " KiB\n", (alloc_count*sizeof(struct object_entry))/1024);
fprintf(stderr, "---------------------------------------------------------------------\n");
pack_report();
fprintf(stderr, "---------------------------------------------------------------------\n");

View File

@ -66,7 +66,7 @@ fall_back_3way () {
git-update-index -z --index-info <"$dotest/patch-merge-index-info" &&
GIT_INDEX_FILE="$dotest/patch-merge-tmp-index" \
git-write-tree >"$dotest/patch-merge-base+" ||
cannot_fallback "Patch does not record usable index information."
cannot_fallback "Repository lacks necessary blobs to fall back on 3-way merge."
echo Using index info to reconstruct a base tree...
if GIT_INDEX_FILE="$dotest/patch-merge-tmp-index" \

View File

@ -553,7 +553,7 @@ foreach my $ps (@psets) {
my $pid = open2(*READER, *WRITER,'git-commit-tree',$tree,@par)
or die $!;
print WRITER $ps->{summary},"\n";
print WRITER $ps->{summary},"\n\n";
print WRITER $ps->{message},"\n";
# make it easy to backtrack and figure out which Arch revision this was:
@ -755,7 +755,8 @@ sub parselog {
$ps->{tag} = $1;
$key = undef;
} elsif (/^Summary:\s*(.*)$/ ) {
# summary can be multiline as long as it has a leading space
# summary can be multiline as long as it has a leading space.
# we squeeze it onto a single line, though.
$ps->{summary} = [ $1 ];
$key = 'summary';
} elsif (/^Creator: (.*)\s*<([^\>]+)>/) {
@ -787,8 +788,18 @@ sub parselog {
}
}
# post-processing:
$ps->{summary} = join("\n",@{$ps->{summary}})."\n";
# drop leading empty lines from the log message
while (@$log && $log->[0] eq '') {
shift @$log;
}
if (exists $ps->{summary} && @{$ps->{summary}}) {
$ps->{summary} = join(' ', @{$ps->{summary}});
}
elsif (@$log == 0) {
$ps->{summary} = 'empty commit message';
} else {
$ps->{summary} = $log->[0] . '...';
}
$ps->{message} = join("\n",@$log);
# skip Arch control files, unescape pika-escaped files

View File

@ -196,7 +196,7 @@ else
work=`git write-tree` &&
git read-tree --reset -u $new || exit
eval GITHEAD_$new=${new_name:-${branch:-$new}} &&
eval GITHEAD_$new='${new_name:-${branch:-$new}}' &&
eval GITHEAD_$work=local &&
export GITHEAD_$new GITHEAD_$work &&
git merge-recursive $old -- $new $work

View File

@ -318,6 +318,10 @@ esac
case "$all,$also" in
t,)
if test ! -f "$THIS_INDEX"
then
die 'nothing to commit (use "git add file1 file2" to include for commit)'
fi
save_index &&
(
cd_to_toplevel &&
@ -356,7 +360,7 @@ t,)
if test -z "$initial_commit"
then
cp "$THIS_INDEX" "$TMP_INDEX"
GIT_INDEX_FILE="$TMP_INDEX" git-read-tree -m HEAD
GIT_INDEX_FILE="$TMP_INDEX" git-read-tree -i -m HEAD
else
rm -f "$TMP_INDEX"
fi || exit
@ -617,6 +621,9 @@ else
fi
ret="$?"
rm -f "$GIT_DIR/COMMIT_MSG" "$GIT_DIR/COMMIT_EDITMSG" "$GIT_DIR/SQUASH_MSG"
cd_to_toplevel
if test -d "$GIT_DIR/rr-cache"
then
git-rerere

View File

@ -47,9 +47,15 @@
#include <netdb.h>
#include <pwd.h>
#include <inttypes.h>
#if defined(__CYGWIN__)
#undef _XOPEN_SOURCE
#include <grp.h>
#define _XOPEN_SOURCE 600
#else
#undef _ALL_SOURCE /* AIX 5.3L defines a struct list with _ALL_SOURCE. */
#include <grp.h>
#define _ALL_SOURCE 1
#endif
#ifndef NO_ICONV
#include <iconv.h>
@ -139,6 +145,11 @@ extern char *gitstrcasestr(const char *haystack, const char *needle);
extern size_t gitstrlcpy(char *, const char *, size_t);
#endif
#ifdef NO_STRTOUMAX
#define strtoumax gitstrtoumax
extern uintmax_t gitstrtoumax(const char *, char **, int);
#endif
extern void release_pack_memory(size_t);
static inline char* xstrdup(const char *str)

View File

@ -241,13 +241,14 @@ if ($opt_c) {
die "Exiting: The commit did not succeed";
}
print "Committed successfully to CVS\n";
# clean up
unlink(".msg");
} else {
print "Ready for you to commit, just run:\n\n $cmd\n";
}
# clean up
unlink(".cvsexportcommit.diff");
unlink(".msg");
sub usage {
print STDERR <<END;

View File

@ -4,7 +4,7 @@
#
# Cleanup unreachable files and optimize the repository.
USAGE='git-gc [--prune]'
USAGE='[--prune]'
SUBDIRECTORY_OK=Yes
. git-sh-setup

View File

@ -20,6 +20,11 @@ tree_search ()
done
}
# Always use the tarball version file if found, just
# in case we are somehow contained in a larger git
# repository that doesn't actually track our state.
# (At least one package manager is doing this.)
#
# We may be a subproject, so try looking for the merge
# commit that supplied this directory content if we are
# not at the toplevel. We probably will always be the
@ -27,10 +32,13 @@ tree_search ()
# that fact.
#
# If we are at the toplevel or the merge assumption fails
# try looking for a gitgui-* tag, or fallback onto the
# distributed version file.
# try looking for a gitgui-* tag.
if prefix="$(git rev-parse --show-prefix 2>/dev/null)"
if test -f version &&
VN=$(cat version)
then
: happy
elif prefix="$(git rev-parse --show-prefix 2>/dev/null)"
test -n "$prefix" &&
head=$(git rev-list --max-count=1 HEAD -- . 2>/dev/null) &&
tree=$(git rev-parse --verify "HEAD:$prefix" 2>/dev/null) &&
@ -48,9 +56,6 @@ elif VN=$(git describe --abbrev=4 HEAD 2>/dev/null) &&
esac
then
VN=$(echo "$VN" | sed -e 's/^gitgui-//;s/-/./g');
elif test -f version
then
VN=$(cat version) || VN="$DEF_VER"
else
VN="$DEF_VER"
fi

View File

@ -1,5 +1,8 @@
all::
# Define V=1 to have a more verbose compile.
#
GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
@$(SHELL_PATH) ./GIT-VERSION-GEN
-include GIT-VERSION-FILE
@ -20,20 +23,25 @@ ifndef INSTALL
INSTALL = install
endif
ifndef V
QUIET_GEN = @echo ' ' GEN $@;
QUIET_BUILT_IN = @echo ' ' BUILTIN $@;
endif
DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
$(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
rm -f $@ $@+
$(QUIET_GEN)rm -f $@ $@+ && \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's/@@GITGUI_VERSION@@/$(GITGUI_VERSION)/g' \
$@.sh >$@+
chmod +x $@+
$@.sh >$@+ && \
chmod +x $@+ && \
mv $@+ $@
$(GITGUI_BUILT_INS): git-gui
rm -f $@ && ln git-gui $@
$(QUIET_BUILT_IN)rm -f $@ && ln git-gui $@
# These can record GITGUI_VERSION
$(patsubst %.sh,%,$(SCRIPT_SH)): GIT-VERSION-FILE

View File

@ -1,44 +0,0 @@
Items outstanding:
* Add file to .gitignore or info/excludes.
* Populate the pull menu with local branches.
* Make use of the new default merge data stored in repo-config.
* Checkout a different local branch.
* Push any local branch to a remote branch.
* Merge any local branches through a real merge UI.
* Allow user to define keyboard shortcuts for frequently used fetch
or merge operations. Or maybe just define a keyboard shortcut
for default fetch/default merge of current branch is enough;
but I do know a few users who merge a couple of common branches
also into the same branch so one default isn't quite enough.
* Better organize fetch/push/pull console windows.
* Clone UI (to download a new repository).
* Remotes editor (for .git/config format only).
* Show a shortlog of the last couple of commits in the main window,
to give the user warm fuzzy feelings that we have their data
saved. Actually this may be the set of commits not yet in
the upstream (aka default merge branch remote repository).
* GUI configuration editor for options listed in
git.git/Documentation/config.txt. Ideally this would
parse that file and generate the options dialog from
the documentation itself, and include the help text
from the documentation as part of the UI somehow.
Known bugs:
* git-gui sometimes just closes on Windows with no error message.
I'm not sure what the problem is here. I suspect the wish
process is just terminating due to a segfault or something,
as the do_quit proc in git-gui doesn't run. It often seems to
occur while writing a commit message in the buffer. Odd.

View File

@ -4,7 +4,7 @@ exec wish "$0" -- "$@"
set appvers {@@GITGUI_VERSION@@}
set copyright {
Copyright <20> 2006, 2007 Shawn Pearce, Paul Mackerras.
Copyright <20> 2006, 2007 Shawn Pearce, et. al.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -46,7 +46,7 @@ proc gitdir {args} {
proc gitexec {args} {
global _gitexec
if {$_gitexec eq {}} {
if {[catch {set _gitexec [exec git --exec-path]} err]} {
if {[catch {set _gitexec [git --exec-path]} err]} {
error "Git not installed?\n\n$err"
}
}
@ -202,14 +202,14 @@ proc save_config {} {
set value $global_config_new($name)
if {$value ne $global_config($name)} {
if {$value eq $default_config($name)} {
catch {exec git config --global --unset $name}
catch {git config --global --unset $name}
} else {
regsub -all "\[{}\]" $value {"} value
exec git config --global $name $value
git config --global $name $value
}
set global_config($name) $value
if {$value eq $repo_config($name)} {
catch {exec git config --unset $name}
catch {git config --unset $name}
set repo_config($name) $value
}
}
@ -219,16 +219,24 @@ proc save_config {} {
set value $repo_config_new($name)
if {$value ne $repo_config($name)} {
if {$value eq $global_config($name)} {
catch {exec git config --unset $name}
catch {git config --unset $name}
} else {
regsub -all "\[{}\]" $value {"} value
exec git config $name $value
git config $name $value
}
set repo_config($name) $value
}
}
}
######################################################################
##
## handy utils
proc git {args} {
return [eval exec git $args]
}
proc error_popup {msg} {
set title [appname]
if {[reponame] ne {}} {
@ -287,12 +295,49 @@ proc ask_popup {msg} {
-message $msg]
}
######################################################################
##
## version check
if {{--version} eq $argv || {version} eq $argv} {
puts "git-gui version $appvers"
exit
}
set req_maj 1
set req_min 5
if {[catch {set v [git --version]} err]} {
catch {wm withdraw .}
error_popup "Cannot determine Git version:
$err
[appname] requires Git $req_maj.$req_min or later."
exit 1
}
if {[regexp {^git version (\d+)\.(\d+)} $v _junk act_maj act_min]} {
if {$act_maj < $req_maj
|| ($act_maj == $req_maj && $act_min < $req_min)} {
catch {wm withdraw .}
error_popup "[appname] requires Git $req_maj.$req_min or later.
You are using $v."
exit 1
}
} else {
catch {wm withdraw .}
error_popup "Cannot parse Git version string:\n\n$v"
exit 1
}
unset -nocomplain v _junk act_maj act_min req_maj req_min
######################################################################
##
## repository setup
if { [catch {set _gitdir $env(GIT_DIR)}]
&& [catch {set _gitdir [exec git rev-parse --git-dir]} err]} {
&& [catch {set _gitdir [git rev-parse --git-dir]} err]} {
catch {wm withdraw .}
error_popup "Cannot find the git directory:\n\n$err"
exit 1
@ -319,6 +364,24 @@ set _reponame [lindex [file split \
[file normalize [file dirname $_gitdir]]] \
end]
######################################################################
##
## global init
set current_diff_path {}
set current_diff_side {}
set diff_actions [list]
set ui_status_value {Initializing...}
set HEAD {}
set PARENT {}
set MERGE_HEAD [list]
set commit_type {}
set empty_tree {}
set current_branch {}
set current_diff_path {}
set selected_commit_type new
######################################################################
##
## task management
@ -365,7 +428,7 @@ proc repository_state {ctvar hdvar mhvar} {
set mh [list]
if {[catch {set current_branch [exec git symbolic-ref HEAD]}]} {
if {[catch {set current_branch [git symbolic-ref HEAD]}]} {
set current_branch {}
} else {
regsub ^refs/((heads|tags|remotes)/)? \
@ -374,7 +437,7 @@ proc repository_state {ctvar hdvar mhvar} {
current_branch
}
if {[catch {set hd [exec git rev-parse --verify HEAD]}]} {
if {[catch {set hd [git rev-parse --verify HEAD]}]} {
set hd {}
set ct initial
return
@ -402,7 +465,7 @@ proc PARENT {} {
return $p
}
if {$empty_tree eq {}} {
set empty_tree [exec git mktree << {}]
set empty_tree [git mktree << {}]
}
return $empty_tree
}
@ -642,8 +705,9 @@ proc reshow_diff {} {
global current_diff_path current_diff_side
set p $current_diff_path
if {$p eq {}
|| $current_diff_side eq {}
if {$p eq {}} {
# No diff is being shown.
} elseif {$current_diff_side eq {}
|| [catch {set s $file_states($p)}]
|| [lsearch -sorted -exact $file_lists($current_diff_side) $p] == -1} {
clear_diff
@ -1042,7 +1106,7 @@ proc committer_ident {} {
global GIT_COMMITTER_IDENT
if {$GIT_COMMITTER_IDENT eq {}} {
if {[catch {set me [exec git var GIT_COMMITTER_IDENT]} err]} {
if {[catch {set me [git var GIT_COMMITTER_IDENT]} err]} {
error_popup "Unable to obtain your identity:\n\n$err"
return {}
}
@ -1109,7 +1173,7 @@ File [short_path $path] cannot be committed by this program.
}
}
}
if {!$files_ready} {
if {!$files_ready && ![string match *merge $curType]} {
info_popup {No changes to commit.
You must add at least 1 file before you can commit.
@ -1205,6 +1269,24 @@ proc commit_committree {fd_wt curHEAD msg} {
return
}
# -- Verify this wasn't an empty change.
#
if {$commit_type eq {normal}} {
set old_tree [git rev-parse "$PARENT^{tree}"]
if {$tree_id eq $old_tree} {
info_popup {No changes to commit.
No files were modified by this commit and it
was not a merge commit.
A rescan will be automatically started now.
}
unlock_index
rescan {set ui_status_value {No changes to commit.}}
return
}
}
# -- Build the message.
#
set msg_p [gitdir COMMIT_EDITMSG]
@ -1219,15 +1301,9 @@ proc commit_committree {fd_wt curHEAD msg} {
# -- Create the commit.
#
set cmd [list git commit-tree $tree_id]
set parents [concat $PARENT $MERGE_HEAD]
if {[llength $parents] > 0} {
foreach p $parents {
foreach p [concat $PARENT $MERGE_HEAD] {
lappend cmd -p $p
}
} else {
# git commit-tree writes to stderr during initial commit.
lappend cmd 2>/dev/null
}
lappend cmd <$msg_p
if {[catch {set cmt_id [eval exec $cmd]} err]} {
error_popup "commit-tree failed:\n\n$err"
@ -1256,14 +1332,6 @@ proc commit_committree {fd_wt curHEAD msg} {
return
}
# -- Make sure our current branch exists.
#
if {$commit_type eq {initial}} {
lappend all_heads $current_branch
set all_heads [lsort -unique $all_heads]
populate_branch_menu
}
# -- Cleanup after ourselves.
#
catch {file delete $msg_p}
@ -1275,7 +1343,7 @@ proc commit_committree {fd_wt curHEAD msg} {
# -- Let rerere do its thing.
#
if {[file isdirectory [gitdir rr-cache]]} {
catch {exec git rerere}
catch {git rerere}
}
# -- Run the post-commit hook.
@ -1299,6 +1367,14 @@ proc commit_committree {fd_wt curHEAD msg} {
if {[is_enabled singlecommit]} do_quit
# -- Make sure our current branch exists.
#
if {$commit_type eq {initial}} {
lappend all_heads $current_branch
set all_heads [lsort -unique $all_heads]
populate_branch_menu
}
# -- Update in memory status
#
set selected_commit_type new
@ -1876,11 +1952,24 @@ proc all_tracking_branches {} {
return [lsort -unique $all_trackings]
}
proc load_all_tags {} {
set all_tags [list]
set fd [open "| git for-each-ref --format=%(refname) refs/tags" r]
while {[gets $fd line] > 0} {
if {![regsub ^refs/tags/ $line {} name]} continue
lappend all_tags $name
}
close $fd
return [lsort $all_tags]
}
proc do_create_branch_action {w} {
global all_heads null_sha1 repo_config
global create_branch_checkout create_branch_revtype
global create_branch_head create_branch_trackinghead
global create_branch_name create_branch_revexp
global create_branch_tag
set newbranch $create_branch_name
if {$newbranch eq {}
@ -1894,7 +1983,7 @@ proc do_create_branch_action {w} {
focus $w.desc.name_t
return
}
if {![catch {exec git show-ref --verify -- "refs/heads/$newbranch"}]} {
if {![catch {git show-ref --verify -- "refs/heads/$newbranch"}]} {
tk_messageBox \
-icon error \
-type ok \
@ -1904,7 +1993,7 @@ proc do_create_branch_action {w} {
focus $w.desc.name_t
return
}
if {[catch {exec git check-ref-format "heads/$newbranch"}]} {
if {[catch {git check-ref-format "heads/$newbranch"}]} {
tk_messageBox \
-icon error \
-type ok \
@ -1919,9 +2008,10 @@ proc do_create_branch_action {w} {
switch -- $create_branch_revtype {
head {set rev $create_branch_head}
tracking {set rev $create_branch_trackinghead}
tag {set rev $create_branch_tag}
expression {set rev $create_branch_revexp}
}
if {[catch {set cmt [exec git rev-parse --verify "${rev}^0"]}]} {
if {[catch {set cmt [git rev-parse --verify "${rev}^0"]}]} {
tk_messageBox \
-icon error \
-type ok \
@ -1964,6 +2054,8 @@ trace add variable create_branch_head write \
[list radio_selector create_branch_revtype head]
trace add variable create_branch_trackinghead write \
[list radio_selector create_branch_revtype tracking]
trace add variable create_branch_tag write \
[list radio_selector create_branch_revtype tag]
trace add variable delete_branch_head write \
[list radio_selector delete_branch_checktype head]
@ -1975,6 +2067,7 @@ proc do_create_branch {} {
global create_branch_checkout create_branch_revtype
global create_branch_head create_branch_trackinghead
global create_branch_name create_branch_revexp
global create_branch_tag
set w .branch_editor
toplevel $w
@ -2038,6 +2131,19 @@ proc do_create_branch {} {
$all_trackings
grid $w.from.tracking_r $w.from.tracking_m -sticky w
}
set all_tags [load_all_tags]
if {$all_tags ne {}} {
set create_branch_tag [lindex $all_tags 0]
radiobutton $w.from.tag_r \
-text {Tag:} \
-value tag \
-variable create_branch_revtype \
-font font_ui
eval tk_optionMenu $w.from.tag_m \
create_branch_tag \
$all_tags
grid $w.from.tag_r $w.from.tag_m -sticky w
}
radiobutton $w.from.exp_r \
-text {Revision Expression:} \
-value expression \
@ -2100,7 +2206,7 @@ proc do_delete_branch_action {w} {
}
if {$check_rev eq {:none}} {
set check_cmt {}
} elseif {[catch {set check_cmt [exec git rev-parse --verify "${check_rev}^0"]}]} {
} elseif {[catch {set check_cmt [git rev-parse --verify "${check_rev}^0"]}]} {
tk_messageBox \
-icon error \
-type ok \
@ -2114,10 +2220,10 @@ proc do_delete_branch_action {w} {
set not_merged [list]
foreach i [$w.list.l curselection] {
set b [$w.list.l get $i]
if {[catch {set o [exec git rev-parse --verify $b]}]} continue
if {[catch {set o [git rev-parse --verify $b]}]} continue
if {$check_cmt ne {}} {
if {$b eq $check_rev} continue
if {[catch {set m [exec git merge-base $o $check_cmt]}]} continue
if {[catch {set m [git merge-base $o $check_cmt]}]} continue
if {$o ne $m} {
lappend not_merged $b
continue
@ -2155,7 +2261,7 @@ Delete the selected branches?}
foreach i $to_delete {
set b [lindex $i 0]
set o [lindex $i 1]
if {[catch {exec git update-ref -d "refs/heads/$b" $o} err]} {
if {[catch {git update-ref -d "refs/heads/$b" $o} err]} {
append failed " - $b: $err\n"
} else {
set x [lsearch -sorted -exact $all_heads $b]
@ -2366,7 +2472,7 @@ Staying on branch '$current_branch'."
# here, it Just Works(tm). If it doesn't we are in some really ugly
# state that is difficult to recover from within git-gui.
#
if {[catch {exec git symbolic-ref HEAD "refs/heads/$new_branch"} err]} {
if {[catch {git symbolic-ref HEAD "refs/heads/$new_branch"} err]} {
error_popup "Failed to set current branch.
This working directory is only partially switched.
@ -2876,14 +2982,16 @@ proc do_local_merge {} {
pack $w.source -fill both -expand 1 -pady 5 -padx 5
set cmd [list git for-each-ref]
lappend cmd {--format=%(objectname) %(refname)}
lappend cmd {--format=%(objectname) %(*objectname) %(refname)}
lappend cmd refs/heads
lappend cmd refs/remotes
lappend cmd refs/tags
set fr_fd [open "| $cmd" r]
fconfigure $fr_fd -translation binary
while {[gets $fr_fd line] > 0} {
set line [split $line { }]
set sha1([lindex $line 0]) [lindex $line 1]
set sha1([lindex $line 0]) [lindex $line 2]
set sha1([lindex $line 1]) [lindex $line 2]
}
close $fr_fd
@ -2891,7 +2999,7 @@ proc do_local_merge {} {
set fr_fd [open "| git rev-list --all --not HEAD"]
while {[gets $fr_fd line] > 0} {
if {[catch {set ref $sha1($line)}]} continue
regsub ^refs/(heads|remotes)/ $ref {} ref
regsub ^refs/(heads|remotes|tags)/ $ref {} ref
lappend to_show $ref
}
close $fr_fd
@ -2972,7 +3080,14 @@ proc new_browser {commit} {
global next_browser_id cursor_ptr M1B
global browser_commit browser_status browser_stack browser_path browser_busy
if {[winfo ismapped .]} {
set w .browser[incr next_browser_id]
set tl $w
toplevel $w
} else {
set w {}
set tl .
}
set w_list $w.list.l
set browser_commit($w_list) $commit
set browser_status($w_list) {Starting...}
@ -2980,7 +3095,6 @@ proc new_browser {commit} {
set browser_path($w_list) $browser_commit($w_list):
set browser_busy($w_list) 1
toplevel $w
label $w.path -textvariable browser_path($w_list) \
-anchor w \
-justify left \
@ -3030,8 +3144,8 @@ proc new_browser {commit} {
bind $w_list <Left> break
bind $w_list <Right> break
bind $w <Visibility> "focus $w"
bind $w <Destroy> "
bind $tl <Visibility> "focus $w"
bind $tl <Destroy> "
array unset browser_buffer $w_list
array unset browser_files $w_list
array unset browser_status $w_list
@ -3040,7 +3154,7 @@ proc new_browser {commit} {
array unset browser_commit $w_list
array unset browser_busy $w_list
"
wm title $w "[appname] ([reponame]): File Browser"
wm title $tl "[appname] ([reponame]): File Browser"
ls_tree $w_list $browser_commit($w_list) {}
}
@ -4161,7 +4275,7 @@ proc do_quit {} {
set rc_geometry {}
}
if {$cfg_geometry ne $rc_geometry} {
catch {exec git config gui.geometry $cfg_geometry}
catch {git config gui.geometry $cfg_geometry}
}
}
@ -4400,7 +4514,7 @@ proc do_about {} {
pack $w.buttons -side bottom -fill x -pady 10 -padx 10
label $w.desc \
-text "[appname] - a commit creation tool for Git.
-text "git-gui - a graphical user interface for Git.
$copyright" \
-padx 5 -pady 5 \
-justify left \
@ -4411,8 +4525,8 @@ $copyright" \
pack $w.desc -side top -fill x -padx 5 -pady 5
set v {}
append v "[appname] version $appvers\n"
append v "[exec git version]\n"
append v "git-gui version $appvers\n"
append v "[git version]\n"
append v "\n"
if {$tcl_patchLevel eq $tk_patchLevel} {
append v "Tcl/Tk version $tcl_patchLevel"
@ -4471,7 +4585,7 @@ proc do_options {} {
toplevel $w
wm geometry $w "+[winfo rootx .]+[winfo rooty .]"
label $w.header -text "[appname] Options" \
label $w.header -text "Options" \
-font font_uibold
pack $w.header -side top -fill x
@ -4945,6 +5059,7 @@ enable_option branch
enable_option transport
switch -- $subcommand {
browser -
blame {
disable_option multicommit
disable_option branch
@ -5094,6 +5209,12 @@ if {[is_enabled branch]} {
-font font_ui
lappend disable_on_lock [list .mbar.branch entryconf \
[.mbar.branch index last] -state]
.mbar.branch add command -label {Reset...} \
-command do_reset_hard \
-font font_ui
lappend disable_on_lock [list .mbar.branch entryconf \
[.mbar.branch index last] -state]
}
# -- Commit Menu
@ -5168,6 +5289,34 @@ if {[is_enabled multicommit] || [is_enabled singlecommit]} {
[list .mbar.commit entryconf [.mbar.commit index last] -state]
}
# -- Merge Menu
#
if {[is_enabled branch]} {
menu .mbar.merge
.mbar.merge add command -label {Local Merge...} \
-command do_local_merge \
-font font_ui
lappend disable_on_lock \
[list .mbar.merge entryconf [.mbar.merge index last] -state]
.mbar.merge add command -label {Abort Merge...} \
-command do_reset_hard \
-font font_ui
lappend disable_on_lock \
[list .mbar.merge entryconf [.mbar.merge index last] -state]
}
# -- Transport Menu
#
if {[is_enabled transport]} {
menu .mbar.fetch
menu .mbar.push
.mbar.push add command -label {Push...} \
-command do_push_anywhere \
-font font_ui
}
if {[is_MacOSX]} {
# -- Apple Menu (Mac OS X only)
#
@ -5177,7 +5326,7 @@ if {[is_MacOSX]} {
.mbar.apple add command -label "About [appname]" \
-command do_about \
-font font_ui
.mbar.apple add command -label "[appname] Options..." \
.mbar.apple add command -label "Options..." \
-command do_options \
-font font_ui
} else {
@ -5236,7 +5385,7 @@ set doc_path [file dirname [gitexec]]
set doc_path [file join $doc_path Documentation index.html]
if {[is_Cygwin]} {
set doc_path [exec cygpath --windows $doc_path]
set doc_path [exec cygpath --mixed $doc_path]
}
if {$browser eq {}} {
@ -5280,6 +5429,15 @@ bind all <$M1B-Key-W> {destroy [winfo toplevel %W]}
# -- Not a normal commit type invocation? Do that instead!
#
switch -- $subcommand {
browser {
if {[llength $argv] != 1} {
puts stderr "usage: $argv0 browser commit"
exit 1
}
set current_branch [lindex $argv 0]
new_browser $current_branch
return
}
blame {
if {[llength $argv] != 2} {
puts stderr "usage: $argv0 blame commit path"
@ -5302,7 +5460,7 @@ gui {
# fall through to setup UI for commits
}
default {
puts stderr "usage: $argv0 \[{blame|citool}\]"
puts stderr "usage: $argv0 \[{blame|browser|citool}\]"
exit 1
}
}
@ -5326,28 +5484,6 @@ pack .branch.l1 -side left
pack .branch.cb -side left -fill x
pack .branch -side top -fill x
if {[is_enabled branch]} {
menu .mbar.merge
.mbar.merge add command -label {Local Merge...} \
-command do_local_merge \
-font font_ui
lappend disable_on_lock \
[list .mbar.merge entryconf [.mbar.merge index last] -state]
.mbar.merge add command -label {Abort Merge...} \
-command do_reset_hard \
-font font_ui
lappend disable_on_lock \
[list .mbar.merge entryconf [.mbar.merge index last] -state]
menu .mbar.fetch
menu .mbar.push
.mbar.push add command -label {Push...} \
-command do_push_anywhere \
-font font_ui
}
# -- Main Window Layout
#
panedwindow .vpane -orient vertical
@ -5552,9 +5688,6 @@ bind_button3 $ui_comm "tk_popup $ctxm %X %Y"
# -- Diff Header
#
set current_diff_path {}
set current_diff_side {}
set diff_actions [list]
proc trace_current_diff_path {varname args} {
global current_diff_path diff_actions file_states
if {$current_diff_path eq {}} {
@ -5747,7 +5880,6 @@ unset ui_diff_applyhunk
# -- Status Bar
#
set ui_status_value {Initializing...}
label .status -textvariable ui_status_value \
-anchor w \
-justify left \
@ -5821,15 +5953,6 @@ unset i
set file_lists($ui_index) [list]
set file_lists($ui_workdir) [list]
set HEAD {}
set PARENT {}
set MERGE_HEAD [list]
set commit_type {}
set empty_tree {}
set current_branch {}
set current_diff_path {}
set selected_commit_type new
wm title . "[appname] ([file normalize [file dirname [gitdir]]])"
focus -force $ui_comm
@ -5904,7 +6027,7 @@ if {[is_enabled transport]} {
if {[is_enabled multicommit]} {
set object_limit 2000
if {[is_Windows]} {set object_limit 200}
regexp {^([0-9]+) objects,} [exec git count-objects] _junk objects_current
regexp {^([0-9]+) objects,} [git count-objects] _junk objects_current
if {$objects_current >= $object_limit} {
if {[ask_popup \
"This repository currently has $objects_current loose objects.

View File

@ -292,9 +292,14 @@ f,*)
# Again the most common case of merging one remote.
echo "Updating $(git-rev-parse --short $head)..$(git-rev-parse --short $1)"
git-update-index --refresh 2>/dev/null
msg="Fast forward"
if test -n "$have_message"
then
msg="$msg (no commit created; -m option ignored)"
fi
new_head=$(git-rev-parse --verify "$1^0") &&
git-read-tree -v -m -u --exclude-per-directory=.gitignore $head "$new_head" &&
finish "$new_head" "Fast forward"
finish "$new_head" "$msg" || exit
dropsave
exit 0
;;

View File

@ -67,7 +67,7 @@ sub list_remote {
$git->command(qw(config --get-regexp), '^remote\.');
};
for (@remotes) {
if (/^remote\.([^.]*)\.(\S*)\s+(.*)$/) {
if (/^remote\.(\S+?)\.([^.\s]+)\s+(.*)$/) {
add_remote_config(\%seen, $1, $2, $3);
}
}

2
git.c
View File

@ -226,7 +226,7 @@ static void handle_internal_command(int argc, const char **argv, char **envp)
{ "add", cmd_add, RUN_SETUP | NOT_BARE },
{ "annotate", cmd_annotate, USE_PAGER },
{ "apply", cmd_apply },
{ "archive", cmd_archive },
{ "archive", cmd_archive, RUN_SETUP },
{ "blame", cmd_blame, RUN_SETUP },
{ "branch", cmd_branch, RUN_SETUP },
{ "cat-file", cmd_cat_file, RUN_SETUP },

184
gitweb/INSTALL Normal file
View File

@ -0,0 +1,184 @@
GIT web Interface (gitweb) Installation
=======================================
First you have to generate gitweb.cgi from gitweb.perl using
"make gitweb/gitweb.cgi", then copy appropriate files (gitweb.cgi,
gitweb.css, git-logo.png and git-favicon.png) to their destination.
For example if git was (or is) installed with /usr prefix, you can do
$ make prefix=/usr gitweb/gitweb.cgi ;# as yourself
# cp gitweb/git* /var/www/cgi-bin/ ;# as root
Alternatively you can use autoconf generated ./configure script to
set up path to git binaries (via config.mak.autogen), so you can write
instead
$ make configure ;# as yourself
$ ./configure --prefix=/usr ;# as yourself
$ make gitweb/gitweb.cgi ;# as yourself
# cp gitweb/git* /var/www/cgi-bin/ ;# as root
The above example assumes that your web server is configured to run
[executable] files in /var/www/cgi-bin/ as server scripts (as CGI
scripts).
Build time configuration
------------------------
See also "How to configure gitweb for your local system" in README
file for gitweb (in gitweb/README).
- There are many configuration variables which affects building of
gitweb.cgi; see "default configuration for gitweb" section in main
(top dir) Makefile, and instructions for building gitweb/gitweb.cgi
target.
One of most important is where to find git wrapper binary. Gitweb
tries to find git wrapper at $(bindir)/git, so you have to set $bindir
when building gitweb.cgi, or $prefix from which $bindir is derived. If
you build and install gitweb together with the rest of git suite,
there should be no problems. Otherwise, if git was for example
installed from a binary package, you have to set $prefix (or $bindir)
accordingly.
- Another important issue is where are git repositories you want to make
available to gitweb. By default gitweb search for repositories under
/pub/git; if you want to have projects somewhere else, like /home/git,
use GITWEB_PROJECTROOT build configuration variable.
By default all git repositories under projectroot are visible and
available to gitweb. List of projects is generated by default by
scanning the projectroot directory for git repositories. This can be
changed (configured) as described in "Gitweb repositories" section
below.
Note that gitweb deals directly with object database, and does not
need working directory; the name of the project is the name of its
repository object database, usually projectname.git for bare
repositories. If you want to provide gitweb access to non-bare (live)
repository, you can make projectname.git symbolic link under
projectroot linking to projectname/.git (but it is just
a suggestion).
- You can control where gitweb tries to find its main CSS style file,
its favicon and logo with GITWEB_CSS, GITWEB_FAVICON and GITWEB_LOGO
build configuration variables. By default gitweb tries to find them
in the same directory as gitweb.cgi script.
Build example
~~~~~~~~~~~~~
- To install gitweb to /var/www/cgi-bin/gitweb/ when git wrapper
is installed at /usr/local/bin/git and the repositories (projects)
we want to display are under /home/local/scm, you can do
make GITWEB_PROJECTROOT="/home/local/scm" \
GITWEB_CSS="/gitweb/gitweb.css" \
GITWEB_LOGO="/gitweb/git-logo.png" \
GITWEB_FAVICON="/gitweb/git-favicon.png" \
bindir=/usr/local/bin \
gitweb/gitweb.cgi
cp -fv ~/git/gitweb/gitweb.{cgi,css} \
~/git/gitweb/git-{favicon,logo}.png \
/var/www/cgi-bin/gitweb/
Gitweb config file
------------------
See also "Runtime gitweb configuration" section in README file
for gitweb (in gitweb/README).
- You can configure gitweb further using gitweb configuration file;
by default it is file named gitweb_config.perl in the same place as
gitweb.cgi script. You can control default place for config file
using GITWEB_CONFIG build configuration variable, and you can set it
using GITWEB_CONFIG environmental variable.
- Gitweb config file is [fragment] of perl code. You can set variables
using "our $variable = value"; text from "#" character until the end
of a line is ignored. See perlsyn(1) for details.
See the top of gitweb.perl file for examples of customizable options.
Gitweb repositories:
--------------------
- By default all git repositories under projectroot are visible and
available to gitweb. List of projects is generated by default by
scanning the projectroot directory for git repositories (for object
databases to be more exact).
You can provide pre-generated list of [visible] repositories,
together with information about their owners (the project ownership
is taken from owner of repository directory otherwise), by setting
GITWEB_LIST build configuration variable (or $projects_list variable
in gitweb config file) to point to a plain file.
Each line of projects list file should consist of url-encoded path
to project repository database (relative to projectroot) separated
by space from url-encoded project owner; spaces in both project path
and project owner have to be encoded as either '%20' or '+'.
You can generate projects list index file using project_index action
(the 'TXT' link on projects list page) directly from gitweb.
- By default even if project is not visible on projects list page, you
can view it nevertheless by hand-crafting gitweb URL. You can set
GITWEB_STRICT_EXPORT build configuration variable (or $strict_export
variable in gitweb config file) to only allow viewing of
repositories also shown on the overview page.
- Alternatively, you can configure gitweb to only list and allow
viewing of the explicitly exported repositories, via
GITWEB_EXPORT_OK build configuration variable (or $export_ok
variable in gitweb config file). If it evaluates to true, gitweb
show repository only if this file exists in its object database
(if directory has the magic file $export_ok).
Requirements
------------
- Core git tools
- Perl
- Perl modules: CGI, Encode, Fcntl, File::Find, File::Basename.
- web server
Example web server configuration
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
See also "Webserver configuration" section in README file for gitweb
(in gitweb/README).
- Apache2, gitweb installed as CGI script,
under /var/www/cgi-bin/
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
<Directory "/var/www/cgi-bin">
Options Indexes FollowSymlinks ExecCGI
AllowOverride None
Order allow,deny
Allow from all
</Directory>
- Apache2, gitweb installed as mod_perl legacy script,
under /var/www/perl/
Alias /perl "/var/www/perl"
<Directory "/var/www/perl">
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
PerlOptions +ParseHeaders
Options Indexes FollowSymlinks +ExecCGI
AllowOverride None
Order allow,deny
Allow from all
</Directory>

View File

@ -107,7 +107,7 @@ span.age {
font-style: italic;
}
div.page_body span.signoff {
span.signoff {
color: #888888;
}

View File

@ -591,7 +591,7 @@ sub esc_html ($;%) {
my %opts = @_;
$str = to_utf8($str);
$str = escapeHTML($str);
$str = $cgi->escapeHTML($str);
if ($opts{'-nbsp'}) {
$str =~ s/ /&nbsp;/g;
}
@ -605,7 +605,7 @@ sub esc_path {
my %opts = @_;
$str = to_utf8($str);
$str = escapeHTML($str);
$str = $cgi->escapeHTML($str);
if ($opts{'-nbsp'}) {
$str =~ s/ /&nbsp;/g;
}
@ -1974,17 +1974,17 @@ sub git_print_page_path {
$fullname .= ($fullname ? '/' : '') . $dir;
print $cgi->a({-href => href(action=>"tree", file_name=>$fullname,
hash_base=>$hb),
-title => esc_html($fullname)}, esc_path($dir));
-title => $fullname}, esc_path($dir));
print " / ";
}
if (defined $type && $type eq 'blob') {
print $cgi->a({-href => href(action=>"blob_plain", file_name=>$file_name,
hash_base=>$hb),
-title => esc_html($name)}, esc_path($basename));
-title => $name}, esc_path($basename));
} elsif (defined $type && $type eq 'tree') {
print $cgi->a({-href => href(action=>"tree", file_name=>$file_name,
hash_base=>$hb),
-title => esc_html($name)}, esc_path($basename));
-title => $name}, esc_path($basename));
print " / ";
} else {
print esc_path($basename);
@ -3719,7 +3719,7 @@ sub git_commit {
$formats_nav .=
'(merge: ' .
join(' ', map {
$cgi->a({-href => href(action=>"commitdiff",
$cgi->a({-href => href(action=>"commit",
hash=>$_)},
esc_html(substr($_, 0, 7)));
} @$parents ) .

View File

@ -1271,7 +1271,9 @@ xml_cdata(void *userData, const XML_Char *s, int len)
struct xml_ctx *ctx = (struct xml_ctx *)userData;
free(ctx->cdata);
ctx->cdata = xmalloc(len + 1);
strlcpy(ctx->cdata, s, len + 1);
/* NB: 's' is not null-terminated, can not use strlcpy here */
memcpy(ctx->cdata, s, len);
ctx->cdata[len] = '\0';
}
static struct remote_lock *lock_remote(const char *path, long timeout)
@ -1295,7 +1297,7 @@ static struct remote_lock *lock_remote(const char *path, long timeout)
sprintf(url, "%s%s", remote->url, path);
/* Make sure leading directories exist for the remote ref */
ep = strchr(url + strlen(remote->url) + 11, '/');
ep = strchr(url + strlen(remote->url) + 1, '/');
while (ep) {
*ep = 0;
slot = get_active_slot();
@ -1473,7 +1475,8 @@ static void process_ls_object(struct remote_ls_ctx *ls)
return;
path += 8;
obj_hex = xmalloc(strlen(path));
strlcpy(obj_hex, path, 3);
/* NB: path is not null-terminated, can not use strlcpy here */
memcpy(obj_hex, path, 2);
strcpy(obj_hex + 2, path + 3);
one_remote_object(obj_hex);
free(obj_hex);
@ -2170,7 +2173,8 @@ static void fetch_symref(const char *path, char **symref, unsigned char *sha1)
/* If it's a symref, set the refname; otherwise try for a sha1 */
if (!strncmp((char *)buffer.buffer, "ref: ", 5)) {
*symref = xmalloc(buffer.posn - 5);
strlcpy(*symref, (char *)buffer.buffer + 5, buffer.posn - 5);
memcpy(*symref, (char *)buffer.buffer + 5, buffer.posn - 6);
(*symref)[buffer.posn - 6] = '\0';
} else {
get_sha1_hex(buffer.buffer, sha1);
}

View File

@ -277,13 +277,19 @@ static void *get_data_from_pack(struct object_entry *obj)
{
unsigned long from = obj[0].offset + obj[0].hdr_size;
unsigned long len = obj[1].offset - from;
unsigned long rdy = 0;
unsigned char *src, *data;
z_stream stream;
int st;
src = xmalloc(len);
if (pread(pack_fd, src, len, from) != len)
data = src;
do {
ssize_t n = pread(pack_fd, data + rdy, len - rdy, from + rdy);
if (n <= 0)
die("cannot pread pack file: %s", strerror(errno));
rdy += n;
} while (rdy < len);
data = xmalloc(obj->size);
memset(&stream, 0, sizeof(stream));
stream.next_out = data;

View File

@ -60,7 +60,7 @@ static int merge_entry(int pos, const char *path)
break;
found++;
strcpy(hexbuf[stage], sha1_to_hex(ce->sha1));
sprintf(ownbuf[stage], "%o", ntohl(ce->ce_mode) & (~S_IFMT));
sprintf(ownbuf[stage], "%o", ntohl(ce->ce_mode));
arguments[stage] = hexbuf[stage];
arguments[stage + 4] = ownbuf[stage];
} while (++pos < active_nr);

View File

@ -589,7 +589,7 @@ static void update_file_flags(const unsigned char *sha,
memcpy(lnk, buf, size);
lnk[size] = '\0';
mkdir_p(path, 0777);
unlink(lnk);
unlink(path);
symlink(lnk, path);
} else
die("do not know what to do with %06o %s '%s'",

View File

@ -158,7 +158,10 @@ static int update(struct command *cmd)
cmd->error_string = "failed to lock";
return error("failed to lock %s", name);
}
write_ref_sha1(lock, new_sha1, "push");
if (write_ref_sha1(lock, new_sha1, "push")) {
cmd->error_string = "failed to write";
return -1; /* error() already called */
}
fprintf(stderr, "%s: %s -> %s\n", name, old_hex, new_hex);
}
return 0;

4
refs.c
View File

@ -921,6 +921,8 @@ static int log_ref_write(const char *ref_name, const unsigned char *old_sha1,
log_file, strerror(errno));
}
adjust_shared_perm(log_file);
msglen = 0;
if (msg) {
/* clean up the message and make sure it is a single line */
@ -1042,7 +1044,9 @@ int create_symref(const char *ref_target, const char *refs_heads_master,
return -1;
}
#ifndef NO_SYMLINK_HEAD
done:
#endif
if (logmsg && !read_ref(refs_heads_master, new_sha1))
log_ref_write(ref_target, old_sha1, new_sha1, logmsg);

View File

@ -116,6 +116,8 @@ void mark_parents_uninteresting(struct commit *commit)
void add_pending_object(struct rev_info *revs, struct object *obj, const char *name)
{
if (revs->no_walk && (obj->flags & UNINTERESTING))
die("object ranges do not make sense when not walking revisions");
add_object_array(obj, name, &revs->pending);
if (revs->reflog_info && obj->type == OBJ_COMMIT)
add_reflog_for_walk(revs->reflog_info,

View File

@ -216,7 +216,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
die("Not a git repository: '%s'", gitdirenv);
}
if (!getcwd(cwd, sizeof(cwd)) || cwd[0] != '/')
if (!getcwd(cwd, sizeof(cwd)-1) || cwd[0] != '/')
die("Unable to read current working directory");
offset = len = strlen(cwd);

View File

@ -114,7 +114,8 @@ test_expect_success \
test_expect_success \
'some edit' \
'mv file file.orig &&
sed -e "s/^3A/99/" -e "/^1A/d" < file.orig > file &&
sed -e "s/^3A/99/" -e "/^1A/d" -e "/^incomplete/d" < file.orig > file &&
echo "incomplete" | tr -d "\\012" >>file &&
GIT_AUTHOR_NAME="D" git commit -a -m "edit"'
test_expect_success \

View File

@ -23,7 +23,8 @@ test_expect_success setup '
cat file2 >file2.orig
git add file1 file2 &&
sed -e "/^B/d" <file1.orig >file1 &&
sed -e "/^B/d" <file2.orig >file2 &&
sed -e "/^[BQ]/d" <file2.orig >file2 &&
echo Q | tr -d "\\012" >>file2 &&
cat file1 >file1.mods &&
cat file2 >file2.mods &&
git diff |

View File

@ -11,7 +11,7 @@ test_expect_success 'split sample box' \
'git-mailsplit -o. ../t5100/sample.mbox >last &&
last=`cat last` &&
echo total is $last &&
test `cat last` = 5'
test `cat last` = 6'
for mail in `echo 00*`
do

5
t/t5100/info0006 Normal file
View File

@ -0,0 +1,5 @@
Author: A U Thor
Email: a.u.thor@example.com
Subject: a commit.
Date: Fri, 9 Jun 2006 00:44:16 -0700

2
t/t5100/msg0006 Normal file
View File

@ -0,0 +1,2 @@
Here is a patch from A U Thor.

14
t/t5100/patch0006 Normal file
View File

@ -0,0 +1,14 @@
---
foo | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/foo b/foo
index 9123cdc..918dcf8 100644
--- a/foo
+++ b/foo
@@ -1 +1 @@
-Fri Jun 9 00:44:04 PDT 2006
+Fri Jun 9 00:44:13 PDT 2006
--
1.4.0.g6f2b

View File

@ -315,3 +315,74 @@ To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From nobody Mon Sep 17 00:00:00 2001
From: A U Thor <a.u.thor@example.com>
References: <Pine.LNX.4.640.0001@woody.linux-foundation.org>
<Pine.LNX.4.640.0002@woody.linux-foundation.org>
<Pine.LNX.4.640.0003@woody.linux-foundation.org>
<Pine.LNX.4.640.0004@woody.linux-foundation.org>
<Pine.LNX.4.640.0005@woody.linux-foundation.org>
<Pine.LNX.4.640.0006@woody.linux-foundation.org>
<Pine.LNX.4.640.0007@woody.linux-foundation.org>
<Pine.LNX.4.640.0008@woody.linux-foundation.org>
<Pine.LNX.4.640.0009@woody.linux-foundation.org>
<Pine.LNX.4.640.0010@woody.linux-foundation.org>
<Pine.LNX.4.640.0011@woody.linux-foundation.org>
<Pine.LNX.4.640.0012@woody.linux-foundation.org>
<Pine.LNX.4.640.0013@woody.linux-foundation.org>
<Pine.LNX.4.640.0014@woody.linux-foundation.org>
<Pine.LNX.4.640.0015@woody.linux-foundation.org>
<Pine.LNX.4.640.0016@woody.linux-foundation.org>
<Pine.LNX.4.640.0017@woody.linux-foundation.org>
<Pine.LNX.4.640.0018@woody.linux-foundation.org>
<Pine.LNX.4.640.0019@woody.linux-foundation.org>
<Pine.LNX.4.640.0020@woody.linux-foundation.org>
<Pine.LNX.4.640.0021@woody.linux-foundation.org>
<Pine.LNX.4.640.0022@woody.linux-foundation.org>
<Pine.LNX.4.640.0023@woody.linux-foundation.org>
<Pine.LNX.4.640.0024@woody.linux-foundation.org>
<Pine.LNX.4.640.0025@woody.linux-foundation.org>
<Pine.LNX.4.640.0026@woody.linux-foundation.org>
<Pine.LNX.4.640.0027@woody.linux-foundation.org>
<Pine.LNX.4.640.0028@woody.linux-foundation.org>
<Pine.LNX.4.640.0029@woody.linux-foundation.org>
<Pine.LNX.4.640.0030@woody.linux-foundation.org>
<Pine.LNX.4.640.0031@woody.linux-foundation.org>
<Pine.LNX.4.640.0032@woody.linux-foundation.org>
<Pine.LNX.4.640.0033@woody.linux-foundation.org>
<Pine.LNX.4.640.0034@woody.linux-foundation.org>
<Pine.LNX.4.640.0035@woody.linux-foundation.org>
<Pine.LNX.4.640.0036@woody.linux-foundation.org>
<Pine.LNX.4.640.0037@woody.linux-foundation.org>
<Pine.LNX.4.640.0038@woody.linux-foundation.org>
<Pine.LNX.4.640.0039@woody.linux-foundation.org>
<Pine.LNX.4.640.0040@woody.linux-foundation.org>
<Pine.LNX.4.640.0041@woody.linux-foundation.org>
<Pine.LNX.4.640.0042@woody.linux-foundation.org>
<Pine.LNX.4.640.0043@woody.linux-foundation.org>
<Pine.LNX.4.640.0044@woody.linux-foundation.org>
<Pine.LNX.4.640.0045@woody.linux-foundation.org>
<Pine.LNX.4.640.0046@woody.linux-foundation.org>
<Pine.LNX.4.640.0047@woody.linux-foundation.org>
<Pine.LNX.4.640.0048@woody.linux-foundation.org>
<Pine.LNX.4.640.0049@woody.linux-foundation.org>
<Pine.LNX.4.640.0050@woody.linux-foundation.org>
Date: Fri, 9 Jun 2006 00:44:16 -0700
Subject: [PATCH] a commit.
Here is a patch from A U Thor.
---
foo | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/foo b/foo
index 9123cdc..918dcf8 100644
--- a/foo
+++ b/foo
@@ -1 +1 @@
-Fri Jun 9 00:44:04 PDT 2006
+Fri Jun 9 00:44:13 PDT 2006
--
1.4.0.g6f2b

View File

@ -64,7 +64,7 @@ case "$refname","$newrev_type" in
# un-annotated tag
refname_type="tag"
short_refname=${refname##refs/tags/}
if [ $allowunannotated != "true" ]; then
if [ "$allowunannotated" != "true" ]; then
echo "*** The un-annotated tag, $short_refname is not allowed in this repository" >&2
echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
exit 1

20
utf8.c
View File

@ -3,13 +3,15 @@
/* This code is originally from http://www.cl.cam.ac.uk/~mgk25/ucs/ */
typedef unsigned int ucs_char_t; /* assuming 32bit int */
struct interval {
int first;
int last;
};
/* auxiliary function for binary search in interval table */
static int bisearch(wchar_t ucs, const struct interval *table, int max) {
static int bisearch(ucs_char_t ucs, const struct interval *table, int max) {
int min = 0;
int mid;
@ -56,11 +58,11 @@ static int bisearch(wchar_t ucs, const struct interval *table, int max) {
* ISO 8859-1 and WGL4 characters, Unicode control characters,
* etc.) have a column width of 1.
*
* This implementation assumes that wchar_t characters are encoded
* This implementation assumes that ucs_char_t characters are encoded
* in ISO 10646.
*/
static int wcwidth(wchar_t ch)
static int wcwidth(ucs_char_t ch)
{
/*
* Sorted list of non-overlapping intervals of non-spacing characters,
@ -157,7 +159,7 @@ static int wcwidth(wchar_t ch)
int utf8_width(const char **start)
{
unsigned char *s = (unsigned char *)*start;
wchar_t ch;
ucs_char_t ch;
if (*s < 0x80) {
/* 0xxxxxxx */
@ -291,11 +293,17 @@ int is_encoding_utf8(const char *name)
* with iconv. If the conversion fails, returns NULL.
*/
#ifndef NO_ICONV
#ifdef OLD_ICONV
typedef const char * iconv_ibp;
#else
typedef char * iconv_ibp;
#endif
char *reencode_string(const char *in, const char *out_encoding, const char *in_encoding)
{
iconv_t conv;
size_t insz, outsz, outalloc;
char *out, *outpos, *cp;
char *out, *outpos;
iconv_ibp cp;
if (!in_encoding)
return NULL;
@ -307,7 +315,7 @@ char *reencode_string(const char *in, const char *out_encoding, const char *in_e
outalloc = outsz + 1; /* for terminating NUL */
out = xmalloc(outalloc);
outpos = out;
cp = (char *)in;
cp = (iconv_ibp)in;
while (1) {
size_t cnt = iconv(conv, &cp, &insz, &outpos, &outsz);