Code

git.git
15 years agoTests on Windows: $(pwd) must return Windows-style paths
Johannes Sixt [Fri, 13 Mar 2009 22:35:24 +0000 (23:35 +0100)]
Tests on Windows: $(pwd) must return Windows-style paths

Many tests pass $(pwd) in some form to git and later test that the output
of git contains the correct value of $(pwd). For example, the test of
'git remote show' sets up a remote that contains $(pwd) and then the
expected result must contain $(pwd).

Again, MSYS-bash's path mangling kicks in: Plain $(pwd) uses the MSYS style
absolute path /c/path/to/git. The test case would write this name into
the 'expect' file. But when git is invoked, MSYS-bash converts this name to
the Windows style path c:/path/to/git, and git would produce this form in
the result; the test would fail.

We fix this by passing -W to bash's pwd that produces the Windows-style
path.

There are a two cases that need an accompanying change:

- In t1504 the value of $(pwd) becomes part of a path list. In this case,
  the lone 'c' in something like /foo:c:/path/to/git:/bar inhibits
  MSYS-bashes path mangling; IOW in this case we want the /c/path/to/git
  form to allow path mangling. We use $PWD instead of $(pwd), which always
  has the latter form.

- In t6200, $(pwd) - the Windows style path - must be used to construct the
  expected result because that is the path form that git sees. (The change
  in the test itself is just for consistency: 'git fetch' always sees the
  Windows-style path, with or without the change.)

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
15 years agotest-lib: Work around missing sum on Windows
Johannes Sixt [Sat, 14 Mar 2009 21:21:27 +0000 (22:21 +0100)]
test-lib: Work around missing sum on Windows

t1002-read-tree-m-u-2way.sh uses 'sum', but it does not rely on the exact
form of the sum, only that it is a hash digest. Therefore, we can sneak
in 'md5sum' under the name 'sum'.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
15 years agotest-lib: Work around incompatible sort and find on Windows
Johannes Sixt [Wed, 11 Mar 2009 20:17:26 +0000 (21:17 +0100)]
test-lib: Work around incompatible sort and find on Windows

If the PATH lists the Windows system directories before the MSYS
directories, Windows's own incompatible sort and find commands would be
picked up. We implement these commands as functions and call the real
tools by absolute path.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
15 years agot5602: Work around path mangling on MSYS
Johannes Sixt [Thu, 12 Mar 2009 19:32:43 +0000 (20:32 +0100)]
t5602: Work around path mangling on MSYS

MSYS's bash rewrites /something/bin/... into a Windows path that looks like
c:/msysgit/something/bin/... before git sees it. But later the test case
verifies that the path was used and compares it to the unmangled version.
This fails, of course. This make the path relative so that the path
mangling is not triggered.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
15 years agot5300, t5302, t5303: Do not use /dev/zero
Johannes Sixt [Mon, 17 Nov 2008 08:21:30 +0000 (09:21 +0100)]
t5300, t5302, t5303: Do not use /dev/zero

We do not have /dev/zero on Windows. This replaces it by data generated
with printf, perl, or echo. Most of the cases do not depend on that the
data is a stream of zero bytes, so we use something printable; nor is an
unlimited stream of data needed, so we produce only as many bytes as the
test cases need.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
15 years agot2200, t7004: Avoid glob pattern that also matches files
Johannes Sixt [Mon, 9 Feb 2009 09:24:51 +0000 (10:24 +0100)]
t2200, t7004: Avoid glob pattern that also matches files

On Windows, there is an unfortunate interaction between the MSYS bash and
git's command line processing:

- Since Windows's CMD does not do the wildcard expansion, but passes
  arguments like path* through to the programs, the programs must do the
  expansion themselves. This happens in the startup code before main() is
  entered.

- bash, however, passes the argument "path*" to git, assuming that git will
  see the unquoted word unchanged as a single argument.

But actually git expands the unquoted word before main() is entered.

In t2200, not all names that the test case is interested in exist as files
at the time when 'git ls-files' is invoked. git expands "path?" to only
the subset of files the exist, and only that subset was listed, so that the
test failed.  We now list all interesting paths explicitly.

In t7004, git exanded the pattern "*a*" to "actual" (the file that stdout
was redirected to), which is not what the was tested for. We fix it by
renaming the output file (and removing any existing files matching *a*).
This was originally fixed by Johannes Schindelin.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
15 years agot7300: fix clean up on Windows
Johannes Schindelin [Wed, 11 Mar 2009 16:58:32 +0000 (17:58 +0100)]
t7300: fix clean up on Windows

On Windows, you cannot remove files that are in use, not even with
'rm -rf'.  So we need to run 'exec <foo/bar' inside a subshell lest
removing the whole test repository fail.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
15 years agotest-lib: Introduce test_chmod and use it instead of update-index --chmod
Johannes Sixt [Sat, 28 Feb 2009 20:12:57 +0000 (21:12 +0100)]
test-lib: Introduce test_chmod and use it instead of update-index --chmod

This function replaces sequences of 'chmod +x' and 'git update-index
--chmod=+x' in the test suite, whose purpose is to help filesystems
that need core.filemode=false. Two places where only 'chmod +x' was used
we also use this new function.

The function calls 'git update-index --chmod' without checking
core.filemode (unlike some of the call sites did). We do this because the
call sites *expect* that the executable bit ends up in the index (ie. it
is not the purpose of the call sites to *test* whether git treats
'chmod +x' and 'update-index --chmod=+x' correctly). Therefore, on
filesystems with core.filemode=true the 'git update-index --chmod' is a
no-op.

The function uses --add with update-index to help one call site in
t6031-merge-recursive. It makes no difference for the other callers.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
15 years agotest-lib: Simplify test counting.
Johannes Sixt [Thu, 5 Feb 2009 20:20:56 +0000 (21:20 +0100)]
test-lib: Simplify test counting.

Since the test case counter was incremented very late, there were a few
users of the counter had to do their own incrementing. Now we increment it
early and simplify these users.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
15 years agotest-lib: Replace uses of $(expr ...) by POSIX shell features.
Johannes Sixt [Thu, 5 Feb 2009 19:59:27 +0000 (20:59 +0100)]
test-lib: Replace uses of $(expr ...) by POSIX shell features.

In particular:

- Test case counting can be achieved by arithmetic expansion.

- The name of the test, e.g. t1234, can be computed with ${0%%} and ${0##}.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
15 years agoCall 'say' outside test_expect_success
Johannes Sixt [Tue, 17 Mar 2009 21:45:22 +0000 (22:45 +0100)]
Call 'say' outside test_expect_success

There were some uses of 'say' inside test_expect_success. But if the tests
were not run in verbose mode, this message went to /dev/null. Pull them out
of test_expect_success.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
15 years agotest suite: Use 'say' to say something instead of 'test_expect_success'
Johannes Sixt [Sun, 1 Mar 2009 18:52:51 +0000 (19:52 +0100)]
test suite: Use 'say' to say something instead of 'test_expect_success'

Some tests report that some tests will be skipped.  They used
'test_expect_success' with a trivially successful test.  Nowadays we have
the helper function 'say' for this purpose.

In on case, 'say_color skip' is replaced by 'say' because the former is
not intended as a public API.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
15 years agot9400, t9401: Do not force hard-linked clone
Johannes Sixt [Fri, 6 Mar 2009 23:04:09 +0000 (00:04 +0100)]
t9400, t9401: Do not force hard-linked clone

The tests do not depend on that the clones are hard-linked, but used
--local only as an optimization: At the time that --local was used first
in t9400 hard-linked clones were not the default, yet.

By removing --local, we help filesystems that do not support hard-links.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
15 years agoUpdate draft release notes to 1.6.3
Junio C Hamano [Wed, 18 Mar 2009 03:26:24 +0000 (20:26 -0700)]
Update draft release notes to 1.6.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'jc/maint-1.6.0-read-tree-overlay'
Junio C Hamano [Wed, 18 Mar 2009 01:58:55 +0000 (18:58 -0700)]
Merge branch 'jc/maint-1.6.0-read-tree-overlay'

* jc/maint-1.6.0-read-tree-overlay:
  read-tree A B C: do not create a bogus index and do not segfault

15 years agoMerge branch 'db/maint-missing-origin'
Junio C Hamano [Wed, 18 Mar 2009 01:58:41 +0000 (18:58 -0700)]
Merge branch 'db/maint-missing-origin'

* db/maint-missing-origin:
  Remove total confusion from git-fetch and git-push
  Give error when no remote is configured

15 years agoMerge branch 'js/sideband-stderr'
Junio C Hamano [Wed, 18 Mar 2009 01:58:25 +0000 (18:58 -0700)]
Merge branch 'js/sideband-stderr'

* js/sideband-stderr:
  winansi: support ESC [ K (erase in line)
  recv_sideband: Bands #2 and #3 always go to stderr

15 years agoMerge branch 'js/rsync-local'
Junio C Hamano [Wed, 18 Mar 2009 01:58:13 +0000 (18:58 -0700)]
Merge branch 'js/rsync-local'

* js/rsync-local:
  rsync transport: allow local paths, and fix tests

15 years agoMerge branch 'rs/color-grep'
Junio C Hamano [Wed, 18 Mar 2009 01:58:02 +0000 (18:58 -0700)]
Merge branch 'rs/color-grep'

* rs/color-grep:
  grep: prefer builtin over external one when coloring results
  grep: cast printf %.*s "precision" argument explicitly to int
  grep: add support for coloring with external greps
  grep: color patterns in output
  grep: add pmatch and eflags arguments to match_one_pattern()
  grep: remove grep_opt argument from match_expr_eval()
  grep: micro-optimize hit collection for AND nodes

15 years agoMerge branch 'js/remote-improvements'
Junio C Hamano [Wed, 18 Mar 2009 01:55:06 +0000 (18:55 -0700)]
Merge branch 'js/remote-improvements'

* js/remote-improvements: (23 commits)
  builtin-remote.c: no "commented out" code, please
  builtin-remote: new show output style for push refspecs
  builtin-remote: new show output style
  remote: make guess_remote_head() use exact HEAD lookup if it is available
  builtin-remote: add set-head subcommand
  builtin-remote: teach show to display remote HEAD
  builtin-remote: fix two inconsistencies in the output of "show <remote>"
  builtin-remote: make get_remote_ref_states() always populate states.tracked
  builtin-remote: rename variables and eliminate redundant function call
  builtin-remote: remove unused code in get_ref_states
  builtin-remote: refactor duplicated cleanup code
  string-list: new for_each_string_list() function
  remote: make match_refs() not short-circuit
  remote: make match_refs() copy src ref before assigning to peer_ref
  remote: let guess_remote_head() optionally return all matches
  remote: make copy_ref() perform a deep copy
  remote: simplify guess_remote_head()
  move locate_head() to remote.c
  move duplicated ref_newer() to remote.c
  move duplicated get_local_heads() to remote.c
  ...

Conflicts:
builtin-clone.c

15 years agoMerge branch 'tr/maint-1.6.0-send-email-irt'
Junio C Hamano [Wed, 18 Mar 2009 01:54:46 +0000 (18:54 -0700)]
Merge branch 'tr/maint-1.6.0-send-email-irt'

* tr/maint-1.6.0-send-email-irt:
  send-email: test --no-thread --in-reply-to combination
  send-email: respect in-reply-to regardless of threading

Conflicts:
t/t9001-send-email.sh

15 years agoMerge branch 'kb/checkout-optim'
Junio C Hamano [Wed, 18 Mar 2009 01:54:31 +0000 (18:54 -0700)]
Merge branch 'kb/checkout-optim'

* kb/checkout-optim:
  Revert "lstat_cache(): print a warning if doing ping-pong between cache types"
  checkout bugfix: use stat.mtime instead of stat.ctime in two places
  Makefile: Set compiler switch for USE_NSEC
  Create USE_ST_TIMESPEC and turn it on for Darwin
  Not all systems use st_[cm]tim field for ns resolution file timestamp
  Record ns-timestamps if possible, but do not use it without USE_NSEC
  write_index(): update index_state->timestamp after flushing to disk
  verify_uptodate(): add ce_uptodate(ce) test
  make USE_NSEC work as expected
  fix compile error when USE_NSEC is defined
  check_updates(): effective removal of cache entries marked CE_REMOVE
  lstat_cache(): print a warning if doing ping-pong between cache types
  show_patch_diff(): remove a call to fstat()
  write_entry(): use fstat() instead of lstat() when file is open
  write_entry(): cleanup of some duplicated code
  create_directories(): remove some memcpy() and strchr() calls
  unlink_entry(): introduce schedule_dir_for_removal()
  lstat_cache(): swap func(length, string) into func(string, length)
  lstat_cache(): generalise longest_match_lstat_cache()
  lstat_cache(): small cleanup and optimisation

15 years agogrep: prefer builtin over external one when coloring results
Nguyễn Thái Ngọc Duy [Mon, 16 Mar 2009 02:20:04 +0000 (13:20 +1100)]
grep: prefer builtin over external one when coloring results

As far as I know, not all grep programs support coloring, so we should
rely on builtin grep. If you want external grep, set
color.grep.external to empty string.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoconfig.txt: Describe special 'none' handling in core.gitProxy.
Emil Sit [Tue, 17 Mar 2009 17:31:42 +0000 (13:31 -0400)]
config.txt: Describe special 'none' handling in core.gitProxy.

Signed-off-by: Emil Sit <sit@emilsit.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agols-files: require worktree when --deleted is given
Jeff King [Tue, 17 Mar 2009 09:03:19 +0000 (05:03 -0400)]
ls-files: require worktree when --deleted is given

The code will end up calling lstat() to check whether the
file still exists; obviously this doesn't work if we're not
in the worktree.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-branch.txt: document -f correctly
Michael J Gruber [Tue, 17 Mar 2009 14:06:20 +0000 (15:06 +0100)]
git-branch.txt: document -f correctly

'git branch -f a b' resets a to b when a exists, rather then deleting a.
Say so in the documentation.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agopickaxe: count regex matches only once
René Scharfe [Mon, 16 Mar 2009 18:38:42 +0000 (19:38 +0100)]
pickaxe: count regex matches only once

When --pickaxe-regex is used, forward past the end of matches instead of
advancing to the byte after their start.  This way matches count only
once, even if the regular expression matches their tail -- like in the
fixed-string fork of the code.

E.g.: /.*/ used to count the number of bytes instead of the number of
lines.  /aa/ resulted in a count of two in "aaa" instead of one.

Also document the fact that regexec() needs a NUL-terminated string as
its second argument by adding an assert().

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-send-email.txt: describe --compose better
Stephen Boyd [Mon, 16 Mar 2009 07:44:57 +0000 (00:44 -0700)]
git-send-email.txt: describe --compose better

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoTests: use test_cmp instead of diff where possible
Miklos Vajna [Mon, 16 Mar 2009 20:18:42 +0000 (21:18 +0100)]
Tests: use test_cmp instead of diff where possible

Several old tests were written before test_cmp was introduced, convert
these to test_cmp.

If were are at it, fix the order of the arguments where necessary to
make expected come first, so the command shows how the test result
deviates from the correct output.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDocumentation: remove extra quoting/emphasis around literal texts
Chris Johnsen [Sun, 15 Mar 2009 11:30:52 +0000 (06:30 -0500)]
Documentation: remove extra quoting/emphasis around literal texts

If literal text (asciidoc `...`) can be rendered in a differently from
normal text for each output format (man, HTML), then we do not need
extra quotes or other wrapping around inline literal text segments.

config.txt

  Change '`...`' to `...`. In asciidoc, the single quotes provide
  emphasis, literal text should be distintive enough.

  Change "`...`" to `...`. These double quotes do not work if present
  in the described config value, so drop them.

git-checkout.txt

  Change "`...`" to `...` or `"..."`. All instances are command line
  argument examples. One "`-`" becomes `-`. Two others are involve
  curly braces, so move the double quotes inside the literal region to
  indicate that they might need to be quoted on the command line of
  certain shells (tcsh).

git-merge.txt

  Change "`...`" to `...`. All instances are used to describe merge
  conflict markers. The quotes should are not important.

git-rev-parse.txt

  Change "`...`" to `...`. All instances are around command line
  arguments where no in-shell quoting should be necessary.

gitcli.txt

  Change `"..."` to `...`. All instances are around command line
  examples or single command arguments. They do not semanticly belong
  inside the literal text, and they are not needed outside it.

glossary-content.txt
user-manual.txt

  Change "`...`" to `...`. All instances were around command lines.

Signed-off-by: Chris Johnsen <chris_johnsen@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-push.txt: describe how to default to pushing only current branch
Chris Johnsen [Sun, 15 Mar 2009 02:32:01 +0000 (21:32 -0500)]
git-push.txt: describe how to default to pushing only current branch

Signed-off-by: Chris Johnsen <chris_johnsen@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agodisable post-checkout test on Cygwin
Alex Riesen [Tue, 17 Mar 2009 16:22:53 +0000 (17:22 +0100)]
disable post-checkout test on Cygwin

It is broken because of the tricks we have to play with
lstat to get the bearable perfomance out of the call.
Sadly, it disables access to Cygwin's executable attribute,
which Windows filesystems do not have at all.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoRevert "lstat_cache(): print a warning if doing ping-pong between cache types"
Kjetil Barvik [Tue, 17 Mar 2009 18:20:29 +0000 (19:20 +0100)]
Revert "lstat_cache(): print a warning if doing ping-pong between cache types"

This reverts commit 7734f04873cfaddd0b148074a633f1f824fd961f.

I guess that the reverted commit, 7734f048, has been in test long
enough, and should now be reverted.  I have not received any info
regarding any debug output of the reverted commit, so lets hope that
the lstat_cache() function do not cause any ping-pong.

Signed-off-by: Kjetil Barvik <barvik@broadpark.no>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMinGW: a hardlink implementation
Petr Kodl [Sat, 24 Jan 2009 14:04:39 +0000 (15:04 +0100)]
MinGW: a hardlink implementation

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMinGW: a helper function that translates Win32 API error codes
Petr Kodl [Sat, 24 Jan 2009 14:04:39 +0000 (15:04 +0100)]
MinGW: a helper function that translates Win32 API error codes

This function translates many possible Win32 error codes to suitable
errno numbers.  We will use it in our wrapper functions that need to call
into Win32.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoRemove total confusion from git-fetch and git-push
Junio C Hamano [Mon, 16 Mar 2009 07:35:09 +0000 (00:35 -0700)]
Remove total confusion from git-fetch and git-push

The config file is not the only place remotes are defined, and without
consulting .git/remotes and .git/branches, you won't know if "origin" is
configured by the user.  Don't give up too early and insult the user with
a wisecrack "Where do you want to fetch from today?"

The only thing the previous patch seems to want to prevent from happening
is a lazy "git fetch/push" that does not say where-from/to to produce an
error message 'origin not found', and we can do that by not letting
add_url_alias() to turn a nickname "origin" literally into a pathname
"origin" without changing the rest of the logic.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoFix various dead stores found by the clang static analyzer
Benjamin Kramer [Sun, 15 Mar 2009 21:01:20 +0000 (22:01 +0100)]
Fix various dead stores found by the clang static analyzer

http-push.c::finish_request():
  request is initialized by the for loop

index-pack.c::free_base_data():
  b is initialized by the for loop

merge-recursive.c::process_renames():
  move compare to narrower scope, and remove unused assignments to it
  remove unused variable renames2

xdiff/xdiffi.c::xdl_recs_cmp():
  remove unused variable ec

xdiff/xemit.c::xdl_emit_diff():
  xche is always overwritten

Signed-off-by: Benjamin Kramer <benny.kra@googlemail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoSync with GIT 1.6.2.1
Junio C Hamano [Sun, 15 Mar 2009 20:10:10 +0000 (13:10 -0700)]
Sync with GIT 1.6.2.1

15 years agoGIT 1.6.2.1 v1.6.2.1
Junio C Hamano [Sun, 15 Mar 2009 20:03:19 +0000 (13:03 -0700)]
GIT 1.6.2.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agocheckout bugfix: use stat.mtime instead of stat.ctime in two places
Kjetil Barvik [Sun, 15 Mar 2009 11:38:55 +0000 (12:38 +0100)]
checkout bugfix: use stat.mtime instead of stat.ctime in two places

Commit e1afca4fd "write_index(): update index_state->timestamp after
flushing to disk" on 2009-02-23 used stat.ctime to record the
timestamp of the index-file.  This is wrong, so fix this and use the
correct stat.mtime timestamp instead.

Commit 110c46a909 "Not all systems use st_[cm]tim field for ns
resolution file timestamp" on 2009-03-08, has a similar bug for the
builtin-fetch-pack.c file.

Signed-off-by: Kjetil Barvik <barvik@broadpark.no>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agotest-lib: write test results to test-results/<basename>-<pid>
Johannes Schindelin [Fri, 13 Mar 2009 16:26:36 +0000 (17:26 +0100)]
test-lib: write test results to test-results/<basename>-<pid>

The earlier code meant to attempt to strip everything except the test
number, but only stripped the part starting with the last dash.

However, there is no reason why we should not use the whole basename.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoRemove unused assignments
Benjamin Kramer [Fri, 13 Mar 2009 12:51:33 +0000 (13:51 +0100)]
Remove unused assignments

These variables were always overwritten or the assigned
value was unused:

  builtin-diff-tree.c::cmd_diff_tree(): nr_sha1
  builtin-for-each-ref.c::opt_parse_sort(): sort_tail
  builtin-mailinfo.c::decode_header_bq(): in
  builtin-shortlog.c::insert_one_record(): len
  connect.c::git_connect(): path
  imap-send.c::v_issue_imap_cmd(): n
  pretty.c::pp_user_info(): filler
  remote::parse_refspec_internal(): llen

Signed-off-by: Benjamin Kramer <benny.kra@googlemail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agotest-suite: Make test script numbers unique
Johannes Sixt [Fri, 13 Mar 2009 12:23:26 +0000 (13:23 +0100)]
test-suite: Make test script numbers unique

In order to selectively skip tests, the environment variable GIT_SKIP_TESTS
can be set like this:

  $ GIT_SKIP_TESTS='t1301 t4150.18' make test

That is, its value can contain only the test script numbers, but not the
full script name. Therefore, it is important that the test scripts are
uniquely numbered. This makes it so.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint'
Junio C Hamano [Fri, 13 Mar 2009 06:39:28 +0000 (23:39 -0700)]
Merge branch 'maint'

* maint:

15 years agoMerge branch 'maint-1.6.1' into maint
Junio C Hamano [Fri, 13 Mar 2009 06:37:16 +0000 (23:37 -0700)]
Merge branch 'maint-1.6.1' into maint

* maint-1.6.1:

15 years agoMerge branch 'maint-1.6.0' into maint-1.6.1
Junio C Hamano [Fri, 13 Mar 2009 06:36:57 +0000 (23:36 -0700)]
Merge branch 'maint-1.6.0' into maint-1.6.1

* maint-1.6.0:
  bisect: fix another instance of eval'ed string
  bisect: fix quoting TRIED revs when "bad" commit is also "skip"ped
  Support "\" in non-wildcard exclusion entries

Conflicts:
git-bisect.sh

15 years agoMerge branch 'en/maint-1.6.1-hash-object' into maint-1.6.1
Junio C Hamano [Fri, 13 Mar 2009 06:11:23 +0000 (23:11 -0700)]
Merge branch 'en/maint-1.6.1-hash-object' into maint-1.6.1

* en/maint-1.6.1-hash-object:
  Ensure proper setup of git_dir for git-hash-object

15 years agoMerge branch 'ks/maint-1.6.0-mailinfo-folded' into maint-1.6.0
Junio C Hamano [Fri, 13 Mar 2009 04:48:43 +0000 (21:48 -0700)]
Merge branch 'ks/maint-1.6.0-mailinfo-folded' into maint-1.6.0

* ks/maint-1.6.0-mailinfo-folded:
  mailinfo: tests for RFC2047 examples
  mailinfo: add explicit test for mails like '<a.u.thor@example.com> (A U Thor)'
  mailinfo: 'From:' header should be unfold as well
  mailinfo: correctly handle multiline 'Subject:' header

15 years agoMerge branch 'cc/maint-1.6.0-bisect-fix' into maint-1.6.0
Junio C Hamano [Fri, 13 Mar 2009 04:48:26 +0000 (21:48 -0700)]
Merge branch 'cc/maint-1.6.0-bisect-fix' into maint-1.6.0

* cc/maint-1.6.0-bisect-fix:
  bisect: fix another instance of eval'ed string
  bisect: fix quoting TRIED revs when "bad" commit is also "skip"ped

15 years agoMerge branch 'fg/maint-1.6.0-exclude-bq' into maint-1.6.0
Junio C Hamano [Fri, 13 Mar 2009 04:48:07 +0000 (21:48 -0700)]
Merge branch 'fg/maint-1.6.0-exclude-bq' into maint-1.6.0

* fg/maint-1.6.0-exclude-bq:
  Support "\" in non-wildcard exclusion entries

15 years agoMerge branch 'js/maint-1.6.1-filter-branch-submodule' into maint-1.6.1
Junio C Hamano [Fri, 13 Mar 2009 04:46:50 +0000 (21:46 -0700)]
Merge branch 'js/maint-1.6.1-filter-branch-submodule' into maint-1.6.1

* js/maint-1.6.1-filter-branch-submodule:
  filter-branch: do not consider diverging submodules a 'dirty worktree'

15 years agoMerge branch 'gt/maint-1.6.1-utf8-width' into maint-1.6.1
Junio C Hamano [Fri, 13 Mar 2009 04:46:35 +0000 (21:46 -0700)]
Merge branch 'gt/maint-1.6.1-utf8-width' into maint-1.6.1

* gt/maint-1.6.1-utf8-width:
  builtin-blame.c: Use utf8_strwidth for author's names
  utf8: add utf8_strwidth()

15 years agoMerge branch 'js/maint-1.6.1-remote-remove-mirror' into maint-1.6.1
Junio C Hamano [Fri, 13 Mar 2009 04:45:56 +0000 (21:45 -0700)]
Merge branch 'js/maint-1.6.1-remote-remove-mirror' into maint-1.6.1

* js/maint-1.6.1-remote-remove-mirror:
  builtin-remote: make rm operation safer in mirrored repository
  builtin-remote: make rm() use properly named variable to hold return value

15 years agoMerge branch 'ek/maint-1.6.1-filter-branch-bare' into maint-1.6.1
Junio C Hamano [Fri, 13 Mar 2009 04:45:21 +0000 (21:45 -0700)]
Merge branch 'ek/maint-1.6.1-filter-branch-bare' into maint-1.6.1

* ek/maint-1.6.1-filter-branch-bare:
  filter-branch: Fix fatal error on bare repositories

15 years agoMerge branch 'jc/maint-1.6.1-add-u-remove-conflicted' into maint-1.6.1
Junio C Hamano [Fri, 13 Mar 2009 04:45:14 +0000 (21:45 -0700)]
Merge branch 'jc/maint-1.6.1-add-u-remove-conflicted' into maint-1.6.1

* jc/maint-1.6.1-add-u-remove-conflicted:
  add -u: do not fail to resolve a path as deleted

15 years agoMerge branch 'js/maint-1.6.1-rebase-i-submodule' into maint-1.6.1
Junio C Hamano [Fri, 13 Mar 2009 04:45:02 +0000 (21:45 -0700)]
Merge branch 'js/maint-1.6.1-rebase-i-submodule' into maint-1.6.1

* js/maint-1.6.1-rebase-i-submodule:
  Fix submodule squashing into unrelated commit
  rebase -i squashes submodule changes into unrelated commit

15 years agoMerge branch 'jc/maint-1.6.1-allow-uninteresting-missing' into maint-1.6.1
Junio C Hamano [Fri, 13 Mar 2009 04:44:48 +0000 (21:44 -0700)]
Merge branch 'jc/maint-1.6.1-allow-uninteresting-missing' into maint-1.6.1

* jc/maint-1.6.1-allow-uninteresting-missing:
  revision traversal: allow UNINTERESTING objects to be missing

15 years agoMerge branch 'ks/maint-1.6.0-mailinfo-folded' into maint-1.6.1
Junio C Hamano [Fri, 13 Mar 2009 04:44:00 +0000 (21:44 -0700)]
Merge branch 'ks/maint-1.6.0-mailinfo-folded' into maint-1.6.1

* ks/maint-1.6.0-mailinfo-folded:
  mailinfo: tests for RFC2047 examples
  mailinfo: add explicit test for mails like '<a.u.thor@example.com> (A U Thor)'
  mailinfo: 'From:' header should be unfold as well
  mailinfo: correctly handle multiline 'Subject:' header

15 years agoMerge branch 'jk/maint-1.6.1-cleanup-after-exec-failure' into maint-1.6.1
Junio C Hamano [Fri, 13 Mar 2009 04:43:38 +0000 (21:43 -0700)]
Merge branch 'jk/maint-1.6.1-cleanup-after-exec-failure' into maint-1.6.1

* jk/maint-1.6.1-cleanup-after-exec-failure:
  git: use run_command() to execute dashed externals
  run_command(): help callers distinguish errors
  run_command(): handle missing command errors more gracefully
  git: s/run_command/run_builtin/

15 years agoMerge branch 'jc/maint-1.6.0-split-diff-metainfo' into maint-1.6.0
Junio C Hamano [Fri, 13 Mar 2009 03:01:28 +0000 (20:01 -0700)]
Merge branch 'jc/maint-1.6.0-split-diff-metainfo' into maint-1.6.0

* jc/maint-1.6.0-split-diff-metainfo:
  diff.c: output correct index lines for a split diff

15 years agoread-tree A B C: do not create a bogus index and do not segfault
Junio C Hamano [Thu, 12 Mar 2009 07:02:12 +0000 (00:02 -0700)]
read-tree A B C: do not create a bogus index and do not segfault

"git read-tree A B C..." without the "-m" (merge) option is a way to read
these trees on top of each other to get an overlay of them.

An ancient commit ee6566e (Rewrite read-tree, 2005-09-05) passed the
ADD_CACHE_SKIP_DFCHECK flag when calling add_index_entry() to add the
paths obtained from these trees to the index, but it is an incorrect use
of the flag.  The flag is meant to be used by callers who know the
addition of the entry does not introduce a D/F conflict to the index in
order to avoid the overhead of checking.

This bug resulted in a bogus index that records both "x" and "x/z" as a
blob after reading three trees that have paths ("x"), ("x", "y"), and
("x/z", "y") respectively.  34110cd (Make 'unpack_trees()' have a separate
source and destination index, 2008-03-06) refactored the callsites of
add_index_entry() incorrectly and added more codepaths that use this flag
when it shouldn't be used.

Also, 0190457 (Move 'unpack_trees()' over to 'traverse_trees()' interface,
2008-03-05) introduced a bug to call add_index_entry() for the tree that
does not have the path in it, passing NULL as a cache entry.  This caused
reading multiple trees, one of which has path "x" but another doesn't, to
segfault.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDocumentation: filter-branch: show --ignore-unmatch in main index-filter example
Thomas Rast [Wed, 11 Mar 2009 23:00:56 +0000 (00:00 +0100)]
Documentation: filter-branch: show --ignore-unmatch in main index-filter example

Rearrange the example usage of

  git filter-branch --index-filter 'git rm --cached ...'

so that --ignore-unmatch is in the main example block.  People keep
stumbling over the (lack of this) option to the point where it is a
FAQ, so we would want to expose the most common usage where it stands
out.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agocontrib/difftool: use a separate config namespace for difftool commands
David Aguilar [Mon, 9 Mar 2009 09:12:36 +0000 (02:12 -0700)]
contrib/difftool: use a separate config namespace for difftool commands

Some users have different mergetool and difftool settings, so teach
difftool to read config vars from the difftool.* namespace.  This allows
having distinct configurations for the diff and merge scenarios.

We don't want to force existing users to set new values for no reason
so difftool falls back to existing mergetool config variables when the
difftool equivalents are not defined.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoUpdate release notes to 1.6.3
Junio C Hamano [Thu, 12 Mar 2009 04:47:02 +0000 (21:47 -0700)]
Update release notes to 1.6.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agosend-email: test --no-thread --in-reply-to combination
Thomas Rast [Wed, 11 Mar 2009 22:40:13 +0000 (23:40 +0100)]
send-email: test --no-thread --in-reply-to combination

3e0c4ff (send-email: respect in-reply-to regardless of threading,
2009-03-01) fixed the handling of the In-Reply-To header when both
--no-thread and --in-reply-to are in effect.  Add a test for it.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint'
Junio C Hamano [Wed, 11 Mar 2009 21:37:26 +0000 (14:37 -0700)]
Merge branch 'maint'

* maint:
  Update draft release notes for 1.6.2.1

15 years agoUpdate draft release notes for 1.6.2.1
Junio C Hamano [Wed, 11 Mar 2009 21:37:15 +0000 (14:37 -0700)]
Update draft release notes for 1.6.2.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'js/maint-send-email' into maint
Junio C Hamano [Wed, 11 Mar 2009 21:01:24 +0000 (14:01 -0700)]
Merge branch 'js/maint-send-email' into maint

* js/maint-send-email:
  send-email: don't create temporary compose file until it is needed
  send-email: --suppress-cc improvements
  send-email: handle multiple Cc addresses when reading mbox message
  send-email: allow send-email to run outside a repo

15 years agoMerge branch 'jk/sane-relative-time' into maint
Junio C Hamano [Wed, 11 Mar 2009 20:59:38 +0000 (13:59 -0700)]
Merge branch 'jk/sane-relative-time' into maint

* jk/sane-relative-time:
  never fallback relative times to absolute

15 years agoMerge branch 'jc/maint-add-p-unquote' into maint
Junio C Hamano [Wed, 11 Mar 2009 20:55:49 +0000 (13:55 -0700)]
Merge branch 'jc/maint-add-p-unquote' into maint

* jc/maint-add-p-unquote:
  git-add -i/-p: learn to unwrap C-quoted paths

15 years agoMerge branch 'fg/maint-exclude-bq' into maint
Junio C Hamano [Wed, 11 Mar 2009 20:53:53 +0000 (13:53 -0700)]
Merge branch 'fg/maint-exclude-bq' into maint

* fg/maint-exclude-bq:
  Support "\" in non-wildcard exclusion entries

15 years agoMerge branch 'en/maint-hash-object' into maint
Junio C Hamano [Wed, 11 Mar 2009 20:51:59 +0000 (13:51 -0700)]
Merge branch 'en/maint-hash-object' into maint

* en/maint-hash-object:
  Ensure proper setup of git_dir for git-hash-object

Conflicts:
hash-object.c

15 years agoMerge branch 'mg/maint-submodule-normalize-path'
Junio C Hamano [Wed, 11 Mar 2009 20:50:29 +0000 (13:50 -0700)]
Merge branch 'mg/maint-submodule-normalize-path'

* mg/maint-submodule-normalize-path:
  git submodule: Fix adding of submodules at paths with ./, .. and //
  git submodule: Add test cases for git submodule add

15 years agoMerge branch 'jc/maint-1.6.0-keep-pack'
Junio C Hamano [Wed, 11 Mar 2009 20:49:56 +0000 (13:49 -0700)]
Merge branch 'jc/maint-1.6.0-keep-pack'

* jc/maint-1.6.0-keep-pack:
  is_kept_pack(): final clean-up
  Simplify is_kept_pack()
  Consolidate ignore_packed logic more
  has_sha1_kept_pack(): take "struct rev_info"
  has_sha1_pack(): refactor "pretend these packs do not exist" interface
  git-repack: resist stray environment variable

15 years agoMerge branch 'rs/memmem'
Junio C Hamano [Wed, 11 Mar 2009 20:49:42 +0000 (13:49 -0700)]
Merge branch 'rs/memmem'

* rs/memmem:
  optimize compat/ memmem()
  diffcore-pickaxe: use memmem()

15 years agoMerge branch 'tv/rebase-stat'
Junio C Hamano [Wed, 11 Mar 2009 20:49:11 +0000 (13:49 -0700)]
Merge branch 'tv/rebase-stat'

* tv/rebase-stat:
  git-pull: Allow --stat and --no-stat to be used with --rebase
  git-rebase: Add --stat and --no-stat for producing diffstat on rebase

15 years agoMerge branch 'jk/clone-post-checkout'
Junio C Hamano [Wed, 11 Mar 2009 20:48:31 +0000 (13:48 -0700)]
Merge branch 'jk/clone-post-checkout'

* jk/clone-post-checkout:
  clone: run post-checkout hook when checking out

15 years agoMerge branch 'tr/format-patch-thread'
Junio C Hamano [Wed, 11 Mar 2009 20:48:07 +0000 (13:48 -0700)]
Merge branch 'tr/format-patch-thread'

* tr/format-patch-thread:
  format-patch: support deep threading
  format-patch: thread as reply to cover letter even with in-reply-to
  format-patch: track several references
  format-patch: threading test reactivation

Conflicts:
builtin-log.c

15 years agoMerge branch 'el/blame-date'
Junio C Hamano [Wed, 11 Mar 2009 20:47:12 +0000 (13:47 -0700)]
Merge branch 'el/blame-date'

* el/blame-date:
  Make git blame's date output format configurable, like git log

15 years agoMerge branch 'tr/gcov'
Junio C Hamano [Wed, 11 Mar 2009 20:47:01 +0000 (13:47 -0700)]
Merge branch 'tr/gcov'

* tr/gcov:
  Test git-patch-id
  Test rev-list --parents/--children
  Test log --decorate
  Test fsck a bit harder
  Test log --graph
  Test diff --dirstat functionality
  Test that diff can read from stdin
  Support coverage testing with GCC/gcov

15 years agotest: do not LoadModule log_config_module unconditionally
Johannes Schindelin [Wed, 11 Mar 2009 11:47:06 +0000 (12:47 +0100)]
test: do not LoadModule log_config_module unconditionally

LoadModule directive for log_config_module will not work if the module is
built-in.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agowinansi: support ESC [ K (erase in line)
Johannes Schindelin [Tue, 10 Mar 2009 21:58:09 +0000 (22:58 +0100)]
winansi: support ESC [ K (erase in line)

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agorecv_sideband: Bands #2 and #3 always go to stderr
Johannes Sixt [Tue, 10 Mar 2009 21:54:17 +0000 (22:54 +0100)]
recv_sideband: Bands #2 and #3 always go to stderr

This removes the last parameter of recv_sideband, by which the callers
told which channel bands #2 and #3 should be written to.

Sayeth Shawn Pearce:

   The definition of the streams in the current sideband protocol
   are rather well defined for the one protocol that uses it,
   fetch-pack/receive-pack:

     stream #1:  pack data
     stream #2:  stderr messages, progress, meant for tty
     stream #3:  abort message, remote is dead, goodbye!

Since both callers of the function passed 2 for the parameter, we hereby
remove it and send bands #2 and #3 to stderr explicitly using fprintf.

This has the nice side-effect that these two streams pass through our
ANSI emulation layer on Windows.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Acked-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agorsync transport: allow local paths, and fix tests
Johannes Schindelin [Mon, 9 Mar 2009 18:44:55 +0000 (19:44 +0100)]
rsync transport: allow local paths, and fix tests

Earlier, the rsync tests were disabled by default, as they needed a
running rsyncd daemon.  This was only due to the limitation that our
rsync transport only allowed full URLs of the form

rsync://<host>/<path>

Relaxing the URLs to allow

rsync:<path>

permitted the change in the tests to run whenever rsync is available,
without requiring a fully configured and running rsyncd.

While at it, the tests were fixed so that they run in directories with a
space in their name.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-instaweb: fix lighttpd configuration on cygwin
Ramsay Jones [Mon, 9 Mar 2009 18:31:55 +0000 (18:31 +0000)]
git-instaweb: fix lighttpd configuration on cygwin

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Tested-by: Pascal Obry <pascal@obry.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoGive error when no remote is configured
Daniel Barkalow [Wed, 11 Mar 2009 05:47:20 +0000 (01:47 -0400)]
Give error when no remote is configured

When there's no explicitly-named remote, we use the remote specified
for the current branch, which in turn defaults to "origin". But it
this case should require the remote to actually be configured, and not
fall back to the path "origin".

Possibly, the config file's "remote = something" should require the
something to be a configured remote instead of a bare repository URL,
but we actually test with a bare repository URL.

In fetch, we were giving the sensible error message when coming up
with a URL failed, but this wasn't actually reachable, so move that
error up and use it when appropriate.

In push, we need a new error message, because the old one (formerly
unreachable without a lot of help) used the repo name, which was NULL.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoInclude log_config module in apache.conf
Daniel Barkalow [Wed, 11 Mar 2009 03:23:45 +0000 (23:23 -0400)]
Include log_config module in apache.conf

The log_config module is needed for at least some versions of apache to
support the LogFormat directive.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoTypo and language fixes for git-checkout.txt
Michael J Gruber [Tue, 10 Mar 2009 15:06:30 +0000 (16:06 +0100)]
Typo and language fixes for git-checkout.txt

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoconnect.c: remove a few globals by using git_config callback data
Erik Faye-Lund [Wed, 11 Mar 2009 02:38:12 +0000 (02:38 +0000)]
connect.c: remove a few globals by using git_config callback data

Since ef90d6d (Provide git_config with a callback-data parameter,
2008-05-14), git_config() takes a callback data pointer that can be
used to pass extra parameters to the parsing function.  The codepath
to parse configuration variables related to git proxy predates this
facility and used a pair of file scope static variables instead.

This patch removes the need for these global variables by passing the
name of the host we are trying to access as the callback data.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge git://git.bogomips.org/git-svn
Junio C Hamano [Tue, 10 Mar 2009 01:38:18 +0000 (18:38 -0700)]
Merge git://git.bogomips.org/git-svn

* git://git.bogomips.org/git-svn:
  git-svn: support intermediate paths when matching tags/branches

15 years agoparseopt: prevent KEEP_UNKNOWN and STOP_AT_NON_OPTION from being used together
René Scharfe [Mon, 9 Mar 2009 20:57:38 +0000 (21:57 +0100)]
parseopt: prevent KEEP_UNKNOWN and STOP_AT_NON_OPTION from being used together

As suggested by Junio, disallow the flags PARSE_OPT_KEEP_UNKNOWN and
PARSE_OPT_STOP_AT_NON_OPTION to be turned on at the same time, as a
value of an unknown option could be mistakenly classified as a
non-option, stopping the parser early.  E.g.:

git cmd --known --unknown value arg0 arg1

The parser should have stopped at "arg0", but it already stops at
"value".

This patch makes parse_options() die if the two flags are used in
combination.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoparseopt: document KEEP_ARGV0, KEEP_UNKNOWN, NO_INTERNAL_HELP
René Scharfe [Mon, 9 Mar 2009 20:26:56 +0000 (21:26 +0100)]
parseopt: document KEEP_ARGV0, KEEP_UNKNOWN, NO_INTERNAL_HELP

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-svn: support intermediate paths when matching tags/branches
Michael Lai [Mon, 9 Mar 2009 18:45:47 +0000 (11:45 -0700)]
git-svn: support intermediate paths when matching tags/branches

For repositories laid out like the following:

[svn-remote "svn"]
      url = http://foo.com/svn/repos/bar
      fetch = myproject/trunk:refs/remotes/trunk
      branches = bar/myproject/branches/*:refs/remotes/*
      tags = bar/myproject/tags/*:refs/remotes/tags/*

The "bar" component above is considered the intermediate path
and was not handled correctly.

Signed-off-by: Michael Lai <myllai@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
15 years agogrep: cast printf %.*s "precision" argument explicitly to int
Junio C Hamano [Mon, 9 Mar 2009 01:22:44 +0000 (18:22 -0700)]
grep: cast printf %.*s "precision" argument explicitly to int

On some systems, regoff_t that is the type of rm_so/rm_eo members are
wider than int; %.*s precision specifier expects an int, so use an explicit
cast.

A breakage reported on Darwin by Brian Gernhardt should be fixed with
this patch.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMakefile: Set compiler switch for USE_NSEC
Brian Gernhardt [Sun, 8 Mar 2009 21:22:51 +0000 (17:22 -0400)]
Makefile: Set compiler switch for USE_NSEC

The comments indicated that setting a Makefile variable USE_NSEC would
enable the code for sub-second [cm]times.  However, the Makefile
variable was never turned into a compiler switch so the code was never
enabled.  This patch allows USE_NSEC to be noticed by the compiler.

Signed-off-by: Brian Gernhardt <benji@silverinsanity.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoCreate USE_ST_TIMESPEC and turn it on for Darwin
Brian Gernhardt [Sun, 8 Mar 2009 20:04:28 +0000 (16:04 -0400)]
Create USE_ST_TIMESPEC and turn it on for Darwin

Not all OSes use st_ctim and st_mtim in their struct stat.  In
particular, it appears that OS X uses st_*timespec instead.  So add a
Makefile variable and #define called USE_ST_TIMESPEC to switch the
USE_NSEC defines to use st_*timespec.

This also turns it on by default for OS X (Darwin) machines.  Likely
this is a sane default for other BSD kernels as well, but I don't have
any to test that assumption on.

Signed-off-by: Brian Gernhardt <benji@silverinsanity.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoNot all systems use st_[cm]tim field for ns resolution file timestamp
Junio C Hamano [Sun, 8 Mar 2009 20:51:33 +0000 (13:51 -0700)]
Not all systems use st_[cm]tim field for ns resolution file timestamp

Some codepaths do not still use the ST_[CM]TIME_NSEC() pair of macros
introduced by the previous commit but assumes all systems use st_mtim
and st_ctim fields in "struct stat" to record nanosecond resolution part
of the file timestamps.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoarchive: use parseopt for local-only options
René Scharfe [Sun, 8 Mar 2009 18:21:53 +0000 (19:21 +0100)]
archive: use parseopt for local-only options

Replace the hand-rolled parsers that find and remove --remote and --exec
by a parseopt parser that also handles --output.

All three options only have a meaning if no remote server is used or on
the local side.  They must be rejected by upload-archive and should not
be sent to the server by archive.

We can't use a single parser for both remote and local side because the
remote end possibly understands a different set of options than the
local side.  A local parser would then wrongly accuse options valid on
the other side as being incorrect.

This patch implements a very forgiving parser that understands only the
three options mentioned above.  All others are passed to the normal,
complete parser in archive.c (running either locally in archive, or
remotely in upload-archive).  This normal parser definition contains
dummy entries for the three options, in order for them to appear in the
help screen.

The parseopt parser allows multiple occurrences of --remote and --exec
unlike the previous one; the one specified last wins.  This looseness
is acceptable, I think.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoparseopt: make usage optional
René Scharfe [Sun, 8 Mar 2009 18:16:58 +0000 (19:16 +0100)]
parseopt: make usage optional

Allow usagestr to be NULL and don't display any help screen in
this case.  This is useful to implement incremental parsers.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoparseopt: add PARSE_OPT_NO_INTERNAL_HELP
René Scharfe [Sun, 8 Mar 2009 18:15:08 +0000 (19:15 +0100)]
parseopt: add PARSE_OPT_NO_INTERNAL_HELP

Add a parseopt flag, PARSE_OPT_NO_INTERNAL_HELP, that turns off internal
handling of -h, --help and --help-all.  This allows the implementation
of custom help option handlers or incremental parsers.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>