Commit graph

2957 commits

Author SHA1 Message Date
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
Junio C Hamano a0919ced8a Avoid "diff-index --cached" optimization under --find-copies-harder
When find-copies-harder is in effect, the diff frontends are expected to
feed all paths, not just changed paths, to the diffcore, so that copy
sources can be picked up.  In such a case, not descending into subtrees
using the cache-tree information is simply wrong.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-25 11:35:29 -07:00
Junio C Hamano aceae2ef92 t4007: modernize the style
This is one of the oldest scripts; update it to match more modern style.
Notably, we should:

 - Put the test title on the same line as the "test_expect_success", and
   end the line with a single-quote to begin the body of the test which is
   one multi-line string; and

 - Run as many commands inside test_expect_success, not outside, to catch
   unexpected breakages.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-25 11:35:29 -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
Stephen Boyd df217ed643 parse-opts: add OPT_FILENAME and transition builtins
Commit dbd0f5c (Files given on the command line are relative to $cwd,
2008-08-06) introduced parse_options_fix_filename() as a minimal fix.
OPT_FILENAME is intended to be a more robust fix for the same issue.
OPT_FILENAME and its associated enum OPTION_FILENAME are used to
represent filename options within the parse options API.

This option is similar to OPTION_STRING. If --no is prefixed to the
option the filename is unset. If no argument is given and the default
value is set, the filename is set to the default value. The difference
is that the filename is prefixed with the prefix passed to
parse_options() (or parse_options_start()).

Update git-apply, git-commit, git-fmt-merge-msg, and git-tag to use
OPT_FILENAME with their filename options. Also, rename
parse_options_fix_filename() to fix_filename() as it is no longer
extern.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-25 01:07:33 -07:00
Junio C Hamano 3d09e64ac1 Merge branch 'jc/mktree' into sb/opt-filename
* jc/mktree:
  mktree: validate entry type in input
  mktree --batch: build more than one tree object
  mktree --missing: updated usage message and man page
  mktree --missing: allow missing objects
  t1010: add mktree test
  mktree: do not barf on a submodule commit
  builtin-mktree.c: use a helper function to handle one line of input
  mktree: use parse-options
  build-in git-mktree
2009-05-25 01:04:10 -07:00
Junio C Hamano ee969693c5 Merge branch 'master' into sb/opt-filename
* master: (654 commits)
  http-push.c::remove_locks(): fix use after free
  t/t3400-rebase.sh: add more tests to help migrating git-rebase.sh to C
  post-receive-email: hooks.showrev: show how to include both web link and patch
  MinGW: Fix compiler warning in merge-recursive
  MinGW: Add a simple getpass()
  MinGW: use POSIX signature of waitpid()
  MinGW: the path separator to split GITPERLLIB is ';' on Win32
  MinGW: Scan for \r in addition to \n when reading shbang lines
  gitweb: Sanitize title attribute in format_subject_html
  Terminate argv with NULL before calling setup_revisions()
  doc/git-rebase.txt: remove mention of multiple strategies
  git-send-email: Handle quotes when parsing .mailrc files
  git-svn: add --authors-prog option
  git-svn: Set svn.authorsfile if it is passed to git svn clone
  git-svn: Correctly report max revision when following deleted paths
  git-svn: Fix for svn paths removed > log-window-size revisions ago
  git-svn testsuite: use standard configuration for Subversion tools
  grep: fix word-regexp colouring
  completion: use git rev-parse to detect bare repos
  Cope better with a _lot_ of packs
  ...
2009-05-25 00:59:07 -07:00
Charles Bailey 5719db91ce Change xdl_merge to generate output even for null merges
xdl_merge used to have a check to ensure that there was at least
some change in one or other side being merged but this suppressed
output for the degenerate case when base, local and remote
contents were all identical.

Removing this check enables correct output in the degenerate case
and xdl_free_script handles freeing NULL scripts so there is no
need to have the check for these calls.

Signed-off-by: Charles Bailey <charles@hashpling.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-24 23:56:34 -07:00
Charles Bailey 1cd12926ce t6023: merge-file fails to output anything for a degenerate merge
In the case that merge-file is passed three files with identical
contents it wipes the contents of the output file instead of
leaving it unchanged.

Althought merge-file is porcelain and this will never happen in
normal usage, it is still wrong.

Signed-off-by: Charles Bailey <charles@hashpling.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-24 23:46:03 -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
Brandon Casey bb43414b37 t8005: convert CP1251 character set to ISO8859-5
On IRIX 6.5 CP1251 is unknown, but WIN1251 (which seems to be a
non-standard name) is known.  On Solaris 10, the opposite is true.  Solaris
also knows CP1251 as WINDOWS-1251, but this too is not recognized on IRIX.
I could not find a name that both platforms recognized for this character
set.

An alternative character set which covers the same alphabet seems to be the
ISO8859-5 character set.  Both platforms support this character set, so use
it instead.

This allows t8005.4 to pass on Solaris 7, and part of the test to pass on
IRIX. (My IRIX can't convert SJIS to UTF-8 :(

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-22 22:41:04 -07:00
Brandon Casey bdb0a7e4e4 t8005: use more portable character encoding names
Some platforms do not have an extensive list of alternate names for
character encodings.

Solaris 7 does not know about shift-jis, but does know SJIS.  It also does
not know that utf-8 and UTF-8 refer to the same encoding.

With the above in mind, the following conversions were performed:

      utf-8 --> UTF-8
  shift-jis --> SJIS

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-22 22:40:22 -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
Brandon Casey bf1db7dba5 t5100: use ancient encoding syntax for backwards compatibility
Some ancient platforms do not have an extensive list of alternate names for
character encodings.  For example, Solaris 7 does not know that ISO-8859-1
is the same as ISO8859-1.  Modern platforms do know this, so use the older
names.

The following conversions were performed:

    ISO-8859-1 --> ISO8859-1
    ISO-8859-2 --> ISO8859-2
    ISO-8859-8 --> ISO8859-8
    iso-2022-jp --> ISO-2022-JP

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-18 20:53:19 -07:00
Brandon Casey e0d44c5075 t9301: use ISO8859-1 rather than ISO-8859-1
Some ancient platforms do not have an extensive list of alternate names for
character encodings.  For example, Solaris 7 does not know that ISO-8859-1
is the same as ISO8859-1.  Modern platforms do know this, so use the older
name.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-18 20:53:18 -07:00
Brandon Casey 1e6bca0e89 t3901: Use ISO8859-1 instead of ISO-8859-1 for backward compatibility
Some ancient platforms do not have an extensive list of alternate names for
character encodings.  For example, Solaris 7 does not know that ISO-8859-1
is the same as ISO8859-1.  Modern platforms do know this, so use the older
name.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-18 20:53:17 -07:00
Brandon Casey d4ea4e2746 t3901: avoid negation on right hand side of '|'
Some shells do not properly handle constructs of the form:

   spew_something | ! process_input

So rewrite this to be:

   spew_something | process_input; test $? != 0

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-18 20:53:16 -07:00
Brandon Casey 5ae93dfdcc t3900: use ancient iconv names for backward compatibility
Some old iconv implementations do not have many alternate names and/or
do not match character encoding names case insensitively.  These
implementations can not tell that utf-8 and UTF-8 are the same encoding
and fail when trying to do the conversion.  So use the old names, which
modern implementations still support.

The following conversions were performed:

         utf-8 --> UTF-8
    ISO-8859-1 --> ISO8859-1
         EUCJP --> eucJP

Also update t9129 and t9500 which make use of the test files in t/t3900.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-18 20:53:11 -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
Junio C Hamano 1c64e79a62 mktree --missing: allow missing objects
We need to allow input lines that point at objects that we do not
have when dealing with submodule entries anyway.  This adds an explicit
option to allow missing objects of other types, to be consistent with
the use of --info-only option to the update-index command and --missing-ok
option to the write-tree command.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-10 17:31:01 -07:00
Junio C Hamano 801cfae8fd t1010: add mktree test
So far mktree (which has always been a quick hack) had no test.
At least give it a bit of test coverage.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-10 12:41:35 -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
René Scharfe e0319ff5ed parseopt: add OPT_NUMBER_CALLBACK
Add a way to recognize numerical options.  The number is passed to
a callback function as a string.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-09 00:29:47 -07:00
René Scharfe 2f4b97f910 parseopt: add OPT_NEGBIT
Add OPTION_NEGBIT and OPT_NEGBIT, mirroring OPTION_BIT and OPT_BIT.
OPT_NEGBIT can be used together with OPT_BIT to define two options
that cancel each other out.

Note: this patch removes the reminder from the test script because
it adds a test for --no-or4 and there already was one for --or4.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-09 00:28:53 -07:00
Nguyễn Thái Ngọc Duy c5ae7cb6d9 t4029: use sh instead of bash
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-06 18:16:26 -07:00
Brandon Casey 5e16488edc t4200: convert sed expression which operates on non-text file to perl
POSIX only requires sed to work on text files and MERGE_RR is not a text
file.  Some versions of sed complain that this file is not newline
terminated, and exit non-zero.  Use perl instead which does not have a
problem with it.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-06 16:43:29 -07:00
Brandon Casey 9eda0e980a t4200: remove two unnecessary lines
These two lines appear to be unnecessary.  They set variables which are not
used afterwards.  The primary motivation to remove them is that the sed
invocation exits non-zero for seds which require newline termination of
input files.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-06 16:43:28 -07:00
Brandon Casey d8b69ecb4c t/annotate-tests.sh: avoid passing a non-newline terminated file to sed
Some versions of sed exit non-zero if the file they are supplied is not
newline terminated.  Solaris's /usr/xpg4/bin/sed is one such sed.  So
rework this test to avoid doing so.

This affects tests t8001-annotate.sh and t8002-blame.sh.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-06 11:50:44 -07:00
Brandon Casey 325fb15104 t4118: avoid sed invocation on file without terminating newline
Some versions of sed exit non-zero if the file they are supplied is not
newline terminated. Solaris's /usr/xpg4/bin/sed is one such sed.  In
this case the sed invocation can be avoided entirely since the resulting
file is equivalent to a previously created file.  So, just copy that file
into place instead.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-06 11:49:14 -07:00
Brandon Casey 723570469f t4118: add missing '&&'
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-06 11:49:05 -07:00
Brandon Casey 0b05dc2b7e t8005: use egrep when extended regular expressions are required
Not all versions of grep understand backslashed extended regular
expressions.  Possibly only gnu grep does.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-06 11:48:58 -07:00
Junio C Hamano 8146f19762 Merge branch 'maint'
* maint:
  improve error message in config.c
  t4018-diff-funcname: add cpp xfuncname pattern to syntax test
  Work around BSD whose typeof(tv.tv_sec) != time_t
  git-am.txt: reword extra headers in message body
  git-am.txt: Use date or value instead of time or timestamp
  git-am.txt: add an 'a', say what 'it' is, simplify a sentence
  dir.c: Fix two minor grammatical errors in comments
  git-svn: fix a sloppy Getopt::Long usage
2009-05-05 22:52:17 -07:00
Brandon Casey 066e596abb t4018-diff-funcname: add cpp xfuncname pattern to syntax test
Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-05 22:49:02 -07:00
Junio C Hamano c2eae0a5f6 Merge branch 'mk/maint-apply-swap' into maint
* mk/maint-apply-swap:
  tests: make test-apply-criss-cross-rename more robust
  builtin-apply: keep information about files to be deleted
  tests: test applying criss-cross rename patch
2009-05-03 15:02:52 -07:00
Junio C Hamano e89c6ea998 Merge branch 'jc/maint-1.6.0-keep-pack' into maint-1.6.1
* jc/maint-1.6.0-keep-pack:
  pack-objects: don't loosen objects available in alternate or kept packs
  t7700: demonstrate repack flaw which may loosen objects unnecessarily
  Remove --kept-pack-only option and associated infrastructure
  pack-objects: only repack or loosen objects residing in "local" packs
  git-repack.sh: don't use --kept-pack-only option to pack-objects
  t7700-repack: add two new tests demonstrating repacking flaws
  is_kept_pack(): final clean-up
  Simplify is_kept_pack()
  Consolidate ignore_packed logic more
  has_sha1_kept_pack(): take "struct rev_info"
  has_sha1_pack(): refactor "pretend these packs do not exist" interface
  git-repack: resist stray environment variable
2009-05-03 15:01:31 -07:00
Junio C Hamano 3f3e2c26fa Merge branch 'jc/maint-1.6.0-diff-borrow-carefully' into maint-1.6.1
* jc/maint-1.6.0-diff-borrow-carefully:
  diff --cached: do not borrow from a work tree when a path is marked as assume-unchanged
2009-05-03 15:01:26 -07:00
Junio C Hamano 652f0c8f1d Merge branch 'bs/maint-1.6.0-tree-walk-prefix' into maint-1.6.1
* bs/maint-1.6.0-tree-walk-prefix:
  match_tree_entry(): a pathspec only matches at directory boundaries
  tree_entry_interesting: a pathspec only matches at directory boundary
2009-05-03 15:01:19 -07:00
Junio C Hamano d1c8c0c8c4 Merge branch 'maint'
* maint:
  diff -c -p: do not die on submodules

Conflicts:
	combine-diff.c
2009-04-29 16:50:31 -07:00
Junio C Hamano 0c44c94309 merge-recursive: do not die on a conflicting submodule
We cannot represent the 3-way conflicted state in the work tree
for these entries, but it is normal not to have commit objects
for them in our repository.  Just update the index and the life
will be good.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-29 16:50:21 -07:00
Junio C Hamano a2dc04ba15 Merge branch 'maint-1.6.1' into maint
* maint-1.6.1:
  diff -c -p: do not die on submodules
2009-04-29 15:40:33 -07:00
Junio C Hamano 934747323c Merge branch 'maint-1.6.0' into maint-1.6.1
* maint-1.6.0:
  diff -c -p: do not die on submodules
2009-04-29 13:43:13 -07:00
Junio C Hamano 7dae8b21c2 diff -c -p: do not die on submodules
The combine diff logic knew only about blobs (and their checked-out form
in the work tree, either regular files or symlinks), and barfed when fed
submodules.  This "externalizes" gitlinks in the same way as the normal
patch generation codepath does (i.e. "Subproject commit Xxx\n") to fix the
issue.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-29 12:49:52 -07:00
Junio C Hamano b79376cdf3 Merge branch 'maint'
* maint:
  grep: fix segfault when "git grep '('" is given
  Documentation: fix a grammatical error in api-builtin.txt
  builtin-merge: fix a typo in an error message
2009-04-28 00:46:39 -07:00
Junio C Hamano 2254da06a5 Merge branch 'maint-1.6.1' into maint
* maint-1.6.1:
  grep: fix segfault when "git grep '('" is given
  Documentation: fix a grammatical error in api-builtin.txt
  builtin-merge: fix a typo in an error message
2009-04-28 00:46:25 -07:00
Junio C Hamano 3e73cb2f48 Merge branch 'maint-1.6.0' into maint-1.6.1
* maint-1.6.0:
  grep: fix segfault when "git grep '('" is given
  Documentation: fix a grammatical error in api-builtin.txt
  builtin-merge: fix a typo in an error message
2009-04-28 00:46:20 -07:00
Johannes Schindelin 7c8224b6a8 t3702: fix reliance on SHELL_PATH being '/bin/sh'
Trying to be lazy and comparing files with fake-editor.sh to avoid
having to provide another example text does not work well: the blob
name changes when SHELL_PATH changes, and so does the 'index' line
in the diff.

Therefore provide a second example text.

Noticed by Mike Ralphson.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-27 18:23:55 -07:00
Linus Torvalds c922b01f54 grep: fix segfault when "git grep '('" is given
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-27 17:28:18 -07:00
Johannes Schindelin b9d622e711 t5701: do not get stuck in empty-push/
A test might happen to be the last one in the script, but other people
later may want to add more tests after your test is done.

Do not surprise them by going in a subdirectory to run a part of your test
and never coming out of it.  This fixes a162e78 in that respect.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-27 16:33:53 -07:00
Linus Torvalds 95110d75d9 t4202: fix typo
While I did a

	make -j64 test > ~/t.out

to check my previous patch (in case some test actually tested 'trustctime'
or something), I noticed this one. Somebody has speeling trouble:

	t4202-log.sh: line 345: test_expect_sucess: command not found

Fixed thus.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-26 16:20:25 -07:00
Brandon Casey 1ef2d5a640 t7700-repack: repack -a now works properly, expect success from test
Since the recent rework of the object listing mechanism of
pack-objects/rev-list, git-repack now properly packs objects from alternate
repositories even when the local repository contains packs.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-25 08:54:18 -07:00
Brandon Casey 84eeb687de t9001: use older Getopt::Long boolean prefix '--no' rather than '--no-'
The '--no-thread' option is a Getopt::Long boolean option. The '--no-'
prefix (as in --no-thread) for boolean options is not supported in
Getopt::Long version 2.32 which was released with Perl 5.8.0. This version
only supports '--no' as in '--nothread'.  More recent versions of
Getopt::Long, such as version 2.34, support either prefix. So use the older
form in the tests.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-25 08:54:18 -07:00
Jeff King a766829458 t7800: respect NO_PERL
Difftool is written in perl, so we don't build it if NO_PERL
is set.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-24 09:24:35 -07:00
Peter Hutterer ca2cedba70 git-submodule: add support for --rebase.
'git submodule update --rebase' rebases your local branch on top of what
would have been checked out to a detached HEAD otherwise.

In some cases, detaching the HEAD when updating a submodule complicates
the workflow to commit to this submodule (checkout master, rebase, then
commit).  For submodules that require frequent updates but infrequent
(if any) commits, a rebase can be executed directly by the git-submodule
command, ensuring that the submodules stay on their respective branches.

git-config key: submodule.$name.rebase (bool)

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-24 01:20:25 -07:00
Allan Caffee eaf158f8bd graph API: Use horizontal lines for more compact graphs
Use horizontal lines instead of long diagonal lines during the
collapsing state of graph rendering.  For example what used to be:

    | | | | |
    | | | |/
    | | |/|
    | |/| |
    |/| | |
    | | | |

is now

    | | | | |
    | |_|_|/
    |/| | |
    | | | |

This results in more compact and legible graphs.

Signed-off-by: Allan Caffee <allan.caffee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-22 18:32:16 -07:00
Allan Caffee a6c1a3827c graph API: fix a bug in the rendering of octopus merges
An off by one error was causing octopus merges with 3 parents to not be
rendered correctly.  This regression was introduced by 427fc5.

Signed-off-by: Allan Caffee <allan.caffee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-22 17:49:56 -07:00
Allan Caffee 7b1d6269ee t4202-log: extend test coverage of graphing
Extend this test to cover the rendering of graphs with octopus merges
and pre_commit lines.

Signed-off-by: Allan Caffee <allan.caffee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-22 17:48:22 -07:00
Michael J Gruber 3a0483281a test-lib.sh: Help test_create_repo() find the templates dir
Currently, test_create_repo() expects that templates can be found below
`pwd`/.. This assumption fails when tests are run against a git
installed somewhere else or test_create_repo() is called from
subdirectiories (several tests do this).
Therefore, use $TEST_DIRECTORY as introduced in 2d84e9fb and expect
templates to be present in $TEST_DIRECTORY/.. which should be the root
dir of the git checkout.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-21 09:49:04 -07:00
Junio C Hamano 0be9bc0f0a Merge branch 'mk/maint-apply-swap'
* mk/maint-apply-swap:
  tests: make test-apply-criss-cross-rename more robust
  builtin-apply: keep information about files to be deleted
  tests: test applying criss-cross rename patch

Conflicts:
	t/t4130-apply-criss-cross-rename.sh
2009-04-21 00:16:09 -07:00
Matthieu Moy a162e78df0 clone: add test for push on an empty clone.
Commit 55f0566 (get_local_heads(): do not return random pointer if
there is no head, 2009-04-17) fixed a segfault for git push, this
patch adds a test-case to avoid future regressions.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-20 13:53:03 -07:00
Michał Kiedrowicz f0583867e7 tests: make test-apply-criss-cross-rename more robust
I realized that this test does check if git-apply succeeds, but doesn't
tell if it applies patches correctly. So I added test_cmp to check it.

I also added a test which checks swapping three files.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-20 13:47:02 -07:00
Michał Kiedrowicz e8141fcf54 builtin-apply: keep information about files to be deleted
Example correct diff generated by `diff -M -B' might look like this:

	diff --git a/file1 b/file2
	similarity index 100%
	rename from file1
	rename to file2
	diff --git a/file2 b/file1
	similarity index 100%
	rename from file2
	rename to file1

Information about removing `file2' comes after information about creation
of new `file2' (renamed from `file1'). Existing implementation isn't able to
apply such patch, because it has to know in advance which files will be
removed.

This patch populates fn_table with information about removal of files
before calling check_patch() for each patch to be applied.

Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-20 13:46:58 -07:00
Michał Kiedrowicz 1d49f0d1a1 tests: test applying criss-cross rename patch
Originally reported by Linus in $gmane/116198

Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-20 13:46:55 -07:00
Junio C Hamano 4f26c39806 Merge branch 'ef/maint-fast-export' into maint
* ef/maint-fast-export:
  builtin-fast-export.c: handle nested tags
  builtin-fast-export.c: fix crash on tagged trees
  builtin-fast-export.c: turn error into warning
  test-suite: adding a test for fast-export with tag variants
2009-04-19 12:40:17 -07:00
Junio C Hamano 5027acc4db Merge branch 'jc/maint-shared-literally' into maint
* jc/maint-shared-literally:
  Update docs on behaviour of 'core.sharedRepository' and 'git init --shared'
  t1301-shared-repo: fix forced modes test
2009-04-19 12:40:05 -07:00
Erik Faye-Lund aadd44404b builtin-fast-export.c: handle nested tags
When tags that points to tags are passed to fast-export, an error is given,
saying "Tag [TAGNAME] points nowhere?". This fix calls parse_object() on the
object before referencing it's tag, to ensure the tag-info is fully initialized.
In addition, it inserts a comment to point out where nested tags are handled.
This is consistent with the comment for signed tags.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-19 12:29:26 -07:00
Erik Faye-Lund 426193c025 builtin-fast-export.c: fix crash on tagged trees
If a tag object points to a tree (or another unhandled type), the commit-
pointer is left uninitialized and later dereferenced. This patch adds a
default case to the switch that issues a warning and skips the object.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-19 12:29:26 -07:00
Erik Faye-Lund 1092f6b3f8 test-suite: adding a test for fast-export with tag variants
Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-19 12:29:25 -07:00
Ben Jackson ea10b60c91 Work around ash "alternate value" expansion bug
Ash (used as /bin/sh on many distros) has a shell expansion bug
for the form ${var:+word word}.  The result is a single argument
"word word".  Work around by using ${var:+word} ${var:+word} or
equivalent.

Signed-off-by: Ben Jackson <ben@ben.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-18 21:37:46 -07:00
Junio C Hamano 5758b25da4 Merge branch 'nd/archive-attribute'
* nd/archive-attribute:
  archive test: attributes
  archive: do not read .gitattributes in working directory
  unpack-trees: do not muck with attributes when we are not checking out
  attr: add GIT_ATTR_INDEX "direction"
  archive tests: do not use .gitattributes in working directory
2009-04-18 14:46:08 -07:00
Junio C Hamano cef5775b9f Merge branch 'maint'
* maint:
  Describe fixes since 1.6.2.3
  doc/git-daemon: add missing arguments to max-connections option
  doc/git-daemon: add missing arguments to options
  init: Do not segfault on big GIT_TEMPLATE_DIR environment variable
  imap-send: use correct configuration variable in documentation
2009-04-18 14:45:59 -07:00
Junio C Hamano a4d1797332 Merge branch 'maint-1.6.0' into maint-1.6.1
* maint-1.6.0:
  doc/git-daemon: add missing arguments to options
  init: Do not segfault on big GIT_TEMPLATE_DIR environment variable
2009-04-18 14:43:24 -07:00
Junio C Hamano 08e7239c36 Merge branch 'bs/maint-1.6.0-tree-walk-prefix' into maint
* bs/maint-1.6.0-tree-walk-prefix:
  match_tree_entry(): a pathspec only matches at directory boundaries
  tree_entry_interesting: a pathspec only matches at directory boundary
2009-04-18 14:18:32 -07:00
Junio C Hamano f392485813 Merge branch 'js/maint-submodule-checkout' into maint
* js/maint-submodule-checkout:
  Fix 'git checkout <submodule>' to update the index
2009-04-18 14:18:29 -07:00
Junio C Hamano eb8a1c4aed Merge branch 'cb/maint-merge-recursive-submodule-fix' into maint
* cb/maint-merge-recursive-submodule-fix:
  simplify output of conflicting merge
  update cache for conflicting submodule entries
  add tests for merging with submodules
2009-04-18 14:18:25 -07:00
Junio C Hamano d890d3f996 Merge branch 'maint-1.6.0' into maint
* maint-1.6.0:
  doc/git-daemon: add missing arguments to options
  init: Do not segfault on big GIT_TEMPLATE_DIR environment variable
2009-04-18 13:39:52 -07:00
Frank Lichtenheld 32d1776b13 init: Do not segfault on big GIT_TEMPLATE_DIR environment variable
Signed-off-by: Frank Lichtenheld <flichtenheld@astaro.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-18 13:06:40 -07:00
Junio C Hamano fc917ad6b2 Merge branch 'mk/apply-swap'
* mk/apply-swap:
  builtin-apply: keep information about files to be deleted
  tests: test applying criss-cross rename patch
2009-04-17 21:42:13 -07:00
Junio C Hamano 1dd9b638c1 Merge branch 'jc/shared-literally'
* jc/shared-literally:
  t1301-shared-repo: fix forced modes test
2009-04-17 21:42:12 -07:00
Junio C Hamano 1ee28e58d5 Merge branch 'ns/am-to-empty'
* ns/am-to-empty:
  git-am: teach git-am to apply a patch to an unborn branch
2009-04-17 21:42:12 -07:00
Junio C Hamano a9b772a011 Merge branch 'bw/short-ref-strict'
* bw/short-ref-strict:
  remote.c: use shorten_unambiguous_ref
  rev-parse: --abbrev-ref option to shorten ref name
  for-each-ref: utilize core.warnAmbiguousRefs for :short-format
  shorten_unambiguous_ref(): add strict mode
2009-04-17 21:42:12 -07:00
Junio C Hamano bd15ef078a Merge branch 'da/difftool'
* da/difftool:
  mergetool--lib: simplify API usage by removing more global variables
  Fix misspelled mergetool.keepBackup
  difftool/mergetool: refactor commands to use git-mergetool--lib
  mergetool: use $( ... ) instead of `backticks`
  bash completion: add git-difftool
  difftool: add support for a difftool.prompt config variable
  difftool: add various git-difftool tests
  difftool: move 'git-difftool' out of contrib
  difftool/mergetool: add diffuse as merge and diff tool
  difftool: add a -y shortcut for --no-prompt
  difftool: use perl built-ins when testing for msys
  difftool: remove the backup file feature
  difftool: remove merge options for opendiff, tkdiff, kdiff3 and xxdiff
  git-mergetool: add new merge tool TortoiseMerge
  git-mergetool/difftool: make (g)vimdiff workable under Windows
  doc/merge-config: list ecmerge as a built-in merge tool
2009-04-17 21:42:12 -07:00
Junio C Hamano 2d430c7133 Merge branch 'maint'
* maint:
  doc/gitattributes: clarify location of config text
  Fix buffer overflow in config parser
  git-apply: fix option description
2009-04-17 21:29:15 -07:00
Junio C Hamano f7446fc6bb Merge branch 'maint-1.6.1' into maint
* maint-1.6.1:
  Fix buffer overflow in config parser
2009-04-17 21:20:58 -07:00
Junio C Hamano 0fa0514b91 Merge branch 'maint-1.6.0' into maint-1.6.1
* maint-1.6.0:
  Fix buffer overflow in config parser
2009-04-17 21:06:11 -07:00
René Scharfe 8aece7ff06 archive test: attributes
Add a test script for all archive attributes and their handling in
normal and bare repositories.  export-ignore and export-subst are
tested, as well as the effect of the option --worktree-attributes.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-17 21:05:49 -07:00
René Scharfe ad94657fdb archive tests: do not use .gitattributes in working directory
We are interested in using archive mostly from a bare repository, so it
should not add .gitattributes to the work tree.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-17 21:05:49 -07:00
Thomas Jarosch e0b3cc0dff Fix buffer overflow in config parser
When interpreting a config value, the config parser reads in 1+ space
character(s) and puts -one- space character in the buffer as soon as
the first non-space character is encountered (if not inside quotes).

Unfortunately the buffer size check lacks the extra space character
which gets inserted at the next non-space character, resulting in
a crash with a specially crafted config entry.

The unit test now uses Java to compile a platform independent
.NET framework to output the test string in C# :o)

    Read: Thanks to Johannes Sixt for the correct printf call
    which replaces the perl invocation.

Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-17 20:59:01 -07:00
Michał Kiedrowicz 7fac0eef91 builtin-apply: keep information about files to be deleted
Example correct diff generated by `diff -M -B' might look like this:

	diff --git a/file1 b/file2
	similarity index 100%
	rename from file1
	rename to file2
	diff --git a/file2 b/file1
	similarity index 100%
	rename from file2
	rename to file1

Information about removing `file2' comes after information about creation
of new `file2' (renamed from `file1'). Existing implementation isn't able to
apply such patch, because it has to know in advance which files will be
removed.

This patch populates fn_table with information about removal of files
before calling check_patch() for each patch to be applied.

Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-15 17:47:55 -07:00
Michał Kiedrowicz d8c81dfcaf tests: test applying criss-cross rename patch
Originally reported by Linus in $gmane/116198

Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-13 09:48:49 -07:00
Bert Wesarg 2bb98169be for-each-ref: utilize core.warnAmbiguousRefs for :short-format
core.warnAmbiguousRefs is used to select strict mode for the
abbreviation for the ":short" format specifier of "refname" and "upstream".

In strict mode, the abbreviated ref will never trigger the
'warn_ambiguous_refs' warning. I.e. for these refs:

  refs/heads/xyzzy
  refs/tags/xyzzy

the abbreviated forms are:

  heads/xyzzy
  tags/xyzzy

Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-13 09:36:52 -07:00
Nanako Shiraishi f79d4c8a0f git-am: teach git-am to apply a patch to an unborn branch
People sometimes wonder why they cannot apply a patch that only
creates new files to an unborn branch.

Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-12 18:42:15 -07:00
Junio C Hamano 7d5a1806e8 Mark t1301 permission test to depend on POSIXPERM
This prepares the topic for inclusion to master.
2009-04-12 17:56:25 -07:00
Junio C Hamano 6f523f6d38 Merge branch 'jk/no-perl'
* jk/no-perl:
  tests: skip perl tests if NO_PERL is defined
  Makefile: allow building without perl
2009-04-12 16:46:42 -07:00
Junio C Hamano 3e52effcf6 Merge branch 'jk/show-upstream'
* jk/show-upstream:
  branch: show upstream branch when double verbose
  make get_short_ref a public function
  for-each-ref: add "upstream" format field
  for-each-ref: refactor refname handling
  for-each-ref: refactor get_short_ref function
2009-04-12 16:46:42 -07:00
Junio C Hamano c276857ee2 Merge branch 'fg/remote-prune'
* fg/remote-prune:
  add tests for remote groups
  git remote update: Fallback to remote if group does not exist
  remote: New function remote_is_configured()
  git remote update: Report error for non-existing groups
  git remote update: New option --prune
  builtin-remote.c: Split out prune_remote as a separate function.
2009-04-12 16:46:41 -07:00
Junio C Hamano 6e353a5e5d Merge branch 'cc/bisect-filter'
* cc/bisect-filter: (21 commits)
  rev-list: add "int bisect_show_flags" in "struct rev_list_info"
  rev-list: remove last static vars used in "show_commit"
  list-objects: add "void *data" parameter to show functions
  bisect--helper: string output variables together with "&&"
  rev-list: pass "int flags" as last argument of "show_bisect_vars"
  t6030: test bisecting with paths
  bisect: use "bisect--helper" and remove "filter_skipped" function
  bisect: implement "read_bisect_paths" to read paths in "$GIT_DIR/BISECT_NAMES"
  bisect--helper: implement "git bisect--helper"
  bisect: use the new generic "sha1_pos" function to lookup sha1
  rev-list: call new "filter_skip" function
  patch-ids: use the new generic "sha1_pos" function to lookup sha1
  sha1-lookup: add new "sha1_pos" function to efficiently lookup sha1
  rev-list: pass "revs" to "show_bisect_vars"
  rev-list: make "show_bisect_vars" non static
  rev-list: move code to show bisect vars into its own function
  rev-list: move bisect related code into its own file
  rev-list: make "bisect_list" variable local to "cmd_rev_list"
  refs: add "for_each_ref_in" function to refactor "for_each_*_ref" functions
  quote: add "sq_dequote_to_argv" to put unwrapped args in an argv array
  ...
2009-04-12 16:46:40 -07:00
Johannes Sixt 078688213f t1301-shared-repo: fix forced modes test
This test was added recently (5a688fe, "core.sharedrepository = 0mode"
should set, not loosen; 2009-03-28). It checked the result of a sed
invocation for emptyness, but in some cases it forgot to print anything
at all, so that those checks would never be false.

Due to this mistake, it went unnoticed that the files in objects/info are
not necessarily 0440, but can also be 0660.  Because the 0mode setting
tries to guarantee that the files are accessible only to the people they
are meant to be used by, we should only make sure that they are readable
by the user and the group when the configuration is set to 0660.  It is a
separate matter from the core.shredrepository settings that w-bit from
immutable object files under objects/[0-9a-f][0-9a-f] directories should
be dropped.

COMMIT_EDITMSG is still world-readable, but it (and any transient files
that are meant for repositories with a work tree) does not matter.  If you
are working on a shared machine and on a sekrit stuff, the root of the
work tree would be with mode 0700 (or 0750 to allow peeking by other
people in the group), and that would mean that .git/COMMIT_EDITMSG in such
a repository would not be readable by the strangers anyway.

Also, in the real-world use case, .git/COMMIT_EDITMSG will be given to an
arbitrary editor the user happens to use, and we have no guarantee what it
does (e.g. it may create a new file with umask and replace, it may rewrite
in place, it may leave an editor backup file but use umask to create it,
etc.), and the protection of the file lies majorly on the protection of
the root of the work tree.

This test cannot be run on Windows; it requires POSIXPERM when merged to
'master'.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-12 13:34:06 -07:00
Johannes Schindelin c59cb03a8b git-add: introduce --edit (to edit the diff vs. the index)
With "git add -e [<files>]", Git will fire up an editor with the current
diff relative to the index (i.e. what you would get with "git diff
[<files>]").

Now you can edit the patch as much as you like, including adding/removing
lines, editing the text, whatever.  Make sure, though, that the first
character of the hunk lines is still a space, a plus or a minus.

After you closed the editor, Git will adjust the line counts of the hunks
if necessary, thanks to the --recount option of apply, and commit the
patch.  Except if you deleted everything, in which case nothing happens
(for obvious reasons).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-12 11:56:17 -07:00
Ben Jackson 88ec205477 git-svn: Save init/clone --ignore-paths in config
The --ignored-paths argument is now stored as
"svn-remote.$REMOTE_NAME.ignore-paths" in the config file.

[ew: edited subject and message]
Signed-off-by: Ben Jackson <ben@ben.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
2009-04-11 17:55:37 -07:00
Ben Jackson 0d8bee71af git-svn: Add per-svn-remote ignore-paths config
The --ignore-paths option to fetch is very useful for working on a subset
of a SVN repository.  For proper operation, every command that causes a
fetch (explicit or implied) must include a matching --ignore-paths option.

This patch adds a persistent svn-remote.$repo_id.ignore-paths config by
promoting Fetcher::is_path_ignored to a member function and initializing
$self->{ignore_regex} in Fetcher::new.  Command line --ignore-paths is
still recognized and acts in addition to the config value.

Signed-off-by: Ben Jackson <ben@ben.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
2009-04-11 17:55:37 -07:00
Jeff King 27845e9548 add tests for remote groups
This tries to systematically cover existing behavior, and
also mark some expect_failure cases for desired behavior.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-09 01:30:06 -07:00
Junio C Hamano bff82d0cda Merge branch 'jc/shared-literally' into maint
* jc/shared-literally:
  t1301: loosen test for forced modes
  set_shared_perm(): sometimes we know what the final mode bits should look like
  move_temp_to_file(): do not forget to chmod() in "Coda hack" codepath
  Move chmod(foo, 0444) into move_temp_to_file()
  "core.sharedrepository = 0mode" should set, not loosen
2009-04-08 23:23:41 -07:00
Junio C Hamano 197cf8d59c Merge branch 'jc/maint-1.6.0-diff-borrow-carefully' into maint
* jc/maint-1.6.0-diff-borrow-carefully:
  diff --cached: do not borrow from a work tree when a path is marked as assume-unchanged
2009-04-08 23:23:17 -07:00
Junio C Hamano c3067cbfb3 Merge branch 'jc/maint-1.6.0-keep-pack' into maint
* jc/maint-1.6.0-keep-pack:
  pack-objects: don't loosen objects available in alternate or kept packs
  t7700: demonstrate repack flaw which may loosen objects unnecessarily
  Remove --kept-pack-only option and associated infrastructure
  pack-objects: only repack or loosen objects residing in "local" packs
  git-repack.sh: don't use --kept-pack-only option to pack-objects
  t7700-repack: add two new tests demonstrating repacking flaws
  is_kept_pack(): final clean-up
  Simplify is_kept_pack()
  Consolidate ignore_packed logic more
  has_sha1_kept_pack(): take "struct rev_info"
  has_sha1_pack(): refactor "pretend these packs do not exist" interface
  git-repack: resist stray environment variable

Conflicts:
	t/t7700-repack.sh
2009-04-08 23:21:10 -07:00
Junio C Hamano 1c9f54417e Merge branch 'bc/maint-1.6.1-branch-deleted-was' into maint-1.6.1
* bc/maint-1.6.1-branch-deleted-was:
  git-branch: display "was sha1" on branch deletion rather than just "sha1"
2009-04-08 23:01:15 -07:00
Jeff King 1b19ccd236 tests: skip perl tests if NO_PERL is defined
These scripts all test git programs that are written in
perl, and thus obviously won't work if NO_PERL is defined.
We pass NO_PERL to the scripts from the building Makefile
via the GIT-BUILD-OPTIONS file.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-08 22:42:16 -07:00
Jeff King 8cae19d987 for-each-ref: add "upstream" format field
The logic for determining the upstream ref of a branch is
somewhat complex to perform in a shell script. This patch
provides a plumbing mechanism for scripts to access the C
logic used internally by git-status, git-branch, etc.

For example:

  $ git for-each-ref \
       --format='%(refname:short) %(upstream:short)' \
       refs/heads/
  master origin/master

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-07 23:22:15 -07:00
Junio C Hamano 6da14ee14f Merge branch 'maint'
* maint:
  Change double quotes to single quotes in message
  Documentation: clarify .gitattributes search
  git-checkout.txt: clarify that <branch> applies when no path is given.
  git-checkout.txt: fix incorrect statement about HEAD and index

Conflicts:
	Documentation/git-checkout.txt
2009-04-07 23:05:43 -07:00
Jari Aalto 714fddf2fc Change double quotes to single quotes in message
Most of the time when we give branch name in the message, we quote it
inside a pair of single-quotes.  git-checkout uses double-quotes; this
patch corrects the inconsistency.

Signed-off-by: Jari Aalto <jari.aalto@cante.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-07 23:04:45 -07:00
Junio C Hamano 00f39fc995 Merge branch 'bs/maint-1.6.0-tree-walk-prefix'
* bs/maint-1.6.0-tree-walk-prefix:
  match_tree_entry(): a pathspec only matches at directory boundaries
  tree_entry_interesting: a pathspec only matches at directory boundary
2009-04-07 22:33:10 -07:00
Junio C Hamano a9906723b2 Merge branch 'js/maint-submodule-checkout'
* js/maint-submodule-checkout:
  Fix 'git checkout <submodule>' to update the index
2009-04-07 22:33:02 -07:00
Junio C Hamano 2149e0f6a6 Merge branch 'cb/maint-merge-recursive-submodule-fix'
* cb/maint-merge-recursive-submodule-fix:
  simplify output of conflicting merge
  update cache for conflicting submodule entries
  add tests for merging with submodules
2009-04-07 22:32:56 -07:00
David Aguilar a904392eae difftool: add support for a difftool.prompt config variable
difftool now supports difftool.prompt so that users do not have to
pass --no-prompt or hit enter each time a diff tool is launched.
The --prompt flag overrides the configuration variable.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-07 22:19:56 -07:00
David Aguilar f92f2038a5 difftool: add various git-difftool tests
t7800-difftool.sh tests the various command-line flags,
git-config variables, and environment settings supported by
git-difftool.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-07 22:19:56 -07:00
Junio C Hamano 03a39a9184 Merge branch 'jc/shared-literally'
* jc/shared-literally:
  t1301: loosen test for forced modes
  set_shared_perm(): sometimes we know what the final mode bits should look like
  move_temp_to_file(): do not forget to chmod() in "Coda hack" codepath
  Move chmod(foo, 0444) into move_temp_to_file()
  "core.sharedrepository = 0mode" should set, not loosen
2009-04-06 00:42:52 -07:00
Junio C Hamano ccc852c377 Merge branch 'mg/tracked-local-branches'
* mg/tracked-local-branches:
  Make local branches behave like remote branches when --tracked
  Test for local branches being followed with --track
2009-04-06 00:42:31 -07:00
Junio C Hamano 87d2062b39 Merge branch 'sb/format-patch-patchname'
* sb/format-patch-patchname:
  format_sanitized_subject: Don't trim past initial length of strbuf
  log-tree: fix patch filename computation in "git format-patch"
  format-patch: --numbered-files and --stdout aren't mutually exclusive
  format-patch: --attach/inline uses filename instead of SHA1
  format-patch: move get_patch_filename() into log-tree
  format-patch: pass a commit to reopen_stdout()
  format-patch: construct patch filename in one function
  pretty.c: add %f format specifier to format_commit_message()
2009-04-06 00:42:23 -07:00
Junio C Hamano 0eaadfe625 t/t9600: remove exit after test_done
This cherry-picks part of 5dba359124

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-05 01:40:50 -07:00
Christian Couder b74d7efb10 t6030: test bisecting with paths
This patch adds some tests to check that "git bisect" works fine when
passing paths to "git bisect start" to reduce the number of
bisection steps.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-05 01:29:45 -07:00
Jeff King 5dba359124 tests: remove exit after test_done call
test_done always exits, so this line is never executed.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-05 00:38:26 -07:00
Clemens Buchacher 0eb6574c24 update cache for conflicting submodule entries
When merging merge bases during a recursive merge we do not want to
leave any unmerged entries. Otherwise we cannot create a temporary
tree for the recursive merge to work with.

We failed to do so in case of a submodule conflict between merge
bases, causing a NULL pointer dereference in the next step of the
recursive merge.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-05 00:26:32 -07:00
Clemens Buchacher f37ae35e73 add tests for merging with submodules
Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-05 00:26:30 -07:00
Jay Soffian 0da43a685a send-email: fix nasty bug in ask() function
Commit 6e18251 (send-email: refactor and ensure prompting doesn't loop
forever) introduced an ask function, which unfortunately had a nasty
bug. This caused it not to accept anything but the default reply to the
"Who should the emails appear to be from?" prompt, and nothing but
ctrl-d to the "Who should the emails be sent to?" and "Message-ID to be
used as In-Reply-To for the first email?" prompts.

This commit corrects the issues and adds a test to confirm the fix.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-04 22:53:32 -07:00
Johannes Schindelin bef3894847 Fix 'git checkout <submodule>' to update the index
While 'git checkout <submodule>' should not update the submodule's
working directory, it should update the index.  This is in line with
how submodules are handled in the rest of Git.

While at it, test 'git reset [<commit>] <submodule>', too.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-02 13:16:42 -07:00
Junio C Hamano cb365a7a56 Merge branch 'js/maint-diff-temp-smudge' into maint
* js/maint-diff-temp-smudge:
  Smudge the files fed to external diff and textconv
2009-04-02 12:02:30 -07:00
Junio C Hamano 8afd317843 Merge branch 'bc/maint-1.6.1-branch-deleted-was' into maint
* bc/maint-1.6.1-branch-deleted-was:
  git-branch: display "was sha1" on branch deletion rather than just "sha1"

Conflicts:
	builtin-branch.c
2009-04-02 12:02:18 -07:00
Jay Soffian a61c0ffa44 send-email: ensure quoted addresses are rfc2047 encoded
sanitize_address assumes that quoted addresses (e.g., "first last"
<first.last@example.com) do not need rfc2047 encoding, but this is
not always the case.

For example, various places in send-email extract addresses using
parse_address_line. parse_address_line returns the addresses already
quoted (e.g., "first last" <first.last@example.com), but not rfc2047
encoded.

This patch makes sanitize_address stricter about what needs rfc2047
encoding and adds a test demonstrating where I noticed the problem.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-02 10:46:21 -07:00
Jay Soffian 3b3637c3f1 send-email: correct two tests which were going interactive
Commit c18f75a (send-email: add tests for refactored prompting, 2009-03-28)
added two tests which went interactive under the dash shell.

This patch corrects the issue, reported by Björn Steinbrink.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-02 10:46:21 -07:00
Junio C Hamano dffc13166b Merge branch 'ef/fast-export'
* ef/fast-export:
  builtin-fast-export.c: handle nested tags
  builtin-fast-export.c: fix crash on tagged trees
  builtin-fast-export.c: turn error into warning
  test-suite: adding a test for fast-export with tag variants
2009-04-01 22:49:28 -07:00
Junio C Hamano 37a13acb2e Merge branch 'mh/format-patch-add-header'
* mh/format-patch-add-header:
  format-patch: add arbitrary email headers
2009-04-01 22:49:24 -07:00
Junio C Hamano 3c91bf6805 Merge branch 'jc/maint-1.6.0-keep-pack'
* jc/maint-1.6.0-keep-pack:
  pack-objects: don't loosen objects available in alternate or kept packs
  t7700: demonstrate repack flaw which may loosen objects unnecessarily
  Remove --kept-pack-only option and associated infrastructure
  pack-objects: only repack or loosen objects residing in "local" packs
  git-repack.sh: don't use --kept-pack-only option to pack-objects
  t7700-repack: add two new tests demonstrating repacking flaws

Conflicts:
	t/t7700-repack.sh
2009-04-01 22:34:19 -07:00
Junio C Hamano 8092bfb6c2 match_tree_entry(): a pathspec only matches at directory boundaries
Previously the code did a simple prefix match, which means that a path in
a directory "frotz/" would have matched with pathspec "f".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-01 19:35:31 -07:00
Björn Steinbrink f0946cb826 tree_entry_interesting: a pathspec only matches at directory boundary
Previously the code did a simple prefix match, which means that a
path in a directory "frotz/" would have matched with pathspec "f".

Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-01 19:35:16 -07:00
Michael J Gruber 5e6e2b487e Make local branches behave like remote branches when --tracked
This makes sure that local branches, when followed using --track, behave
the same as remote ones (e.g. differences being reported by git status
and git checkout). This fixes 1 known failure.

The fix is done within branch_get(): The first natural candidate,
namely remote_find_tracking(), does not have all the necessary info
because in general there is no remote struct for '.', and we don't want
one because it would show up in other places as well.

branch_get(), on the other hand, has access to merge_names[] (in
addition to merge[]) and therefore can set up the followed branch
easily.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-01 15:48:30 -07:00
Jay Soffian dc1460aa8d send-email: ask_default should apply to all emails, not just the first
Commit 6e18251 made the "Send this email?" prompt assume yes if confirm
= "inform" when it was unable to get a valid response. However, the
"yes" assumption only worked correctly for the first email. This commit
fixes the issue and confirms the fix by modifying the existing test for
the prompt to send multiple emails.

Reported by Matthieu Moy <Matthieu.Moy@imag.fr>

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-01 11:11:21 -07:00
Jeff King 1b89eaa4be t1301: loosen test for forced modes
One of the aspects of the test checked explicitly for the
g+s bit to be set on created directories. However, this is
only the means to an end (the "end" being having the correct
group set). And in fact, on systems where
DIR_HAS_BSD_GROUP_SEMANTICS is set, we do not even need to
use this "means" at all, causing the test to fail.

This patch removes that part of the test. In an ideal world
it would be replaced by a test to check that the group was
properly assigned, but that is difficult to automate because
it requires the user running the test suite be a member of
multiple groups.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-01 11:09:25 -07:00
Jay Soffian c18f75a1e9 send-email: add tests for refactored prompting
Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-29 21:41:28 -07:00
Erik Faye-Lund 1982467d92 builtin-fast-export.c: handle nested tags
When tags that points to tags are passed to fast-export, an error is given,
saying "Tag [TAGNAME] points nowhere?". This fix calls parse_object() on the
object before referencing it's tag, to ensure the tag-info is fully initialized.
In addition, it inserts a comment to point out where nested tags are handled.
This is consistent with the comment for signed tags.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-29 19:48:43 -07:00
Erik Faye-Lund c0582c53bc builtin-fast-export.c: fix crash on tagged trees
If a tag object points to a tree (or another unhandled type), the commit-
pointer is left uninitialized and later dereferenced. This patch adds a
default case to the switch that issues a warning and skips the object.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-29 19:48:43 -07:00
Erik Faye-Lund 41a5c70f2c test-suite: adding a test for fast-export with tag variants
Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-29 19:48:39 -07:00
Junio C Hamano b0085a7167 Merge branch 'maint'
* maint:
  test-lib: Clean up comments and Makefile.
  diff --no-index: Do not generate patch output if other output is requested
2009-03-28 01:16:46 -07:00
Junio C Hamano aa72a14a7f Merge branch 'jc/maint-1.6.0-diff-borrow-carefully'
* jc/maint-1.6.0-diff-borrow-carefully:
  diff --cached: do not borrow from a work tree when a path is marked as assume-unchanged
2009-03-28 00:42:31 -07:00
Junio C Hamano 9d5156496d Merge branch 'maint-1.6.1' into maint
* maint-1.6.1:
  test-lib: Clean up comments and Makefile.
  diff --no-index: Do not generate patch output if other output is requested
2009-03-28 00:41:50 -07:00
Emil Sit 81db4abf84 test-lib: Clean up comments and Makefile.
Bring documentation in test-lib and clean target
in Makefile in-line with abc5d372.

Signed-off-by: Emil Sit <sit@emilsit.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-28 00:11:27 -07:00
Michael Hendricks d7d9c2d049 format-patch: add arbitrary email headers
format-patch supports the format.headers configuration for adding
arbitrary email headers to the patches it outputs.  This patch adds
support for an --add-header argument which makes the same feature
available from the command line.  This is useful when the content of
custom email headers must change from branch to branch.

This patch has been sponsored by Grant Street Group

Signed-off-by: Michael Hendricks <michael@ndrix.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-27 23:49:50 -07:00
Junio C Hamano 5a688fe470 "core.sharedrepository = 0mode" should set, not loosen
This fixes the behaviour of octal notation to how it is defined in the
documentation, while keeping the traditional "loosen only" semantics
intact for "group" and "everybody".

Three main points of this patch are:

 - For an explicit octal notation, the internal shared_repository variable
   is set to a negative value, so that we can tell "group" (which is to
   "OR" in 0660) and 0660 (which is to "SET" to 0660);

 - git-init did not set shared_repository variable early enough to affect
   the initial creation of many files, notably copied templates and the
   configuration.  We set it very early when a command-line option
   specifies a custom value.

 - Many codepaths create files inside $GIT_DIR by various ways that all
   involve mkstemp(), and then call move_temp_to_file() to rename it to
   its final destination.  We can add adjust_shared_perm() call here; for
   the traditional "loosen-only", this would be a no-op for many codepaths
   because the mode is already loose enough, but with the new behaviour it
   makes a difference.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-27 21:51:04 -07:00
Michael J Gruber 57dac0bfe4 Test for local branches being followed with --track
According to the documentation, it is perfectly okay to follow local
branches using the --track option. Introduce a test which checks whether
they behave the same. Currently one test fails.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-27 01:08:36 -07:00
Junio C Hamano f504fa2acb Merge branch 'jk/reflog-date'
* jk/reflog-date:
  make oneline reflog dates more consistent with multiline format
2009-03-26 00:27:37 -07:00
Junio C Hamano 6ba8b079cb Merge branch 'jc/attributes-checkout'
* jc/attributes-checkout:
  Add a test for checking whether gitattributes is honored by checkout.
  Read attributes from the index that is being checked out
2009-03-26 00:27:33 -07:00
Junio C Hamano b71fdc590d Merge branch 'js/maint-diff-temp-smudge'
* js/maint-diff-temp-smudge:
  Smudge the files fed to external diff and textconv
2009-03-26 00:27:30 -07:00
Junio C Hamano 23fd723c9d Merge branch 'bc/maint-1.6.1-branch-deleted-was'
* bc/maint-1.6.1-branch-deleted-was:
  git-branch: display "was sha1" on branch deletion rather than just "sha1"

Conflicts:
	builtin-branch.c
2009-03-26 00:26:47 -07:00
Elijah Newren ebeec7dbc5 fast-export: Avoid dropping files from commits
When exporting a subset of commits on a branch that do not go back to a
root commit (e.g. master~2..master), we still want each exported commit to
have the same files in the exported tree as in the original tree.

Previously, when given such a range, we would omit master~2 as a parent of
master~1, but we would still diff against master~2 when selecting the list
of files to include in master~1.  This would result in only files that
had changed in the given range showing up in the resulting export.  In such
cases, we should diff master~1 against the root instead (i.e. use
diff_root_tree_sha1 instead of diff_tree_sha1).

There's a special case to consider here: incremental exports (i.e. exports
where the --import-marks flag is specified).  If master~2 is an imported
mark, then we still want to diff master~1 against master~2 when selecting
the list of files to include.

We can handle all cases, including the special case, by just checking
whether master~2 corresponds to a known object mark when deciding what to
diff against.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-25 22:53:45 -07:00
Junio C Hamano 8befac5d6f Merge branch 'for-junio' of git://repo.or.cz/git/mingw/j6t
* 'for-junio' of git://repo.or.cz/git/mingw/j6t:
  t7502-commit: Skip SIGTERM test on Windows
  t7005-editor: Use $SHELL_PATH in the editor scripts
2009-03-25 15:08:09 -07:00
Johannes Sixt fb9a2beab2 t7502-commit: Skip SIGTERM test on Windows
The implementation of exec on Windows is just a rough approximation of the
POSIX behavior. In particular, no real process "overlay" happens (a new
process is spawned instead and the parent process waits until the child
terminates). In particular, the process ID cannot be taken by the exec'd
process. But there is one test in t7502-commit.sh that depends on this.
We have to skip it on Windows.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2009-03-25 21:25:57 +01:00
Johannes Sixt 80f0e53d6b t7005-editor: Use $SHELL_PATH in the editor scripts
The test sets up various shell scripts and uses them as commit message
editors.  On Windows, we need a shebang line in order to recognize the
files as executable shell scripts.  This adds it.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2009-03-25 21:25:53 +01:00
Junio C Hamano 78360b576a Merge branch 'js/windows-tests'
* js/windows-tests:
  t0060: fix whitespace in "wc -c" invocation
  t5503: GIT_DEBUG_SEND_PACK is not supported on MinGW
  t7004: Use prerequisite tags to skip tests that need gpg
  Use prerequisites to skip tests that need unzip
  t3700: Skip a test with backslashes in pathspec
  Skip tests that require a filesystem that obeys POSIX permissions
  t0060: Fix tests on Windows
  Use prerequisite tags to skip tests that depend on symbolic links
  t9100, t9129: Use prerequisite tags for UTF-8 tests
  t5302: Use prerequisite tags to skip 64-bit offset tests
  Skip tests that fail if the executable bit is not handled by the filesystem
  t3600: Use test prerequisite tags
  test-lib: Infrastructure to test and check for prerequisites
  t0050: Check whether git init detected symbolic link support correctly
  Tests on Windows: $(pwd) must return Windows-style paths
  test-lib: Work around missing sum on Windows
  test-lib: Work around incompatible sort and find on Windows

Conflicts:
	t/t3000-ls-files-others.sh
2009-03-24 14:42:50 -07:00
Jeff King 28baf82ea3 t0060: fix whitespace in "wc -c" invocation
Some platforms like to stick extra whitespace in the output
of "wc -c"; using the result without quotes gets the shell
to collapse the whitespace.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-23 00:18:02 -07:00
Stephen Boyd 747e25050b format-patch: --numbered-files and --stdout aren't mutually exclusive
For example:

    git format-patch --numbered-files --stdout --attach HEAD~~

will create two messages with files 1 and 2 attached respectively.
There is no effect when using --numbered-files and --stdout together
without an --attach or --inline, the --numbered-files option will be
ignored. Add a test to show this.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-22 21:46:02 -07:00
Stephen Boyd 108dab2811 format-patch: --attach/inline uses filename instead of SHA1
Currently when format-patch is used with --attach or --inline the patch
attachment has the SHA1 of the commit for its filename.  This replaces
the SHA1 with the filename used by format-patch when outputting to
files.

Fix tests relying on the SHA1 output and add a test showing how the
--suffix option affects the attachment filename output.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-22 21:45:19 -07:00
Junio C Hamano 150115aded diff --cached: do not borrow from a work tree when a path is marked as assume-unchanged
When the index says that the file in the work tree that corresponds to the
blob object that is used for comparison is known to be unchanged, "diff"
reads from the file and applies convert_to_git(), instead of inflating the
object, to feed the internal diff engine with, because an earlier
benchnark found that it tends to be faster to use this optimization.

However, the index can lie when the path is marked as assume-unchanged.
Disable the optimization for such paths.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-22 15:26:07 -07:00
Johannes Schindelin 4e218f54b3 Smudge the files fed to external diff and textconv
When preparing temporary files for an external diff or textconv, it is
easier on the external tools, especially when they are implemented using
platform tools, if they are fed the input after convert_to_working_tree().

This fixes msysGit issue 177.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-22 15:03:59 -07:00
Johannes Sixt 8b02c64a3c t5503: GIT_DEBUG_SEND_PACK is not supported on MinGW
The test opens fd 3 and instructs git-upload-pack (via GIT_DEBUG_SEND_PACK)
to log information to that channel.

The way in which new processes are spawned by git on MinGW does not inherit
all file descriptors to the child processes, but only 0, 1, and 2.
The tests in t5503 require that file descriptor 3 is inherited from
git-fetch to git-upload-pack.

A complete implementation is non-trivial and not warranted just to satisfy
this test.  Note that the incompleteness applies only to the executables
that use compat/mingw.c; bash and perl (the other important executables
used by git) are complete, of course.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2009-03-22 17:52:43 +01:00
Johannes Sixt a4df22ce49 t7004: Use prerequisite tags to skip tests that need gpg
The tests are skipped if no gpg was found or if gpg is version 1.0.6.
Previously, the latter condition was checked a bit later in the test file
so that the tag verification tests would be exercised. These are now
skipped as well, but only because we would need a facility to revoke a
test prerequisite, which we do not have.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2009-03-22 17:52:43 +01:00
Johannes Sixt 552a26c8c0 Use prerequisites to skip tests that need unzip
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2009-03-22 17:52:43 +01:00
Johannes Sixt 6fd1106aa4 t3700: Skip a test with backslashes in pathspec
The test verifies that glob special characters can be escaped with
backslashes.  In particular, the string fo\[ou\]bar is given to git.

On Windows, this does not work because backslashes are first of all
directory separators, and first thing git does with a pathspec from the
command line is to convert backslashes to forward slashes.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2009-03-22 17:49:52 +01:00
Johannes Sixt ee9fb68c39 Skip tests that require a filesystem that obeys POSIX permissions
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2009-03-22 17:26:44 +01:00
Johannes Sixt 2718e852e9 t0060: Fix tests on Windows
Since the MSYS bash mangles absolute paths that it passes as command line
arguments to non-MSYS progams (such as git or test-path-utils), we have to
bend over backwards to squeeze some usefulness out of the existing tests.

In particular, a set of path normalization tests is added that test
relative paths. Some paths in the ancestor path tests are adjusted to help
MSYS bash's path mangling heuristics.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2009-03-22 17:26:44 +01:00