Commit graph

19805 commits

Author SHA1 Message Date
Marius Storm-Olsen 164a5e3faa Add MSVC to Makefile
Enable MSVC builds with GNU Make by simply calling
    make MSVC=1
(Debug build possible by adding DEBUG=1 as well)

Two scripts, clink.pl and lib.pl, are used to convert certain GCC
specific command line options into something MSVC understands.
By building for MSVC with GNU Make, we can ensure that the MSVC
port always follows the latest code, and does not lag behind due
to unmaintained NMake Makefile or IDE projects.

Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-18 20:00:42 -07:00
Marius Storm-Olsen 386ac45102 Define strncasecmp and ftruncate for MSVC
Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-18 20:00:42 -07:00
Marius Storm-Olsen 435bdf8c7f Make usage of windows.h lean and mean
Centralize the include of windows.h in git-compat-util.h, turn on
WIN32_LEAN_AND_MEAN to avoid including plenty of other header files
which is not needed in Git. Also ensure we load winsock2.h first,
so we don't load the older winsock definitions at a later stage,
since they contain duplicate definitions.

When moving windows.h into git-compat-util.h, we need to protect
the definition of struct pollfd in mingw.h, since this file is used
by both MinGW and MSVC, and the latter defines this struct in
winsock2.h.

We need to keep the windows.h include in compat/win32.h, since its
shared by both MinGW and Cygwin, and we're not touching Cygwin in
this commit. The include in git-compat-util.h is protected with an
ifdef WIN32, which is not the case when compiling for Cygwin.

Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-18 20:00:42 -07:00
Frank Li d75f8e6131 Add platform files for porting to MSVC
Add msvc.c and msvc.h to build git under MSVC.

Signed-off-by: Frank Li <lznuaa@gmail.com>
Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-18 20:00:42 -07:00
Frank Li 16fe1e0369 Add MinGW header files to build git with MSVC
Added the header files dirent.h, unistd.h and utime.h
Add alloca.h, which simply includes malloc.h, which defines alloca().

Signed-off-by: Frank Li <lznuaa@gmail.com>
Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-18 20:00:42 -07:00
Marius Storm-Olsen 55fcb06482 Add empty header files for MSVC port
MSVC lacks many of the header files included by git-compat-util.h; add
blank header files for these instead of going ifdef crazy.

Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-18 20:00:42 -07:00
Frank Li 71064e3f86 Test for WIN32 instead of __MINGW32_
The code which is conditional on MinGW32 is actually conditional on Windows.
Use the WIN32 symbol, which is defined by the MINGW32 and MSVC environments,
but not by Cygwin.

Define SNPRINTF_SIZE_CORR=1 for MSVC too, as its vsnprintf function does
not add NUL at the end of the buffer if the result fits the buffer size
exactly.

Signed-off-by: Frank Li <lznuaa@gmail.com>
Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-18 20:00:42 -07:00
Frank Li d7fa500fb5 Fix __stdcall placement and function prototype
MSVC requires __stdcall to be between the functions return value and the
function name, and that the function pointer type is in the form of

    return_type (WINAPI *function_name)(arguments...)

Signed-off-by: Frank Li <lznuaa@gmail.com>
Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-18 20:00:42 -07:00
Marius Storm-Olsen a6ca8c6246 Set _O_BINARY as default fmode for both MinGW and MSVC
MinGW set the _CRT_fmode to set both the default fmode and _O_BINARY on
stdin/stdout/stderr. Rather use the main() define in mingw.h to set this
for both MinGW and MSVC.

This will ensure that a MinGW and MSVC build will handle input and output
identically.

Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-18 20:00:42 -07:00
Frank Li 3f83bf3784 Change regerror() declaration from K&R style to ANSI C (C89)
The MSVC headers typedef errcode as int, and thus confused the compiler in
the K&R style definition. ANSI style deconfuses it.

Signed-off-by: Frank Li <lznuaa@gmail.com>
Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-18 20:00:42 -07:00
Marius Storm-Olsen 627735f9bf Add include guards to compat/win32.h
Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-18 20:00:42 -07:00
Frank Li 0d30ad71fa Avoid declaration after statement
MSVC does not understand this C99 style.

Signed-off-by: Frank Li <lznuaa@gmail.com>
Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-18 20:00:41 -07:00
Thiago Farina 812bdbc31b pack-objects: remove SP at the end of usage string
These spaces immediately before the end of lines are unnecessary.

While at it, instead of using a single string literal with backslashes
at end of each line, split the lines into individual string literals
and tell the compiler to concatenate them.

Signed-off-by: Thiago Farina <tfransosi@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-18 19:48:48 -07:00
Thiago Farina 1f986c4ac4 Update the usage bundle string.
"git bundle -h" gives a single long line that is hard to read.  Rewrite it
into a multi-line format similar to the one used by other commands, e.g
"git stash -h".

Signed-off-by: Thiago Farina <tfransosi@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-18 19:47:15 -07:00
Clemens Buchacher e481b1d8db cvs: initialize empty password
If we do not read a password from the command line, and there are no
passwords stored in .cvspass, we have to initialize the password with
just "A".

This fixes a regression introduced by 3fb9d582 (Do not scramble
password read from .cvspass).

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-17 00:38:49 -07:00
Junio C Hamano 8426f672fc Merge 1.6.4.4 in
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-16 15:04:21 -07:00
Junio C Hamano cb572206d9 GIT 1.6.4.4
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-16 14:53:26 -07:00
Junio C Hamano af4f640529 Merge branch 'jc/maint-unpack-objects-strict' into maint
* jc/maint-unpack-objects-strict:
  Fix "unpack-objects --strict"

Conflicts:
	builtin-unpack-objects.c
2009-09-16 14:45:18 -07:00
Junio C Hamano 6674d310d1 Merge branch 'tf/diff-whitespace-incomplete-line' into maint
* tf/diff-whitespace-incomplete-line:
  xutils: Fix xdl_recmatch() on incomplete lines
  xutils: Fix hashing an incomplete line with whitespaces at the end
2009-09-16 14:27:08 -07:00
Junio C Hamano bd91890c62 Merge branch 'jk/maint-1.6.3-checkout-unborn' into maint
* jk/maint-1.6.3-checkout-unborn:
  checkout: do not imply "-f" on unborn branches
2009-09-16 14:26:56 -07:00
Junio C Hamano bba287531b Merge branch 'jc/maint-checkout-index-to-prefix' into maint
* jc/maint-checkout-index-to-prefix:
  check_path(): allow symlinked directories to checkout-index --prefix
2009-09-16 14:26:40 -07:00
Junio C Hamano 2b621c1a3a Merge branch 'maint'
* maint:
  http.c: avoid freeing an uninitialized pointer
2009-09-14 14:48:27 -07:00
Junio C Hamano 4197ce3c6d Merge branch 'rc/maint-http-no-head-pack-check' into maint
* rc/maint-http-no-head-pack-check:
  http.c: avoid freeing an uninitialized pointer
2009-09-14 14:48:20 -07:00
Junio C Hamano b2025146d0 http.c: avoid freeing an uninitialized pointer
An earlier 59b8d38 (http.c: remove verification of remote packs) left
the variable "url" uninitialized; "goto cleanup" codepath can free it
which is not very nice.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-14 14:48:15 -07:00
Heiko Voigt 20f34902d1 web--browse: fix Mac OS X GUI detection for 10.6
Since OS X 10.6 the variable $SECURITYSESSIONID does not exist anymore,
so lets look for the $TERM_PROGRAM variable as backup.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-14 02:27:25 -07:00
Heiko Voigt 39c448c19d remove logical typo in documentation of sample update hook
Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-14 02:23:49 -07:00
Nicolas Pitre 03aa8ff3be Nicolas Pitre has a new email address
Due to problems at cam.org, my nico@cam.org email address is no longer
valid.  From now on, nico@fluxnic.net should be used instead.

Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-14 02:23:36 -07:00
Dmitry Potapov 0f4b377c20 git-archive: infer output format from filename when unspecified
A command line

    $ git archive -o my-v2.0.zip v2.0

almost certainly wants the output in zip format, even though it does not
specify any --format option.

When --format is not given, but output filename is, try to infer what
format is requested from the filename extension.  Currently this code only
knows about '.zip'.  When the format is unspecified and the filename does
not tell us, the output will be in 'tar' format as before.

Of course, an explicit --format will not trigger this guesswork.

Signed-off-by: Dmitry Potapov <dpotapov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-13 13:54:39 -07:00
Todd Zullinger 518ef8f07f completion: Replace config --list with --get-regexp
James Bardin noted that the completion spewed warnings when no git config
file is present.  This is likely a bug to be fixed in git config, but it's
also good to simplify the completion code by using the --get-regexp option
as Jeff King pointed out.

Signed-off-by: Todd Zullinger <tmz@pobox.com>
Trivially-acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-13 13:40:25 -07:00
Dmitry Potapov 05d3951ec9 git-archive: add '-o' as a alias for '--output'
The '-o' option is commonly used in many tools to specify the output file.
Typing '--output' every time is a bit too long to be a practical alternative
to redirecting output. But specifying the output name has the advantage of
making possible to guess the desired output format by filename extension.

Signed-off-by: Dmitry Potapov <dpotapov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-13 13:23:40 -07:00
Clemens Buchacher 98df233e2d test local clone by copying
Test the effect of an earlier change by f7835a2 (preserve mtime of local
clone, 2009-09-12) to keep stale loose object files stale in the new
repository when a local clone is made by copying files in .git/
directory.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-13 13:22:29 -07:00
Johannes Gilger 65d15ed992 git-clone doc: typofix
Signed-off-by: Johannes Gilger <heipei@hackvalue.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-13 11:58:54 -07:00
Nelson Elhage 9f67fee2f0 git-push: Accept -n as a synonym for --dry-run.
git-push is not currently using -n for anything else, and it seems
unlikely we will want to use it to mean anything else in the future,
so add it as an alias for convenience.

Signed-off-by: Nelson Elhage <nelhage@mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-13 11:29:18 -07:00
Junio C Hamano 12efe45a33 git-commit doc: remove duplicated --dry-run description
60c2993 (Documentation/git-commit.txt: describe --dry-run, 2009-08-15)
wanted to update the documentation to say that "git status" is not the
same as "git commit --dry-run" anymore, but it screwed up and also added
the description of --dry-run that was already present.

Noticed by Johannes Gilger.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-13 11:24:26 -07:00
Junio C Hamano eaf1c941bb GIT 1.6.5-rc1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-13 01:50:33 -07:00
Jari Aalto 5f2b1e67ca Improve --patch option documentation in git-add
Signed-off-by: Jari Aalto <jari.aalto@cante.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-13 01:36:13 -07:00
Junio C Hamano 4a452ede39 Merge branch 'pk/fast-import-tars'
* pk/fast-import-tars:
  import-tars: Allow per-tar author and commit message.
2009-09-13 01:33:29 -07:00
Junio C Hamano d821c003f8 Merge branch 'pk/fast-import-dirs'
* pk/fast-import-dirs:
  Add script for importing bits-and-pieces to Git.
2009-09-13 01:33:26 -07:00
Junio C Hamano 79cb645f9a Merge branch 'jt/pushinsteadof'
* jt/pushinsteadof:
  Add url.<base>.pushInsteadOf: URL rewriting for push only
  Wrap rewrite globals in a struct in preparation for adding another set
2009-09-13 01:33:20 -07:00
Junio C Hamano dc1b0c06ee Merge branch 'jk/unwanted-advices'
* jk/unwanted-advices:
  status: make "how to stage" messages optional
  push: make non-fast-forward help message configurable
2009-09-13 01:33:18 -07:00
Junio C Hamano 8b54f63dce Merge branch 'jc/merge-saner-messages'
* jc/merge-saner-messages:
  merge-recursive: give less scary messages when merge did not start
2009-09-13 01:33:15 -07:00
Junio C Hamano 1cdd64e800 quiltimport documentation: --dry-run and -n are synonyms
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-13 01:32:49 -07:00
Clemens Buchacher f7835a251c preserve mtime of local clone
A local clone without hardlinks copies all objects, including dangling
ones, to the new repository. Since the mtimes are renewed, those
dangling objects cannot be pruned by "git gc --prune", even if they
would have been old enough for pruning in the original repository.

Instead, preserve mtime during copy. "git gc --prune" will then work
in the clone just like it did in the original.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-13 01:32:26 -07:00
Jim Meyering 41698375ad don't dereference NULL upon fdopen failure
There were several unchecked use of fdopen(); replace them with xfdopen()
that checks and dies.

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-13 01:32:20 -07:00
Jim Meyering 3d913526b1 use write_str_in_full helper to avoid literal string lengths
This is the same fix to use write_str_in_full() helper to write a constant
string out without counting the length of it ourselves.

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-13 01:32:04 -07:00
Junio C Hamano cd03eebbfd Merge branch 'db/vcs-helper'
* db/vcs-helper:
  Makefile: remove remnant of separate http/https/ftp helpers
  Use a clearer style to issue commands to remote helpers
  Make the "traditionally-supported" URLs a special case
  Makefile: install hardlinks for git-remote-<scheme> supported by libcurl if possible
  Makefile: do not link three copies of git-remote-* programs
  Makefile: git-http-fetch does not need expat
  http-fetch: Fix Makefile dependancies
  Add transport native helper executables to .gitignore
  git-http-fetch: not a builtin
  Use an external program to implement fetching with curl
  Add support for external programs for handling native fetches
2009-09-13 01:31:55 -07:00
Jim Meyering 2b7ca830c6 use write_str_in_full helper to avoid literal string lengths
In 2d14d65 (Use a clearer style to issue commands to remote helpers,
2009-09-03) I happened to notice two changes like this:

-	write_in_full(helper->in, "list\n", 5);
+
+	strbuf_addstr(&buf, "list\n");
+	write_in_full(helper->in, buf.buf, buf.len);
+	strbuf_reset(&buf);

IMHO, it would be better to define a new function,

    static inline ssize_t write_str_in_full(int fd, const char *str)
    {
           return write_in_full(fd, str, strlen(str));
    }

and then use it like this:

-       strbuf_addstr(&buf, "list\n");
-       write_in_full(helper->in, buf.buf, buf.len);
-       strbuf_reset(&buf);
+       write_str_in_full(helper->in, "list\n");

Thus not requiring the added allocation, and still avoiding
the maintenance risk of literal string lengths.
These days, compilers are good enough that strlen("literal")
imposes no run-time cost.

Transformed via this:

    perl -pi -e \
        's/write_in_full\((.*?), (".*?"), \d+\)/write_str_in_full($1, $2)/'\
      $(git grep -l 'write_in_full.*"')

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-13 01:31:10 -07:00
Matthieu Moy 511a3fc116 wrap git's main usage string.
It's now similar wrapped the same way as in Documentation/git.txt, and
fits in a 67 characters wide terminal.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-13 01:31:02 -07:00
Junio C Hamano 5b590d783a Merge branch 'maint'
* maint:
  GIT 1.6.4.3
  svn: properly escape arguments for authors-prog
  http.c: remove verification of remote packs
  grep: accept relative paths outside current working directory
  grep: fix exit status if external_grep() punts

Conflicts:
	GIT-VERSION-GEN
	RelNotes
2009-09-13 01:30:53 -07:00
Junio C Hamano 7fb6bcff2d GIT 1.6.4.3
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-13 01:28:13 -07:00