Compare commits

...

136 Commits

Author SHA1 Message Date
8a263aeb4f GIT 1.1.3 2006-01-15 22:22:23 -08:00
181dc77695 describe: omit clearing marks on the last one.
When describing more than one, we need to clear the commit marks
before handling the next one, but most of the time we are
running it for only one commit, and in such a case this clearing
phase is totally unnecessary.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-15 22:15:37 -08:00
7cb038a692 Merge branch 'fixo/1.0' 2006-01-15 21:12:12 -08:00
ae4a35261d GIT 1.0.11 2006-01-15 21:11:30 -08:00
ee3d299e93 diffcore-break/diffcore-rename: integer overflow.
While reviewing the end user tutorial rewrite by J. Bruce
Fields, I noticed that "git-diff-tree -B -C" did not correctly
break the total rewrite of Documentation/tutorial.txt.  It turns
out that we had integer overflow during the break score
computations.

Cop out by using floating point.  This is not a kernel.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-15 21:08:42 -08:00
59617ebb74 GIT 1.1.2 2006-01-13 16:47:05 -08:00
e99c2fbdda GIT 1.0.10 2006-01-13 16:39:17 -08:00
a0dfb48af7 Documentation: git-reset - interrupted workflow.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-13 13:17:55 -08:00
cb95bf488b Documentation: git-commit -a
A bit more elaboration on what "update all paths" means.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-13 12:59:21 -08:00
c2bc6e404d Documentation: clarify fetch parameter descriptions.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-12 22:03:11 -08:00
87758f975b show-branch: handle [] globs as well.
Earlier only '?' and '*' signalled the command that what the
user has given is a glob pattern.  This prevented us to say:

	$ git show-branch 'v0.99.[0-3]'

Now we notice '[' as well, so the above would work.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-11 15:36:07 -08:00
2c817df25d name-rev: do not omit leading components of ref name.
In a repository with mainto/1.0 (to keep maintaining the 1.0.X
series) and fixo/1.0 (to keep fixes that apply to both 1.0.X
series and upwards) branches, "git-name-rev mainto/1.0" answered
just "1.0" making things ambiguous.  Show refnames unambiguously
like show-branch does.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-11 14:47:20 -08:00
8c23b6fae2 describe: do not silently ignore indescribable commits
We silently ignored indescribable commits without complaining.
Complain and die instead.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-11 13:41:25 -08:00
a94d9948da update-index: work with c-quoted name
update-index --stdin did not work with c-style quoted names even though
update-index --index-info did.  This fixes the inconsistency.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-11 13:36:45 -08:00
5a25b4a66e Add git-describe to .gitignore.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-11 00:36:03 -08:00
0de62e5985 GIT 1.0.9 2006-01-10 16:20:22 -08:00
78ff5cf6b5 GIT 1.1.1 2006-01-10 16:19:11 -08:00
d5a6aafc90 glossary: explain "master" and "origin"
If you are a long time git user/developer, you forget that to a new git
user, these words have not the same meaning as to you.

[jc: with updates from J. Bruce Fields.]

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-10 16:02:54 -08:00
eb858c60d7 GIT-VERSION-GEN: detect dirty tree and mark the version accordingly.
If we are building from a working tree with local modifications,
mark the version accordingly.

Deliberately uses '-' to prevent RPM from being built from such
a tree.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-09 22:59:58 -08:00
181129d24c For release tarballs, include the proper version
When producing a release tarball, include a "version" file, which
GIT-VERSION-GEN can then use to do the right thing when building from a
tarball.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-09 20:22:26 -08:00
5a2282de13 GIT 1.1.0 2006-01-08 14:22:19 -08:00
e77f489edf Add a test for rebase when a change was picked upstream
This test exercises the standard feature that makes rebase useful.

Signed-off-by: Yann Dirson <ydirson@altern.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-08 12:33:13 -08:00
b91db2707a Add a minimal test for git-cherry
This test checks that git-cherry finds the expected number of patches
in two simple cases, and then tests the new limit arguments.

[jc: collapsed two patches into one and added sleep to make sure
 the two commits would get different timestamps]

Signed-off-by: Yann Dirson <ydirson@altern.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-08 00:54:31 -08:00
77f1055ca7 Add an optional limit to git-cherry
This allows to use another commit than the merge base as a limit for
scanning patches.

[jc: part about t3500 test omitted.]

Signed-off-by: Yann Dirson <ydirson@altern.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-08 00:54:30 -08:00
b21c31c9a5 git-daemon --base-path
Tommi Virtanen expressed a wish on #git to be able to use short and elegant
git URLs by making git-daemon 'root' in a given directory. This patch
implements this, causing git-daemon to interpret all paths relative to
the given base path if any is given.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-07 21:43:02 -08:00
f8f9c73c7d describe: allow more than one revs to be named.
The main loop was prepared to take more than one revs, but the actual
naming logic wad not (it used pop_most_recent_commit while forgetting
that the commit marks stay after it's done).

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-07 21:43:01 -08:00
78c2cff61f ls-files --others --directory: test
Add a test to run with --directory option.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-07 21:34:03 -08:00
9eafb7bad1 git-status: use ls-files --others --directory for untracked list.
This shortens "Untracked files" list by using --directory option
when running ls-files --others.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-07 21:34:03 -08:00
0907fedbee ls-files --others --directory: give trailing slash
This adds a trailing slash to directory names in the output
when "--others --directory" option shows only untracked
directories and not their contents, to make them stand out.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-07 21:34:02 -08:00
657907e76e ls-files --others --directory: fix a bug with index entry ordering
When both howto-index.sh and howto/make-dist.txt exist under
Documentation/ directory, dir_exists() mistakenly checked it
without the trailing slash to see if there was something under
Documentation/howto directory, and did not realize there was,
because '-' sorts earlier than '/' and cache_name_pos() finds
howto-index.sh, which is not under howto/ directory.  This
caused --others --directory to show it which was incorrect.

Check the directory name with the trailing slash, because having
an entry that has such as a prefix is what we are looking for.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-07 21:34:02 -08:00
9518eb2629 ls-files -o: optionally skip showing the contents in "untracked" directories
Darrin Thompson notes that git-ls-files -o reports all the unknown
files it finds in a work area.  Subversion and probably other systems
"simply ignore all the files and directories inside an unknown
directory and just note the directory as unknown."

With --directory option, ls-files --others shows untracked directories
without descending into them.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-07 21:34:02 -08:00
03febf99bc git-fetch: auto-following tags.
I added things to ls-remote so that Cogito can auto-follow tags
easily and correctly a while ago, but git-fetch did not use the
facility.  Recently added git-describe command relies on
repository keeping up-to-date set of tags, which made it much
more attractive to automatically follow tags, so we do that as
well.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-07 21:33:51 -08:00
8fc11b5aa9 GIT 1.0.8 2006-01-07 21:32:48 -08:00
6f2eacfeb2 mailsplit: allow empty input from stdin
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-07 21:26:30 -08:00
013049c985 revert/cherry-pick: handle single quote in author name.
The same fix as aa66c7ec77 is
needed here.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-07 20:45:11 -08:00
5f815e5922 Fix git-format-patch usage string wrt output modes.
--stdout was not mentionned, and the description for the case where -o
was not given was thus incomplete.

Signed-off-by: Yann Dirson <ydirson@altern.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-07 18:17:38 -08:00
36071af305 Fix typo in debug stanza of t2001
Signed-off-by: Yann Dirson <ydirson@altern.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-07 18:13:44 -08:00
3ac0ebbba4 tar-tree: finish honoring extractor's umask in git-tar-tree.
Earlier commit 38ec15a973 forgot
to apply the same principle of not forcing go-w to the base
directory when specified.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-07 15:11:11 -08:00
8f1d2e6f49 [PATCH] Compilation: zero-length array declaration.
ISO C99 (and GCC 3.x or later) lets you write a flexible array
at the end of a structure, like this:

	struct frotz {
		int xyzzy;
		char nitfol[]; /* more */
	};

GCC 2.95 and 2.96 let you to do this with "char nitfol[0]";
unfortunately this is not allowed by ISO C90.

This declares such construct like this:

	struct frotz {
		int xyzzy;
		char nitfol[FLEX_ARRAY]; /* more */
	};

and git-compat-util.h defines FLEX_ARRAY to 0 for gcc 2.95 and
empty for others.

If you are using a C90 C compiler, you should be able
to override this with CFLAGS=-DFLEX_ARRAY=1 from the
command line of "make".

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-07 10:51:06 -08:00
3be7098ce4 prune: do not show error from pack-redundant when no packs are found.
When there is no pack yet, git-prune leaked an error message
from "git-pack-redundant --all" which complained that there is
no pack.  Squelch the annoying message.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-07 00:29:48 -08:00
7d0e65b892 Retire debian/ directory.
The official maintainer is keeping up-to-date quite well, and now
the older Debian is supported with backports.org, there is no reason
for me to keep debian/ directory around here.

I have not been building and publishing debs since 1.0.4 anyway.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-06 19:18:12 -08:00
476e801111 unpack-objects: default to quiet if stderr is not a tty.
This would help cron/at jobs that run send-pack to mirror
repositories.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-06 18:53:16 -08:00
34c99da2a4 Substitute "/" with $opt_s in tag names as well as branch names
In 'git cvsimport' changes "/" to "-" (or $opt_s) in branch names,
but not in tag names, which is inconsistent.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-06 14:27:47 -08:00
576cfc86fc Teach cvsexportcommit to add new files
"cvs add" support was already there, but the "unknown" status
returned when querying a file not yet known to cvs caused the
script to abort prematurely.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-06 14:27:47 -08:00
026351a035 Make GIT-VERSION-GEN tolerate missing git describe command
I think it is probably a bug that "git non_existent_command"
returns its error message to stdout without an error, where
"git-non_existent_command" behaves differently and does return an
error.

Older versions of git did not implement "git describe"  and
GIT-VERSION-GEN produces an empty version string if run on
a system with such a git installed.  The consequence
is that "make rpm" fails.

This patch fixes GIT-VERSION-GEN so that it works in the
absence of a working "git describe"

Signed-off-by: John Ellson <ellson@research.att.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-05 21:02:01 -08:00
5df466c507 Merge fixes up to GIT 1.0.7
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-05 20:54:42 -08:00
92e802c6cc GIT 1.0.7
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-05 20:52:50 -08:00
c1fe2fe4fe Fix git-symbolic-ref typo in git.txt.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-05 20:29:52 -08:00
da6bf70ebf git: grok 'help' to mean '--help'.
Most other scm's understand it, most users expect it and it's an easy fix.

Signed-off-by: Andreas Ericsson <ae@op5.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-05 20:28:52 -08:00
2ed8e622bf Documentation/git-svnimport: document -T and -t switches correctly
The -T and -t switches are swapped in the documentation and actual
code.  I've made the documentation match the code.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-05 20:28:19 -08:00
2961e0ee8b svnimport: support repositories requiring SSL authentication
I looked at svn-mirror to see how it did this, seems about right.
"It works for me" when using it against https://svn.musicpd.org

tested command-line: git-svnimport -C mpc -i -m -v  \
	-T mpc/trunk -b mpc/branches -t mpc/tags https://svn.musicpd.org

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-05 20:28:14 -08:00
6ce183216d t3300: skip when filesystem does not like TAB in filenames.
Instead of checking Cygwin explicitly, see if the filesystem lets us
create funny filenames.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-05 20:14:40 -08:00
aa66c7ec77 format-patch/commit: Quote single quote in the author name properly.
Noticed by Kyle McMartin.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-05 20:02:33 -08:00
81214e4ddf git-fetch --tags: reject malformed tags.
When the other end was prepared with older git and has tags that
do not follow the naming convention (see check-ref-format), do not
barf but simply reject to copy them.

Initial fix by Simon Richter, but done differently.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-05 19:42:12 -08:00
353ce81597 Wrap synopsis lines and use [verse] to keep formatting
In addition, also fixes a few synopses to be more consistent and a gitlink.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-05 18:44:28 -08:00
6ff0b1c56c use GIT_DIR instead of /var/tmp
Not every system (will not one microsoft windows system) have /var/tmp,
whereas using GIT_DIR for random temporary files is more or less established.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-05 17:24:51 -08:00
2ccd2027b0 trivial: check, if t/trash directory was successfully created
and was successfully entered. Otherwise git-init-db will create it directly
in the working directory (t/) which can be dangerous.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-05 17:24:47 -08:00
10ae7d86c1 trivial: .gitignore precompiled python modules
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-05 17:24:42 -08:00
b484ef28fb trivial: use git-repo-config to detect how to run tests in the test repository
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-05 17:23:46 -08:00
e58b97af31 trivial: use git-repo-config to detect if the test can be run on the repository
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-05 17:23:44 -08:00
31f883d1b8 trivial: remove the dots at the end of file names from merge-one-file
to make the output more friendly to mouse copy-paste.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-05 17:23:41 -08:00
50b4e0c178 trivial: clarify, what are the config's user.name and user.email about
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-05 17:23:21 -08:00
b6ae5409ea trivial: typo in git-commit.sh
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-05 17:23:16 -08:00
88fb958baa use result of open(2) to check for presence
Not that the stat against open race would matter much in this context,
but that simplifies
the code a bit. Also some diagnostics added (why the open failed)

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-05 17:22:51 -08:00
d9e08be9d5 fix potential deadlock in create_one_file
It can happen if the temporary file already exists (i.e. after a panic
and reboot).

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-05 17:22:49 -08:00
781411ed46 trivial: O_EXCL makes O_TRUNC redundant
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-05 17:22:47 -08:00
7f272ca80c trivial: retval of waitpid is not errno
...but is used as such and passed to strerror.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-05 17:22:45 -08:00
b73cebf437 Fix nasty approxidate bug
Stupid me.

If approxidate ends up with a month that is ahead of the current month, it
decrements the year to last year.

Which is correct, and means that "last december" does the right thing.

HOWEVER. It should only do so if the year is the same as the current year.

Without this fix, "5 days ago" ends up being in 2004, because it first
decrements five days, getting us to December 2005 (correct), but then it
also ends up decrementing the year once more to turn that December into
"last year" (incorrect, since it already _was_ last year).

Duh. Pass me a donut.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-05 17:22:43 -08:00
0a15217184 AIX compile fix for repo-config.c
AIX 5 has a /usr/include/regex.h containing this code:

 #ifdef  _NO_PROTO
 extern  char    *regex();
 extern  char    *regcmp();
 #else /* _NO_PROTO */
 extern  char    *regex(const char *, const char *, ...);
 extern  char    *regcmp(const char *, ...);
 #endif  /* _NO_PROTO */

This means that repo-config.c is trying to redefine the `regex' symbol.
Here is a simple patch that just uses `regexp' as the symbol name instead.

Signed-off-by: Amos Waterland <apw@us.ibm.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-05 17:22:37 -08:00
8b32572c74 git-init-db(1): Describe --shared and the idempotent nature of init-db
Based on the recent discussion on the mailing list.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-05 17:22:31 -08:00
4e7a2eccc2 ?alloc: do not return NULL when asked for zero bytes
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-29 01:33:40 -08:00
82f9d58a39 code comments: spell
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-29 01:32:56 -08:00
89438677ab Documentation: spell.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-29 01:32:56 -08:00
f1ec72ba1e Fix skipping merge-order test with NO_OPENSSL=1.
Move git-rev-list --merge-order usage check for 'OpenSSL not linked' after
test 1; we cannot trigger this unless we try to actually use --merge-order
by giving some ref, and we do not have any ref until we run the first test
to create commits.

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-28 11:09:53 -08:00
58e3fb40f7 Merge fixes up to GIT 1.0.6 2005-12-27 18:13:30 -08:00
17dff84b5e GIT 1.0.6
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-27 18:08:58 -08:00
cfee10a773 send-pack/receive-pack: allow errors to be reported back to pusher.
This updates the protocol between git-send-pack/git-receive-pack
in a backward compatible way to allow failures at the receiving
end to be propagated back to the sender.  Most notably, versions
of git-push before this could not notice if the update hook on
the receiving end refused to update the ref for its own policy
reasons.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-27 18:04:14 -08:00
9b88fcef7d Makefile: use git-describe to mark the git version.
Note: with this commit, the GIT maintainer workflow must change.
GIT-VERSION-GEN is now the file to munge when the default
version needs to be changed, not Makefile.  The tag needs to be
pushed into the repository to build the official tarball and
binary package beforehand.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-27 17:57:28 -08:00
c06818e20a git-describe: documentation.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-27 17:57:28 -08:00
64deb858b0 git-describe: still prefer annotated tag under --all and --tags
Even though --all and --tags can be used to include non
annotated tags in the reference point candidates, prefer to use
annotated tags if there are more than one refs that name the
same commit.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-27 17:57:27 -08:00
2d9e7c9f90 git-describe: --tags and --abbrev
With --tags, not just annontated tags, but also any ref under
refs/tags/ are used to name the revision.

The number of digits is configurable with the --abbrev=<n> option.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-27 17:57:27 -08:00
4cdf78bf96 git-describe: use find_unique_abbrev()
Just in case 8 hexadecimal digits are not enough.  We could use
shorter default if we wanted to.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-27 17:57:27 -08:00
635d413430 git-describe: really prefer tags only.
Often there are references other than annotated tags under
refs/tags hierarchy that are used to "keep things just in case".
default to use annotated tags only, still leaving the option to
use any ref with --all flag.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-27 17:57:27 -08:00
908e5310b9 Add a "git-describe" command
It shows you the most recent tag that is reachable from a particular
commit is.

Maybe this is something that "git-name-rev" should be taught to do,
instead of having a separate command for it. Regardless, I find it useful.

What it does is to take any random commit, and "name" it by looking up the
most recent commit that is tagged and reachable from that commit. If the
match is exact, it will just print out that ref-name directly. Otherwise
it will print out the ref-name, followed by the 8-character "short SHA".

IOW, with something like Junios current tree, I get:

	[torvalds@g5 git]$ git-describe parent
	refs/tags/v1.0.4-g2414721b

ie the current head of my "parent" branch (ie Junio) is based on v1.0.4,
but since it has a few commits on top of that, it has added the git hash
of the thing to the end: "-g" + 8-char shorthand for the commit
2414721b19.

Doing a "git-describe" on a tag-name will just show the full tag path:

	[torvalds@g5 git]$ git-describe v1.0.4
	refs/tags/v1.0.4

unless there are _other_ tags pointing to that commit, in which case it
will just choose one at random.

This is useful for two things:

 - automatic version naming in Makefiles, for example. We could use it in
   git itself: when doing "git --version", we could use this to give a
   much more useful description of exactly what version was installed.

 - for any random commit (say, you use "gitk <pathname>" or
   "git-whatchanged" to look at what has changed in some file), you can
   figure out what the last version of the repo was. Ie, say I find a bug
   in commit 39ca371c45b04cd50d0974030ae051906fc516b6, I just do:

	[torvalds@g5 linux]$ git-describe 39ca371c45b04cd50d0974030ae051906fc516b6
	refs/tags/v2.6.14-rc4-g39ca371c

   and I now know that it was _not_ in v2.6.14-rc4, but was presumably in
   v2.6.14-rc5.

The latter is useful when you want to see what "version timeframe" a
commit happened in.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-27 17:57:27 -08:00
36cd2cc7d9 Do not mark tags fetched via --tags flag as mergeable
Otherwise "git pull --tags" would mistakenly try to merge all of
them, which is never what the user wants.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-27 11:52:51 -08:00
e9add36007 Fix bogus tests on rev-list output.
These tests seem to mean checking the output with expected
result, but was not doing its handrolled test helper function.

Also fix the guard to workaround wc output that have whitespace
padding, which was broken but not exposed because the test was
not testing it ;-).

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-27 11:08:57 -08:00
8eafa3da62 Guard a test against wc that pads its output with whitespace
Spotted by Johannes.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-27 11:08:57 -08:00
08337a97a2 copy_fd: close ifd on error
In copy_fd when write fails we ought to close input file descriptor.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-27 10:49:25 -08:00
36de72aa9d Merge fixes up to GIT 1.0.5 2005-12-26 18:45:30 -08:00
e5f5219a4f GIT 1.0.5
Minor fixes.

Starting from this one I won't be touching debian/ directory
since the official maintainer seems to be reasonably quick to
package up things.  The packaging procedure used there seems to
be quite different from what I have, so I'd like to avoid
potential confusion and reduce work by the official maintainer
and myself.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-26 18:44:15 -08:00
975b31dc6e Handle symlinks graciously
This patch converts a stat() to an lstat() call, thereby fixing the case
when the date of a symlink was not the same as the one recorded in the
index. The included test case demonstrates this.

This is for the case that the symlink points to a non-existing file. If
the file exists, worse things than just an error message happen.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-26 18:33:27 -08:00
c97451ce09 t5300: avoid false failures.
Johannes found that the test has 1/256 chance of falsely
producing an uncorrupted idx file, causing the check to detect
corruption fail.  Now we have 1/2^160 chance of false failure
;-).

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-26 18:23:41 -08:00
7e4a2a8483 avoid asking ?alloc() for zero bytes.
Avoid asking for zero bytes when that change simplifies overall
logic.  Later we would change the wrapper to ask for 1 byte on
platforms that return NULL for zero byte request.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-26 17:23:59 -08:00
7d6fb370bc short circuit out of a few places where we would allocate zero bytes
dietlibc versions of malloc, calloc and realloc all return NULL if
they're told to allocate 0 bytes, causes the x* wrappers to die().

There are several more places where these calls could end up asking
for 0 bytes, too...

Maybe simply not die()-ing in the x* wrappers if 0/NULL is returned
when the requested size is zero is a safer and easier way to go.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-26 08:59:21 -08:00
2ed7542fad Merge branch 'jc/checkout' 2005-12-25 23:30:15 -08:00
b74ed49735 Tutorial: mention shared repository management.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-24 00:21:11 -08:00
af6e277c5e git-init-db: initialize shared repositories with --shared
Now you can say

	git-init-db --shared

if you want other users to be able to push into that repository.

[jc: info/ and objects/info/ need to be group writable if the
 repository is shared --- otherwise packs and refs files cannot
 be updated.]

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-24 00:21:10 -08:00
457f06d68e Introduce core.sharedrepository
If the config variable 'core.sharedrepository' is set, the directories

	$GIT_DIR/objects/
	$GIT_DIR/objects/??
	$GIT_DIR/objects/pack
	$GIT_DIR/refs
	$GIT_DIR/refs/heads
	$GIT_DIR/refs/heads/tags

are set group writable (and g+s, since the git group may be not the primary
group of all users).

Since all files are written as lock files first, and then moved to
their destination, they do not have to be group writable.  Indeed, if
this leads to problems you found a bug.

Note that -- as in my first attempt -- the config variable is set in the
function which checks the repository format. If this were done in
git_default_config instead, a lot of programs would need to be modified
to call git_config(git_default_config) first.

[jc: git variables should be in environment.c unless there is a
 compelling reason to do otherwise.]

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-24 00:21:10 -08:00
2414721b19 Merge fixes up to GIT 1.0.4 2005-12-24 00:16:56 -08:00
6ab58895cd GIT 1.0.4
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-24 00:02:08 -08:00
ac44f3e7c0 mailinfo: iconv does not like "latin-1" -- should spell it "latin1"
This was a stupid typo that did not follow

	http://www.iana.org/assignments/character-sets

Long noticed but neglected by JC, but finally reported by
Marco.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-23 23:56:52 -08:00
9a84074d08 ls-files --full-name: usage string and documentation.
Somehow this option was not mentioned anywhere in the
documentation nor the usage string.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-23 15:51:33 -08:00
695bf722da merge --no-commit: tweak message
We did not distinguish the case the user asked not to make a
commit with --no-commit flag and the automerge failed.  Tell
these cases apart and phrase dying message differently.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-23 15:48:09 -08:00
056211053b git-clone: do not special case dumb http.
Underlying http-fetch is supposed to be capable of handling
packed repositories just fine, so no need to special case it in
the wrapper script.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-23 15:30:07 -08:00
bb5ebed731 show-branch: usability updates.
This does three things:

 . It simplifies the logic to handle the case in which no
   refs are given on the command line, and fixes the bug
   when only "--heads" is specified.  Earlier we showed
   them twice.

 . It avoids to add the same ref twice.

 . It sorts the glob result (e.g. "git show-branch
   'tags/v1.0*'") according to a more version friendly
   sort order.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-23 14:16:19 -08:00
c5ced64578 check_packed_git_idx(): check integrity of the idx file itself.
Although pack-check.c had routine to verify the checksum for the
pack index file itself, the core did not check it before using
it.

This is stolen from the patch to tighten packname requirements.

Signed-off-by: Junio C Hamano <junkio@cox.net>
(cherry picked from 797bd6f490 commit)
2005-12-23 14:14:28 -08:00
d0d14cf33d Adjust to ls-tree --full-name when run from a subdirectory.
A proposed change to show cwd relative paths by default from
ls-tree when run from a subdirectory means we would need to
give --full-name option to it.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-23 14:10:16 -08:00
a69dd585fc ls-tree: chomp leading directories when run from a subdirectory
When run from a subdirectory, even though we filtered the output
based on where we were using pathspec, we wrote out the
repository relative paths, not subtree relative paths.  This
changes things so that it shows only the current subdirectory
relative paths.

For example, in Documentation subdirectory of git itself, this
used to be the case:

    $ git-ls-tree --name-only HEAD | grep how
    Documentation/git-show-branch.txt
    Documentation/git-show-index.txt
    Documentation/howto-index.sh
    Documentation/howto

But now it does this instead:

    $ git-ls-tree --name-only HEAD | grep how
    git-show-branch.txt
    git-show-index.txt
    howto-index.sh
    howto

There are two things to keep in mind.

1. This shows nothing.

   $ git-ls-tree --name-only HEAD ../ppc/

   This is to make things consistent with ls-files, which
   refuses relative path that goes uplevel.

2. These show things in full repository relative paths.  In this
   case, paths outside the current subdirectory are also shown.

   $ git-ls-tree --name-only --full-name HEAD | grep how
   Documentation/git-show-branch.txt
   Documentation/git-show-index.txt
   Documentation/howto-index.sh
   Documentation/howto

   $ git-ls-tree --name-only --full-name HEAD ../ppc/
   ppc/sha1.c
   ppc/sha1.h
   ppc/sha1ppc.S

The flag --full-name gives the same behaviour as 1.0, so it
ought to be the default if we really care about the backward
compatibility, but in practice no Porcelain runs ls-tree from a
subdirectory yet, and without --full-name is more human
friendly, so hopefully the default being not --full-name would
be acceptable.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-23 14:01:32 -08:00
104f3e03c0 checkout: sometimes work from a subdirectory.
git-checkout does two very different things, and what they
should do when run from subdirectory are quite different.

It does not make any sense to run the one that switches the
current head from anywhere other than the toplevel:

	git-checkout [-f] <branch>
        git-checkout [-b <branch>] <committish>

We could of course chdir to top and do the whole-tree checkout
in git-checkout, but the point is the operation does not make
sense on a partial tree.  The whole tree is checked out.

The other form is to update the index file and working tree file
selectively:

	git-checkout <treeish> <file>... ;# out of tree to index and file
        git-checkout -- <file>...	 ;# out of index to file

This form _does_ make sense to run from subdirectory; and I
myself often wish we supported this.

So here is a patch to do both.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-22 23:16:55 -08:00
797bd6f490 check_packed_git_idx(): check integrity of the idx file itself.
Although pack-check.c had routine to verify the checksum for the
pack index file itself, the core did not check it before using
it.

This is stolen from the patch to tighten packname requirements.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-22 22:57:20 -08:00
5f94c730f3 rev-parse: --show-cdup
When --show-prefix is useful, sometimes it is easier to cd up to
the toplevel of the tree.  This is equivalent to:

    git rev-parse --show-prefix | sed -e 's|[^/][^/]*|..|g'

but we do not have to invoke sed for that.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-22 22:35:38 -08:00
c10d634518 Merge in fixes up to 1.0.3 maintenance branch.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-22 18:19:03 -08:00
c63da8d8e8 GIT 1.0.3
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-22 18:14:31 -08:00
e6c310fd0d git-clone: Support changing the origin branch with -o
Earlier, git-clone stored upstream's master in the branch named 'origin',
possibly overwriting an existing such branch.

Now you can change it by calling git-clone with '-o <other_name>'.

[jc: added ref format check, subdirectory safety, documentation
 and usage string.]

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-22 16:35:37 -08:00
1e80e04492 sha1_to_hex: properly terminate the SHA1
sha1_to_hex() returns a pointer to a static buffer. Some of its users
modify that buffer by appending a newline character. Other users rely
on the fact that you can call

	printf("%s", sha1_to_hex(sha1));

Just to be on the safe side, terminate the SHA1 in sha1_to_hex().

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-22 12:52:37 -08:00
a14c225661 Fix for http-fetch from file:// URLs
Recognize missing files when using http-fetch with file:// URLs

Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-22 12:52:35 -08:00
e99fcf96de git-format-patch should show the correct version
We want to record the version of the tools the patch was generated with.
While these tools could be rebuilt, git-format-patch stayed the same and
report the wrong version.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-22 12:52:29 -08:00
69310a34cb send-pack: reword non-fast-forward error message.
Wnen refusing to push a head, we said cryptic "remote 'branch'
object X does not exist on local" or "remote ref 'branch' is not
a strict subset of local ref 'branch'".  That was gittish.

Since the most likely reason this happens is because the pushed
head was not up-to-date, clarify the error message to say that
straight, and suggest pulling first.

First noticed by Johannes and seconded by Andreas.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-22 12:39:39 -08:00
356bece0a2 GIT: Support [address] in URLs
Allow IPv6address/IPvFuture enclosed by [] in URLs, like:
   git push '[3ffe:ffff:...:1]:GIT/git'
or
   git push 'ssh://[3ffe:ffff:...:1]/GIT/git'

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-21 23:48:56 -08:00
9b15770220 whatchanged: customize diff-tree output
This allows the configuration item whatchanged.difftree to
control the output from git-whatchanged command.  For example:

	[whatchanged]
        	difftree = --pretty=fuller --name-status -M

does rename detection, shows the commit header in "fuller"
format and lists affected pathnames and the kind of changes to
them.

When no such configuration item exists, the output format
defaults to "--pretty -M --abbrev".

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-21 23:48:45 -08:00
ebc12ce5bf Merge branch 'fixes' 2005-12-21 23:48:31 -08:00
7246ed438c \n usage in stderr output
fprintf and die sometimes have missing/excessive "\n" in their arguments,
correct the strings where I think it would be appropriate.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-21 23:09:40 -08:00
6d016c9c7f git-pack-redundant: speed and memory usage improvements
Slab allocation of llist entries gives some speed improvements.

Not computing the pack_list permutaions all at once reduces memory
usage greatly on repositories with many packs.

Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-21 23:02:33 -08:00
724b511d4f merge-recursive: conflicting rename case.
This changes the way the case two branches rename the same path
to different paths is handled.  Earlier, the code removed the
original path and added both destinations to the index at
stage0.  This commit changes it to leave the original path at
stage1, and two destination paths at stage2 and stage3,
respectively.

[jc: I am not really sure if this makes much difference in the
real life merge situations.  What should happen when our branch
renames A to B and M to N, while their branch renames A to M?
That is, M remains in our tree as is.]

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-21 22:34:59 -08:00
c894168631 Versioning scheme changes.
HPA suggests it is simply silly to imitate Linux versioning
scheme where the leading "2" does not mean anything anymore, and
I tend to agree.

The first feature release after 1.0.0 will be 1.1.0, and the
development path leading to 1.1.0 will carry 1.0.GIT as the
version number from now on.  Similarly, the third maintenance
release that follows 1.0.0 will not be 1.0.0c as planned, but
will be called 1.0.3.  The "maint" branch will merge in fixes
and immediately tagged, so there is no need for 1.0.2.GIT that
is in between 1.0.2 (aka 1.0.0b) and 1.0.3.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-21 22:33:37 -08:00
f4a11066cf sanity check in add_packed_git()
add_packed_git() tries to get the pack SHA1 by parsing its name.  It may
access uninitialized memory for packs with short names.

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-21 17:05:09 -08:00
2a212746f4 Merge branch 'fixes' 2005-12-21 14:00:47 -08:00
8d712aafd2 GIT 1.0.0b
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-21 13:51:51 -08:00
8ac4838af4 server-info: skip empty lines.
Now we allow an empty line in objects/info/packs file, recognize
that and stop complaining.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-21 13:48:47 -08:00
50e7b06730 [PATCH] quote.c: Make loop control more readable.
quote_c_style_counted() in quote.c uses a hard-to-read  construct.
Convert this to a more traditional form of the for loop.

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-21 13:28:24 -08:00
e4e79a2175 GIT 1.0.0a
- Avoid misleading success message on error (Johannes)
    - objects/info/packs: work around bug in http-fetch.c::fetch_indices()
    - http-fetch.c: fix objects/info/pack parsing.
    - An off-by-one bug found by valgrind (Pavel)

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-21 13:17:54 -08:00
6689f08735 An off-by-one bug found by valgrind
Insufficient memory is allocated in index-pack.c to hold the *.idx name.
One more byte should be allocated to hold the terminating 0.

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-21 13:00:31 -08:00
9470657ad0 Avoid misleading success message on error
When a push fails (for example when the remote head does not fast forward
to the desired ref) it is not correct to print "Everything up-to-date".

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-21 12:22:43 -08:00
455c161c47 http-fetch.c: fix objects/info/pack parsing.
It failed to register the last pack in the objects/info/packs
file.  Also it had an independent overrun error.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-21 12:13:53 -08:00
21b1aced83 objects/info/packs: work around bug in http-fetch.c::fetch_indices()
The code to fetch pack index files in deployed clients have a
bug that causes it to ignore the pack file on the last line of
objects/info/packs file, so append an empty line to work it
around.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-21 12:13:52 -08:00
5d9d11db3c Post 1.0.0 development track.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-21 12:12:26 -08:00
141 changed files with 1741 additions and 988 deletions

3
.gitignore vendored
View File

@ -1,3 +1,4 @@
GIT-VERSION-FILE
git git
git-add git-add
git-am git-am
@ -27,6 +28,7 @@ git-diff-files
git-diff-index git-diff-index
git-diff-stages git-diff-stages
git-diff-tree git-diff-tree
git-describe
git-fetch git-fetch
git-fetch-pack git-fetch-pack
git-findtags git-findtags
@ -119,3 +121,4 @@ git-core.spec
*.exe *.exe
libgit.a libgit.a
*.o *.o
*.py[co]

View File

@ -138,7 +138,7 @@ mailing list archives for details).
git has a couple of alternatives, though, that you may find sufficient git has a couple of alternatives, though, that you may find sufficient
or even superior depending on your use. One is called "git-whatchanged" or even superior depending on your use. One is called "git-whatchanged"
(for obvious reasons) and the other one is called "pickaxe" ("a tool for (for obvious reasons) and the other one is called "pickaxe" ("a tool for
the software archeologist"). the software archaeologist").
The "git-whatchanged" script is a truly trivial script that can give you The "git-whatchanged" script is a truly trivial script that can give you
a good overview of what has changed in a file or a directory (or an a good overview of what has changed in a file or a directory (or an

View File

@ -117,7 +117,7 @@ git specific extension to diff format
What -p option produces is slightly different from the What -p option produces is slightly different from the
traditional diff format. traditional diff format.
1. It is preceeded with a "git diff" header, that looks like 1. It is preceded with a "git diff" header, that looks like
this: this:
diff --git a/file1 b/file2 diff --git a/file1 b/file2

View File

@ -21,7 +21,7 @@
--abbrev[=<n>]:: --abbrev[=<n>]::
Instead of showing the full 40-byte hexadecimal object Instead of showing the full 40-byte hexadecimal object
name in diff-raw format output and diff-tree header name in diff-raw format output and diff-tree header
lines, show only handful dhexigits prefix. This is lines, show only handful hexdigits prefix. This is
independent of --full-index option above, which controls independent of --full-index option above, which controls
the diff-patch output format. Non default number of the diff-patch output format. Non default number of
digits can be specified with --abbrev=<n>. digits can be specified with --abbrev=<n>.

View File

@ -10,15 +10,23 @@
fetches is a descendant of `<lbranch>`. This option fetches is a descendant of `<lbranch>`. This option
overrides that check. overrides that check.
\--no-tags::
By default, `git-fetch` fetches tags that point at
objects that are downloaded from the remote repository
and stores them locally. This option disables this
automatic tag following.
-t, \--tags:: -t, \--tags::
By default, the git core utilities will not fetch and store Most of the tags are fetched automatically as branch
tags under the same name as the remote repository; ask it heads are downloaded, but tags that do not point at
to do so using `--tags`. Using this option will bound the objects reachable from the branch heads that are being
list of objects pulled to the remote tags. Commits in branches tracked will not be fetched by this mechanism. This
beyond the tags will be ignored. flag lets all tags and their associated objects be
downloaded.
-u, \--update-head-ok:: -u, \--update-head-ok::
By default `git-fetch` refuses to update the head which By default `git-fetch` refuses to update the head which
corresponds to the current branch. This flag disables the corresponds to the current branch. This flag disables the
check. Note that fetching into the current branch will not check. Note that fetching into the current branch will not
update the index and working directory, so use it with care. update the index and working directory, so use it with care.

View File

@ -31,7 +31,7 @@ DISCUSSION
---------- ----------
The list of <file> given to the command is fed to `git-ls-files` The list of <file> given to the command is fed to `git-ls-files`
command to list files that are not registerd in the index and command to list files that are not registered in the index and
are not ignored/excluded by `$GIT_DIR/info/exclude` file or are not ignored/excluded by `$GIT_DIR/info/exclude` file or
`.gitignore` file in each directory. This means two things: `.gitignore` file in each directory. This means two things:

View File

@ -8,6 +8,7 @@ git-am - Apply a series of patches in a mailbox
SYNOPSIS SYNOPSIS
-------- --------
[verse]
'git-am' [--signoff] [--dotest=<dir>] [--utf8] [--binary] [--3way] <mbox>... 'git-am' [--signoff] [--dotest=<dir>] [--utf8] [--binary] [--3way] <mbox>...
'git-am' [--skip | --resolved] 'git-am' [--skip | --resolved]

View File

@ -8,7 +8,10 @@ git-apply - Apply patch on a git index file and a work tree
SYNOPSIS SYNOPSIS
-------- --------
'git-apply' [--stat] [--numstat] [--summary] [--check] [--index] [--apply] [--no-add] [--index-info] [--allow-binary-replacement] [-z] [<patch>...] [verse]
'git-apply' [--stat] [--numstat] [--summary] [--check] [--index] [--apply]
[--no-add] [--index-info] [--allow-binary-replacement] [-z]
[<patch>...]
DESCRIPTION DESCRIPTION
----------- -----------

View File

@ -8,15 +8,15 @@ git-archimport - Import an Arch repository into git
SYNOPSIS SYNOPSIS
-------- --------
`git-archimport` [ -h ] [ -v ] [ -o ] [ -a ] [ -f ] [ -T ] [verse]
[ -D depth ] [ -t tempdir ] `git-archimport` [-h] [-v] [-o] [-a] [-f] [-T] [-D depth] [-t tempdir]
<archive/branch> [ <archive/branch> ] <archive/branch> [ <archive/branch> ]
DESCRIPTION DESCRIPTION
----------- -----------
Imports a project from one or more Arch repositories. It will follow branches Imports a project from one or more Arch repositories. It will follow branches
and repositories within the namespaces defined by the <archive/branch> and repositories within the namespaces defined by the <archive/branch>
parameters suppplied. If it cannot find the remote branch a merge comes from parameters supplied. If it cannot find the remote branch a merge comes from
it will just import it as a regular commit. If it can find it, it will mark it it will just import it as a regular commit. If it can find it, it will mark it
as a merge whenever possible (see discussion below). as a merge whenever possible (see discussion below).

View File

@ -8,7 +8,7 @@ git-cat-file - Provide content or type information for repository objects
SYNOPSIS SYNOPSIS
-------- --------
'git-cat-file' (-t | -s | -e | <type>) <object> 'git-cat-file' [-t | -s | -e | <type>] <object>
DESCRIPTION DESCRIPTION
----------- -----------

View File

@ -8,6 +8,7 @@ git-checkout-index - Copy files from the index to the working directory
SYNOPSIS SYNOPSIS
-------- --------
[verse]
'git-checkout-index' [-u] [-q] [-a] [-f] [-n] [--prefix=<string>] 'git-checkout-index' [-u] [-q] [-a] [-f] [-n] [--prefix=<string>]
[--stage=<number>] [--] <file>... [--stage=<number>] [--] <file>...

View File

@ -8,7 +8,9 @@ git-clone - Clones a repository.
SYNOPSIS SYNOPSIS
-------- --------
'git-clone' [-l [-s]] [-q] [-n] [-u <upload-pack>] <repository> [<directory>] [verse]
'git-clone' [-l [-s]] [-q] [-n] [-o <name>] [-u <upload-pack>]
<repository> [<directory>]
DESCRIPTION DESCRIPTION
----------- -----------
@ -56,6 +58,13 @@ OPTIONS
-n:: -n::
No checkout of HEAD is performed after the clone is complete. No checkout of HEAD is performed after the clone is complete.
-o <name>::
Instead of using the branch name 'origin' to keep track
of the upstream repository, use <name> instead. Note
that the shorthand name stored in `remotes/origin` is
not affected, but the local branch name to pull the
remote `master` branch into is.
--upload-pack <upload-pack>:: --upload-pack <upload-pack>::
-u <upload-pack>:: -u <upload-pack>::
When given, and the repository to clone from is handled When given, and the repository to clone from is handled

View File

@ -60,7 +60,8 @@ either `.git/config` file, or using the following environment variables.
(nb "<", ">" and "\n"s are stripped) (nb "<", ">" and "\n"s are stripped)
In `.git/config` file, the following items are used: In `.git/config` file, the following items are used for GIT_AUTHOR_NAME and
GIT_AUTHOR_EMAIL:
[user] [user]
name = "Your Name" name = "Your Name"

View File

@ -7,7 +7,9 @@ git-commit - Record your changes
SYNOPSIS SYNOPSIS
-------- --------
'git-commit' [-a] [-s] [-v] [(-c | -C) <commit> | -F <file> | -m <msg>] [-e] [--] <file>... [verse]
'git-commit' [-a] [-s] [-v] [(-c | -C) <commit> | -F <file> | -m <msg>]
[-e] [--] <file>...
DESCRIPTION DESCRIPTION
----------- -----------
@ -23,7 +25,9 @@ information.
OPTIONS OPTIONS
------- -------
-a|--all:: -a|--all::
Update all paths in the index file. Update all paths in the index file. This flag notices
files that have been modified and deleted, but new files
you have not told about git are not affected.
-c or -C <commit>:: -c or -C <commit>::
Take existing commit object, and reuse the log message Take existing commit object, and reuse the log message

View File

@ -8,8 +8,7 @@ git-cvsexportcommit - Export a commit to a CVS checkout
SYNOPSIS SYNOPSIS
-------- --------
git-cvsexportcommmit.perl 'git-cvsexportcommmit' [-h] [-v] [-c] [-p] [PARENTCOMMIT] COMMITID
[ -h ] [ -v ] [ -c ] [ -p ] [PARENTCOMMIT] COMMITID
DESCRIPTION DESCRIPTION

View File

@ -8,10 +8,10 @@ git-cvsimport - Import a CVS repository into git
SYNOPSIS SYNOPSIS
-------- --------
'git-cvsimport' [ -o <branch-for-HEAD> ] [ -h ] [ -v ] [verse]
[ -d <CVSROOT> ] [ -p <options-for-cvsps> ] 'git-cvsimport' [-o <branch-for-HEAD>] [-h] [-v] [-d <CVSROOT>] [-s <subst>]
[ -C <git_repository> ] [ -i ] [ -P <file> ] [ -k ] [-p <options-for-cvsps>] [-C <git_repository>] [-i] [-P <file>]
[ -s <subst> ] [ -m ] [ -M regex ] [ <CVS_module> ] [-m] [-M regex] [<CVS_module>]
DESCRIPTION DESCRIPTION

View File

@ -7,8 +7,10 @@ git-daemon - A really simple server for git repositories.
SYNOPSIS SYNOPSIS
-------- --------
[verse]
'git-daemon' [--verbose] [--syslog] [--inetd | --port=n] [--export-all] 'git-daemon' [--verbose] [--syslog] [--inetd | --port=n] [--export-all]
[--timeout=n] [--init-timeout=n] [--strict-paths] [directory...] [--timeout=n] [--init-timeout=n] [--strict-paths]
[--base-path=path] [directory...]
DESCRIPTION DESCRIPTION
----------- -----------
@ -35,6 +37,14 @@ OPTIONS
git-daemon will refuse to start when this option is enabled and no git-daemon will refuse to start when this option is enabled and no
whitelist is specified. whitelist is specified.
--base-path::
Remap all the path requests as relative to the given path.
This is sort of "GIT root" - if you run git-daemon with
'--base-path=/srv/git' on example.com, then if you later try to pull
'git://example.com/hello.git', `git-daemon` will interpret the path
as '/srv/git/hello.git'. Home directories (the '~login' notation)
access is disabled.
--export-all:: --export-all::
Allow pulling from all directories that look like GIT repositories Allow pulling from all directories that look like GIT repositories
(have the 'objects' and 'refs' subdirectories), even if they (have the 'objects' and 'refs' subdirectories), even if they

View File

@ -0,0 +1,79 @@
git-describe(1)
===============
NAME
----
git-describe - Show the most recent tag that is reachable from a commit.
SYNOPSIS
--------
'git-describe' [--all] [--tags] [--abbrev=<n>] <committish>...
DESCRIPTION
-----------
The command finds the most recent tag that is reachable from a
commit, and if the commit itself is pointed at by the tag, shows
the tag. Otherwise, it suffixes the tag name with abbreviated
object name of the commit.
OPTIONS
-------
<committish>::
The object name of the comittish.
--all::
Instead of using only the annotated tags, use any ref
found in `.git/refs/`.
--tags::
Instead of using only the annotated tags, use any tag
found in `.git/refs/tags`.
--abbrev=<n>::
Instead of using the default 8 hexadecimal digits as the
abbreviated object name, use <n> digits.
EXAMPLES
--------
With something like git.git current tree, I get:
[torvalds@g5 git]$ git-describe parent
v1.0.4-g2414721b
i.e. the current head of my "parent" branch is based on v1.0.4,
but since it has a few commits on top of that, it has added the
git hash of the thing to the end: "-g" + 8-char shorthand for
the commit `2414721b194453f058079d897d13c4e377f92dc6`.
Doing a "git-describe" on a tag-name will just show the tag name:
[torvalds@g5 git]$ git-describe v1.0.4
v1.0.4
With --all, the command can use branch heads as references, so
the output shows the reference path as well:
[torvalds@g5 git]$ git describe --all --abbrev=4 v1.0.5^2
tags/v1.0.0-g975b
[torvalds@g5 git]$ git describe --all HEAD^
heads/lt/describe-g975b
Author
------
Written by Linus Torvalds <torvalds@osdl.org>, but somewhat
butchered by Junio C Hamano <junkio@cox.net>
Documentation
--------------
Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
GIT
---
Part of the gitlink:git[7] suite

View File

@ -53,7 +53,7 @@ If '--cached' is specified, it allows you to ask:
contents (the ones I'd write with a "git-write-tree") contents (the ones I'd write with a "git-write-tree")
For example, let's say that you have worked on your working directory, updated For example, let's say that you have worked on your working directory, updated
some files in the index and are ready to commit. You want to see eactly some files in the index and are ready to commit. You want to see exactly
*what* you are going to commit is without having to write a new tree *what* you are going to commit is without having to write a new tree
object and compare it that way, and to do that, you just do object and compare it that way, and to do that, you just do
@ -110,7 +110,7 @@ NOTE: As with other commands of this type, "git-diff-index" does not
actually look at the contents of the file at all. So maybe actually look at the contents of the file at all. So maybe
`kernel/sched.c` hasn't actually changed, and it's just that you `kernel/sched.c` hasn't actually changed, and it's just that you
touched it. In either case, it's a note that you need to touched it. In either case, it's a note that you need to
"git-upate-index" it to make the index be in sync. "git-update-index" it to make the index be in sync.
NOTE: You can have a mixture of files show up as "has been updated" NOTE: You can have a mixture of files show up as "has been updated"
and "is still dirty in the working directory" together. You can always and "is still dirty in the working directory" together. You can always

View File

@ -8,7 +8,9 @@ git-diff-tree - Compares the content and mode of blobs found via two tree object
SYNOPSIS SYNOPSIS
-------- --------
'git-diff-tree' [--stdin] [-m] [-s] [-v] [--no-commit-id] [--pretty] [-t] [-r] [--root] [<common diff options>] <tree-ish> [<tree-ish>] [<path>...] [verse]
'git-diff-tree' [--stdin] [-m] [-s] [-v] [--no-commit-id] [--pretty] [-t] [-r]
[--root] [<common diff options>] <tree-ish> [<tree-ish>] [<path>...]
DESCRIPTION DESCRIPTION
----------- -----------
@ -62,7 +64,7 @@ separated with a single space are given.
-s:: -s::
By default, "git-diff-tree --stdin" shows differences, By default, "git-diff-tree --stdin" shows differences,
either in machine-readable form (without '-p') or in patch either in machine-readable form (without '-p') or in patch
form (with '-p'). This output can be supressed. It is form (with '-p'). This output can be suppressed. It is
only useful with '-v' flag. only useful with '-v' flag.
-v:: -v::

View File

@ -67,7 +67,7 @@ $ git diff HEAD^ HEAD <3>
<1> instead of using the tip of the current branch, compare with the <1> instead of using the tip of the current branch, compare with the
tip of "test" branch. tip of "test" branch.
<2> instead of comparing with the tip of "test" branch, compare with <2> instead of comparing with the tip of "test" branch, compare with
the tip of the curren branch, but limit the comparison to the the tip of the current branch, but limit the comparison to the
file "test". file "test".
<3> compare the version before the last commit and the last commit. <3> compare the version before the last commit and the last commit.
------------ ------------

View File

@ -8,7 +8,9 @@ git-format-patch - Prepare patches for e-mail submission.
SYNOPSIS SYNOPSIS
-------- --------
'git-format-patch' [-n | -k] [-o <dir> | --stdout] [-s] [-c] [--mbox] [--diff-options] <his> [<mine>] [verse]
'git-format-patch' [-n | -k] [-o <dir> | --stdout] [-s] [-c] [--mbox]
[--diff-options] <his> [<mine>]
DESCRIPTION DESCRIPTION
----------- -----------
@ -96,7 +98,7 @@ git-format-patch -M -B origin::
See Also See Also
-------- --------
gitlink:git-am[1], gitlink:git-send-email gitlink:git-am[1], gitlink:git-send-email[1]
Author Author

View File

@ -8,7 +8,9 @@ git-fsck-objects - Verifies the connectivity and validity of the objects in the
SYNOPSIS SYNOPSIS
-------- --------
'git-fsck-objects' [--tags] [--root] [--unreachable] [--cache] [--standalone | --full] [--strict] [<object>*] [verse]
'git-fsck-objects' [--tags] [--root] [--unreachable] [--cache]
[--standalone | --full] [--strict] [<object>*]
DESCRIPTION DESCRIPTION
----------- -----------

View File

@ -8,7 +8,7 @@ git-grep - print lines matching a pattern
SYNOPSIS SYNOPSIS
-------- --------
'git-grep' <option>... <pattern> <path>... 'git-grep' [<option>...] <pattern> [<path>...]
DESCRIPTION DESCRIPTION
----------- -----------
@ -27,7 +27,6 @@ OPTIONS
The pattern to look for. The pattern to look for.
<path>...:: <path>...::
Optional paths to limit the set of files to be searched; Optional paths to limit the set of files to be searched;
passed to `git-ls-files`. passed to `git-ls-files`.

View File

@ -3,12 +3,12 @@ git-http-fetch(1)
NAME NAME
---- ----
git-http-fetch - Downloads a remote git repository via HTTP git-http-fetch - downloads a remote git repository via HTTP
SYNOPSIS SYNOPSIS
-------- --------
'git-http-fetch' [-c] [-t] [-a] [-d] [-v] [-w filename] [--recover] commit-id url 'git-http-fetch' [-c] [-t] [-a] [-d] [-v] [-w filename] [--recover] <commit> <url>
DESCRIPTION DESCRIPTION
----------- -----------

View File

@ -8,7 +8,7 @@ git-init-db - Creates an empty git repository
SYNOPSIS SYNOPSIS
-------- --------
'git-init-db' [--template=<template_directory>] 'git-init-db' [--template=<template_directory>] [--shared]
OPTIONS OPTIONS
@ -16,6 +16,9 @@ OPTIONS
--template=<template_directory>:: --template=<template_directory>::
Provide the directory in from which templates will be used. Provide the directory in from which templates will be used.
--shared::
Specify that the git repository is to be shared amongst several users.
DESCRIPTION DESCRIPTION
----------- -----------
@ -30,7 +33,16 @@ If the object storage directory is specified via the `$GIT_OBJECT_DIRECTORY`
environment variable then the sha1 directories are created underneath - environment variable then the sha1 directories are created underneath -
otherwise the default `$GIT_DIR/objects` directory is used. otherwise the default `$GIT_DIR/objects` directory is used.
`git-init-db` won't hurt an existing repository. A shared repository allows users belonging to the same group to push into that
repository. When specifying `--shared` the config variable "core.sharedRepository"
is set to 'true' so that directories under `$GIT_DIR` are made group writable
(and g+sx, since the git group may be not the primary group of all users).
Running `git-init-db` in an existing repository is safe. It will not overwrite
things that are already there. The primary reason for rerunning `git-init-db`
is to pick up newly added templates.
EXAMPLES EXAMPLES

View File

@ -13,7 +13,8 @@ SYNOPSIS
(-[c|d|o|i|s|u|k|m])\* (-[c|d|o|i|s|u|k|m])\*
[-x <pattern>|--exclude=<pattern>] [-x <pattern>|--exclude=<pattern>]
[-X <file>|--exclude-from=<file>] [-X <file>|--exclude-from=<file>]
[--exclude-per-directory=<file>] [--] [<file>]\* [--exclude-per-directory=<file>]
[--full-name] [--] [<file>]\*
DESCRIPTION DESCRIPTION
----------- -----------
@ -73,10 +74,16 @@ OPTIONS
H:: cached H:: cached
M:: unmerged M:: unmerged
R:: removed/deleted R:: removed/deleted
C:: modifed/changed C:: modified/changed
K:: to be killed K:: to be killed
? other ? other
--full-name::
When run from a subdirectory, the command usually
outputs paths relative to the current directory. This
option forces paths to be output relative to the project
top directory.
--:: --::
Do not interpret any more arguments as options. Do not interpret any more arguments as options.

View File

@ -46,7 +46,7 @@ base-name::
output of the command. output of the command.
--stdout:: --stdout::
Write the pack contents (what would have been writtin to Write the pack contents (what would have been written to
.pack file) out to the standard output. .pack file) out to the standard output.
--window and --depth:: --window and --depth::

View File

@ -21,9 +21,9 @@ You can query/set/replace/unset options with this command. The name is
actually the section and the key separated by a dot, and the value will be actually the section and the key separated by a dot, and the value will be
escaped. escaped.
If you want to set/unset an option which can occor on multiple lines, you If you want to set/unset an option which can occur on multiple lines, you
should provide a POSIX regex for the value. If you want to handle the lines should provide a POSIX regex for the value. If you want to handle the lines
*not* matching the regex, just prepend a single exlamation mark in front *not* matching the regex, just prepend a single exclamation mark in front
(see EXAMPLES). (see EXAMPLES).
This command will fail if This command will fail if

View File

@ -145,6 +145,32 @@ brings your index file and the working tree back to that state,
and resets the tip of the branch to that commit. and resets the tip of the branch to that commit.
------------ ------------
Interrupted workflow::
+
You can get interrupted by an ungent fix request while you are
still in the middle of a large change. The files in your
working tree are not in any shape to be committed yet, but you
need to get to the other branch for a quick bugfix.
+
------------
$ git checkout feature ;# you were working in "feature" branch and
$ work work work ;# got interrupted
$ git commit -a -m 'snapshot WIP' <1>
$ git checkout master
$ fix fix fix
$ git commit ;# commit with real log
$ git checkout feature
$ git reset --soft HEAD^ ;# go back to WIP state <2>
$ git reset <3>
<1> This commit will get blown away so a throw-away log message is OK.
<2> This removes the 'WIP' commit from the commit history, and makes
your working tree in the state just before you made that snapshot.
<3> After <2>, the index file still has all the WIP changes you
committed in <1>. This sets it to the last commit you were
basing the WIP changes on.
------------
Author Author
------ ------
Written by Junio C Hamano <junkio@cox.net> and Linus Torvalds <torvalds@osdl.org> Written by Junio C Hamano <junkio@cox.net> and Linus Torvalds <torvalds@osdl.org>
@ -156,4 +182,3 @@ Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
GIT GIT
--- ---
Part of the gitlink:git[7] suite Part of the gitlink:git[7] suite

View File

@ -8,16 +8,17 @@ git-rev-list - Lists commit objects in reverse chronological order
SYNOPSIS SYNOPSIS
-------- --------
[verse]
'git-rev-list' [ \--max-count=number ] 'git-rev-list' [ \--max-count=number ]
[ \--max-age=timestamp ] [ \--max-age=timestamp ]
[ \--min-age=timestamp ] [ \--min-age=timestamp ]
[ \--sparse ] [ \--sparse ]
[ \--no-merges ] [ \--no-merges ]
[ \--all ] [ \--all ]
[ [ \--merge-order [ \--show-breaks ] ] | [ \--topo-order ] | ] [ [ \--merge-order [ \--show-breaks ] ] | [ \--topo-order ] ]
[ \--parents ] [ \--parents ]
[ \--objects [ \--unpacked ] ] [ \--objects [ \--unpacked ] ]
[ \--pretty | \--header | ] [ \--pretty | \--header ]
[ \--bisect ] [ \--bisect ]
<commit>... [ \-- <paths>... ] <commit>... [ \-- <paths>... ]
@ -129,7 +130,7 @@ the marked commit in the list.
+ +
Commits marked with (^) are not parents of the immediately preceding commit. Commits marked with (^) are not parents of the immediately preceding commit.
These "breaks" represent necessary discontinuities implied by trying to These "breaks" represent necessary discontinuities implied by trying to
represent an arbtirary DAG in a linear form. represent an arbitrary DAG in a linear form.
+ +
`--show-breaks` is only valid if `--merge-order` is also specified. `--show-breaks` is only valid if `--merge-order` is also specified.

View File

@ -68,10 +68,15 @@ OPTIONS
Show all refs found in `$GIT_DIR/refs`. Show all refs found in `$GIT_DIR/refs`.
--show-prefix:: --show-prefix::
When the command is invoked from a directory show the When the command is invoked from a subdirectory, show the
path of the current directory relative to the top-level path of the current directory relative to the top-level
directory. directory.
--show-cdup::
When the command is invoked from a subdirectory, show the
path of the top-level directory relative to the current
directory (typically a sequence of "../", or an empty string).
--since=datestring, --after=datestring:: --since=datestring, --after=datestring::
Parses the date string, and outputs corresponding Parses the date string, and outputs corresponding
--max-age= parameter for git-rev-list command. --max-age= parameter for git-rev-list command.

View File

@ -85,7 +85,7 @@ Following these N lines, one-line log for each commit is
displayed, indented N places. If a commit is on the I-th displayed, indented N places. If a commit is on the I-th
branch, the I-th indentation character shows a '+' sign; branch, the I-th indentation character shows a '+' sign;
otherwise it shows a space. Each commit shows a short name that otherwise it shows a space. Each commit shows a short name that
can be used as an exended SHA1 to name that commit. can be used as an extended SHA1 to name that commit.
The following example shows three branches, "master", "fixes" The following example shows three branches, "master", "fixes"
and "mhf": and "mhf":

View File

@ -11,7 +11,7 @@ SYNOPSIS
-------- --------
'git-svnimport' [ -o <branch-for-HEAD> ] [ -h ] [ -v ] [ -d | -D ] 'git-svnimport' [ -o <branch-for-HEAD> ] [ -h ] [ -v ] [ -d | -D ]
[ -C <GIT_repository> ] [ -i ] [ -u ] [-l limit_rev] [ -C <GIT_repository> ] [ -i ] [ -u ] [-l limit_rev]
[ -b branch_subdir ] [ -t trunk_subdir ] [ -T tag_subdir ] [ -b branch_subdir ] [ -T trunk_subdir ] [ -t tag_subdir ]
[ -s start_chg ] [ -m ] [ -M regex ] [ -s start_chg ] [ -m ] [ -M regex ]
<SVN_repository_URL> [ <path> ] <SVN_repository_URL> [ <path> ]
@ -40,17 +40,17 @@ OPTIONS
-s <start_rev>:: -s <start_rev>::
Start importing at this SVN change number. The default is 1. Start importing at this SVN change number. The default is 1.
+ +
When importing incementally, you might need to edit the .git/svn2git file. When importing incrementally, you might need to edit the .git/svn2git file.
-i:: -i::
Import-only: don't perform a checkout after importing. This option Import-only: don't perform a checkout after importing. This option
ensures the working directory and index remain untouched and will ensures the working directory and index remain untouched and will
not create them if they do not exist. not create them if they do not exist.
-t <trunk_subdir>:: -T <trunk_subdir>::
Name the SVN trunk. Default "trunk". Name the SVN trunk. Default "trunk".
-T <tag_subdir>:: -t <tag_subdir>::
Name the SVN subdirectory for tags. Default "tags". Name the SVN subdirectory for tags. Default "tags".
-b <branch_subdir>:: -b <branch_subdir>::

View File

@ -139,6 +139,9 @@ Interrogation commands
gitlink:git-cat-file[1]:: gitlink:git-cat-file[1]::
Provide content or type/size information for repository objects. Provide content or type/size information for repository objects.
gitlink:git-describe[1]::
Show the most recent tag that is reachable from a commit.
gitlink:git-diff-index[1]:: gitlink:git-diff-index[1]::
Compares content and mode of blobs between the index and repository. Compares content and mode of blobs between the index and repository.
@ -422,7 +425,7 @@ gitlink:git-rev-parse[1]::
gitlink:git-send-email[1]:: gitlink:git-send-email[1]::
Send patch e-mails out of "format-patch --mbox" output. Send patch e-mails out of "format-patch --mbox" output.
gitlink:git-symbolic-refs[1]:: gitlink:git-symbolic-ref[1]::
Read and modify symbolic refs. Read and modify symbolic refs.
gitlink:git-stripspace[1]:: gitlink:git-stripspace[1]::

View File

@ -19,7 +19,7 @@ hash::
In git's context, synonym to object name. In git's context, synonym to object name.
object database:: object database::
Stores a set of "objects", and an individial object is identified Stores a set of "objects", and an individual object is identified
by its object name. The objects usually live in `$GIT_DIR/objects/`. by its object name. The objects usually live in `$GIT_DIR/objects/`.
blob object:: blob object::
@ -111,6 +111,17 @@ branch::
a particular revision, which is called the branch head. The a particular revision, which is called the branch head. The
branch heads are stored in `$GIT_DIR/refs/heads/`. branch heads are stored in `$GIT_DIR/refs/heads/`.
master::
The default 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 development.
origin::
The default upstream branch. Most projects have one upstream
project which they track, and by default 'origin' is used for
that purpose. New updates from upstream will be fetched into
this branch; you should never commit to it yourself.
ref:: ref::
A 40-byte hex representation of a SHA1 pointing to a particular A 40-byte hex representation of a SHA1 pointing to a particular
object. These may be stored in `$GIT_DIR/refs/`. object. These may be stored in `$GIT_DIR/refs/`.

View File

@ -24,7 +24,7 @@ Then do
git bisect bad master <- mark "master" as the bad state git bisect bad master <- mark "master" as the bad state
git bisect good ORIG_HEAD <- mark ORIG_HEAD as good (or git bisect good ORIG_HEAD <- mark ORIG_HEAD as good (or
whatever other known-good whatever other known-good
thing you booted laste) thing you booted last)
and at this point "git bisect" will churn for a while, and tell you what and at this point "git bisect" will churn for a while, and tell you what
the mid-point between those two commits are, and check that state out as the mid-point between those two commits are, and check that state out as

View File

@ -134,9 +134,9 @@ is often useful.
+ +
Some short-cut notations are also supported. Some short-cut notations are also supported.
+ +
* For backward compatibility, `tag` is almost ignored; * `tag <tag>` means the same as `refs/tags/<tag>:refs/tags/<tag>`;
it just makes the following parameter <tag> to mean a used with pull or fetch, it requests fetching everything up to
refspec `refs/tags/<tag>:refs/tags/<tag>`. the given tag.
* A parameter <ref> without a colon is equivalent to * A parameter <ref> without a colon is equivalent to
<ref>: when pulling/fetching, and <ref>`:`<ref> when <ref>: when pulling/fetching, and <ref>`:`<ref> when
pushing. That is, do not store it locally if pushing. That is, do not store it locally if

View File

@ -21,7 +21,7 @@ outside world but sometimes useful for private repository.
. You can be using `objects/info/alternates` mechanism, or . You can be using `objects/info/alternates` mechanism, or
`$GIT_ALTERNATE_OBJECT_DIRECTORIES` mechanism to 'borrow' `$GIT_ALTERNATE_OBJECT_DIRECTORIES` mechanism to 'borrow'
objects from other object stores. A repository with this kind objects from other object stores. A repository with this kind
of incompete object store is not suitable to be published for of incomplete object store is not suitable to be published for
use with dumb transports but otherwise is OK as long as use with dumb transports but otherwise is OK as long as
`objects/info/alternates` points at the right object stores `objects/info/alternates` points at the right object stores
it borrows from. it borrows from.
@ -106,7 +106,7 @@ info/refs::
up-to-date if the repository is published for dumb up-to-date if the repository is published for dumb
transports. The `git-receive-pack` command, which is transports. The `git-receive-pack` command, which is
run on a remote repository when you `git push` into it, run on a remote repository when you `git push` into it,
runs `hooks/update` hook to help you achive this. runs `hooks/update` hook to help you achieve this.
info/grafts:: info/grafts::
This file records fake commit ancestry information, to This file records fake commit ancestry information, to

View File

@ -1695,6 +1695,24 @@ You still need to create UNIX user accounts for each developer,
and put them in the same group. Make sure that the repository and put them in the same group. Make sure that the repository
shared among these developers is writable by that group. shared among these developers is writable by that group.
. Initializing the shared repository with `git-init-db --shared`
helps somewhat.
. Run the following in the shared repository:
+
------------
$ chgrp -R $group repo.git
$ find repo.git -type d -print | xargs chmod ug+rwx,g+s
$ GIT_DIR=repo.git git repo-config core.sharedrepository true
------------
The above measures make sure that directories lazily created in
`$GIT_DIR` are writable by group members. You, as the
repository administrator, are still responsible to make sure
your developers belong to that shared repository group and set
their umask to a value no stricter than 027 (i.e. at least allow
reading and searching by group members).
You can implement finer grained branch policies using update You can implement finer grained branch policies using update
hooks. There is a document ("control access to branches") in hooks. There is a document ("control access to branches") in
Documentation/howto by Carl Baldwin and JC outlining how to (1) Documentation/howto by Carl Baldwin and JC outlining how to (1)

33
GIT-VERSION-GEN Executable file
View File

@ -0,0 +1,33 @@
#!/bin/sh
GVF=GIT-VERSION-FILE
DEF_VER=v1.1.GIT
# First try git-describe, then see if there is a version file
# (included in release tarballs), then default
VN=$(git-describe --abbrev=4 HEAD 2>/dev/null) ||
VN=$(cat version) ||
VN="$DEF_VER"
VN=$(expr "$VN" : v*'\(.*\)')
dirty=$(sh -c 'git-diff-index --name-only HEAD' 2>/dev/null) || dirty=
case "$dirty" in
'')
;;
*)
VN="$VN-dirty" ;;
esac
if test -r $GVF
then
VC=$(sed -e 's/^GIT_VERSION = //' <$GVF)
else
VC=unset
fi
test "$VN" = "$VC" || {
echo >&2 "GIT_VERSION = $VN"
echo "GIT_VERSION = $VN" >$GVF
}

View File

@ -55,7 +55,9 @@ all:
# Define USE_STDEV below if you want git to care about the underlying device # Define USE_STDEV below if you want git to care about the underlying device
# change being considered an inode change from the update-cache perspective. # change being considered an inode change from the update-cache perspective.
GIT_VERSION = 1.0.0 GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
@sh ./GIT-VERSION-GEN
-include GIT-VERSION-FILE
# CFLAGS and LDFLAGS are for the users to override from the command line. # CFLAGS and LDFLAGS are for the users to override from the command line.
@ -135,7 +137,8 @@ PROGRAMS = \
git-unpack-objects$X git-update-index$X git-update-server-info$X \ git-unpack-objects$X git-update-index$X git-update-server-info$X \
git-upload-pack$X git-verify-pack$X git-write-tree$X \ git-upload-pack$X git-verify-pack$X git-write-tree$X \
git-update-ref$X git-symbolic-ref$X git-check-ref-format$X \ git-update-ref$X git-symbolic-ref$X git-check-ref-format$X \
git-name-rev$X git-pack-redundant$X git-repo-config$X git-var$X git-name-rev$X git-pack-redundant$X git-repo-config$X git-var$X \
git-describe$X
# what 'all' will build and 'install' will install. # what 'all' will build and 'install' will install.
ALL_PROGRAMS = $(PROGRAMS) $(SIMPLE_PROGRAMS) $(SCRIPTS) git$X ALL_PROGRAMS = $(PROGRAMS) $(SIMPLE_PROGRAMS) $(SCRIPTS) git$X
@ -368,7 +371,7 @@ all: $(ALL_PROGRAMS)
all: all:
$(MAKE) -C templates $(MAKE) -C templates
git$X: git.c $(LIB_FILE) Makefile git$X: git.c $(LIB_FILE)
$(CC) -DGIT_EXEC_PATH='"$(bindir)"' -DGIT_VERSION='"$(GIT_VERSION)"' \ $(CC) -DGIT_EXEC_PATH='"$(bindir)"' -DGIT_VERSION='"$(GIT_VERSION)"' \
$(CFLAGS) $(COMPAT_CFLAGS) -o $@ $(filter %.c,$^) $(LIB_FILE) $(CFLAGS) $(COMPAT_CFLAGS) -o $@ $(filter %.c,$^) $(LIB_FILE)
@ -397,6 +400,13 @@ $(patsubst %.py,%,$(SCRIPT_PYTHON)) : % : %.py
git-cherry-pick: git-revert git-cherry-pick: git-revert
cp $< $@ cp $< $@
# These can record GIT_VERSION
git$X git.spec \
$(patsubst %.sh,%,$(SCRIPT_SH)) \
$(patsubst %.perl,%,$(SCRIPT_PERL)) \
$(patsubst %.py,%,$(SCRIPT_PYTHON)) \
: GIT-VERSION-FILE
%.o: %.c %.o: %.c
$(CC) -o $*.o -c $(ALL_CFLAGS) $< $(CC) -o $*.o -c $(ALL_CFLAGS) $<
%.o: %.S %.o: %.S
@ -471,7 +481,7 @@ install-doc:
### Maintainer's dist rules ### Maintainer's dist rules
git.spec: git.spec.in Makefile git.spec: git.spec.in
sed -e 's/@@VERSION@@/$(GIT_VERSION)/g' < $< > $@ sed -e 's/@@VERSION@@/$(GIT_VERSION)/g' < $< > $@
GIT_TARNAME=git-$(GIT_VERSION) GIT_TARNAME=git-$(GIT_VERSION)
@ -479,19 +489,15 @@ dist: git.spec git-tar-tree
./git-tar-tree HEAD $(GIT_TARNAME) > $(GIT_TARNAME).tar ./git-tar-tree HEAD $(GIT_TARNAME) > $(GIT_TARNAME).tar
@mkdir -p $(GIT_TARNAME) @mkdir -p $(GIT_TARNAME)
@cp git.spec $(GIT_TARNAME) @cp git.spec $(GIT_TARNAME)
$(TAR) rf $(GIT_TARNAME).tar $(GIT_TARNAME)/git.spec @echo $(GIT_VERSION) > $(GIT_TARNAME)/version
$(TAR) rf $(GIT_TARNAME).tar \
$(GIT_TARNAME)/git.spec $(GIT_TARNAME)/version
@rm -rf $(GIT_TARNAME) @rm -rf $(GIT_TARNAME)
gzip -f -9 $(GIT_TARNAME).tar gzip -f -9 $(GIT_TARNAME).tar
rpm: dist rpm: dist
$(RPMBUILD) -ta $(GIT_TARNAME).tar.gz $(RPMBUILD) -ta $(GIT_TARNAME).tar.gz
deb: dist
rm -rf $(GIT_TARNAME)
$(TAR) zxf $(GIT_TARNAME).tar.gz
dpkg-source -b $(GIT_TARNAME)
cd $(GIT_TARNAME) && fakeroot debian/rules binary
### Cleaning rules ### Cleaning rules
clean: clean:
@ -501,9 +507,11 @@ clean:
rm -f *.spec *.pyc *.pyo */*.pyc */*.pyo rm -f *.spec *.pyc *.pyo */*.pyc */*.pyo
rm -rf $(GIT_TARNAME) rm -rf $(GIT_TARNAME)
rm -f $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz rm -f $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz
rm -f git-core_$(GIT_VERSION)-*.dsc
rm -f git-*_$(GIT_VERSION)-*.deb
$(MAKE) -C Documentation/ clean $(MAKE) -C Documentation/ clean
$(MAKE) -C templates clean $(MAKE) -C templates clean
$(MAKE) -C t/ clean $(MAKE) -C t/ clean
rm -f GIT-VERSION-FILE
.PHONY: all install clean
.PHONY: .FORCE-GIT-VERSION-FILE

View File

@ -1588,7 +1588,7 @@ static int try_create_file(const char *path, unsigned int mode, const char *buf,
if (S_ISLNK(mode)) if (S_ISLNK(mode))
return symlink(buf, path); return symlink(buf, path);
fd = open(path, O_CREAT | O_EXCL | O_WRONLY | O_TRUNC, (mode & 0100) ? 0777 : 0666); fd = open(path, O_CREAT | O_EXCL | O_WRONLY, (mode & 0100) ? 0777 : 0666);
if (fd < 0) if (fd < 0)
return -1; return -1;
while (size) { while (size) {
@ -1635,6 +1635,7 @@ static void create_one_file(const char *path, unsigned mode, const char *buf, un
} }
if (errno != EEXIST) if (errno != EEXIST)
break; break;
++nr;
} }
} }
die("unable to write file %s mode %o", path, mode); die("unable to write file %s mode %o", path, mode);

2
blob.c
View File

@ -1,5 +1,5 @@
#include "blob.h"
#include "cache.h" #include "cache.h"
#include "blob.h"
#include <stdlib.h> #include <stdlib.h>
const char *blob_type = "blob"; const char *blob_type = "blob";

11
cache.h
View File

@ -81,7 +81,7 @@ struct cache_entry {
unsigned int ce_size; unsigned int ce_size;
unsigned char sha1[20]; unsigned char sha1[20];
unsigned short ce_flags; unsigned short ce_flags;
char name[0]; char name[FLEX_ARRAY]; /* more */
}; };
#define CE_NAMEMASK (0x0fff) #define CE_NAMEMASK (0x0fff)
@ -159,6 +159,7 @@ extern void rollback_index_file(struct cache_file *);
extern int trust_executable_bit; extern int trust_executable_bit;
extern int only_use_symrefs; extern int only_use_symrefs;
extern int diff_rename_limit_default; extern int diff_rename_limit_default;
extern int shared_repository;
#define GIT_REPO_VERSION 0 #define GIT_REPO_VERSION 0
extern int repository_format_version; extern int repository_format_version;
@ -183,6 +184,7 @@ extern const unsigned char null_sha1[20];
int git_mkstemp(char *path, size_t n, const char *template); int git_mkstemp(char *path, size_t n, const char *template);
int adjust_shared_perm(const char *path);
int safe_create_leading_directories(char *path); int safe_create_leading_directories(char *path);
char *safe_strncpy(char *, const char *, size_t); char *safe_strncpy(char *, const char *, size_t);
char *enter_repo(char *path, int strict); char *enter_repo(char *path, int strict);
@ -257,7 +259,7 @@ extern int checkout_entry(struct cache_entry *ce, struct checkout *state);
extern struct alternate_object_database { extern struct alternate_object_database {
struct alternate_object_database *next; struct alternate_object_database *next;
char *name; char *name;
char base[0]; /* more */ char base[FLEX_ARRAY]; /* more */
} *alt_odb_list; } *alt_odb_list;
extern void prepare_alt_odb(void); extern void prepare_alt_odb(void);
@ -271,7 +273,8 @@ extern struct packed_git {
unsigned int pack_use_cnt; unsigned int pack_use_cnt;
int pack_local; int pack_local;
unsigned char sha1[20]; unsigned char sha1[20];
char pack_name[0]; /* something like ".git/objects/pack/xxxxx.pack" */ /* something like ".git/objects/pack/xxxxx.pack" */
char pack_name[FLEX_ARRAY]; /* more */
} *packed_git; } *packed_git;
struct pack_entry { struct pack_entry {
@ -286,7 +289,7 @@ struct ref {
unsigned char new_sha1[20]; unsigned char new_sha1[20];
unsigned char force; unsigned char force;
struct ref *peer_ref; /* when renaming */ struct ref *peer_ref; /* when renaming */
char name[0]; char name[FLEX_ARRAY]; /* more */
}; };
extern int git_connect(int fd[2], char *url, const char *prog); extern int git_connect(int fd[2], char *url, const char *prog);

View File

@ -1,6 +1,6 @@
#include "cache.h"
#include "tag.h" #include "tag.h"
#include "commit.h" #include "commit.h"
#include "cache.h"
int save_commit_buffer = 1; int save_commit_buffer = 1;
@ -352,6 +352,21 @@ struct commit *pop_most_recent_commit(struct commit_list **list,
return ret; return ret;
} }
void clear_commit_marks(struct commit *commit, unsigned int mark)
{
struct commit_list *parents;
parents = commit->parents;
commit->object.flags &= ~mark;
while (parents) {
struct commit *parent = parents->item;
if (parent && parent->object.parsed &&
(parent->object.flags & mark))
clear_commit_marks(parent, mark);
parents = parents->next;
}
}
/* /*
* Generic support for pretty-printing the header * Generic support for pretty-printing the header
*/ */
@ -560,6 +575,9 @@ void sort_in_topological_order(struct commit_list ** list)
next = next->next; next = next->next;
count++; count++;
} }
if (!count)
return;
/* allocate an array to help sort the list */ /* allocate an array to help sort the list */
nodes = xcalloc(count, sizeof(*nodes)); nodes = xcalloc(count, sizeof(*nodes));
/* link the list to the array */ /* link the list to the array */

View File

@ -58,6 +58,8 @@ struct commit *pop_most_recent_commit(struct commit_list **list,
struct commit *pop_commit(struct commit_list **stack); struct commit *pop_commit(struct commit_list **stack);
void clear_commit_marks(struct commit *commit, unsigned int mark);
int count_parents(struct commit * commit); int count_parents(struct commit * commit);
/* /*

View File

@ -409,8 +409,7 @@ int git_config_set_multivar(const char* key, const char* value,
const char* value_regex, int multi_replace) const char* value_regex, int multi_replace)
{ {
int i; int i;
struct stat st; int fd, in_fd;
int fd;
char* config_filename = strdup(git_path("config")); char* config_filename = strdup(git_path("config"));
char* lock_file = strdup(git_path("config.lock")); char* lock_file = strdup(git_path("config.lock"));
const char* last_dot = strrchr(key, '.'); const char* last_dot = strrchr(key, '.');
@ -457,9 +456,17 @@ int git_config_set_multivar(const char* key, const char* value,
/* /*
* If .git/config does not exist yet, write a minimal version. * If .git/config does not exist yet, write a minimal version.
*/ */
if (stat(config_filename, &st)) { in_fd = open(config_filename, O_RDONLY);
if ( in_fd < 0 ) {
free(store.key); free(store.key);
if ( ENOENT != errno ) {
error("opening %s: %s", config_filename,
strerror(errno));
close(fd);
unlink(lock_file);
return 3; /* same as "invalid config file" */
}
/* if nothing to unset, error out */ /* if nothing to unset, error out */
if (value == NULL) { if (value == NULL) {
close(fd); close(fd);
@ -471,7 +478,7 @@ int git_config_set_multivar(const char* key, const char* value,
store_write_section(fd, key); store_write_section(fd, key);
store_write_pair(fd, key, value); store_write_pair(fd, key, value);
} else{ } else{
int in_fd; struct stat st;
char* contents; char* contents;
int i, copy_begin, copy_end, new_line = 0; int i, copy_begin, copy_end, new_line = 0;
@ -487,7 +494,7 @@ int git_config_set_multivar(const char* key, const char* value,
store.value_regex = (regex_t*)malloc(sizeof(regex_t)); store.value_regex = (regex_t*)malloc(sizeof(regex_t));
if (regcomp(store.value_regex, value_regex, if (regcomp(store.value_regex, value_regex,
REG_EXTENDED)) { REG_EXTENDED)) {
fprintf(stderr, "Invalid pattern: %s", fprintf(stderr, "Invalid pattern: %s\n",
value_regex); value_regex);
free(store.value_regex); free(store.value_regex);
return 6; return 6;
@ -528,7 +535,7 @@ int git_config_set_multivar(const char* key, const char* value,
return 5; return 5;
} }
in_fd = open(config_filename, O_RDONLY, 0666); fstat(in_fd, &st);
contents = mmap(NULL, st.st_size, PROT_READ, contents = mmap(NULL, st.st_size, PROT_READ,
MAP_PRIVATE, in_fd, 0); MAP_PRIVATE, in_fd, 0);
close(in_fd); close(in_fd);

View File

@ -34,10 +34,6 @@ struct ref **get_remote_heads(int in, struct ref **list,
die("protocol error: expected sha/ref, got '%s'", buffer); die("protocol error: expected sha/ref, got '%s'", buffer);
name = buffer + 41; name = buffer + 41;
if (ignore_funny && 45 < len && !memcmp(name, "refs/", 5) &&
check_ref_format(name + 5))
continue;
name_len = strlen(name); name_len = strlen(name);
if (len != name_len + 41) { if (len != name_len + 41) {
if (server_capabilities) if (server_capabilities)
@ -45,6 +41,10 @@ struct ref **get_remote_heads(int in, struct ref **list,
server_capabilities = strdup(name + name_len + 1); server_capabilities = strdup(name + name_len + 1);
} }
if (ignore_funny && 45 < len && !memcmp(name, "refs/", 5) &&
check_ref_format(name + 5))
continue;
if (nr_match && !path_match(name, nr_match, match)) if (nr_match && !path_match(name, nr_match, match))
continue; continue;
ref = xcalloc(1, sizeof(*ref) + len - 40); ref = xcalloc(1, sizeof(*ref) + len - 40);
@ -561,7 +561,8 @@ int git_connect(int fd[2], char *url, const char *prog)
{ {
char command[1024]; char command[1024];
char *host, *path = url; char *host, *path = url;
char *colon = NULL; char *end;
int c;
int pipefd[2][2]; int pipefd[2][2];
pid_t pid; pid_t pid;
enum protocol protocol = PROTO_LOCAL; enum protocol protocol = PROTO_LOCAL;
@ -571,15 +572,30 @@ int git_connect(int fd[2], char *url, const char *prog)
*host = '\0'; *host = '\0';
protocol = get_protocol(url); protocol = get_protocol(url);
host += 3; host += 3;
path = strchr(host, '/'); c = '/';
} } else {
else {
host = url; host = url;
if ((colon = strchr(host, ':'))) { c = ':';
protocol = PROTO_SSH;
*colon = '\0';
path = colon + 1;
} }
if (host[0] == '[') {
end = strchr(host + 1, ']');
if (end) {
*end = 0;
end++;
host++;
} else
end = host;
} else
end = host;
path = strchr(end, c);
if (c == ':') {
if (path) {
protocol = PROTO_SSH;
*path++ = '\0';
} else
path = host;
} }
if (!path || !*path) if (!path || !*path)

7
copy.c
View File

@ -22,13 +22,16 @@ int copy_fd(int ifd, int ofd)
buf += written; buf += written;
len -= written; len -= written;
} }
else if (!written) else if (!written) {
close(ifd);
return error("copy-fd: write returned 0"); return error("copy-fd: write returned 0");
else } else {
close(ifd);
return error("copy-fd: write returned %s", return error("copy-fd: write returned %s",
strerror(errno)); strerror(errno));
} }
} }
}
close(ifd); close(ifd);
return 0; return 0;
} }

View File

@ -15,7 +15,8 @@ static int verbose;
static const char daemon_usage[] = static const char daemon_usage[] =
"git-daemon [--verbose] [--syslog] [--inetd | --port=n] [--export-all]\n" "git-daemon [--verbose] [--syslog] [--inetd | --port=n] [--export-all]\n"
" [--timeout=n] [--init-timeout=n] [--strict-paths] [directory...]"; " [--timeout=n] [--init-timeout=n] [--strict-paths]\n"
" [--base-path=path] [directory...]";
/* List of acceptable pathname prefixes */ /* List of acceptable pathname prefixes */
static char **ok_paths = NULL; static char **ok_paths = NULL;
@ -24,6 +25,9 @@ static int strict_paths = 0;
/* If this is set, git-daemon-export-ok is not required */ /* If this is set, git-daemon-export-ok is not required */
static int export_all_trees = 0; static int export_all_trees = 0;
/* Take all paths relative to this one if non-NULL */
static char *base_path = NULL;
/* Timeout, and initial timeout */ /* Timeout, and initial timeout */
static unsigned int timeout = 0; static unsigned int timeout = 0;
static unsigned int init_timeout = 0; static unsigned int init_timeout = 0;
@ -138,6 +142,17 @@ static char *path_ok(char *dir)
return NULL; return NULL;
} }
if (base_path) {
static char rpath[PATH_MAX];
if (*dir != '/') {
/* Forbid possible base-path evasion using ~paths. */
logerror("'%s': Non-absolute path denied (base-path active)");
return NULL;
}
snprintf(rpath, PATH_MAX, "%s%s", base_path, dir);
dir = rpath;
}
path = enter_repo(dir, strict_paths); path = enter_repo(dir, strict_paths);
if (!path) { if (!path) {
@ -639,6 +654,10 @@ int main(int argc, char **argv)
strict_paths = 1; strict_paths = 1;
continue; continue;
} }
if (!strncmp(arg, "--base-path=", 12)) {
base_path = arg+12;
continue;
}
if (!strcmp(arg, "--")) { if (!strcmp(arg, "--")) {
ok_paths = &argv[i+1]; ok_paths = &argv[i+1];
break; break;

4
date.c
View File

@ -326,7 +326,7 @@ static int match_digit(const char *date, struct tm *tm, int *offset, int *tm_gmt
/* /*
* NOTE! We will give precedence to day-of-month over month or * NOTE! We will give precedence to day-of-month over month or
* year numebers in the 1-12 range. So 05 is always "mday 5", * year numbers in the 1-12 range. So 05 is always "mday 5",
* unless we already have a mday.. * unless we already have a mday..
* *
* IOW, 01 Apr 05 parses as "April 1st, 2005". * IOW, 01 Apr 05 parses as "April 1st, 2005".
@ -640,7 +640,7 @@ unsigned long approxidate(const char *date)
} }
if (number > 0 && number < 32) if (number > 0 && number < 32)
tm.tm_mday = number; tm.tm_mday = number;
if (tm.tm_mon > now.tm_mon) if (tm.tm_mon > now.tm_mon && tm.tm_year == now.tm_year)
tm.tm_year--; tm.tm_year--;
return mktime(&tm); return mktime(&tm);
} }

6
debian/.gitignore vendored
View File

@ -1,6 +0,0 @@
git-core
git-tk
*.debhelper
*.substvars
build-stamp
files

201
debian/changelog vendored
View File

@ -1,201 +0,0 @@
git-core (1.0.0-0) unstable; urgency=low
* GIT 1.0.0
-- Junio C Hamano <junkio@cox.net> Wed, 21 Dec 2005 00:01:00 -0800
git-core (0.99.9n-0) unstable; urgency=low
* GIT 0.99.9n aka 1.0rc6
-- Junio C Hamano <junkio@cox.net> Wed, 14 Dec 2005 17:27:08 -0800
git-core (0.99.9m-0) unstable; urgency=low
* GIT 0.99.9m aka 1.0rc5
-- Junio C Hamano <junkio@cox.net> Sun, 11 Dec 2005 16:48:06 -0800
git-core (0.99.9l-0) unstable; urgency=low
* GIT 0.99.9l aka 1.0rc4
-- Junio C Hamano <junkio@cox.net> Sat, 3 Dec 2005 23:45:23 -0800
git-core (0.99.9k-0) unstable; urgency=low
* GIT 0.99.9k but not 1.0rc yet.
-- Junio C Hamano <junkio@cox.net> Fri, 25 Nov 2005 16:33:11 -0800
git-core (0.99.9j-0) unstable; urgency=low
* GIT 0.99.9j aka 1.0rc3
-- Junio C Hamano <junkio@cox.net> Wed, 16 Nov 2005 20:39:55 -0800
git-core (0.99.9i-0) unstable; urgency=low
* GIT 0.99.9i aka 1.0rc2
-- Junio C Hamano <junkio@cox.net> Mon, 14 Nov 2005 18:38:27 -0800
git-core (0.99.9h-0) unstable; urgency=low
* GIT 0.99.9h
-- Junio C Hamano <junkio@cox.net> Fri, 11 Nov 2005 22:33:18 -0800
git-core (0.99.9g-0) unstable; urgency=low
* GIT 0.99.9g
-- Junio C Hamano <junkio@cox.net> Wed, 9 Nov 2005 21:01:55 -0800
git-core (0.99.9f-0) unstable; urgency=low
* GIT 0.99.9f
-- Junio C Hamano <junkio@cox.net> Tue, 8 Nov 2005 01:21:52 -0800
git-core (0.99.9e-0) unstable; urgency=low
* GIT 0.99.9e
-- Junio C Hamano <junkio@cox.net> Sun, 6 Nov 2005 18:37:18 -0800
git-core (0.99.9d-0) unstable; urgency=low
* GIT 0.99.9d
-- Junio C Hamano <junkio@cox.net> Sat, 5 Nov 2005 11:46:37 -0800
git-core (0.99.9c-0) unstable; urgency=low
* GIT 0.99.9c
-- Junio C Hamano <junkio@cox.net> Thu, 3 Nov 2005 15:44:54 -0800
git-core (0.99.9b-0) unstable; urgency=low
* GIT 0.99.9b
-- Junio C Hamano <junkio@cox.net> Tue, 1 Nov 2005 21:39:39 -0800
git-core (0.99.9a-0) unstable; urgency=low
* GIT 0.99.9a
-- Junio C Hamano <junkio@cox.net> Sun, 30 Oct 2005 15:03:32 -0800
git-core (0.99.9.GIT-2) unstable; urgency=low
* Build Dependency did not include libexpat-dev.
-- Junio C Hamano <junkio@cox.net> Sun, 13 Nov 2005 01:55:34 -0800
git-core (0.99.9.GIT-1) unstable; urgency=low
* Do not scatter txt and html documentation into feature
subpackages. Do place man pages into them.
* Capture more cvs stuff into git-cvs package.
-- Junio C Hamano <junkio@cox.net> Tue, 8 Nov 2005 01:19:06 -0800
git-core (0.99.9.GIT-0) unstable; urgency=low
* Test Build.
-- Junio C Hamano <junkio@cox.net> Sat, 5 Nov 2005 11:18:13 -0800
git-core (0.99.9-1) unstable; urgency=low
* Split the git-core binary package into core, doc, and foreign SCM
interoperability modules.
-- Junio C Hamano <junkio@cox.net> Sat, 5 Nov 2005 11:18:13 -0800
git-core (0.99.9-0) unstable; urgency=low
* GIT 0.99.9
-- Junio C Hamano <junkio@cox.net> Sat, 29 Oct 2005 14:34:30 -0700
git-core (0.99.8-0) unstable; urgency=low
* GIT 0.99.8
-- Junio C Hamano <junkio@cox.net> Sun, 2 Oct 2005 12:54:26 -0700
git-core (0.99.7-0) unstable; urgency=low
* GIT 0.99.7
-- Junio C Hamano <junkio@cox.net> Sat, 10 Sep 2005 18:36:39 -0700
git-core (0.99.6-0) unstable; urgency=low
* GIT 0.99.6
-- Junio C Hamano <junkio@cox.net> Wed, 24 Aug 2005 23:09:35 -0700
git-core (0.99.5-1) unstable; urgency=low
* Enable git-send-email on Debian. There is no reason to shy
away from it, since we have the necessary Perl modules available.
-- Junio C Hamano <junkio@cox.net> Thu, 25 Aug 2005 14:16:59 -0700
git-core (0.99.5-0) unstable; urgency=low
* GIT 0.99.5
-- Junio C Hamano <junkio@cox.net> Wed, 10 Aug 2005 22:05:00 -0700
git-core (0.99.4-4) unstable; urgency=low
* Mark git-tk as architecture neutral.
-- Junio C Hamano <junkio@cox.net> Fri, 12 Aug 2005 13:25:00 -0700
git-core (0.99.4-3) unstable; urgency=low
* Split off gitk.
* Do not depend on diff which is an essential package.
* Use dh_movefiles, not dh_install, to stage two subpackages.
-- Matthias Urlichs <smurf@debian.org> Thu, 11 Aug 2005 01:43:24 +0200
git-core (0.99.4-2) unstable; urgency=low
* Git 0.99.4 official release.
-- Junio C Hamano <junkio@cox.net> Wed, 10 Aug 2005 15:00:00 -0700
git-core (0.99.4-1) unstable; urgency=low
* Pass prefix down to the submake when building.
-- Junio C Hamano <junkio@cox.net> Sat, 6 Aug 2005 13:00:00 -0700
git-core (0.99-2) unstable; urgency=low
* Conflict with the GNU Interactive Tools package, which also installs
/usr/bin/git.
* Use the Mozilla SHA1 code and/or the PPC assembly in preference to
OpenSSL. This is only a partial fix for the license issues with OpenSSL.
* Minor tweaks to the Depends.
-- Ryan Anderson <ryan@michonline.com> Sat, 23 Jul 2005 14:15:00 -0400
git-core (0.99-1) unstable; urgency=low
* Update deb package support to build correctly.
-- Ryan Anderson <ryan@michonline.com> Thu, 21 Jul 2005 02:03:32 -0400
git-core (0.99-0) unstable; urgency=low
* Initial deb package support
-- Eric Biederman <ebiederm@xmission.com> Tue, 12 Jul 2005 10:57:51 -0600

1
debian/compat vendored
View File

@ -1 +0,0 @@
4

63
debian/control vendored
View File

@ -1,63 +0,0 @@
Source: git-core
Section: devel
Priority: optional
Maintainer: Junio C Hamano <junkio@cox.net>
Build-Depends-Indep: libz-dev, libssl-dev, libcurl3-dev|libcurl3-gnutls-dev|libcurl3-openssl-dev, asciidoc (>= 7), xmlto, debhelper (>= 4.0.0), bc, libexpat-dev
Standards-Version: 3.6.1
Package: git-core
Architecture: any
Depends: ${shlibs:Depends}, ${perl:Depends}, ${misc:Depends}, rcs
Recommends: rsync, curl, ssh, python (>= 2.4.0), less
Suggests: cogito, patch
Conflicts: git, cogito (<< 0.13)
Description: The git content addressable filesystem
GIT comes in two layers. The bottom layer is merely an extremely fast
and flexible filesystem-based database designed to store directory trees
with regard to their history. The top layer is a SCM-like tool which
enables human beings to work with the database in a manner to a degree
similar to other SCM tools.
Package: git-doc
Architecture: all
Depends: ${shlibs:Depends}, ${misc:Depends}, git-core
Description: The git content addressable filesystem, Documentation
This package contains documentation for GIT.
Package: git-tk
Architecture: all
Depends: ${shlibs:Depends}, ${misc:Depends}, git-core, tk8.4
Description: The git content addressable filesystem, GUI add-on
This package contains 'gitk', the git revision tree visualizer.
Package: git-svn
Architecture: all
Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, git-core, libsvn-core-perl (>= 1.2.1)
Suggests: subversion
Description: The git content addressable filesystem, SVN interoperability
This package contains 'git-svnimport', to import development history from
SVN repositories.
Package: git-arch
Architecture: all
Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, git-core
Suggests: tla, bazaar
Description: The git content addressable filesystem, GNUArch interoperability
This package contains 'git-archimport', to import development history from
GNUArch repositories.
Package: git-cvs
Architecture: all
Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, git-core, cvsps (>= 2.1)
Suggests: cvs
Description: The git content addressable filesystem, CVS interoperability
This package contains 'git-cvsimport', to import development history from
CVS repositories.
Package: git-email
Architecture: all
Depends: ${shlibs:Depends}, ${misc:Depends}, git-core, libmail-sendmail-perl, libemail-valid-perl
Description: The git content addressable filesystem, e-mail add-on
This package contains 'git-send-email', to send a series of patch e-mails.

24
debian/copyright vendored
View File

@ -1,24 +0,0 @@
This package was downloaded from ftp.kernel.org:/pub/software/scm/git/.
Upstream Author: Linus Torvalds and many others
Copyright:
Copyright 2005, Linus Torvalds and others.
This package is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 dated June, 1991.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this package; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
On Debian GNU/Linux systems, the complete text of the GNU General
Public License can be found in `/usr/share/common-licenses/GPL'.

1
debian/docs vendored
View File

@ -1 +0,0 @@
README

View File

@ -1,2 +0,0 @@
/usr/bin/git-arch*
/usr/share/man/*/git-arch*

View File

@ -1,13 +0,0 @@
Document: git-core
Title: git reference
Abstract: This manual describes git
Section: Devel
Format: HTML
Index: /usr/share/doc/git-core/git.html
Files: /usr/share/doc/git-core/*.html
/usr/share/doc/git-core/*/*.html
Format: text
Files: /usr/share/doc/git-core/*.txt
/usr/share/doc/git-core/*/*.txt

View File

@ -1 +0,0 @@
/usr

View File

@ -1,2 +0,0 @@
/usr/bin/git-cvs*
/usr/share/man/*/git-cvs*

View File

@ -1,4 +0,0 @@
/usr/share/doc/git-core/*.txt
/usr/share/doc/git-core/*.html
/usr/share/doc/git-core/*/*.html
/usr/share/doc/git-core/*/*.txt

View File

@ -1,2 +0,0 @@
/usr/bin/git-send-email
/usr/share/man/*/git-send-email.*

View File

@ -1,2 +0,0 @@
/usr/bin/git-svn*
/usr/share/man/*/git-svn*

2
debian/git-tk.files vendored
View File

@ -1,2 +0,0 @@
/usr/bin/gitk
/usr/share/man/man1/gitk.*

109
debian/rules vendored
View File

@ -1,109 +0,0 @@
#!/usr/bin/make -f
# -*- makefile -*-
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
CFLAGS = -g -Wall
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
else
CFLAGS += -O2
endif
export CFLAGS
#
# On PowerPC we compile against the hand-crafted assembly, on all
# other architectures we compile against GPL'ed sha1 code lifted
# from Mozilla. OpenSSL is strangely licensed and best avoided
# in Debian.
#
HOST_ARCH=$(shell dpkg-architecture -qDEB_HOST_ARCH)
ifeq (${HOST_ARCH},powerpc)
export PPC_SHA1=YesPlease
else
export MOZILLA_SHA1=YesPlease
endif
# We do have the requisite perl modules in the mainline, and
# have no reason to shy away from this script.
export WITH_SEND_EMAIL=YesPlease
PREFIX := /usr
MANDIR := /usr/share/man/
SRC := ./
DOC := Documentation/
DESTDIR := $(CURDIR)/debian/tmp
DOC_DESTDIR := $(DESTDIR)/usr/share/doc/git-core/
MAN_DESTDIR := $(DESTDIR)/$(MANDIR)
build: debian/build-stamp
debian/build-stamp:
dh_testdir
$(MAKE) prefix=$(PREFIX) PYTHON_PATH=/usr/bin/python2.4 all test doc
touch debian/build-stamp
debian-clean:
dh_testdir
dh_testroot
rm -f debian/build-stamp
dh_clean
clean: debian-clean
$(MAKE) clean
install: build
dh_testdir
dh_testroot
dh_clean -k
dh_installdirs
make DESTDIR=$(DESTDIR) prefix=$(PREFIX) mandir=$(MANDIR) \
install install-doc
make -C Documentation DESTDIR=$(DESTDIR) prefix=$(PREFIX) \
WEBDOC_DEST=$(DOC_DESTDIR) install-webdoc
dh_movefiles -p git-arch
dh_movefiles -p git-cvs
dh_movefiles -p git-svn
dh_movefiles -p git-tk
dh_movefiles -p git-email
dh_movefiles -p git-doc
dh_movefiles -p git-core
find debian/tmp -type d -o -print | sed -e 's/^/? /'
binary-arch: build install
dh_testdir
dh_testroot
dh_installchangelogs -a
dh_installdocs -a
dh_strip -a
dh_compress -a
dh_fixperms -a
dh_perl -a
dh_makeshlibs -a
dh_installdeb -a
dh_shlibdeps -a
dh_gencontrol -a
dh_md5sums -a
dh_builddeb -a
binary-indep: build install
dh_testdir
dh_testroot
dh_installchangelogs -i
dh_installdocs -i
dh_compress -i
dh_fixperms -i
dh_makeshlibs -i
dh_installdeb -i
dh_shlibdeps -i
dh_gencontrol -i
dh_md5sums -i
dh_builddeb -i
binary: binary-arch binary-indep
.PHONY: build clean binary install clean debian-clean

166
describe.c Normal file
View File

@ -0,0 +1,166 @@
#include "cache.h"
#include "commit.h"
#include "tag.h"
#include "refs.h"
#define SEEN (1u << 0)
static const char describe_usage[] =
"git-describe [--all] [--tags] [--abbrev=<n>] <committish>*";
static int all = 0; /* Default to annotated tags only */
static int tags = 0; /* But allow any tags if --tags is specified */
#define DEFAULT_ABBREV 8 /* maybe too many */
static int abbrev = DEFAULT_ABBREV;
static int names = 0, allocs = 0;
static struct commit_name {
const struct commit *commit;
int prio; /* annotated tag = 2, tag = 1, head = 0 */
char path[FLEX_ARRAY]; /* more */
} **name_array = NULL;
static struct commit_name *match(struct commit *cmit)
{
int i = names;
struct commit_name **p = name_array;
while (i-- > 0) {
struct commit_name *n = *p++;
if (n->commit == cmit)
return n;
}
return NULL;
}
static void add_to_known_names(const char *path,
const struct commit *commit,
int prio)
{
int idx;
int len = strlen(path)+1;
struct commit_name *name = xmalloc(sizeof(struct commit_name) + len);
name->commit = commit;
name->prio = prio;
memcpy(name->path, path, len);
idx = names;
if (idx >= allocs) {
allocs = (idx + 50) * 3 / 2;
name_array = xrealloc(name_array, allocs*sizeof(*name_array));
}
name_array[idx] = name;
names = ++idx;
}
static int get_name(const char *path, const unsigned char *sha1)
{
struct commit *commit = lookup_commit_reference_gently(sha1, 1);
struct object *object;
int prio;
if (!commit)
return 0;
object = parse_object(sha1);
/* If --all, then any refs are used.
* If --tags, then any tags are used.
* Otherwise only annotated tags are used.
*/
if (!strncmp(path, "refs/tags/", 10)) {
if (object->type == tag_type)
prio = 2;
else
prio = 1;
}
else
prio = 0;
if (!all) {
if (!prio)
return 0;
if (!tags && prio < 2)
return 0;
}
add_to_known_names(all ? path + 5 : path + 10, commit, prio);
return 0;
}
static int compare_names(const void *_a, const void *_b)
{
struct commit_name *a = *(struct commit_name **)_a;
struct commit_name *b = *(struct commit_name **)_b;
unsigned long a_date = a->commit->date;
unsigned long b_date = b->commit->date;
if (a->prio != b->prio)
return b->prio - a->prio;
return (a_date > b_date) ? -1 : (a_date == b_date) ? 0 : 1;
}
static void describe(struct commit *cmit, int last_one)
{
struct commit_list *list;
static int initialized = 0;
struct commit_name *n;
if (!initialized) {
initialized = 1;
for_each_ref(get_name);
qsort(name_array, names, sizeof(*name_array), compare_names);
}
n = match(cmit);
if (n) {
printf("%s\n", n->path);
return;
}
list = NULL;
commit_list_insert(cmit, &list);
while (list) {
struct commit *c = pop_most_recent_commit(&list, SEEN);
n = match(c);
if (n) {
printf("%s-g%s\n", n->path,
find_unique_abbrev(cmit->object.sha1, abbrev));
if (!last_one)
clear_commit_marks(cmit, SEEN);
return;
}
}
die("cannot describe '%s'", sha1_to_hex(cmit->object.sha1));
}
int main(int argc, char **argv)
{
int i;
for (i = 1; i < argc; i++) {
const char *arg = argv[i];
unsigned char sha1[20];
struct commit *cmit;
if (!strcmp(arg, "--all")) {
all = 1;
continue;
}
if (!strcmp(arg, "--tags")) {
tags = 1;
continue;
}
if (!strncmp(arg, "--abbrev=", 9)) {
abbrev = strtoul(arg + 9, NULL, 10);
if (abbrev < 4 || 40 <= abbrev)
abbrev = DEFAULT_ABBREV;
continue;
}
if (get_sha1(arg, sha1) < 0)
usage(describe_usage);
cmit = lookup_commit_reference(sha1);
if (!cmit)
usage(describe_usage);
describe(cmit, i == argc - 1);
}
return 0;
}

View File

@ -116,7 +116,7 @@ static int diff_cache(struct cache_entry **ac, int entries, const char **pathspe
/* We come here with ce pointing at stage 1 /* We come here with ce pointing at stage 1
* (original tree) and ac[1] pointing at stage * (original tree) and ac[1] pointing at stage
* 3 (unmerged). show-modified with * 3 (unmerged). show-modified with
* report-mising set to false does not say the * report-missing set to false does not say the
* file is deleted but reports true if work * file is deleted but reports true if work
* tree does not have it, in which case we * tree does not have it, in which case we
* fall through to report the unmerged state. * fall through to report the unmerged state.

10
diff.c
View File

@ -504,9 +504,9 @@ static void prepare_temp_file(const char *name,
} }
if (S_ISLNK(st.st_mode)) { if (S_ISLNK(st.st_mode)) {
int ret; int ret;
char *buf, buf_[1024]; char buf[PATH_MAX + 1]; /* ought to be SYMLINK_MAX */
buf = ((sizeof(buf_) < st.st_size) ? if (sizeof(buf) <= st.st_size)
xmalloc(st.st_size) : buf_); die("symlink too long: %s", name);
ret = readlink(name, buf, st.st_size); ret = readlink(name, buf, st.st_size);
if (ret < 0) if (ret < 0)
die("readlink(%s)", name); die("readlink(%s)", name);
@ -650,7 +650,7 @@ static void diff_fill_sha1_info(struct diff_filespec *one)
if (DIFF_FILE_VALID(one)) { if (DIFF_FILE_VALID(one)) {
if (!one->sha1_valid) { if (!one->sha1_valid) {
struct stat st; struct stat st;
if (stat(one->path, &st) < 0) if (lstat(one->path, &st) < 0)
die("stat %s", one->path); die("stat %s", one->path);
if (index_path(one->sha1, one->path, &st, 0)) if (index_path(one->sha1, one->path, &st, 0))
die("cannot hash %s\n", one->path); die("cannot hash %s\n", one->path);
@ -787,7 +787,7 @@ int diff_setup_done(struct diff_options *options)
* so it is safe for us to do this here. Also * so it is safe for us to do this here. Also
* it does not smudge active_cache or active_nr * it does not smudge active_cache or active_nr
* when it fails, so we do not have to worry about * when it fails, so we do not have to worry about
* cleaning it up oufselves either. * cleaning it up ourselves either.
*/ */
read_cache(); read_cache();
} }

View File

@ -105,9 +105,13 @@ static int compare_pair_order(const void *a_, const void *b_)
void diffcore_order(const char *orderfile) void diffcore_order(const char *orderfile)
{ {
struct diff_queue_struct *q = &diff_queued_diff; struct diff_queue_struct *q = &diff_queued_diff;
struct pair_order *o = xmalloc(sizeof(*o) * q->nr); struct pair_order *o;
int i; int i;
if (!q->nr)
return;
o = xmalloc(sizeof(*o) * q->nr);
prepare_order(orderfile); prepare_order(orderfile);
for (i = 0; i < q->nr; i++) { for (i = 0; i < q->nr; i++) {
o[i].pair = q->queue[i]; o[i].pair = q->queue[i];

View File

@ -48,6 +48,9 @@ void diffcore_pathspec(const char **pathspec)
for (i = 0; pathspec[i]; i++) for (i = 0; pathspec[i]; i++)
; ;
speccnt = i; speccnt = i;
if (!speccnt)
return;
spec = xmalloc(sizeof(*spec) * speccnt); spec = xmalloc(sizeof(*spec) * speccnt);
for (i = 0; pathspec[i]; i++) { for (i = 0; pathspec[i]; i++) {
spec[i].spec = pathspec[i]; spec[i].spec = pathspec[i];

View File

@ -282,7 +282,7 @@ void diffcore_rename(struct diff_options *options)
else if (detect_rename == DIFF_DETECT_COPY) else if (detect_rename == DIFF_DETECT_COPY)
register_rename_src(p->one, 1); register_rename_src(p->one, 1);
} }
if (rename_dst_nr == 0 || if (rename_dst_nr == 0 || rename_src_nr == 0 ||
(0 < rename_limit && rename_limit < rename_dst_nr)) (0 < rename_limit && rename_limit < rename_dst_nr))
goto cleanup; /* nothing to do */ goto cleanup; /* nothing to do */

View File

@ -15,7 +15,7 @@
* passed around in one int (high 16-bit for merge and low 16-bit * passed around in one int (high 16-bit for merge and low 16-bit
* for break). * for break).
*/ */
#define MAX_SCORE 60000 #define MAX_SCORE 60000.0
#define DEFAULT_RENAME_SCORE 30000 /* rename/copy similarity minimum (50%) */ #define DEFAULT_RENAME_SCORE 30000 /* rename/copy similarity minimum (50%) */
#define DEFAULT_BREAK_SCORE 30000 /* minimum for break to happen (50%)*/ #define DEFAULT_BREAK_SCORE 30000 /* minimum for break to happen (50%)*/
#define DEFAULT_MERGE_SCORE 48000 /* maximum for break-merge to happen (80%)*/ #define DEFAULT_MERGE_SCORE 48000 /* maximum for break-merge to happen (80%)*/

View File

@ -60,7 +60,7 @@ static void remove_subtree(const char *path)
static int create_file(const char *path, unsigned int mode) static int create_file(const char *path, unsigned int mode)
{ {
mode = (mode & 0100) ? 0777 : 0666; mode = (mode & 0100) ? 0777 : 0666;
return open(path, O_WRONLY | O_TRUNC | O_CREAT | O_EXCL, mode); return open(path, O_WRONLY | O_CREAT | O_EXCL, mode);
} }
static int write_entry(struct cache_entry *ce, const char *path, struct checkout *state) static int write_entry(struct cache_entry *ce, const char *path, struct checkout *state)

View File

@ -15,6 +15,7 @@ int trust_executable_bit = 1;
int only_use_symrefs = 0; int only_use_symrefs = 0;
int repository_format_version = 0; int repository_format_version = 0;
char git_commit_encoding[MAX_ENCODING_LENGTH] = "utf-8"; char git_commit_encoding[MAX_ENCODING_LENGTH] = "utf-8";
int shared_repository = 0;
static char *git_dir, *git_object_dir, *git_index_file, *git_refs_dir, static char *git_dir, *git_object_dir, *git_index_file, *git_refs_dir,
*git_graft_file; *git_graft_file;

View File

@ -190,7 +190,7 @@ static void free_mass_counter(struct mass_counter *counter)
* enqueued, enqueuing the commit in a list of pending commits, in latest * enqueued, enqueuing the commit in a list of pending commits, in latest
* commit date first order. * commit date first order.
* *
* The algorithm then preceeds to visit each commit in the pending queue. * The algorithm then proceeds to visit each commit in the pending queue.
* Upon each visit, the pending mass is added to the mass already seen for that * Upon each visit, the pending mass is added to the mass already seen for that
* commit and then divided into N equal portions, where N is the number of * commit and then divided into N equal portions, where N is the number of
* parents of the commit being visited. The divided portions are then injected * parents of the commit being visited. The divided portions are then injected

View File

@ -47,7 +47,7 @@ static int finish_pack(const char *pack_tmp_name, const char *me)
if (retval < 0) { if (retval < 0) {
if (errno == EINTR) if (errno == EINTR)
continue; continue;
error("waitpid failed (%s)", strerror(retval)); error("waitpid failed (%s)", strerror(errno));
goto error_die; goto error_die;
} }
if (WIFSIGNALED(status)) { if (WIFSIGNALED(status)) {

View File

@ -1,6 +1,7 @@
#!/bin/sh #!/bin/sh
USAGE='[-f] [-b <new_branch>] [<branch>] [<paths>...]' USAGE='[-f] [-b <new_branch>] [<branch>] [<paths>...]'
SUBDIRECTORY_OK=Sometimes
. git-sh-setup . git-sh-setup
old=$(git-rev-parse HEAD) old=$(git-rev-parse HEAD)
@ -79,7 +80,7 @@ then
# from a specific tree-ish; note that this is for # from a specific tree-ish; note that this is for
# rescuing paths and is never meant to remove what # rescuing paths and is never meant to remove what
# is not in the named tree-ish. # is not in the named tree-ish.
git-ls-tree -r "$new" "$@" | git-ls-tree --full-name -r "$new" "$@" |
git-update-index --index-info || exit $? git-update-index --index-info || exit $?
fi fi
git-checkout-index -f -u -- "$@" git-checkout-index -f -u -- "$@"
@ -95,6 +96,14 @@ else
fi fi
fi fi
# We are switching branches and checking out trees, so
# we *NEED* to be at the toplevel.
cdup=$(git-rev-parse --show-cdup)
if test ! -z "$cdup"
then
cd "$cdup"
fi
[ -z "$new" ] && new=$old [ -z "$new" ] && new=$old
# If we don't have an old branch that we're switching to, # If we don't have an old branch that we're switching to,

View File

@ -3,17 +3,17 @@
# Copyright (c) 2005 Junio C Hamano. # Copyright (c) 2005 Junio C Hamano.
# #
USAGE='[-v] <upstream> [<head>]' USAGE='[-v] <upstream> [<head>] [<limit>]'
LONG_USAGE=' __*__*__*__*__> <upstream> LONG_USAGE=' __*__*__*__*__> <upstream>
/ /
fork-point fork-point
\__+__+__+__+__+__+__+__> <head> \__+__+__+__+__+__+__+__> <head>
Each commit between the fork-point and <head> is examined, and Each commit between the fork-point (or <limit> if given) and <head> is
compared against the change each commit between the fork-point and examined, and compared against the change each commit between the
<upstream> introduces. If the change seems to be in the upstream, fork-point and <upstream> introduces. If the change seems to be in
it is shown on the standard output with prefix "+". Otherwise the upstream, it is shown on the standard output with prefix "+".
it is shown with prefix "-".' Otherwise it is shown with prefix "-".'
. git-sh-setup . git-sh-setup
case "$1" in -v) verbose=t; shift ;; esac case "$1" in -v) verbose=t; shift ;; esac
@ -28,9 +28,15 @@ esac
case "$#" in case "$#" in
1) upstream=`git-rev-parse --verify "$1"` && 1) upstream=`git-rev-parse --verify "$1"` &&
ours=`git-rev-parse --verify HEAD` || exit ours=`git-rev-parse --verify HEAD` || exit
limit="$upstream"
;; ;;
2) upstream=`git-rev-parse --verify "$1"` && 2) upstream=`git-rev-parse --verify "$1"` &&
ours=`git-rev-parse --verify "$2"` || exit ours=`git-rev-parse --verify "$2"` || exit
limit="$upstream"
;;
3) upstream=`git-rev-parse --verify "$1"` &&
ours=`git-rev-parse --verify "$2"` &&
limit=`git-rev-parse --verify "$3"` || exit
;; ;;
*) usage ;; *) usage ;;
esac esac
@ -38,7 +44,7 @@ esac
# Note that these list commits in reverse order; # Note that these list commits in reverse order;
# not that the order in inup matters... # not that the order in inup matters...
inup=`git-rev-list ^$ours $upstream` && inup=`git-rev-list ^$ours $upstream` &&
ours=`git-rev-list $ours ^$upstream` || exit ours=`git-rev-list $ours ^$limit` || exit
tmp=.cherry-tmp$$ tmp=.cherry-tmp$$
patch=$tmp-patch patch=$tmp-patch

View File

@ -9,7 +9,7 @@
unset CDPATH unset CDPATH
usage() { usage() {
echo >&2 "Usage: $0 [-l [-s]] [-q] [-u <upload-pack>] [-n] <repo> [<dir>]" echo >&2 "Usage: $0 [-l [-s]] [-q] [-u <upload-pack>] [-o <name>] [-n] <repo> [<dir>]"
exit 1 exit 1
} }
@ -31,25 +31,11 @@ clone_dumb_http () {
cd "$2" && cd "$2" &&
clone_tmp='.git/clone-tmp' && clone_tmp='.git/clone-tmp' &&
mkdir -p "$clone_tmp" || exit 1 mkdir -p "$clone_tmp" || exit 1
http_fetch "$1/info/refs" "$clone_tmp/refs" && http_fetch "$1/info/refs" "$clone_tmp/refs" || {
http_fetch "$1/objects/info/packs" "$clone_tmp/packs" || {
echo >&2 "Cannot get remote repository information. echo >&2 "Cannot get remote repository information.
Perhaps git-update-server-info needs to be run there?" Perhaps git-update-server-info needs to be run there?"
exit 1; exit 1;
} }
while read type name
do
case "$type" in
P) ;;
*) continue ;;
esac &&
idx=`expr "$name" : '\(.*\)\.pack'`.idx
http_fetch "$1/objects/pack/$name" ".git/objects/pack/$name" &&
http_fetch "$1/objects/pack/$idx" ".git/objects/pack/$idx" &&
git-verify-pack ".git/objects/pack/$idx" || exit 1
done <"$clone_tmp/packs"
while read sha1 refname while read sha1 refname
do do
name=`expr "$refname" : 'refs/\(.*\)'` && name=`expr "$refname" : 'refs/\(.*\)'` &&
@ -67,6 +53,7 @@ use_local=no
local_shared=no local_shared=no
no_checkout= no_checkout=
upload_pack= upload_pack=
origin=origin
while while
case "$#,$1" in case "$#,$1" in
0,*) break ;; 0,*) break ;;
@ -75,6 +62,14 @@ while
*,-s|*,--s|*,--sh|*,--sha|*,--shar|*,--share|*,--shared) *,-s|*,--s|*,--sh|*,--sha|*,--shar|*,--share|*,--shared)
local_shared=yes; use_local=yes ;; local_shared=yes; use_local=yes ;;
*,-q|*,--quiet) quiet=-q ;; *,-q|*,--quiet) quiet=-q ;;
1,-o) usage;;
*,-o)
git-check-ref-format "$2" || {
echo >&2 "'$2' is not suitable for a branch name"
exit 1
}
origin="$2"; shift
;;
1,-u|1,--upload-pack) usage ;; 1,-u|1,--upload-pack) usage ;;
*,-u|*,--upload-pack) *,-u|*,--upload-pack)
shift shift
@ -208,14 +203,14 @@ then
mkdir -p .git/remotes && mkdir -p .git/remotes &&
echo >.git/remotes/origin \ echo >.git/remotes/origin \
"URL: $repo "URL: $repo
Pull: $head_points_at:origin" && Pull: $head_points_at:$origin" &&
cp ".git/refs/heads/$head_points_at" .git/refs/heads/origin && git-update-ref "refs/heads/$origin" $(git-rev-parse HEAD) &&
find .git/refs/heads -type f -print | find .git/refs/heads -type f -print |
while read ref while read ref
do do
head=`expr "$ref" : '.git/refs/heads/\(.*\)'` && head=`expr "$ref" : '.git/refs/heads/\(.*\)'` &&
test "$head_points_at" = "$head" || test "$head_points_at" = "$head" ||
test "origin" = "$head" || test "$origin" = "$head" ||
echo "Pull: ${head}:${head}" echo "Pull: ${head}:${head}"
done >>.git/remotes/origin done >>.git/remotes/origin
esac esac

View File

@ -148,7 +148,7 @@ esac
if [ -f "$GIT_DIR/MERGE_HEAD" ]; then if [ -f "$GIT_DIR/MERGE_HEAD" ]; then
echo "#" echo "#"
echo "# It looks like your may be committing a MERGE." echo "# It looks like you may be committing a MERGE."
echo "# If this is not correct, please remove the file" echo "# If this is not correct, please remove the file"
echo "# $GIT_DIR/MERGE_HEAD" echo "# $GIT_DIR/MERGE_HEAD"
echo "# and try again" echo "# and try again"
@ -165,6 +165,7 @@ then
then then
pick_author_script=' pick_author_script='
/^author /{ /^author /{
s/'\''/'\''\\'\'\''/g
h h
s/^author \([^<]*\) <[^>]*> .*$/\1/ s/^author \([^<]*\) <[^>]*> .*$/\1/
s/'\''/'\''\'\'\''/g s/'\''/'\''\'\'\''/g

View File

@ -1,6 +1,14 @@
#ifndef GIT_COMPAT_UTIL_H #ifndef GIT_COMPAT_UTIL_H
#define GIT_COMPAT_UTIL_H #define GIT_COMPAT_UTIL_H
#ifndef FLEX_ARRAY
#if defined(__GNUC__) && (__GNUC__ < 3)
#define FLEX_ARRAY 0
#else
#define FLEX_ARRAY /* empty */
#endif
#endif
#include <unistd.h> #include <unistd.h>
#include <stdio.h> #include <stdio.h>
#include <sys/stat.h> #include <sys/stat.h>
@ -63,6 +71,8 @@ extern char *gitstrcasestr(const char *haystack, const char *needle);
static inline void *xmalloc(size_t size) static inline void *xmalloc(size_t size)
{ {
void *ret = malloc(size); void *ret = malloc(size);
if (!ret && !size)
ret = malloc(1);
if (!ret) if (!ret)
die("Out of memory, malloc failed"); die("Out of memory, malloc failed");
return ret; return ret;
@ -71,6 +81,8 @@ static inline void *xmalloc(size_t size)
static inline void *xrealloc(void *ptr, size_t size) static inline void *xrealloc(void *ptr, size_t size)
{ {
void *ret = realloc(ptr, size); void *ret = realloc(ptr, size);
if (!ret && !size)
ret = realloc(ptr, 1);
if (!ret) if (!ret)
die("Out of memory, realloc failed"); die("Out of memory, realloc failed");
return ret; return ret;
@ -79,6 +91,8 @@ static inline void *xrealloc(void *ptr, size_t size)
static inline void *xcalloc(size_t nmemb, size_t size) static inline void *xcalloc(size_t nmemb, size_t size)
{ {
void *ret = calloc(nmemb, size); void *ret = calloc(nmemb, size);
if (!ret && (!nmemb || !size))
ret = calloc(1, 1);
if (!ret) if (!ret)
die("Out of memory, calloc failed"); die("Out of memory, calloc failed");
return ret; return ret;

View File

@ -103,8 +103,16 @@ undef @files; # don't need it anymore
# check that the files are clean and up to date according to cvs # check that the files are clean and up to date according to cvs
my $dirty; my $dirty;
foreach my $f (@afiles, @mfiles, @dfiles) { foreach my $f (@afiles) {
# TODO:we need to handle removed in cvs and/or new (from git) my $status = `cvs -q status "$f" | grep '^File: '`;
unless ($status =~ m/Status: Unknown$/) {
$dirty = 1;
warn "File $f is already known in your CVS checkout!\n";
}
}
foreach my $f (@mfiles, @dfiles) {
# TODO:we need to handle removed in cvs
my $status = `cvs -q status "$f" | grep '^File: '`; my $status = `cvs -q status "$f" | grep '^File: '`;
unless ($status =~ m/Status: Up-to-date$/) { unless ($status =~ m/Status: Up-to-date$/) {

View File

@ -649,6 +649,7 @@ my $commit = sub {
my($xtag) = $tag; my($xtag) = $tag;
$xtag =~ s/\s+\*\*.*$//; # Remove stuff like ** INVALID ** and ** FUNKY ** $xtag =~ s/\s+\*\*.*$//; # Remove stuff like ** INVALID ** and ** FUNKY **
$xtag =~ tr/_/\./ if ( $opt_u ); $xtag =~ tr/_/\./ if ( $opt_u );
$xtag =~ s/[\/]/$opt_s/g;
my $pid = open2($in, $out, 'git-mktag'); my $pid = open2($in, $out, 'git-mktag');
print $out "object $cid\n". print $out "object $cid\n".

View File

@ -11,6 +11,7 @@ LF='
' '
IFS="$LF" IFS="$LF"
no_tags=
tags= tags=
append= append=
force= force=
@ -28,6 +29,9 @@ do
-t|--t|--ta|--tag|--tags) -t|--t|--ta|--tag|--tags)
tags=t tags=t
;; ;;
-n|--n|--no|--no-|--no-t|--no-ta|--no-tag|--no-tags)
no_tags=t
;;
-u|--u|--up|--upd|--upda|--updat|--update|--update-|--update-h|\ -u|--u|--up|--upd|--upda|--updat|--update|--update-|--update-h|\
--update-he|--update-hea|--update-head|--update-head-|\ --update-he|--update-hea|--update-head|--update-head-|\
--update-head-o|--update-head-ok) --update-head-o|--update-head-ok)
@ -188,11 +192,20 @@ esac
reflist=$(get_remote_refs_for_fetch "$@") reflist=$(get_remote_refs_for_fetch "$@")
if test "$tags" if test "$tags"
then then
taglist=$(git-ls-remote --tags "$remote" | taglist=$(IFS=" " &&
sed -e ' git-ls-remote --tags "$remote" |
/\^/d while read sha1 name
s/^[^ ]* // do
s/.*/&:&/') case "$name" in
(*^*) continue ;;
esac
if git-check-ref-format "$name"
then
echo ".${name}:${name}"
else
echo >&2 "warning: tag ${name} ignored"
fi
done)
if test "$#" -gt 1 if test "$#" -gt 1
then then
# remote URL plus explicit refspecs; we need to merge them. # remote URL plus explicit refspecs; we need to merge them.
@ -203,8 +216,12 @@ then
fi fi
fi fi
for ref in $reflist fetch_main () {
do reflist="$1"
refs=
for ref in $reflist
do
refs="$refs$LF$ref" refs="$refs$LF$ref"
# These are relative path from $GIT_DIR, typically starting at refs/ # These are relative path from $GIT_DIR, typically starting at refs/
@ -255,8 +272,8 @@ do
"$remote/objects/" "$GIT_OBJECT_DIRECTORY/" || exit "$remote/objects/" "$GIT_OBJECT_DIRECTORY/" || exit
# Look at objects/info/alternates for rsync -- http will # Look at objects/info/alternates for rsync -- http will
# support it natively and git native ones will do it on the remote # support it natively and git native ones will do it on
# end. Not having that file is not a crime. # the remote end. Not having that file is not a crime.
rsync -q "$remote/objects/info/alternates" \ rsync -q "$remote/objects/info/alternates" \
"$GIT_DIR/TMP_ALT" 2>/dev/null || "$GIT_DIR/TMP_ALT" 2>/dev/null ||
rm -f "$GIT_DIR/TMP_ALT" rm -f "$GIT_DIR/TMP_ALT"
@ -283,12 +300,13 @@ do
append_fetch_head "$head" "$remote" \ append_fetch_head "$head" "$remote" \
"$remote_name" "$remote_nick" "$local_name" "$not_for_merge" "$remote_name" "$remote_nick" "$local_name" "$not_for_merge"
done done
case "$remote" in case "$remote" in
http://* | https://* | rsync://* ) http://* | https://* | rsync://* )
;; # we are already done. ;; # we are already done.
*) *)
( : subshell because we muck with IFS
IFS=" $LF" IFS=" $LF"
( (
git-fetch-pack "$remote" $rref || echo failed "$remote" git-fetch-pack "$remote" $rref || echo failed "$remote"
@ -328,8 +346,36 @@ http://* | https://* | rsync://* )
local_name=$(expr "$found" : '[^:]*:\(.*\)') local_name=$(expr "$found" : '[^:]*:\(.*\)')
append_fetch_head "$sha1" "$remote" \ append_fetch_head "$sha1" "$remote" \
"$remote_name" "$remote_nick" "$local_name" "$not_for_merge" "$remote_name" "$remote_nick" "$local_name" "$not_for_merge"
done || exit done
;; ) || exit ;;
esac
}
fetch_main "$reflist"
# automated tag following
case "$no_tags$tags" in
'')
taglist=$(IFS=" " &&
git-ls-remote --tags "$remote" |
sed -ne 's|^\([0-9a-f]*\)[ ]\(refs/tags/.*\)^{}$|\1 \2|p' |
while read sha1 name
do
test -f "$GIT_DIR/$name" && continue
git-check-ref-format "$name" || {
echo >&2 "warning: tag ${name} ignored"
continue
}
git-cat-file -t "$sha1" >/dev/null 2>&1 || continue
echo >&2 "Auto-following $name"
echo ".${name}:${name}"
done)
case "$taglist" in
'') ;;
?*)
fetch_main "$taglist" ;;
esac
esac esac
# If the original head was empty (i.e. no "master" yet), or # If the original head was empty (i.e. no "master" yet), or

View File

@ -9,8 +9,10 @@ one file per patch, for e-mail submission. Each output file is
numbered sequentially from 1, and uses the first line of the commit numbered sequentially from 1, and uses the first line of the commit
message (massaged for pathname safety) as the filename. message (massaged for pathname safety) as the filename.
When -o is specified, output files are created in that directory; otherwise in There are three output modes. By default, output files are created in
the current working directory. the current working directory; when -o is specified, they are created
in that directory instead; when --stdout is specified, they are spit
on standard output, and can be piped to git-am.
When -n is specified, instead of "[PATCH] Subject", the first line is formatted When -n is specified, instead of "[PATCH] Subject", the first line is formatted
as "[PATCH N/M] Subject", unless you have only one patch. as "[PATCH N/M] Subject", unless you have only one patch.
@ -173,6 +175,7 @@ titleScript='
whosepatchScript=' whosepatchScript='
/^author /{ /^author /{
s/'\''/'\''\\'\'\''/g
s/author \(.*>\) \(.*\)$/au='\''\1'\'' ad='\''\2'\''/p s/author \(.*>\) \(.*\)$/au='\''\1'\'' ad='\''\2'\''/p
q q
}' }'

View File

@ -82,7 +82,7 @@ case "${1:-.}${2:-.}${3:-.}" in
expr "$sz0" \< "$sz1" \* 2 >/dev/null || : >$orig expr "$sz0" \< "$sz1" \* 2 >/dev/null || : >$orig
;; ;;
*) *)
echo "Auto-merging $4." echo "Auto-merging $4"
orig=`git-unpack-file $1` orig=`git-unpack-file $1`
;; ;;
esac esac
@ -107,7 +107,7 @@ case "${1:-.}${2:-.}${3:-.}" in
fi fi
if [ $ret -ne 0 ]; then if [ $ret -ne 0 ]; then
echo "ERROR: Merge conflict in $4." echo "ERROR: Merge conflict in $4"
exit 1 exit 1
fi fi
exec git-update-index -- "$4" exec git-update-index -- "$4"

View File

@ -283,12 +283,20 @@ def updateFileExt(sha, mode, path, updateCache, updateWd):
def setIndexStages(path, def setIndexStages(path,
oSHA1, oMode, oSHA1, oMode,
aSHA1, aMode, aSHA1, aMode,
bSHA1, bMode): bSHA1, bMode,
clear=True):
istring = []
if clear:
istring.append("0 " + ("0" * 40) + "\t" + path + "\0")
if oMode:
istring.append("%o %s %d\t%s\0" % (oMode, oSHA1, 1, path))
if aMode:
istring.append("%o %s %d\t%s\0" % (aMode, aSHA1, 2, path))
if bMode:
istring.append("%o %s %d\t%s\0" % (bMode, bSHA1, 3, path))
runProgram(['git-update-index', '-z', '--index-info'], runProgram(['git-update-index', '-z', '--index-info'],
input="0 " + ("0" * 40) + "\t" + path + "\0" + \ input="".join(istring))
"%o %s %d\t%s\0" % (oMode, oSHA1, 1, path) + \
"%o %s %d\t%s\0" % (aMode, aSHA1, 2, path) + \
"%o %s %d\t%s\0" % (bMode, bSHA1, 3, path))
def removeFile(clean, path): def removeFile(clean, path):
updateCache = cacheOnly or clean updateCache = cacheOnly or clean
@ -570,7 +578,7 @@ def processRenames(renamesA, renamesB, branchNameA, branchNameB):
continue continue
ren1.processed = True ren1.processed = True
removeFile(True, ren1.srcName)
if ren2: if ren2:
# Renamed in 1 and renamed in 2 # Renamed in 1 and renamed in 2
assert(ren1.srcName == ren2.srcName) assert(ren1.srcName == ren2.srcName)
@ -598,13 +606,19 @@ def processRenames(renamesA, renamesB, branchNameA, branchNameB):
'adding as', dstName2, 'instead.') 'adding as', dstName2, 'instead.')
removeFile(False, ren2.dstName) removeFile(False, ren2.dstName)
else: else:
dstName2 = ren1.dstName dstName2 = ren2.dstName
setIndexStages(dstName1,
None, None,
ren1.dstSha, ren1.dstMode,
None, None)
setIndexStages(dstName2,
None, None,
None, None,
ren2.dstSha, ren2.dstMode)
# NEEDSWORK: place dstNameA at stage 2 and dstNameB at stage 3
# What about other stages???
updateFile(False, ren1.dstSha, ren1.dstMode, dstName1)
updateFile(False, ren2.dstSha, ren2.dstMode, dstName2)
else: else:
removeFile(True, ren1.srcName)
[resSha, resMode, clean, merge] = \ [resSha, resMode, clean, merge] = \
mergeFile(ren1.srcName, ren1.srcSha, ren1.srcMode, mergeFile(ren1.srcName, ren1.srcSha, ren1.srcMode,
ren1.dstName, ren1.dstSha, ren1.dstMode, ren1.dstName, ren1.dstSha, ren1.dstMode,
@ -630,6 +644,8 @@ def processRenames(renamesA, renamesB, branchNameA, branchNameB):
updateFile(clean, resSha, resMode, ren1.dstName) updateFile(clean, resSha, resMode, ren1.dstName)
else: else:
removeFile(True, ren1.srcName)
# Renamed in 1, maybe changed in 2 # Renamed in 1, maybe changed in 2
if renamesA == renames1: if renamesA == renames1:
stage = 3 stage = 3

View File

@ -209,6 +209,7 @@ case "$use_strategies" in
esac esac
result_tree= best_cnt=-1 best_strategy= wt_strategy= result_tree= best_cnt=-1 best_strategy= wt_strategy=
merge_was_ok=
for strategy in $use_strategies for strategy in $use_strategies
do do
test "$wt_strategy" = '' || { test "$wt_strategy" = '' || {
@ -228,6 +229,7 @@ do
exit=$? exit=$?
if test "$no_commit" = t && test "$exit" = 0 if test "$no_commit" = t && test "$exit" = 0
then then
merge_was_ok=t
exit=1 ;# pretend it left conflicts. exit=1 ;# pretend it left conflicts.
fi fi
@ -293,4 +295,11 @@ do
done >"$GIT_DIR/MERGE_HEAD" done >"$GIT_DIR/MERGE_HEAD"
echo $merge_msg >"$GIT_DIR/MERGE_MSG" echo $merge_msg >"$GIT_DIR/MERGE_MSG"
die "Automatic merge failed/prevented; fix up by hand" if test "$merge_was_ok" = t
then
echo >&2 \
"Automatic merge went well; stopped before committing as requested"
exit 0
else
die "Automatic merge failed; fix up by hand"
fi

View File

@ -33,8 +33,7 @@ sed -ne '/unreachable /{
git-prune-packed $dryrun git-prune-packed $dryrun
redundant=$(git-pack-redundant --all) if redundant=$(git-pack-redundant --all 2>/dev/null) && test "" != "$redundant"
if test "" != "$redundant"
then then
if test "" = "$dryrun" if test "" = "$dryrun"
then then

View File

@ -3,7 +3,7 @@
USAGE='[--mixed | --soft | --hard] [<commit-ish>]' USAGE='[--mixed | --soft | --hard] [<commit-ish>]'
. git-sh-setup . git-sh-setup
tmp=/var/tmp/reset.$$ tmp=${GIT_DIR}/reset.$$
trap 'rm -f $tmp-*' 0 1 2 3 15 trap 'rm -f $tmp-*' 0 1 2 3 15
reset_type=--mixed reset_type=--mixed

View File

@ -93,6 +93,7 @@ revert)
cherry-pick) cherry-pick)
pick_author_script=' pick_author_script='
/^author /{ /^author /{
s/'\''/'\''\\'\'\''/g
h h
s/^author \([^<]*\) <[^>]*> .*$/\1/ s/^author \([^<]*\) <[^>]*> .*$/\1/
s/'\''/'\''\'\'\''/g s/'\''/'\''\'\'\''/g

View File

@ -83,11 +83,11 @@ report "Changed but not updated" "use git-update-index to mark for commit"
if test -f "$GIT_DIR/info/exclude" if test -f "$GIT_DIR/info/exclude"
then then
git-ls-files -z --others \ git-ls-files -z --others --directory \
--exclude-from="$GIT_DIR/info/exclude" \ --exclude-from="$GIT_DIR/info/exclude" \
--exclude-per-directory=.gitignore --exclude-per-directory=.gitignore
else else
git-ls-files -z --others \ git-ls-files -z --others --directory \
--exclude-per-directory=.gitignore --exclude-per-directory=.gitignore
fi | fi |
perl -e '$/ = "\0"; perl -e '$/ = "\0";

View File

@ -96,8 +96,10 @@ sub new {
sub conn { sub conn {
my $self = shift; my $self = shift;
my $repo = $self->{'fullrep'}; my $repo = $self->{'fullrep'};
my $s = SVN::Ra->new($repo); my $auth = SVN::Core::auth_open ([SVN::Client::get_simple_provider,
SVN::Client::get_ssl_server_trust_file_provider,
SVN::Client::get_username_provider]);
my $s = SVN::Ra->new(url => $repo, auth => $auth);
die "SVN connection to $repo: $!\n" unless defined $s; die "SVN connection to $repo: $!\n" unless defined $s;
$self->{'svn'} = $s; $self->{'svn'} = $s;
$self->{'repo'} = $repo; $self->{'repo'} = $repo;

View File

@ -4,9 +4,15 @@ USAGE='[-p] [--max-count=<n>] [<since>..<limit>] [--pretty=<format>] [-m] [git-d
SUBDIRECTORY_OK='Yes' SUBDIRECTORY_OK='Yes'
. git-sh-setup . git-sh-setup
diff_tree_flags=$(git-rev-parse --sq --no-revs --flags "$@")
test -z "$diff_tree_flags" &&
diff_tree_flags=$(git-repo-config --get whatchanged.difftree)
test -z "$diff_tree_flags" &&
diff_tree_flags='-M --abbrev'
rev_list_args=$(git-rev-parse --sq --default HEAD --revs-only "$@") && rev_list_args=$(git-rev-parse --sq --default HEAD --revs-only "$@") &&
diff_tree_args=$(git-rev-parse --sq --no-revs "$@") && diff_tree_args=$(git-rev-parse --sq --no-revs --no-flags "$@") &&
eval "git-rev-list $rev_list_args" | eval "git-rev-list $rev_list_args" |
eval "git-diff-tree --stdin --pretty -r $diff_tree_args" | eval "git-diff-tree --stdin --pretty -r $diff_tree_flags $diff_tree_args" |
LESS="$LESS -S" ${PAGER:-less} LESS="$LESS -S" ${PAGER:-less}

7
git.c
View File

@ -244,6 +244,11 @@ int main(int argc, char **argv, char **envp)
for (i = 1; i < argc; i++) { for (i = 1; i < argc; i++) {
char *arg = argv[i]; char *arg = argv[i];
if (!strcmp(arg, "help")) {
show_help = 1;
continue;
}
if (strncmp(arg, "--", 2)) if (strncmp(arg, "--", 2))
break; break;
@ -278,7 +283,7 @@ int main(int argc, char **argv, char **envp)
if (*exec_path != '/') { if (*exec_path != '/') {
if (!getcwd(git_command, sizeof(git_command))) { if (!getcwd(git_command, sizeof(git_command))) {
fprintf(stderr, fprintf(stderr,
"git: cannot determine current directory"); "git: cannot determine current directory\n");
exit(1); exit(1);
} }
len = strlen(git_command); len = strlen(git_command);

View File

@ -267,7 +267,8 @@ static void process_object_response(void *callback_data)
obj_req->state = COMPLETE; obj_req->state = COMPLETE;
/* Use alternates if necessary */ /* Use alternates if necessary */
if (obj_req->http_code == 404) { if (obj_req->http_code == 404 ||
obj_req->curl_result == CURLE_FILE_COULDNT_READ_FILE) {
fetch_alternates(alt->base); fetch_alternates(alt->base);
if (obj_req->repo->next != NULL) { if (obj_req->repo->next != NULL) {
obj_req->repo = obj_req->repo =
@ -475,7 +476,8 @@ static void process_alternates_response(void *callback_data)
} }
} }
} else if (slot->curl_result != CURLE_OK) { } else if (slot->curl_result != CURLE_OK) {
if (slot->http_code != 404) { if (slot->http_code != 404 &&
slot->curl_result != CURLE_FILE_COULDNT_READ_FILE) {
got_alternates = -1; got_alternates = -1;
return; return;
} }
@ -637,7 +639,8 @@ static int fetch_indices(struct alt_base *repo)
if (start_active_slot(slot)) { if (start_active_slot(slot)) {
run_active_slot(slot); run_active_slot(slot);
if (slot->curl_result != CURLE_OK) { if (slot->curl_result != CURLE_OK) {
if (slot->http_code == 404) { if (slot->http_code == 404 ||
slot->curl_result == CURLE_FILE_COULDNT_READ_FILE) {
repo->got_indices = 1; repo->got_indices = 1;
free(buffer.buffer); free(buffer.buffer);
return 0; return 0;
@ -658,7 +661,7 @@ static int fetch_indices(struct alt_base *repo)
switch (data[i]) { switch (data[i]) {
case 'P': case 'P':
i++; i++;
if (i + 52 < buffer.posn && if (i + 52 <= buffer.posn &&
!strncmp(data + i, " pack-", 6) && !strncmp(data + i, " pack-", 6) &&
!strncmp(data + i + 46, ".pack\n", 6)) { !strncmp(data + i + 46, ".pack\n", 6)) {
get_sha1_hex(data + i + 6, sha1); get_sha1_hex(data + i + 6, sha1);
@ -667,7 +670,7 @@ static int fetch_indices(struct alt_base *repo)
break; break;
} }
default: default:
while (data[i] != '\n') while (i < buffer.posn && data[i] != '\n')
i++; i++;
} }
i++; i++;
@ -802,7 +805,8 @@ static int fetch_object(struct alt_base *repo, unsigned char *sha1)
ret = error("Request for %s aborted", hex); ret = error("Request for %s aborted", hex);
} else if (obj_req->curl_result != CURLE_OK && } else if (obj_req->curl_result != CURLE_OK &&
obj_req->http_code != 416) { obj_req->http_code != 416) {
if (obj_req->http_code == 404) if (obj_req->http_code == 404 ||
obj_req->curl_result == CURLE_FILE_COULDNT_READ_FILE)
ret = -1; /* Be silent, it is probably in a pack. */ ret = -1; /* Be silent, it is probably in a pack. */
else else
ret = error("%s (curl_result = %d, http_code = %ld, sha1 = %s)", ret = error("%s (curl_result = %d, http_code = %ld, sha1 = %s)",

View File

@ -140,7 +140,7 @@ static int copy(char *buf, int size, int offset, const char *src)
/* /*
* Copy the rest to the buffer, but avoid the special * Copy the rest to the buffer, but avoid the special
* characters '\n' '<' and '>' that act as delimeters on * characters '\n' '<' and '>' that act as delimiters on
* a identification line * a identification line
*/ */
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {

View File

@ -352,19 +352,25 @@ static int sha1_compare(const void *_a, const void *_b)
static void write_index_file(const char *index_name, unsigned char *sha1) static void write_index_file(const char *index_name, unsigned char *sha1)
{ {
struct sha1file *f; struct sha1file *f;
struct object_entry **sorted_by_sha = struct object_entry **sorted_by_sha, **list, **last;
xcalloc(nr_objects, sizeof(struct object_entry *));
struct object_entry **list = sorted_by_sha;
struct object_entry **last = sorted_by_sha + nr_objects;
unsigned int array[256]; unsigned int array[256];
int i; int i;
SHA_CTX ctx; SHA_CTX ctx;
if (nr_objects) {
sorted_by_sha =
xcalloc(nr_objects, sizeof(struct object_entry *));
list = sorted_by_sha;
last = sorted_by_sha + nr_objects;
for (i = 0; i < nr_objects; ++i) for (i = 0; i < nr_objects; ++i)
sorted_by_sha[i] = &objects[i]; sorted_by_sha[i] = &objects[i];
qsort(sorted_by_sha, nr_objects, sizeof(sorted_by_sha[0]), qsort(sorted_by_sha, nr_objects, sizeof(sorted_by_sha[0]),
sha1_compare); sha1_compare);
}
else
sorted_by_sha = list = last = NULL;
unlink(index_name); unlink(index_name);
f = sha1create("%s", index_name); f = sha1create("%s", index_name);
@ -440,7 +446,7 @@ int main(int argc, char **argv)
if (len < 5 || strcmp(pack_name + len - 5, ".pack")) if (len < 5 || strcmp(pack_name + len - 5, ".pack"))
die("packfile name '%s' does not end with '.pack'", die("packfile name '%s' does not end with '.pack'",
pack_name); pack_name);
index_name_buf = xmalloc(len - 1); index_name_buf = xmalloc(len);
memcpy(index_name_buf, pack_name, len - 5); memcpy(index_name_buf, pack_name, len - 5);
strcpy(index_name_buf + len - 5, ".idx"); strcpy(index_name_buf + len - 5, ".idx");
index_name = index_name_buf; index_name = index_name_buf;

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