Commit graph

2790 commits

Author SHA1 Message Date
Junio C Hamano 1136e2c642 Merge branch 'cc/bisect' (early part)
* 'cc/bisect' (early part):
  bisect: check ancestors without forking a "git rev-list" process
  commit: add function to unparse a commit and its parents
  bisect: rework some rev related functions to make them more reusable
2009-05-31 16:16:48 -07:00
Jeff King 6e4f981ffb git-add: no need for -f when resolving a conflict in already tracked path
When a path F that matches ignore pattern has a conflict, "git add F"
insisted the -f option be given, which did not make sense.  It would have
required -f when the path was originally added, but when resolving a
conflict, it already is tracked.

So this should work (and does):

  $ echo file >.gitignore
  $ echo content >file
  $ git add -f file ;# need -f because we are adding new path
  $ echo more content >>file
  $ git add file ;# don't need -f; it is not actually an "other" file

This is handled under the hood by the COLLECT_IGNORED option to
read_directory. When that code finds an ignored file, it checks the
index to make sure it is not actually a tracked file. However, the test
it uses does not take into account unmerged entries, and considers them
to still be ignored. "git ls-files" uses a more elaborate test and gets
the right answer and the same test should be used here.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-31 15:59:16 -07:00
Junio C Hamano 0ddbbb6661 Merge git://git.bogomips.org/git-svn
* git://git.bogomips.org/git-svn:
  git-svn: refuse to dcommit non-UTF-8 messages
2009-05-30 22:25:41 -07:00
Junio C Hamano 9affecbc89 Merge branch 'sb/maint-1.6.2-opt-filename-fix'
* sb/maint-1.6.2-opt-filename-fix:
  apply, fmt-merge-msg: use relative filenames
  commit: -F overrides -t
2009-05-29 15:01:16 -07:00
Junio C Hamano 659f096896 Merge branch 'jc/maint-add-p-coalesce-fix'
* jc/maint-add-p-coalesce-fix:
  t3701: ensure correctly set up repository after skipped tests
  Revert "git-add--interactive: remove hunk coalescing"
  Splitting a hunk that adds a line at the top fails in "add -p"
2009-05-29 15:00:15 -07:00
Junio C Hamano 8e105e3928 Merge branch 'rs/maint-grep-word-regexp-fix'
* rs/maint-grep-word-regexp-fix:
  grep: fix word-regexp at the beginning of lines
2009-05-29 14:59:50 -07:00
Stephen Boyd 3be7e06713 t9120: don't expect failure with SVN_HTTPD_PORT unset
The test still passes when SVN_HTTPD_PORT is not set. Futhermore, t9115
and t9118 don't check if SVN_HTTPD_PORT is set even though they both use
start_httpd() from lib-git-svn.sh. Admittedly, the test is not very
meaningful without SVN_HTTPD_PORT, as commit f5530b (support for funky
branch and project names over HTTP(S) 2007-11-11) states that the URI
escaping is only done over HTTP(S).

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-29 00:53:43 -07:00
Junio C Hamano a9d29038a7 Merge branch 'maint'
* maint:
  fix segfault showing an empty remote
2009-05-28 22:50:23 -07:00
Eric Wong b510df8af2 git-svn: refuse to dcommit non-UTF-8 messages
...without i18n.commitencoding set in the config.

SVN tries to store all commit messages in UTF-8, however it is
up to the job of the clients to enforce this rule.  SVN servers
themselves do not always enforce this; allowing clients to
commit malformed UTF-8 messages and break repositories.

So git-svn will enforce this and tell the user to set
i18n.commitencoding when a git commit is is not in UTF-8.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2009-05-28 00:57:07 -07:00
Clemens Buchacher 6a01554e63 fix segfault showing an empty remote
In case of an empty list, the search for its tail caused a
NULL-pointer dereference.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Reported-by: Erik Faye-Lund <kusmabite@googlemail.com>
Acked-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-27 23:16:16 -07:00
Stephen Boyd 3902985a58 t5500: Modernize test style
Code outside of the test harness was emitting "Initializing..." from
git-init. Fixup this test to be more modern:

    - test_expect_object_count() and count_objects() are unused

    - use grep directly instead of test "..." = $(grep ...)

    - end the test_expect_success line with a single-quote and put the
      test on a new line

    - put as much code inside the test harness as possible

    - no_strict_count_check is unused and duplicates the test
      "new object count"

    - use && whenever possible to catch errors early

    - use test_tick instead of GIT_AUTHOR_DATE=$sec

    - remove debugging aid log.txt

    - use subshells instead of cd-ing around

Also merge the pull test into one large test.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-27 00:06:12 -07:00
Junio C Hamano 597a178246 Merge branch 'jm/format-patch-no-auto-n-when-k-is-given' into maint
* jm/format-patch-no-auto-n-when-k-is-given:
  format-patch let -k override a config-specified format.numbered
2009-05-25 19:03:52 -07:00
Junio C Hamano 5c44cc9ea2 Merge branch 'do/maint-merge-recursive-fix' into maint
* do/maint-merge-recursive-fix:
  merge-recursive: never leave index unmerged while recursing
2009-05-25 19:03:43 -07:00
Johannes Sixt 32a90233d1 t3701: ensure correctly set up repository after skipped tests
There are two tests that are skipped if file modes are not obeyed by the
file system. In this case, the subsequent test failed because the
repository was in an unexpected state. This corrects it.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-25 11:23:30 -07:00
Nguyễn Thái Ngọc Duy 7a7eb5173d t/t3400-rebase.sh: add more tests to help migrating git-rebase.sh to C
These new tests make sure I don't miss any check being performed before
rebase is proceeded (which is well tested by other tests)

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-24 10:25:55 -07:00
René Scharfe dbb6a4ada6 grep: fix word-regexp at the beginning of lines
After bol is forwarded, it doesn't represent the beginning of the line
any more.  This means that the beginning-of-line marker (^) mustn't match,
i.e. the regex flag REG_NOTBOL needs to be set.

This bug was introduced by fb62eb7fab
("grep -w: forward to next possible position after rejected match").

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-23 16:29:05 -07:00
Stephen Boyd 4c8d4c14c6 apply, fmt-merge-msg: use relative filenames
Commit dbd0f5c7 (Files given on the command line are relative to $cwd,
2008-08-06) only fixed git-commit and git-tag. But, git-apply and
git-fmt-merge-msg didn't get the update and exhibit the same behavior.

Fix them and add tests for "apply --build-fake-ancestor" and
"fmt-merge-msg -F".

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-23 15:45:52 -07:00
Stephen Boyd aae94ffbc1 commit: -F overrides -t
Commit dbd0f5c7 (Files given on the command line are relative to $cwd,
2008-08-06) introduced parse_options_fix_filename() as a quick fix for
filename arguments used in the parse options API.

git-commit was still broken. This means

    git commit -F log -t temp

in a subdirectory would make git think the log message should be taken
from temp instead of log.

This is because parse_options_fix_filename() calls prefix_filename()
which uses a single static char buffer to do its work. Making two calls
with two char pointers causes the pointers to alias. To prevent
aliasing, we duplicate the string returned by
parse_options_fix_filename().

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-23 15:45:52 -07:00
Junio C Hamano c9a88deede Merge branch 'mg/track'
* mg/track:
  Fix behavior with non-commit upstream references
  Test tracking of non-commit upstreams
2009-05-23 01:44:00 -07:00
Junio C Hamano 44ee247f8d Merge branch 'fc/decorate-tag'
* fc/decorate-tag:
  Prettify log decorations even more
  Change prettify_ref to prettify_refname
2009-05-23 01:43:50 -07:00
Junio C Hamano 5781e80ffd Merge branch 'jm/format-patch-no-auto-n-when-k-is-given'
* jm/format-patch-no-auto-n-when-k-is-given:
  format-patch let -k override a config-specified format.numbered
2009-05-23 01:40:22 -07:00
Junio C Hamano d32643c0ff Merge branch 'do/maint-merge-recursive-fix'
* do/maint-merge-recursive-fix:
  merge-recursive: never leave index unmerged while recursing
2009-05-23 01:39:50 -07:00
Junio C Hamano 104d379448 Merge branch 'rs/grep-parseopt'
* rs/grep-parseopt:
  grep: make callback functions static
  grep: use parseopt
  grep: remove global variable builtin_grep
  parseopt: add PARSE_OPT_NODASH
  parseopt: add OPT_NUMBER_CALLBACK
  parseopt: add OPT_NEGBIT
2009-05-23 01:38:32 -07:00
Junio C Hamano 9d764f9538 Merge branch 'fl/git-pm'
* fl/git-pm:
  Git.pm: Always set Repository to absolute path if autodetecting
  Git.pm: Set GIT_WORK_TREE if we set GIT_DIR
2009-05-23 01:38:28 -07:00
Junio C Hamano 77ce907786 Merge branch 'mt/submodule-reference'
* mt/submodule-reference:
  Add --reference option to git submodule.
2009-05-23 01:38:24 -07:00
Mark Lodato 36db1eddf9 git-svn: add --authors-prog option
Add a new option, --authors-prog, to git-svn that allows a more flexible
alternative (or supplement) to --authors-file.  This allows more
advanced username operations than the authors file will allow.  For
example, one may look up Subversion users via LDAP, or may generate the
name and email address from the Subversion username.

Notes:

* If both --authors-name and --authors-prog are given, the former is
  tried first, falling back to the later.

* The program is called once per unique SVN username, and the result is
  cached.

* The command-line argument must be the path to a program, not a generic
  shell command line.  The absolute path to this program is taken at
  startup since the git-svn script changes directory during operation.

* The option is not enabled for `git svn log'.

[ew: fixed case where neither --authors-(name|prog) were defined]
Signed-off-by: Mark Lodato <lodatom@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
2009-05-21 00:56:18 -07:00
Eygene Ryabinkin da083d688e git-svn testsuite: use standard configuration for Subversion tools
I have tweaked configuration in my ~/.subversion directory, namely I am
running auto-properties and automatically adding '$Id$' expansion to
every file.  This choke the last test named 'proplist' from
t9101-git-svn-props.sh, because one more property, svn:keywords is
automatically added.

I had just wrapped svn invocation with the svn_cmd that specifies empty
directory via --config-dir argument.  Since the latter is the global
option, it should be recognized by all svn subcommands, so no
regressions will be introduced.

Now svn_cmd is used everywhere, not just in the failed test module: this
should guard us from the future clashes with user-defined configuration
tweaks.

Signed-off-by: Eygene Ryabinkin <rea-git@codelabs.ru>
Acked-by: Eric Wong <normalperson@yhbt.net>
2009-05-21 00:31:07 -07:00
Junio C Hamano 362724af6c Merge branch 'js/add-edit'
* js/add-edit:
  t3702: fix reliance on SHELL_PATH being '/bin/sh'
  git-add: introduce --edit (to edit the diff vs. the index)
2009-05-18 09:00:06 -07:00
Junio C Hamano 7f1eaec7f4 Merge branch 'ac/graph-horizontal-line'
* ac/graph-horizontal-line:
  graph API: Use horizontal lines for more compact graphs
2009-05-18 08:59:30 -07:00
Christian Couder 2d938fc7bc bisect: check ancestors without forking a "git rev-list" process
We must save the pending commits that will be used during revision
walking and unparse them after, because we want to leave a clean
state for the next revision walking that will try to find the best
bisection point.

As we don't fork a process anymore to call "git rev-list", we need
to remove the use of GIT_TRACE to check how "git rev-list" is
called from the t6030 test that uses it.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-17 23:29:17 -07:00
Junio C Hamano 671d1bc6a0 Merge branch 'maint'
* maint:
  test: checkout shouldn't say that HEAD has moved if it didn't
  completion: enhance "current branch" display
  completion: simplify "current branch" in __git_ps1()
  completion: fix PS1 display during a merge on detached HEAD
  builtin-checkout: Don't tell user that HEAD has moved before it has
  pre-commit.sample: don't print incidental SHA1
  tests: Add tests for missing format-patch long options
  api-parse-options.txt: use 'func' instead of 'funct'
  Turn on USE_ST_TIMESPEC for OpenBSD
  ls-tree manpage: output of ls-tree is compatible with update-index
  ls-tree manpage: use "unless" instead of "when ... is not"
2009-05-16 19:49:42 -07:00
Nanako Shiraishi e4b09dad9f test: checkout shouldn't say that HEAD has moved if it didn't
Signed-off-by: しらいしななこ <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-16 19:49:25 -07:00
Alex Riesen 39d404d137 Use UTF-8 instead of utf8 for backward compatibility
An old iconv (GNU libiconv 1.11) does not know about utf8, it does know
UTF-8 though, which is also understood by all newer iconv implementations.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-16 19:43:29 -07:00
Junio C Hamano 7a26e65392 Revert "git-add--interactive: remove hunk coalescing"
This reverts commit 0beee4c6de but with a
bit of twist, as we have added "edit hunk manually" hack and we cannot
rely on the original line numbers of the hunks that were manually edited.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-16 18:52:12 -07:00
Matt Graham f67182bf65 Splitting a hunk that adds a line at the top fails in "add -p"
Splitting a hunk into two in add -p doesn't work for a diff that adds a
new line at the top of the file with other add in the same hunk.

Signed-off-by: Matthew Graham <mdg149@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-16 18:52:03 -07:00
Stephen Boyd f044fe2de6 tests: Add tests for missing format-patch long options
Exercise format-patch's --signoff, --in-reply-to and --start-number long
options.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-16 11:47:19 -07:00
Michael J Gruber 57ffc5f85a Fix behavior with non-commit upstream references
stat_tracking_info() assumes that upstream references (as specified by
--track or set up automatically) are commits. By calling lookup_commit()
on them, create_objects() creates objects for them with type commit no
matter what their real type is; this disturbs lookup_tag() later on in the
call sequence, leading to git status, git branch -v  and git checkout
erroring out.

Fix this by using lookup_commit_reference() instead so that (annotated)
tags can be used as upstream references.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-14 09:43:54 -07:00
Felipe Contreras de435ac0f6 Prettify log decorations even more
"tag: v1.6.2.5" looks much better than "tag: refs/tags/v1.6.2.5".

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-13 20:55:49 -07:00
Michael J Gruber 1be570f4eb Test tracking of non-commit upstreams
git-checkout and git-branch allow setting up an arbitrary committish as
the upstream reference for --track. In particular, tags are allowed. But
they and git-status barf on non-commit upstreams as soon as they are
asked for trackings stats.

Expose this shortcoming by adding two tests: annotated tags are affected
but lightweight tags are OK.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-13 20:25:56 -07:00
Junio C Hamano 4bf1f68ee7 Merge branch 'maint'
* maint:
  GIT 1.6.3.1
  Revert "checkout branch: prime cache-tree fully"
2009-05-12 22:51:28 -07:00
Junio C Hamano 235236c83d Merge branch 'maint-1.6.2' into maint
* maint-1.6.2:
  Revert "checkout branch: prime cache-tree fully"
2009-05-12 09:58:34 -07:00
Junio C Hamano a83502f8e5 Merge branch 'jc/maint-read-tree-multi' into maint-1.6.2
* jc/maint-read-tree-multi:
  Revert "checkout branch: prime cache-tree fully"
2009-05-12 09:58:21 -07:00
Junio C Hamano 49d833dc07 Revert "checkout branch: prime cache-tree fully"
The logic in 83ae209 (checkout branch: prime cache-tree fully,
2009-04-20) is bogus; checkout can switch branches with a dirty
index and in such a case the tree won't match HEAD.

Add t2014-switch to catch this breakage.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-12 09:57:21 -07:00
Junio C Hamano eb127887fa t3900: ISO-2022-JP has more than one popular variants
When converting from other encodings (e.g. EUC-JP or UTF-8), there are
subtly different variants of ISO-2022-JP, all of which are valid.  At the
end of line or when a run of string switches to 1-byte sequence, ESC ( B
can be used to switch to ASCII or ESC ( J can be used to switch to ISO
646:JP (JIS X 0201) but they essentially are the same character set and
are used interchangeably.  Similarly the set ESC $ @ switches to (JIS X
0208-1978) and ESC $ B switches to (JIS X 0208-1983) are in practice used
interchangeably.

Depending on the iconv library and the locale definition on the system, a
program that converts from another encoding to ISO-2022-JP can produce
different byte sequence, and GIT_TEST_CMP (aka "diff -u") will report the
difference as a failure.

Fix this by converting the expected and the actual output to UTF-8 before
comparing when the end result is ISO-2022-JP.  The test vector string in
t3900/ISO-2022-JP.txt is expressed with ASCII and JIS X 0208-1983, but it
can be expressed with any other possible variant, and when converted back
to UTF-8, these variants produce identical byte sequences.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-12 02:01:51 -07:00
Dave Olszewski bf74106a5b merge-recursive: never leave index unmerged while recursing
When you are trying to come up with the final result (i.e. depth=0), you
want to record how the conflict arose by registering the state of the
common ancestor, your branch and the other branch in the index, hence you
want to do update_stages().

When you are merging with positive depth, that is because of a criss-cross
merge situation.  In such a case, you would need to record the tentative
result, with conflict markers and all, as if the merge went cleanly, even
if there are conflicts, in order to write it out as a tree object later to
be used as a common ancestor tree.

update_file() calls update_file_flags() with update_cache=1 to signal that
the result needs to be written to the index at stage #0 (i.e. merged), and
the code should not clobber the index further by calling update_stages().

The codepath to deal with rename/delete conflict in a recursive merge
however left the index unmerged.

Signed-off-by: Dave Olszewski <cxreg@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-09 21:05:52 -07:00
Michael S. Tsirkin d92a39590d Add --reference option to git submodule.
This adds --reference option to git submodule add and
git submodule update commands, which is passed to git clone.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-09 08:27:52 -07:00
Frank Lichtenheld fe53bbc9be Git.pm: Always set Repository to absolute path if autodetecting
So far we only set it to absolute paths in some cases which lead
to problems like wc_chdir not working.

Signed-off-by: Frank Lichtenheld <flichtenheld@astaro.com>
Acked-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-09 08:25:55 -07:00
Frank Lichtenheld da159c7759 Git.pm: Set GIT_WORK_TREE if we set GIT_DIR
Otherwise git will use the current directory as work tree which will
lead to unexpected results if we operate in sub directory of the
work tree.

Signed-off-by: Frank Lichtenheld <flichtenheld@astaro.com>
Acked-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-09 08:25:55 -07:00
Jim Meyering ca6b91d29b format-patch let -k override a config-specified format.numbered
Let a command-line --keep-subject (-k) override a config-specified
format.numbered (--numbered (-n)), rather than provoking the
"-n and -k are mutually exclusive" failure.
* t4021-format-patch-numbered.sh: Test for the above

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-09 08:10:15 -07:00
René Scharfe 51a9949eda parseopt: add PARSE_OPT_NODASH
Add support for options that don't start with a dash.  Initially, they
don't accept arguments and can only be short options, i.e. consist of a
single character.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-09 00:29:50 -07:00