1
0
mirror of https://github.com/git/git.git synced 2024-10-20 00:38:50 +02:00
Commit Graph

26720 Commits

Author SHA1 Message Date
Jeff King
5347a50fec filter-branch: use require_clean_work_tree
Filter-branch already requires that we have a clean work
tree before starting. However, it failed to refresh the
index before checking, which means it could be wrong in the
case of stat-dirtiness.

Instead of simply adding a call to refresh the index, let's
switch to using the require_clean_work_tree function
provided by git-sh-setup. It does exactly what we want, and
with fewer lines of code and more specific output messages.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-15 16:58:55 -07:00
Junio C Hamano
6099835c19 Allow git merge ":/<pattern>"
It probably is not such a good idea to use ":/<pattern>" to specify which
commit to merge, as ":/<pattern>" can often hit unexpected commits, but
somebody tried it and got a nonsense error message:

	fatal: ':/Foo bar' does not point to a commit

So here is a for-the-sake-of-consistency update that is fairly useless
that allows users to carefully try not shooting in the foot.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-15 16:52:43 -07:00
Thomas Rast
c05b988a69 t6019: avoid refname collision on case-insensitive systems
The criss-cross tests kept failing for me because of collisions of 'a'
with 'A' etc.  Prefix the lowercase refnames with an extra letter to
disambiguate.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Acked-by: Brad King <brad.king@kitware.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-15 08:53:11 -07:00
Junio C Hamano
559357b508 Merge branch 'ph/format-patch-no-color'
* ph/format-patch-no-color:
  format-patch: ignore ui.color
2011-09-14 21:43:57 -07:00
Jeff King
5d40a17985 run_hook: use argv_array API
This was a pretty straightforward use, so it really doesn't
save that many lines. Still, perhaps it's a little bit more
readable.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-14 11:57:33 -07:00
Jeff King
7bf0b01750 checkout: use argv_array API
We were using a similar ad-hoc rev_list_args structure, but
this saves some code.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-14 11:57:25 -07:00
Jeff King
8a534b6124 bisect: use argv_array API
Now that the argv_array API exists, we can save some lines
of code.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-14 11:56:57 -07:00
Jeff King
37e8161a04 quote: provide sq_dequote_to_argv_array
This is similar to sq_dequote_to_argv, but more convenient
if you have an argv_array. It's tempting to just feed the
components of the argv_array to sq_dequote_to_argv instead,
but:

  1. It wouldn't maintain the NULL-termination invariant
     of argv_array.

  2. It doesn't match the memory ownership policy of
     argv_array (in which each component is free-able, not a
     pointer into a separate buffer).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-14 11:56:49 -07:00
Jeff King
c1189caeaf refactor argv_array into generic code
The submodule code recently grew generic code to build a
dynamic argv array. Many other parts of the code can reuse
this, too, so let's make it generically available.

There are two enhancements not found in the original code:

  1. We now handle the NULL-termination invariant properly,
     even when no strings have been pushed (before, you
     could have an empty, NULL argv). This was not a problem
     for the submodule code, which always pushed at least
     one argument, but was not sufficiently safe for
     generic code.

  2. There is a formatted variant of the "push" function.
     This is a convenience function which was not needed by
     the submodule code, but will make it easier to port
     other users to the new code.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-14 11:56:36 -07:00
Jeff King
7878b07c0d quote.h: fix bogus comment
Commit 758e915 made sq_quote_next static, removing it from
quote.h. However, it forgot to update the related comment,
making it appear as a confusing description of sq_quote_to_argv.

Let's remove the crufty bits, and elaborate more on sq_quote_to_argv.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-14 11:44:05 -07:00
Jeff King
163ed566db add sha1_array API docs
This API was introduced in 902bb36, but never documented.
Let's be nice to future users of the code.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-14 11:44:05 -07:00
Jeff King
376eb14a05 t3200: clean up checks for file existence
This patch uses test_path_is_file and test_path_is_missing
instead of "test -f / ! test -f" checks. The former are more
verbose in case of failure and more precise (e.g., is_missing
will check that the entry is actually missing, not just not
a regular file).

As a bonus, this also fixes a few buggy tests that used
"test foo" instead of "test -f foo", and consequently always
reported success.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-13 10:11:39 -07:00
Thomas Rast
2b4aa89c27 Documentation: basic configuration of notes.rewriteRef
Users had problems finding a working setting for notes.rewriteRef.
Document how to enable rewriting for notes/commits, which should be a
safe setting.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-13 08:35:38 -07:00
Bryan Jacobs
1e5814f3de git-svn: teach git-svn to populate svn:mergeinfo
Allow git-svn to populate the svn:mergeinfo property automatically in
a narrow range of circumstances. Specifically, when dcommitting a
revision with multiple parents, all but (potentially) the first of
which have been committed to SVN in the same repository as the target
of the dcommit.

In this case, the merge info is the union of that given by each of the
parents, plus all changes introduced to the first parent by the other
parents.

In all other cases where a revision to be committed has multiple
parents, cause "git svn dcommit" to raise an error rather than
completing the commit and potentially losing history information in
the upstream SVN repository.

This behavior is disabled by default, and can be enabled by setting
the svn.pushmergeinfo config option.

[ew: minor style changes and manpage merge fix]

Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Bryan Jacobs <bjacobs@woti.com>
2011-09-13 08:12:13 +00:00
Clemens Buchacher
c5978246f0 send-email: add option -h
Most other git commands print a synopsis when passed -h. Make
send-email do the same.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-12 17:00:23 -07:00
Haitao Li
ee646eb48f date.c: Support iso8601 timezone formats
Timezone designators in the following formats are all valid according to
ISO8601:2004, section 4.3.2:

    [+-]hh, [+-]hhmm, [+-]hh:mm

but we have ignored the ones with colon so far.

Signed-off-by: Haitao Li <lihaitao@gmail.com>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-12 16:49:14 -07:00
Junio C Hamano
9684e44a07 refactor run_receive_hook()
Running a hook has to make complex set-up to establish web of
communication between child process and multiplexer, which is common
regardless of what kind of data is fed to the hook. Refactor the parts
that is specific to the data fed to the particular set of hooks from the
part that runs the hook, so that the code can be reused to drive hooks
that take different kind of data.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-12 16:40:06 -07:00
Clemens Buchacher
f950eb9560 rename pathspec_prefix() to common_prefix() and move to dir.[ch]
Also make common_prefix_len() static as this refactoring makes dir.c
itself the only caller of this helper function.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-12 14:38:32 -07:00
Jeff King
6859de45a9 fetch: avoid quadratic loop checking for updated submodules
Recent versions of git can be slow to fetch repositories with a
large number of refs (or when they already have a large
number of refs). For example, GitHub makes pull-requests
available as refs, which can lead to a large number of
available refs. This slowness goes away when submodule
recursion is turned off:

  $ git ls-remote git://github.com/rails/rails.git | wc -l
  3034

  [this takes ~10 seconds of CPU time to complete]
  git fetch --recurse-submodules=no \
    git://github.com/rails/rails.git "refs/*:refs/*"

  [this still isn't done after 10 _minutes_ of pegging the CPU]
  git fetch \
    git://github.com/rails/rails.git "refs/*:refs/*"

You can produce a quicker and simpler test case like this:

  doit() {
    head=`git rev-parse HEAD`
    for i in `seq 1 $1`; do
      echo $head refs/heads/ref$i
    done >.git/packed-refs
    echo "==> $1"
    rm -rf dest
    git init -q --bare dest &&
      (cd dest && time git.compile fetch -q .. refs/*:refs/*)
  }

  rm -rf repo
  git init -q repo && cd repo &&
  >file && git add file && git commit -q -m one

  doit 100
  doit 200
  doit 400
  doit 800
  doit 1600
  doit 3200

Which yields timings like:

  # refs  seconds of CPU
     100            0.06
     200            0.24
     400            0.95
     800            3.39
    1600           13.66
    3200           54.09

Notice that although the number of refs doubles in each
trial, the CPU time spent quadruples.

The problem is that the submodule recursion code works
something like:

  - for each ref we fetch
    - for each commit in git rev-list $new_sha1 --not --all
      - add modified submodules to list
  - fetch any newly referenced submodules

But that means if we fetch N refs, we start N revision
walks. Worse, because we use "--all", the number of refs we
must process that constitute "--all" keeps growing, too. And
you end up doing O(N^2) ref resolutions.

Instead, this patch structures the code like this:

  - for each sha1 we already have
    - add $old_sha1 to list $old
  - for each ref we fetch
    - add $new_sha1 to list $new
  - for each commit in git rev-list $new --not $old
    - add modified submodules to list
  - fetch any newly referenced submodules

This yields timings like:

  # refs  seconds of CPU
  100               0.00
  200               0.04
  400               0.04
  800               0.10
  1600              0.21
  3200              0.39

Note that the amount of effort doubles as the number of refs
doubles. Similarly, the fetch of rails.git takes about as
much time as it does with --recurse-submodules=no.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-12 14:16:41 -07:00
Pang Yan Han
787570c7cd format-patch: ignore ui.color
commit c9bfb953 (want_color: automatically fallback to color.ui,
2011-08-17) introduced a regression where format-patch produces colorized
patches when color.ui is set to "always".

In f3aafa4 (Disable color detection during format-patch, 2006-07-09),
git_format_config was taught to intercept diff.color to avoid passing it
down to git_log_config and later, git_diff_ui_config.

Teach git_format_config to intercept color.ui in the same way.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Pang Yan Han <pangyanhan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-12 11:43:58 -07:00
Junio C Hamano
5738c9c21e Git 1.7.7-rc1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
v1.7.7-rc1
2011-09-12 10:44:32 -07:00
Junio C Hamano
81a5bdd9c5 Sync with 1.7.6.3
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-12 10:43:17 -07:00
Junio C Hamano
e49450327e Merge branch 'jn/remote-helpers-doc'
* jn/remote-helpers-doc:
  (short) documentation for the testgit remote helper
  Documentation/git-remote-helpers: explain how import works with multiple refs
  Documentation/remote-helpers: explain capabilities first
2011-09-12 10:38:11 -07:00
Junio C Hamano
740a8fc224 Git 1.7.6.3
Signed-off-by: Junio C Hamano <gitster@pobox.com>
v1.7.6.3
2011-09-12 10:33:40 -07:00
Junio C Hamano
8702fee617 Merge branch 'jl/maint-fetch-submodule-check-fix' into maint
* jl/maint-fetch-submodule-check-fix:
  fetch: skip on-demand checking when no submodules are configured
2011-09-12 10:19:57 -07:00
Junio C Hamano
2f9e2e7587 Merge branch 'maint'
* maint:
  Prepare for 1.7.6.3 maintenance release
  SubmittingPathces: remove Cogito reference

Conflicts:
	RelNotes
2011-09-11 22:35:11 -07:00
Junio C Hamano
c2d53586dd Prepare for 1.7.6.3 maintenance release
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-11 22:33:27 -07:00
Junio C Hamano
e1fd529f2f Merge branch 'ms/reflog-show-is-default' into maint
* ms/reflog-show-is-default:
  reflog: actually default to subcommand 'show'
2011-09-11 22:33:24 -07:00
Junio C Hamano
2f19a52c64 Merge branch 'jk/reset-reflog-message-fix' into maint
* jk/reset-reflog-message-fix:
  reset: give better reflog messages
2011-09-11 22:33:20 -07:00
Junio C Hamano
5d4fcd9ac0 Merge branch 'vi/make-test-vector-less-specific' into maint
* vi/make-test-vector-less-specific:
  tests: cleanup binary test vector files
2011-09-11 22:33:16 -07:00
Junio C Hamano
fcfc2d5879 Merge branch 'jk/tag-contains-ab' (early part) into maint
* 'jk/tag-contains-ab' (early part):
  tag: speed up --contains calculation
2011-09-11 21:54:32 -07:00
Junio C Hamano
908bb1a9b7 Merge branch 'dz/connect-error-report' into maint
* dz/connect-error-report:
  Do not log unless all connect() attempts fail
2011-09-11 21:53:47 -07:00
Junio C Hamano
b3038a5adb Merge branch 'jc/maint-mergetool-read-fix' into maint
* jc/maint-mergetool-read-fix:
  mergetool: check return value from read
2011-09-11 21:53:39 -07:00
Junio C Hamano
eff7c32cfd Merge branch 'jk/maint-config-param' into maint
* jk/maint-config-param:
  config: use strbuf_split_str instead of a temporary strbuf
  strbuf: allow strbuf_split to work on non-strbufs
  config: avoid segfault when parsing command-line config
  config: die on error in command-line config
  fix "git -c" parsing of values with equals signs
  strbuf_split: add a max parameter
2011-09-11 21:53:13 -07:00
Junio C Hamano
7baf32a829 Merge branch 'jn/doc-dashdash' into maint
* jn/doc-dashdash:
  Documentation/i18n: quote double-dash for AsciiDoc
  Documentation: quote double-dash for AsciiDoc

Conflicts:
	Documentation/git-mergetool--lib.txt
2011-09-11 21:52:18 -07:00
Junio C Hamano
3fc44a10f6 Merge branch 'jk/maint-1.7.2-status-ignored' into maint
* jk/maint-1.7.2-status-ignored:
  git status --ignored: tests and docs
  status: fix bug with missing --ignore files

Conflicts:
	Documentation/git-status.txt
	t/t7508-status.sh
2011-09-11 21:51:10 -07:00
Martin von Zweigbergk
b52d00aede remote: only update remote-tracking branch if updating refspec
'git remote rename' will only update the remote's fetch refspec if it
looks like a default one. If the remote has no default fetch refspec,
as in

[remote "origin"]
    url = git://git.kernel.org/pub/scm/git/git.git
    fetch = +refs/heads/*:refs/remotes/upstream/*

we would not update the fetch refspec and even if there is a ref
called "refs/remotes/origin/master", we should not rename it, since it
was not created by fetching from the remote.

Suggested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-11 21:40:00 -07:00
Martin von Zweigbergk
1822b86a51 remote rename: warn when refspec was not updated
When renaming a remote, we also try to update the fetch refspec
accordingly, but only if it has the default format. For others, such
as refs/heads/master:refs/heads/origin, we are conservative and leave
it untouched. Let's give the user a warning about refspecs that are
not updated, so he can manually update the config if necessary.

Suggested-by: Jeff King <peff@peff.net>
Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-11 21:39:58 -07:00
Martin von Zweigbergk
60e5eee0f1 remote: "rename o foo" should not rename ref "origin/bar"
When renaming a remote called 'o' using 'git remote rename o foo', git
should also rename any remote-tracking branches for the remote. This
does happen, but any remote-tracking branches starting with
'refs/remotes/o', such as 'refs/remotes/origin/bar', will also be
renamed (to 'refs/remotes/foorigin/bar' in this case).

Fix it by simply matching one more character, up to the slash
following the remote name.

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-11 21:39:56 -07:00
Martin von Zweigbergk
28f555f635 remote: write correct fetch spec when renaming remote 'remote'
When renaming a remote whose name is contained in a configured fetch
refspec for that remote, we currently replace the first occurrence of
the remote name in the refspec. This is correct in most cases, but
breaks if the remote name occurs in the fetch refspec before the
expected place. For example, we currently change

[remote "remote"]
	url = git://git.kernel.org/pub/scm/git/git.git
	fetch = +refs/heads/*:refs/remotes/remote/*

into

[remote "origin"]
	url = git://git.kernel.org/pub/scm/git/git.git
	fetch = +refs/heads/*:refs/origins/remote/*

Reduce the risk of changing incorrect sections of the refspec by
matching the entire ":refs/remotes/<name>/" instead of just "<name>".

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-11 21:39:55 -07:00
Sverre Rabbelier
30962fb7fb SubmittingPathces: remove Cogito reference
Removing Cogito leaves just git and StGit, which is a rather
incomplete list of git diff tools available. Sidestep the problem
of deciding what tools to mention by not mentioning any.

Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-11 20:53:00 -07:00
Junio C Hamano
eb726f2d76 fsck: do not abort upon finding an empty blob
Asking fwrite() to write one item of size bytes results in fwrite()
reporting "I wrote zero item", when size is zero. Instead, we could
ask it to write "size" items of 1 byte and expect it to report that
"I wrote size items" when it succeeds, with any value of size,
including zero.

Noticed and reported by BJ Hargrave.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-11 18:03:38 -07:00
Junio C Hamano
3ab24efeef refs.c: make create_cached_refs() static
There is nobody outside that calls into this helper function.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-11 15:59:26 -07:00
Junio C Hamano
fb3198c57f builtin/revert.c: make commit_list_append() static
There is nobody outside that calls into this helper function.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-11 15:29:21 -07:00
Ramsay Jones
3254310863 obstack.c: Fix some sparse warnings
In particular, sparse issues the following warnings:

    compat/obstack.c:176:17: warning: Using plain integer as NULL pointer
    compat/obstack.c:224:17: warning: Using plain integer as NULL pointer
    compat/obstack.c:324:16: warning: Using plain integer as NULL pointer
    compat/obstack.c:329:16: warning: Using plain integer as NULL pointer
    compat/obstack.c:347:16: warning: Using plain integer as NULL pointer
    compat/obstack.c:362:19: warning: Using plain integer as NULL pointer
    compat/obstack.c:379:29: warning: Using plain integer as NULL pointer
    compat/obstack.c:399:1: error: symbol 'print_and_abort' redeclared with \
        different type (originally declared at compat/obstack.c:95) \
        - different modifiers

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-11 14:43:33 -07:00
Ramsay Jones
a946ef55f7 sparse: Fix an "Using plain integer as NULL pointer" warning
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-11 14:43:14 -07:00
Ramsay Jones
435bd2ae8e Makefile: Make dependency directory creation less noisy
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-11 13:50:44 -07:00
Junio C Hamano
52fed6e1ce receive-pack: check connectivity before concluding "git push"
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-09 15:19:05 -07:00
Junio C Hamano
f96400cb46 check_everything_connected(): libify
Extract the helper function and the type definition of the iterator
function it uses out of builtin/fetch.c into a separate source and a
header file.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-09 15:19:02 -07:00
Junio C Hamano
f0e278b1b7 check_everything_connected(): refactor to use an iterator
We will be using the same "rev-list --verify-objects" logic to add a
sanity check to the receiving end of "git push" in the same way, but the
list of commits that are checked come from a structure with a different
shape over there.

Update the function to take an iterator to make it easier to reuse it in
different contexts.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-09 15:07:56 -07:00