gitweb.git
git-p4: add test for p4 labelsLuke Diamand Thu, 19 Jan 2012 09:52:28 +0000 (09:52 +0000)

git-p4: add test for p4 labels

Add basic test of p4 label import. Checks label import and
import with shell metachars; labels with different length
descriptions.

Signed-off-by: Luke Diamand <luke@diamand.org>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: importing labels should cope with missing ownerLuke Diamand Thu, 19 Jan 2012 09:52:27 +0000 (09:52 +0000)

git-p4: importing labels should cope with missing owner

In p4, the Owner field is optional. If it is missing,
construct something sensible rather than crashing.

Signed-off-by: Luke Diamand <luke@diamand.org>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: cope with labels with empty descriptionsLuke Diamand Thu, 19 Jan 2012 09:52:26 +0000 (09:52 +0000)

git-p4: cope with labels with empty descriptions

Use an explicit length for the data in a label, rather
than EOT, so that labels with empty descriptions are
passed through correctly.

Signed-off-by: Luke Diamand <luke@diamand.org>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: handle p4 branches and labels containing shell... Luke Diamand Thu, 19 Jan 2012 09:52:25 +0000 (09:52 +0000)

git-p4: handle p4 branches and labels containing shell chars

Don't use shell expansion when detecting branches, as it will
fail if the branch name contains a shell metachar. Similarly
for labels.

Add additional test for branches with shell metachars.

Signed-off-by: Luke Diamand <luke@diamand.org>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

remote-curl: Fix push status report when all branches... Shawn O. Pearce Fri, 20 Jan 2012 03:12:09 +0000 (19:12 -0800)

remote-curl: Fix push status report when all branches fail

The protocol between transport-helper.c and remote-curl requires
remote-curl to always print a blank line after the push command
has run. If the blank line is ommitted, transport-helper kills its
container process (the git push the user started) with exit(128)
and no message indicating a problem, assuming the helper already
printed reasonable error text to the console.

However if the remote rejects all branches with "ng" commands in the
report-status reply, send-pack terminates with non-zero status, and
in turn remote-curl exited with non-zero status before outputting
the blank line after the helper status printed by send-pack. No
error messages reach the user.

This caused users to see the following from git push over HTTP
when the remote side's update hook rejected the branch:

$ git push http://... master
Counting objects: 4, done.
Delta compression using up to 6 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 301 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
$

Always print a blank line after the send-pack process terminates,
ensuring the helper status report (if it was output) will be
correctly parsed by the calling transport-helper.c. This ensures
the helper doesn't abort before the status report can be shown to
the user.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Making pathspec limited log play nicer with --first... Junio C Hamano Thu, 19 Jan 2012 19:58:45 +0000 (11:58 -0800)

Making pathspec limited log play nicer with --first-parent

In a topic branch workflow, you often want to find the latest commit that
merged a side branch that touched a particular area of the system, so that
a new topic branch to work on that area can be forked from that commit.
For example, I wanted to find an appropriate fork-point to queue Luke's
changes related to git-p4 in contrib/fast-import/.

"git log --first-parent" traverses the first-parent chain, and "-m --stat"
shows the list of paths touched by commits including merge commits. We
could ask the question this way:

# What is the latest commit that touched that path?
$ git log --first-parent --oneline -m --stat master |
sed -e '/^ contrib\/fast-import\/git-p4 /q' | tail

The above finds that 8cbfc11 (Merge branch 'pw/p4-view-updates',
2012-01-06) was such a commit.

But a more natural way to spell this question is this:

$ git log --first-parent --oneline -m --stat -1 master -- \
contrib/fast-import/git-p4

Unfortunately, this does not work. It finds ecb7cf9 (git-p4: rewrite view
handling, 2012-01-02). This commit is a part of the merged topic branch
and is _not_ on the first-parent path from the 'master':

$ git show-branch 8cbfc11 ecb7cf9
! [8cbfc11] Merge branch 'pw/p4-view-updates'
! [ecb7cf9] git-p4: rewrite view handling
--
- [8cbfc11] Merge branch 'pw/p4-view-updates'
+ [8cbfc11^2] git-p4: view spec documentation
++ [ecb7cf9] git-p4: rewrite view handling

The problem is caused by the merge simplification logic when it inspects
the merge commit 8cbfc11. In this case, the history leading to the tip of
'master' did not touch git-p4 since 'pw/p4-view-updates' topic forked, and
the result of the merge is simply a copy from the tip of the topic branch
in the view limited by the given pathspec. The merge simplification logic
discards the history on the mainline side of the merge, and pretends as if
the sole parent of the merge is its second parent, i.e. the tip of the
topic. While this simplification is correct in the general case, it is at
least surprising if not outright wrong when the user explicitly asked to
show the first-parent history.

Here is an attempt to fix this issue, by not allowing us to compare the
merge result with anything but the first parent when --first-parent is in
effect, to avoid the history traversal veering off to the side branch.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Git 1.7.9-rc2 v1.7.9-rc2Junio C Hamano Wed, 18 Jan 2012 23:53:35 +0000 (15:53 -0800)

Git 1.7.9-rc2

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'maint'Junio C Hamano Wed, 18 Jan 2012 23:52:08 +0000 (15:52 -0800)

Merge branch 'maint'

* maint:
Git 1.7.8.4
Git 1.7.7.6
diff-index: enable recursive pathspec matching in unpack_trees

Conflicts:
GIT-VERSION-GEN

Git 1.7.8.4 v1.7.8.4Junio C Hamano Wed, 18 Jan 2012 23:51:00 +0000 (15:51 -0800)

Git 1.7.8.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'maint-1.7.7' into maintJunio C Hamano Wed, 18 Jan 2012 23:48:46 +0000 (15:48 -0800)

Merge branch 'maint-1.7.7' into maint

* maint-1.7.7:
Git 1.7.7.6
diff-index: enable recursive pathspec matching in unpack_trees

Conflicts:
GIT-VERSION-GEN

Git 1.7.7.6 v1.7.7.6Junio C Hamano Wed, 18 Jan 2012 23:46:31 +0000 (15:46 -0800)

Git 1.7.7.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>

diff-index: enable recursive pathspec matching in unpac... Nguyen Thai Ngoc Duy Sun, 15 Jan 2012 10:03:27 +0000 (17:03 +0700)

diff-index: enable recursive pathspec matching in unpack_trees

The pathspec structure has a few bits of data to drive various operation
modes after we unified the pathspec matching logic in various codepaths.
For example, max_depth field is there so that "git grep" can limit the
output for files found in limited depth of tree traversal. Also in order
to show just the surface level differences in "git diff-tree", recursive
field stops us from descending into deeper level of the tree structure
when it is set to false, and this also affects pathspec matching when
we have wildcards in the pathspec.

The diff-index has always wanted the recursive behaviour, and wanted to
match pathspecs without any depth limit. But we forgot to do so when we
updated tree_entry_interesting() logic to unify the pathspec matching
logic.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'jc/pull-signed-tag-doc'Junio C Hamano Wed, 18 Jan 2012 23:18:02 +0000 (15:18 -0800)

Merge branch 'jc/pull-signed-tag-doc'

* jc/pull-signed-tag-doc:
pulling signed tag: add howto document

pulling signed tag: add howto documentJunio C Hamano Tue, 17 Jan 2012 22:52:24 +0000 (14:52 -0800)

pulling signed tag: add howto document

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'jk/credentials'Junio C Hamano Wed, 18 Jan 2012 23:16:53 +0000 (15:16 -0800)

Merge branch 'jk/credentials'

* jk/credentials:
credential-cache: ignore "connection refused" errors
unix-socket: do not let close() or chdir() clobber errno during cleanup
credential-cache: report more daemon connection errors
unix-socket: handle long socket pathnames

Merge branch 'nd/pathspec-recursion-cleanup'Junio C Hamano Wed, 18 Jan 2012 23:16:43 +0000 (15:16 -0800)

Merge branch 'nd/pathspec-recursion-cleanup'

* nd/pathspec-recursion-cleanup:
diff-index: enable recursive pathspec matching in unpack_trees
Document limited recursion pathspec matching with wildcards

Merge branch 'mh/maint-show-ref-doc'Junio C Hamano Wed, 18 Jan 2012 23:16:23 +0000 (15:16 -0800)

Merge branch 'mh/maint-show-ref-doc'

* mh/maint-show-ref-doc:
git-show-ref doc: typeset regexp in fixed width font
git-show-ref: fix escaping in asciidoc source

Merge branch 'tr/maint-word-diff-incomplete-line'Junio C Hamano Wed, 18 Jan 2012 23:16:19 +0000 (15:16 -0800)

Merge branch 'tr/maint-word-diff-incomplete-line'

* tr/maint-word-diff-incomplete-line:
word-diff: ignore '\ No newline at eof' marker

test-lib: add the test_pause convenience functionJens Lehmann Tue, 17 Jan 2012 21:04:31 +0000 (22:04 +0100)

test-lib: add the test_pause convenience function

Since 781f76b15 (test-lib: redirect stdin of tests) you can't simply put a
"bash &&" into a test for debugging purposes anymore. Instead you'll have
to use "bash <&6 >&3 2>&4".

As that invocation is not that easy to remember add the test_pause
convenience function. It invokes "$SHELL_PATH" to provide a sane shell
for the user.

This function also checks if the -v flag is given and will error out if
that is not the case instead of letting the test hang until ^D is pressed.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

write_remote_refs(): create packed (rather than extra... Michael Haggerty Tue, 17 Jan 2012 05:50:34 +0000 (06:50 +0100)

write_remote_refs(): create packed (rather than extra) refs

write_remote_refs() creates new packed refs from references obtained
from the remote repository, which is "out of thin air" as far as the
local repository is concerned. Previously it did this by creating
"extra" refs, then calling pack_refs() to bake them into the
packed-refs file. Instead, create packed refs (in the packed
reference cache) directly, then call pack_refs().

Aside from being more logical, this is another step towards removing
extra refs entirely.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

add_packed_ref(): new function in the refs API.Michael Haggerty Tue, 17 Jan 2012 05:50:33 +0000 (06:50 +0100)

add_packed_ref(): new function in the refs API.

Add a new function add_packed_ref() that adds a reference directly to
the in-memory packed reference cache. This will be useful for
creating local references while cloning.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

ref_array: keep track of whether references are sortedMichael Haggerty Tue, 17 Jan 2012 05:50:32 +0000 (06:50 +0100)

ref_array: keep track of whether references are sorted

Keep track of how many entries at the beginning of a ref_array are already
sorted. In sort_ref_array(), return early if the the array is already
sorted (i.e., if no new references has been appended to the end of the
list since the last call to sort_ref_array()).

Sort ref_arrays only when needed, namely in search_ref_array() and in
do_for_each_ref(). However, never call sort_ref_array() on the
extra_refs, because extra_refs can contain multiple entries with the same
name and because sort_ref_array() not only sorts, but de-dups its
contents.

This change is currently not useful, because entries are not added to
ref_arrays after they are created. But in a moment they will be...

Implementation note: we could store a binary "sorted" value instead of
an integer, but storing the number of sorted entries leaves the way
open for a couple of possible future optimizations:

* In sort_ref_array(), sort *only* the unsorted entries, then merge
them with the sorted entries. This should be faster if most of the
entries are already sorted.

* Teach search_ref_array() to do a binary search of any sorted
entries, and if unsuccessful do a linear search of any unsorted
entries. This would avoid the need to sort the list every time that
search_ref_array() is called, and (given some intelligence about how
often to sort) could significantly improve the speed in certain
hypothetical usage patterns.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pack_refs(): remove redundant checkMichael Haggerty Tue, 17 Jan 2012 05:50:31 +0000 (06:50 +0100)

pack_refs(): remove redundant check

handle_one_ref() only adds refs to the cbdata.ref_to_prune list if
(cbdata.flags & PACK_REFS_PRUNE) is set. So any references in this
list at the end of pack_refs() can be pruned unconditionally.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

credential-cache: ignore "connection refused" errorsJeff King Tue, 17 Jan 2012 06:02:32 +0000 (01:02 -0500)

credential-cache: ignore "connection refused" errors

The credential-cache helper will try to connect to its
daemon over a unix socket. Originally, a failure to do so
was silently ignored, and we would either give up (if
performing a "get" or "erase" operation), or spawn a new
daemon (for a "store" operation).

But since 8ec6c8d, we try to report more errors. We detect a
missing daemon by checking for ENOENT on our connection
attempt. If the daemon is missing, we continue as before
(giving up or spawning a new daemon). For any other error,
we die and report the problem.

However, checking for ENOENT is not sufficient for a missing
daemon. We might also get ECONNREFUSED if a dead daemon
process left a stale socket. This generally shouldn't
happen, as the daemon cleans up after itself, but the daemon
may not always be given a chance to do so (e.g., power loss,
"kill -9").

The resulting state is annoying not just because the helper
outputs an extra useless message, but because it actually
blocks the helper from spawning a new daemon to replace the
stale socket.

Fix it by checking for ECONNREFUSED.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'jn/maint-gitweb-grep-fix'Junio C Hamano Tue, 17 Jan 2012 00:45:56 +0000 (16:45 -0800)

Merge branch 'jn/maint-gitweb-grep-fix'

* jn/maint-gitweb-grep-fix:
gitweb: Harden "grep" search against filenames with ':'
gitweb: Fix file links in "grep" search

clone: print advice on checking out detached HEADNguyễn Thái Ngọc Duy Mon, 16 Jan 2012 09:46:16 +0000 (16:46 +0700)

clone: print advice on checking out detached HEAD

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

clone: allow --branch to take a tagNguyễn Thái Ngọc Duy Mon, 16 Jan 2012 09:46:15 +0000 (16:46 +0700)

clone: allow --branch to take a tag

Because a tag ref cannot be put to HEAD, HEAD will become detached.
This is consistent with "git checkout <tag>".

This is mostly useful in shallow clone, where it allows you to clone a
tag in addtion to branches.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

clone: refuse to clone if --branch points to bogus refNguyễn Thái Ngọc Duy Mon, 16 Jan 2012 09:46:14 +0000 (16:46 +0700)

clone: refuse to clone if --branch points to bogus ref

It's possible that users make a typo in the branch name. Stop and let
users recheck. Falling back to remote's HEAD is not documented any
way.

Except when using remote helper, the pack has not been transferred at
this stage yet so we don't waste much bandwidth.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

clone: --branch=<branch> always means refs/heads/<branch>Nguyễn Thái Ngọc Duy Mon, 16 Jan 2012 09:46:13 +0000 (16:46 +0700)

clone: --branch=<branch> always means refs/heads/<branch>

It does not make sense to look outside refs/heads for HEAD's target
(src_ref_prefix can be set to "refs/" if --mirror is used) because ref
code only allows symref in form refs/heads/...

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

clone: delay cloning until after remote HEAD checkingNguyễn Thái Ngọc Duy Mon, 16 Jan 2012 09:46:12 +0000 (16:46 +0700)

clone: delay cloning until after remote HEAD checking

This gives us an opportunity to abort the command during remote HEAD
check without wasting much bandwidth.

Cloning with remote-helper remains before the check because the remote
helper updates mapped_refs, which is necessary for remote ref checks.
foreign_vcs field is used to indicate the transport is handled by
remote helper.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

clone: factor out remote ref writingNguyễn Thái Ngọc Duy Mon, 16 Jan 2012 09:46:11 +0000 (16:46 +0700)

clone: factor out remote ref writing

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

clone: factor out HEAD update codeNguyễn Thái Ngọc Duy Mon, 16 Jan 2012 09:46:10 +0000 (16:46 +0700)

clone: factor out HEAD update code

While at it, update the comment at "if (remote_head)"

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

clone: factor out checkout codeNguyễn Thái Ngọc Duy Mon, 16 Jan 2012 09:46:09 +0000 (16:46 +0700)

clone: factor out checkout code

Read HEAD from disk instead of relying on local variable
our_head_points_at, so that if earlier code fails to make HEAD
properly, it'll be detected.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

clone: write detached HEAD in bare repositoriesNguyễn Thái Ngọc Duy Mon, 16 Jan 2012 09:46:08 +0000 (16:46 +0700)

clone: write detached HEAD in bare repositories

If we don't write, HEAD is still at refs/heads/master as initialized
by init-db, which may or may not match remote's HEAD.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t5601: add missing && cascadeNguyễn Thái Ngọc Duy Mon, 16 Jan 2012 09:46:07 +0000 (16:46 +0700)

t5601: add missing && cascade

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mailinfo: with -b, keep space after [foo]Thomas Rast Mon, 16 Jan 2012 10:53:01 +0000 (11:53 +0100)

mailinfo: with -b, keep space after [foo]

The logic for the -b mode, where [PATCH] is dropped but [foo] is not,
silently ate all spaces after the ].

Fix this by keeping the next isspace() character, if there is any.
Being more thorough is pointless, as the later cleanup_space() call
will normalize any sequence of whitespace to a single ' '.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

am: learn passing -b to mailinfoThomas Rast Mon, 16 Jan 2012 10:53:00 +0000 (11:53 +0100)

am: learn passing -b to mailinfo

git-am could pass -k to mailinfo, but not -b. Introduce an option
that does so. We change the meaning of the 'keep' state file, but are
careful not to cause a problem unless you downgrade in the middle of
an 'am' run.

This uncovers a bug in mailinfo -b, hence the failing test.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

index-pack: eliminate unlimited recursion in get_base_d... Nguyễn Thái Ngọc Duy Sat, 14 Jan 2012 12:19:55 +0000 (19:19 +0700)

index-pack: eliminate unlimited recursion in get_base_data()

Revese the order of delta applying so that by the time a delta is
applied, its base is either non-delta or already inflated.
get_base_data() is still recursive, but because base's data is always
ready, the inner get_base_data() call never has any chance to call
itself again.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

index-pack: eliminate recursion in find_unresolved_deltasNguyễn Thái Ngọc Duy Sat, 14 Jan 2012 12:19:54 +0000 (19:19 +0700)

index-pack: eliminate recursion in find_unresolved_deltas

Current find_unresolved_deltas() links all bases together in a form of
tree, using struct base_data, with prev_base pointer to point to
parent node. Then it traverses down from parent to children in
recursive manner with all base_data allocated on stack.

To eliminate recursion, we simply need to put all on heap
(parse_pack_objects and fix_unresolved_deltas). After that, it's
simple non-recursive depth-first traversal loop. Each node also
maintains its own state (ofs and ref indices) to iterate over all
children nodes.

So we process one node:

- if it returns a new (child) node (a parent base), we link it to our
tree, then process the new node.

- if it returns nothing, the node is done, free it. We go back to
parent node and resume whatever it's doing.

and do it until we have no nodes to process.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Eliminate recursion in setting/clearing marks in commit... Nguyễn Thái Ngọc Duy Sat, 14 Jan 2012 12:19:53 +0000 (19:19 +0700)

Eliminate recursion in setting/clearing marks in commit list

Recursion in a DAG is generally a bad idea because it could be very
deep. Be defensive and avoid recursion in mark_parents_uninteresting()
and clear_commit_marks().

mark_parents_uninteresting() learns a trick from clear_commit_marks()
to avoid malloc() in (dominant) single-parent case.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

diff-index: enable recursive pathspec matching in unpac... Nguyen Thai Ngoc Duy Sun, 15 Jan 2012 10:03:27 +0000 (17:03 +0700)

diff-index: enable recursive pathspec matching in unpack_trees

The pathspec structure has a few bits of data to drive various operation
modes after we unified the pathspec matching logic in various codepaths.
For example, max_depth field is there so that "git grep" can limit the
output for files found in limited depth of tree traversal. Also in order
to show just the surface level differences in "git diff-tree", recursive
field stops us from descending into deeper level of the tree structure
when it is set to false, and this also affects pathspec matching when
we have wildcards in the pathspec.

The diff-index has always wanted the recursive behaviour, and wanted to
match pathspecs without any depth limit. But we forgot to do so when we
updated tree_entry_interesting() logic to unify the pathspec matching
logic.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Document limited recursion pathspec matching with wildcardsNguyễn Thái Ngọc Duy Sat, 14 Jan 2012 09:23:22 +0000 (16:23 +0700)

Document limited recursion pathspec matching with wildcards

It's actually unlimited recursion if wildcards are active regardless
--max-depth

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-show-ref doc: typeset regexp in fixed width fontMichael Haggerty Fri, 13 Jan 2012 16:39:16 +0000 (17:39 +0100)

git-show-ref doc: typeset regexp in fixed width font

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-show-ref: fix escaping in asciidoc sourceMichael Haggerty Fri, 13 Jan 2012 16:39:15 +0000 (17:39 +0100)

git-show-ref: fix escaping in asciidoc source

Two "^" characters were incorrectly being interpreted as markup for
superscripting. Fix them by writing them as attribute references
"{caret}".

Although a single "^" character in a paragraph cannot be
misinterpreted in this way, also write other "^" characters as
"{caret}" in the interest of good hygiene (unless they are in literal
paragraphs, of course, in which context attribute references are not
recognized).

Spell "{}" consistently, namely *not* quoted as "\{\}". Since the
braces are empty, they cannot be interpreted as an attribute
reference, and either spelling is OK. So arbitrarily choose one
variation and use it consistently.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Git 1.7.9-rc1 v1.7.9-rc1Junio C Hamano Fri, 13 Jan 2012 07:43:28 +0000 (23:43 -0800)

Git 1.7.9-rc1

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'jc/request-pull-show-head-4'Junio C Hamano Fri, 13 Jan 2012 07:34:30 +0000 (23:34 -0800)

Merge branch 'jc/request-pull-show-head-4'

* jc/request-pull-show-head-4:
request-pull: use the real fork point when preparing the message

Merge branch 'tr/maint-mailinfo'Junio C Hamano Fri, 13 Jan 2012 07:34:26 +0000 (23:34 -0800)

Merge branch 'tr/maint-mailinfo'

* tr/maint-mailinfo:
mailinfo documentation: accurately describe non -k case

Merge branch 'ss/maint-msys-cvsexportcommit'Junio C Hamano Fri, 13 Jan 2012 07:34:21 +0000 (23:34 -0800)

Merge branch 'ss/maint-msys-cvsexportcommit'

* ss/maint-msys-cvsexportcommit:
git-cvsexportcommit: Fix calling Perl's rel2abs() on MSYS
t9200: On MSYS, do not pass Windows-style paths to CVS

Merge branch 'jk/maint-upload-archive'Junio C Hamano Fri, 13 Jan 2012 07:34:17 +0000 (23:34 -0800)

Merge branch 'jk/maint-upload-archive'

* jk/maint-upload-archive:
archive: re-allow HEAD:Documentation on a remote invocation

Merge branch 'maint'Junio C Hamano Fri, 13 Jan 2012 07:33:39 +0000 (23:33 -0800)

Merge branch 'maint'

* maint:
Update draft release notes to 1.7.8.4
Update draft release notes to 1.7.7.6
Update draft release notes to 1.7.6.6
thin-pack: try harder to use preferred base objects as base

Update draft release notes to 1.7.8.4Junio C Hamano Fri, 13 Jan 2012 07:33:29 +0000 (23:33 -0800)

Update draft release notes to 1.7.8.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'maint-1.7.7' into maintJunio C Hamano Fri, 13 Jan 2012 07:31:46 +0000 (23:31 -0800)

Merge branch 'maint-1.7.7' into maint

* maint-1.7.7:
Update draft release notes to 1.7.7.6
Update draft release notes to 1.7.6.6
thin-pack: try harder to use preferred base objects as base

Update draft release notes to 1.7.7.6Junio C Hamano Fri, 13 Jan 2012 07:31:41 +0000 (23:31 -0800)

Update draft release notes to 1.7.7.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'maint-1.7.6' into maint-1.7.7Junio C Hamano Fri, 13 Jan 2012 07:31:05 +0000 (23:31 -0800)

Merge branch 'maint-1.7.6' into maint-1.7.7

* maint-1.7.6:
Update draft release notes to 1.7.6.6
thin-pack: try harder to use preferred base objects as base

Update draft release notes to 1.7.6.6Junio C Hamano Fri, 13 Jan 2012 07:30:53 +0000 (23:30 -0800)

Update draft release notes to 1.7.6.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>

thin-pack: try harder to use preferred base objects... Jeff King Thu, 12 Jan 2012 22:32:34 +0000 (17:32 -0500)

thin-pack: try harder to use preferred base objects as base

When creating a pack using objects that reside in existing packs, we try
to avoid recomputing futile delta between an object (trg) and a candidate
for its base object (src) if they are stored in the same packfile, and trg
is not recorded as a delta already. This heuristics makes sense because it
is likely that we tried to express trg as a delta based on src but it did
not produce a good delta when we created the existing pack.

As the pack heuristics prefer producing delta to remove data, and Linus's
law dictates that the size of a file grows over time, we tend to record
the newest version of the file as inflated, and older ones as delta
against it.

When creating a thin-pack to transfer recent history, it is likely that we
will try to send an object that is recorded in full, as it is newer. But
the heuristics to avoid recomputing futile delta effectively forbids us
from attempting to express such an object as a delta based on another
object. Sending an object in full is often more expensive than sending a
suboptimal delta based on other objects, and it is even more so if we
could use an object we know the receiving end already has (i.e. preferred
base object) as the delta base.

Tweak the recomputation avoidance logic, so that we do not punt on
computing delta against a preferred base object.

The effect of this change can be seen on two simulated upload-pack
workloads. The first is based on 44 reflog entries from my git.git
origin/master reflog, and represents the packs that kernel.org sent me git
updates for the past month or two. The second workload represents much
larger fetches, going from git's v1.0.0 tag to v1.1.0, then v1.1.0 to
v1.2.0, and so on.

The table below shows the average generated pack size and the average CPU
time consumed for each dataset, both before and after the patch:

dataset
| reflog | tags
---------------------------------
before | 53358 | 2750977
size after | 32398 | 2668479
change | -39% | -3%
---------------------------------
before | 0.18 | 1.12
CPU after | 0.18 | 1.15
change | +0% | +3%

This patch makes a much bigger difference for packs with a shorter slice
of history (since its effect is seen at the boundaries of the pack) though
it has some benefit even for larger packs.

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

word-diff: ignore '\ No newline at eof' markerThomas Rast Thu, 12 Jan 2012 11:15:33 +0000 (12:15 +0100)

word-diff: ignore '\ No newline at eof' marker

The word-diff logic accumulates + and - lines until another line type
appears (normally [ @\]), at which point it generates the word diff.
This is usually correct, but it breaks when the preimage does not have
a newline at EOF:

$ printf "%s" "a a a" >a
$ printf "%s\n" "a ab a" >b
$ git diff --no-index --word-diff a b
diff --git 1/a 2/b
index 9f68e94..6a7c02f 100644
--- 1/a
+++ 2/b
@@ -1 +1 @@
[-a a a-]
No newline at end of file
{+a ab a+}

Because of the order of the lines in a unified diff

@@ -1 +1 @@
-a a a
\ No newline at end of file
+a ab a

the '\' line flushed the buffers, and the - and + lines were never
matched with each other.

A proper fix would defer such markers until the end of the hunk.
However, word-diff is inherently whitespace-ignoring, so as a cheap
fix simply ignore the marker (and hide it from the output).

We use a prefix match for '\ ' to parallel the logic in
apply.c:parse_fragment(). We currently do not localize this string
(just accept other variants of it in git-apply), but this should be
future-proof.

Noticed-by: Ivan Shirokoff <shirokoff@yandex-team.ru>
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

archive: re-allow HEAD:Documentation on a remote invocationCarlos Martín Nieto Wed, 11 Jan 2012 12:12:38 +0000 (13:12 +0100)

archive: re-allow HEAD:Documentation on a remote invocation

The tightening done in (ee27ca4a: archive: don't let remote clients
get unreachable commits, 2011-11-17) went too far and disallowed
HEAD:Documentation as it would try to find "HEAD:Documentation" as a
ref.

Only DWIM the "HEAD" part to see if it exists as a ref. Once we're
sure that we've been given a valid ref, we follow the normal code
path. This still disallows attempts to access commits which are not
branch tips.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'maint'Junio C Hamano Thu, 12 Jan 2012 03:11:28 +0000 (19:11 -0800)

Merge branch 'maint'

* maint:
attr: fix leak in free_attr_elem
t2203: fix wrong commit command

Merge branch 'maint-1.7.7' into maintJunio C Hamano Thu, 12 Jan 2012 03:11:13 +0000 (19:11 -0800)

Merge branch 'maint-1.7.7' into maint

* maint-1.7.7:
attr: fix leak in free_attr_elem
t2203: fix wrong commit command

Merge branch 'maint-1.7.6' into maint-1.7.7Junio C Hamano Thu, 12 Jan 2012 03:11:00 +0000 (19:11 -0800)

Merge branch 'maint-1.7.6' into maint-1.7.7

* maint-1.7.6:
attr: fix leak in free_attr_elem
t2203: fix wrong commit command

attr: fix leak in free_attr_elemJeff King Thu, 12 Jan 2012 03:05:03 +0000 (22:05 -0500)

attr: fix leak in free_attr_elem

This function frees the individual "struct match_attr"s we
have allocated, but forgot to free the array holding their
pointers, leading to a minor memory leak (but it can add up
after checking attributes for paths in many directories).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sequencer: factor code out of revert builtinRamkumar Ramachandra Wed, 11 Jan 2012 18:15:57 +0000 (23:45 +0530)

sequencer: factor code out of revert builtin

Expose the cherry-picking machinery through a public
sequencer_pick_revisions() (renamed from pick_revisions() in
builtin/revert.c), so that cherry-picking and reverting are special
cases of a general sequencer operation. The cherry-pick builtin is
now a thin wrapper that does command-line argument parsing before
calling into sequencer_pick_revisions(). In the future, we can write
a new "foo" builtin that calls into the sequencer like:

memset(&opts, 0, sizeof(opts));
opts.action = REPLAY_FOO;
opts.revisions = xmalloc(sizeof(*opts.revs));
parse_args_populate_opts(argc, argv, &opts);
init_revisions(opts.revs);
sequencer_pick_revisions(&opts);

This patch does not intend to make any functional changes. Check
with:

$ git blame -s -C HEAD^..HEAD -- sequencer.c | grep -C3 '^[^^]'

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

revert: prepare to move replay_action to headerRamkumar Ramachandra Wed, 11 Jan 2012 18:15:56 +0000 (23:45 +0530)

revert: prepare to move replay_action to header

REVERT and CHERRY_PICK and are unsuitable names for an enumerator in a
public interface, because they are generic enough to be likely to
clash with identifiers with other meanings. Rename to REPLAY_REVERT
and REPLAY_PICK as preparation for exposing them.

Helped-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-cvsexportcommit: Fix calling Perl's rel2abs() on... Sebastian Schuberth Wed, 11 Jan 2012 09:21:10 +0000 (10:21 +0100)

git-cvsexportcommit: Fix calling Perl's rel2abs() on MSYS

Due to MSYS path mangling GIT_DIR contains a Windows-style path when
checked inside a Perl script even if GIT_DIR was previously set to an
MSYS-style path in a shell script. So explicitly convert to an MSYS-style
path before calling Perl's rel2abs() to make it work.

This fix was inspired by a very similar patch in WebKit:

http://trac.webkit.org/changeset/76255/trunk/Tools/Scripts/commit-log-editor

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Tested-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t9200: On MSYS, do not pass Windows-style paths to CVSSebastian Schuberth Wed, 11 Jan 2012 09:20:14 +0000 (10:20 +0100)

t9200: On MSYS, do not pass Windows-style paths to CVS

For details, see the commit message of 4114156ae9. Note that while using
$PWD as part of GIT_DIR is not required here, it does no harm and it is
more consistent. In addition, on MSYS using an environment variable should
be slightly faster than spawning an external executable.

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

unix-socket: do not let close() or chdir() clobber... Jonathan Nieder Wed, 11 Jan 2012 23:50:10 +0000 (17:50 -0600)

unix-socket: do not let close() or chdir() clobber errno during cleanup

unix_stream_connect and unix_stream_listen return -1 on error, with
errno set by the failing underlying call to allow the caller to write
a useful diagnosis.

Unfortunately the error path involves a few system calls itself, such
as close(), that can themselves touch errno.

This is not as worrisome as it might sound. If close() fails, this
just means substituting one meaningful error message for another,
which is perfectly fine. However, when the call _succeeds_, it is
allowed to (and sometimes might) clobber errno along the way with some
undefined value, so it is good higiene to save errno and restore it
immediately before returning to the caller. Do so.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mailinfo documentation: accurately describe non -k... Thomas Rast Wed, 11 Jan 2012 20:13:42 +0000 (21:13 +0100)

mailinfo documentation: accurately describe non -k case

Since its very first description of -k, the documentation for
git-mailinfo claimed that (in the case without -k) after cleaning up
bracketed strings [blah], it would insert [PATCH].

It doesn't; on the contrary, one of the important jobs of mailinfo is
to remove those strings.

Since we're already there, rewrite the paragraph to give a complete
enumeration of all the transformations. Specifically, it was missing
the whitespace normalization (run of isspace(c) -> ' ') and the
removal of leading ':'.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: add tests demonstrating spec overlay ambiguitiesPete Wyckoff Wed, 11 Jan 2012 23:31:10 +0000 (18:31 -0500)

git-p4: add tests demonstrating spec overlay ambiguities

Introduce new tests that look more closely at overlay situations
when there are conflicting files. Five of these are broken.
Document the brokenness.

This is a fundamental problem with how git-p4 only "borrows" a
client spec. At some sync operation, a new change can contain
a file which is already in the repo or explicitly deleted through
another mapping. To sort this out would involve listing all the
files in the client spec to find one with a higher priority.
While this is not too hard for the initial import, subsequent
sync operations would be very costly.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: adjust test to adhere to stricter useClientSpecPete Wyckoff Wed, 11 Jan 2012 23:31:09 +0000 (18:31 -0500)

git-p4: adjust test to adhere to stricter useClientSpec

This test relied on what now is seen as broken behavior
in --use-client-spec. Change it to make sure it works
according to the new behavior as described in
ecb7cf9 (git-p4: rewrite view handling, 2012-01-02) and
c700b68 (git-p4: test client view handling, 2012-01-02).

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: clarify commentPete Wyckoff Wed, 11 Jan 2012 23:31:08 +0000 (18:31 -0500)

git-p4: clarify comment

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: fix verbose comment typoPete Wyckoff Wed, 11 Jan 2012 23:31:07 +0000 (18:31 -0500)

git-p4: fix verbose comment typo

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: only a single ... wildcard is supportedPete Wyckoff Wed, 11 Jan 2012 23:31:06 +0000 (18:31 -0500)

git-p4: only a single ... wildcard is supported

Catch the case where a ... exists at the end, and also elsehwere.

Reported-by: Gary Gibbons <ggibbons@perforce.com>
Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Fix incorrect ref namespace checkNguyễn Thái Ngọc Duy Thu, 5 Jan 2012 12:39:40 +0000 (19:39 +0700)

Fix incorrect ref namespace check

The reason why the trailing slash is needed is obvious. refs/stash and
HEAD are not namespace, but complete refs. Do full string compare on them.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t2203: fix wrong commit commandNguyễn Thái Ngọc Duy Wed, 11 Jan 2012 03:21:38 +0000 (10:21 +0700)

t2203: fix wrong commit command

Add commit message to avoid commit's aborting due to the lack of
commit message, not because there are INTENT_TO_ADD entries in index.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

request-pull: use the real fork point when preparing... Junio C Hamano Wed, 11 Jan 2012 05:45:52 +0000 (21:45 -0800)

request-pull: use the real fork point when preparing the message

The command takes the "start" argument and computes the merge base
between it and the commit to be pulled so that we can show the diffstat,
but uses the "start" argument as-is when composing the message

The following changes since commit $X are available

to tell the integrator which commit the work is based on. Giving "origin"
(most of the time it resolves to refs/remotes/origin/master) as the start
argument is often convenient, but it is usually not the fork point, and
does not help the integrator at all.

Use the real fork point, which is the merge base we already compute, when
composing that part of the message.

Suggested-by: Linus Torvalds
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'bw/maint-t8006-sed-incomplete-line'Junio C Hamano Tue, 10 Jan 2012 22:46:52 +0000 (14:46 -0800)

Merge branch 'bw/maint-t8006-sed-incomplete-line'

* bw/maint-t8006-sed-incomplete-line:
Use perl instead of sed for t8006-blame-textconv test

Sync with maintJunio C Hamano Tue, 10 Jan 2012 22:46:22 +0000 (14:46 -0800)

Sync with maint

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Prepare for 1.7.8.4Junio C Hamano Tue, 10 Jan 2012 22:27:14 +0000 (14:27 -0800)

Prepare for 1.7.8.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge the attributes fix in from maint-1.6.7 branchJunio C Hamano Tue, 10 Jan 2012 22:24:01 +0000 (14:24 -0800)

Merge the attributes fix in from maint-1.6.7 branch

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Prepare for 1.7.7.6Junio C Hamano Tue, 10 Jan 2012 22:16:49 +0000 (14:16 -0800)

Prepare for 1.7.7.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge the attributes fix in from maint-1.6.6 branchJunio C Hamano Tue, 10 Jan 2012 22:14:26 +0000 (14:14 -0800)

Merge the attributes fix in from maint-1.6.6 branch

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Prepare for 1.7.6.6Junio C Hamano Tue, 10 Jan 2012 21:11:03 +0000 (13:11 -0800)

Prepare for 1.7.6.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation: rerere's rr-cache auto-creation and... Junio C Hamano Tue, 10 Jan 2012 14:57:27 +0000 (15:57 +0100)

Documentation: rerere's rr-cache auto-creation and rerere.enabled

The description of rerere.enabled left the user in the dark as to who
might create an rr-cache directory. Add a note that simply invoking
rerere does this.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

attr.c: clarify the logic to pop attr_stackJunio C Hamano Tue, 10 Jan 2012 20:28:38 +0000 (12:28 -0800)

attr.c: clarify the logic to pop attr_stack

Signed-off-by: Junio C Hamano <gitster@pobox.com>

attr.c: make bootstrap_attr_stack() leave earlyJunio C Hamano Tue, 10 Jan 2012 20:27:37 +0000 (12:27 -0800)

attr.c: make bootstrap_attr_stack() leave early

Thas would de-dent the body of a function that has grown rather large over
time, making it a bit easier to read.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

attr: drop misguided defensive codingJeff King Tue, 10 Jan 2012 19:32:06 +0000 (14:32 -0500)

attr: drop misguided defensive coding

In prepare_attr_stack, we pop the old elements of the stack
(which were left from a previous lookup and may or may not
be useful to us). Our loop to do so checks that we never
reach the top of the stack. However, the code immediately
afterwards will segfault if we did actually reach the top of
the stack.

Fortunately, this is not an actual bug, since we will never
pop all of the stack elements (we will always keep the root
gitattributes, as well as the builtin ones). So the extra
check in the loop condition simply clutters the code and
makes the intent less clear. Let's get rid of it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

attr: don't confuse prefixes with leading directoriesJeff King Tue, 10 Jan 2012 18:08:21 +0000 (13:08 -0500)

attr: don't confuse prefixes with leading directories

When we prepare the attribute stack for a lookup on a path,
we start with the cached stack from the previous lookup
(because it is common to do several lookups in the same
directory hierarchy). So the first thing we must do in
preparing the stack is to pop any entries that point to
directories we are no longer interested in.

For example, if our stack contains gitattributes for:

foo/bar/baz
foo/bar
foo

but we want to do a lookup in "foo/bar/bleep", then we want
to pop the top element, but retain the others.

To do this we walk down the stack from the top, popping
elements that do not match our lookup directory. However,
the test do this simply checked strncmp, meaning we would
mistake "foo/bar/baz" as a leading directory of
"foo/bar/baz_plus". We must also check that the character
after our match is '/', meaning we matched the whole path
component.

There are two special cases to consider:

1. The top of our attr stack has the empty path. So we
must not check for '/', but rather special-case the
empty path, which always matches.

2. Typically when matching paths in this way, you would
also need to check for a full string match (i.e., the
character after is '\0'). We don't need to do so in
this case, though, because our path string is actually
just the directory component of the path to a file
(i.e., we know that it terminates with "/", because the
filename comes after that).

Helped-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

credential-cache: report more daemon connection errorsJeff King Tue, 10 Jan 2012 04:57:33 +0000 (23:57 -0500)

credential-cache: report more daemon connection errors

Originally, this code remained relatively silent when we
failed to connect to the cache. The idea was that it was
simply a cache, and we didn't want to bother the user with
temporary failures (the worst case is that we would simply
ask their password again).

However, if you have a configuration failure or other
problem, it is helpful for the daemon to report those
problems. Git will happily ignore the failed error code, but
the extra information to stderr can help the user diagnose
the problem.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

unix-socket: handle long socket pathnamesJeff King Tue, 10 Jan 2012 04:44:30 +0000 (23:44 -0500)

unix-socket: handle long socket pathnames

On many systems, the sockaddr_un.sun_path field is quite
small. Even on Linux, it is only 108 characters. A user of
the credential-cache daemon can easily surpass this,
especially if their home directory is in a deep directory
tree (since the default location expands ~/.git-credentials).

We can hack around this in the unix-socket.[ch] code by
doing a chdir() to the enclosing directory, feeding the
relative basename to the socket functions, and then
restoring the working directory.

This introduces several new possible error cases for
creating a socket, including an irrecoverable one in the
case that we can't restore the working directory. In the
case of the credential-cache code, we could perhaps get away
with simply chdir()-ing to the socket directory and never
coming back. However, I'd rather do it at the lower level
for a few reasons:

1. It keeps the hackery behind an opaque interface instead
of polluting the main program logic.

2. A hack in credential-cache won't help any unix-socket
users who come along later.

3. The chdir trickery isn't that likely to fail (basically
it's only a problem if your cwd is missing or goes away
while you're running). And because we only enable the
hack when we get a too-long name, it can only fail in
cases that would have failed under the previous code
anyway.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Use perl instead of sed for t8006-blame-textconv testBen Walton Tue, 10 Jan 2012 02:47:33 +0000 (21:47 -0500)

Use perl instead of sed for t8006-blame-textconv test

In test 'blame --textconv with local changes' of t8006-blame-textconv,
using /usr/xpg4/bin/sed (as set by SANE_TOOL_PATH), an additional
newline was added to the output from the 'helper' script.

This was noted by sed with a message such as:
sed: Missing newline at end of file zero.bin.

Sed then exits with status 2 causing the helper script to also exit
with status 2.

In turn, this was triggering a fatal error from git blame:
fatal: unable to read files to diff

To work around this difference in sed behaviour, use perl -p instead
of sed -e as it exits cleanly and does not insert the additional
newline.

Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'jk/credentials'Junio C Hamano Mon, 9 Jan 2012 23:58:47 +0000 (15:58 -0800)

Merge branch 'jk/credentials'

* jk/credentials:
credentials: unable to connect to cache daemon

Merge branch 'mh/ref-api-less-extra-refs'Junio C Hamano Mon, 9 Jan 2012 23:58:43 +0000 (15:58 -0800)

Merge branch 'mh/ref-api-less-extra-refs'

* mh/ref-api-less-extra-refs:
write_head_info(): handle "extra refs" locally
show_ref(): remove unused "flag" and "cb_data" arguments
receive-pack: move more work into write_head_info()

Merge branch 'mm/maint-gitweb-project-maxdepth'Junio C Hamano Mon, 9 Jan 2012 23:58:30 +0000 (15:58 -0800)

Merge branch 'mm/maint-gitweb-project-maxdepth'

* mm/maint-gitweb-project-maxdepth:
gitweb: accept trailing "/" in $project_list

Merge branch 'maint'Junio C Hamano Mon, 9 Jan 2012 23:56:58 +0000 (15:56 -0800)

Merge branch 'maint'

* maint:
send-email: multiedit is a boolean config option

send-email: multiedit is a boolean config optionJeff King Mon, 9 Jan 2012 22:55:42 +0000 (17:55 -0500)

send-email: multiedit is a boolean config option

The sendemail.multiedit variable is meant to be a boolean.
However, it is not marked as such in the code, which means
we store its value literally. Thus in the do_edit function,
perl ends up coercing it to a boolean value according to
perl rules, not git rules. This works for "0", but "false",
"no", or "off" will erroneously be interpreted as true.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

gitweb: Fix actionless dispatch for non-existent objectsJakub Narebski Sat, 7 Jan 2012 10:47:38 +0000 (11:47 +0100)

gitweb: Fix actionless dispatch for non-existent objects

When gitweb URL does not provide action explicitly, e.g.

http://git.example.org/repo.git/branch

dispatch() tries to guess action (view to be used) based on remaining
parameters. Among others it is based on the type of requested object,
which gave problems when asking for non-existent branch or file (for
example misspelt name).

Now undefined $action from dispatch() should not result in problems.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-daemon tests: wait until daemon is readyClemens Buchacher Sat, 7 Jan 2012 11:42:47 +0000 (12:42 +0100)

git-daemon tests: wait until daemon is ready

In start_daemon, git-daemon is started as a background process. In
theory, the tests may try to connect before the daemon had a chance
to open a listening socket. Avoid this race condition by waiting
for it to output "Ready to rumble". Any other output is considered
an error and the test is aborted.

Should git-daemon produce no output at all, lib-git-daemon would
block forever. This could be fixed by introducing a timeout. On
the other hand, we have no timeout for other git commands which
could suffer from the same problem. Since such a mechanism adds
some complexity, I have decided against it.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-daemon: produce output when readyClemens Buchacher Sat, 7 Jan 2012 11:42:46 +0000 (12:42 +0100)

git-daemon: produce output when ready

If a client tries to connect after git-daemon starts, but before it
opens a listening socket, the connection will fail. Output "[PID]
Ready to rumble]" after opening the socket successfully in order to
inform the user that the daemon is now ready to receive
connections.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-daemon: add testsClemens Buchacher Sat, 7 Jan 2012 11:42:45 +0000 (12:42 +0100)

git-daemon: add tests

The semantics of the git daemon tests are similar to the http transport
tests. In fact, they are only a slightly modified copy of t5550, plus the
newly added remote error tests.

All git-daemon tests will be skipped unless the environment variable
GIT_TEST_GIT_DAEMON is set.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>