git.git
16 years agoMerge branch 'maint'
Junio C Hamano [Fri, 22 Feb 2008 22:01:43 +0000 (14:01 -0800)]
Merge branch 'maint'

* maint:
  hash: fix lookup_hash semantics

16 years agohash: fix lookup_hash semantics
Jeff King [Fri, 22 Feb 2008 19:47:27 +0000 (14:47 -0500)]
hash: fix lookup_hash semantics

We were returning the _address of_ the stored item (or NULL)
instead of the item itself. While this sort of indirection
is useful for insertion (since you can lookup and then
modify), it is unnecessary for read-only lookup. Since the
hash code splits these functions between the internal
lookup_hash_entry function and the public lookup_hash
function, it makes sense for the latter to provide what
users of the library expect.

The result of this was that the index caching returned bogus
results on lookup. We unfortunately didn't catch this
because we were returning a "struct cache_entry **" as a
"void *", and accidentally assigning it to a "struct
cache_entry *".

As it happens, this actually _worked_ most of the time,
because the entries were defined as:

  struct cache_entry {
  struct cache_entry *next;
  ...
  };

meaning that interpreting a "struct cache_entry **" as a
"struct cache_entry *" would yield an entry where all fields
were totally bogus _except_ for the next pointer, which
pointed to the actual cache entry. When walking the list, we
would look at the bogus "name" field, which was unlikely to
match our lookup, and then proceed to the "real" entry.

The reading of bogus data was silently ignored most of the
time, but could cause a segfault for some data (which seems
to be more common on OS X).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogitweb: Better chopping in commit search results
Junio C Hamano [Fri, 22 Feb 2008 16:33:47 +0000 (17:33 +0100)]
gitweb: Better chopping in commit search results

When searching commit messages (commit search), if matched string is
too long, the generated HTML was munged leading to an ill-formed XHTML
document.

Now gitweb chop leading, trailing and matched parts, HTML escapes
those parts, then composes and marks up match info.  HTML output is
never chopped.  Limiting matched info to 80 columns (with slop) is now
done by dividing remaining characters after chopping match equally to
leading and trailing part, not by chopping composed and HTML marked
output.

Noticed-by: Jean-Baptiste Quenot <jbq@caraldi.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agobuiltin-tag.c: remove cruft
Gerrit Pape [Fri, 22 Feb 2008 09:53:09 +0000 (09:53 +0000)]
builtin-tag.c: remove cruft

After changing builtin-tag.c to use strbuf in fd17f5b (Replace all
read_fd use with strbuf_read, and get rid of it.), the last condition
in do_sign() will always be false, as it's checked already right
above.  So let's remove the cruft.

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-merge-index documentation: clarify synopsis
Gerrit Pape [Fri, 22 Feb 2008 08:55:29 +0000 (08:55 +0000)]
git-merge-index documentation: clarify synopsis

The options following <merge-program> are not -a, --, or <file>...,
but either -a, or -- <file>..., while -- is optional.

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agosend-email: fix In-Reply-To regression
Jay Soffian [Fri, 22 Feb 2008 00:16:04 +0000 (19:16 -0500)]
send-email: fix In-Reply-To regression

Fix a regression introduced by

1ca3d6e (send-email: squelch warning due to comparing undefined $_ to "")

where if the user was prompted for an initial In-Reply-To and didn't
provide one, messages would be sent out with an invalid In-Reply-To of
"<>"

Also add test cases for the regression and the fix. A small modification
was needed to allow send-email to take its replies from stdin if the
environment variable GIT_SEND_EMAIL_NOTTY is set.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-reset --hard and git-read-tree --reset: fix read_cache_unmerged()
Junio C Hamano [Thu, 21 Feb 2008 19:33:56 +0000 (11:33 -0800)]
git-reset --hard and git-read-tree --reset: fix read_cache_unmerged()

When invalidating unmerged entries in the index, we used to set
their ce_mode to 0 to note the fact that they do not matter
anymore which also made sure that later unpack_trees() call
would not reuse them.  Instead just remove them from the index.

Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoTeach git-grep --name-only as synonym for -l
Shawn O. Pearce [Thu, 21 Feb 2008 04:28:07 +0000 (23:28 -0500)]
Teach git-grep --name-only as synonym for -l

I expected git grep --name-only to give me only the file names,
much as git diff --name-only only generates filenames.  Alas the
option is -l, which matches common external greps but doesn't match
other parts of the git UI.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agodiff: fix java funcname pattern for solaris
Jeff King [Thu, 21 Feb 2008 00:01:16 +0000 (19:01 -0500)]
diff: fix java funcname pattern for solaris

The Solaris regex library doesn't like having the '$' anchor
inside capture parentheses. It rejects the match, causing
t4018 to fail.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agot3404: use configured shell instead of /bin/sh
Jeff King [Thu, 21 Feb 2008 00:00:44 +0000 (19:00 -0500)]
t3404: use configured shell instead of /bin/sh

The fake-editor shell script invoked /bin/sh; normally this
is fine, unless the /bin/sh doesn't meet our compatibility
requirements, as is the case with Solaris. Specifically, the
$() syntax used by fake-editor is not understood.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit_config_*: don't assume we are parsing a config file
Jeff King [Thu, 21 Feb 2008 00:00:32 +0000 (19:00 -0500)]
git_config_*: don't assume we are parsing a config file

These functions get called by other code, including parsing
config options from the command line. In that case,
config_file_name is NULL, leading to an ugly message or even
a segfault on some implementations of printf.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoprefix_path: use is_absolute_path() instead of *orig == '/'
Johannes Sixt [Tue, 19 Feb 2008 21:29:40 +0000 (22:29 +0100)]
prefix_path: use is_absolute_path() instead of *orig == '/'

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-clean: handle errors if removing files fails
Miklos Vajna [Thu, 21 Feb 2008 01:44:46 +0000 (02:44 +0100)]
git-clean: handle errors if removing files fails

git-clean simply ignored errors if removing a file or directory failed. This
patch makes it raise a warning and the exit code also greater than zero if
there are remaining files.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'mk/color'
Junio C Hamano [Thu, 21 Feb 2008 00:13:56 +0000 (16:13 -0800)]
Merge branch 'mk/color'

* mk/color:
  Add color.ui variable which globally enables colorization if set

16 years agoMerge branch 'js/maint-cvsexport'
Junio C Hamano [Thu, 21 Feb 2008 00:13:52 +0000 (16:13 -0800)]
Merge branch 'js/maint-cvsexport'

* js/maint-cvsexport:
  cvsexportcommit: be graceful when "cvs status" reorders the arguments

Conflicts:

t/t9200-git-cvsexportcommit.sh

16 years agoMerge branch 'js/maint-http-push'
Junio C Hamano [Thu, 21 Feb 2008 00:13:32 +0000 (16:13 -0800)]
Merge branch 'js/maint-http-push'

* js/maint-http-push:
  http-push: avoid a needless goto
  http-push: do not get confused by submodules
  http-push: avoid invalid memory accesses

16 years agoMerge branch 'jk/empty-tree'
Junio C Hamano [Thu, 21 Feb 2008 00:13:28 +0000 (16:13 -0800)]
Merge branch 'jk/empty-tree'

* jk/empty-tree:
  add--interactive: handle initial commit better
  hard-code the empty tree object

16 years agoMerge branch 'lt/revision-walker'
Junio C Hamano [Thu, 21 Feb 2008 00:13:24 +0000 (16:13 -0800)]
Merge branch 'lt/revision-walker'

* lt/revision-walker:
  Add "--show-all" revision walker flag for debugging

16 years agoMerge branch 'mc/prefix'
Junio C Hamano [Thu, 21 Feb 2008 00:13:22 +0000 (16:13 -0800)]
Merge branch 'mc/prefix'

* mc/prefix:
  Avoid a useless prefix lookup in strbuf_expand()

16 years agoMerge branch 'bc/fopen'
Junio C Hamano [Thu, 21 Feb 2008 00:13:19 +0000 (16:13 -0800)]
Merge branch 'bc/fopen'

* bc/fopen:
  Add compat/fopen.c which returns NULL on attempt to open directory

16 years agoMerge branch 'jc/setup'
Junio C Hamano [Thu, 21 Feb 2008 00:13:16 +0000 (16:13 -0800)]
Merge branch 'jc/setup'

* jc/setup:
  builtin-mv: minimum fix to avoid losing files
  git-add: adjust to the get_pathspec() changes.
  Make blame accept absolute paths
  setup: sanitize absolute and funny paths in get_pathspec()

16 years agoMerge branch 'maint'
Junio C Hamano [Thu, 21 Feb 2008 00:13:13 +0000 (16:13 -0800)]
Merge branch 'maint'

* maint:
  Clarified the meaning of git-add -u in the documentation
  git-clone.sh: properly configure remote even if remote's head is dangling
  Documentation/git-stash: document options for git stash list
  send-email: squelch warning due to comparing undefined $_ to ""

16 years agoClarified the meaning of git-add -u in the documentation
Pekka Kaitaniemi [Wed, 20 Feb 2008 22:29:39 +0000 (00:29 +0200)]
Clarified the meaning of git-add -u in the documentation

The git-add documentation did not state clearly that the -u switch
updates only the tracked files that are in the current directory and
its subdirectories.

Signed-off-by: Pekka Kaitaniemi <kaitanie@cc.helsinki.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-clone.sh: properly configure remote even if remote's head is dangling
Gerrit Pape [Wed, 20 Feb 2008 15:10:17 +0000 (15:10 +0000)]
git-clone.sh: properly configure remote even if remote's head is dangling

When cloning a remote repository which's HEAD refers to a nonexistent
ref, git-clone cloned all existing refs, but failed to write the
configuration for 'remote'.  Now it detects the dangling remote HEAD,
refuses to checkout any local branch since HEAD refers to nowhere, but
properly writes the configuration for 'remote', so that subsequent
'git fetch's don't fail.

The problem was reported by Daniel Jacobowitz through
 http://bugs.debian.org/466581

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit.el: Set process-environment instead of invoking env
David Kågedal [Tue, 19 Feb 2008 14:01:53 +0000 (15:01 +0100)]
git.el: Set process-environment instead of invoking env

This will make it a little less posix-dependent, and more efficient.

Included is also a minor doc improvement.

Signed-off-by: David Kågedal <davidk@lysator.liu.se>
Acked-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDocumentation/git-stash: document options for git stash list
Miklos Vajna [Wed, 20 Feb 2008 11:31:35 +0000 (12:31 +0100)]
Documentation/git-stash: document options for git stash list

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agosend-email: squelch warning due to comparing undefined $_ to ""
Jay Soffian [Wed, 20 Feb 2008 05:55:07 +0000 (00:55 -0500)]
send-email: squelch warning due to comparing undefined $_ to ""

The check to see if initial_reply_to is defined was also comparing $_ to
"" for a reason I cannot ascertain (looking at the commit which made the
change didn't provide enlightenment), but if $_ is undefined, perl
generates a warning.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'maint'
Junio C Hamano [Wed, 20 Feb 2008 08:54:24 +0000 (00:54 -0800)]
Merge branch 'maint'

* maint:
  Rename git-core rpm to just git and rename the meta-pacakge to git-all.
  push: document the status output
  Documentation/push: clarify matching refspec behavior
  push: indicate partialness of error message

16 years agocvsexportcommit: be graceful when "cvs status" reorders the arguments
Johannes Schindelin [Mon, 18 Feb 2008 17:55:22 +0000 (17:55 +0000)]
cvsexportcommit: be graceful when "cvs status" reorders the arguments

In my use cases, "cvs status" sometimes reordered the passed filenames,
which often led to a misdetection of a dirty state (when it was in
reality a clean state).

I finally tracked it down to two filenames having the same basename.

So no longer trust the order of the results blindly, but actually check
the file name.

Since "cvs status" only returns the basename (and the complete path on the
server which is useless for our purposes), run "cvs status" several times
with lists consisting of files with unique (chomped) basenames.

Be a bit clever about new files: these are reported as "no file <blabla>",
so in order to discern it from existing files, prepend "no file " to the
basename.

In other words, one call to "cvs status" will not ask for two files
"blabla" (which does not yet exist) and "no file blabla" (which exists).

This patch makes cvsexportcommit slightly slower, when the list of changed
files has non-unique basenames, but at least it is accurate now.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoRename git-core rpm to just git and rename the meta-pacakge to git-all.
Kristian Høgsberg [Mon, 18 Feb 2008 23:11:21 +0000 (18:11 -0500)]
Rename git-core rpm to just git and rename the meta-pacakge to git-all.

This fixes my favorite annoyance with the git rpm packaging: don't pull
in tla when I say yum install git!  You wouldn't expect yum install gcc
to pull in gcc-gfortran, right?

With this change, and blanket 'yum update' will automatically pull in the
new 'git' package and push out the old 'git-core', and if the old 'git'
package was installed 'git-all' will be pulled in instead.  A couple of
things do break though: 'yum update git-core', because yum behaves
differently when given a specific package name - it doesn't follow obsoletes.

Instead, 'yum install git' will pull in the new git rpm, which will then
push out the old 'git-core'.  Similarly, to get the newest version of
the meta package, 'yum install git-all' will install git-all, which then
pushes out the old 'git' meta package.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoTechnical documentation of the run-command API.
Johannes Sixt [Mon, 18 Feb 2008 19:23:03 +0000 (20:23 +0100)]
Technical documentation of the run-command API.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoCorrect git-pull documentation
Jay Soffian [Tue, 19 Feb 2008 19:24:32 +0000 (14:24 -0500)]
Correct git-pull documentation

The --rebase option was documented in the wrong place (under MERGE
STRATEGIES instead of OPTIONS). Noted the branch.<name>.rebase
option.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogitweb: Fix bug in href(..., -replay=>1) when using 'pathinfo' form
Jakub Narebski [Thu, 14 Feb 2008 08:22:30 +0000 (09:22 +0100)]
gitweb: Fix bug in href(..., -replay=>1) when using 'pathinfo' form

URLs generated by href(..., -replay=>1) (which includes 'next page'
links and alternate view links) didn't set project info correctly
when current page URL is in pathinfo form.

This resulted in broken links such like:

  http://www.example.com/w/ARRAY(0x85a5318)?a=shortlog;pg=1

if the 'pathinfo' feature was used, or

  http://www.example.com/w/?a=shortlog;pg=1

if it wasn't, instead of correct:

  http://www.example.com/w/project.git?a=shortlog;pg=1

This was caused by the fact that href() always replays params in the
arrayref form, were they multivalued or singlevalued, and the code
dealing with 'pathinfo' feature couldn't deal with $params{'project'}
being arrayref.

Setting $params{'project'} is moved before replaying params; this
ensures that 'project' parameter is processed correctly.

Noticed-by: Peter Oberndorfer <kumbayo84@arcor.de>
Noticed-by: Wincent Colaiuta <win@wincent.com>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agopush: document the status output
Jeff King [Tue, 19 Feb 2008 16:26:45 +0000 (11:26 -0500)]
push: document the status output

The output was meant to be a balance of self-explanatory and
terse. In case we have erred too far on the terse side, it
doesn't hurt to explain in more detail what each line means.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDocumentation/push: clarify matching refspec behavior
Jeff King [Tue, 19 Feb 2008 16:25:22 +0000 (11:25 -0500)]
Documentation/push: clarify matching refspec behavior

The previous text was correct, but it was easy to miss the
fact that we are talking about "matching" refs. That is, the
text can be parsed as "we push the union of the sets
of remote and local heads" and not "we push the intersection
of the sets of remote and local heads". (The former actually
doesn't make sense if you think about it, since we don't
even _have_ some of those heads). A careful reading would
reveal the correct meaning, but it makes sense to be as
explicit as possible in documentation.

We also explicitly use and introduce the term "matching";
this is a term discussed on the list, and it seems useful
to for users to be able to refer to this behavior by name.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agopush: indicate partialness of error message
Jeff King [Tue, 19 Feb 2008 16:25:01 +0000 (11:25 -0500)]
push: indicate partialness of error message

The existing message indicates that an error occured during
push, but it is unclear whether _any_ refs were actually
pushed (even though the status table above shows which were
pushed successfully and which were not, the message "failed
to push" implies a total failure). By indicating that "some
refs" failed, we hopefully indicate to the user that the
table above contains the details.

We could also put in an explicit "see above for details"
message, but it seemed to clutter the output quite a bit
(both on a line of its own, or at the end of the error line,
which inevitably wraps).

This could also be made more fancy if the transport
mechanism passed back more details on how many refs
succeeded and failed:

  error: failed to push %d out of %d refs to '%s'

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoAPI documentation for remote.h
Daniel Barkalow [Tue, 19 Feb 2008 07:52:11 +0000 (02:52 -0500)]
API documentation for remote.h

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoSimplify setup of $GIT_DIR in git-sh-setup.sh
Lars Hjemli [Mon, 18 Feb 2008 10:44:19 +0000 (11:44 +0100)]
Simplify setup of $GIT_DIR in git-sh-setup.sh

Using 'git rev-parse --git-dir' makes the code shorter and more future-
proof.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'mk/maint-parse-careful'
Junio C Hamano [Tue, 19 Feb 2008 04:56:01 +0000 (20:56 -0800)]
Merge branch 'mk/maint-parse-careful'

* mk/maint-parse-careful:
  peel_onion: handle NULL
  check return value from parse_commit() in various functions
  parse_commit: don't fail, if object is NULL
  revision.c: handle tag->tagged == NULL
  reachable.c::process_tree/blob: check for NULL
  process_tag: handle tag->tagged == NULL
  check results of parse_commit in merge_bases
  list-objects.c::process_tree/blob: check for NULL
  reachable.c::add_one_tree: handle NULL from lookup_tree
  mark_blob/tree_uninteresting: check for NULL
  get_sha1_oneline: check return value of parse_object
  read_object_with_reference: don't read beyond the buffer

16 years agopeel_onion: handle NULL
Martin Koegler [Mon, 18 Feb 2008 20:47:58 +0000 (21:47 +0100)]
peel_onion: handle NULL

Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agocheck return value from parse_commit() in various functions
Martin Koegler [Mon, 18 Feb 2008 20:48:03 +0000 (21:48 +0100)]
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>
16 years agoparse_commit: don't fail, if object is NULL
Martin Koegler [Mon, 18 Feb 2008 20:48:02 +0000 (21:48 +0100)]
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>
16 years agorevision.c: handle tag->tagged == NULL
Martin Koegler [Mon, 18 Feb 2008 20:48:01 +0000 (21:48 +0100)]
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>
16 years agoreachable.c::process_tree/blob: check for NULL
Martin Koegler [Mon, 18 Feb 2008 20:48:00 +0000 (21:48 +0100)]
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>
16 years agoprocess_tag: handle tag->tagged == NULL
Martin Koegler [Mon, 18 Feb 2008 20:47:59 +0000 (21:47 +0100)]
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>
16 years agocheck results of parse_commit in merge_bases
Martin Koegler [Mon, 18 Feb 2008 20:47:57 +0000 (21:47 +0100)]
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>
16 years agolist-objects.c::process_tree/blob: check for NULL
Martin Koegler [Mon, 18 Feb 2008 20:47:56 +0000 (21:47 +0100)]
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>
16 years agoreachable.c::add_one_tree: handle NULL from lookup_tree
Martin Koegler [Mon, 18 Feb 2008 20:47:55 +0000 (21:47 +0100)]
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>
16 years agomark_blob/tree_uninteresting: check for NULL
Martin Koegler [Mon, 18 Feb 2008 20:47:54 +0000 (21:47 +0100)]
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>
16 years agoget_sha1_oneline: check return value of parse_object
Martin Koegler [Mon, 18 Feb 2008 20:47:53 +0000 (21:47 +0100)]
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>
16 years agoread_object_with_reference: don't read beyond the buffer
Martin Koegler [Mon, 18 Feb 2008 20:47:52 +0000 (21:47 +0100)]
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>
16 years agoAdd color.ui variable which globally enables colorization if set
Matthias Kestenholz [Mon, 18 Feb 2008 07:26:03 +0000 (08:26 +0100)]
Add color.ui variable which globally enables colorization if set

Signed-off-by: Matthias Kestenholz <mk@spinlock.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agocheck return code of prepare_revision_walk
Martin Koegler [Mon, 18 Feb 2008 07:31:56 +0000 (08:31 +0100)]
check return code of prepare_revision_walk

A failure in prepare_revision_walk can be caused by
a not parseable object.

Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoderef_tag: handle tag->tagged = NULL
Martin Koegler [Mon, 18 Feb 2008 07:31:55 +0000 (08:31 +0100)]
deref_tag: handle tag->tagged = NULL

Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoderef_tag: handle return value NULL
Martin Koegler [Mon, 18 Feb 2008 07:31:54 +0000 (08:31 +0100)]
deref_tag: handle return value NULL

Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agohelp.c: use 'git_config_string' to get 'help_default_format'.
Christian Couder [Sun, 17 Feb 2008 19:52:50 +0000 (20:52 +0100)]
help.c: use 'git_config_string' to get 'help_default_format'.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'br/gitweb'
Junio C Hamano [Mon, 18 Feb 2008 03:31:18 +0000 (19:31 -0800)]
Merge branch 'br/gitweb'

* br/gitweb:
  gitweb: Use the config file to set repository owner's name.

16 years agogitweb: Add new option -nohtml to quot_xxx subroutines
Jakub Narebski [Sun, 17 Feb 2008 17:48:13 +0000 (18:48 +0100)]
gitweb: Add new option -nohtml to quot_xxx subroutines

Add support for new option -nohtml to quot_cec and quot_upr
subroutines, to have output not wrapped in HTML tags.  This makes
those subroutines suitable to quoting attributes values, and for plain
text output quoting.  Currently this API is not used yet.

While at it fix whitespace, and use ';' as delimiter, not separator.

The option to not wrap quot_cec output in HTML tag were proposed
originally in patch:
  "Don't open a XML tag while another one is already open"
  Message-ID: <20080216191628.GK30676@schiele.dyndns.org>
by Robert Schiele.  Originally the parameter was named '-notag', was
also supportted by esc_html (but not esc_path) which passed it down to
quot_cec.  Mentioned patch was meant to fix the bug Martin Koegler
reported in his mail
  "Invalid html output repo.or.cz (alt-git.git)"
  Message-ID: <20080216130037.GA14571@auto.tuwien.ac.at>
which was fixed in different way (do not use esc_html to escape and
quote HTML attributes).

Signed-off-by: Robert Schiele <rschiele@gmail.com>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogitweb: Fix displaying unchopped argument in chop_and_escape_str
Jakub Narebski [Sat, 16 Feb 2008 22:07:46 +0000 (23:07 +0100)]
gitweb: Fix displaying unchopped argument in chop_and_escape_str

Do not use esc_html to escape [title] _attribute_ of a HTML element,
and quote unprintable characters.  Replace unprintable characters by
'?' and use CGI method to generate HTML element and do the escaping.

This caused bug noticed by Martin Koegler,
  Message-ID: <20080216130037.GA14571@auto.tuwien.ac.at>
that for bad commit encoding in author name, the title attribute (here
to show full, not shortened name) had embedded HTML code in it, result
of quoting unprintable characters the gitweb/HTML way. This of course
broke the HTML, causing page being not displayed in XML validating web
browsers.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agobisect view: check for MinGW32 and MacOSX in addition to X11
Johannes Schindelin [Thu, 14 Feb 2008 12:29:58 +0000 (12:29 +0000)]
bisect view: check for MinGW32 and MacOSX in addition to X11

When deciding if gitk or git-log should be used to visualize the current
state, the environment variable DISPLAY was checked.  Now, we check
MSYSTEM (for MinGW32/MSys) and SECURITYSESSIONID (for MacOSX) in addition.

Note that there is currently no way to ssh into MinGW32, and that
SECURITYSESSIONID is not set automatically on MacOSX when ssh'ing into it.
So this patch should be safe.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agosending errors to stdout under $PAGER
Junio C Hamano [Sat, 16 Feb 2008 19:15:41 +0000 (11:15 -0800)]
sending errors to stdout under $PAGER

If you do this (and you are not an Emacs user who uses PAGER=cat
in your *shell* buffer):

        $ git init
        Initialized empty Git repository in .git/
        $ echo hello world >foo
        $ H=$(git hash-object -w foo)
        $ git tag -a foo-tag -m "Tags $H" $H
        $ echo $H
        3b18e512dba79e4c8300dd08aeb37f8e728b8dad
        $ rm -f .git/objects/3b/18e5*
        $ git show foo-tag
        tag foo-tag
        Tagger: Junio C Hamano <gitster@pobox.com>
        Date:   Sat Feb 16 10:43:23 2008 -0800

        Tags 3b18e512dba79e4c8300dd08aeb37f8e728b8dad

you do not get any indication of error.  If you are careful, you
would notice that no contents from the tagged object is
displayed, but that is about it.  If you run the "show" command
without pager, however, you will see the error:

        $ git --no-pager show foo-tag
        tag foo-tag
        Tagger: Junio C Hamano <gitster@pobox.com>
        Date:   Sat Feb 16 10:43:23 2008 -0800

        Tags 3b18e512dba79e4c8300dd08aeb37f8e728b8dad
        error: Could not read object 3b18e512dba79e4c8300dd08aeb37f8e728b8dad

Because we spawn the pager as the foreground process and feed
its input via pipe from the real command, we cannot affect the
exit status the shell sees from git command when the pager is in
use (I think there is not much gain we can have by working it
around, though).  But at least it may make sense to show the
error message to the user sitting in front of the pager.

[jc: Edgar Toernig suggested a much nicer implementation than
what I originally posted, which I took.]

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoSync with 1.5.4.2 and start 1.5.5 Release Notes
Junio C Hamano [Sun, 17 Feb 2008 09:18:54 +0000 (01:18 -0800)]
Sync with 1.5.4.2 and start 1.5.5 Release Notes

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'maint'
Junio C Hamano [Sun, 17 Feb 2008 09:16:44 +0000 (01:16 -0800)]
Merge branch 'maint'

* maint:
  GIT 1.5.4.2

16 years agoGIT 1.5.4.2 v1.5.4.2
Junio C Hamano [Sun, 17 Feb 2008 06:44:31 +0000 (22:44 -0800)]
GIT 1.5.4.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'bd/qsort'
Junio C Hamano [Sun, 17 Feb 2008 02:11:10 +0000 (18:11 -0800)]
Merge branch 'bd/qsort'

* bd/qsort:
  compat: Add simplified merge sort implementation from glibc

16 years agoMerge branch 'sp/safecrlf'
Junio C Hamano [Sun, 17 Feb 2008 01:59:20 +0000 (17:59 -0800)]
Merge branch 'sp/safecrlf'

* sp/safecrlf:
  safecrlf: Add mechanism to warn about irreversible crlf conversions

16 years agoMerge branch 'cc/browser'
Junio C Hamano [Sun, 17 Feb 2008 01:57:47 +0000 (17:57 -0800)]
Merge branch 'cc/browser'

* cc/browser:
  Documentation: add 'git-web--browse.txt' and simplify other docs.
  git-web--browse: fix misplaced quote in init_browser_path()
  web--browse: Add a few quotes in 'init_browser_path'.
  Documentation: instaweb: add 'git-web--browse' information.
  Adjust .gitignore for 5884f1(Rename 'git-help--browse.sh'...)
  git-web--browse: do not start the browser with nohup
  instaweb: use 'git-web--browse' to launch browser.
  Rename 'git-help--browse.sh' to 'git-web--browse.sh'.
  help--browse: add '--config' option to check a config option for a browser.
  help: make 'git-help--browse' usable outside 'git-help'.

Conflicts:

git-web--browse.sh

16 years agoMerge branch 'jc/gitignore-ends-with-slash'
Junio C Hamano [Sun, 17 Feb 2008 01:57:06 +0000 (17:57 -0800)]
Merge branch 'jc/gitignore-ends-with-slash'

* jc/gitignore-ends-with-slash:
  gitignore: lazily find dtype
  gitignore(5): Allow "foo/" in ignore list to match directory "foo"

16 years agoMerge branch 'pb/prepare-commit-msg'
Junio C Hamano [Sun, 17 Feb 2008 01:56:59 +0000 (17:56 -0800)]
Merge branch 'pb/prepare-commit-msg'

* pb/prepare-commit-msg:
  git-commit: add a prepare-commit-msg hook
  git-commit: Refactor creation of log message.
  git-commit: set GIT_EDITOR=: if editor will not be launched
  git-commit: support variable number of hook arguments

16 years agoMerge branch 'jk/noetcconfig'
Junio C Hamano [Sun, 17 Feb 2008 01:56:51 +0000 (17:56 -0800)]
Merge branch 'jk/noetcconfig'

* jk/noetcconfig:
  fix config reading in tests
  allow suppressing of global and system config

Conflicts:

cache.h

16 years agoMerge branch 'jc/submittingpatches'
Junio C Hamano [Sun, 17 Feb 2008 01:43:25 +0000 (17:43 -0800)]
Merge branch 'jc/submittingpatches'

* jc/submittingpatches:
  Documentation/SubmittingPatches - a suggested patch flow
  Documentation/SubmittingPatches: What's Acked-by and Tested-by?
  Documentation/SubmittingPatches: discuss first then submit
  Documentation/SubmittingPatches: Instruct how to use [PATCH] Subject header

16 years agoMerge git://repo.or.cz/git-gui
Junio C Hamano [Sun, 17 Feb 2008 01:42:49 +0000 (17:42 -0800)]
Merge git://repo.or.cz/git-gui

* git://repo.or.cz/git-gui:
  git-gui: Correct size of dictionary name widget in options dialog
  git-gui: Paper bag fix bad string length call in spellchecker

16 years agoMerge git://git.kernel.org/pub/scm/gitk/gitk
Junio C Hamano [Sun, 17 Feb 2008 01:41:38 +0000 (17:41 -0800)]
Merge git://git.kernel.org/pub/scm/gitk/gitk

* git://git.kernel.org/pub/scm/gitk/gitk:
  [PATCH] gitk: Heed the lines of context in merge commits

16 years agoMerge branch 'maint'
Junio C Hamano [Sun, 17 Feb 2008 01:41:23 +0000 (17:41 -0800)]
Merge branch 'maint'

* maint:
  Documentation/git-reset: Add an example of resetting selected paths
  Documentation/git-reset: don't mention --mixed for selected-paths reset
  Documentation/git-reset:

16 years agoDocumentation/SubmittingPatches - a suggested patch flow
Junio C Hamano [Sun, 10 Feb 2008 22:09:52 +0000 (14:09 -0800)]
Documentation/SubmittingPatches - a suggested patch flow

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDocumentation/git-reset: Add an example of resetting selected paths
Pieter de Bie [Sat, 16 Feb 2008 16:48:46 +0000 (17:48 +0100)]
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>
16 years agoDocumentation/git-reset: don't mention --mixed for selected-paths reset
Pieter de Bie [Sat, 16 Feb 2008 16:48:45 +0000 (17:48 +0100)]
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>
16 years agoDocumentation/git-reset:
Junio C Hamano [Sat, 16 Feb 2008 18:38:12 +0000 (10:38 -0800)]
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>
16 years agoadd--interactive: handle initial commit better
Jeff King [Wed, 13 Feb 2008 10:50:51 +0000 (05:50 -0500)]
add--interactive: handle initial commit better

There were several points where we looked at the HEAD
commit; for initial commits, this is meaningless. So instead
we:

  - show staged status data as a diff against the empty tree
    instead of HEAD
  - show file diffs as creation events
  - use "git rm --cached" to revert instead of going back to
    the HEAD commit

We magically reference the empty tree to implement this.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoUpdate fast-import documentation to discuss crash reports
Shawn O. Pearce [Thu, 14 Feb 2008 06:34:46 +0000 (01:34 -0500)]
Update fast-import documentation to discuss crash reports

Recent versions of fast-import will now dump information out upon
crashing, making it possible for the frontend developer to review
some state information and possibly restart the import from the
point where it crashed.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFinish current packfile during fast-import crash handler
Shawn O. Pearce [Thu, 14 Feb 2008 06:34:43 +0000 (01:34 -0500)]
Finish current packfile during fast-import crash handler

If fast-import is in the middle of crashing due to a protocol error
or something like that then it can be very useful to have the mark
table and all objects up until that point be available for a new
import to resume from.

Currently we just close the active packfile, unkeep all of our
newly created packfiles (so they can be deleted), and dump the
marks table to a temporary file.

We don't attempt to update the refs/tags that the process has in
memory as much of that data can be found in the crash report and I'm
not sure it would be the right thing to do under every type of crash.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoInclude the fast-import marks table in crash reports
Shawn O. Pearce [Thu, 14 Feb 2008 06:34:40 +0000 (01:34 -0500)]
Include the fast-import marks table in crash reports

If fast-import was not run with --export-marks but we are crashing
the frontend application developer may still benefit from having
that information available to them.  We now include the marks table
as part of the crash report if --export-marks was not supplied on
the command line.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoInclude annotated tags in fast-import crash reports
Shawn O. Pearce [Thu, 14 Feb 2008 06:34:36 +0000 (01:34 -0500)]
Include annotated tags in fast-import crash reports

If annotated tags were created they exist in a different namespace
within the fast-import process' internal memory tables so we did
not export them in the inactive branch table.  Now they are written
out after the branches, in the order that they were defined by the
frontend process.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDocumentation: add 'git-web--browse.txt' and simplify other docs.
Christian Couder [Thu, 14 Feb 2008 07:01:23 +0000 (08:01 +0100)]
Documentation: add 'git-web--browse.txt' and simplify other docs.

'git-help.txt' and 'git-instaweb.txt' contained duplicated
information about 'git-web--browse'.

This patch puts this information where it belongs.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-help--browse: improve browser support under OS X
Jay Soffian [Thu, 14 Feb 2008 08:36:14 +0000 (03:36 -0500)]
git-help--browse: improve browser support under OS X

/usr/bin/open <document> is used under OS X to open a document as if the
user had double-clicked on the file's icon (i.e. HTML files are opened
w/the user's default browser).

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Acked-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'maint'
Junio C Hamano [Sat, 16 Feb 2008 08:20:37 +0000 (00:20 -0800)]
Merge branch 'maint'

* maint:
  commit: discard index after setting up partial commit
  filter-branch: handle filenames that need quoting
  diff: Fix miscounting of --check output
  hg-to-git: fix parent analysis
  mailinfo: feed only one line to handle_filter() for QP input
  diff.c: add "const" qualifier to "char *cmd" member of "struct ll_diff_driver"
  Add "const" qualifier to "char *excludes_file".
  Add "const" qualifier to "char *editor_program".
  Add "const" qualifier to "char *pager_program".
  config: add 'git_config_string' to refactor string config variables.
  diff.c: remove useless check for value != NULL
  fast-import: check return value from unpack_entry()
  Validate nicknames of remote branches to prohibit confusing ones
  diff.c: replace a 'strdup' with 'xstrdup'.
  diff.c: fixup garding of config parser from value=NULL

16 years agocommit: discard index after setting up partial commit
Jeff King [Thu, 14 Feb 2008 17:18:23 +0000 (12:18 -0500)]
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>
16 years agofilter-branch: handle filenames that need quoting
Junio C Hamano [Sat, 16 Feb 2008 07:57:26 +0000 (23:57 -0800)]
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>
16 years agohttp-push: avoid a needless goto
Johannes Schindelin [Thu, 14 Feb 2008 23:26:12 +0000 (23:26 +0000)]
http-push: avoid a needless goto

There was a goto, and while it is not half as harmful as some people
believe, it was unnecessary here.  So remove it for readability.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agohttp-push: do not get confused by submodules
Johannes Schindelin [Thu, 14 Feb 2008 23:32:32 +0000 (23:32 +0000)]
http-push: do not get confused by submodules

When encountering submodules in a tree, http-push should not try sending
the respective object.  Instead, it should ignore it.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agohttp-push: avoid invalid memory accesses
Johannes Schindelin [Thu, 14 Feb 2008 23:25:33 +0000 (23:25 +0000)]
http-push: avoid invalid memory accesses

Before objects are sent, the respective ref is locked.  However,
without this patch, the lock is lifted before the last object for
that ref was sent.  As a consequence, the lock data was accessed
after the lock structure was free()d.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agodiff: Fix miscounting of --check output
Junio C Hamano [Sat, 16 Feb 2008 04:30:05 +0000 (20:30 -0800)]
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>
16 years agohg-to-git: fix parent analysis
Stelian Pop [Fri, 15 Feb 2008 21:20:44 +0000 (22:20 +0100)]
hg-to-git: fix parent analysis

Fix a bug in the hg-to-git convertor introduced by commit
1bc7c13af9f936aa80893100120b542338a10bf4: 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>
16 years agomailinfo: feed only one line to handle_filter() for QP input
Jay Soffian [Fri, 15 Feb 2008 21:53:36 +0000 (16:53 -0500)]
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>
16 years agodiff.c: add "const" qualifier to "char *cmd" member of "struct ll_diff_driver"
Christian Couder [Sat, 16 Feb 2008 05:02:17 +0000 (06:02 +0100)]
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>
16 years agoAdd "const" qualifier to "char *excludes_file".
Christian Couder [Sat, 16 Feb 2008 05:01:59 +0000 (06:01 +0100)]
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>
16 years agoAdd "const" qualifier to "char *editor_program".
Christian Couder [Sat, 16 Feb 2008 05:01:41 +0000 (06:01 +0100)]
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>
16 years agoAdd "const" qualifier to "char *pager_program".
Christian Couder [Sat, 16 Feb 2008 05:01:11 +0000 (06:01 +0100)]
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>
16 years agoconfig: add 'git_config_string' to refactor string config variables.
Christian Couder [Sat, 16 Feb 2008 05:00:24 +0000 (06:00 +0100)]
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>
16 years agodiff.c: remove useless check for value != NULL
Christian Couder [Sat, 16 Feb 2008 04:59:53 +0000 (05:59 +0100)]
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>