Commit graph

13279 commits

Author SHA1 Message Date
Martin Koegler 355885d531 add generic, type aware object chain walker
The requirements are:
* it may not crash on NULL pointers
* a callback function is needed, as index-pack/unpack-objects
  need to do different things
* the type information is needed to check the expected <-> real type
  and print better error messages

Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-25 23:57:34 -08:00
Martin Koegler f73df331a4 peel_onion: handle NULL
Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-18 20:49:18 -08:00
Martin Koegler dec38c8165 check return value from parse_commit() in various functions
Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-18 20:49:13 -08:00
Martin Koegler 9786f68bfc parse_commit: don't fail, if object is NULL
Some codepaths (eg. builtin-rev-parse -> get_merge_bases -> parse_commit)
can pass NULL.

Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-18 19:25:26 -08:00
Martin Koegler 9684afd967 revision.c: handle tag->tagged == NULL
Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-18 19:25:26 -08:00
Martin Koegler f7de5a56b7 reachable.c::process_tree/blob: check for NULL
As these functions are directly called with the result
from lookup_tree/blob, they must handle NULL.

Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-18 19:25:26 -08:00
Martin Koegler cc36934791 process_tag: handle tag->tagged == NULL
Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-18 19:25:26 -08:00
Martin Koegler 172947e645 check results of parse_commit in merge_bases
An error is signaled by returning NULL.

Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-18 19:25:26 -08:00
Martin Koegler a301b0c8f2 list-objects.c::process_tree/blob: check for NULL
As these functions are directly called with the result
from lookup_tree/blob, they must handle NULL.

Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-18 19:25:26 -08:00
Martin Koegler c34066358a reachable.c::add_one_tree: handle NULL from lookup_tree
Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-18 19:25:22 -08:00
Martin Koegler c1ee9013ad mark_blob/tree_uninteresting: check for NULL
As these functions are directly called with the result
from lookup_tree/blob, they must handle NULL.

Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-18 19:20:20 -08:00
Martin Koegler 283cdbcf49 get_sha1_oneline: check return value of parse_object
Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-18 19:20:18 -08:00
Martin Koegler 50974ec994 read_object_with_reference: don't read beyond the buffer
Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-18 19:20:17 -08:00
Junio C Hamano e5fc9a0aea GIT 1.5.4.2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-17 00:20:38 -08:00
Pieter de Bie 965053b09a Documentation/git-reset: Add an example of resetting selected paths
Signed-off-by: Pieter de Bie <pdebie@ai.rug.nl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-16 10:57:05 -08:00
Pieter de Bie ceb4cacb42 Documentation/git-reset: don't mention --mixed for selected-paths reset
The option is accepted, but that is the only form selected-paths
variant of the reset command takes, so there is no point mentioning it.
And while we're at it, use the dashless git call.

Signed-off-by: Pieter de Bie <pdebie@ai.rug.nl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-16 10:56:24 -08:00
Junio C Hamano 3983caa531 Documentation/git-reset:
Since 3368d11 (Remove unnecessary git-rm --cached reference from
status output), the status output marks the "Added but not yet
committed" section as "Changes to be committed".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-16 10:51:46 -08:00
Jeff King 959ba670ad commit: discard index after setting up partial commit
There may still be some entries from the original index that
should be discarded before we show the status. In
particular, if a file was added in the index but not
included in the partial commit, it would still show up in
the status listing as staged for commit.

Ultimately the correct fix is to keep the two states in
separate index_state variables. Then we can avoid having
to reload the cache from the temporary file altogether, and
just point wt_status_print at the correct index.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-16 00:12:56 -08:00
Junio C Hamano 1fe32cb9d0 filter-branch: handle filenames that need quoting
The command used a very old fashioned construct to extract
filenames out of diff-index and ended up corrupting the output.
We can simply use --name-only and pipe into --stdin mode of
update-index.  It's been like that for the past 2 years or so
since a94d994 (update-index: work with c-quoted name).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-15 23:57:26 -08:00
Junio C Hamano 0ef617f4b6 diff: Fix miscounting of --check output
c1795bb (Unify whitespace checking) incorrectly made the
checking function return without incrementing the line numbers
when there is no whitespace problem is found on a '+' line.

This resurrects the earlier behaviour.

Noticed and reported by Jay Soffian.  The test script was stolen
from Jay's independent fix.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-15 23:06:57 -08:00
Stelian Pop 13bf1a9976 hg-to-git: fix parent analysis
Fix a bug in the hg-to-git convertor introduced by commit
1bc7c13af9: when searching the changeset
parents, 'hg log' returns an extra space at the end of the line, which
confuses the .split(' ') based tokenizer:

    Traceback (most recent call last):
      File "hg-to-git.py", line 123, in <module>
          hgchildren[mparent] += ( str(cset), )
      KeyError: ''

Signed-off-by: Stelian Pop <stelian@popies.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-15 23:01:49 -08:00
Jay Soffian 87f1b8849b mailinfo: feed only one line to handle_filter() for QP input
The function is intended to be fed one logical line at a time to
inspect, but a QP encoded raw input line can have more than one
lines, just like BASE64 encoded one.

Quoting LF as =0A may be unusual but RFC2045 allows it.

The issue was noticed and fixed by Jay Soffian.  JC added a test
to protect the fix from regressing later.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-15 22:16:34 -08:00
Christian Couder b20a60d0c0 diff.c: add "const" qualifier to "char *cmd" member of "struct ll_diff_driver"
Also use "git_config_string" to simplify code where "cmd" is set.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-15 21:24:54 -08:00
Christian Couder dfb068be8d Add "const" qualifier to "char *excludes_file".
Also use "git_config_string" to simplify "config.c" code
where "excludes_file" is set.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-15 21:24:54 -08:00
Christian Couder ee9601e6be Add "const" qualifier to "char *editor_program".
Also use "git_config_string" to simplify "config.c" code
where "editor_program" is set.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-15 21:24:53 -08:00
Christian Couder 872da32d80 Add "const" qualifier to "char *pager_program".
Also use "git_config_string" to simplify "config.c" code
where "pager_program" is set.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-15 21:24:53 -08:00
Christian Couder ea5105a5e3 config: add 'git_config_string' to refactor string config variables.
In many places we just check if a value from the config file is not
NULL, then we duplicate it and return 0. This patch introduces the new
'git_config_string' function to do that.

This function is also used to refactor some code in 'config.c'.
Refactoring other files is left for other patches.

Also not all the code in "config.c" is refactored, because the function
takes a "const char **" as its first parameter, but in many places a
"char *" is used instead of a "const char *". (And C does not allow
using a "char **" instead of a "const char **" without a warning.)

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-15 21:24:53 -08:00
Christian Couder 2c778210f8 diff.c: remove useless check for value != NULL
It is not necessary to check if value != NULL before calling
'parse_lldiff_command' as there is already a check inside this
function.

By the way this patch also improves the existing check inside
'parse_lldiff_command' by using:
	return config_error_nonbool(var);
instead of:
	return error("%s: lacks value", var);

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-15 21:24:53 -08:00
Shawn O. Pearce e8b32e0610 fast-import: check return value from unpack_entry()
If the tree object we have asked for is deltafied in the packfile and
the delta did not apply correctly or was not able to be decompressed
from the packfile then we can get back NULL instead of the tree data.
This is (part of) the reason why read_sha1_file() can return NULL, so
we need to also handle it the same way.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-15 20:11:51 -08:00
Daniel Barkalow df93e33c8b Validate nicknames of remote branches to prohibit confusing ones
The original problem was that the parsers for configuration files were
getting confused by seeing as nicknames remotes that involved
directory-changing characters. In particular, the branches config file
for ".." was particularly mystifying on platforms that can open
directories and read odd data from them.

The validation function was written by Junio Hamano (with a typo
corrected).

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-15 14:23:22 -08:00
Christian Couder 8ca496e97d diff.c: replace a 'strdup' with 'xstrdup'.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-15 14:11:28 -08:00
Junio C Hamano 588071112c diff.c: fixup garding of config parser from value=NULL
Christian Couder noticed that there still were a handcrafted error()
call that we should have converted to config_error_nonbool() where
parse_lldiff_command() parses the configuration file.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-15 09:37:54 -08:00
Christian Couder d8e87570c3 config: add test cases for empty value and no value config variables.
The tests in 't1300-repo-config.sh' did not check what happens when
an empty value like the following is used in the config file:

[emptyvalue]
	variable =

Also it was not checked that a variable with no value like the
following:

[novalue]
	variable

gives a boolean "true" value, while an ampty value gives a boolean
"false" value.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-13 14:23:32 -08:00
Gerrit Pape 9386ecbb1c cvsimport: have default merge regex also match beginning of commit message
The default value of @mergerx uses \W, which matches a non-word
character; this means that commit messages like "Merging FOO" are not
matched by default; using \b, which matches a word boundary, instead of
\W fixes that.

This change was suggested by Frédéric Brière through
 http://bugs.debian.org/463468

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-13 14:22:54 -08:00
Miklos Vajna 846688726c git clone -s documentation: force a new paragraph for the NOTE
It should be loud and clear.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-13 14:15:44 -08:00
Jeff King ff58b9aaf8 status: suggest "git rm --cached" to unstage for initial commit
It makes no sense to suggest "git reset HEAD" since we have
no HEAD commit. This actually used to work but regressed in
f26a0012.

wt_status_print_cached_header was updated to take the whole
wt_status struct rather than just the reference field.
Previously the various code paths were sometimes sending in
s->reference and sometimes sending in NULL, making the
decision on whether this was an initial commit before we
even got to this function. Now we must check the initial
flag here.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-13 13:54:58 -08:00
Junio C Hamano 077b725f0b Protect get_author_ident_from_commit() from filenames in work tree
We used to use "cat-file commit $commit" to extract the original
author information from existing commit, but an earlier commit
5ac2715 (Consistent message encoding while reusing log from an
existing commit) changed it to use "git show -s $commit".  If
you have a file in your work tree that can be interpreted as a
valid object name (e.g. "HEAD"), this conversion will not work.

Disambiguate by marking the end of revision parameter on the
comand line with an explicit "--" to fix this.

This breakage is most visible with rebase when a file called
"HEAD" exists in the worktree.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-13 13:43:02 -08:00
Johannes Sixt 04b330551e upload-pack: Initialize the exec-path.
Since git-upload-pack has to spawn git-pack-objects, it has to make sure
that the latter can be found in the PATH. Without this patch an attempt
to clone or pull via ssh from a server fails if the git tools are not in
the standard PATH on the server even though git clone or git pull were
invoked with --upload-pack=/path/to/git-upload-pack.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-13 12:04:01 -08:00
Johannes Schindelin f454cdc48f bisect: use verbatim commit subject in the bisect log
Due to a typo, the commit subject was shell expanded in the bisect log.
That is, if you had some shell pattern in the commit subject, bisect
would happily put all matching file names into the log.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Tested-by: Frans Pop <elendil@planet.nl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-13 12:03:49 -08:00
Sergei Organov 8608b33434 git-cvsimport.txt: fix '-M' description.
Fix '-M' description. Old one reads as if the user can somehow "see"
the default regex when using -M along with -m.

Signed-off-by: Sergei Organov <osv@javad.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-13 11:08:41 -08:00
Junio C Hamano 75ad235c2e Revert "pack-objects: only throw away data during memory pressure"
This reverts commit 9c2174350c.

Nico analyzed and found out that this does not really help, and
I agree with it.

By the time this gets into action and data is actively thrown
away, performance simply goes down the drain due to the data
constantly being reloaded over and over and over and over and
over and over again, to the point of virtually making no
relative progress at all.  The previous behavior of enforcing
the memory limit by dynamically shrinking the window size at
least had the effect of allowing some kind of progress, even if
the end result wouldn't be optimal.

And that's the whole point behind this memory limiting feature:
allowing some progress to be made when resources are too limited
to let the repack go unbounded.
2008-02-12 23:39:03 -08:00
Junio C Hamano 6c47d0e8f3 config.c: guard config parser from value=NULL
user.{name,email}, core.{pager,editor,excludesfile,whitespace} and
i18n.{commit,logoutput}encoding all expect string values.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-11 13:14:25 -08:00
Junio C Hamano 90f5c1864c builtin-log.c: guard config parser from value=NULL
format.suffix expects a string value.  format.numbered is bool plus "auto"

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-11 13:14:25 -08:00
Junio C Hamano 3c17c34ac7 imap-send.c: guard config parser from value=NULL
None of the configuration variables this expects is boolean.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-11 13:14:25 -08:00
Junio C Hamano 451d36bb25 wt-status.c: guard config parser from value=NULL
status.color.* and color.status.* expect a string value

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-11 13:11:37 -08:00
Junio C Hamano 180483c5c9 setup.c: guard config parser from value=NULL
core.worktree expects a string value

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-11 13:11:37 -08:00
Junio C Hamano d2370cc296 remote.c: guard config parser from value=NULL
branch.*.{remote,merge} expect a string value

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-11 13:11:37 -08:00
Junio C Hamano e098368b5b merge-recursive.c: guard config parser from value=NULL
merge.default, merge.*.{name,driver} expect a string value

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-11 13:11:37 -08:00
Junio C Hamano 111dd25f3c http.c: guard config parser from value=NULL
http.sslcert and friends expect a string value

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-11 13:11:37 -08:00
Junio C Hamano b51b2bb4c3 help.c: guard config parser from value=NULL
help.format configuration expects a string value

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-11 13:11:37 -08:00