git
12 years agobisect: take advantage of gettextln, eval_gettextln.
Jon Seymour [Tue, 30 Aug 2011 23:09:47 +0000 (09:09 +1000)] 
bisect: take advantage of gettextln, eval_gettextln.

Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'maint'
Junio C Hamano [Tue, 30 Aug 2011 19:35:51 +0000 (12:35 -0700)] 
Merge branch 'maint'

* maint:
  Documentation: clarify effects of -- <path> arguments

12 years agoSymlink mergetools scriptlets into valgrind wrappers
Thomas Rast [Tue, 30 Aug 2011 00:47:36 +0000 (02:47 +0200)] 
Symlink mergetools scriptlets into valgrind wrappers

Since bc7a96a (mergetool--lib: Refactor tools into separate files,
2011-08-18) the mergetools and difftools related tests fail under
--valgrind because the mergetools/* scriptlets are not in the exec
path.

For now, symlink the mergetools subdir into the t/valgrind/bin
directory as a whole, since it does not contain anything of interest
to the valgrind wrappers.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agogrep: Fix race condition in delta_base_cache
Nicolas Morey-Chaisemartin [Tue, 30 Aug 2011 13:45:38 +0000 (15:45 +0200)] 
grep: Fix race condition in delta_base_cache

When running large git grep (ie: git grep regexp $(git rev-list --all)), glibc error sometimes occur:
*** glibc detected *** git: double free or corruption (!prev): 0x00000000010abdf0 ***

According to gdb the problem originate from release_delta_cash (sha1_file.c:1703)
free(ent->data);

>From my analysis it seems that git grep threads do acquire lock before calling read_sha1_file but not before calling
read_object_with_reference who ends up calling read_sha1_file too.

Adding the lock around read_object_with_reference seems to fix the issue for me.
I've ran git grep about a dozen time and seen no more error while
it usually happened half the time before.

Signed-off-by: Nicolas Morey-Chaisemartin <nicolas@morey-chaisemartin.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agot3903: fix misquoted rev-parse invocation
Thomas Rast [Tue, 30 Aug 2011 00:06:07 +0000 (02:06 +0200)] 
t3903: fix misquoted rev-parse invocation

!"git ..." hopefully always succeeds because "git ..." is not the name
of any executable.  However, that's not what was intended.  Unquote
it, and while we're at it, also replace ! with test_must_fail since it
is a call to git.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Acked-by: Jon Seymour <jon.seymour@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoDocumentation: clarify effects of -- <path> arguments
Thomas Rast [Tue, 30 Aug 2011 09:21:07 +0000 (11:21 +0200)] 
Documentation: clarify effects of -- <path> arguments

'git log -- <path>' does not "show commits that affect the specified
paths" in a literal sense unless --full-history is given (for example,
a file that only existed on a side branch will turn up no commits at
all!).

Reword it to specify the actual intent of the filtering, and point to
the "History Simplification" section.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoDocumentation/remote-helpers: explain capabilities first
Jonathan Nieder [Tue, 30 Aug 2011 03:56:08 +0000 (22:56 -0500)] 
Documentation/remote-helpers: explain capabilities first

The current remote helper documentation is from the perspective of
git, so to speak: it presents a full menu of commands for a person
invoking a remote helper to choose from.  In practice, that's less
useful than it could be, since the daunted novice remote-helper author
probably just wanted a list of commands needs to implement to get
started.  So preface the command list with an overview of each
capability, its purpose, and what commands it requires.

As a side effect, this makes it a little clearer that git doesn't
choose arbitrary commands to run, even if the remote helper advertises
all capabilities --- instead, there are well defined command sequences
for various tasks.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agostrbuf_grow(): maintain nul-termination even for new buffer
Thomas Rast [Mon, 29 Aug 2011 21:16:12 +0000 (23:16 +0200)] 
strbuf_grow(): maintain nul-termination even for new buffer

In the case where sb is initialized to the slopbuf (through
strbuf_init(sb,0) or STRBUF_INIT), strbuf_grow() loses the terminating
nul: it grows the buffer, but gives ALLOC_GROW a NULL source to avoid
it being freed.  So ALLOC_GROW does not copy anything to the new
memory area.

This subtly broke the call to strbuf_getline in read_next_command()
[fast-import.c:1855], which goes

    strbuf_detach(&command_buf, NULL);  # command_buf is now = STRBUF_INIT
    stdin_eof = strbuf_getline(&command_buf, stdin, '\n');
    if (stdin_eof)
            return EOF;

In strbuf_getwholeline, this did

    strbuf_grow(sb, 0);  # loses nul-termination
    if (feof(fp))
            return EOF;
    strbuf_reset(sb);    # this would have nul-terminated!

Valgrind found this because fast-import subsequently uses prefixcmp()
on command_buf.buf, which after the EOF exit contains only
uninitialized memory.

Arguably strbuf_getwholeline is also broken, in that it touches the
buffer before deciding whether to do any work.  However, it seems more
futureproof to not let the strbuf API lose the nul-termination by its
own fault.

So make sure that strbuf_grow() puts in a nul even if it has nowhere
to copy it from.  This makes strbuf_grow(sb, 0) a semantic no-op as
far as readers of the buffer are concerned.

Also remove the nul-termination added by strbuf_init, which is made
redudant.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoDocument negated forms of format-patch --to --cc --add-headers
Thomas Rast [Mon, 29 Aug 2011 20:10:49 +0000 (22:10 +0200)] 
Document negated forms of format-patch --to --cc --add-headers

The negated forms introduced in c426003 (format-patch: add --no-cc,
--no-to, and --no-add-headers, 2010-03-07) were not documented
anywhere.  Add them to the descriptions of the positive forms.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agot4014: "no-add-headers" is actually called "no-add-header"
Thomas Rast [Mon, 29 Aug 2011 20:10:48 +0000 (22:10 +0200)] 
t4014: "no-add-headers" is actually called "no-add-header"

Since c426003 (format-patch: add --no-cc, --no-to, and
--no-add-headers, 2010-03-07) the tests have checked for an option
called --no-add-headers introduced by letting the user negate
--add-header.

However, the parseopt machinery does not automatically pluralize
anything, so it is in fact called --no-add-header.

Since the option never worked, is not documented anywhere, and
implementing an actual --no-add-headers would lead to silly code
complications, we just adapt the test to the code.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agot4014: invoke format-patch with --stdout where intended
Thomas Rast [Mon, 29 Aug 2011 20:10:47 +0000 (22:10 +0200)] 
t4014: invoke format-patch with --stdout where intended

The test wrote something along the lines of 0001-foo.patch to output,
which of course never contained a signature.  Luckily the tested
behaviour is actually present.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agot4014: check for empty files from git format-patch --stdout
Thomas Rast [Mon, 29 Aug 2011 20:10:46 +0000 (22:10 +0200)] 
t4014: check for empty files from git format-patch --stdout

Most kinds of failure in 'git format-patch --stdout >output' will
result in an empty 'output'.  This slips past checks that only verify
absence of output, such as the '! grep ...' that are quite prevalent
in t4014.

Introduce a helper check_patch() that checks that at least From, Date
and Subject are present, thus making sure it looks vaguely like a
patch (or cover letter) email.  Then insert calls to it in all tests
that do have positive checks for content.

This makes two of the tests fail.  Mark them as such; they'll be
fixed in a moment.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoUse memmove in ident_to_git
Thomas Rast [Mon, 29 Aug 2011 20:06:04 +0000 (22:06 +0200)] 
Use memmove in ident_to_git

convert_to_git sets src=dst->buf if any of the preceding conversions
actually did any work.  Thus in ident_to_git we have to use memmove
instead of memcpy as far as src->dst copying is concerned.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agodiff-index: pass pathspec down to unpack-trees machinery
Junio C Hamano [Mon, 29 Aug 2011 20:34:08 +0000 (13:34 -0700)] 
diff-index: pass pathspec down to unpack-trees machinery

And finally, pass the pathspec down through unpack_trees() to traverse_trees()
callchain.

Before and after applying this series, looking for changes in the kernel
repository with a fairly narrow pathspec becomes somewhat faster.

  (without patch)
  $ /usr/bin/time git diff --raw v2.6.27 -- net/ipv6 >/dev/null
  0.48user 0.05system 0:00.53elapsed 100%CPU (0avgtext+0avgdata 163296maxresident)k
  0inputs+952outputs (0major+11163minor)pagefaults 0swaps

  (with patch)
  $ /usr/bin/time git diff --raw v2.6.27 -- net/ipv6 >/dev/null
  0.01user 0.00system 0:00.02elapsed 104%CPU (0avgtext+0avgdata 43856maxresident)k
  0inputs+24outputs (0major+3688minor)pagefaults 0swaps

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agounpack-trees: allow pruning with pathspec
Junio C Hamano [Mon, 29 Aug 2011 19:31:06 +0000 (12:31 -0700)] 
unpack-trees: allow pruning with pathspec

Use the pathspec pruning of traverse_trees() from unpack_trees(). Again,
the unpack_trees() machinery is primarily meant for merging two (or more)
trees, and because a merge is a full tree operation, it didn't support any
pruning with pathspec, and this codepath probably should not be enabled
while running a merge, but the caller in diff-lib.c::diff_cache() should
be able to take advantage of it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agotraverse_trees(): allow pruning with pathspec
Junio C Hamano [Mon, 29 Aug 2011 19:26:05 +0000 (12:26 -0700)] 
traverse_trees(): allow pruning with pathspec

The traverse_trees() machinery is primarily meant for merging two (or
more) trees, and because a merge is a full tree operation, it doesn't
support any pruning with pathspec.

Since d1f2d7e (Make run_diff_index() use unpack_trees(), not read_tree(),
2008-01-19), however, we use unpack_trees() to traverse_trees() callchain
to perform "diff-index", which could waste a lot of work traversing trees
outside the user-supplied pathspec, only to discard at the blob comparison
level in diff-lib.c::oneway_diff() which is way too late.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoam: preliminary support for hg patches
Giuseppe Bilotta [Mon, 29 Aug 2011 16:44:06 +0000 (18:44 +0200)] 
am: preliminary support for hg patches

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoam: fix stgit patch mangling
Giuseppe Bilotta [Mon, 29 Aug 2011 16:44:07 +0000 (18:44 +0200)] 
am: fix stgit patch mangling

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agogit-p4: simple branch tests edits
Pete Wyckoff [Mon, 29 Aug 2011 09:32:23 +0000 (10:32 +0100)] 
git-p4: simple branch tests edits

More review comments.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Vitor Antunes <vitor.hda@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoam: format is in $patch_format, not parse_patch
Giuseppe Bilotta [Mon, 29 Aug 2011 15:22:06 +0000 (17:22 +0200)] 
am: format is in $patch_format, not parse_patch

The error message given when the patch format was not recognized was
wrong, since the variable checked was $parse_patch rather than
$patch_format. Fix by checking the non-emptyness of the correct
variable.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agot5540-http-test: shorten grep pattern
Brian Gernhardt [Mon, 29 Aug 2011 06:42:21 +0000 (02:42 -0400)] 
t5540-http-test: shorten grep pattern

On OS X, the grep pattern

    "\"OP .*/objects/$x2/X38_X40 HTTP/[.0-9]*\" 20[0-9] "

is too long ($x38 and $x40 represent 38 and 40 copies of [0-9a-f]) for
grep to handle.  In order to still be able to match this, use the sed
invocation to replace what we're looking for with a token.

Improved-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Brian Gernhardt <brian@gernhardtsoftware.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoDocumentation: clarify "git clean -e <pattern>"
Junio C Hamano [Thu, 25 Aug 2011 18:29:57 +0000 (11:29 -0700)] 
Documentation: clarify "git clean -e <pattern>"

The current explanation of -e can be misread as allowing the user to say

    I know 'git clean -XYZ' (substitute -XYZ with any option and/or
    parameter) will remove paths A, B, and C, and I want them all removed
    except for paths matching this pattern by adding '-e C' to the same
    command line, i.e. 'git clean -e C -XYZ'.

But that is not what this option does. It augments the set of ignore rules
from the command line, just like the same "-e <pattern>" argument does
with the "ls-files" command (the user could probably pass "-e \!C" to tell
the command to clean everything the command would normally remove, except
for C). Also error out when both -x and -e are given with an explanation of
what -e means---it is a symptom of misunderstanding what -e does.

It also fixes small style nit in the parameter to add_exclude() call. The
current code only works because EXC_CMDL happens to be defined as 0.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agot3005: do not assume a particular order of stdout and stderr of git-ls-files
Johannes Sixt [Sun, 28 Aug 2011 07:34:56 +0000 (09:34 +0200)] 
t3005: do not assume a particular order of stdout and stderr of git-ls-files

There is no guarantee that stderr is flushed before stdout when both
channels are redirected to a file. Check the channels using independent
files.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoobstack: Fix portability issues
Fredrik Kuivinen [Sun, 28 Aug 2011 20:08:46 +0000 (22:08 +0200)] 
obstack: Fix portability issues

i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1, SunOS 5.10, and possibly
others do not have exit.h and exitfail.h. Remove the use of these in
obstack.c.

The __block variable was renamed to block to avoid a gcc error:

compat/obstack.h:190: error: __block attribute can be specified on variables only

Initial-patch-by: David Aguilar <davvid@gmail.com>
Reported-by: Brian Gernhardt <brian@gernhardtsoftware.com>
Signed-off-by: Fredrik Kuivinen <frekui@gmail.com>
Acked-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoUpdate draft release notes to 1.7.7
Junio C Hamano [Mon, 29 Aug 2011 04:49:35 +0000 (21:49 -0700)] 
Update draft release notes to 1.7.7

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'nd/decorate-grafts'
Junio C Hamano [Mon, 29 Aug 2011 04:22:58 +0000 (21:22 -0700)] 
Merge branch 'nd/decorate-grafts'

* nd/decorate-grafts:
  log: Do not decorate replacements with --no-replace-objects
  log: decorate "replaced" on to replaced commits
  log: decorate grafted commits with "grafted"
  Move write_shallow_commits to fetch-pack.c
  Add for_each_commit_graft() to iterate all grafts
  decoration: do not mis-decorate refs with same prefix

12 years agoMerge branch 'nd/maint-clone-gitdir'
Junio C Hamano [Mon, 29 Aug 2011 04:20:28 +0000 (21:20 -0700)] 
Merge branch 'nd/maint-clone-gitdir'

* nd/maint-clone-gitdir:
  clone: allow to clone from .git file
  read_gitfile_gently(): rename misnamed function to read_gitfile()

12 years agoMerge branch 'ci/forbid-unwanted-current-branch-update'
Junio C Hamano [Mon, 29 Aug 2011 04:19:31 +0000 (21:19 -0700)] 
Merge branch 'ci/forbid-unwanted-current-branch-update'

* ci/forbid-unwanted-current-branch-update:
  Show interpreted branch name in error messages
  Prevent force-updating of the current branch

12 years agoMerge branch 'jk/pager-with-external-command'
Junio C Hamano [Mon, 29 Aug 2011 04:19:25 +0000 (21:19 -0700)] 
Merge branch 'jk/pager-with-external-command'

* jk/pager-with-external-command:
  support pager.* for external commands

12 years agoMerge branch 'jc/maint-clone-alternates'
Junio C Hamano [Mon, 29 Aug 2011 04:19:21 +0000 (21:19 -0700)] 
Merge branch 'jc/maint-clone-alternates'

* jc/maint-clone-alternates:
  clone: clone from a repository with relative alternates
  clone: allow more than one --reference

Conflicts:
builtin/clone.c

12 years agoMerge branch 'jk/color-and-pager'
Junio C Hamano [Mon, 29 Aug 2011 04:19:16 +0000 (21:19 -0700)] 
Merge branch 'jk/color-and-pager'

* jk/color-and-pager:
  want_color: automatically fallback to color.ui
  diff: don't load color config in plumbing
  config: refactor get_colorbool function
  color: delay auto-color decision until point of use
  git_config_colorbool: refactor stdout_is_tty handling
  diff: refactor COLOR_DIFF from a flag into an int
  setup_pager: set GIT_PAGER_IN_USE
  t7006: use test_config helpers
  test-lib: add helper functions for config
  t7006: modernize calls to unset

Conflicts:
builtin/commit.c
parse-options.c

12 years agoMerge branch 'mh/attr'
Junio C Hamano [Mon, 29 Aug 2011 04:19:12 +0000 (21:19 -0700)] 
Merge branch 'mh/attr'

* mh/attr:
  Unroll the loop over passes
  Change while loop into for loop
  Determine the start of the states outside of the pass loop
  Change parse_attr() to take a pointer to struct attr_state
  Increment num_attr in parse_attr_line(), not parse_attr()
  Document struct match_attr
  Add a file comment

12 years agoMerge branch 'di/fast-import-tagging'
Junio C Hamano [Mon, 29 Aug 2011 04:18:48 +0000 (21:18 -0700)] 
Merge branch 'di/fast-import-tagging'

* di/fast-import-tagging:
  fast-import: allow to tag newly created objects
  fast-import: add tests for tagging blobs

12 years agoMerge branch 'di/fast-import-blob-tweak'
Junio C Hamano [Mon, 29 Aug 2011 04:18:47 +0000 (21:18 -0700)] 
Merge branch 'di/fast-import-blob-tweak'

* di/fast-import-blob-tweak:
  fast-import: treat cat-blob as a delta base hint for next blob
  fast-import: count and report # of calls to diff_delta in stats

12 years agoMerge branch 'di/fast-import-deltified-tree'
Junio C Hamano [Mon, 29 Aug 2011 04:18:47 +0000 (21:18 -0700)] 
Merge branch 'di/fast-import-deltified-tree'

* di/fast-import-deltified-tree:
  fast-import: prevent producing bad delta
  fast-import: add a test for tree delta base corruption

12 years agoMerge branch 'di/fast-import-ident'
Junio C Hamano [Mon, 29 Aug 2011 04:18:47 +0000 (21:18 -0700)] 
Merge branch 'di/fast-import-ident'

* di/fast-import-ident:
  fsck: improve committer/author check
  fsck: add a few committer name tests
  fast-import: check committer name more strictly
  fast-import: don't fail on omitted committer name
  fast-import: add input format tests

12 years agoMerge branch 'bw/doc-repo-layout'
Junio C Hamano [Mon, 29 Aug 2011 04:15:34 +0000 (21:15 -0700)] 
Merge branch 'bw/doc-repo-layout'

* bw/doc-repo-layout:
  Mark http-fetch without -a as deprecated
  Documentation: Grammar correction, wording fixes and cleanup

12 years agoMerge branch 'va/p4-branch-import'
Junio C Hamano [Mon, 29 Aug 2011 04:15:34 +0000 (21:15 -0700)] 
Merge branch 'va/p4-branch-import'

* va/p4-branch-import:
  git-p4: Add simple test case for branch import
  git-p4: Allow branch definition with git config
  git-p4: Allow filtering Perforce branches by user
  git-p4: Correct branch base depot path detection
  git-p4: Process detectCopiesHarder with --bool
  git-p4: Add test case for copy detection
  git-p4: Add test case for rename detection
  git-p4: Add description of rename/copy detection options
  git-p4: Allow setting rename/copy detection threshold

12 years agoMerge branch 'jc/combine-diff-callback'
Junio C Hamano [Mon, 29 Aug 2011 04:15:33 +0000 (21:15 -0700)] 
Merge branch 'jc/combine-diff-callback'

* jc/combine-diff-callback:
  combine-diff: support format_callback

12 years agoMerge branch 'nk/branch-v-abbrev'
Junio C Hamano [Mon, 29 Aug 2011 04:15:33 +0000 (21:15 -0700)] 
Merge branch 'nk/branch-v-abbrev'

* nk/branch-v-abbrev:
  branch -v: honor core.abbrev

12 years agogit-daemon.txt: specify --timeout in seconds
Michael Stapelberg [Sat, 27 Aug 2011 14:29:20 +0000 (16:29 +0200)] 
git-daemon.txt: specify --timeout in seconds

Signed-off-by: Michael Stapelberg <michael@stapelberg.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoForbid DEL characters in reference names
Michael Haggerty [Sat, 27 Aug 2011 04:12:44 +0000 (06:12 +0200)] 
Forbid DEL characters in reference names

DEL is an ASCII control character and therefore should not be
permitted in reference names.  Add tests for this and other unusual
characters.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agogit-stash: remove untracked/ignored directories when stashed
Brandon Casey [Sat, 27 Aug 2011 00:59:27 +0000 (19:59 -0500)] 
git-stash: remove untracked/ignored directories when stashed

The two new stash options --include-untracked and --all do not remove the
untracked and/or ignored files that are stashed if those files reside in
a subdirectory. e.g. the following sequence fails:

   mkdir untracked &&
   echo hello >untracked/file.txt &&
   git stash --include-untracked &&
   test ! -f untracked/file.txt

Within the git-stash script, git-clean is used to remove the
untracked/ignored files, but since the -d option was not supplied, it does
not remove directories.

So, add -d to the git-clean arguments, and update the tests to test this
functionality.

Reported-by: Hilco Wijbenga <hilco.wijbenga@gmail.com>
Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agot/t3905: add missing '&&' linkage
Brandon Casey [Sat, 27 Aug 2011 00:59:26 +0000 (19:59 -0500)] 
t/t3905: add missing '&&' linkage

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agogit-stash.sh: fix typo in error message
Brandon Casey [Sat, 27 Aug 2011 00:59:25 +0000 (19:59 -0500)] 
git-stash.sh: fix typo in error message

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agot/t3905: use the name 'actual' for test output, swap arguments to test_cmp
Brandon Casey [Sat, 27 Aug 2011 00:59:24 +0000 (19:59 -0500)] 
t/t3905: use the name 'actual' for test output, swap arguments to test_cmp

It is common practice in the git test suite to use the file names 'actual'
and 'expect' to hold the actual and expected output of commands.  So change
the name 'output' to 'actual'.

Additionally, swap the order of arguments to test_cmp when comparing
expected output and actual output so that if diff output is produced, it
describes how the actual output differs from what was expected rather than
the other way around.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agorebase -i: notice and warn if "exec $cmd" modifies the index or the working tree
Junio C Hamano [Wed, 24 Aug 2011 18:54:50 +0000 (11:54 -0700)] 
rebase -i: notice and warn if "exec $cmd" modifies the index or the working tree

If "exec $cmd" touched the index or the working tree, and exited with
non-zero status, the code did not check and warn that there now are
uncommitted changes.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agorebase -i: clean error message for --continue after failed exec
Matthieu Moy [Wed, 24 Aug 2011 14:01:48 +0000 (16:01 +0200)] 
rebase -i: clean error message for --continue after failed exec

After an "exec false" stops the rebase and gives the control back to
the user, if changes are added to the index, "rebase --continue" fails
with this message, which may technically be correct, but does not point
at the real problem:

.../git-rebase--interactive: line 774: .../.git/rebase-merge/author-script: No such file or directory

We could try auto-amending HEAD, but this goes against the logic of
.git/rebase-merge/author-script (see also the testcase 'auto-amend only
edited commits after "edit"' in t3404-rebase-interactive.sh) to
auto-amend something the user hasn't explicitely asked to edit.

Instead of doing anything automatically, detect the situation and give a
clean error message. While we're there, also clarify the error message in
case '. "$author_script"' fails, which now corresponds to really weird
senario where the author script exists but can't be read.

Test-case-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoGit 1.7.7-rc0 v1.7.7-rc0
Junio C Hamano [Fri, 26 Aug 2011 04:00:46 +0000 (21:00 -0700)] 
Git 1.7.7-rc0

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agolog: Do not decorate replacements with --no-replace-objects
Michael J Gruber [Thu, 25 Aug 2011 15:09:30 +0000 (17:09 +0200)] 
log: Do not decorate replacements with --no-replace-objects

5267d29 (log: decorate "replaced" on to replaced commits, 2011-08-19)
introduced textual decorations for replaced commits, based on the
detection of refs/replace.

Make it so that additionally the use of --no-replace-objects is
detected: I.e. replaced commits are only decorated as replaced when they
are actually replaced.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agorevision: do not include sibling history in --ancestry-path output
Junio C Hamano [Fri, 26 Aug 2011 00:51:50 +0000 (17:51 -0700)] 
revision: do not include sibling history in --ancestry-path output

If the commit specified as the bottom of the commit range has a direct
parent that has another child commit that contributed to the resulting
history, "rev-list --ancestry-path" was confused and listed that side
history as well, due to the command line parser subtlety corrected by the
previous commit.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agorevision: keep track of the end-user input from the command line
Junio C Hamano [Fri, 26 Aug 2011 00:35:39 +0000 (17:35 -0700)] 
revision: keep track of the end-user input from the command line

Given a complex set of revision specifiers on the command line, it is too
late to look at the flags of the objects in the initial traversal list at
the beginning of limit_list() in order to determine what the objects the
end-user explicitly listed on the command line were. The process to move
objects from the pending array to the traversal list may have marked
objects that are not mentioned as UNINTERESTING, when handle_commit()
marked the parents of UNINTERESTING commits mentioned on the command line
by calling mark_parents_uninteresting().

This made "rev-list --ancestry-path ^A ..." to mistakenly list commits
that are descendants of A's parents but that are not descendants of A
itself, as ^A from the command line causes A and its parents marked as
UNINTERESTING before coming to limit_list(), and we try to enumerate the
commits that are descendants of these commits that are UNINTERESTING
before we start walking the history.

It actually is too late even if we inspected the pending object array
before calling prepare_revision_walk(), as some of the same objects might
have been mentioned twice, once as positive and another time as negative.
The "rev-list --some-option A --not --all" command may want to notice,
even if the resulting set is empty, that the user showed some interest in
"A" and do something special about it.

Prepare a separate array to keep track of what syntactic element was used
to cause each object to appear in the pending array from the command line,
and populate it as setup_revisions() parses the command line.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agorev-list: Demonstrate breakage with --ancestry-path --all
Brad King [Thu, 25 Aug 2011 16:49:13 +0000 (12:49 -0400)] 
rev-list: Demonstrate breakage with --ancestry-path --all

The option added by commit ebdc94f3 (revision: --ancestry-path,
2010-04-20) does not work properly in combination with --all, at least
in the case of a criss-cross merge:

    b---bc
   / \ /
  a   X
   \ / \
    c---cb

There are no descendants of 'cb' in the history.  The command

  git rev-list --ancestry-path cb..bc

correctly reports no commits.  However, the command

  git rev-list --ancestry-path --all ^cb

reports 'bc'.  Add a test case to t6019-rev-list-ancestry-path
demonstrating this breakage.

Signed-off-by: Brad King <brad.king@kitware.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'jc/merge-reword'
Junio C Hamano [Thu, 25 Aug 2011 23:00:53 +0000 (16:00 -0700)] 
Merge branch 'jc/merge-reword'

* jc/merge-reword:
  merge: reword the final message

12 years agoMerge branch 'mg/branch-set-upstream-previous'
Junio C Hamano [Thu, 25 Aug 2011 23:00:49 +0000 (16:00 -0700)] 
Merge branch 'mg/branch-set-upstream-previous'

* mg/branch-set-upstream-previous:
  branch.c: use the parsed branch name

12 years agoMerge branch 'da/difftool-mergtool-refactor'
Junio C Hamano [Thu, 25 Aug 2011 23:00:43 +0000 (16:00 -0700)] 
Merge branch 'da/difftool-mergtool-refactor'

* da/difftool-mergtool-refactor:
  mergetools/meld: Use '--output' when available
  mergetool--lib: Refactor tools into separate files
  mergetool--lib: Make style consistent with git
  difftool--helper: Make style consistent with git

12 years agoMerge branch 'jc/maint-autofix-tag-in-head'
Junio C Hamano [Thu, 25 Aug 2011 23:00:37 +0000 (16:00 -0700)] 
Merge branch 'jc/maint-autofix-tag-in-head'

* jc/maint-autofix-tag-in-head:
  commit: reduce use of redundant global variables

12 years agoMerge branch 'di/fast-import-doc'
Junio C Hamano [Thu, 25 Aug 2011 23:00:32 +0000 (16:00 -0700)] 
Merge branch 'di/fast-import-doc'

* di/fast-import-doc:
  doc/fast-import: document feature import-marks-if-exists

12 years agoMerge branch 'jn/plug-empty-tree-leak'
Junio C Hamano [Thu, 25 Aug 2011 23:00:29 +0000 (16:00 -0700)] 
Merge branch 'jn/plug-empty-tree-leak'

* jn/plug-empty-tree-leak:
  merge-recursive: take advantage of hardcoded empty tree
  revert: plug memory leak in "cherry-pick root commit" codepath

12 years agoMerge branch 'ac/describe-dirty-refresh'
Junio C Hamano [Thu, 25 Aug 2011 23:00:24 +0000 (16:00 -0700)] 
Merge branch 'ac/describe-dirty-refresh'

* ac/describe-dirty-refresh:
  describe: Refresh the index when run with --dirty

12 years agoMerge branch 'di/parse-options-split'
Junio C Hamano [Thu, 25 Aug 2011 23:00:20 +0000 (16:00 -0700)] 
Merge branch 'di/parse-options-split'

* di/parse-options-split:
  Reduce parse-options.o dependencies
  parse-options: export opterr, optbug

12 years agoMerge branch 'js/i18n-scripts'
Junio C Hamano [Thu, 25 Aug 2011 23:00:16 +0000 (16:00 -0700)] 
Merge branch 'js/i18n-scripts'

* js/i18n-scripts:
  submodule: take advantage of gettextln and eval_gettextln.
  stash: take advantage of eval_gettextln
  pull: take advantage of eval_gettextln
  git-am: take advantage of gettextln and eval_gettextln.
  gettext: add gettextln, eval_gettextln to encode common idiom

12 years agoMerge branch 'maint'
Junio C Hamano [Thu, 25 Aug 2011 23:00:07 +0000 (16:00 -0700)] 
Merge branch 'maint'

* maint:
  whitespace: have SP on both sides of an assignment "="
  update-ref: whitespace fix

12 years agowhitespace: have SP on both sides of an assignment "="
Junio C Hamano [Thu, 25 Aug 2011 21:46:52 +0000 (14:46 -0700)] 
whitespace: have SP on both sides of an assignment "="

I've deliberately excluded the borrowed code in compat/nedmalloc
directory.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoupdate-ref: whitespace fix
Pang Yan Han [Thu, 25 Aug 2011 15:40:50 +0000 (23:40 +0800)] 
update-ref: whitespace fix

Signed-off-by: Pang Yan Han <pangyanhan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agocheck-ref-format --print: Normalize refnames that start with slashes
Michael Haggerty [Thu, 25 Aug 2011 19:19:24 +0000 (21:19 +0200)] 
check-ref-format --print: Normalize refnames that start with slashes

When asked if "refs///heads/master" is valid, check-ref-format says "Yes,
it is well formed", and when asked to print canonical form, it shows
"refs/heads/master". This is so that it can be tucked after "$GIT_DIR/"
to form a valid pathname for a loose ref, and we normalize a pathname like
"$GIT_DIR/refs///heads/master" to de-dup the slashes in it.

Similarly, when asked if "/refs/heads/master" is valid, check-ref-format
says "Yes, it is Ok", but the leading slash is not removed when printing,
leading to "$GIT_DIR//refs/heads/master".

Fix it to make sure such leading slashes are removed.  Add tests that such
refnames are accepted and normalized correctly.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agogit-notes.txt: clarify -C vs. copy and -F
Michael J Gruber [Thu, 25 Aug 2011 10:26:37 +0000 (12:26 +0200)] 
git-notes.txt: clarify -C vs. copy and -F

The current description of '-C' together with the analogy to 'git commit
-C' can lead to the wrong conclusion that '-C' copies notes between
objects. Make this clearer by rewording and pointing to 'copy'.

The example for attaching binary notes with 'git hash-object' followed
by 'git notes add -C' immediately raises the question: "Why not use 'git
notes add -F'?". Answer it (the latter is not binary-safe).

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Acked-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoSync with 1.7.6.1
Junio C Hamano [Wed, 24 Aug 2011 19:18:02 +0000 (12:18 -0700)] 
Sync with 1.7.6.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoGit 1.7.6.1 v1.7.6.1
Junio C Hamano [Wed, 24 Aug 2011 19:16:58 +0000 (12:16 -0700)] 
Git 1.7.6.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'jc/maint-smart-http-race-upload-pack' into maint
Junio C Hamano [Wed, 24 Aug 2011 19:16:15 +0000 (12:16 -0700)] 
Merge branch 'jc/maint-smart-http-race-upload-pack' into maint

* jc/maint-smart-http-race-upload-pack:
  get_indexed_object can return NULL if nothing is in that slot; check for it

12 years agoget_indexed_object can return NULL if nothing is in that slot; check for it
Brian Harring [Wed, 24 Aug 2011 05:47:17 +0000 (22:47 -0700)] 
get_indexed_object can return NULL if nothing is in that slot; check for it

This fixes a segfault introduced by 051e400; via it, no longer able to
trigger the http/smartserv race.

Signed-off-by: Brian Harring <ferringb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMark http-fetch without -a as deprecated
Ben Walton [Wed, 24 Aug 2011 00:29:51 +0000 (20:29 -0400)] 
Mark http-fetch without -a as deprecated

As the use of http-fetch without -a can create an object store that is
invalid to the point where it cannot even be fsck'd, mark it as
deprecated.  A future release should change the default and then
remove the option entirely.

Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoDocumentation: Grammar correction, wording fixes and cleanup
Ben Walton [Wed, 24 Aug 2011 00:32:35 +0000 (20:32 -0400)] 
Documentation: Grammar correction, wording fixes and cleanup

Correct a few grammar issues in gitrepository-layout.txt and also
rewords a few sections for clarity.

Remove references to using http-fetch without -a to create a broken
repository.

Mark a few areas of the repository structure as legacy.

Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoUpdate draft release notes to 1.7.7
Junio C Hamano [Tue, 23 Aug 2011 22:43:38 +0000 (15:43 -0700)] 
Update draft release notes to 1.7.7

12 years agoMerge branch 'rt/zlib-smaller-window'
Junio C Hamano [Tue, 23 Aug 2011 22:40:33 +0000 (15:40 -0700)] 
Merge branch 'rt/zlib-smaller-window'

* rt/zlib-smaller-window:
  test: consolidate definition of $LF
  Tolerate zlib deflation with window size < 32Kb

12 years agoMerge branch 'jn/maint-test-return'
Junio C Hamano [Tue, 23 Aug 2011 22:35:26 +0000 (15:35 -0700)] 
Merge branch 'jn/maint-test-return'

* jn/maint-test-return:
  t3900: do not reference numbered arguments from the test script
  test: cope better with use of return for errors
  test: simplify return value of test_run_

12 years agoMerge branch 'cb/maint-ls-files-error-report'
Junio C Hamano [Tue, 23 Aug 2011 22:34:31 +0000 (15:34 -0700)] 
Merge branch 'cb/maint-ls-files-error-report'

* cb/maint-ls-files-error-report:
  ls-files: fix pathspec display on error

12 years agoMerge branch 'maint'
Junio C Hamano [Tue, 23 Aug 2011 22:29:08 +0000 (15:29 -0700)] 
Merge branch 'maint'

* maint:
  Update draft release notes for 1.7.6.1

12 years agoUpdate draft release notes for 1.7.6.1
Junio C Hamano [Tue, 23 Aug 2011 22:28:18 +0000 (15:28 -0700)] 
Update draft release notes for 1.7.6.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'jc/maint-combined-diff-work-tree' into maint
Junio C Hamano [Tue, 23 Aug 2011 22:27:30 +0000 (15:27 -0700)] 
Merge branch 'jc/maint-combined-diff-work-tree' into maint

* jc/maint-combined-diff-work-tree:
  diff -c/--cc: do not mistake "resolved as deletion" as "use working tree"

Conflicts:
combine-diff.c

12 years agoMerge branch 'cb/maint-exec-error-report' into maint
Junio C Hamano [Tue, 23 Aug 2011 22:20:06 +0000 (15:20 -0700)] 
Merge branch 'cb/maint-exec-error-report' into maint

* cb/maint-exec-error-report:
  notice error exit from pager
  error_routine: use parent's stderr if exec fails

12 years agoMerge branch 'cb/maint-quiet-push' into maint
Junio C Hamano [Tue, 23 Aug 2011 22:19:45 +0000 (15:19 -0700)] 
Merge branch 'cb/maint-quiet-push' into maint

* cb/maint-quiet-push:
  receive-pack: do not overstep command line argument array
  propagate --quiet to send-pack/receive-pack

Conflicts:
Documentation/git-receive-pack.txt
Documentation/git-send-pack.txt

12 years agoMerge branch 'jc/maint-smart-http-race-upload-pack' into maint
Junio C Hamano [Tue, 23 Aug 2011 22:17:50 +0000 (15:17 -0700)] 
Merge branch 'jc/maint-smart-http-race-upload-pack' into maint

* jc/maint-smart-http-race-upload-pack:
  helping smart-http/stateless-rpc fetch race

12 years agoMerge branch 'jc/no-gitweb-test-without-cgi-etc' into maint
Junio C Hamano [Tue, 23 Aug 2011 22:17:14 +0000 (15:17 -0700)] 
Merge branch 'jc/no-gitweb-test-without-cgi-etc' into maint

* jc/no-gitweb-test-without-cgi-etc:
  t/gitweb-lib.sh: skip gitweb tests when perl dependencies are not met

12 years agofast-import: allow to tag newly created objects
Dmitry Ivankov [Mon, 22 Aug 2011 12:10:19 +0000 (18:10 +0600)] 
fast-import: allow to tag newly created objects

fast-import allows to tag objects by sha1 and to query sha1 of objects
being imported. So it should allow to tag these objects, make it do so.

Signed-off-by: Dmitry Ivankov <divanorama@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agofast-import: add tests for tagging blobs
Dmitry Ivankov [Mon, 22 Aug 2011 12:10:18 +0000 (18:10 +0600)] 
fast-import: add tests for tagging blobs

fast-import allows to create an annotated tag that annotates a blob,
via mark or direct sha1 specification.

For mark it works, for sha1 it tries to read the object. It tries to
do so via read_sha1_file, and then checks the size to be at least 46.

That's weird, let's just allow to (annotated) tag any object referenced
by sha1. If the object originates from our packfile, we still fail though.

Signed-off-by: Dmitry Ivankov <divanorama@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoclone: clone from a repository with relative alternates
Junio C Hamano [Tue, 23 Aug 2011 01:05:16 +0000 (18:05 -0700)] 
clone: clone from a repository with relative alternates

Cloning from a local repository blindly copies or hardlinks all the files
under objects/ hierarchy. This results in two issues:

 - If the repository cloned has an "objects/info/alternates" file, and the
   command line of clone specifies --reference, the ones specified on the
   command line get overwritten by the copy from the original repository.

 - An entry in a "objects/info/alternates" file can specify the object
   stores it borrows objects from as a path relative to the "objects/"
   directory. When cloning a repository with such an alternates file, if
   the new repository is not sitting next to the original repository, such
   relative paths needs to be adjusted so that they can be used in the new
   repository.

This updates add_to_alternates_file() to take the path to the alternate
object store, including the "/objects" part at the end (earlier, it was
taking the path to $GIT_DIR and was adding "/objects" itself), as it is
technically possible to specify in objects/info/alternates file the path
of a directory whose name does not end with "/objects".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agogit-p4: Add simple test case for branch import
Vitor Antunes [Thu, 18 Aug 2011 23:44:06 +0000 (00:44 +0100)] 
git-p4: Add simple test case for branch import

Create a basic branch structure in P4 and clone it with git-p4.
Also, make an update on P4 side and check if git-p4 imports it correctly.
The branch structure is created in such a way that git-p4 will fail to import
updates if patch "git-p4: Correct branch base depot path detection" is not
applied.

Signed-off-by: Vitor Antunes <vitor.hda@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agogit-p4: Allow branch definition with git config
Vitor Antunes [Thu, 18 Aug 2011 23:44:05 +0000 (00:44 +0100)] 
git-p4: Allow branch definition with git config

Perforce does not strictly require the usage of branch specifications to create
branches. In these cases the branch detection code of git-p4 will not be able to
import them.
This patch adds support for git-p4.branchList configuration option, allowing
branches to be defined in git config.

Signed-off-by: Vitor Antunes <vitor.hda@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agogit-p4: Allow filtering Perforce branches by user
Vitor Antunes [Thu, 18 Aug 2011 23:44:04 +0000 (00:44 +0100)] 
git-p4: Allow filtering Perforce branches by user

All branches in the Perforce server are downloaded to allow branch detection. If
you have a centralized server on a remote location and there is a big number of
branches this operation can take some time.
This patch adds the configuration option git-p4.branchUser to allow filtering
the branch list by user. Although this limits the branch maintenance in Perforce
to be done by a single user, it might be an advantage when the number of
branches being used in a specific depot is very small when compared with the
branches available in the server.

Signed-off-by: Vitor Antunes <vitor.hda@gmail.com>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agogit-p4: Correct branch base depot path detection
Vitor Antunes [Thu, 18 Aug 2011 23:44:03 +0000 (00:44 +0100)] 
git-p4: Correct branch base depot path detection

When branch detection is enabled each branch is named in git after their
relative depot path in Perforce. To do this the depot paths are compared against
each other to find their common base path. The current algorithm makes this
comparison on a character by character basis.
Assuming we have the following branches:

  //depot/branches/featureA
  //depot/branches/featureB

Then the base depot path would be //depot/branches/feature, which is an invalid
depot path.

The current patch fixes this by splitting the path into a list and comparing the
list entries, making it choose correctly //depot/branches as the base path.

Signed-off-by: Vitor Antunes <vitor.hda@gmail.com>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'maint'
Junio C Hamano [Tue, 23 Aug 2011 04:02:41 +0000 (21:02 -0700)] 
Merge branch 'maint'

* maint:
  add technical documentation about ref iteration
  Do not use C++-style comments

12 years agoclone: allow more than one --reference
Junio C Hamano [Tue, 23 Aug 2011 01:05:15 +0000 (18:05 -0700)] 
clone: allow more than one --reference

Also add a test to expose a long-standing bug that is triggered when
cloning with --reference option from a local repository that has its own
alternates. The alternate object stores specified on the command line
are lost, and only alternates copied from the source repository remain.
The bug will be fixed in the next patch.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoShow interpreted branch name in error messages
Conrad Irwin [Sat, 20 Aug 2011 21:49:49 +0000 (14:49 -0700)] 
Show interpreted branch name in error messages

Change the error message when doing: "git branch @{-1}",
"git checkout -b @{-1}", or "git branch -m foo @{-1}"

 * was: A branch named '@{-1}' already exists.
 * now: A branch named 'bar' already exists.

Signed-off-by: Conrad Irwin <conrad.irwin@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoPrevent force-updating of the current branch
Conrad Irwin [Sat, 20 Aug 2011 21:49:48 +0000 (14:49 -0700)] 
Prevent force-updating of the current branch

"git branch -M <foo> <current-branch>" allows updating the current branch
which HEAD points, without the necessary house-keeping that git reset
normally does to make this operation sensible. It also leaves the reflog
in a confusing state (you would be warned when trying to read it).

"git checkout -B <current branch> <foo>" is also partly vulnerable to this
bug; due to inconsistent pre-flight checks it would perform half of its
task and then abort just before rewriting the branch. Again this
manifested itself as the index file getting out-of-sync with HEAD.

"git branch -f" already guarded against this problem, and aborts with
a fatal error.

Update "git branch -M", "git checkout -B" and "git branch -f" to share the
same check before allowing a branch to be created. These prevent you from
updating the current branch.

We considered suggesting the use of "git reset" in the failure message
but concluded that it was not possible to discern what the user was
actually trying to do.

Signed-off-by: Conrad Irwin <conrad.irwin@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoadd technical documentation about ref iteration
Heiko Voigt [Mon, 22 Aug 2011 20:36:45 +0000 (22:36 +0200)] 
add technical documentation about ref iteration

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoclone: allow to clone from .git file
Nguyễn Thái Ngọc Duy [Sun, 21 Aug 2011 11:58:09 +0000 (18:58 +0700)] 
clone: allow to clone from .git file

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoread_gitfile_gently(): rename misnamed function to read_gitfile()
Junio C Hamano [Mon, 22 Aug 2011 21:04:56 +0000 (14:04 -0700)] 
read_gitfile_gently(): rename misnamed function to read_gitfile()

The function was not gentle at all to the callers and died without giving
them a chance to deal with possible errors. Rename it to read_gitfile(),
and update all the callers.

As no existing caller needs a true "gently" variant, we do not bother
adding one at this point.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agofast-import: treat cat-blob as a delta base hint for next blob
Dmitry Ivankov [Sat, 20 Aug 2011 19:04:12 +0000 (01:04 +0600)] 
fast-import: treat cat-blob as a delta base hint for next blob

Delta base for blobs is chosen as a previously saved blob. If we
treat cat-blob's blob as a delta base for the next blob, nothing
is likely to become worse.

For fast-import stream producer like svn-fe cat-blob is used like
following:
- svn-fe reads file delta in svn format
- to apply it, svn-fe asks cat-blob 'svn delta base'
- applies 'svn delta' to the response
- produces a blob command to store the result

Currently there is no way for svn-fe to give fast-import a hint on
object delta base. While what's requested in cat-blob is most of
the time a best delta base possible. Of course, it could be not a
good delta base, but we don't know any better one anyway.

So do treat cat-blob's result as a delta base for next blob. The
profit is nice: 2x to 7x reduction in pack size AND 1.2x to 3x
time speedup due to diff_delta being faster on good deltas. git gc
--aggressive can compress it even more, by 10% to 70%, utilizing
more cpu time, real time and 3 cpu cores.

Tested on 213M and 2.7G fast-import streams, resulting packs are 22M
and 113M, import time is 7s and 60s, both streams are produced by
svn-fe, sniffed and then used as raw input for fast-import.

For git-fast-export produced streams there is no change as it doesn't
use cat-blob and doesn't try to reorder blobs in some smart way to
make successive deltas small.

Signed-off-by: Dmitry Ivankov <divanorama@gmail.com>
Acked-by: David Barr <davidbarr@google.com>
Acked-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agofast-import: count and report # of calls to diff_delta in stats
Dmitry Ivankov [Sat, 20 Aug 2011 19:04:11 +0000 (01:04 +0600)] 
fast-import: count and report # of calls to diff_delta in stats

It's an interesting number, how often do we try to deltify each type of
objects and how often do we succeed. So do add it to stats.

Success doesn't mean much gain in pack size though. As we allow delta to
be as big as (data.len - 20). And delta close to data.len gains nothing
compared to no delta at all even after zlib compression (delta is pretty
much the same as data, just with few modifications).

We should try to make less attempts that result in huge deltas as these
consume more cpu than trivial small deltas. Either by choosing a better
delta base or reducing delta size upper bound or doing less delta attempts
at all.

Currently, delta base for blobs is a waste literally. Each blob delta
base is chosen as a previously stored blob. Disabling deltas for blobs
doesn't increase pack size and reduce import time, or at least doesn't
increase time for all fast-import streams I've tried.

Signed-off-by: Dmitry Ivankov <divanorama@gmail.com>
Acked-by: David Barr <davidbarr@google.com>
Acked-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>