Code

git.git
15 years agoWindows: Make 'git help -a' work.
Johannes Sixt [Mon, 14 Jan 2008 13:05:33 +0000 (14:05 +0100)]
Windows: Make 'git help -a' work.

git help -a scans the PATH for git commands. On Windows it failed for two
reasons:

- The PATH separator is ';', not ':' on Windows.

- stat() does not set the executable bit.

We now open the file and guess whether it is executable.

The result of the guess is good enough for the list of git commands, but
it is of no use for a general stat() implementation because (1) it is a
guess, (2) the user has no way to influence the outcome (via chmod or
similar), and (3) it would reduce stat() performance by an unacceptable
amount. Therefore, this strategy is a special-case local to help.c.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
15 years agoWindows: Work around an oddity when a pipe with no reader is written to.
Johannes Sixt [Fri, 17 Aug 2007 16:40:36 +0000 (18:40 +0200)]
Windows: Work around an oddity when a pipe with no reader is written to.

On Windows, write() is implemented using WriteFile(). After the reader
closed its end of the pipe, the first WriteFile() returns
ERROR_BROKEN_PIPE (which translates to EPIPE), subsequent WriteFile()s
return ERROR_NO_DATA, which is translated to EINVAL.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
15 years agoWindows: Make the pager work.
Johannes Sixt [Sat, 8 Dec 2007 20:28:41 +0000 (21:28 +0100)]
Windows: Make the pager work.

Since we have neither fork() nor exec(), we have to spawn the pager and
feed it with the program's output.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
15 years agoWhen installing, be prepared that template_dir may be relative.
Johannes Sixt [Tue, 1 Jan 2008 21:15:21 +0000 (22:15 +0100)]
When installing, be prepared that template_dir may be relative.

Since the Makefile in the template/ subdirectory is only used to install
the templates, we do not simply pass down the setting of template_dir
when it is relative, but construct the intended destination in a new
variable: A relative template_dir is relative to gitexecdir.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
15 years agoWindows: Use a relative default template_dir and ETC_GITCONFIG
Johannes Sixt [Fri, 30 Nov 2007 21:28:38 +0000 (22:28 +0100)]
Windows: Use a relative default template_dir and ETC_GITCONFIG

With this definition the templates and system config file will be found
irrespective of the installation location.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
15 years agoWindows: Compute the fallback for exec_path from the program invocation.
Johannes Sixt [Wed, 11 Apr 2007 14:02:45 +0000 (16:02 +0200)]
Windows: Compute the fallback for exec_path from the program invocation.

Since on Windows the user is fairly free where to install programs, we
cannot rely on a hard-coded path. We use the program name to derive the
installation directory and use that as exec_path.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
15 years agoTurn builtin_exec_path into a function.
Johannes Sixt [Wed, 11 Apr 2007 13:26:08 +0000 (15:26 +0200)]
Turn builtin_exec_path into a function.

builtin_exec_path returns the hard-coded installation path, which is used
as the ultimate fallback to look for git commands. Making it into a function
enables us in a follow-up patch to return a computed value instead of just
a constant string.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
15 years agoWindows: Use a customized struct stat that also has the st_blocks member.
Johannes Sixt [Mon, 12 Nov 2007 11:52:41 +0000 (12:52 +0100)]
Windows: Use a customized struct stat that also has the st_blocks member.

Windows's struct stat does not have a st_blocks member. Since we already
have our own stat/lstat/fstat implementations, we can just as well use
a customized struct stat. This patch introduces just that, and also fills
in the st_blocks member. On the other hand, we don't provide members that
are never used.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
15 years agoWindows: Add a custom implementation for utime().
Johannes Sixt [Fri, 7 Sep 2007 11:05:00 +0000 (13:05 +0200)]
Windows: Add a custom implementation for utime().

This is a necessary pendant to our lstat implementation: MSVCRT's
implementations of lstat and utime do some adjustments if daylight
saving time is in effect, but our lstat implementation doesn't do these
adjustments and report the correct UTC time.  With this implementation
we omit the adjustments in utime() as well and always write UTC.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
15 years agoWindows: Add a new lstat and fstat implementation based on Win32 API.
Marius Storm-Olsen [Mon, 3 Sep 2007 18:40:26 +0000 (20:40 +0200)]
Windows: Add a new lstat and fstat implementation based on Win32 API.

This gives us a significant speedup when adding, committing and stat'ing files.
Also, since Windows doesn't really handle symlinks, we let stat just uses lstat.
We also need to replace fstat, since our implementation and the standard stat()
functions report slightly different timestamps, possibly due to timezones.

We simply report UTC in our implementation, and do our FILETIME to time_t
conversion based on the document at http://support.microsoft.com/kb/167296.

With Moe's repo structure (100K files in 100 dirs, containing 2-4 bytes)
    mkdir bummer && cd bummer; for ((i=0;i<100;i++)); do
      mkdir $i && pushd $i;
        for ((j=0;j<1000;j++)); do echo "$j" >$j; done;
      popd;
    done

We get the following performance boost:

    With normal lstat & stat  Custom lstat/fstat
    ------------------------  ------------------------
    Command: git init         Command: git init
    ------------------------  ------------------------
    real    0m 0.047s          real   0m 0.063s
    user    0m 0.031s          user   0m 0.015s
    sys     0m 0.000s          sys    0m 0.015s
    ------------------------  ------------------------
    Command: git add .        Command: git add .
    ------------------------  ------------------------
    real    0m19.390s         real    0m12.031s       1.6x
    user    0m 0.015s         user    0m 0.031s
    sys     0m 0.030s         sys     0m 0.000s
    ------------------------  ------------------------
    Command: git commit -a..  Command: git commit -a..
    ------------------------  ------------------------
    real    0m30.812s         real    0m16.875s       1.8x
    user    0m 0.015s         user    0m 0.015s
    sys     0m 0.000s         sys     0m 0.015s
    ------------------------  ------------------------
    3x Command: git-status    3x Command: git-status
    ------------------------  ------------------------
    real    0m11.860s         real    0m 5.266s       2.2x
    user    0m 0.015s         user    0m 0.015s
    sys     0m 0.015s         sys     0m 0.015s

    real    0m11.703s         real    0m 5.234s
    user    0m 0.015s         user    0m 0.015s
    sys     0m 0.000s         sys     0m 0.000s

    real    0m11.672s         real    0m 5.250s
    user    0m 0.031s         user    0m 0.015s
    sys     0m 0.000s         sys     0m 0.000s
    ------------------------  ------------------------
    Command: git commit...    Command: git commit...
    (single file)             (single file)
    ------------------------  ------------------------
    real    0m14.234s         real    0m 7.735s       1.8x
    user    0m 0.015s         user    0m 0.031s
    sys     0m 0.000s         sys     0m 0.000s

Signed-off-by: Marius Storm-Olsen <mstormo_git@storm-olsen.com>
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
15 years agoWindows: Implement a custom spawnve().
Johannes Sixt [Sat, 24 Nov 2007 21:49:16 +0000 (22:49 +0100)]
Windows: Implement a custom spawnve().

The problem with Windows's own implementation is that it tries to be
clever when a console program is invoked from a GUI application: In this
case it sometimes automatically allocates a new console window. As a
consequence, the IO channels of the spawned program are directed to the
console, but the invoking application listens on channels that are now
directed to nowhere.

In this implementation we use the lowlevel facilities of CreateProcess(),
which offers a flag to tell the system not to open a console. As a side
effect, only stdin, stdout, and stderr channels will be accessible from
C programs that are spawned. Other channels (file handles, pipe handles,
etc.) are still inherited by the spawned program, but it doesn't get
enough information to access them.

Johannes Schindelin integrated path quoting and unified the various
*execv* and *spawnv* helpers. Eric Raible suggested to also quote '{'.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
15 years agoWindows: Implement wrappers for gethostbyname(), socket(), and connect().
Johannes Sixt [Wed, 26 Dec 2007 12:51:18 +0000 (13:51 +0100)]
Windows: Implement wrappers for gethostbyname(), socket(), and connect().

gethostbyname() is the first function that calls into the Winsock library,
and it is wrapped only to initialize the library.

socket() is wrapped for two reasons:
- Windows's socket() creates things that are like low-level file handles,
  and they must be converted into file descriptors first.
- And these handles cannot be used with plain ReadFile()/WriteFile()
  because they are opened for "overlapped IO". We have to use WSASocket()
  to create non-overlapped IO sockets.

connect() must be wrapped because Windows's connect() expects the low-level
sockets, not file descriptors, and we must first unwrap the file descriptor
before we can pass it on to Windows's connect().

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
15 years agoWindows: Work around incompatible sort and find.
Johannes Sixt [Fri, 30 Nov 2007 21:06:30 +0000 (22:06 +0100)]
Windows: Work around incompatible sort and find.

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 <johannes.sixt@telecom.at>
15 years agoWindows: Implement asynchronous functions as threads.
Johannes Sixt [Sat, 8 Dec 2007 21:19:14 +0000 (22:19 +0100)]
Windows: Implement asynchronous functions as threads.

In upload-pack we must explicitly close the output channel of rev-list.
(On Unix, the channel is closed automatically because process that runs
rev-list terminates.)

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
15 years agoWindows: Disambiguate DOS style paths from SSH URLs.
Johannes Sixt [Fri, 30 Nov 2007 21:51:10 +0000 (22:51 +0100)]
Windows: Disambiguate DOS style paths from SSH URLs.

If on Windows a path is specified as C:/path, then this is also a valid
SSH URL. To disambiguate between the two interpretations we take an URL
that looks like a path with a drive letter as a local URL.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
15 years agoWindows: A rudimentary poll() emulation.
Johannes Sixt [Sat, 1 Dec 2007 21:00:56 +0000 (22:00 +0100)]
Windows: A rudimentary poll() emulation.

This emulation of poll() is by far not general. It assumes that the
fds that are to be waited for are connected to pipes. The pipes are
polled in a loop until data becomes available in at least one of them.
If only a single fd is waited for, the implementation actually does
not wait at all, but assumes that a subsequent read() will block.

In order not to needlessly burn CPU time, the CPU is yielded to other
processes before the next round in the poll loop using Sleep(0). Note that
any sleep timeout greater than zero will reduce the efficiency by a
magnitude.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
16 years agoWindows: Implement start_command().
Johannes Sixt [Fri, 7 Dec 2007 21:08:59 +0000 (22:08 +0100)]
Windows: Implement start_command().

On Windows, we have spawnv() variants to run a child process instead of
fork()/exec(). In order to attach pipe ends to stdin, stdout, and stderr,
we have to use this idiom:

    save1 = dup(1);
    dup2(pipe[1], 1);
    spawnv();
    dup2(save1, 1);
    close(pipe[1]);

assuming that the descriptors created by pipe() are not inheritable.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
16 years agoWindows: A pipe() replacement whose ends are not inherited to children.
Johannes Sixt [Fri, 7 Dec 2007 21:05:36 +0000 (22:05 +0100)]
Windows: A pipe() replacement whose ends are not inherited to children.

On Unix the idiom to use a pipe is as follows:

    pipe(fd);
    pid = fork();
    if (!pid) {
        dup2(fd[1], 1);
        close(fd[1]);
        close(fd[0]);
        ...
     }
     close(fd[1]);

i.e. the child process closes the both pipe ends after duplicating one
to the file descriptors where they are needed.

On Windows, which does not have fork(), we never have an opportunity to
(1) duplicate a pipe end in the child, (2) close unused pipe ends. Instead,
we must use this idiom:

    save1 = dup(1);
    pipe(fd);
    dup2(fd[1], 1);
    spawn(...);
    dup2(save1, 1);
    close(fd[1]);

i.e. save away the descriptor at the destination slot, replace by the pipe
end, spawn process, restore the saved file.

But there is a problem: Notice that the child did not only inherit the
dup2()ed descriptor, but also *both* original pipe ends. Although the one
end that was dup()ed could be closed before the spawn(), we cannot close
the other end - the child inherits it, no matter what.

The solution is to generate non-inheritable pipes. At the first glance,
this looks strange: The purpose of pipes is usually to be inherited to
child processes. But notice that in the course of actions as outlined
above, the pipe descriptor that we want to inherit to the child is
dup2()ed, and as it so happens, Windows's dup2() creates inheritable
duplicates.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
16 years agoWindows: Wrap execve so that shell scripts can be invoked.
Johannes Sixt [Tue, 4 Dec 2007 11:38:32 +0000 (12:38 +0100)]
Windows: Wrap execve so that shell scripts can be invoked.

When an external git command is invoked, it can be a Bourne shell script.
This patch looks into the command file to see whether it is one.
In this case, the command line is rearranged to invoke the shell
with the proper arguments.

With this change, scripted git commands work. Command line arguments
to those scripts cannot be complex (contain spaces or double-quotes), yet.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
16 years agoWindows: Implement setitimer() and sigaction().
Johannes Sixt [Tue, 13 Nov 2007 09:14:45 +0000 (10:14 +0100)]
Windows: Implement setitimer() and sigaction().

The timer is implemented using a thread that calls the signal handler
at regular intervals.

We also replace Windows's signal() function because we must intercept
that SIGALRM is set (which is used when a timer is canceled).

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
16 years agoWindows: Fix PRIuMAX definition.
Johannes Sixt [Fri, 23 Mar 2007 09:57:05 +0000 (10:57 +0100)]
Windows: Fix PRIuMAX definition.

Since GIT calls into Microsoft's MSVCRT.DLL, it must use the printf
format that this DLL uses for 64-bit integers, which is %I64u instead
of %llu.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
16 years agoWindows: Implement gettimeofday().
Johannes Sixt [Sat, 1 Dec 2007 20:51:20 +0000 (21:51 +0100)]
Windows: Implement gettimeofday().

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
16 years agoMake my_mktime() public and rename it to tm_to_time_t()
Johannes Sixt [Mon, 23 Jun 2008 06:31:41 +0000 (08:31 +0200)]
Make my_mktime() public and rename it to tm_to_time_t()

We will use it from the MinGW port's gettimeofday() substitution.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
16 years agoWindows: Work around misbehaved rename().
Johannes Sixt [Fri, 7 Dec 2007 21:19:40 +0000 (22:19 +0100)]
Windows: Work around misbehaved rename().

Windows's rename() is based on the MoveFile() API, which fails if the
destination exists. Here we work around the problem by using MoveFileEx().
Furthermore, the posixly correct error is returned if the destination is
a directory.

The implementation is still slightly incomplete, however, because of the
missing error code translation: We assume that the failure is due to
permissions.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
16 years agoWindows: always chmod(, 0666) before unlink().
Johannes Schindelin [Tue, 23 Jan 2007 12:39:09 +0000 (13:39 +0100)]
Windows: always chmod(, 0666) before unlink().

On Windows, read-only files cannot be deleted. To make sure that
deletion does not fail because of this, always call chmod() before
unlink().

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
16 years agoWindows: A minimal implemention of getpwuid().
Johannes Sixt [Sat, 1 Dec 2007 21:09:17 +0000 (22:09 +0100)]
Windows: A minimal implemention of getpwuid().

getpwuid() is implemented just enough that GIT does not issue errors.
Since the information that it returns is not very useful, users are
required to set up user.name and user.email configuration.

All uses of getpwuid() are like getpwuid(getuid()), hence, the return value
of getuid() is irrelevant and the uid parameter is not even looked at.

Side note: getpwnam() is only used to resolve '~' and '~username' paths,
which is an idiom not known on Windows, hence, we don't implement it.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
16 years agoWindows: Implement a wrapper of the open() function.
Johannes Sixt [Thu, 15 Nov 2007 21:22:47 +0000 (22:22 +0100)]
Windows: Implement a wrapper of the open() function.

The wrapper does two things:
- Requests to open /dev/null are redirected to open the nul pseudo file.
- A request to open a file that currently exists as a directory on
  Windows fails with EACCES; this is changed to EISDIR.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
16 years agoWindows: Strip ".exe" from the program name.
Johannes Sixt [Sat, 8 Dec 2007 19:57:25 +0000 (20:57 +0100)]
Windows: Strip ".exe" from the program name.

Before we can successfully parse a builtin command from the program name
we must strip off unneeded parts, that is, the file extension.

Furthermore, we must take Windows style path names into account when we
parse the program name.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
16 years agoWindows: Handle absolute paths in safe_create_leading_directories().
Johannes Sixt [Fri, 30 Nov 2007 20:36:00 +0000 (21:36 +0100)]
Windows: Handle absolute paths in safe_create_leading_directories().

In this function we must be careful to handle drive-local paths else there
is a danger that it runs into an infinite loop.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
16 years agoWindows: Treat Windows style path names.
Johannes Sixt [Wed, 5 Mar 2008 20:51:27 +0000 (21:51 +0100)]
Windows: Treat Windows style path names.

GIT's guts work with a forward slash as a path separators. We do not change
that. Rather we make sure that only "normalized" paths enter the depths
of the machinery.

We have to translate backslashes to forward slashes in the prefix and in
command line arguments. Fortunately, all of them are passed through
functions in setup.c.

A macro has_dos_drive_path() is defined that checks whether a path begins
with a drive letter+colon combination. This predicate is always false on
Unix. Another macro is_dir_sep() abstracts that a backslash is also a
directory separator on Windows.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
16 years agosetup.c: Prepare for Windows directory separators.
Johannes Sixt [Sat, 1 Mar 2008 20:11:14 +0000 (21:11 +0100)]
setup.c: Prepare for Windows directory separators.

This turns two switch/case statements into an if-else-if cascade because
we later do not want to have

        case '/':
    #ifdef __MINGW32__
        case '\\':
    #endif

but use a predicate is_dir_sep(foo) in order to check for the directory
separator.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
16 years agoWindows: Use the Windows style PATH separator ';'.
Johannes Sixt [Mon, 3 Dec 2007 20:55:57 +0000 (21:55 +0100)]
Windows: Use the Windows style PATH separator ';'.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
16 years agoAdd target architecture MinGW.
Johannes Sixt [Sat, 1 Dec 2007 20:24:59 +0000 (21:24 +0100)]
Add target architecture MinGW.

With this change GIT can be compiled and linked using MinGW. Builtins
that only read the repository such as the log family and grep already
work.

Simple stubs are provided for a number of functions that the Windows C
runtime does not offer. They will be completed in later patches.
However, a fix for the snprintf/vsnprintf replacement is applied here
to avoid buffer overflows.

Dmitry Kakurin pointed out that access(..., X_OK) would always fails on
Vista and suggested the -D__USE_MINGW_ACCESS workaround.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
16 years agoCompile some programs only conditionally.
Johannes Sixt [Sat, 1 Dec 2007 10:10:54 +0000 (11:10 +0100)]
Compile some programs only conditionally.

These programs depend on difficult to emulate POSIX functionality.
On Windows, we won't compile them.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
16 years agoAdd compat/regex.[ch] and compat/fnmatch.[ch].
Johannes Sixt [Sun, 9 Dec 2007 14:43:34 +0000 (15:43 +0100)]
Add compat/regex.[ch] and compat/fnmatch.[ch].

We don't have fnmatch and regular expressions on Windows. We borrow
fnmatch.[ch] from the GNU C library (license is LGPL 2 or later) and
GNU regexp (regexp.c[ch], license is GPL 2 or later). Note that regexp.c
was changed slightly to avoid warnings with gcc.

We make the addition of these files an extra commit so as not to clutter
the next commits.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
16 years agoGIT 1.5.6 v1.5.6
Junio C Hamano [Wed, 18 Jun 2008 20:09:43 +0000 (13:09 -0700)]
GIT 1.5.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoclean up error conventions of remote.c:match_explicit
Jeff King [Mon, 16 Jun 2008 16:15:02 +0000 (12:15 -0400)]
clean up error conventions of remote.c:match_explicit

match_explicit is called for each push refspec to try to
fully resolve the source and destination sides of the
refspec.  Currently, we look at each refspec and report
errors on both the source and the dest side before aborting.

It makes sense to report errors for each refspec, since an
error in one is independent of an error in the other.
However, reporting errors on the 'dst' side of a refspec if
there has been an error on the 'src' side does not
necessarily make sense, since the interpretation of the
'dst' side depends on the 'src' side (for example, when
creating a new unqualified remote ref, we use the same type
as the src ref).

This patch lets match_explicit return early when the src
side of the refspec is bogus. We still look at all of the
refspecs before aborting the push, though.

At the same time, we clean up the call signature, which
previously took an extra "errs" flag. This was pointless, as
we didn't act on that flag, but rather just passed it back
to the caller. Instead, we now use the more traditional
"return -1" to signal an error, and the caller aggregates
the error count.

This change fixes two bugs, as well:

  - the early return avoids a segfault when passing a NULL
    matched_src to guess_ref()

  - the check for multiple sources pointing to a single dest
    aborted if the "err" flag was set. Presumably the intent
    was not to bother with the check if we had no
    matched_src. However, since the err flag was passed in
    from the caller, we might abort the check just because a
    previous refspec had a problem, which doesn't make
    sense.

    In practice, this didn't matter, since due to the error
    flag we end up aborting the push anyway.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFix approxidate("never") to always return 0
Olivier Marin [Tue, 17 Jun 2008 16:34:57 +0000 (18:34 +0200)]
Fix approxidate("never") to always return 0

Commit af66366a9feb0194ed04b1f538998021ece268a8 introduced the keyword
"never" to be used with approxidate() but defined it with a fixed date
without taking care of timezone. As a result approxidate() will return
a timestamp in the future with a negative timezone.

With this patch, approxidate("never") always return 0 whatever your
timezone is.

Signed-off-by: Olivier Marin <dkr@freesurf.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-am: head -1 is obsolete and doesn't work on some new systems
Alejandro Mery [Tue, 17 Jun 2008 11:43:57 +0000 (13:43 +0200)]
git-am: head -1 is obsolete and doesn't work on some new systems

head -<n> was deprecated by POSIX, and as modern versions of coreutils
package don't support it at least one exports _POSIX2_VERSION=199209
it's fails on some systems.

head -n<n> is portable, but sed <n>q is even more.

Signed-off-by: Alejandro Mery <amery@geeks.cl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agobuiltin-rerere: fix a small leak
Junio C Hamano [Tue, 17 Jun 2008 07:23:31 +0000 (00:23 -0700)]
builtin-rerere: fix a small leak

The data read from MERGE_RR file is kept in path-list by hanging textual
40-byte conflict signature to path of the blob that contains the
conflict.  The signature is strdup'ed twice, and the second copy is given
to the path-list, leaking the first copy.

Signed-off-by: Junio C Hamano <junio@pobox.com>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
16 years agogitweb: remove unused parse_ref method
Lea Wiemann [Tue, 17 Jun 2008 06:25:28 +0000 (08:25 +0200)]
gitweb: remove unused parse_ref method

The parse_ref method became unused in cd1464083c, but the author
decided to leave it in.  Now it gets in the way of refactoring, so
let's remove it.

Signed-off-by: Lea Wiemann <LeWiemann@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogitweb: quote commands properly when calling the shell
Lea Wiemann [Tue, 17 Jun 2008 21:46:35 +0000 (23:46 +0200)]
gitweb: quote commands properly when calling the shell

This eliminates the function git_cmd_str, which was used for composing
command lines, and adds a quote_command function, which quotes all of
its arguments (as in quote.c).

Signed-off-by: Lea Wiemann <LeWiemann@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agosha1_file.c: simplify parse_pack_index()
Junio C Hamano [Tue, 17 Jun 2008 05:19:00 +0000 (22:19 -0700)]
sha1_file.c: simplify parse_pack_index()

It was implemented as a thin wrapper around an otherwise unused
helper function parse_pack_index_file().  The code becomes simpler
and easier to read by consolidating the two.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agocreate_tempfile: make sure that leading directories can be accessible by peers
Junio C Hamano [Tue, 17 Jun 2008 05:02:12 +0000 (22:02 -0700)]
create_tempfile: make sure that leading directories can be accessible by peers

In a shared repository, we should make sure adjust_shared_perm() is called
after creating the initial fan-out directories under objects/ directory.

Earlier an logico called the function only when mkdir() failed; we should
do so when mkdir() succeeded.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agowrite_loose_object: don't bother trying to read an old object
Linus Torvalds [Tue, 17 Jun 2008 00:17:10 +0000 (17:17 -0700)]
write_loose_object: don't bother trying to read an old object

Before even calling this, all callers have done a "has_sha1_file(sha1)"
or "has_loose_object(sha1)" check, so there is no point in doing a
second check.

If something races with us on object creation, we handle that in the
final link() that moves it to the right place.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agopath-list documentation: document all functions and data structures
Miklos Vajna [Sun, 15 Jun 2008 12:06:43 +0000 (14:06 +0200)]
path-list documentation: document all functions and data structures

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agorun-command documentation: fix "memset()" parameter
Miklos Vajna [Sat, 14 Jun 2008 01:01:59 +0000 (03:01 +0200)]
run-command documentation: fix "memset()" parameter

When initializing the struct async and struct child_process structures,
the documentation suggested "clearing" the structure with '0' instead of
'\0'.  It is enough to use integer zero here.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'maint'
Junio C Hamano [Tue, 17 Jun 2008 00:39:50 +0000 (17:39 -0700)]
Merge branch 'maint'

* maint:
  diff.c: fix emit_line() again not to add extra line

16 years agodiff.c: fix emit_line() again not to add extra line
Junio C Hamano [Tue, 17 Jun 2008 00:37:21 +0000 (17:37 -0700)]
diff.c: fix emit_line() again not to add extra line

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'maint'
Junio C Hamano [Mon, 16 Jun 2008 23:14:22 +0000 (16:14 -0700)]
Merge branch 'maint'

* maint:
  diff: reset color before printing newline

16 years agodiff: reset color before printing newline
SZEDER Gábor [Mon, 16 Jun 2008 22:00:02 +0000 (00:00 +0200)]
diff: reset color before printing newline

It worked that way since commit 50f575fc (Tweak diff colors,
2006-06-22), but commit c1795bb0 (Unify whitespace checking, 2007-12-13)
changed it.  This patch restores the old behaviour.

Besides Linus' arguments in the log message of 50f575fc, resetting color
before printing newline is also important to keep 'git add --patch'
happy.  If the last line(s) of a file are removed, then that hunk will
end with a colored line.  However, if the newline comes before the color
reset, then the diff output will have an additional line at the end
containing only the reset sequence.  This causes trouble in
git-add--interactive.perl's parse_diff function, because @colored will
have one more element than @diff, and that last element will contain the
color reset.  The elements of these arrays will then be copied to @hunk,
but only as many as the number of elements in @diff.  As a result the
last color reset is lost and all subsequent terminal output will be
printed in color.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMake git reflog expire honour core.sharedRepository.
Pierre Habouzit [Sun, 15 Jun 2008 21:37:42 +0000 (23:37 +0200)]
Make git reflog expire honour core.sharedRepository.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoUpdate RPM spec to drop curl executable requirement
Junio C Hamano [Sun, 15 Jun 2008 20:47:14 +0000 (13:47 -0700)]
Update RPM spec to drop curl executable requirement

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoThe "curl" executable is no longer required
Johan Herland [Sun, 15 Jun 2008 10:16:01 +0000 (12:16 +0200)]
The "curl" executable is no longer required

git-clone.sh was the last user of the "curl" executable. Relevant git
commands now use libcurl instead. This should be reflected in the
install requirements.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMakefile: update check-docs target
Junio C Hamano [Sun, 15 Jun 2008 20:43:32 +0000 (13:43 -0700)]
Makefile: update check-docs target

Earlier series to rename documentation pages around did not update this
target and left check-docs broken.  This should fix it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoConsistency: Use "libcurl" instead of "cURL library" and "curl"
Johan Herland [Sun, 15 Jun 2008 10:14:12 +0000 (12:14 +0200)]
Consistency: Use "libcurl" instead of "cURL library" and "curl"

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agocpio is no longer used by git-clone
Johan Herland [Sun, 15 Jun 2008 10:13:22 +0000 (12:13 +0200)]
cpio is no longer used by git-clone

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDocumentation: RelNotes-1.5.6: talk about renamed HTML files
Christian Couder [Sun, 15 Jun 2008 13:39:20 +0000 (15:39 +0200)]
Documentation: RelNotes-1.5.6: talk about renamed HTML files

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoGIT 1.5.6-rc3 v1.5.6-rc3
Junio C Hamano [Sat, 14 Jun 2008 19:57:18 +0000 (12:57 -0700)]
GIT 1.5.6-rc3

Just a lot of small fixes, mostly documentation.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoSimplify and rename find_sha1_file()
Linus Torvalds [Sat, 14 Jun 2008 18:43:01 +0000 (11:43 -0700)]
Simplify and rename find_sha1_file()

Now that we've made the loose SHA1 file reading more careful and
streamlined, we only use the old find_sha1_file() function for checking
whether a loose object file exists at all.

As such, the whole 'return stat information' part of it was just
pointless (nobody cares any more), and the naming of the function is not
really all that relevant either.

So simplify it to not do a 'stat()', but just an existence check (which
is what the callers want), and rename it to 'has_loose_object()' which
matches the use.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMake loose object file reading more careful
Linus Torvalds [Sat, 14 Jun 2008 18:32:37 +0000 (11:32 -0700)]
Make loose object file reading more careful

We used to do 'stat()+open()+mmap()+close()' to read the loose object
file data, which does work fine, but has a couple of problems:

 - it unnecessarily walks the filename twice (at 'stat()' time and then
   again to open it)

 - NFS generally has open-close consistency guarantees, which means that
   the initial 'stat()' was technically done outside of the normal
   consistency rules.

So change it to do 'open()+fstat()+mmap()+close()' instead, which avoids
both these issues.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoAvoid cross-directory renames and linking on object creation
Linus Torvalds [Sat, 14 Jun 2008 17:50:12 +0000 (10:50 -0700)]
Avoid cross-directory renames and linking on object creation

Instead of creating new temporary objects in the top-level git object
directory, create them in the same directory they will finally end up in
anyway.  This avoids making the final atomic "rename to stable name"
operation be a cross-directory event, which makes it a lot easier for
various filesystems.

Several filesystems do things like change the inode number when moving
files across directories (or refuse to do it entirely).

In particular, it can also cause problems for NFS implementations that
change the filehandle of a file when it moves to a different directory,
like the old user-space NFS server did, and like the Linux knfsd still
does if you don't export your filesystems with 'no_subtree_check' or if
you export a filesystem that doesn't have stable inode numbers across
renames).

This change also obviously implies creating the object fan-out
subdirectory at tempfile creation time, rather than at the final
move_temp_to_file() time.  Which actually accounts for most of the size
of the patch.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoUse 'trash directory' thoroughly in t/test-lib.sh
Jakub Narebski [Sat, 14 Jun 2008 18:14:12 +0000 (20:14 +0200)]
Use 'trash directory' thoroughly in t/test-lib.sh

...also in comments.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDon't allocate too much memory in quote_ref_url
Mike Hommey [Sat, 14 Jun 2008 10:02:22 +0000 (12:02 +0200)]
Don't allocate too much memory in quote_ref_url

In c13b263, http_fetch_ref got "refs/" included in the ref passed to it,
which, incidentally, makes the allocation in quote_ref_url too big, now.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogitweb: Make it work with $GIT containing spaces
Jakub Narebski [Sat, 14 Jun 2008 18:37:59 +0000 (20:37 +0200)]
gitweb: Make it work with $GIT containing spaces

This fixes single point where $GIT (which can contain full path
to git binary) with embedded spaces gave errors.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agocompletion: add more 'git add' options
SZEDER Gábor [Sat, 14 Jun 2008 09:48:01 +0000 (11:48 +0200)]
completion: add more 'git add' options

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit add: add long equivalents of '-u' and '-f' options
SZEDER Gábor [Sat, 14 Jun 2008 09:48:00 +0000 (11:48 +0200)]
git add: add long equivalents of '-u' and '-f' options

The option -u stands for --update and it is a good idea to make it clear
especially because this is the only mode of operation of "git add" that
does something different from "adding".  Give longer --force synonym to -f
while we are at it as well.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'rs/attr'
Junio C Hamano [Sat, 14 Jun 2008 18:48:59 +0000 (11:48 -0700)]
Merge branch 'rs/attr'

* rs/attr:
  Ignore .gitattributes in bare repositories

16 years agogit-svn: test that extra blank lines aren't inserted in commit messages.
Avery Pennarun [Thu, 12 Jun 2008 23:10:51 +0000 (19:10 -0400)]
git-svn: test that extra blank lines aren't inserted in commit messages.

Improve the git-svn-author test to check that extra newlines aren't inserted
into commit messages as they take a round trip from git to svn and back.

We test both with and without the --add-author-from option to git-svn.

git-svn: test that svn repo doesn't have extra newlines.

Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-svn: don't append extra newlines at the end of commit messages.
Avery Pennarun [Thu, 12 Jun 2008 23:10:50 +0000 (19:10 -0400)]
git-svn: don't append extra newlines at the end of commit messages.

In git, all commits end in exactly one newline character.  In svn, commits
end in zero or more newlines.  Thus, when importing commits from svn into
git, git-svn always appends two extra newlines to ensure that the
git-svn-id: line is separated from the main commit message by at least one
blank line.

Combined with the terminating newline that's always present in svn commits
produced by git, you usually end up with two blank lines instead of one
between the commit message and git-svn-id: line, which is undesirable.

Instead, let's remove all trailing whitespace from the git commit on the way
through to svn.

Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-submodule - Fix errors regarding resolve_relative_url
Mark Levedahl [Sat, 14 Jun 2008 17:09:41 +0000 (13:09 -0400)]
git-submodule - Fix errors regarding resolve_relative_url

git-submodule was invoking "die" from within resolve-relative-url, but
this does not actually cause the script to exit. Fix this by returning
the error to the caller and have the caller exit.

While we're at it, clean up the quoting on invocation of
resolve_relative_url as it was wrong.

Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agodocumentation: bisect: remove bits talking about a bisection branch
Christian Couder [Sat, 14 Jun 2008 07:21:36 +0000 (09:21 +0200)]
documentation: bisect: remove bits talking about a bisection branch

... because we are now bisecting using a detached HEAD.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agosha1_file.c: dead code removal
Junio C Hamano [Sat, 14 Jun 2008 06:00:51 +0000 (23:00 -0700)]
sha1_file.c: dead code removal

write_sha1_from_fd() and write_sha1_to_fd() were dead code nobody called,
neither the latter's helper repack_object() was.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-instaweb: improve auto-discovery of httpd and call conventions.
Flavio Poletti [Thu, 12 Jun 2008 21:54:55 +0000 (23:54 +0200)]
git-instaweb: improve auto-discovery of httpd and call conventions.

This patch allows calling:

   git-instaweb -d apache2

and have the script Do The Right Thing. In particular, the auto-discovery
mechanism has been extended in order to be used for module listing as
well, and the call convention is that if the daemon is apache2/lighttpd
and the parameter to the "-d" option does not end by "-f", the "-f" is
added to the end of the option itself.

Change all backticks to $( ... ) as per Documentation/CodingGuidelines.

Signed-off-by: Flavio Poletti <flavio@polettix.it>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agot4126: fix test that happened to work due to timing
Junio C Hamano [Sat, 14 Jun 2008 00:16:02 +0000 (17:16 -0700)]
t4126: fix test that happened to work due to timing

The test did "reset --hard" (where the HEAD commit has an empty
blob at path "empty") followed by "> empty", expecting that
the index does not notice the file _changed_ since git wrote
it out upon "reset" if the redirection is done quickly enough.

There was no need to do the emptying, and it gave a wrong result
if "reset --hard" happened on time T and then ">empty" happened on
the next second T+1.  This fixes it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'om/remote-fix'
Junio C Hamano [Fri, 13 Jun 2008 05:55:44 +0000 (22:55 -0700)]
Merge branch 'om/remote-fix'

* om/remote-fix:
  "remote prune": be quiet when there is nothing to prune
  remote show: list tracked remote branches with -n
  remote prune: print the list of pruned branches
  builtin-remote: split show_or_prune() in two separate functions
  remote show: fix the -n option

16 years agofast-export: Correctly generate initial commits with no parents
Shawn O. Pearce [Fri, 13 Jun 2008 04:38:55 +0000 (00:38 -0400)]
fast-export: Correctly generate initial commits with no parents

If we are exporting a commit which has no parents we may be doing
it to a branch that already exists, causing fast-import to assume
the branch's current revision should be the sole parent of the
new commit.  This can cause `git fast-export | git fast-import`
to produce an incorrect graph for:

   A-------M----o------o  refs/heads/master
          /
       B-+

In this graph A and B are initial commits (no parents) but if A was
output first to refs/heads/master and then B is output fast-import
would assume the graph was this instead:

   A-------M----o------o  refs/heads/master
    \     /
     +-B-+

Which would cause B, M, and all later commits to have a different
SHA-1, and obviously be quite a different graph.

Sending a reset command prior to B informs fast-import to clear
the implied parent of A, allowing B to remain an initial commit.

Reported-by: Ben Lynn <benlynn@gmail.com>
Deemed-obviously-correct-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agot/.gitattributes: only ignore whitespace errors in test files
Lea Wiemann [Thu, 12 Jun 2008 22:35:59 +0000 (00:35 +0200)]
t/.gitattributes: only ignore whitespace errors in test files

Only ignore whitespace errors in t/tNNNN-*.sh and the t/tNNNN
subdirectories.  Other files (like test libraries) should still be
checked.

Also fix a whitespace error in t/test-lib.sh.

Signed-off-by: Lea Wiemann <LeWiemann@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agodocument --pretty=tformat: option
Jeff King [Thu, 12 Jun 2008 06:14:28 +0000 (02:14 -0400)]
document --pretty=tformat: option

This was introduced in 4da45bef, but never documented anywhere.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoImprove sed portability
Chris Ridd [Wed, 11 Jun 2008 13:09:19 +0000 (14:09 +0100)]
Improve sed portability

The behaviour of "sed" on an incomplete line is unspecified by POSIX, and
On Solaris it apparently fails to process input that doesn't end in a LF.

Consequently constructs like

  re=$(printf '%s' foo | sed -e 's/bar/BAR/g' $)

cause re to be set to the empty string. Such a construct is used in
git-submodule.sh.

Because the LF at the end of command output are stripped away by the
command substitution, it is a safe and sane change to add a LF at the end
of the printf format specifier.

Signed-off-by: Chris Ridd <chris.ridd@isode.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agouser-manual: describe how higher stages are set during a merge
Junio C Hamano [Thu, 12 Jun 2008 21:30:37 +0000 (14:30 -0700)]
user-manual: describe how higher stages are set during a merge

Higher stages store the blobs involved from their side verbatim.  Removal
of uninteresting hunks are done by "diff --cc" upon demand and not stored
in the index.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agodoc: adding gitman.info and *.texi to .gitignore
Geoffrey Irving [Thu, 12 Jun 2008 14:29:42 +0000 (07:29 -0700)]
doc: adding gitman.info and *.texi to .gitignore

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDocumentation: exclude @pxref{[REMOTES]} from texinfo intermediate output
Junio C Hamano [Thu, 12 Jun 2008 21:21:05 +0000 (14:21 -0700)]
Documentation: exclude @pxref{[REMOTES]} from texinfo intermediate output

We already had a hack to exclude @pxref{[URLS]} from the texi stream that
refers to nonexistent anchor.

This allows "make info" to produce gitman.info again.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDocumentation/git-pull.txt: Use more standard [NOTE] markup
Junio C Hamano [Thu, 12 Jun 2008 21:19:09 +0000 (14:19 -0700)]
Documentation/git-pull.txt: Use more standard [NOTE] markup

Unlike other manual pages (e.g. git-blame.txt), this used *NOTE:*
to show a side note headed with boldface string "NOTE".  Use a paragraph
headed by [NOTE] like others instead.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years ago"remote prune": be quiet when there is nothing to prune
Junio C Hamano [Thu, 12 Jun 2008 06:43:25 +0000 (23:43 -0700)]
"remote prune": be quiet when there is nothing to prune

The previous commit made it always say "Pruning $remote" but reported the
URL only when there is something to prune.  Make it consistent by not
saying anything at all when there is nothing to prune.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoTypo in RelNotes.
Mikael Magnusson [Thu, 12 Jun 2008 02:38:38 +0000 (04:38 +0200)]
Typo in RelNotes.

Signed-off-by: Mikael Magnusson <mikachu@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge git://git.kernel.org/pub/scm/gitk/gitk
Junio C Hamano [Wed, 11 Jun 2008 23:22:53 +0000 (16:22 -0700)]
Merge git://git.kernel.org/pub/scm/gitk/gitk

* git://git.kernel.org/pub/scm/gitk/gitk:
  gitk: Handle detached heads better

16 years agoMerge branch 'maint'
Junio C Hamano [Wed, 11 Jun 2008 23:21:56 +0000 (16:21 -0700)]
Merge branch 'maint'

* maint:
  fix typo in tutorial

16 years agofix typo in tutorial
Fred Maranhão [Wed, 11 Jun 2008 23:09:48 +0000 (19:09 -0400)]
fix typo in tutorial

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoremote show: list tracked remote branches with -n
Olivier Marin [Tue, 10 Jun 2008 22:54:49 +0000 (00:54 +0200)]
remote show: list tracked remote branches with -n

Signed-off-by: Olivier Marin <dkr@freesurf.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoremote prune: print the list of pruned branches
Olivier Marin [Tue, 10 Jun 2008 14:51:35 +0000 (16:51 +0200)]
remote prune: print the list of pruned branches

This command is really too quiet which make it unconfortable to use.

Also implement a --dry-run option, in place of the original -n one, to
list stale tracking branches that will be pruned, but do not actually
prune them.

Add a test case for --dry-run.

Signed-off-by: Olivier Marin <dkr@freesurf.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agobuiltin-remote: split show_or_prune() in two separate functions
Olivier Marin [Tue, 10 Jun 2008 14:51:21 +0000 (16:51 +0200)]
builtin-remote: split show_or_prune() in two separate functions

This allow us to add different features to each of them and keep the
code simple at the same time. Also create a get_remote_ref_states()
to avoid duplicated code.

Signed-off-by: Olivier Marin <dkr@freesurf.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoremote show: fix the -n option
Olivier Marin [Tue, 10 Jun 2008 14:51:08 +0000 (16:51 +0200)]
remote show: fix the -n option

The perl version accepted a -n flag, to show local informations only
without querying remote heads, that seems to have been lost in the C
revrite.

This restores the older behaviour and add a test case.

Signed-off-by: Olivier Marin <dkr@freesurf.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-cvsimport: do not fail when CVSROOT is /
Philippe Bruhat (BooK) [Tue, 10 Jun 2008 12:32:06 +0000 (14:32 +0200)]
git-cvsimport: do not fail when CVSROOT is /

For CVS repositories with unusual CVSROOT, git-cvsimport would fail:

    $ git-cvsimport -v -C foo -d :pserver:anon:@cvs.example.com:/ foo
    AuthReply: error 0 : no such repository

This patch ensures that the path is never empty, but at least '/'.

Signed-off-by: Philippe Bruhat (BooK) <book@cpan.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoConsolidate SHA1 object file close
Linus Torvalds [Wed, 11 Jun 2008 01:47:18 +0000 (18:47 -0700)]
Consolidate SHA1 object file close

This consolidates the common operations for closing the new temporary file
that we have written, before we move it into place with the final name.

There's some common code there (make it read-only and check for errors on
close), but more importantly, this also gives a single place to add an
fsync_or_die() call if we want to add a safe mode.

This was triggered due to Denis Bueno apparently twice being able to
corrupt his git repository on OS X due to an unlucky combination of kernel
crashes and a not-very-robust filesystem.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDocumentation/git-cat-file.txt: add missing line break
Lea Wiemann [Tue, 3 Jun 2008 11:06:12 +0000 (13:06 +0200)]
Documentation/git-cat-file.txt: add missing line break

Without [verse], the line break between the two synopsis lines does
not make it into the man page.

Signed-off-by: Lea Wiemann <LeWiemann@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'js/merge-recursive'
Junio C Hamano [Mon, 9 Jun 2008 23:13:10 +0000 (16:13 -0700)]
Merge branch 'js/merge-recursive'

* js/merge-recursive:
  merge-recursive: respect core.autocrlf when writing out the result
  Add testcase for merging in a CRLF repo

16 years agoMerge branch 'maint'
Junio C Hamano [Mon, 9 Jun 2008 23:13:08 +0000 (16:13 -0700)]
Merge branch 'maint'

* maint:
  git-read-tree: document -v option.
  Remove exec bit from builtin-fast-export.c

16 years agomerge-recursive: respect core.autocrlf when writing out the result
Johannes Schindelin [Mon, 9 Jun 2008 21:23:16 +0000 (22:23 +0100)]
merge-recursive: respect core.autocrlf when writing out the result

The code forgot to convert the blob contents into work tree
representation before writing it out.  Also fixes leaks -- earlier
the updated blobs were never freed.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-read-tree: document -v option.
Miklos Vajna [Mon, 9 Jun 2008 20:25:15 +0000 (22:25 +0200)]
git-read-tree: document -v option.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>