1
0
mirror of https://github.com/git/git.git synced 2024-09-26 05:40:49 +02:00
Commit Graph

15424 Commits

Author SHA1 Message Date
Dmitry Potapov
f66cf96d7c Fix buffer overflow in prepare_attr_stack
If PATH_MAX on your system is smaller than a path stored in the git repo,
it may cause the buffer overflow in prepare_attr_stack.

Signed-off-by: Dmitry Potapov <dpotapov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-16 14:05:50 -07:00
Dmitry Potapov
fd55a19eb1 Fix buffer overflow in git diff
If PATH_MAX on your system is smaller than a path stored, it may cause
buffer overflow and stack corruption in diff_addremove() and diff_change()
functions when running git-diff

Signed-off-by: Dmitry Potapov <dpotapov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-16 14:03:24 -07:00
Dmitry Potapov
620e2bb937 Fix buffer overflow in git-grep
If PATH_MAX on your system is smaller than any path stored in the git
repository, that can cause memory corruption inside of the grep_tree
function used by git-grep.

Signed-off-by: Dmitry Potapov <dpotapov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-16 13:30:34 -07:00
SungHyun Nam
dd33927ccd t/Makefile: use specified shell when running aggregation script
Signed-off-by: SungHyun Nam <goweol@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-16 08:59:14 -07:00
Lars Noschinski
df4b3abc94 git-cvsserver: fix call to nonexistant cleanupWorkDir()
git-cvsserver.perl contained a single call to a nonexistant function
cleanupWorkDir(). This was obviously a typo for cleanupWorkTree().

Signed-off-by: Lars Noschinski <lars@public.noschinski.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-16 08:53:51 -07:00
Nanako Shiraishi
1121a8786e parse-options.c: make check_typos() static
This function is not used by any other file.

Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-16 08:50:36 -07:00
Nanako Shiraishi
cb2a1cc298 builtin-describe.c: make a global variable "pattern" static
This variable is not used by any other file.

Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-16 08:50:32 -07:00
Nanako Shiraishi
7ba04d9f37 cache-tree.c: make cache_tree_find() static
This function is not used by any other file.

Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-16 08:50:27 -07:00
Petr Baudis
8bd867ee0e Documentation/git-cherry-pick.txt et al.: Fix misleading -n description
The manual page of git-cherry-pick and git-revert asserts that -n works
primarily on the working tree, while in fact the primary object it operates
on is the index, and the changes only "accidentally" propagate to the
working tree. This e.g. leads innocent #git IRC folks to believe that you
can use -n to prepare changes for git-add -i staging.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-16 08:50:07 -07:00
Junio C Hamano
300072f486 t/aggregate-results: whitespace fix
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-16 08:42:52 -07:00
Eric Wong
3901a8c866 t/lib-git-svn: fix SVN_HTTPD tests to work with "trash directory"
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-16 08:11:15 -07:00
Junio C Hamano
fcab40a389 Merge branch 'mv/merge-in-c'
* mv/merge-in-c:
  reduce_heads(): protect from duplicate input
  reduce_heads(): thinkofix
  Add a new test for git-merge-resolve
  t6021: add a new test for git-merge-resolve
  Teach merge.log to "git-merge" again
  Build in merge
  Fix t7601-merge-pull-config.sh on AIX
  git-commit-tree: make it usable from other builtins
  Add new test case to ensure git-merge prepends the custom merge message
  Add new test case to ensure git-merge reduces octopus parents when possible
  Introduce reduce_heads()
  Introduce get_merge_bases_many()
  Add new test to ensure git-merge handles more than 25 refs.
  Introduce get_octopus_merge_bases() in commit.c
  git-fmt-merge-msg: make it usable from other builtins
  Move read_cache_unmerged() to read-cache.c
  Add new test to ensure git-merge handles pull.twohead and pull.octopus
  Move parse-options's skip_prefix() to git-compat-util.h
  Move commit_list_count() to commit.c
  Move split_cmdline() to alias.c

Conflicts:
	Makefile
	parse-options.c
2008-07-15 19:09:46 -07:00
Junio C Hamano
c158cae110 Merge branch 'ag/rewrite_one'
* ag/rewrite_one:
  Fix quadratic performance in rewrite_one.
2008-07-15 18:59:48 -07:00
Junio C Hamano
223bb84572 Merge branch 'sp/win'
* sp/win:
  We need to check for msys as well as Windows in add--interactive.
  Convert CR/LF to LF in tag signatures
  Fixed text file auto-detection: treat EOF character 032 at the end of file as printable
2008-07-15 18:59:45 -07:00
Junio C Hamano
1466080199 Merge branch 'js/more-win'
* js/more-win:
  help (Windows): Display HTML in default browser using Windows' shell API
  help.c: Add support for htmldir relative to git_exec_path()
  Move code interpreting path relative to exec-dir to new function system_path()
2008-07-15 18:59:28 -07:00
Junio C Hamano
fab600ce2e Merge branch 'js/maint-pretty-mailmap'
* js/maint-pretty-mailmap:
  Add pretty format %aN which gives the author name, respecting .mailmap
2008-07-15 18:59:04 -07:00
Johannes Schindelin
28ed6e7b32 Rename ".dotest/" to ".git/rebase" and ".dotest-merge" to "rebase-merge"
Since the files generated and used during a rebase are never to be
tracked, they should live in $GIT_DIR.  While at it, avoid the rather
meaningless term "dotest" to "rebase", and unhide ".dotest-merge".

This was wished for on the mailing list, but so far unimplemented.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-15 18:49:28 -07:00
Alexander Gavrilov
1617fe9879 Do not try to detect move/copy for entries below threshold.
Splits for such entries are rejected anyway, so there is no
point even trying to compute them.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-15 16:38:33 -07:00
Alexander Gavrilov
eb46328e18 Avoid rescanning unchanged entries in search for copies.
Repeatedly comparing the same entry against the same set
of blobs in search for copies is quite pointless. This
huge waste of effort can be avoided using a flag in
the blame_entry structure.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-15 16:38:32 -07:00
Junio C Hamano
6c11a5fd46 Update draft release notes to 1.6.0
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-15 07:38:35 -07:00
Johannes Schindelin
b526f8ed4d shortlog: support --pretty=format: option
With this patch, the user can override the default setting, to print
the commit messages using a user format instead of the onelines of the
commits.  Example:

	$ git shortlog --pretty='format:%s (%h)' <commit>..

Note that shortlog will only respect a user format setting, as the other
formats do not make much sense.

Wished for by Andrew Morton.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-15 07:37:00 -07:00
Ciaran McCreesh
1e5aaa6db3 Make git-add -i accept ranges like 7-
git-add -i ranges expect number-number. But for the supremely lazy, typing in
that second number when selecting "from patch 7 to the end" is wasted effort.
So treat an empty second number in a range as "until the last item".

Signed-off-by: Ciaran McCreesh <ciaran.mccreesh@googlemail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-15 07:37:00 -07:00
Pavel Roskin
a271b2a9ce t9600: allow testing with cvsps 2.2, including beta versions
We've supported cvsps 2.1 so far.  Newer 2.2b1 (beta) seems to work with
us, too.

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-15 07:37:00 -07:00
René Scharfe
489e351ea0 archive: remove extra arguments parsing code
Replace the code that calls backend specific argument parsers by a
simple flag mechanism.  This reduces code size and complexity.

We can add back such a mechanism (based on incremental parse_opt(),
perhaps) when we need it.  The compression level parameter, though,
is going to be shared by future compressing backends like tgz.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-15 07:18:04 -07:00
René Scharfe
1d11d5bb85 archive: unify file attribute handling
Now that all file attribute handling for git archive has moved to archive.c,
we can unexport sha1_file_to_archive() and is_archive_path_ignored() even
disappears.

Add setup_archive_check(), modelled after similar functions used in the code
of other commands that support multiple file attributes.

Also remove convert_to_archive(), as it's only remaining function with
attribute handling gone was to call format_subst() if commit was not NULL,
which is now checked in sha1_file_to_archive().

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-15 07:18:04 -07:00
René Scharfe
562e25abea archive: centralize archive entry writing
Add the exported function write_archive_entries() to archive.c, which uses
the new ability of read_tree_recursive() to pass a context pointer to its
callback in order to centralize previously duplicated code.

The new callback function write_archive_entry() does the work that every
archiver backend needs to do: loading file contents, entering subdirectories,
handling file attributes, constructing the full path of the entry.  All that
done, it calls the backend specific write_archive_entry_fn_t function.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-15 07:18:04 -07:00
René Scharfe
d53fe8187c archive: add baselen member to struct archiver_args
Calculate the length of base and save it in a new member of struct
archiver_args.  This way we don't have to compute it in each of the
format backends.

Note: parse_archive_args() guarantees that ->base won't ever be NULL.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-15 07:18:04 -07:00
René Scharfe
671f070721 add context pointer to read_tree_recursive()
Add a pointer parameter to read_tree_recursive(), which is passed to the
callback function.  This allows callers of read_tree_recursive() to
share data with the callback without resorting to global variables.  All
current callers pass NULL.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-15 07:17:59 -07:00
René Scharfe
34533004b2 archive: remove args member from struct archiver
Pass struct archiver and struct archiver_args explicitly to parse_archive_args
and remove the latter from the former.  This allows us to get rid of struct
archiver_desc and simplifies the code a bit.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-15 07:08:11 -07:00
Shawn O. Pearce
92392b4a45 index-pack: Honor core.deltaBaseCacheLimit when resolving deltas
If we are trying to resolve deltas for a long delta chain composed
of multi-megabyte objects we can easily run into requiring 500M+
of memory to hold each object in the chain on the call stack while
we recurse into the dependent objects and resolve them.

We now use a simple delta cache that discards objects near the
bottom of the call stack first, as they are the most least recently
used objects in this current delta chain.  If we recurse out of a
chain we may find the base object is no longer available, as it was
free'd to keep memory under the deltaBaseCacheLimit.  In such cases
we must unpack the base object again, which will require recursing
back to the root of the top of the delta chain as we released that
root first.

The astute reader will probably realize that we can still exceed
the delta base cache limit, but this happens only if the most
recent base plus the delta plus the inflated dependent sum up to
more than the base cache limit.  Due to the way patch_delta is
currently implemented we cannot operate in less memory anyway.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-15 06:37:44 -07:00
Shawn O. Pearce
03993e139c index-pack: Track the object_entry that creates each base_data
If we free the data stored within a base_data we need the struct
object_entry to get the data back again for use with another dependent
delta.  Storing the object_entry* in base_data makes it simple to call
get_data_from_pack() to recover the compressed information.

This however means that we must add the missing base object to the end of
our packfile prior to calling resolve_delta() on each of the dependent
deltas.  Adding the base first ensures we can read the base back from the
pack we are indexing, as if it had been included by the remote side.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-15 06:36:49 -07:00
Shawn O. Pearce
4a438cabac index-pack: Chain the struct base_data on the stack for traversal
We need to release earlier inflated base objects when memory gets
low, which means we need to be able to walk up or down the stack
to locate the objects we want to release, and free their data.

The new link/unlink routines allow inserting and removing the struct
base_data during recursion inside resolve_delta, and the global
base_cache gives us the head of the chain (bottom of the stack)
so we can traverse it.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-15 06:30:59 -07:00
Shawn O. Pearce
f41aebd469 index-pack: Refactor base arguments of resolve_delta into a struct
We need to discard base objects which are not recently used if our
memory gets low, such as when we are unpacking a long delta chain
of a very large object.

To support tracking the available base objects we combine the
pointer and size into a struct.  Future changes would allow the
data pointer to be free'd and marked NULL if memory gets low.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-15 06:27:09 -07:00
Junio C Hamano
547905f8cd Merge git://repo.or.cz/git-gui
* git://repo.or.cz/git-gui:
  git-gui: MERGE_RR lives in .git/ directly with newer Git versions
  git-gui: Exit shortcut in MacOSX repaired
2008-07-15 00:08:02 -07:00
Junio C Hamano
ebcffb1d44 Merge branch 'js/merge-rr'
* js/merge-rr:
  Move MERGE_RR from .git/rr-cache/ into .git/

Conflicts:
	builtin-rerere.c
2008-07-14 23:56:27 -07:00
Junio C Hamano
1864265c4d Merge branch 'sb/rerere-lib'
* sb/rerere-lib:
  rerere: Separate libgit and builtin functions
2008-07-14 23:47:48 -07:00
Junio C Hamano
abce32b5ba Merge branch 'ls/maint-mailinfo-patch-label'
* ls/maint-mailinfo-patch-label:
  git-mailinfo: Fix getting the subject from the in-body [PATCH] line
2008-07-14 23:47:23 -07:00
Junio C Hamano
19792b27da Merge branch 'om/rerere-careful'
* om/rerere-careful:
  builtin-rerere: more carefully find conflict markers
2008-07-14 23:47:14 -07:00
Junio C Hamano
b773fc34a0 Merge branch 'jc/branch-merged'
* jc/branch-merged:
  branch --merged/--no-merged: allow specifying arbitrary commit
  branch --contains: default to HEAD
  parse-options: add PARSE_OPT_LASTARG_DEFAULT flag

Conflicts:
	Documentation/git-branch.txt
2008-07-14 23:47:01 -07:00
Junio C Hamano
633ce9a3ba Merge branch 'jc/rebase-orig-head'
* jc/rebase-orig-head:
  Documentation: mention ORIG_HEAD in am, merge, and rebase
  Teach "am" and "rebase" to mark the original position with ORIG_HEAD
2008-07-14 23:45:49 -07:00
Shawn O. Pearce
055767194c bash completion: Remove dashed command completion support
Since only 'git' and 'gitk' are in the user's $PATH now we do not
expect users to need completion support for git-fetch, and expect
they will instead rely upon the completion support for 'git fetch'.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-14 23:37:42 -07:00
Junio C Hamano
3df6499c22 Merge branch 'sp/maint-bash-completion-optim'
* sp/maint-bash-completion-optim:
  bash completion: Resolve git show ref:path<tab> losing ref: portion
  bash completion: Append space after file names have been completed
2008-07-14 23:36:08 -07:00
Nicolas Pitre
ac9391093f restore legacy behavior for read_sha1_file()
Since commit 8eca0b47ff, it is possible
for read_sha1_file() to return NULL even with existing objects when they
are corrupted.  Previously a corrupted object would have terminated the
program immediately, effectively making read_sha1_file() return NULL
only when specified object is not found.

Let's restore this behavior for all users of read_sha1_file() and
provide a separate function with the ability to not terminate when
bad objects are encountered.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-14 23:35:32 -07:00
Teemu Likonen
25a1f374f0 bash: Add long option completion for 'git send-email'
Add the following long options to be completed with 'git send-email':

    --bcc --cc --cc-cmd --chain-reply-to --compose --dry-run
    --envelope-sender --from --identity --in-reply-to
    --no-chain-reply-to --no-signed-off-by-cc --no-suppress-from
    --no-thread --quiet --signed-off-by-cc --smtp-pass --smtp-server
    --smtp-server-port --smtp-ssl --smtp-user --subject --suppress-cc
    --suppress-from --thread --to

Short ones like --to and --cc are not usable for actual completion
because of the shortness itself and because there are longer ones which
start with same letters (--thread, --compose). It's still useful to have
these shorter options _listed_ when user presses TAB key after typing
two dashes. It gives user an idea what options are available (and --to
and --cc are probably the most commonly used).

Signed-off-by: Teemu Likonen <tlikonen@iki.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-14 23:35:32 -07:00
Mark Levedahl
c2f939170c git-submodule - register submodule URL if adding in place
When adding a new submodule in place, meaning the user created the
submodule as a git repo in the superproject's tree first, we don't go
through "git submodule init" to register the module.  Thus, the
submodule's origin repository URL is not stored in .git/config, and no
subsequent submodule operation will ever do so.  In this case, assume the
URL the user supplies to "submodule add" is the one that should be
registered, and do so.

Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-14 23:35:32 -07:00
Mark Levedahl
ec05df353c git-submodule - make "submodule add" more strict, and document it
This change makes "submodule add" much more strict in the arguments it
takes, and is intended to address confusion as recently noted on the
git-list. With this change, the required syntax is:

	$ git submodule add URL path

Specifically, this eliminates the form

	$ git submodule add URL

which was confused by more than one person as

	$ git submodule add path

With this patch, the URL locating the submodule's origin repository can be
either an absolute URL, or (if it begins with ./ or ../) can express the
submodule's repository location relative to the superproject's origin.

This patch also eliminates a third form of URL, which was relative to the
superproject's top-level directory (not its repository).  Any URL that was
neither absolute nor matched ./*|../* was assumed to point to a
subdirectory of the superproject as the location of the submodule's origin
repository.  This URL form was confusing and does not seem to correspond
to an important use-case.  Specifically, no-one has identified the need to
clone from a repository already in the superproject's tree, but if this is
needed it is easily done using an absolute URL: $(pwd)/relative-path.  So,
no functionality is lost with this patch. (t6008-rev-list-submodule.sh did
rely upon this relative URL, fixed by using $(pwd).)

Following this change, there are exactly four variants of
submodule-add, as both arguments have two flavors:

URL can be absolute, or can begin with ./|../ and thus names the
submodule's origin relative to the superproject's origin.

Note: With this patch, "submodule add" discerns an absolute URL as
matching /*|*:*: e.g., URL begins with /, or it contains a :.  This works
for all valid URLs, an absolute path in POSIX, as well as an absolute path
on Windows).

path can either already exist as a valid git repo, or will be cloned from
the given URL.  The first form here eases creation of a new submodule in
an existing superproject as the submodule can be added and tested in-tree
before pushing to the public repository.  However, the more usual form is
the second, where the repo is cloned from the given URL.

This specifically addresses the issue of

	$ git submodule add a/b/c

attempting to clone from a repository at "a/b/c" to create a new module
in "c". This also simplifies description of "relative URL" as there is now
exactly *one* form: a URL relative to the parent's origin repo.

Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-14 23:35:31 -07:00
Frederik Schwarzer
8f510bef13 git-svn: typofix
Signed-off-by: Frederik Schwarzer <schwarzerf@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-14 23:35:31 -07:00
João Abecasis
63c56022f8 git-svn: find-rev and rebase for SVN::Mirror repositories
find-rev and rebase error out on svm because git-svn doesn't trace the
original svn revision numbers back to git commits. The updated test
case, included in the patch, shows the issue and passes with the rest of
the patch applied.

This fixes Git::SVN::find_by_url to find branches based on the
svm:source URL, where useSvmProps is set. Also makes sure cmd_find_rev
and working_head_info use the information they have to correctly track
the source repository. This is enough to get find-rev and rebase
working.

Signed-off-by: João Abecasis <joao@abecasis.name>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-14 23:35:31 -07:00
Junio C Hamano
dc29bc8bd2 tutorial: clarify "pull" is "fetch + merge"
The document says that a fetch with a configured remote stores what are
fetched in the remote tracking branches "Unlike the longhand form", but
there is no longhand form "fetch" demonstrated earlier.

This adds a missing demonstration of the longhand form, and a new
paragraph to explain why some people might want to fetch before pull.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-14 23:35:31 -07:00
Ian Katz
5d5e88af5c tutorial: use prompt with user names in example, to clarify who is doing what
Signed-off-by: Ian Katz <ifreecarve@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-14 23:35:31 -07:00