Commit graph

1536 commits

Author SHA1 Message Date
Bryan Donlan 0e46e70462 Don't use the 'export NAME=value' in the test scripts.
This form is not portable across all shells, so replace instances of:

  export FOO=bar

with:

  FOO=bar
  export FOO

Signed-off-by: Bryan Donlan <bdonlan@fushizen.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-05 14:17:01 -07:00
Bryan Donlan cdf3ec01ac lib-git-svn.sh: Fix quoting issues with paths containing shell metacharacters
Signed-off-by: Bryan Donlan <bdonlan@fushizen.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-05 14:17:01 -07:00
Bryan Donlan b480f5cf1a test-lib.sh: Fix some missing path quoting
Signed-off-by: Bryan Donlan <bdonlan@fushizen.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-05 14:17:01 -07:00
Bryan Donlan 7f0475c308 Use test_set_editor in t9001-send-email.sh
Signed-off-by: Bryan Donlan <bdonlan@fushizen.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-05 14:17:01 -07:00
Bryan Donlan 02b3566003 test-lib.sh: Add a test_set_editor function to safely set $VISUAL
In particular, this function correctly handles cases where the pwd contains
spaces, quotes, and other troublesome metacharacters.

Signed-off-by: Bryan Donlan <bdonlan@fushizen.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-05 14:17:01 -07:00
Bryan Donlan 065096c2b5 git-send-email.perl: Handle shell metacharacters in $EDITOR properly
This fixes the git-send-perl semantics for launching an editor when
$GIT_EDITOR (or friends) contains shell metacharacters to match
launch_editor() in builtin-tag.c. If we use the current approach
(sh -c '$0 $@' "$EDITOR" files ...), we see it fails when $EDITOR has
shell metacharacters:

  $ sh -x -c '$0 $@' "$VISUAL" "foo"
  + "$FAKE_EDITOR" foo
  "$FAKE_EDITOR": 1: "$FAKE_EDITOR": not found

Whereas builtin-tag.c will invoke sh -c "$EDITOR \"$@\"".

Thus, this patch changes git-send-email.perl to use the same method as the
C utilities, and additionally updates t/t9001-send-email.sh to test for
this bug.

Signed-off-by: Bryan Donlan <bdonlan@fushizen.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-05 14:17:00 -07:00
Bryan Donlan e5c349ba11 config.c: Escape backslashes in section names properly
If an element of the configuration key name other than the first or last
contains a backslash, it is not escaped on output, but is treated as an
escape sequence on input. Thus, the backslash is lost when re-loading
the configuration.

This patch corrects this by having backslashes escaped properly, and
introduces a new test for this bug.

Signed-off-by: Bryan Donlan <bdonlan@fushizen.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-05 14:17:00 -07:00
Bryan Donlan 97b88dd58c git-rebase.sh: Fix --merge --abort failures when path contains whitespace
Also update t/t3407-rebase-abort.sh to expose the bug.

Signed-off-by: Bryan Donlan <bdonlan@fushizen.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-05 14:17:00 -07:00
Alex Riesen 97ad535b01 Use the modern syntax of git-diff-files in t2002-checkout-cache-u.sh
As a nice side effect it also fixes t2002-checkout-cache-u.sh on FreeBSD 4,
/bin/sh of which has problems interpreting "! command" construction.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-29 23:11:57 -07:00
Junio C Hamano 633d1fe9d0 Merge branch 'maint'
* maint:
  clone: detect and fail on excess parameters
  Remove 'header' from --signoff option description
2008-04-27 21:47:51 -07:00
Junio C Hamano a2b26acd7a clone: detect and fail on excess parameters
"git clone [options] $src $dst excess-garbage" simply ignored
excess-garbage without giving any diagnostic message.  Fix it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-27 21:47:39 -07:00
Junio C Hamano 36c79d2bf8 Merge branch 'ho/shared'
* ho/shared:
  Make core.sharedRepository more generic
2008-04-25 12:17:45 -07:00
Junio C Hamano 049a226fa1 Merge branch 'maint'
* maint:
  remote: create fetch config lines with '+'
  push: allow unqualified dest refspecs to DWIM
  doc/git-gc: add a note about what is collected
  t5516: remove ambiguity test (1)
  Linked glossary from cvs-migration page
  write-tree: properly detect failure to write tree objects
2008-04-24 22:40:02 -07:00
Jeff King 1ce89cc4bb remote: create fetch config lines with '+'
Since git-remote always uses remote tracking branches, it
should be safe to always force updates of those branches.
I.e., we should generate

  fetch = +refs/heads/*:refs/remotes/$remote/*

instead of

  fetch = refs/heads/*:refs/remotes/$remote/*

This was the behavior of the perl version, which seems to
have been lost in the C rewrite.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-24 22:30:31 -07:00
Jeff King f8aae12034 push: allow unqualified dest refspecs to DWIM
Previously, a push like:

  git push remote src:dst

would go through the following steps:

  1. check for an unambiguous 'dst' on the remote; if it
     exists, then push to that ref
  2. otherwise, check if 'dst' begins with 'refs/'; if it
     does, create a new ref
  3. otherwise, complain because we don't know where in the
     refs hierarchy to put 'dst'

However, in some cases, we can guess about the ref type of
'dst' based on the ref type of 'src'. Specifically, before
complaining we now check:

  2.5. if 'src' resolves to a ref starting with refs/heads
       or refs/tags, then prepend that to 'dst'

So now this creates a new branch on the remote, whereas it
previously failed with an error message:

  git push master:newbranch

Note that, by design, we limit this DWIM behavior only to
source refs which resolve exactly (including symrefs which
resolve to existing refs). We still complain on a partial
destination refspec if the source is a raw sha1, or a ref
expression such as 'master~10'.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-24 22:13:24 -07:00
Junio C Hamano 31c6390d40 Merge branch 'maint-1.5.4' into maint
* maint-1.5.4:
  t5516: remove ambiguity test (1)
  Linked glossary from cvs-migration page
  write-tree: properly detect failure to write tree objects
2008-04-24 21:50:48 -07:00
Jeff King 3ef6a1fe95 t5516: remove ambiguity test (1)
This test tried to push into a remote with ambiguous refs in
remotes/$x/master and remotes/$y/master. However, the remote
never actually tells us about the refs/remotes hierarchy, so
we don't even see this ambiguity.

The test happened to pass because we were simply looking for
failure, and the test fails for another reason: the dst
refspec does not exist and does not begin with refs/, making
it invalid.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-23 10:56:07 -07:00
Junio C Hamano edae5f0c20 write-tree: properly detect failure to write tree objects
Tomasz Fortuna reported that "git commit" does not error out properly when
it cannot write tree objects out.  "git write-tree" shares the same issue,
as the failure to notice the error is deep in the logic to write tree
objects out recursively.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-23 10:02:44 -07:00
Junio C Hamano 57cf5ca305 Merge branch 'maint'
* maint:
  Amend git-push refspec documentation
  git-gc --prune is deprecated
  svn-git: Use binmode for reading/writing binary rev maps
  diff options documentation: refer to --diff-filter in --name-status
  Don't force imap.host to be set when imap.tunnel is set
  git-clone.txt: Adjust note to --shared for new pruning behavior of git-gc
  git-svn bug with blank commits and author file
  archive.c: format_subst - fixed bogus argument to memchr
  copy.c: copy_fd - correctly report write errors
  gitattributes: Fix subdirectory attributes specified from root directory
2008-04-23 00:03:56 -07:00
Junio C Hamano d6958a1a32 Merge branch 'maint-1.5.4' into maint
* maint-1.5.4:
  svn-git: Use binmode for reading/writing binary rev maps
  diff options documentation: refer to --diff-filter in --name-status
  git-svn bug with blank commits and author file
  archive.c: format_subst - fixed bogus argument to memchr
  copy.c: copy_fd - correctly report write errors
  gitattributes: Fix subdirectory attributes specified from root directory
2008-04-22 23:37:06 -07:00
Matthew Ogilvie 82881b3823 gitattributes: Fix subdirectory attributes specified from root directory
Signed-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-22 21:12:37 -07:00
Junio C Hamano 41a3e3aa9b Merge branch 'jc/maint-rebase-am' into maint
* jc/maint-rebase-am:
  rebase: do not munge commit log message

Conflicts:

	git-am.sh
2008-04-19 23:01:51 -07:00
Junio C Hamano 3642617ee7 Merge branch 'py/submodule'
* py/submodule:
  builtin-status: Add tests for submodule summary
  builtin-status: submodule summary support
  git-submodule summary: --for-status option
2008-04-19 21:11:29 -07:00
Junio C Hamano 8876046037 Merge branch 'jc/maint-rebase-am'
* jc/maint-rebase-am:
  rebase: do not munge commit log message

Conflicts:

	git-am.sh
2008-04-19 00:25:15 -07:00
Junio C Hamano d9f39d9838 Merge branch 'maint'
* maint:
  gitweb: Fix 'history' view for deleted files with history
  Document that WebDAV doesn't need git on the server, and works over SSL
  git-remote: reject adding remotes with invalid names
  am: POSIX portability fix
2008-04-18 22:58:32 -07:00
Jakub Narebski 5634cf2476 gitweb: Fix 'history' view for deleted files with history
When asked for history of a file which is not present in given branch
("HEAD", i.e. current branch, or given by transient $hash_hase ('hb')
parameter), but is present deeper in the history (meaning that "git
rev-list --full-history $hash_base -- $file_name" is not empty), and
there is no $hash ('h') parameter set for a file, gitweb would spew
multiple of "Use of uninitialized value" warnings, and some links
would be missing.  This commit fixes this bug.

This bug occurs in the rare cases when "git log -- <path>" is empty
and "git log --full-history -- <path>" is not, or to be more exact in
the cases when full-history starts later than given branch.  It can
happen if you are using handcrafted gitwb URL, or if you follow
generic 'history' link or bookmark for a file which got deleted.

Gitweb tried to get file type ('tree', or 'blob', or even 'commit')
from the commit we start searching from (where the file was not
present), and not among found commits.  This was the cause of "Use of
uninitialized value" warnings.

This commit also add tests for such situation to t9500 test.

While we are it, return HTTP error if there is _no_ history; it means
that file or directory was not found (for given branch).  Also error
out if type of item could not be found: it should not happen now, but
better be sure.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-18 22:10:38 -07:00
Jonas Fonseca 24b6177e02 git-remote: reject adding remotes with invalid names
This can happen if the arguments to git-remote add is switched by the
user, and git would only show an error if fetching was also requested.
Fix it by using the refspec parsing engine to check if the requested
name can be parsed as a remote before add it.

Also cleanup so that the "remote.<name>.url" config name buffer is only
initialized once.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-18 16:31:27 -07:00
Heikki Orsila 06cbe85503 Make core.sharedRepository more generic
git init --shared=0xxx, where '0xxx' is an octal number, will create
a repository with file modes set to '0xxx'. Users with a safe umask
value (0077) can use this option to force file modes. For example,
'0640' is a group-readable but not group-writable regardless of
user's umask value. Values compatible with old Git versions are written
as they were before, for compatibility reasons. That is, "1" for
"group" and "2" for "everybody".

"git config core.sharedRepository 0xxx" is also handled.

Signed-off-by: Heikki Orsila <heikki.orsila@iki.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-16 18:23:54 -07:00
Junio C Hamano 5e835cac86 rebase: do not munge commit log message
Traditionally git-rebase was implemented in terms of "format-patch" piped
to "am -3", to strike balance between speed (because it avoids a rather
expensive read-tree/merge-recursive machinery most of the time) and
flexibility (the magic "-3" allows it to fall back to 3-way merge as
necessary).  However, this combination has one flaw when dealing with a
nonstandard commit log message format that has more than one lines in the
first paragraph.

This teaches "git am --rebasing" to take advantage of the fact that the
mbox message "git rebase" prepares for it records the original commit
object name, to get the log message from the original commit object
instead.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-16 12:50:48 -07:00
Junio C Hamano a17b1d2f0b Merge branch 'maint'
* maint:
  git-bisect: make "start", "good" and "skip" succeed or fail atomically
  git-am: cope better with an empty Subject: line
  Ignore leading empty lines while summarizing merges
  bisect: squelch "fatal: ref HEAD not a symref" misleading message
  builtin-apply: Show a more descriptive error on failure when opening a patch
  Clarify documentation of git-cvsserver, particularly in relation to git-shell
2008-04-16 00:45:52 -07:00
Junio C Hamano 464509f790 Merge branch 'maint-1.5.4' into maint
* maint-1.5.4:
  git-bisect: make "start", "good" and "skip" succeed or fail atomically
  git-am: cope better with an empty Subject: line
  Ignore leading empty lines while summarizing merges
  bisect: squelch "fatal: ref HEAD not a symref" misleading message
  builtin-apply: Show a more descriptive error on failure when opening a patch
  Clarify documentation of git-cvsserver, particularly in relation to git-shell
2008-04-16 00:37:33 -07:00
Christian Couder d3e54c8829 git-bisect: make "start", "good" and "skip" succeed or fail atomically
Before this patch, when "git bisect start", "git bisect good" or
"git bisect skip" were called with many revisions, they could fail
after having already marked some revisions as "good", "bad" or
"skip".

This could be especilally bad for "git bisect start" because as
the file ".git/BISECT_NAMES" would not have been written, there
would have been no attempt to clear the marked revisions on a
"git bisect reset". That's because if there is no
".git/BISECT_NAMES" file, nothing is done to clean things up, as
the bisect session is not supposed to have started.

While at it, let's also create the ".git/BISECT_START" file, only
after ".git/BISECT_NAMES" as been created.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-16 00:11:37 -07:00
Junio C Hamano 189d6b8bfa Merge branch 'maint'
* maint:
  git clean: Add test to verify directories aren't removed with a prefix
  git clean: Don't automatically remove directories when run within subdirectory
  git-submodule - possibly use branch name to describe a module
2008-04-14 23:15:09 -07:00
Shawn Bohrer 2b6f0b0a78 git clean: Add test to verify directories aren't removed with a prefix
Signed-off-by: Shawn Bohrer <shawn.bohrer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-14 23:14:58 -07:00
Junio C Hamano c35b0b5884 Fix git_config_bool_or_int
The earlier one botched the return value logic between config_bool and
config_bool_and_int.  The former should normalize between 0 and 1 while
the latter should give back full range of integer values.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-13 12:11:11 -07:00
Ping Yin e5e4a7f23d builtin-status: Add tests for submodule summary
Signed-off-by: Ping Yin <pkufranky@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-12 20:00:45 -07:00
Ping Yin d0f64dd44d git-submodule summary: --for-status option
The --for-status option is mainly used by builtin-status/commit.
It adds 'Modified submodules:' line at top and  '# ' prefix to all
following lines.

Signed-off-by: Ping Yin <pkufranky@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-12 20:00:45 -07:00
Junio C Hamano f43e2fd43b Merge branch 'maint'
* maint:
  t7401: squelch garbage output
  Documentation/git-submodule: typofix
  Fix config key miscount in url.*.insteadOf
  Docs gitk: Explicitly mention the files that gitk uses (~/.gitk)
  Document -w option to shortlog
  bisect: report bad rev better
2008-04-12 19:17:51 -07:00
Junio C Hamano 02604e293a t7401: squelch garbage output
The script had an unconditional output done outside of test_expect_*
construct, which leaked out and contaminated the output without -v.
Squelch it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-12 18:57:08 -07:00
Daniel Barkalow 60e3aba9c3 Fix config key miscount in url.*.insteadOf
Also tighten test to require it to be correct.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-12 15:41:24 -07:00
Junio C Hamano 4cdda2b895 Merge branch 'maint'
* maint:
  bisect: fix bad rev checking in "git bisect good"
  revision.c: make --date-order overriddable
  git-submodule: Avoid 'fatal: cannot describe' message
  Force the medium pretty format on calls to git log
  Fix section about backdating tags in the git-tag docs
  Document option --only of git commit
  Documentation/git-request-pull: Fixed a typo ("send" -> "end")
2008-04-11 23:56:09 -07:00
Junio C Hamano eed81838f0 Merge branch 'maint-1.5.4' into maint
* maint-1.5.4:
  bisect: fix bad rev checking in "git bisect good"
  revision.c: make --date-order overriddable
  Fix section about backdating tags in the git-tag docs
  Document option --only of git commit
  Documentation/git-request-pull: Fixed a typo ("send" -> "end")
2008-04-11 23:55:55 -07:00
Christian Couder e3389075c6 bisect: fix bad rev checking in "git bisect good"
It seems that "git bisect good" and "git bisect skip" have never
properly checked arguments that have been passed to them. As soon
as one of them can be parsed as a SHA1, no error or warning would
be given.

This is because 'git rev-parse --revs-only --no-flags "$@"' always
"exit 0" and outputs all the SHA1 it can found from parsing "$@".

This patch fix this by using, for each "bisect good" argument, the
same logic as for the "bisect bad" argument.

While at it, this patch teaches "bisect bad" to give a meaningfull
error message when it is passed more than one argument.

Note that if "git bisect good" or "git bisect skip" is given some
proper revs and then something that is not a proper rev, then the
first proper revs will still have been marked as "good" or "skip".

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-11 23:54:45 -07:00
Junio C Hamano 71349732c5 Merge branch 'maint'
* maint:
  git-fetch: fix status output when not storing tracking ref
  core-tutorial.txt: Fix showing the current behaviour.
  git-archive: ignore prefix when checking file attribute
  Fix documentation syntax of optional arguments in short options.
2008-04-10 00:47:04 -07:00
Junio C Hamano 179c94b24a Merge branch 'maint-1.5.4' into maint
* maint-1.5.4:
  core-tutorial.txt: Fix showing the current behaviour.
  git-archive: ignore prefix when checking file attribute
  Fix documentation syntax of optional arguments in short options.
2008-04-10 00:29:33 -07:00
René Scharfe ac7fa2776c git-archive: ignore prefix when checking file attribute
Ulrik Sverdrup noticed that git-archive doesn't correctly apply the attribute
export-subst when the option --prefix is given, too.

When it checked if a file has the attribute turned on, git-archive would try
to look up the full path -- including the prefix -- in .gitattributes.  That's
wrong, as the prefix doesn't need to have any relation to any existing
directories, tracked or not.

This patch makes git-archive ignore the prefix when looking up if value of the
attribute export-subst for a file.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-10 00:20:38 -07:00
Junio C Hamano 3c993de9f2 Merge branch 'mk/unpack-careful'
* mk/unpack-careful:
  t5300: add test for "index-pack --strict"
  receive-pack: allow using --strict mode for unpacking objects
  unpack-objects: fix --strict handling
  t5300: add test for "unpack-objects --strict"
  unpack-objects: prevent writing of inconsistent objects
2008-04-09 00:44:17 -07:00
Junio C Hamano ce47dc0775 Merge branch 'jk/add-i-mode'
* jk/add-i-mode:
  add--interactive: allow user to choose mode update
  add--interactive: ignore mode change in 'p'atch command
2008-04-09 00:29:24 -07:00
Eric Wong f61cc48d28 git-svn: fix following renamed paths when tracking a single path
When using git-svn to follow only a single (empty) path per
svn-remote (i.e. not using --stdlayout), following the history
of a renamed path was broken in
c586879cdf.

This reverts the regression for the single (emtpy) path per
svn-remote case.

To avoid breaking the tests in a committed revision, this is an
addendum to a patch originally submitted by

  Santhosh Kumar Mani <santhoshmani@gmail.com>:
  > git-svn: add test for renamed directory fetch
  >
  > This test tries to fetch a directory which had renames in the
  > history from a SVN repository.

  [ew: unneccesary dependency on the starting an HTTP server
   removed from Santhosh's original test.]

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-07 00:16:08 -07:00
Junio C Hamano a1c0dca43a Merge branch 'jc/maint-apply-match-beginning'
* jc/maint-apply-match-beginning:
  Fix "git apply" to correctly enforce "match at the beginning"
2008-04-06 20:04:29 -07:00