Commit graph

25753 commits

Author SHA1 Message Date
Ramsay Jones 488201c87e setup.c: Fix some "symbol not declared" sparse warnings
In particular, sparse issues the "symbol 'a_symbol' was not declared.
Should it be static?" warnings for the following symbols:

    setup.c:159:3: 'pathspec_magic'
    setup.c:176:12: 'prefix_pathspec'

These symbols only require file scope, so we add the static modifier
to their declarations.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-17 21:04:59 -07:00
Michael J Gruber 5a2df368c2 config: Give error message when not changing a multivar
When trying to set a multivar with "git config var value", "git config"
issues

warning: remote.repoor.push has multiple values

leaving the user under the impression that the operation succeeded,
unless one checks the return value.

Instead, make it

warning: remote.repoor.push has multiple values
error: cannot overwrite multiple values with a single value
       Use a regexp, --add or --set-all to change remote.repoor.push.

to be clear and helpful.

Note: The "warning" is raised through other code paths also so that it
needs to remain a warning for these (which do not raise the error). Only
the caller can determine how to go on from that.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-17 21:01:29 -07:00
Michael J Gruber 7a39741999 config: define and document exit codes
The return codes of git_config_set() and friends are magic numbers right
in the source. #define them in cache.h where the functions are declared,
and use the constants in the source.

Also, mention the resulting exit codes of "git config" in its man page
(and complete the list).

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-17 21:01:17 -07:00
Thomas Rast b5cc003253 add -i: ignore terminal escape sequences
On the author's terminal, the up-arrow input sequence is ^[[A, and
thus fat-fingering an up-arrow into 'git checkout -p' is quite
dangerous: git-add--interactive.perl will ignore the ^[ and [
characters and happily treat A as "discard everything".

As a band-aid fix, use Term::Cap to get all terminal capabilities.
Then use the heuristic that any capability value that starts with ^[
(i.e., \e in perl) must be a key input sequence.  Finally, given an
input that starts with ^[, read more characters until we have read a
full escape sequence, then return that to the caller.  We use a
timeout of 0.5 seconds on the subsequent reads to avoid getting stuck
if the user actually input a lone ^[.

Since none of the currently recognized keys start with ^[, the net
result is that the sequence as a whole will be ignored and the help
displayed.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-17 20:44:17 -07:00
Junio C Hamano b602ed7dea Update release notes to 1.7.6
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-16 17:19:24 -07:00
Junio C Hamano 1c1f046c43 Merge branch 'js/maint-1.6.6-send-pack-stateless-rpc-deadlock-fix' into js/maint-send-pack-stateless-rpc-deadlock-fix
* js/maint-1.6.6-send-pack-stateless-rpc-deadlock-fix:
  sideband_demux(): fix decl-after-stmt
2011-05-16 17:01:03 -07:00
Junio C Hamano fb53969686 Merge branch 'jc/convert'
* jc/convert:
  convert: make it harder to screw up adding a conversion attribute
  convert: make it safer to add conversion attributes
  convert: give saner names to crlf/eol variables, types and functions
  convert: rename the "eol" global variable to "core_eol"
2011-05-16 16:47:16 -07:00
Junio C Hamano 7a77754cf6 Merge branch 'ci/commit--interactive-atomic'
* ci/commit--interactive-atomic:
  Test atomic git-commit --interactive
  Add commit to list of config.singlekey commands
  Add support for -p/--patch to git-commit
  Allow git commit --interactive with paths
  t7501.8: feed a meaningful command
  Use a temporary index for git commit --interactive
2011-05-16 16:47:10 -07:00
Junio C Hamano 0184435268 Merge branch 'sg/completion-updates'
* sg/completion-updates:
  Revert "completion: don't declare 'local words' to make zsh happy"
  git-completion: fix regression in zsh support
  completion: move private shopt shim for zsh to __git_ namespace
  completion: don't declare 'local words' to make zsh happy
2011-05-16 16:47:00 -07:00
Junio C Hamano 8cee0f1d8a Merge branch 'kk/maint-prefix-in-config-mak'
* kk/maint-prefix-in-config-mak:
  Honor $(prefix) set in config.mak* when defining ETC_GIT*
  Revert "Honor $(prefix) set in config.mak* when defining ETC_GIT* and sysconfdir"
  Honor $(prefix) set in config.mak* when defining ETC_GIT* and sysconfdir
2011-05-16 16:46:53 -07:00
Junio C Hamano 36a45b4fa4 Merge branch 'mg/merge-ff-config'
* mg/merge-ff-config:
  tests: check git does not barf on merge.ff values for future versions of git
  merge: introduce merge.ff configuration variable

Conflicts:
	t/t7600-merge.sh
2011-05-16 16:46:23 -07:00
Junio C Hamano 6c7471bcf1 Merge branch 'maint'
* maint:
  Update draft release notes to 1.7.5.2
  Documentation/git-fsck.txt: fix typo: unreadable -> unreachable
2011-05-16 16:44:57 -07:00
Junio C Hamano ea1ab4b280 Update draft release notes to 1.7.5.2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-16 16:44:50 -07:00
Junio C Hamano 4bbfd8e3da Merge branch 'jn/maint-format-patch-doc' into maint
* jn/maint-format-patch-doc:
  Documentation: describe the format of messages with inline patches
2011-05-16 16:39:09 -07:00
Junio C Hamano 0f51322a6b Merge branch 'ss/cherry-pick-x-doc' into maint
* ss/cherry-pick-x-doc:
  doc: Clarify that "cherry-pick -x" does not use "git notes"
2011-05-16 16:38:56 -07:00
Junio C Hamano 8de4338650 Merge branch 'vr/merge-base-doc' into maint
* vr/merge-base-doc:
  Restructure documentation for git-merge-base.
  Documentation: update to git-merge-base --octopus
2011-05-16 16:38:46 -07:00
Junio C Hamano f7045912f8 Merge branch 'sr/maint-fast-import-tighten-option-parsing' into maint
* sr/maint-fast-import-tighten-option-parsing:
  fast-import: fix option parser for no-arg options
2011-05-16 16:38:16 -07:00
Junio C Hamano a8793d2178 Merge branch 'jc/t1506-shell-param-expansion-gotcha' into maint
* jc/t1506-shell-param-expansion-gotcha:
  t1507: avoid "${parameter<op>'word'}" inside double-quotes
2011-05-16 16:37:54 -07:00
Junio C Hamano 90e8b9b23d Merge branch 'jc/fix-add-u-unmerged' into maint
* jc/fix-add-u-unmerged:
  Fix "add -u" that sometimes fails to resolve unmerged paths

Conflicts:
	builtin/add.c
2011-05-16 16:37:33 -07:00
Junio C Hamano 81f90684bf Merge branch 'jn/gitweb-dependency' into maint
* jn/gitweb-dependency:
  Remove gitweb/gitweb.cgi and other legacy targets from main Makefile
  git-instaweb: Simplify build dependency on gitweb
2011-05-16 16:37:12 -07:00
Junio C Hamano 2f0db1d86b Merge branch 'jc/maint-branch-mergeoptions' into maint
* jc/maint-branch-mergeoptions:
  merge: make branch.<name>.mergeoptions correctly override merge.<option>

Conflicts:
	builtin/merge.c
2011-05-16 16:37:07 -07:00
Junio C Hamano c69e8b6935 Merge branch 'jc/maint-add-p-overlapping-hunks' into maint
* jc/maint-add-p-overlapping-hunks:
  t3701: add-p-fix makes the last test to pass
  "add -p": work-around an old laziness that does not coalesce hunks
  add--interactive.perl: factor out repeated --recount option
  t3701: Editing a split hunk in an "add -p" session
  add -p: 'q' should really quit
2011-05-16 16:36:46 -07:00
Jim Meyering 43d532e6ba Documentation/git-fsck.txt: fix typo: unreadable -> unreachable
Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-16 16:35:08 -07:00
Jeff King a1a3fd1f40 send-pack: avoid deadlock on git:// push with failed pack-objects
Commit 09c9957c fixes a deadlock in which pack-objects
fails, the remote end is still waiting for pack data, and we
are still waiting for the remote end to say something (see
that commit for a much more in-depth explanation).

We solved the problem there by making sure the output pipe
is closed on error; thus the remote sees EOF, and proceeds
to complain and close its end of the connection.

However, in the special case of push over git://, we don't
have a pipe, but rather a full-duplex socket, with another
dup()-ed descriptor in place of the second half of the pipe.
In this case, closing the second descriptor signals nothing
to the remote end, and we still deadlock.

This patch calls shutdown() explicitly to signal EOF to the
other side.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-16 16:20:01 -07:00
Jeff King 7ffe853b10 connect: let callers know if connection is a socket
They might care because they want to do a half-duplex close.
With pipes, that means simply closing the output descriptor;
with a socket, you must actually call shutdown.

Instead of exposing the magic no_fork child_process struct,
let's encapsulate the test in a function.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-16 16:20:01 -07:00
Jeff King 5cbf8246d2 connect: treat generic proxy processes like ssh processes
The git_connect function returns two ends of a pipe for
talking with a remote, plus a struct child_process
representing the other end of the pipe. If we have a direct
socket connection, then this points to a special "no_fork"
child process.

The code path for doing git-over-pipes or git-over-ssh sets
up this child process to point to the child git command or
the ssh process. When we call finish_connect eventually, we
check wait() on the command and report its return value.

The code path for git://, on the other hand, always sets it
to no_fork. In the case of a direct TCP connection, this
makes sense; we have no child process. But in the case of a
proxy command (configured by core.gitproxy), we do have a
child process, but we throw away its pid, and therefore
ignore its return code.

Instead, let's keep that information in the proxy case, and
respect its return code, which can help catch some errors
(though depending on your proxy command, it will be errors
reported by the proxy command itself, and not propagated
from git commands. Still, it is probably better to propagate
such errors than to ignore them).

It also means that the child_process field can reliably be
used to determine whether the returned descriptors are
actually a full-duplex socket, which means we should be
using shutdown() instead of a simple close.

Signed-off-by: Jeff King <peff@peff.net>
Helped-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-16 16:20:01 -07:00
Junio C Hamano 61432146ad sideband_demux(): fix decl-after-stmt
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-16 16:19:49 -07:00
Jeff King e9fe74cba4 t3503: test cherry picking and reverting root commits
We already tested cherry-picking a root commit, but only
with the internal merge-recursive strategy. Let's also test
the recently-allowed reverting of a root commit, as well as
testing with external strategies (which until recently
triggered a segfault).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-16 13:05:03 -07:00
Jeff King fad2652673 revert: allow reverting a root commit
Although it is probably an uncommon operation, there is no
reason to disallow it, as it works just fine. It is the
reverse of a cherry-pick of a root commit, which is already
allowed.

We do have to tweak one check on whether we have a merge
commit, which assumed we had at least one parent.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-16 13:01:45 -07:00
Jeff King 161807349a cherry-pick: handle root commits with external strategies
The merge-recursive strategy already handles root commits;
it cherry-picks the difference between the empty tree and
the root commit's tree.

However, for external strategies, we dereference NULL and
segfault while building the argument list. Instead, let's
handle this by passing the empty tree sha1 to the merge
script.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-16 13:00:30 -07:00
Junio C Hamano a80dff2515 Makefile: Pass USE_LIBPCRE down in GIT-BUILD-OPTIONS
Otherwise we would fail to rebuild correctly when this option was
changed between $(MAKE) invocations, and more importantly, $(MAKE) test
would not pass it down and t/test-lib.sh would not set the LIBPCRE
prerequisite.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-16 00:11:53 -07:00
Junio C Hamano dd0a21ede0 git-grep: update tests now regexp type is "last one wins"
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-16 00:10:14 -07:00
Junio C Hamano c565cb452c Sync release notes for 1.7.6 to exclude what are in maintenance track
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-15 16:19:16 -07:00
Junio C Hamano f574cb3404 Merge branch 'maint'
* maint:
  Update draft release notes to 1.7.5.2
  git_open_noatime(): drop unused parameter
  sha1_file: typofix
2011-05-15 16:16:56 -07:00
Junio C Hamano 96dbe93da5 Update draft release notes to 1.7.5.2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-15 16:11:55 -07:00
Junio C Hamano 06c0f42f94 Merge branch 'cn/format-patch-quiet' into maint
* cn/format-patch-quiet:
  format-patch: document --quiet option
  format-patch: don't pass on the --quiet flag
2011-05-15 16:10:49 -07:00
Junio C Hamano ab02095ccd Merge branch 'jm/mergetool-submodules' into maint
* jm/mergetool-submodules:
  mergetool: Teach about submodules
2011-05-15 15:57:16 -07:00
Junio C Hamano 92b501f2a0 Merge branch 'jk/format-patch-quote-special-in-from' into maint
* jk/format-patch-quote-special-in-from:
  pretty: quote rfc822 specials in email addresses
2011-05-15 15:56:44 -07:00
Junio C Hamano e5c1650b27 Merge branch 'vh/git-svn-doc' into maint
* vh/git-svn-doc:
  git-svn.txt: small typeface improvements
  git-svn.txt: move option descriptions
  git-svn.txt: fix usage of --add-author-from
2011-05-15 15:52:40 -07:00
Junio C Hamano f4e516834e git_open_noatime(): drop unused parameter
Since commit c793430 (Limit file descriptors used by packs, 2011-02-28),
the extra parameter added in f2e872aa (Work around EMFILE when there are
too many pack files, 2010-11-01) is not used anymore.

Remove it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
2011-05-15 15:24:52 -07:00
Junio C Hamano ccf5ace0dc sha1_file: typofix
The number zero is spelled "zero", not "zer0".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-15 15:24:36 -07:00
Junio C Hamano 5bf29b9500 read_sha1_file(): allow selective bypassing of replacement mechanism
The way "object replacement" mechanism was tucked to the read_sha1_file()
interface was suboptimal in a couple of ways:

 - Callers that want it to die with useful diagnosis upon seeing a corrupt
   object does not have a way to say that they do not want any object
   replacement.

 - Callers who do not want it to die but want to handle the errors
   themselves are told to arrange to call read_object(), but the function
   does not use the replacement mechanism, and also it is a file scope
   static function that not many callers can call to begin with.

This adds a read_sha1_file_extended() that takes a set of flags; the
callers of read_sha1_file() passes a flag READ_SHA1_FILE_REPLACE to ask
for object replacement mechanism to kick in.

Later, we could add another flag bit to tell the function to return an
error instead of dying and then remove the misguided "call read_object()
yourself".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-15 15:23:34 -07:00
Junio C Hamano e1111cef23 inline lookup_replace_object() calls
In a repository without object replacement, lookup_replace_object() should
be a no-op. Check the flag "read_replace_refs" on the side of the caller,
and bypess a function call when we know we are not dealing with replacement.

Also, even when we are set up to replace objects, if we do not find any
replacement defined, flip that flag off to avoid function call overhead
for all the later object accesses.

As this change the semantics of the flag from "do we need read the
replacement definition?" to "do we need to check with the lookup table?"
the flag needs to be renamed later to something saner, e.g. "use_replace",
when the codebase is calmer, but not now.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-15 15:23:33 -07:00
Junio C Hamano 4bbf5a2615 read_sha1_file(): get rid of read_sha1_file_repl() madness
Most callers want to silently get a replacement object, and they do not
care what the real name of the replacement object is.  Worse yet, no sane
interface to return the underlying object without replacement is provided.

Remove the function and make only the few callers that want the name of
the replacement object find it themselves.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-15 15:23:33 -07:00
Junio C Hamano abb25ac365 t6050: make sure we test not just commit replacement
The replacement mechanism should affect all types of objects not
just commits, so make sure it deals with at least a blob.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-15 15:23:32 -07:00
Junio C Hamano fea33a1ef3 Declare lookup_replace_object() in cache.h, not in commit.h
The declaration is misplaced as the replace API is supposed to affect
not just commits, but all types of objects.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-15 15:23:31 -07:00
Junio C Hamano 2f80de956f Merge branch 'maint'
* maint:
  add, merge, diff: do not use strcasecmp to compare config variable names
2011-05-14 20:44:09 -07:00
Ævar Arnfjörð Bjarmason adc3b2b276 Makefile: add xgettext target for *.sh files
Change the "pot" target to also extract strings from our $(SCRIPT_SH)
files with xgettext(1).

Note that due to Jonathan Nieder's trick of doing "mv $@+ $@" at the
end of the target the "pot" target will now warn:

    $ make pot
        XGETTEXT po/git.pot
    po/git.pot+: warning: Charset "CHARSET" is not a portable encoding name.
                          Message conversion to user's charset might not work.

This warnings is emitted because xgettext is writing into a non-*.pot
file, it's harmless however. The content that's written out is
equivalent to what it would be if we were writing directly into an
existing POT file with --join-existing.

As part of this change I've eliminated the && chain between xgettext
calls, this is incompatible with $(QUIET_XGETTEXT), if the && is left
in it'll emit:

    /bin/sh: @echo: not found

Since it's redundant (the Makefile will stop if there's an error) I've
removed it altogether.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-14 20:29:11 -07:00
Ævar Arnfjörð Bjarmason 64a4295147 git-sh-i18n.sh: add GIT_GETTEXT_POISON support
Change git-sh-i18n.sh to support the GIT_GETTEXT_POISON environment
variable like gettext.c does, this ensures that tests that use
git-sh-i18n.sh will fail under GETTEXT_POISON=YesPlease if they rely
on Git's C locale messages without declaring that they do.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-14 20:29:11 -07:00
Ævar Arnfjörð Bjarmason e00cf070a4 git-sh-i18n.sh: add no-op gettext() and eval_gettext() wrappers
Add a no-op wrapper library for Git's shell scripts. To split up the
gettext series I'm first submitting patches to gettextize the source
tree before I add any of the Makefile and Shell library changes needed
to actually use them.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-14 20:29:11 -07:00