Commit Graph

19280 Commits

Author SHA1 Message Date
Thomas Rast
d824cbba02 Convert existing die(..., strerror(errno)) to die_errno()
Change calls to die(..., strerror(errno)) to use the new die_errno().

In the process, also make slight style adjustments: at least state
_something_ about the function that failed (instead of just printing
the pathname), and put paths in single quotes.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-27 11:14:53 -07:00
Junio C Hamano
f8b5a8e13c die_errno(): double % in strerror() output just in case
[tr: handle border case where % is placed at end of buffer]

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-27 11:14:53 -07:00
Thomas Rast
b875036e5a Introduce die_errno() that appends strerror(errno) to die()
There are many calls to die() that do, or should, report
strerror(errno) to indicate how the syscall they guard failed.
Introduce a small helper function for this case.

Note:

- POSIX says vsnprintf can modify errno in some unlikely cases, so we
  have to use errno early.

- We take some care to pass the original format to die_routine(), in
  case someone wants to call die_errno() with custom format
  characters.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-27 11:14:53 -07:00
Ulrich Dangel
50ff236670 git-svn: Canonicalize svn urls to prevent libsvn assertion
Cloning/initializing svn repositories with an uncanonicalize url
does not work as libsvn throws an assertion. This patch
canonicalize svn uris for the clone and init command from
git-svn.

[ew: fixed trailing whitespace]

Signed-off-by: Ulrich Dangel <uli@spamt.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
2009-06-26 14:08:52 -07:00
Eric Wong
2317d289fe t9138: remove stray dot in test which broke bash
The stray dot broke bash and probably some other shells,
but worked fine with dash in my limited testing.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2009-06-26 11:05:36 -07:00
Chris Frey
345a380394 git-remote: fix missing .uploadpack usage for show command
For users pulling from machines with self compiled git installs,
in non-PATH locations, they can set the config option
remote.<name>.uploadpack to set the location of git-upload-pack.

When using 'git remote show <name>', the remote HEAD check
did not use the uploadpack configuration setting, and would
not use the configured program.

In builtin-remote.c, the config setting is already loaded
with the call to remote_get(), so this patch passes that remote
along to transport_get().

Signed-off-by: Chris Frey <cdfrey@foursquare.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-25 14:47:49 -07:00
Eric Wong
f705059931 git-svn: convert globs to regexps for branch destinations
Marc Branchaud wrote:
> I'm fairly happy with this, except for the way the branch
> subcommand matches refspecs.  The patch does a simple string
> comparison, but it'd be better to do an actual glob.  I just
> couldn't track down the right function for that, so I left it as
> a strcmp and hope that a gitizen can tell me how to glob here.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2009-06-25 02:28:25 -07:00
Marc Branchaud
6224406914 git svn: Support multiple branch and tag paths in the svn repository.
This enables git-svn.perl to read multiple 'branches' and 'tags' entries in
svn-remote config sections.  The init and clone subcommands also support
multiple --branches and --tags arguments.

The branch (and tag) subcommand gets a new argument: --destination (or -d).
This argument is required if there are multiple branches (or tags) entries
configured for the remote Subversion repository.  The argument's value
specifies which branch (or tag) path to use to create the branch (or tag).
The specified value must match the left side (without wildcards) of one of
the branches (or tags) refspecs in the svn-remote's config.

[ew: avoided explicit loop when combining globs with "push"]

Signed-off-by: Marc Branchaud <marcnarc@xiplink.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
2009-06-25 01:58:09 -07:00
Ben Jackson
195643f2fc Add 'git svn reset' to unwind 'git svn fetch'
Add a command to unwind the effects of fetch by moving the rev_map
and refs/remotes/git-svn back to an old SVN revision.  This allows
revisions to be re-fetched.  Ideally SVN revs would be immutable,
but permissions changes in the SVN repository or indiscriminate use
of '--ignore-paths' can create situations where fetch cannot make
progress.

Signed-off-by: Ben Jackson <ben@ben.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
2009-06-25 00:38:17 -07:00
Ben Jackson
ca5e880ec2 git-svn: speed up find_rev_before
By limiting start revision of find_rev_before to max existing
revision.  This avoids a long wait if you do
'git svn reset -r 9999999'.  The linear search within the
contiguous revisions doesn't seem to be a problem.

[ew: expanded commit message]

Signed-off-by: Ben Jackson <ben@ben.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
2009-06-25 00:38:16 -07:00
Ben Jackson
9a8c92ac9e Add 'git svn help [cmd]' which works outside a repo.
Previously there was no explicit 'help' command, but 'git svn help'
still printed the usage message (as an invalid command), provided you
got past the initialization steps that required a valid repo.

Signed-off-by: Ben Jackson <ben@ben.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
2009-06-25 00:38:16 -07:00
Thomas Rast
5eec27e35f git-svn: let 'dcommit $rev' work on $rev instead of HEAD
'git svn dcommit' takes an optional revision argument, but the meaning
of it was rather scary.  It completely ignored the current state of
the HEAD, only looking at the revisions between SVN and $rev.  If HEAD
was attached to $branch, the branch lost all commits $rev..$branch in
the process.

Considering that 'git svn dcommit HEAD^' has the intuitive meaning
"dcommit all changes on my branch except the last one", we change the
meaning of the revision argument.  git-svn temporarily checks out $rev
for its work, meaning that

* if a branch is specified, that branch (_not_ the HEAD) is rebased as
  part of the dcommit,

* if some other revision is specified, as in the example, all work
  happens on a detached HEAD and no branch is affected.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Acked-by: Eric Wong <normalperson@yhbt.net>
2009-06-25 00:38:16 -07:00
Roel Kluin
6651c3f706 fread does not return negative on error
size_t res cannot be less than 0. fread returns 0 on error.

Reported-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-23 16:57:15 -07:00
Bert Wesarg
3f721d1d6d builtin-remote: (get_one_entry): use strbuf
Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-23 16:43:16 -07:00
Brandon Casey
977e289e0d t/t9001-send-email.sh: ensure generated script is executed with $SHELL_PATH
If the shell is not specified using the '#!' notation, then the OS will
use '/bin/sh' to execute the script which may not produce the desired
results.  In particular, /bin/sh on Solaris interprets '^' specially which
has an effect on the sed command that this patch touches.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-23 16:41:27 -07:00
Junio C Hamano
916e1373fb Merge branch 'maint'
* maint:
  t3700-add: add a POSIXPERM prerequisite to a new test
2009-06-22 00:44:34 -07:00
Johannes Sixt
1ab012cf81 t3700-add: add a POSIXPERM prerequisite to a new test
The new test does a 'chmod 0', which does not have the intended
effect on Windows.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-22 00:44:14 -07:00
Junio C Hamano
d1f6c18bd6 Merge branch 'sb/maint-1.6.0-add-config-fix' into maint
* sb/maint-1.6.0-add-config-fix:
  add: allow configurations to be overriden by command line
2009-06-22 00:44:09 -07:00
Junio C Hamano
e16a4779b3 Sync with 1.6.3.3
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-21 23:50:17 -07:00
Junio C Hamano
cff4231a1d GIT 1.6.3.3
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-21 21:15:50 -07:00
Junio C Hamano
a69f8c9809 Merge branch 'ak/maint-for-each-ref-no-lookup' into maint
* ak/maint-for-each-ref-no-lookup:
  for-each-ref: Do not lookup objects when they will not be used
2009-06-21 21:15:39 -07:00
Junio C Hamano
be273c73b7 Merge branch 'rc/maint-http-local-slot-fix' into maint
* rc/maint-http-local-slot-fix:
  http*: cleanup slot->local after fclose
2009-06-21 21:15:31 -07:00
Junio C Hamano
d836118be9 Merge branch 'cb/maint-no-double-merge' into maint
* cb/maint-no-double-merge:
  refuse to merge during a merge
2009-06-21 21:15:27 -07:00
Junio C Hamano
6019b3ce8d Merge branch 'mn/maint-iconv-autoconf' into maint
* mn/maint-iconv-autoconf:
  fix handling of iconv configuration options
2009-06-21 21:14:25 -07:00
Junio C Hamano
44fb185963 Merge branch 'lt/maint-unsigned-left-shift' into maint
* lt/maint-unsigned-left-shift:
  Fix big left-shifts of unsigned char
2009-06-21 21:14:09 -07:00
Junio C Hamano
037e9d5b15 Merge branch 'pb/maint-1.6.2-userdiff-fix' into maint
* pb/maint-1.6.2-userdiff-fix:
  upload-archive: fix infinite loop on Cygwin
  avoid exponential regex match for java and objc function names
2009-06-21 21:08:05 -07:00
Johannes Sixt
2ff4d1ab9e receive-pack: do not send error details to the client
If the objects that a client pushes to the server cannot be processed for
any reason, an error is reported back to the client via the git protocol.
We used to send quite detailed information if a system call failed if
unpack-objects is run. This can be regarded as an information leak. Now we
do not send any error details like we already do in the case where
index-pack failed.

Errors in system calls as well as the exit code of unpack-objects and
index-pack are now reported to stderr; in the case of a local push or via
ssh these messages still go to the client, but that is OK since these forms
of access to the server assume that the client can be trusted. If
receive-pack is run from git-daemon, then the daemon should put the error
messages into the syslog.

With this reasoning a new status report is added for the post-update-hook;
untrusted (i.e. daemon's) clients cannot observe its status anyway, others
may want to know failure details.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-21 20:19:21 -07:00
Junio C Hamano
a437900fd7 attribute: whitespace set to true detects all errors known to git
That is what the documentation says, but the code pretends as if all the
known whitespace error tokens were given.

Among the whitespace error tokens, there is one kind that loosens the rule
when set: cr-at-eol.  Which means that whitespace error token that is set
to true ignores a newly introduced CR at the end, which is inconsistent
with the documentation.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-21 10:43:10 -07:00
Nanako Shiraishi
e2f6331a14 .gitattributes: CR at the end of the line is an error
When a CR is accidentally added at the end of a C source file in the git
project tree, "git diff --check" doesn't detect it as an error.

    $ echo abQ | tr Q '\015' >>fast-import.c
    $ git diff --check

I think this is because the "whitespace" attribute is set to *.[ch] files
without specifying what kind of errors are caught. It makes git "notice
all types of errors" (as described in the documentation), but I think it
is incorrectly setting cr-at-eol, too, and hides this error.

Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-21 10:42:37 -07:00
Junio C Hamano
c6720cfa49 t3505: fix abuse of test_expect_code
The test wanted to make sure that cherry-pick exits with status 1,
but with the way it was placed after "git checkout master &&" meant
that it could have misjudged success if checkout barfed with the
same failure status.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-21 02:01:28 -07:00
Stephen Boyd
69932bc611 show-ref: migrate to parse-options
Also make the docs more consistent with the usage message. While we're
here remove the zero initializers from the static variables as they're
unnecessary.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-20 23:50:42 -07:00
Junio C Hamano
c5764c095c Merge branch 'maint'
* maint:
  git-show-ref.txt: remove word and make consistent
  git-svn documentation: fix typo in 'rebase vs. pull/merge' section
2009-06-20 23:50:17 -07:00
Junio C Hamano
3ba4f3a9fc Merge branch 'maint-1.6.2' into maint
* maint-1.6.2:
  git-show-ref.txt: remove word and make consistent
  git-svn documentation: fix typo in 'rebase vs. pull/merge' section
  use xstrdup, not strdup in ll-merge.c
2009-06-20 23:48:46 -07:00
Junio C Hamano
cd12f53612 Merge branch 'maint-1.6.1' into maint-1.6.2
* maint-1.6.1:
  git-show-ref.txt: remove word and make consistent
  git-svn documentation: fix typo in 'rebase vs. pull/merge' section
  use xstrdup, not strdup in ll-merge.c
2009-06-20 23:48:28 -07:00
Junio C Hamano
4258c212ca Merge branch 'maint-1.6.0' into maint-1.6.1
* maint-1.6.0:
  git-show-ref.txt: remove word and make consistent
  git-svn documentation: fix typo in 'rebase vs. pull/merge' section
  use xstrdup, not strdup in ll-merge.c
2009-06-20 23:48:21 -07:00
Stephen Boyd
d4900ee48c git-show-ref.txt: remove word and make consistent
Under is better than in because of the nested nature of the .git
directory.

"also using" sounds a little odd, plus we say combined with later on so
just use that.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-20 23:45:51 -07:00
Linus Torvalds
2af202be3d Fix various sparse warnings in the git source code
There are a few remaining ones, but this fixes the trivial ones. It boils
down to two main issues that sparse complains about:

 - warning: Using plain integer as NULL pointer

   Sparse doesn't like you using '0' instead of 'NULL'. For various good
   reasons, not the least of which is just the visual confusion. A NULL
   pointer is not an integer, and that whole "0 works as NULL" is a
   historical accident and not very pretty.

   A few of these remain: zlib is a total mess, and Z_NULL is just a 0.
   I didn't touch those.

 - warning: symbol 'xyz' was not declared. Should it be static?

   Sparse wants to see declarations for any functions you export. A lack
   of a declaration tends to mean that you should either add one, or you
   should mark the function 'static' to show that it's in file scope.

   A few of these remain: I only did the ones that should obviously just
   be made static.

That 'wt_status_submodule_summary' one is debatable. It has a few related
flags (like 'wt_status_use_color') which _are_ declared, and are used by
builtin-commit.c. So maybe we'd like to export it at some point, but it's
not declared now, and not used outside of that file, so 'static' it is in
this patch.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-20 21:52:55 -07:00
Junio C Hamano
a49eb197d8 Merge branch 'ph/submodule-rebase'
* ph/submodule-rebase:
  git-submodule: add support for --merge.

Conflicts:
	Documentation/git-submodule.txt
	git-submodule.sh
2009-06-20 21:51:13 -07:00
Brandon Casey
1d7b1af420 Makefile: Solaris needs HAVE_ALLOCA_H for alloca()
There is special handling in compat/regex/regex.c for the GNU compiler
to define alloca to __builtin_alloca, but the native compiler must include
alloca.h which happens when HAVE_ALLOCA_H is defined.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-20 21:50:11 -07:00
Junio C Hamano
c28a17f270 Merge branch 'jc/cache-tree'
* jc/cache-tree:
  Avoid "diff-index --cached" optimization under --find-copies-harder
  Optimize "diff-index --cached" using cache-tree
  t4007: modernize the style
  cache-tree.c::cache_tree_find(): simplify internal API
  write-tree --ignore-cache-tree
2009-06-20 21:47:30 -07:00
Junio C Hamano
deded16d15 Merge branch 'mg/pushurl'
* mg/pushurl:
  avoid NULL dereference on failed malloc
  builtin-remote: Make "remote -v" display push urls
  builtin-remote: Show push urls as well
  technical/api-remote: Describe new struct remote member pushurl
  t5516: Check pushurl config setting
  Allow push and fetch urls to be different
2009-06-20 21:47:27 -07:00
Junio C Hamano
974e6e42f7 Merge branch 'mn/maint-iconv-autoconf'
* mn/maint-iconv-autoconf:
  fix handling of iconv configuration options
2009-06-20 21:47:22 -07:00
Junio C Hamano
12d4ffaa94 Merge branch 'sb/pull-rebase'
* sb/pull-rebase:
  parse-remote: remove unused functions
  parse-remote: support default reflist in get_remote_merge_branch
  parse-remote: function to get the tracking branch to be merge
2009-06-20 21:47:13 -07:00
Junio C Hamano
451316d9bd Merge branch 'pb/send-email-cccmd-fix'
* pb/send-email-cccmd-fix:
  Test cccmd in t9001-send-email.sh and fix some bugs
2009-06-20 21:47:06 -07:00
Junio C Hamano
b58f6b50c1 Merge branch 'pb/maint-1.6.2-userdiff-fix'
* pb/maint-1.6.2-userdiff-fix:
  upload-archive: fix infinite loop on Cygwin
  avoid exponential regex match for java and objc function names
2009-06-20 21:46:55 -07:00
Junio C Hamano
09236d8048 Merge branch 'sb/maint-1.6.0-add-config-fix'
* sb/maint-1.6.0-add-config-fix:
  add: allow configurations to be overriden by command line
  use xstrdup, not strdup in ll-merge.c

Conflicts:
	builtin-add.c
2009-06-20 21:46:38 -07:00
Junio C Hamano
7c74c3926a Merge branch 'lt/maint-unsigned-left-shift'
* lt/maint-unsigned-left-shift:
  Fix big left-shifts of unsigned char
2009-06-20 21:46:10 -07:00
Miklos Vajna
ccf497de97 git-svn documentation: fix typo in 'rebase vs. pull/merge' section
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-20 21:20:51 -07:00
Junio C Hamano
d4f6bc887d Merge git://git.kernel.org/pub/scm/gitk/gitk
* git://git.kernel.org/pub/scm/gitk/gitk:
  gitk: Allow diff view without context lines
  gitk: Add another string to translation
  gitk: Add option 'Simple history' to the options menu
  gitk: Handle msysGit version during version comparisons
  gitk: Make more options easily accessible from Edit View dialog
  gitk: Check git version before using --textconv flag
  gitk: Use --textconv to generate diff text
  gitk: Update German translation.
2009-06-20 11:54:37 -07:00
Stephen Boyd
ed342fdea0 add: allow configurations to be overriden by command line
Don't call git_config after parsing the command line options, otherwise
the config settings will override any settings made by the command line.

This can be seen by setting add.ignore_errors and then specifying
--no-ignore-errors when using git-add.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-18 12:20:36 -07:00