Code

git.git
15 years agoGIT 1.5.6.4 v1.5.6.4
Junio C Hamano [Sat, 19 Jul 2008 17:58:01 +0000 (10:58 -0700)]
GIT 1.5.6.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobuiltin-rm: fix index lock file path
Olivier Marin [Sat, 19 Jul 2008 16:24:46 +0000 (18:24 +0200)]
builtin-rm: fix index lock file path

When hold_locked_index() is called with a relative git_dir and you are
outside the work tree, the lock file become relative to the current
directory. So when later setup_work_tree() change the current directory
it breaks lock file path and commit_locked_index() fails.

This patch move index locking code after setup_work_tree() call to make
lock file relative to the working tree as it should be and add a test
case.

Noticed by Nick Andrew.

Signed-off-by: Olivier Marin <dkr@freesurf.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'sp/maint-index-pack' into maint
Junio C Hamano [Fri, 18 Jul 2008 22:39:51 +0000 (15:39 -0700)]
Merge branch 'sp/maint-index-pack' into maint

* sp/maint-index-pack:
  index-pack: Honor core.deltaBaseCacheLimit when resolving deltas
  index-pack: Track the object_entry that creates each base_data
  index-pack: Chain the struct base_data on the stack for traversal
  index-pack: Refactor base arguments of resolve_delta into a struct

15 years agohttp-fetch: do not SEGV after fetching a bad pack idx file
Junio C Hamano [Fri, 18 Jul 2008 07:11:40 +0000 (00:11 -0700)]
http-fetch: do not SEGV after fetching a bad pack idx file

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agorev-list: honor --quiet option
Junio C Hamano [Fri, 18 Jul 2008 05:39:09 +0000 (22:39 -0700)]
rev-list: honor --quiet option

Nick Andrew noticed that rev-list lets --quiet option to be parsed by
underlying diff_options parser but did not pick up the result.  This
resulted in --quiet option to become effectively a no-op.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoapi-run-command.txt: typofix
Stephan Beyer [Thu, 17 Jul 2008 23:53:55 +0000 (01:53 +0200)]
api-run-command.txt: typofix

Replace "run_command_v_opt_dir" by "run_command_v_opt_cd".

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoStart preparing 1.5.6.4 release notes
Junio C Hamano [Wed, 16 Jul 2008 22:55:51 +0000 (15:55 -0700)]
Start preparing 1.5.6.4 release notes

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit fetch-pack: do not complain about "no common commits" in an empty repo
Johannes Schindelin [Wed, 2 Jul 2008 17:06:56 +0000 (18:06 +0100)]
git fetch-pack: do not complain about "no common commits" in an empty repo

If the repo is empty, it is obvious that there are no common commits
when fetching from _anywhere_.

So there is no use in saying it in that case, and it can even be
annoying.  Therefore suppress the message unilaterally if the repository
is empty prior to the fetch.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'js/maint-pretty-mailmap' into maint
Junio C Hamano [Wed, 16 Jul 2008 22:27:03 +0000 (15:27 -0700)]
Merge branch 'js/maint-pretty-mailmap' into maint

* js/maint-pretty-mailmap:
  Add pretty format %aN which gives the author name, respecting .mailmap

15 years agoMerge branch 'sp/maint-bash-completion-optim' into maint
Junio C Hamano [Wed, 16 Jul 2008 22:25:24 +0000 (15:25 -0700)]
Merge branch 'sp/maint-bash-completion-optim' into maint

* sp/maint-bash-completion-optim:
  bash completion: Resolve git show ref:path<tab> losing ref: portion
  bash completion: Append space after file names have been completed
  bash completion: Don't offer "a.." as a completion for "a."
  bash completion: Improve responsiveness of git-log completion

15 years agoMerge branch 'sp/maint-pack-memuse' into maint
Junio C Hamano [Wed, 16 Jul 2008 22:24:07 +0000 (15:24 -0700)]
Merge branch 'sp/maint-pack-memuse' into maint

* sp/maint-pack-memuse:
  Correct pack memory leak causing git gc to try to exceed ulimit

15 years agoMerge branch 'ls/maint-mailinfo-patch-label' into maint
Junio C Hamano [Wed, 16 Jul 2008 22:23:19 +0000 (15:23 -0700)]
Merge branch 'ls/maint-mailinfo-patch-label' into maint

* ls/maint-mailinfo-patch-label:
  git-mailinfo: Fix getting the subject from the in-body [PATCH] line

15 years agoMerge branch 'js/maint-daemon-syslog' into maint
Junio C Hamano [Wed, 16 Jul 2008 22:22:05 +0000 (15:22 -0700)]
Merge branch 'js/maint-daemon-syslog' into maint

* js/maint-daemon-syslog:
  git daemon: avoid calling syslog() from a signal handler

15 years agorebase-i: keep old parents when preserving merges
Stephan Beyer [Wed, 16 Jul 2008 01:51:49 +0000 (03:51 +0200)]
rebase-i: keep old parents when preserving merges

When "rebase -i -p" tries to preserve merges of unrelated branches, it
lost some parents:

 - When you have more than two parents, the commit in the new history
   ends up with fewer than expected number of parents and this breakage
   goes unnoticed;

 - When you are rebasing a merge with two parents and one is lost, the
   command tries to cherry-pick the original merge commit, and the command
   fails.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agot7600-merge: Use test_expect_failure to test option parsing
Johannes Sixt [Wed, 16 Jul 2008 08:33:52 +0000 (10:33 +0200)]
t7600-merge: Use test_expect_failure to test option parsing

It used plain 'if git merge ...', which hides a segfault. The test does not pass.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoFix buffer overflow in prepare_attr_stack
Dmitry Potapov [Wed, 16 Jul 2008 15:39:55 +0000 (19:39 +0400)]
Fix buffer overflow in prepare_attr_stack

If PATH_MAX on your system is smaller than a path stored in the git repo,
it may cause the buffer overflow in prepare_attr_stack.

Signed-off-by: Dmitry Potapov <dpotapov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoFix buffer overflow in git diff
Dmitry Potapov [Wed, 16 Jul 2008 14:54:02 +0000 (18:54 +0400)]
Fix buffer overflow in git diff

If PATH_MAX on your system is smaller than a path stored, it may cause
buffer overflow and stack corruption in diff_addremove() and diff_change()
functions when running git-diff

Signed-off-by: Dmitry Potapov <dpotapov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoFix buffer overflow in git-grep
Dmitry Potapov [Wed, 16 Jul 2008 15:33:29 +0000 (19:33 +0400)]
Fix buffer overflow in git-grep

If PATH_MAX on your system is smaller than any path stored in the git
repository, that can cause memory corruption inside of the grep_tree
function used by git-grep.

Signed-off-by: Dmitry Potapov <dpotapov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-cvsserver: fix call to nonexistant cleanupWorkDir()
Lars Noschinski [Wed, 16 Jul 2008 11:35:46 +0000 (13:35 +0200)]
git-cvsserver: fix call to nonexistant cleanupWorkDir()

git-cvsserver.perl contained a single call to a nonexistant function
cleanupWorkDir(). This was obviously a typo for cleanupWorkTree().

Signed-off-by: Lars Noschinski <lars@public.noschinski.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDocumentation/git-cherry-pick.txt et al.: Fix misleading -n description
Petr Baudis [Wed, 16 Jul 2008 12:35:22 +0000 (14:35 +0200)]
Documentation/git-cherry-pick.txt et al.: Fix misleading -n description

The manual page of git-cherry-pick and git-revert asserts that -n works
primarily on the working tree, while in fact the primary object it operates
on is the index, and the changes only "accidentally" propagate to the
working tree. This e.g. leads innocent #git IRC folks to believe that you
can use -n to prepare changes for git-add -i staging.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoindex-pack: Honor core.deltaBaseCacheLimit when resolving deltas
Shawn O. Pearce [Tue, 15 Jul 2008 04:45:34 +0000 (04:45 +0000)]
index-pack: Honor core.deltaBaseCacheLimit when resolving deltas

If we are trying to resolve deltas for a long delta chain composed
of multi-megabyte objects we can easily run into requiring 500M+
of memory to hold each object in the chain on the call stack while
we recurse into the dependent objects and resolve them.

We now use a simple delta cache that discards objects near the
bottom of the call stack first, as they are the most least recently
used objects in this current delta chain.  If we recurse out of a
chain we may find the base object is no longer available, as it was
free'd to keep memory under the deltaBaseCacheLimit.  In such cases
we must unpack the base object again, which will require recursing
back to the root of the top of the delta chain as we released that
root first.

The astute reader will probably realize that we can still exceed
the delta base cache limit, but this happens only if the most
recent base plus the delta plus the inflated dependent sum up to
more than the base cache limit.  Due to the way patch_delta is
currently implemented we cannot operate in less memory anyway.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoindex-pack: Track the object_entry that creates each base_data
Shawn O. Pearce [Mon, 14 Jul 2008 02:07:46 +0000 (22:07 -0400)]
index-pack: Track the object_entry that creates each base_data

If we free the data stored within a base_data we need the struct
object_entry to get the data back again for use with another dependent
delta.  Storing the object_entry* in base_data makes it simple to call
get_data_from_pack() to recover the compressed information.

This however means that we must add the missing base object to the end of
our packfile prior to calling resolve_delta() on each of the dependent
deltas.  Adding the base first ensures we can read the base back from the
pack we are indexing, as if it had been included by the remote side.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoindex-pack: Chain the struct base_data on the stack for traversal
Shawn O. Pearce [Mon, 14 Jul 2008 02:07:45 +0000 (22:07 -0400)]
index-pack: Chain the struct base_data on the stack for traversal

We need to release earlier inflated base objects when memory gets
low, which means we need to be able to walk up or down the stack
to locate the objects we want to release, and free their data.

The new link/unlink routines allow inserting and removing the struct
base_data during recursion inside resolve_delta, and the global
base_cache gives us the head of the chain (bottom of the stack)
so we can traverse it.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoindex-pack: Refactor base arguments of resolve_delta into a struct
Shawn O. Pearce [Mon, 14 Jul 2008 02:07:44 +0000 (22:07 -0400)]
index-pack: Refactor base arguments of resolve_delta into a struct

We need to discard base objects which are not recently used if our
memory gets low, such as when we are unpacking a long delta chain
of a very large object.

To support tracking the available base objects we combine the
pointer and size into a struct.  Future changes would allow the
data pointer to be free'd and marked NULL if memory gets low.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobash completion: Resolve git show ref:path<tab> losing ref: portion
Shawn O. Pearce [Tue, 15 Jul 2008 05:52:04 +0000 (05:52 +0000)]
bash completion: Resolve git show ref:path<tab> losing ref: portion

Linus reported that the bash completion for git show often dropped
the ref portion of the argument (stuff before the :) when trying
to complete a file name of a file in another branch or tag.

Björn Steinbrink tracked it down to the gvfs completion script
which comes standard on many Fedora Core based systems.  That is
removing : from COMP_WORDBREAKS, making readline treat the entire
argument (including the ref) as the name that must be completed.
When the git completion routines supplied a completion of just the
filename, readline replaced everything.

Since Git users often need to use "ref:path" or "ref:ref" sort of
arguments, and expect completion support on both sides of the :
we really want the : in COMP_WORDBREAKS to provide a good user
experience.  This is also the default that ships with bash as it
can be useful in other contexts, such as rcp/scp.

We now try to add : back to COMP_WORDBREAKS if it has been removed
by a script that loaded before us.  However if this doesn't work
(as the : is stripped after we load) we fallback in the completion
routines to include "ref:" as part of the prefix for completions,
allowing readine to fully insert the argument the user wanted.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobash completion: Append space after file names have been completed
Shawn O. Pearce [Mon, 14 Jul 2008 00:22:03 +0000 (00:22 +0000)]
bash completion: Append space after file names have been completed

When completing `git show origin/maint:Makef<tab>` we should add a
space after the filename has been completed, so that the user can
immediately begin the next argument.

I also added a special case for the symlink variant so we treat it
just like a normal blob, as there are no items below it in the Git
tree structure.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-mailinfo: Fix getting the subject from the in-body [PATCH] line
Lukas Sandström [Thu, 10 Jul 2008 21:41:33 +0000 (23:41 +0200)]
git-mailinfo: Fix getting the subject from the in-body [PATCH] line

"Subject: " isn't in the static array "header", and thus
memcmp("Subject:", header[i], 7) will never match.

Even if it did so, hdr_data[] may not have been allocated if there weren't
a "Subject: " in-body when we process "[PATCH]" in the affected codepath.

Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobash completion: Don't offer "a.." as a completion for "a."
Shawn O. Pearce [Sun, 13 Jul 2008 22:06:31 +0000 (22:06 +0000)]
bash completion: Don't offer "a.." as a completion for "a."

If the user is trying to complete "v1.5.3.<tab>" to see all of
the available maintenance releases for 1.5.3 we should not give
them an extra dot as the completion.  Instead if the user wants
a ".." or a "..." operator they should key the two dots out on
their own.  Its the same number of keystrokes either way.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoGIT 1.5.6.3 v1.5.6.3
Junio C Hamano [Sun, 13 Jul 2008 22:23:43 +0000 (15:23 -0700)]
GIT 1.5.6.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-am: Do not exit silently if committer is unset
Stephan Beyer [Sat, 12 Jul 2008 15:46:59 +0000 (17:46 +0200)]
git-am: Do not exit silently if committer is unset

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobash completion: Improve responsiveness of git-log completion
Shawn O. Pearce [Sun, 13 Jul 2008 02:37:42 +0000 (02:37 +0000)]
bash completion: Improve responsiveness of git-log completion

Junio noticed the bash completion has been taking a long time lately.
Petr Baudis tracked it down to 72e5e989b ("bash: Add space after
unique command name is completed.").  Tracing the code showed
we spent significant time inside of this loop within __gitcomp,
due to the string copying overhead.

  [28.146109654] _git common over
  [28.164791148] gitrefs in
  [28.280302268] gitrefs dir out
  [28.300939737] gitcomp in
  [28.308378112] gitcomp pre-case
* [28.313407453] gitcomp iter in
* [28.701270296] gitcomp iter out
  [28.713370786] out normal

Since __git_refs avoids this string copying by forking and using
echo we use the same trick here when we need to finish generating
the names for the caller.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agot0004: fix timing bug
Junio C Hamano [Sat, 12 Jul 2008 11:15:56 +0000 (04:15 -0700)]
t0004: fix timing bug

The test created an initial commit, made .git/objects unwritable and then
exercised various codepaths to create loose commit, tree and blob objects
to make sure the commands notice failures from these attempts.

However, the initial commit was not preceded with test_tick, which made
its object name depend on the timestamp.  The names of all the later tree
and blob objects the test tried to create were static.  If the initial
commit's object name happened to begin with the same two hexdigits as the
tree or blob objects the test later attempted to create, the fan-out
directory in which these tree or blob would be created is already created
when the initial commit was made, and the object creation succeeds, and
commands being tested should not notice any failure --- in short, the test
was bogus.

This makes the fan-out directories also unwritable, and adds test_tick
before the commit object creation to make the test repeatable.

The contents of the file to create a blob from "a" to "60" is to force the
name of the blob object to begin with "1b", which shares the fan-out
directory with the initial commit that is created with the test.  This was
useful when diagnosing the breakage of this test.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoAdd pretty format %aN which gives the author name, respecting .mailmap
Johannes Schindelin [Fri, 11 Jul 2008 23:28:18 +0000 (00:28 +0100)]
Add pretty format %aN which gives the author name, respecting .mailmap

The pretty format %an does not respect .mailmap, but gives the exact
author name recorded in the commit.  Sometimes it is more desirable,
however, to look if the email has another name mapped to it in .mailmap.

This commit adds %aN (and %cN for the committer name) to do exactly that.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-mailinfo: document the -n option
Lukas Sandström [Thu, 10 Jul 2008 21:36:28 +0000 (23:36 +0200)]
git-mailinfo: document the -n option

Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoFix backwards-incompatible handling of core.sharedRepository
Petr Baudis [Sat, 12 Jul 2008 01:15:03 +0000 (03:15 +0200)]
Fix backwards-incompatible handling of core.sharedRepository

06cbe85 (Make core.sharedRepository more generic, 2008-04-16) broke the
traditional setting of core.sharedRepository to true, which was to make
the repository group writable: with umask 022, it would clear the
permission bits for 'other'. (umask 002 did not exhibit this behaviour
since pre-chmod() check in adjust_shared_perm() fails in that case.)

The call to adjust_shared_perm() should only loosen the permission.
If the user has umask like 022 or 002 that allow others to read, the
resulting files should be made readable and writable by group, without
restricting the readability by others.

This patch fixes the adjust_shared_perm() mode tweak based on Junio's
suggestion and adds the appropriate tests to t/t1301-shared-repo.sh.

Cc: Heikki Orsila <heikki.orsila@iki.fi>
Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoCorrect pack memory leak causing git gc to try to exceed ulimit
Shawn O. Pearce [Wed, 9 Jul 2008 07:10:07 +0000 (07:10 +0000)]
Correct pack memory leak causing git gc to try to exceed ulimit

When recursing to unpack a delta base we must unuse_pack() so that
the pack window for the current object does not remain pinned in
memory while the delta base is itself being unpacked and materialized
for our use.

On a long delta chain of 50 objects we may need to access 6 different
windows from a very large (>3G) pack file in order to obtain all
of the delta base content.  If the process ulimit permits us to
map/allocate only 1.5G we must release windows during this recursion
to ensure we stay within the ulimit and transition memory from pack
cache to standard malloc, or other mmap needs.

Inserting an unuse_pack() call prior to the recursion allows us to
avoid pinning the current window, making it available for garbage
collection if memory runs low.

This has been broken since at least before 1.5.1-rc1, and very
likely earlier than that.  Its fixed now.  :)

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoStart preparing release notes for 1.5.6.3
Junio C Hamano [Wed, 9 Jul 2008 06:57:14 +0000 (23:57 -0700)]
Start preparing release notes for 1.5.6.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-submodule - Fix bugs in adding an existing repo as a module
Mark Levedahl [Tue, 8 Jul 2008 02:36:40 +0000 (22:36 -0400)]
git-submodule - Fix bugs in adding an existing repo as a module

git-submodule add would trip if path to the submodule included a space,
or if its .git was a gitdir: link to a GIT_DIR kept elsewhere. Fix both.

Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobash: offer only paths after '--'
SZEDER Gábor [Tue, 8 Jul 2008 16:56:14 +0000 (18:56 +0200)]
bash: offer only paths after '--'

Many git commands use '--' to separate subcommands, options, and refs
from paths.  However, the programmable completion for several of these
commands does not respect the '--', and offer subcommands, options, or
refs after a '--', although only paths are permitted.  e.g. 'git bisect
-- <TAB>' offers subcommands, 'git log -- --<TAB>' offers options and
'git log -- git<TAB>' offers all gitgui tags.

The completion for the following commands share this wrong behaviour:
  am add bisect commit diff log reset shortlog submodule gitk.

To avoid this, we check the presence of a '--' on the command line first
and let the shell do filename completion, if one is found.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoRemove unnecessary pack-*.keep file after successful git-clone
Shawn O. Pearce [Tue, 8 Jul 2008 04:46:06 +0000 (04:46 +0000)]
Remove unnecessary pack-*.keep file after successful git-clone

Once a clone is successful we no longer need to hold onto the
.keep file created by the transport.  Delete the file so we
can later repack the complete repository.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agomake deleting a missing ref more quiet
Jeff King [Tue, 8 Jul 2008 04:08:02 +0000 (00:08 -0400)]
make deleting a missing ref more quiet

If git attempts to delete a ref, but the unlink of the ref
file fails, we print a message to stderr. This is usually a
good thing, but if the error is ENOENT, then it indicates
that the ref has _already_ been deleted. And since that's
our goal, it doesn't make sense to complain to the user.

This harmonizes the error reporting behavior for the
unpacked and packed cases; the packed case already printed
nothing on ENOENT, but the unpacked printed unconditionally.

Additionally, send-pack would, when deleting the tracking
ref corresponding to a remote delete, print "Failed to
delete" on any failure. This can be a misleading
message, since we actually _did_ delete at the remote side,
but we failed to delete locally. Rather than make the
message more precise, let's just eliminate it entirely; the
delete_ref routine already takes care of printing out a much
more specific message about what went wrong.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'qq/maint' into maint
Junio C Hamano [Tue, 8 Jul 2008 20:05:06 +0000 (13:05 -0700)]
Merge branch 'qq/maint' into maint

* qq/maint:
  run_command(): respect GIT_TRACE

15 years agoMerge branch 'lt/racy-empty' into maint
Junio C Hamano [Tue, 8 Jul 2008 07:19:17 +0000 (00:19 -0700)]
Merge branch 'lt/racy-empty' into maint

* lt/racy-empty:
  racy-git: an empty blob has a fixed object name

15 years agoMerge branch 'qq/maint' (early part) into maint
Junio C Hamano [Mon, 7 Jul 2008 23:09:17 +0000 (16:09 -0700)]
Merge branch 'qq/maint' (early part) into maint

* 'qq/maint' (early part):
  git-svn.perl: workaround assertions in svn library 1.5.0
  mailinfo: feed the correct line length to decode_transfer_encoding()
  git-clone: remove leftover debugging fprintf().
  Fix "config_error_nonbool" used with value instead of key
  clone -q: honor "quiet" option over native transports.
  attribute documentation: keep EXAMPLE at end
  builtin-commit.c: Use 'git_config_string' to get 'commit.template'
  http.c: Use 'git_config_string' to clean up SSL config.
  diff.c: Use 'git_config_string' to get 'diff.external'
  convert.c: Use 'git_config_string' to get 'smudge' and 'clean'
  builtin-log.c: Use 'git_config_string' to get 'format.subjectprefix' and 'format.suffix'
  Documentation cvs: Clarify when a bare repository is needed
  Documentation: be precise about which date --pretty uses

15 years agorun_command(): respect GIT_TRACE
Johannes Schindelin [Mon, 7 Jul 2008 13:41:34 +0000 (14:41 +0100)]
run_command(): respect GIT_TRACE

When GIT_TRACE is set, the user is most likely wanting to see an external
command that is about to be executed.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-svn.perl: workaround assertions in svn library 1.5.0
Gerrit Pape [Sun, 6 Jul 2008 19:28:50 +0000 (19:28 +0000)]
git-svn.perl: workaround assertions in svn library 1.5.0

With subversion 1.5.0 (C and perl libraries) the git-svn selftest
t9101-git-svn-props.sh fails at test 25 and 26.  The following commands
cause assertions in the svn library

 $ cd deeply
 $ git-svn propget svn:ignore .
 perl: /build/buildd/subversion-1.5.0dfsg1/subversion/libsvn_ra/ra_loader.c:674: svn_ra_get_dir: Assertion `*path != '/'' failed.
 Aborted

 $ git-svn propget svn:ignore ..
 perl: /build/buildd/subversion-1.5.0dfsg1/subversion/libsvn_subr/path.c:120: svn_path_join: Assertion `is_canonical(component, clen)' failed.

With this commit, git-svn makes sure the path doesn't start with a
slash, and is not a dot, working around these assertions.

The breakage was reported by Lucas Nussbaum through
 http://bugs.debian.org/489108

Signed-off-by: Gerrit Pape <pape@smarden.org>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agomailinfo: feed the correct line length to decode_transfer_encoding()
Junio C Hamano [Mon, 7 Jul 2008 05:26:45 +0000 (22:26 -0700)]
mailinfo: feed the correct line length to decode_transfer_encoding()

When handling a MIME multipart message, multi-part boundary lines are eaten
by a call to handle_boundary() function from the main loop of handle_body(),
and after that happens, we should update the line length correctly, because
handle_boundary() udpates line[] with new data.

This was caused by a thinko in 9aa2309 (mailinfo: apply the same fix not
to lose NULs in BASE64 and QP codepaths, 2008-05-25).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-clone: remove leftover debugging fprintf().
Alex Riesen [Sun, 6 Jul 2008 22:56:49 +0000 (00:56 +0200)]
git-clone: remove leftover debugging fprintf().

Acked-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoFix grammar in git-rev-parse(1).
Mikael Magnusson [Sun, 6 Jul 2008 20:34:21 +0000 (22:34 +0200)]
Fix grammar in git-rev-parse(1).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit daemon: avoid calling syslog() from a signal handler
Johannes Schindelin [Thu, 3 Jul 2008 15:27:24 +0000 (16:27 +0100)]
git daemon: avoid calling syslog() from a signal handler

Signal handlers should never call syslog(), as that can raise signals
of its own.

Instead, call the syslog() from the master process.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoFix "config_error_nonbool" used with value instead of key
Christian Couder [Sun, 6 Jul 2008 04:10:04 +0000 (06:10 +0200)]
Fix "config_error_nonbool" used with value instead of key

The function "config_error_nonbool", that is defined in "config.c",
is used to report an error when a config key in the config file
should have a corresponding value but it hasn't.

So the parameter to this function should be the key and not the
value, because the value is undefined. And it could crash if the
value is used.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoclone -q: honor "quiet" option over native transports.
Junio C Hamano [Sun, 6 Jul 2008 00:58:50 +0000 (17:58 -0700)]
clone -q: honor "quiet" option over native transports.

The earlier built-in conversion seems to have broken "git-clone"; this
teaches the command to honor the "-q" option again when talking to the
remote end over native transports (file://, git:// and ssh://).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoattribute documentation: keep EXAMPLE at end
Junio C Hamano [Sun, 6 Jul 2008 01:14:27 +0000 (18:14 -0700)]
attribute documentation: keep EXAMPLE at end

The document gives overall definition of states in DESCRIPTION, describes
various aspects of git operations that can be influenced in EFFECTS, and
finally gives examples in the EXAMPLE section.  Archive creation however
was somehow documented after the EXAMPLE section, not insode EFFECTS.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobuiltin-commit.c: Use 'git_config_string' to get 'commit.template'
Brian Hetro [Sat, 5 Jul 2008 05:24:40 +0000 (01:24 -0400)]
builtin-commit.c: Use 'git_config_string' to get 'commit.template'

Signed-off-by: Brian Hetro <whee@smaertness.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agohttp.c: Use 'git_config_string' to clean up SSL config.
Brian Hetro [Sat, 5 Jul 2008 05:24:44 +0000 (01:24 -0400)]
http.c: Use 'git_config_string' to clean up SSL config.

Signed-off-by: Brian Hetro <whee@smaertness.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agodiff.c: Use 'git_config_string' to get 'diff.external'
Brian Hetro [Sat, 5 Jul 2008 05:24:43 +0000 (01:24 -0400)]
diff.c: Use 'git_config_string' to get 'diff.external'

Signed-off-by: Brian Hetro <whee@smaertness.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoconvert.c: Use 'git_config_string' to get 'smudge' and 'clean'
Brian Hetro [Sat, 5 Jul 2008 05:24:42 +0000 (01:24 -0400)]
convert.c: Use 'git_config_string' to get 'smudge' and 'clean'

Signed-off-by: Brian Hetro <whee@smaertness.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobuiltin-log.c: Use 'git_config_string' to get 'format.subjectprefix' and 'format...
Brian Hetro [Sat, 5 Jul 2008 05:24:41 +0000 (01:24 -0400)]
builtin-log.c: Use 'git_config_string' to get 'format.subjectprefix' and 'format.suffix'

Signed-off-by: Brian Hetro <whee@smaertness.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDocumentation cvs: Clarify when a bare repository is needed
Matthew Ogilvie [Sat, 5 Jul 2008 04:43:41 +0000 (22:43 -0600)]
Documentation cvs: Clarify when a bare repository is needed

New users sometimes import a project and then immediately
try to use the imported repository as a central shared repository.
This provides pointers about setting up a bare repository for that
in the parts of the documentation dealing with CVS migration.

Signed-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDocumentation: be precise about which date --pretty uses
Nikolaus Schulz [Sat, 5 Jul 2008 00:00:13 +0000 (02:00 +0200)]
Documentation: be precise about which date --pretty uses

This makes it explicit that the --pretty formats 'medium' and 'email' use the
author date (and ignore the committer date).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoGIT 1.5.6.2 v1.5.6.2
Junio C Hamano [Fri, 4 Jul 2008 08:12:54 +0000 (01:12 -0700)]
GIT 1.5.6.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoFix executable bits in t/ scripts
Junio C Hamano [Fri, 4 Jul 2008 08:38:34 +0000 (01:38 -0700)]
Fix executable bits in t/ scripts

Pointed out by Ramsay Jones.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoWork around gcc warnings from curl headers
Junio C Hamano [Fri, 4 Jul 2008 07:37:40 +0000 (00:37 -0700)]
Work around gcc warnings from curl headers

After master.k.org upgrade, I started seeing these warning messages:

    transport.c: In function 'get_refs_via_curl':
    transport.c:458: error: call to '_curl_easy_setopt_err_write_callback' declared with attribute warning: curl_easy_setopt expects a curl_write_callback argument for this option

It appears that the curl header wants to enforce the function signature
for callback function given to curl_easy_setopt() to be compatible with
that of (*curl_write_callback) or fwrite.  This patch seems to work the
issue around.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'js/maint-clone-insteadof' into maint
Junio C Hamano [Thu, 3 Jul 2008 04:32:44 +0000 (21:32 -0700)]
Merge branch 'js/maint-clone-insteadof' into maint

* js/maint-clone-insteadof:
  clone: respect the settings in $HOME/.gitconfig and /etc/gitconfig
  clone: respect url.insteadOf setting in global configs

15 years agoMerge branch 'jk/maint-fetch-ref-hier' into maint
Junio C Hamano [Thu, 3 Jul 2008 04:32:44 +0000 (21:32 -0700)]
Merge branch 'jk/maint-fetch-ref-hier' into maint

* jk/maint-fetch-ref-hier:
  fetch: give a hint to the user when local refs fail to update
  fetch: report local storage errors in status table

15 years agoMerge branch 'jc/maint-reset' into maint
Junio C Hamano [Thu, 3 Jul 2008 04:32:44 +0000 (21:32 -0700)]
Merge branch 'jc/maint-reset' into maint

* jc/maint-reset:
  Allow "git-reset path" when unambiguous

15 years agoFix describe --tags --long so it does not segfault
Shawn O. Pearce [Thu, 3 Jul 2008 02:32:45 +0000 (02:32 +0000)]
Fix describe --tags --long so it does not segfault

If we match a lightweight (non-annotated tag) as the name to
output and --long was requested we do not have a tag, nor do
we have a tagged object to display.  Instead we must use the
object we were passed as input for the long format display.

Reported-by: Mark Burton <markb@ordern.com>
Backtraced-by: Mikael Magnusson <mikachu@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoStart draft release notes for 1.5.6.2
Junio C Hamano [Wed, 2 Jul 2008 00:09:21 +0000 (17:09 -0700)]
Start draft release notes for 1.5.6.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoFix 'git show' on signed tag of signed tag of commit
Thomas Rast [Tue, 1 Jul 2008 09:47:04 +0000 (11:47 +0200)]
Fix 'git show' on signed tag of signed tag of commit

The cmd_show loop resolves tags by showing them, then pointing the
object to the 'tagged' member.  However, this object is not fully
initialized; it only contains the SHA1.  (This resulted in a segfault
if there were two levels of tags.)  We apply parse_object to get a
full object.

Noticed by Kalle Olavi Niemitalo on IRC.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agofetch: give a hint to the user when local refs fail to update
Jeff King [Fri, 27 Jun 2008 04:01:41 +0000 (00:01 -0400)]
fetch: give a hint to the user when local refs fail to update

There are basically two categories of update failures for
local refs:

  1. problems outside of git, like disk full, bad
     permissions, etc.

  2. D/F conflicts on tracking branch ref names

In either case, there should already have been an error
message. In case '1', hopefully enough information has
already been given that the user can fix it. In the case of
'2', we can hint that the user can clean up their tracking
branch area by using 'git remote prune'.

Note that we don't actually know _which_ case we have, so
the user will receive the hint in case 1, as well. In this
case the suggestion won't do any good, but hopefully the
user is smart enough to figure out that it's just a hint.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agodoc/rev-parse: clarify reflog vs --until for specifying revisions
Jeff King [Mon, 30 Jun 2008 03:27:45 +0000 (23:27 -0400)]
doc/rev-parse: clarify reflog vs --until for specifying revisions

The rev-parse manpage introduces the branch@{date} syntax,
and mentions the reflog specifically. However, new users may
not be familiar with the distinction between the reflog and
the commit date, so let's help them out with a "you may be
interested in --until" pointer.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoclone: respect the settings in $HOME/.gitconfig and /etc/gitconfig
Johannes Schindelin [Fri, 27 Jun 2008 12:55:23 +0000 (13:55 +0100)]
clone: respect the settings in $HOME/.gitconfig and /etc/gitconfig

After initializing the config in the newly-created repository, we
need to unset GIT_CONFIG so that the global configs are read again.

Noticed by Pieter de Bie.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-svn: don't sanitize remote names in config
Eric Wong [Sun, 29 Jun 2008 03:40:32 +0000 (20:40 -0700)]
git-svn: don't sanitize remote names in config

The original sanitization code was just taken from the
remotes2config.sh shell script in contrib.

Credit to Avery Pennarun for noticing this mistake, and Junio
for clarifying the rules for config section names:

Junio C Hamano wrote in <7vfxr23s6m.fsf@gitster.siamese.dyndns.org>:

> In
>
>  [foo "bar"] baz = value
>
> foo and baz must be config.c::iskeychar() (and baz must be isalpha()), but
> "bar" can be almost anything.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-svn: avoid filling up the disk with temp files.
Avery Pennarun [Sat, 28 Jun 2008 23:33:56 +0000 (19:33 -0400)]
git-svn: avoid filling up the disk with temp files.

Commit ffe256f9bac8a40ff751a9341a5869d98f72c285 ("git-svn: Speed up fetch")
introduced changes that create a temporary file for each object fetched by
svn.  These files should be deleted automatically, but perl apparently
doesn't do this until the process exits (or perhaps when its garbage
collector runs).

This means that on a large fetch, especially with lots of branches, we
sometimes fill up /tmp completely, which prevents the next temp file from
being written completely.  This is aggravated by the fact that a new temp
file is created for each updated file, even if that update produces a file
identical to one already in git.  Thus, it can happen even if there's lots
of disk space to store the finished repository.

We weren't adequately checking for write errors, so this would result in an
invalid file getting committed, which caused git-svn to fail later with an
invalid checksum.

This patch adds a check to syswrite() so similar problems don't lead to
corruption in the future.  It also unlink()'s each temp file explicitly
when we're done with it, so the disk doesn't need to fill up.

Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
Tested-by: Björn Steinbrink <B.Steinbrink@gmx.de>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit cat-file: Fix memory leak in batch mode
Björn Steinbrink [Sun, 29 Jun 2008 01:21:25 +0000 (03:21 +0200)]
git cat-file: Fix memory leak in batch mode

When run in batch mode, git cat-file never frees the memory for the blob
contents it is printing. This quickly adds up and causes git-svn to be
hardly usable for imports of large svn repos, because it uses cat-file in
batch mode and cat-file's memory usage easily reaches several hundred MB
without any good reason.

Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agofix git config example syntax
Joey Hess [Sat, 28 Jun 2008 20:02:47 +0000 (16:02 -0400)]
fix git config example syntax

git-config expects a space, not '=' between option and value.

Also, quote the value since it contains globs, which some shells will not
pass through unchanged, or will abort if the glob doesn't expand.

Signed-off-by: Joey Hess <joey@kitenet.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoavoid off-by-one error in run_upload_archive
Jochen Voss [Sat, 28 Jun 2008 16:04:24 +0000 (17:04 +0100)]
avoid off-by-one error in run_upload_archive

Make sure that buf has enough space to store the trailing \0 of
the command line argument, too.

Signed-off-by: Jochen Voss <voss@seehuhn.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agofetch: report local storage errors in status table
Jeff King [Fri, 27 Jun 2008 03:59:50 +0000 (23:59 -0400)]
fetch: report local storage errors in status table

Previously, if there was an error while storing a local
tracking ref, the low-level functions would report an error,
but fetch's status output wouldn't indicate any problem.
E.g., imagine you have an old "refs/remotes/origin/foo/bar" but
upstream has deleted "foo/bar" in favor of a new branch
"foo". You would get output like this:

  error: there are still refs under 'refs/remotes/origin/foo'
  From $url_of_repo
   * [new branch]      foo        -> origin/foo

With this patch, the output takes into account the status of
updating the local ref:

  error: there are still refs under 'refs/remotes/origin/foo'
  From $url_of_repo
   ! [new branch]      foo        -> origin/foo  (unable to update local ref)

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoclone: respect url.insteadOf setting in global configs
Johannes Schindelin [Fri, 27 Jun 2008 12:56:05 +0000 (13:56 +0100)]
clone: respect url.insteadOf setting in global configs

When we call "git clone" with a url that has a rewrite rule in either
$HOME/.gitconfig or /etc/gitconfig, the URL can be different from
what the command line expects it to be.

So, let's use the URL as the remote structure has it, not the literal
string from the command line.

Noticed by Pieter de Bie.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Acked-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint-1.5.5' into maint
Junio C Hamano [Fri, 27 Jun 2008 01:08:51 +0000 (18:08 -0700)]
Merge branch 'maint-1.5.5' into maint

* maint-1.5.5:
  GIT 1.5.5.5
  GIT 1.5.4.6
  git-shell: accept "git foo" form

Conflicts:

GIT-VERSION-GEN
RelNotes

15 years agoGIT 1.5.5.5 v1.5.5.5
Junio C Hamano [Fri, 27 Jun 2008 00:16:50 +0000 (17:16 -0700)]
GIT 1.5.5.5

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint-1.5.4' into maint-1.5.5
Junio C Hamano [Fri, 27 Jun 2008 00:14:03 +0000 (17:14 -0700)]
Merge branch 'maint-1.5.4' into maint-1.5.5

* maint-1.5.4:
  GIT 1.5.4.6
  git-shell: accept "git foo" form

Conflicts:

GIT-VERSION-GEN
RelNotes

15 years agoGIT 1.5.4.6 v1.5.4.6
Junio C Hamano [Fri, 27 Jun 2008 00:11:21 +0000 (17:11 -0700)]
GIT 1.5.4.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-shell: accept "git foo" form
Junio C Hamano [Sun, 2 Dec 2007 06:16:19 +0000 (22:16 -0800)]
git-shell: accept "git foo" form

This is a backport of 0a47dc110e042b5bcc63dc94c8d517e67efe9306
to 'maint' to be included in 1.5.6.2 so that older server side
can accept dashless form of request when clients are updated.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agodiff --check: do not discard error status upon seeing a good line
Junio C Hamano [Thu, 26 Jun 2008 20:16:33 +0000 (13:16 -0700)]
diff --check: do not discard error status upon seeing a good line

"git diff --check" should return non-zero when there was any whitespace
error but the code only paid attention to the error status of the last
new line in the patch.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoAllow "git-reset path" when unambiguous
Junio C Hamano [Thu, 26 Jun 2008 01:16:36 +0000 (18:16 -0700)]
Allow "git-reset path" when unambiguous

Resetting a selected set of index entries is done with
"git reset -- paths" syntax, but we did not allow -- to be omitted
even when the command is unambiguous.

This updates the command to follow the general rule:

 * When -- appears, revs come before it, and paths come after it;

 * When there is no --, earlier ones are revs and the rest are paths, and
   we need to guess.  When lack of -- marker forces us to guess, we
   protect from user errors and typoes by making sure what we treat as
   revs do not appear as filenames in the work tree, and what we treat as
   paths do appear as filenames in the work tree, and by erroring out if
   that is not the case.  We tell the user to disambiguate by using -- in
   such a case.

which is employed elsewhere in the system.

When this rule is applied to "reset", because we can have only zero or one
rev to the command, the check can be slightly simpler than other programs.
We have to check only the first one or two tokens after the command name
and options, and when they are:

    -- A:
     no explicit rev given; "A" and whatever follows it are paths.

    A --:
        explicit rev "A" given and whatever follows the "--" are paths.

    A B:
       "A" could be rev or path and we need to guess.  "B" could
       be missing but if exists that (and everything that follows) would
       be paths.

So we apply the guess only in the last case and only to "A" (not "B" and
what comes after it).

 * As long as "A" is unambiguously a path, index entries for "A", "B" (and
   everything that follows) are reset to the HEAD revision.

 * If "A" is unambiguously a rev, on the other hand, the index entries for
   "B" (and everything that follows) are reset to the "A" revision.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoGIT 1.5.6.1 v1.5.6.1
Junio C Hamano [Thu, 26 Jun 2008 00:09:40 +0000 (17:09 -0700)]
GIT 1.5.6.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agofix update-hook-example to work with packed tag references
Dmitry Potapov [Wed, 25 Jun 2008 08:26:55 +0000 (12:26 +0400)]
fix update-hook-example to work with packed tag references

The update-hook-example used 'test -f' to check the tag present, which
does not work if the checked reference is packed. This check has been
changed to use 'git rev-parse $tag' instead.

Signed-off-by: Dmitry Potapov <dpotapov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoclone: create intermediate directories of destination repo
Jeff King [Wed, 25 Jun 2008 05:41:34 +0000 (01:41 -0400)]
clone: create intermediate directories of destination repo

The shell version used to use "mkdir -p" to create the repo
path, but the C version just calls "mkdir". Let's replicate
the old behavior. We have to create the git and worktree
leading dirs separately; while most of the time, the
worktree dir contains the git dir (as .git), the user can
override this using GIT_WORK_TREE.

We can reuse safe_create_leading_directories, but we need to
make a copy of our const buffer to do so. Since
merge-recursive uses the same pattern, we can factor this
out into a global function. This has two other cleanup
advantages for merge-recursive:

  1. mkdir_p wasn't a very good name. "mkdir -p foo/bar" actually
     creates bar, but this function just creates the leading
     directories.

  2. mkdir_p took a mode argument, but it was completely
     ignored.

Acked-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'jc/maint-combine-diff-pre-context' into maint
Junio C Hamano [Wed, 25 Jun 2008 18:20:01 +0000 (11:20 -0700)]
Merge branch 'jc/maint-combine-diff-pre-context' into maint

* jc/maint-combine-diff-pre-context:
  diff -c/--cc: do not include uninteresting deletion before leading context

15 years agoMerge branch 'lt/maint-gitdir-relative' into maint
Junio C Hamano [Wed, 25 Jun 2008 18:19:33 +0000 (11:19 -0700)]
Merge branch 'lt/maint-gitdir-relative' into maint

* lt/maint-gitdir-relative:
  Make git_dir a path relative to work_tree in setup_work_tree()

15 years agoMerge branch 'sb/maint-rebase' into maint
Junio C Hamano [Wed, 25 Jun 2008 18:18:39 +0000 (11:18 -0700)]
Merge branch 'sb/maint-rebase' into maint

* sb/maint-rebase:
  git-rebase.sh: Add check if rebase is in progress

15 years agofor-each-ref: implement missing tag values
Jeff King [Wed, 25 Jun 2008 16:08:15 +0000 (12:08 -0400)]
for-each-ref: implement missing tag values

The "type" and "object" fields for tags were accepted as
valid atoms, but never implemented. Consequently, they
simply returned the empty string, even for valid tags.

Noticed by Lea Wiemann.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-svn: make rebuild respect rewriteRoot option
Jan Krüger [Tue, 24 Jun 2008 00:17:36 +0000 (02:17 +0200)]
git-svn: make rebuild respect rewriteRoot option

Suppose someone fetches git-svn-ified commits from another repo and then
attempts to use 'git-svn init --rewrite-root=foo bar'. Using git svn rebase
after that will fail badly:

 * For each commit tried by working_head_info, rebuild is called indirectly.
 * rebuild will iterate over all commits and skip all of them because the
   URL does not match. Because of that no rev_map file is generated at all.
 * Thus, rebuild will run once for every commit. This takes ages.
 * In the end there still isn't any rev_map file and thus working_head_info
   fails.

Addressing this behaviour fixes an apparently not too uncommon problem with
providing git-svn mirrors of Subversion repositories. Some repositories are
accessed using different URLs depending on whether the user has push
privileges or not. In the latter case, an anonymous URL is often used that
differs from the push URL. Providing a mirror that is usable in both cases
becomes a lot more possible with this change.

Signed-off-by: Jan Krüger <jk@jk.gs>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoWorkaround for AIX mkstemp()
Patrick Higgins [Mon, 23 Jun 2008 21:33:41 +0000 (15:33 -0600)]
Workaround for AIX mkstemp()

The AIX mkstemp will modify it's template parameter to an empty string if
the call fails. This caused a subsequent mkdir to fail.

Signed-off-by: Patrick Higgins <patrick.higgins@cexp.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoExtend parse-options test suite
Stephan Beyer [Sun, 22 Jun 2008 15:04:26 +0000 (17:04 +0200)]
Extend parse-options test suite

This patch serves two purposes:
 1. test-parse-option.c should be a more complete
    example for the parse-options API, and
 2. there have been no tests for OPT_CALLBACK,
    OPT_DATE, OPT_BIT, OPT_SET_INT and OPT_SET_PTR
    before.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoapi-parse-options.txt: Introduce documentation for parse options API
Stephan Beyer [Sun, 22 Jun 2008 15:04:25 +0000 (17:04 +0200)]
api-parse-options.txt: Introduce documentation for parse options API

Add some documentation of basics, macros and callback
implementation of the parse-options API.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoparse-options.c: fix documentation syntax of optional arguments
Michele Ballabio [Sun, 22 Jun 2008 14:39:04 +0000 (16:39 +0200)]
parse-options.c: fix documentation syntax of optional arguments

When an argument for an option is optional, short options don't need a
space between the option and the argument, and long options need a "=".
Otherwise, arguments are misinterpreted.

Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoapi-builtin.txt: update and fix typo
Stephan Beyer [Sat, 21 Jun 2008 23:54:36 +0000 (01:54 +0200)]
api-builtin.txt: update and fix typo

Mention NEED_WORK_TREE flag and command-list.txt.
Fix "bulit-in" typo and AsciiDoc-formatting of a paragraph.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-rebase.sh: Add check if rebase is in progress
Stephan Beyer [Sun, 22 Jun 2008 14:07:02 +0000 (16:07 +0200)]
git-rebase.sh: Add check if rebase is in progress

"git rebase --continue" and friends gave nonsense errors when there is no
rebase in progress.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>