git.git
13 years agoconfig.c: Remove unused git_config_global() function
Ramsay Jones [Tue, 31 May 2011 17:23:42 +0000 (18:23 +0100)]
config.c: Remove unused git_config_global() function

Commit 8f323c00 (drop support for GIT_CONFIG_NOGLOBAL, 15-03-2011)
removed the git_config_global() function, among other things, since
it is no longer required. Unfortunately, this function has since
been unintentionally restored by a faulty conflict resolution.

Remove it.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'jc/fmt-req-fix'
Junio C Hamano [Tue, 31 May 2011 03:19:21 +0000 (20:19 -0700)]
Merge branch 'jc/fmt-req-fix'

* jc/fmt-req-fix:
  userformat_find_requirements(): find requirement for the correct format

13 years agoMerge branch 'jk/maint-config-alias-fix'
Junio C Hamano [Tue, 31 May 2011 03:19:14 +0000 (20:19 -0700)]
Merge branch 'jk/maint-config-alias-fix'

* jk/maint-config-alias-fix:
  handle_options(): do not miscount how many arguments were used
  config: always parse GIT_CONFIG_PARAMETERS during git_config
  git_config: don't peek at global config_parameters
  config: make environment parsing routines static

Conflicts:
config.c

13 years agoMerge branch 'maint'
Junio C Hamano [Mon, 30 May 2011 07:09:55 +0000 (00:09 -0700)]
Merge branch 'maint'

* maint:
  git-submodule.sh: separate parens by a space to avoid confusing some shells
  Documentation/technical/api-diff.txt: correct name of diff_unmerge()
  read_gitfile_gently: use ssize_t to hold read result
  remove tests of always-false condition
  rerere.c: diagnose a corrupt MERGE_RR when hitting EOF between TAB and '\0'

13 years agoMerge branch 'jm/maint-misc-fix' into maint
Junio C Hamano [Mon, 30 May 2011 07:09:41 +0000 (00:09 -0700)]
Merge branch 'jm/maint-misc-fix' into maint

* jm/maint-misc-fix:
  read_gitfile_gently: use ssize_t to hold read result
  remove tests of always-false condition
  rerere.c: diagnose a corrupt MERGE_RR when hitting EOF between TAB and '\0'

13 years agoMerge branch 'bc/maint-submodule-fix-parked' into maint
Junio C Hamano [Mon, 30 May 2011 07:09:36 +0000 (00:09 -0700)]
Merge branch 'bc/maint-submodule-fix-parked' into maint

* bc/maint-submodule-fix-parked:
  git-submodule.sh: separate parens by a space to avoid confusing some shells

13 years agoMerge branch 'bc/maint-api-doc-parked' into maint
Junio C Hamano [Mon, 30 May 2011 07:03:52 +0000 (00:03 -0700)]
Merge branch 'bc/maint-api-doc-parked' into maint

* bc/maint-api-doc-parked:
  Documentation/technical/api-diff.txt: correct name of diff_unmerge()

13 years agoMerge branch 'mk/grep-pcre'
Junio C Hamano [Mon, 30 May 2011 07:00:07 +0000 (00:00 -0700)]
Merge branch 'mk/grep-pcre'

* mk/grep-pcre:
  git-grep: Fix problems with recently added tests
  git-grep: Update tests (mainly for -P)
  Makefile: Pass USE_LIBPCRE down in GIT-BUILD-OPTIONS
  git-grep: update tests now regexp type is "last one wins"
  git-grep: do not die upon -F/-P when grep.extendedRegexp is set.
  git-grep: Bail out when -P is used with -F or -E
  grep: Add basic tests
  configure: Check for libpcre
  git-grep: Learn PCRE
  grep: Extract compile_regexp_failed() from compile_regexp()
  grep: Fix a typo in a comment
  grep: Put calls to fixmatch() and regmatch() into patmatch()
  contrib/completion: --line-number to git grep
  Documentation: Add --line-number to git-grep synopsis

13 years agogit-grep: Fix problems with recently added tests
Michał Kiedrowicz [Thu, 26 May 2011 22:43:59 +0000 (00:43 +0200)]
git-grep: Fix problems with recently added tests

Brian Gernhardt reported that test 'git grep -E -F -G a\\+b' fails on
OS X 10.6.7. This is because I assumed \+ is part of BRE, which isn't
true on all platforms.

The easiest way to make this test pass is to just update expected
output, but that would make the test pointless. Its real purpose is to
check whether 'git grep -E -F -G' is different from 'git grep -E -G -F'.
To check that, let's change pattern to "a+b*c". This should return
different match for -G, -F and -E.

I also made two small tweaks to the tests. First, I added path "ab" to
all calls to future-proof tests. Second, I updated last two tests to
better show that 'git grep -P -E' is different from 'git grep -E -P'.

Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'jc/notes-batch-removal'
Junio C Hamano [Mon, 30 May 2011 06:51:26 +0000 (23:51 -0700)]
Merge branch 'jc/notes-batch-removal'

* jc/notes-batch-removal:
  show: --ignore-missing
  notes remove: --stdin reads from the standard input
  notes remove: --ignore-missing
  notes remove: allow removing more than one

13 years agoMerge branch 'jk/haves-from-alternate-odb'
Junio C Hamano [Mon, 30 May 2011 06:51:22 +0000 (23:51 -0700)]
Merge branch 'jk/haves-from-alternate-odb'

* jk/haves-from-alternate-odb:
  receive-pack: eliminate duplicate .have refs
  bisect: refactor sha1_array into a generic sha1 list
  refactor refs_from_alternate_cb to allow passing extra data

13 years agoMerge branch 'jn/run-command-error-failure' into maint
Junio C Hamano [Mon, 30 May 2011 02:08:51 +0000 (19:08 -0700)]
Merge branch 'jn/run-command-error-failure' into maint

* jn/run-command-error-failure:
  run-command: handle short writes and EINTR in die_child
  tests: check error message from run_command

13 years agogit-submodule.sh: separate parens by a space to avoid confusing some shells
Brandon Casey [Thu, 26 May 2011 20:52:04 +0000 (13:52 -0700)]
git-submodule.sh: separate parens by a space to avoid confusing some shells

Some shells interpret '(( ))' according to the rules for arithmetic
expansion.  This may not follow POSIX, but is prevalent in commonly used
shells.  Bash does not have a problem with this particular instance of
'((', likely because it is not followed by a '))', but the public domain
ksh does, and so does ksh on IRIX 6.5.

So, add a space between the parenthesis to avoid confusing these shells.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoDocumentation/technical/api-diff.txt: correct name of diff_unmerge()
Brandon Casey [Thu, 26 May 2011 20:46:56 +0000 (13:46 -0700)]
Documentation/technical/api-diff.txt: correct name of diff_unmerge()

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoread_gitfile_gently: use ssize_t to hold read result
Jeff King [Thu, 26 May 2011 16:28:44 +0000 (12:28 -0400)]
read_gitfile_gently: use ssize_t to hold read result

Otherwise, a negative error return becomes a very large read
value. We catch this in practice because we compare the
expected and actual numbers of bytes (and you are not likely
to be reading (size_t)-1 bytes), but this makes the
correctness a little more obvious.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoremove tests of always-false condition
Jim Meyering [Thu, 26 May 2011 13:58:16 +0000 (15:58 +0200)]
remove tests of always-false condition

* fsck.c (fsck_error_function): Don't test obj->sha1 == 0.
It can never be true, since that sha1 member is an array.
* transport.c (set_upstreams): Likewise for ref->new_sha1.

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoplug a DIR buffer leak in rerere.c
Jim Meyering [Thu, 26 May 2011 13:55:50 +0000 (15:55 +0200)]
plug a DIR buffer leak in rerere.c

Signed-off-by: Jim Meyering <jim@meyering.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agorerere.c: diagnose a corrupt MERGE_RR when hitting EOF between TAB and '\0'
Jim Meyering [Thu, 26 May 2011 13:54:18 +0000 (15:54 +0200)]
rerere.c: diagnose a corrupt MERGE_RR when hitting EOF between TAB and '\0'

If we reach EOF after the SHA1-then-TAB, yet before the NUL that
terminates each file name, we would fill the file name buffer with \255
bytes resulting from the repeatedly-failing fgetc (returns EOF/-1) and
ultimately complain about "filename too long", because no NUL was
encountered.

Signed-off-by: Jim Meyering <jim@meyering.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoUpdate 1.7.6 draft release notes
Junio C Hamano [Thu, 26 May 2011 17:41:33 +0000 (10:41 -0700)]
Update 1.7.6 draft release notes

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'jn/userdiff-perl-updates'
Junio C Hamano [Thu, 26 May 2011 17:32:25 +0000 (10:32 -0700)]
Merge branch 'jn/userdiff-perl-updates'

* jn/userdiff-perl-updates:
  userdiff/perl: tighten BEGIN/END block pattern to reject here-doc delimiters
  tests: make test_expect_code quieter on success
  userdiff/perl: catch sub with brace on second line
  userdiff/perl: match full line of POD headers
  userdiff/perl: anchor "sub" and "package" patterns on the left
  t4018 (funcname patterns): minor cleanups
  t4018 (funcname patterns): make configuration easier to track
  t4018 (funcname patterns): make .gitattributes state easier to track

13 years agoMerge branch 'rg/no-gecos-in-pwent'
Junio C Hamano [Thu, 26 May 2011 17:32:19 +0000 (10:32 -0700)]
Merge branch 'rg/no-gecos-in-pwent'

* rg/no-gecos-in-pwent:
  ident: add NO_GECOS_IN_PWENT for systems without pw_gecos in struct passwd

Conflicts:
Makefile

13 years agoMerge branch 'jk/fetch-mark-complete-optimization'
Junio C Hamano [Thu, 26 May 2011 17:32:11 +0000 (10:32 -0700)]
Merge branch 'jk/fetch-mark-complete-optimization'

* jk/fetch-mark-complete-optimization:
  fetch: avoid repeated commits in mark_complete

13 years agoMerge branch 'jn/gitweb-js'
Junio C Hamano [Thu, 26 May 2011 17:31:57 +0000 (10:31 -0700)]
Merge branch 'jn/gitweb-js'

* jn/gitweb-js:
  gitweb: Make JavaScript ability to adjust timezones configurable
  gitweb.js: Add UI for selecting common timezone to display dates
  gitweb: JavaScript ability to adjust time based on timezone
  gitweb: Unify the way long timestamp is displayed
  gitweb: Refactor generating of long dates into format_timestamp_html
  gitweb.js: Provide getElementsByClassName method (if it not exists)
  gitweb.js: Introduce code to handle cookies from JavaScript
  gitweb.js: Extract and improve datetime handling
  gitweb.js: Provide default values for padding in padLeftStr and padLeft
  gitweb.js: Update and improve comments in JavaScript files
  gitweb: Split JavaScript for maintability, combining on build

13 years agoMerge branch 'jn/ctags-more'
Junio C Hamano [Thu, 26 May 2011 17:31:53 +0000 (10:31 -0700)]
Merge branch 'jn/ctags-more'

* jn/ctags-more:
  gitweb: Optional grouping of projects by category
  gitweb: Modularized git_get_project_description to be more generic
  gitweb: Split git_project_list_body in two functions

13 years agoMerge branch 'jc/require-work-tree-exists'
Junio C Hamano [Thu, 26 May 2011 17:31:47 +0000 (10:31 -0700)]
Merge branch 'jc/require-work-tree-exists'

* jc/require-work-tree-exists:
  require-work-tree wants more than what its name says

13 years agoSync with 1.7.5.3
Junio C Hamano [Thu, 26 May 2011 17:30:28 +0000 (10:30 -0700)]
Sync with 1.7.5.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoGit 1.7.5.3 v1.7.5.3
Junio C Hamano [Thu, 26 May 2011 16:45:29 +0000 (09:45 -0700)]
Git 1.7.5.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'maint-1.7.4' into maint
Junio C Hamano [Thu, 26 May 2011 17:29:24 +0000 (10:29 -0700)]
Merge branch 'maint-1.7.4' into maint

* maint-1.7.4:

13 years agoMerge branch 'jk/git-connection-deadlock-fix' into maint-1.7.4
Junio C Hamano [Thu, 26 May 2011 17:28:10 +0000 (10:28 -0700)]
Merge branch 'jk/git-connection-deadlock-fix' into maint-1.7.4

* jk/git-connection-deadlock-fix:
  test core.gitproxy configuration
  send-pack: avoid deadlock on git:// push with failed pack-objects
  connect: let callers know if connection is a socket
  connect: treat generic proxy processes like ssh processes

Conflicts:
connect.c

13 years agoMerge branch 'js/maint-send-pack-stateless-rpc-deadlock-fix' into maint-1.7.4
Junio C Hamano [Thu, 26 May 2011 17:27:55 +0000 (10:27 -0700)]
Merge branch 'js/maint-send-pack-stateless-rpc-deadlock-fix' into maint-1.7.4

* js/maint-send-pack-stateless-rpc-deadlock-fix:
  sideband_demux(): fix decl-after-stmt
  send-pack: unbreak push over stateless rpc
  send-pack: avoid deadlock when pack-object dies early

13 years agoMerge branch 'jk/maint-upload-pack-shallow' into maint-1.7.4
Junio C Hamano [Thu, 26 May 2011 17:27:29 +0000 (10:27 -0700)]
Merge branch 'jk/maint-upload-pack-shallow' into maint-1.7.4

* jk/maint-upload-pack-shallow:
  upload-pack: start pack-objects before async rev-list

13 years agoMerge branch 'jm/maint-diff-words-with-sbe' into maint
Junio C Hamano [Thu, 26 May 2011 16:43:00 +0000 (09:43 -0700)]
Merge branch 'jm/maint-diff-words-with-sbe' into maint

* jm/maint-diff-words-with-sbe:
  do not read beyond end of malloc'd buffer

13 years agoMerge branch 'kk/maint-prefix-in-config-mak' into maint
Junio C Hamano [Thu, 26 May 2011 16:42:12 +0000 (09:42 -0700)]
Merge branch 'kk/maint-prefix-in-config-mak' into maint

* 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

13 years agoMerge branch 'mg/diff-uiconfig-doc' into maint
Junio C Hamano [Thu, 26 May 2011 16:41:11 +0000 (09:41 -0700)]
Merge branch 'mg/diff-uiconfig-doc' into maint

* mg/diff-uiconfig-doc:
  config.txt,diff-options.txt: porcelain vs. plumbing for color.diff

13 years agoMerge branch 'ft/gitweb-tar-with-gzip-n' into maint
Junio C Hamano [Thu, 26 May 2011 16:40:50 +0000 (09:40 -0700)]
Merge branch 'ft/gitweb-tar-with-gzip-n' into maint

* ft/gitweb-tar-with-gzip-n:
  gitweb: supply '-n' to gzip for identical output

13 years agoMerge branch 'ss/doc-svn' into maint
Junio C Hamano [Thu, 26 May 2011 16:39:40 +0000 (09:39 -0700)]
Merge branch 'ss/doc-svn' into maint

* ss/doc-svn:
  remove noise and inaccuracies from git-svn docs

13 years agoMerge branch 'jn/format-patch-doc' into maint
Junio C Hamano [Thu, 26 May 2011 16:39:33 +0000 (09:39 -0700)]
Merge branch 'jn/format-patch-doc' into maint

* jn/format-patch-doc:
  Documentation/format-patch: suggest Toggle Word Wrap add-on for Thunderbird
  Documentation: publicize hints for sending patches with GMail
  Documentation: publicize KMail hints for sending patches inline
  Documentation: hints for sending patches inline with Thunderbird
  Documentation: explain how to check for patch corruption

13 years agoMerge branch 'jc/maint-pathspec-stdin-and-cmdline' into maint
Junio C Hamano [Thu, 26 May 2011 16:38:44 +0000 (09:38 -0700)]
Merge branch 'jc/maint-pathspec-stdin-and-cmdline' into maint

* jc/maint-pathspec-stdin-and-cmdline:
  setup_revisions(): take pathspec from command line and --stdin correctly

13 years agoMerge branch 'jk/cherry-pick-root-with-resolve' into maint
Junio C Hamano [Thu, 26 May 2011 16:37:41 +0000 (09:37 -0700)]
Merge branch 'jk/cherry-pick-root-with-resolve' into maint

* jk/cherry-pick-root-with-resolve:
  t3503: test cherry picking and reverting root commits
  revert: allow reverting a root commit
  cherry-pick: handle root commits with external strategies

13 years agoMerge branch 'rg/copy-gecos-username' into maint
Junio C Hamano [Thu, 26 May 2011 16:37:04 +0000 (09:37 -0700)]
Merge branch 'rg/copy-gecos-username' into maint

* rg/copy-gecos-username:
  copy_gecos: fix not adding nlen to len when processing "&"

13 years agoMerge branch 'fc/completion-zsh' into maint
Junio C Hamano [Thu, 26 May 2011 16:36:33 +0000 (09:36 -0700)]
Merge branch 'fc/completion-zsh' into maint

* fc/completion-zsh:
  git-completion: fix regression in zsh support

13 years agoMerge branch 'jk/git-connection-deadlock-fix' into maint
Junio C Hamano [Thu, 26 May 2011 16:33:25 +0000 (09:33 -0700)]
Merge branch 'jk/git-connection-deadlock-fix' into maint

* jk/git-connection-deadlock-fix:
  test core.gitproxy configuration
  send-pack: avoid deadlock on git:// push with failed pack-objects
  connect: let callers know if connection is a socket
  connect: treat generic proxy processes like ssh processes

Conflicts:
connect.c

13 years agoMerge branch 'js/maint-send-pack-stateless-rpc-deadlock-fix' into maint
Junio C Hamano [Thu, 26 May 2011 16:32:14 +0000 (09:32 -0700)]
Merge branch 'js/maint-send-pack-stateless-rpc-deadlock-fix' into maint

* js/maint-send-pack-stateless-rpc-deadlock-fix:
  sideband_demux(): fix decl-after-stmt
  send-pack: unbreak push over stateless rpc
  send-pack: avoid deadlock when pack-object dies early

13 years agocompat/fnmatch/fnmatch.c: give a fall-back definition for NULL
Junio C Hamano [Thu, 26 May 2011 16:25:47 +0000 (09:25 -0700)]
compat/fnmatch/fnmatch.c: give a fall-back definition for NULL

Somebody tried to compile fnmatch.c compatibility file on Interix and got
an error because no header included in the file on that platform defined
NULL.  It usually comes from stddef.h and indirectly from other headers
like string.h, unistd.h, stdio.h, stdlib.h, etc., but with the way we
compile this file from our Makefile, inclusion of the header files that
are expected to define NULL in fnmatch.c do not happen because they are
protected with "#ifdef STDC_HEADERS", etc. which we do not pass.

As the least-impact workaround, give a fall-back definition when none of
the headers define NULL.

Noticed-by: Markus Duft <mduft@gentoo.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'svn-fe-maint' of git://repo.or.cz/git/jrn into maint
Junio C Hamano [Thu, 26 May 2011 15:52:11 +0000 (08:52 -0700)]
Merge branch 'svn-fe-maint' of git://repo.or.cz/git/jrn into maint

* 'svn-fe-maint' of git://repo.or.cz/git/jrn:
  Revert "t0081 (line-buffer): add buffering tests"

13 years agoMerge branch 'jc/bigfile'
Junio C Hamano [Wed, 25 May 2011 23:23:26 +0000 (16:23 -0700)]
Merge branch 'jc/bigfile'

* jc/bigfile:
  Bigfile: teach "git add" to send a large file straight to a pack
  index_fd(): split into two helper functions
  index_fd(): turn write_object and format_check arguments into one flag

13 years agoMerge branch 'js/log-abbrev-commit-config'
Junio C Hamano [Wed, 25 May 2011 23:23:22 +0000 (16:23 -0700)]
Merge branch 'js/log-abbrev-commit-config'

* js/log-abbrev-commit-config:
  Add log.abbrevCommit config variable
  "git log -h": typofix misspelled 'suppress'

13 years agoMerge branch 'maint'
Junio C Hamano [Wed, 25 May 2011 22:25:44 +0000 (15:25 -0700)]
Merge branch 'maint'

* maint:
  init/clone: remove short option -L and document --separate-git-dir

13 years agouserformat_find_requirements(): find requirement for the correct format
Junio C Hamano [Wed, 25 May 2011 19:23:44 +0000 (12:23 -0700)]
userformat_find_requirements(): find requirement for the correct format

This function was introduced in 5b16360 (pretty: Initialize notes if %N is
used, 2010-04-13) to check what kind of information the "log --format=..."
user format string wants. The function can be passed a NULL instead of a
format string to ask it to check user_format variable kept by an earlier
call to save_user_format().

But it unconditionally checked user_format and not the string it was
given.  The only caller introduced by the change passes NULL, which
kept the bug unnoticed, until a new GCC noticed that there is an
assignment to fmt that is never used.

Noticed-by: Chris Wilson's compiler
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Acked-by: Jeff King <peff@peff.net>
13 years agogitweb: Refactor reading and parsing config file into read_config_file
Jakub Narebski [Wed, 25 May 2011 16:35:26 +0000 (18:35 +0200)]
gitweb: Refactor reading and parsing config file into read_config_file

Beside being obvious reduction of duplicated code, this is enables us
to easily call site-wide config file in per-installation config file.

The actual update to documentation is left for next commit, because of
possible exclusive alternative (possible other next commit) of always
reading system-wide config file and relying on per-instalation config
file overriding system-wide defaults.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Acked-by: John 'Warthog9' Hawley <warthog9@kernel.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agosh-18n: quell "unused variable" warning
Michael J Gruber [Wed, 25 May 2011 09:55:43 +0000 (11:55 +0200)]
sh-18n: quell "unused variable" warning

show_variables is set but never used. Comment it out rather than remove it so
that the relation with upstream remains clear.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoinit/clone: remove short option -L and document --separate-git-dir
Nguyen Thai Ngoc Duy [Tue, 24 May 2011 16:40:32 +0000 (23:40 +0700)]
init/clone: remove short option -L and document --separate-git-dir

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agohandle_options(): do not miscount how many arguments were used
Junio C Hamano [Tue, 24 May 2011 22:50:35 +0000 (18:50 -0400)]
handle_options(): do not miscount how many arguments were used

The handle_options() function advances the base of the argument array and
returns the number of arguments it used. The caller in handle_alias()
wants to reallocate the argv array it passes to this function, and
attempts to do so by subtracting the returned value to compensate for the
change handle_options() makes to the new_argv.

But handle_options() did not correctly count when "-c <config=value>" is
given, causing a wrong pointer to be passed to realloc().

Fix it by saving the original argv at the beginning of handle_options(),
and return the difference between the final value of argv, which will
relieve the places that move the array pointer from the additional burden
of keeping track of "handled" counter.

Noticed-by: Kazuki Tsujimoto
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoconfig: always parse GIT_CONFIG_PARAMETERS during git_config
Jeff King [Tue, 24 May 2011 22:49:55 +0000 (18:49 -0400)]
config: always parse GIT_CONFIG_PARAMETERS during git_config

Previously we parsed GIT_CONFIG_PARAMETERS lazily into a
linked list, and then checked that list during future
invocations of git_config. However, that ignores the fact
that the environment variable could change during our run
(e.g., because we parse more "-c" as part of an alias).

Instead, let's just re-parse the environment variable each
time. It's generally not very big, and it's no more work
than parsing the config files, anyway.

As a bonus, we can ditch all of the linked list storage code
entirely, making the code much simpler.

The test unfortunately still does not pass because of an
unrelated bug in handle_options.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit_config: don't peek at global config_parameters
Jeff King [Tue, 24 May 2011 22:49:45 +0000 (18:49 -0400)]
git_config: don't peek at global config_parameters

The config_parameters list in config.c is an implementation
detail of git_config_from_parameters; instead, that function
should tell us whether it found anything.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoconfig: make environment parsing routines static
Jeff King [Tue, 24 May 2011 22:49:36 +0000 (18:49 -0400)]
config: make environment parsing routines static

Nobody outside of git_config_from_parameters should need
to use the GIT_CONFIG_PARAMETERS parsing functions, so let's
make them private.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agodoc: discuss textconv versus external diff drivers
Jeff King [Tue, 24 May 2011 19:45:27 +0000 (15:45 -0400)]
doc: discuss textconv versus external diff drivers

We already talk about how to use each one and how they work,
but it is a reasonable question to wonder why one might use
one over the other.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agorequire-work-tree wants more than what its name says
Junio C Hamano [Thu, 5 May 2011 02:11:18 +0000 (19:11 -0700)]
require-work-tree wants more than what its name says

Somebody tried "git pull" from a random place completely outside the work
tree, while exporting GIT_DIR and GIT_WORK_TREE that are set to correct
places, e.g.

    GIT_WORK_TREE=$HOME/git.git
    GIT_DIR=$GIT_WORK_TREE/.git
    export GIT_WORK_TREE GIT_DIR
    cd /tmp
    git pull

At the beginning of git-pull, we check "require-work-tree" and then
"cd-to-toplevel".  I _think_ the original intention when I wrote the
command was "we MUST have a work tree, our $(cwd) might not be at the
top-level directory of it", and no stronger than that.  That check is a
very sensible thing to do before doing cd-to-toplevel.  We check that the
place we would want to go exists, and then go there.

But the implementation of require_work_tree we have today is quite
different.  I don't have energy to dig the history, but currently it says:

    test "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = true ||
    die "fatal: $0 cannot be used without a working tree."

Which is completely bogus.  Even though we may happen to be just outside
of it right now, we may have a working tree that we can cd_to_toplevel
back to.

Add a function "require_work_tree_exists" that implements the check
this function originally intended (this is so that third-party scripts
that rely on the current behaviour do not have to get broken).

For now, update _no_ in-tree scripts, not even "git pull", as nobody on
the list seems to really care about the above corner case workflow that
triggered this. Scripts can be updated after vetting that they do want the
"we want to make sure the place we are going to go actually exists"
semantics.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogitweb: Make JavaScript ability to adjust timezones configurable
Jakub Narebski [Thu, 28 Apr 2011 19:04:11 +0000 (21:04 +0200)]
gitweb: Make JavaScript ability to adjust timezones configurable

Configure JavaScript-based ability to select common timezone for git
dates via %feature mechanism, namely 'javascript-timezone' feature.

The following settings are configurable:
* default timezone (defaults to 'local' i.e. browser timezone);
  this also can function as a way to disable this ability,
  by setting it to false-ish value (undef or '')
* name of cookie to store user's choice of timezone
* class name to mark dates

NOTE: This is a bit of abuse of %feature system, which can store only
sequence of values, rather than dictionary (hash); usually but not
always only a single value is used.

Based-on-code-by: John 'Warthog9' Hawley <warthog9@eaglescrag.net>
Helped-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogitweb.js: Add UI for selecting common timezone to display dates
John 'Warthog9' Hawley [Thu, 28 Apr 2011 19:04:10 +0000 (21:04 +0200)]
gitweb.js: Add UI for selecting common timezone to display dates

This will modify HTML, add CSS rules and add DOM event handlers so
that clicking on any date (the common part, not the localtime part)
will display a drop down menu to choose the timezone to change to.

Currently menu displays only the following timezones:

  utc
  local
  -1200
  -1100
  ...
  +1100
  +1200
  +1300
  +1400

In timezone selection menu each timezone is +1hr to the previous.  The
code is capable of handling fractional timezones, but those have not
been added to the menu.

All changes are saved to a cookie, so page changes and closing /
reopening browser retains the last known timezone setting used.

[jn: Changed from innerHTML to DOM, moved to event delegation for
onclick to trigger menu, added close button and cookie refreshing]

Helped-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: John 'Warthog9' Hawley <warthog9@eaglescrag.net>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogitweb: JavaScript ability to adjust time based on timezone
John 'Warthog9' Hawley [Thu, 28 Apr 2011 19:04:09 +0000 (21:04 +0200)]
gitweb: JavaScript ability to adjust time based on timezone

This patch is based on Kevin Cernekee's <cernekee@gmail.com>
patch series entitled "gitweb: introduce localtime feature".  While
Kevin's patch changed the server side output so that the timezone
was output from gitweb itself, this has a number of drawbacks, in
particular with respect to gitweb-caching.

This patch takes the same basic goal, display the appropriate times in
a given common timezone, and implements it in JavaScript.  This
requires adding / using a new class, "datetime", to be able to find
elements to be adjusted from JavaScript.  Appropriate dates are
wrapped in a span with this class.

Timezone to be used can be retrieved from "gitweb_tz" cookie, though
currently there is no way to set / manipulate this cookie from gitweb;
this is left for later commit.

Valid timezones, currently, are: "utc", "local" (which means that
timezone is taken from browser), and "+/-ZZZZ" numeric timezone as in
RFC-2822.  Default timezone is "local" (currently not configurable,
left for later commit).

Fallback (should JavaScript not be enabled) is to treat dates as they
have been and display them, only, in UTC.

Pages affected:
* 'summary' view, "last change" field (commit time from latest change)
* 'log' view, author time
* 'commit' and 'commitdiff' views, author/committer time
* 'tag' view, tagger time

Based-on-code-from: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: John 'Warthog9' Hawley <warthog9@eaglescrag.net>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogitweb: Unify the way long timestamp is displayed
Jakub Narebski [Thu, 28 Apr 2011 19:04:08 +0000 (21:04 +0200)]
gitweb: Unify the way long timestamp is displayed

format_timestamp_html loses its "-localtime => 1" option, and now
always print the local time (in author/comitter/tagger local
timezone), with "atnight" warning if needed.

This means that both 'summary' and 'log' views now display localtime.
In the case of 'log' view this can be thought as an improvement, as
now one can easily see which commits in a series are made "atnight"
and should be examined closer.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogitweb: Refactor generating of long dates into format_timestamp_html
Jakub Narebski [Thu, 28 Apr 2011 19:04:07 +0000 (21:04 +0200)]
gitweb: Refactor generating of long dates into format_timestamp_html

It is pure refactoring and doesn't change gitweb output, though this
could potentially affect 'summary', 'log', and 'commit'-like views
('commit', 'commitdiff', 'tag').

Remove print_local_time and format_local_time, as their use is now
replaced (indirectly) by using format_timestamp_html.

While at it improve whitespace formatting.

Inspired-by-code-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogitweb.js: Provide getElementsByClassName method (if it not exists)
Jakub Narebski [Thu, 28 Apr 2011 19:04:06 +0000 (21:04 +0200)]
gitweb.js: Provide getElementsByClassName method (if it not exists)

The code is simplified and does not support full specification of
native getElementsByClassName method, but implements just subset that
would be enough for gitweb, supporting only single class name.

Signed-off-by: John 'Warthog9' Hawley <warthog9@eaglescrag.net>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogitweb.js: Introduce code to handle cookies from JavaScript
Jakub Narebski [Thu, 28 Apr 2011 19:04:05 +0000 (21:04 +0200)]
gitweb.js: Introduce code to handle cookies from JavaScript

Introduced gitweb/static/js/cookies.js file provides functions for
setting, getting and deleting cookies.

Code taken from subsection "Cookies in JavaScript" of "Professional
JavaScript for Web Developers" by Nicholas C. Zakas and from cookie
plugin for jQuery (dual licensed under the MIT and GPL licenses).

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogitweb.js: Extract and improve datetime handling
Jakub Narebski [Thu, 28 Apr 2011 19:04:04 +0000 (21:04 +0200)]
gitweb.js: Extract and improve datetime handling

Move formatDateISOLocal(epoch, timezone) function (and also helper
timezoneOffset(timezoneInfo) function it requires) from common-lib.js to
datetime.js

Add new functions:
* localTimezoneOffset - to get browser timezone offset in seconds
* localTimezoneInfo   - to get browser timezone in '(+|-)HHMM' format
* formatTimezoneInfo - turn offset in hours and minutes into '(+|-)HHMM'
* parseRFC2822Date - to parse RFC-2822 dates that gitweb uses into epoch
* formatDateRFC2882 - like formatDateISOLocal, only RFC-2822 format

All those functions are meant to be used in future commit
'gitweb: javascript ability to adjust time based on timezone'

An alternative would be to use e.g. Datejs (http://www.datejs.com)
library, or JavaScript framework that has date formatting (perhaps as
a plugin).

While at it escape '-' in character class inside tzRe regexp, as
recommended by JSLint (http://www.jslint.com).

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogitweb.js: Provide default values for padding in padLeftStr and padLeft
Jakub Narebski [Thu, 28 Apr 2011 19:04:03 +0000 (21:04 +0200)]
gitweb.js: Provide default values for padding in padLeftStr and padLeft

This means that one can use padLeft(4, 2) and it would be equivalent
to runing padLeft(4, 2, '0'), and it would return '04' i.e. '4' padded
with '0' to width 2, to be used e.g. in formatting date and time.

This should make those functions easier to use.  Current code doesn't
yet make use of this feature.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogitweb.js: Update and improve comments in JavaScript files
Jakub Narebski [Thu, 28 Apr 2011 19:04:02 +0000 (21:04 +0200)]
gitweb.js: Update and improve comments in JavaScript files

This consists of adding a few extra explanation, fixing descriptions
of functions to match names of parameters in code, adding a few
separators, and fixing spelling -- while at it spell 'neighbor' using
American spelling (and not as 'neighbour').

This is post-split cleanup.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogitweb: Split JavaScript for maintability, combining on build
Jakub Narebski [Thu, 28 Apr 2011 19:04:01 +0000 (21:04 +0200)]
gitweb: Split JavaScript for maintability, combining on build

Split originally single gitweb.js file into smaller files, each
dealing with single issue / area of responsibility.  This move should
make gitweb's JavaScript code easier to maintain.

For better webapp performance it is recommended[1][2][3] to combine
JavaScript files.  Do it during build time (in gitweb/Makefile), by
straight concatenation of files into gitweb.js file (which is now
ignored as being generated).  This means that there are no changes to
gitweb script itself - it still uses gitweb.js or gitweb.min.js, but
now generated.

[1]: http://developer.yahoo.com/performance/rules.html
     "Minimize HTTP Requests" section
[2]: http://code.google.com/speed/articles/include-scripts-properly.html
     "1. Combine external JavaScript files"
[3]: http://javascript-reference.info/speed-up-your-javascript-load-time.htm
     "Combine Your Files" section.

See also new gitweb/static/js/README file.

Inspired-by-patch-by: John 'Warthog9' Hawley <warthog9@eaglescrag.net>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit-grep: Update tests (mainly for -P)
Michał Kiedrowicz [Sun, 22 May 2011 11:37:28 +0000 (13:37 +0200)]
git-grep: Update tests (mainly for -P)

Add few more tests for "-P/--perl-regexp" option of "git grep".

While at it, add some generic tests for grep.extendedRegexp config option,
for detecting invalid regexep and check if "last one wins" rule works for
selecting regexp type.

Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agouserdiff/perl: tighten BEGIN/END block pattern to reject here-doc delimiters
Jonathan Nieder [Sun, 22 May 2011 17:29:32 +0000 (12:29 -0500)]
userdiff/perl: tighten BEGIN/END block pattern to reject here-doc delimiters

A naive method of treating BEGIN/END blocks with a brace on the second
line as diff/grep funcname context involves also matching unrelated
lines that consist of all-caps letters:

sub foo {
print <<'EOF'
text goes here
...
EOF
... rest of foo ...
}

That's not so great, because it means that "git diff" and "git grep
--show-function" would write "=EOF" or "@@ EOF" as context instead of
a more useful reminder like "@@ sub foo {".

To avoid this, tighten the pattern to only match the special block
names that perl accepts (namely BEGIN, END, INIT, CHECK, UNITCHECK,
AUTOLOAD, and DESTROY).  The list is taken from perl's toke.c.

Suggested-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoUpdate 1.7.6 draft release notes
Junio C Hamano [Mon, 23 May 2011 17:54:54 +0000 (10:54 -0700)]
Update 1.7.6 draft release notes

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'tr/add-i-no-escape'
Junio C Hamano [Mon, 23 May 2011 17:50:06 +0000 (10:50 -0700)]
Merge branch 'tr/add-i-no-escape'

* tr/add-i-no-escape:
  add -i: ignore terminal escape sequences

13 years agoMerge branch 'jm/maint-diff-words-with-sbe'
Junio C Hamano [Mon, 23 May 2011 17:27:42 +0000 (10:27 -0700)]
Merge branch 'jm/maint-diff-words-with-sbe'

* jm/maint-diff-words-with-sbe:
  do not read beyond end of malloc'd buffer

13 years agoMerge branch 'js/mingw-shutdown'
Junio C Hamano [Mon, 23 May 2011 17:27:12 +0000 (10:27 -0700)]
Merge branch 'js/mingw-shutdown'

* js/mingw-shutdown:
  Windows: add a wrapper for the shutdown() system call

13 years agoMerge branch 'ms/ls-remote-exit-with-status'
Junio C Hamano [Mon, 23 May 2011 17:27:08 +0000 (10:27 -0700)]
Merge branch 'ms/ls-remote-exit-with-status'

* ms/ls-remote-exit-with-status:
  ls-remote: the --exit-code option reports "no matching refs"

13 years agoMerge branch 'mg/config-symbolic-constants'
Junio C Hamano [Mon, 23 May 2011 16:59:05 +0000 (09:59 -0700)]
Merge branch 'mg/config-symbolic-constants'

* mg/config-symbolic-constants:
  config: Give error message when not changing a multivar
  config: define and document exit codes

13 years agoMerge branch 'ab/i18n-scripts-basic'
Junio C Hamano [Mon, 23 May 2011 16:58:45 +0000 (09:58 -0700)]
Merge branch 'ab/i18n-scripts-basic'

* ab/i18n-scripts-basic:
  Makefile: add xgettext target for *.sh files
  git-sh-i18n.sh: add GIT_GETTEXT_POISON support
  git-sh-i18n.sh: add no-op gettext() and eval_gettext() wrappers
  git-sh-i18n--envsubst: our own envsubst(1) for eval_gettext()

13 years agoMerge branch 'jc/magic-pathspec'
Junio C Hamano [Mon, 23 May 2011 16:58:35 +0000 (09:58 -0700)]
Merge branch 'jc/magic-pathspec'

* jc/magic-pathspec:
  setup.c: Fix some "symbol not declared" sparse warnings
  t3703: Skip tests using directory name ":" on Windows
  revision.c: leave a note for "a lone :" enhancement
  t3703, t4208: add test cases for magic pathspec
  rev/path disambiguation: further restrict "misspelled index entry" diag
  fix overslow :/no-such-string-ever-existed diagnostics
  fix overstrict :<path> diagnosis
  grep: use get_pathspec() correctly
  pathspec: drop "lone : means no pathspec" from get_pathspec()
  Revert "magic pathspec: add ":(icase)path" to match case insensitively"
  magic pathspec: add ":(icase)path" to match case insensitively
  magic pathspec: futureproof shorthand form
  magic pathspec: add tentative ":/path/from/top/level" pathspec support

13 years agoMerge branch 'jk/blame-line-porcelain'
Junio C Hamano [Mon, 23 May 2011 16:58:31 +0000 (09:58 -0700)]
Merge branch 'jk/blame-line-porcelain'

* jk/blame-line-porcelain:
  blame: add --line-porcelain output format
  blame: refactor porcelain output
  add tests for various blame formats

13 years agotests: make test_expect_code quieter on success
Jonathan Nieder [Sat, 21 May 2011 19:40:32 +0000 (14:40 -0500)]
tests: make test_expect_code quieter on success

A command exiting with the expected status is not particularly
notable.

While the indication of progress might be useful when tracking down
where in a test a failure has happened, the same applies to most other
test helpers, which are quiet about success, so this single helper's
output stands out in an unpleasant way.  An alternative method for
showing progress information might to invent a --progress option that
runs tests with "set -x", or until that is available, to run tests
using commands like

prove -v -j2 --shuffle --exec='sh -x' t2202-add-addremove.sh

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agouserdiff/perl: catch sub with brace on second line
Jonathan Nieder [Sat, 21 May 2011 19:38:26 +0000 (14:38 -0500)]
userdiff/perl: catch sub with brace on second line

Accept

sub foo
{
}

as an alternative to a more common style that introduces perl
functions with a brace on the first line (and likewise for BEGIN/END
blocks).  The new regex is a little hairy to avoid matching

# forward declaration
sub foo;

while continuing to match "sub foo($;@) {" and

sub foo { # This routine is interesting;
# in fact, the lines below explain how...

While at it, pay attention to Perl 5.14's "package foo {" syntax as an
alternative to the traditional "package foo;".

Requested-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agouserdiff/perl: match full line of POD headers
Jonathan Nieder [Sat, 21 May 2011 19:35:51 +0000 (14:35 -0500)]
userdiff/perl: match full line of POD headers

The builtin perl userdiff driver is not greedy enough about catching
POD header lines.  Capture the whole line, so instead of just
declaring that we are in some "@@ =head1" section, diff/grep output
can explain that the enclosing section is about "@@ =head1 OPTIONS".

Reported-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agouserdiff/perl: anchor "sub" and "package" patterns on the left
Jonathan Nieder [Sat, 21 May 2011 19:29:01 +0000 (14:29 -0500)]
userdiff/perl: anchor "sub" and "package" patterns on the left

The userdiff funcname mechanism has no concept of nested scopes ---
instead, "git diff" and "git grep --show-function" simply label the
diff header with the most recent matching line.  Unfortunately that
means text following a subroutine in a POD section:

=head1 DESCRIPTION

You might use this facility like so:

sub example {
foo;
}

Now, having said that, let's say more about the facility.
Blah blah blah ... etc etc.

gets the subroutine name instead of the POD header in its diff/grep
funcname header, making it harder to get oriented when reading a
diff without enough context.

The fix is simple: anchor the funcname syntax to the left margin so
nested subroutines and packages like this won't get picked up.  (The
builtin C++ funcname pattern already does the same thing.)  This means
the userdiff driver will misparse the idiom

{
my $static;
sub foo {
... use $static ...
}
}

but I think that's worth it; we can revisit this later if the userdiff
mechanism learns to keep track of the beginning and end of nested
scopes.

Reported-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot4018 (funcname patterns): minor cleanups
Jonathan Nieder [Sat, 21 May 2011 19:25:14 +0000 (14:25 -0500)]
t4018 (funcname patterns): minor cleanups

Introduce a test_expect_funcname function to make a diff and apply a
regexp anchored on the left to the function name it writes, avoiding
some repetition.

Omit the space after >, <<, and < operators for consistency with
other scripts.  Quote the <<here document delimiter and $ signs in
quotes so readers don't have to worry about the effect of shell
metacharacters.

Remove some unnecessary blank lines.

Run "git diff" as a separate command instead of as upstream of a pipe
that checks its output, so the exit status can be tested.  In
particular, this way if "git diff" starts segfaulting the test harness
will notice.

Allow "error:" as a synonym for "fatal:" when checking error messages,
since whether a command uses die() or "return error()" is a small
implementation detail.

Anchor some more regexes on the right.

None of the above is very important on its own; the point is just to
make the script a little easier to read and the code less scary to
modify.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot4018 (funcname patterns): make configuration easier to track
Jonathan Nieder [Sat, 21 May 2011 19:22:28 +0000 (14:22 -0500)]
t4018 (funcname patterns): make configuration easier to track

Introduce a "test_config" function to set a configuration variable
for use by a single test (automatically unsetting it when the
assertion finishes).  If this function is used consistently, the
configuration used in a test_expect_success block can be read at the
beginning of that block instead of requiring reading all the tests
that come before.  So it becomes a little easier to add new tests or
rearrange existing ones without fear of breaking configuration.

In particular, the test of alternation in xfuncname patterns also
checks that xfuncname takes precedence over funcname variable as a
sort of side-effect, since the latter leaks in from previous tests.
In the new syntax, the test has to say explicitly what variables it is
using, making the test clearer and a future regression in coverage
from carelessly editing the script less likely.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot4018 (funcname patterns): make .gitattributes state easier to track
Jonathan Nieder [Sat, 21 May 2011 19:11:33 +0000 (14:11 -0500)]
t4018 (funcname patterns): make .gitattributes state easier to track

Most, but not all, tests in this script rely on attributes declaring
that files with a .java extension should use the "java" driver:

*.java diff=java

Split out a "set up" test to put such a .gitattributes in place after
the tests that do not want it have run, to make it more likely that
individual tests other than this setup test can be safely modified,
rearranged, or skipped.  Presumably this setup code will learn to
request other drivers for other extensions in the same place when the
test suite learns to exercise other diff drivers.

Similarly, make sure that early test assertions that do not use these
default attributes set up .gitattributes appropriately for themselves,
so tests that run before can be modified with less risk of breaking
something.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'maint'
Junio C Hamano [Sat, 21 May 2011 01:50:29 +0000 (18:50 -0700)]
Merge branch 'maint'

* maint:
  git-svn: Fix git svn log --show-commit

13 years agodo not read beyond end of malloc'd buffer
Jim Meyering [Fri, 20 May 2011 17:20:12 +0000 (19:20 +0200)]
do not read beyond end of malloc'd buffer

With diff.suppress-blank-empty=true, "git diff --word-diff" would
output data that had been read from uninitialized heap memory.
The problem was that fn_out_consume did not account for the
possibility of a line with length 1, i.e., the empty context line
that diff.suppress-blank-empty=true converts from " \n" to "\n".
Since it assumed there would always be a prefix character (the space),
it decremented "len" unconditionally, thus passing len=0 to emit_line,
which would then blindly call emit_line_0 with len=-1 which would
pass that value on to fwrite as SIZE_MAX.  Boom.

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit-svn: Fix git svn log --show-commit
Michael J Gruber [Fri, 20 May 2011 11:16:34 +0000 (13:16 +0200)]
git-svn: Fix git svn log --show-commit

git svn log --show-commit had no tests and, consequently, no attention
by the author of

b1b4755 (git-log: put space after commit mark, 2011-03-10)

who kept git svn log working only without --show-commit.

Introduce a test and fix it.

Reported-by: Bernt Hansen <bernt@norang.ca>
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoUpdate draft release notes to 1.7.6
Junio C Hamano [Fri, 20 May 2011 03:50:07 +0000 (20:50 -0700)]
Update draft release notes to 1.7.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'jc/maint-1.7.4-pathspec-stdin-and-cmdline'
Junio C Hamano [Fri, 20 May 2011 04:02:14 +0000 (21:02 -0700)]
Merge branch 'jc/maint-1.7.4-pathspec-stdin-and-cmdline'

* jc/maint-1.7.4-pathspec-stdin-and-cmdline:

13 years agoMerge branch 'rg/copy-gecos-username'
Junio C Hamano [Fri, 20 May 2011 03:37:21 +0000 (20:37 -0700)]
Merge branch 'rg/copy-gecos-username'

* rg/copy-gecos-username:
  copy_gecos: fix not adding nlen to len when processing "&"

13 years agoMerge branch 'jl/submodule-conflicted-gitmodules'
Junio C Hamano [Fri, 20 May 2011 03:37:21 +0000 (20:37 -0700)]
Merge branch 'jl/submodule-conflicted-gitmodules'

* jl/submodule-conflicted-gitmodules:
  Submodules: Don't parse .gitmodules when it contains, merge conflicts
  test that git status works with merge conflict in, .gitmodules

13 years agoMerge branch 'jc/replacing'
Junio C Hamano [Fri, 20 May 2011 03:37:21 +0000 (20:37 -0700)]
Merge branch 'jc/replacing'

* jc/replacing:
  read_sha1_file(): allow selective bypassing of replacement mechanism
  inline lookup_replace_object() calls
  read_sha1_file(): get rid of read_sha1_file_repl() madness
  t6050: make sure we test not just commit replacement
  Declare lookup_replace_object() in cache.h, not in commit.h

Conflicts:
environment.c

13 years agoMerge branch 'nd/sparse-co-fix'
Junio C Hamano [Fri, 20 May 2011 03:37:21 +0000 (20:37 -0700)]
Merge branch 'nd/sparse-co-fix'

* nd/sparse-co-fix:
  sparse checkout: do not eagerly decide the fate for whole directory
  t1011: fix sparse-checkout initialization and add new file

13 years agoMerge branch 'ld/p4-preserve-user-names'
Junio C Hamano [Fri, 20 May 2011 03:37:20 +0000 (20:37 -0700)]
Merge branch 'ld/p4-preserve-user-names'

* ld/p4-preserve-user-names:
  git-p4: warn if git authorship won't be retained
  git-p4: small improvements to user-preservation
  git-p4: add option to preserve user names

13 years agoMerge branch 'ms/tagname-does-not-begin-with-dash'
Junio C Hamano [Fri, 20 May 2011 03:37:20 +0000 (20:37 -0700)]
Merge branch 'ms/tagname-does-not-begin-with-dash'

* ms/tagname-does-not-begin-with-dash:
  tag: disallow '-' as tag name

13 years agoMerge branch 'jk/git-connection-deadlock-fix'
Junio C Hamano [Fri, 20 May 2011 03:37:20 +0000 (20:37 -0700)]
Merge branch 'jk/git-connection-deadlock-fix'

* jk/git-connection-deadlock-fix:
  test core.gitproxy configuration
  send-pack: avoid deadlock on git:// push with failed pack-objects
  connect: let callers know if connection is a socket
  connect: treat generic proxy processes like ssh processes

Conflicts:
connect.c

13 years agoMerge branch 'js/maint-send-pack-stateless-rpc-deadlock-fix'
Junio C Hamano [Fri, 20 May 2011 03:37:19 +0000 (20:37 -0700)]
Merge branch 'js/maint-send-pack-stateless-rpc-deadlock-fix'

* js/maint-send-pack-stateless-rpc-deadlock-fix:
  sideband_demux(): fix decl-after-stmt