1
0
mirror of https://github.com/git/git.git synced 2024-10-21 16:18:11 +02:00
Commit Graph

19112 Commits

Author SHA1 Message Date
Linus Torvalds
dba2e2037f Simplify read_directory[_recursive]() arguments
Stop the insanity with separate 'path' and 'base' arguments that must
match.  We don't need that crazy interface any more, since we cleaned up
handling of 'path' in commit da4b3e8c28b1dc2b856d2555ac7bb47ab712598c.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-09 01:11:28 -07:00
Linus Torvalds
1d8842d921 Add 'fill_directory()' helper function for directory traversal
Most of the users of "read_directory()" actually want a much simpler
interface than the whole complex (but rather powerful) one.

In fact 'git add' had already largely abstracted out the core interface
issues into a private "fill_directory()" function that was largely
applicable almost as-is to a number of callers.  Yes, 'git add' wants to
do some extra work of its own, specific to the add semantics, but we can
easily split that out, and use the core as a generic function.

This function does exactly that, and now that much simplified
'fill_directory()' function can be shared with a number of callers,
while also ensuring that the rather more complex calling conventions of
read_directory() are used by fewer call-sites.

This also makes the 'common_prefix()' helper function private to dir.c,
since all callers are now in that file.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-09 01:11:26 -07:00
Stephen Boyd
f581de1b7b completion: __git_config_get_set_variables() handle values with spaces
Commit 0065236 (bash completion: complete variable names for "git
config" with options 2009-05-08) implemented its config variable search
wrong. When a config contains a value with a space and a period (.) in
it, completion erroneously thinks that line in the configuration is
multiple config variables.

For example

 $ cat .git/config
   format.cc = Junio C Hamano <gitster@pobox.com>

 $ git config --unset <TAB>
   format.cc
   <gitster@pobox.com>

Instead of using a for loop splitting across spaces, pipe each line to a
while read loop and beef up the case statement to match only
'config.variable=value'.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-06 09:45:00 -07:00
Junio C Hamano
dd787c19c4 Merge branch 'tr/die_errno'
* tr/die_errno:
  Use die_errno() instead of die() when checking syscalls
  Convert existing die(..., strerror(errno)) to die_errno()
  die_errno(): double % in strerror() output just in case
  Introduce die_errno() that appends strerror(errno) to die()
2009-07-06 09:39:46 -07:00
Junio C Hamano
864cd94917 Merge branch 'cb/maint-fetch-refspec-wo-dst'
* cb/maint-fetch-refspec-wo-dst:
  fetch: do not create ref from empty name
2009-07-06 09:39:38 -07:00
Junio C Hamano
ea1b9b948d Merge branch 'sb/show-ref-parse-options'
* sb/show-ref-parse-options:
  show-ref: migrate to parse-options
2009-07-06 09:38:58 -07:00
Junio C Hamano
7557b34310 Merge branch 'gb/am-foreign'
* gb/am-foreign:
  git-am: refactor 'cleaning up and aborting'
  git-am foreign patch support: StGIT support
  git-am foreign patch support: autodetect some patch formats
  git-am foreign patch support: introduce patch_format
2009-07-06 09:38:33 -07:00
Junio C Hamano
e526692066 Merge branch 'jk/use-our-regexp'
* jk/use-our-regexp:
  Makefile: Solaris needs HAVE_ALLOCA_H for alloca()
  Makefile: use compat regex on Solaris
  Makefile: refactor regex compat support
2009-07-06 09:38:08 -07:00
Junio C Hamano
5cacf3d644 Merge branch 'uk/rev-parse-parse-opt'
* uk/rev-parse-parse-opt:
  parse-opt: make PARSE_OPT_STOP_AT_NON_OPTION available to git rev-parse
  more tests for git rev-parse --parse-opt
2009-07-06 09:38:01 -07:00
Nick Woolley
3115fe9821 Avoid generating a warning if $fullname{$file} is undefined
Signed-off-by: Nick Woolley <git.wu-lee@noodlefactory.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-06 09:36:43 -07:00
Nick Woolley
444f29ce42 Remove archaic use of regex capture \1 in favour of $1
Using it will generate a perl warning "\1 better written as $1".

Signed-off-by: Nick Woolley <git.wu-lee@noodlefactory.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-06 09:36:39 -07:00
Todd Zullinger
5d0e634343 completion: Add --full-diff to log options
Signed-off-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-06 09:36:24 -07:00
Eric Wong
f290974390 Allow the Unix epoch to be a valid commit date
It is common practice to use the Unix epoch as a fallback date
when a suitable date is not available.  This is true of git svn
and possibly other importing tools that import non-git history
into git.

Instead of clobbering established strtoul() error reporting
semantics with our own, preserve the strtoul() error value
of ULONG_MAX for fsck.c to handle.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-06 09:36:16 -07:00
Hunter, D. Seth
c8400d9ef5 http-push: fix xml_entities() string parsing overrun
xml_entities() in http-push.c did not properly stop at the end of the
string being examined, which would occasionally cause nonsense to be
appended to escaped URL strings and result in failed DAV XML queries

Signed-off-by: Seth Hunter <hunter@ll.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-06 09:36:08 -07:00
Martin Renold
606475f317 Remove filename from conflict markers
Put filenames into the conflict markers only when they are different.
Otherwise they are redundant information clutter.

Print the filename explicitely when warning about a binary conflict.

Signed-off-by: Martin Renold <martinxyz@gmx.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-01 19:46:30 -07:00
Junio C Hamano
702beb3af0 Merge branch 'cc/bisect'
* cc/bisect:
  Documentation: remove warning saying that "git bisect skip" may slow bisection
  bisect: use a PRNG with a bias when skipping away from untestable commits
2009-07-01 19:41:04 -07:00
Junio C Hamano
a4103bac37 Merge branch 'js/daemon-log'
* js/daemon-log:
  receive-pack: do not send error details to the client
  upload-pack: squelch progress indicator if client cannot see it
  daemon: send stderr of service programs to the syslog
2009-07-01 19:41:00 -07:00
Junio C Hamano
59773c7e58 Merge branch 'cf/maint-remote-uploadpack-useconfig-fix'
* cf/maint-remote-uploadpack-useconfig-fix:
  git-remote: fix missing .uploadpack usage for show command
2009-07-01 19:40:54 -07:00
Junio C Hamano
e6c7c2cc97 Merge branch 'sb/quiet-porcelains'
* sb/quiet-porcelains:
  stash: teach quiet option
  am, rebase: teach quiet option
  submodule, repack: migrate to git-sh-setup's say()
  git-sh-setup: introduce say() for quiet options
  am: suppress apply errors when using 3-way
  t4150: test applying with a newline in subject
2009-07-01 19:40:50 -07:00
Junio C Hamano
4197195bee Merge branch 'ne/maint-1.6.0-diff-tree-t-r-show-directory'
* ne/maint-1.6.0-diff-tree-t-r-show-directory:
  diff-tree -r -t: include added/removed directories in the output
2009-07-01 19:40:47 -07:00
Junio C Hamano
3eb1e8ee1f Merge branch 'maint'
* maint:
  request-pull: really really disable pager
2009-07-01 19:40:16 -07:00
Michal Marek
653a31c16a request-pull: really really disable pager
Earlier 476cc72 (request-pull: really disable pager, 2009-06-30)
tried to use the correct environment variable to disable paging
from multiple calls to "git log" and friends, but there was one
extra call to "git log" that was not covered by the trick.

Move the setting and exporting of GIT_PAGER much earlier in the
script to cover everybody.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-01 13:20:00 -07:00
Jeff King
8715227df6 log-tree: fix confusing comment
This comment mentions the case where use_terminator is set,
but this case is not handled at all by this chunk of code.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-01 11:16:54 -07:00
Junio C Hamano
725cf7b45d Merge branch 'maint'
* maint:
  attr: plug minor memory leak
  request-pull: really disable pager
  Makes some cleanup/review in gittutorial
  Makefile: git.o depends on library headers
  git-submodule documentation: fix foreach example
2009-06-30 16:12:35 -07:00
René Scharfe
d4c985653a attr: plug minor memory leak
Free the memory allocated for struct strbuf pathbuf when we're done.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-30 16:12:24 -07:00
Brandon Casey
6167c13657 git.c: avoid allocating one-too-many elements for new argv array
When creating a new argv array from a configured alias and the supplied
command line arguments, the new argv was allocated with one element too
many.  Since the first element of the original argv array is skipped when
copying it to the new_argv, the number of elements that are allocated
should be reduced by one.  'count' is the number of elements that new_argv
contains, and *argcp is the number of elements in the original argv array.
So the total allocation (including the terminating NULL entry) for the
new_argv array should be:

  count + (*argcp - 1) + 1

Also, the explicit assignment of the NULL terminating entry can be avoided
by just copying it over from the original argv array.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-30 16:12:14 -07:00
Junio C Hamano
476cc72424 request-pull: really disable pager
ff06c74 (Improve request-pull to handle non-rebased branches, 2007-05-01)
attempted to disable pager when running subcommands in this script, but
with a wrong variable.  If GIT_PAGER is set, it takes precedence over
PAGER.

Noticed by Michal Marek.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-30 11:33:30 -07:00
Johannes Sixt
b8f262699f git-mv: fix directory separator treatment on Windows
The following invocations did not work as expected on Windows:

    git mv foo\bar dest
    git mv foo\ dest

The first command was interpreted as

    git mv foo/bar dest/foo/bar

because the Windows style directory separator was not obeyed when the
basename of 'foo\bar' was computed.

The second command failed because the Windows style directory separator was
not removed from the source directory, whereupon the lookup of the
directory in the index failed.

This fixes both issues by using is_dir_sep() and basename().

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-30 11:23:21 -07:00
Stephen Boyd
6fac1b83bd completion: add missing config variables
Update to include branch.*.rebase, remote.*.pushurl, and
add.ignore-errors

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-30 11:20:04 -07:00
Thadeu Lima de Souza Cascardo
21d777f257 Makes some cleanup/review in gittutorial
There are some different but little cleanup changes to fix some missing
quotes, to fix what seemed to be an unended sentence, to reident a
little paragraph with too large a sentence and fix a branch name that
was referred to twice later by another name.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-30 11:17:55 -07:00
Johannes Sixt
fe104986c6 Makefile: git.o depends on library headers
This dependency was not yet specified anywhere else.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-30 11:17:54 -07:00
Miklos Vajna
1c3acfcd57 git-submodule documentation: fix foreach example
Backtick and apostrophe are asciidoc markup, so they should be escaped
in order to get the expected result in the rendered manual page.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-30 11:17:54 -07:00
Linus Torvalds
b8e8db281c git log: add '--merges' flag to match '--no-merges'
I do various statistics on git, and one of the things I look at is merges,
because they are often interesting events to count ("how many merges vs
how much 'real development'" kind of statistics). And you can do it with
some fairly straightforward scripting, ie

	git rev-list --parents HEAD |
		grep ' .* ' |
		git diff-tree --always -s --pretty=oneline --stdin |
		less -S

will do it.

But I finally got irritated with the fact that we can skip merges with
'--no-merges', but we can't do the trivial reverse operation.

So this just adds a '--merges' flag that _only_ shows merges. Now you can
do the above with just a

	git log --merges --pretty=oneline

which is a lot simpler. It also means that we automatically get a lot of
statistics for free, eg

	git shortlog -ns --merges

does exactly what you'd want it to do.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-29 12:32:51 -07:00
Junio C Hamano
4f2b15ce88 Merge git://git.bogomips.org/git-svn
* git://git.bogomips.org/git-svn:
  git svn: Doc update for multiple branch and tag paths
  git svn: cleanup t9138-multiple-branches
  git-svn: Canonicalize svn urls to prevent libsvn assertion
  t9138: remove stray dot in test which broke bash
  git-svn: convert globs to regexps for branch destinations
  git svn: Support multiple branch and tag paths in the svn repository.
  Add 'git svn reset' to unwind 'git svn fetch'
  git-svn: speed up find_rev_before
  Add 'git svn help [cmd]' which works outside a repo.
  git-svn: let 'dcommit $rev' work on $rev instead of HEAD
2009-06-27 20:09:04 -07:00
Marc Branchaud
ab81a3643b git svn: Doc update for multiple branch and tag paths
Signed-off-by: Marc Branchaud <marcnarc@xiplink.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
2009-06-27 15:05:42 -07:00
Marc Branchaud
b5c9b38bc3 git svn: cleanup t9138-multiple-branches
Using the "svn_cmd" wrapper instead of "svn" alone allows tests
to run consistently for users with customized
~/.subversion/configs.  Additionally, using subshells via
"(cd ...)" allow cleaner and less error-prone tests to
be written.

[ew: expanded commit message]

Signed-off-by: Marc Branchaud <marcnarc@xiplink.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
2009-06-27 15:01:57 -07:00
Junio C Hamano
36e74ab7ef Merge branch 'pb/send-email-cccmd-fix'
* pb/send-email-cccmd-fix:
  t/t9001-send-email.sh: ensure generated script is executed with $SHELL_PATH
2009-06-27 14:13:43 -07:00
Junio C Hamano
2dc7f40d44 Merge branch 'maint'
* maint:
  gitweb/README: fix AliasMatch in example
  Test grep --and/--or/--not
  Test git archive --remote
  fread does not return negative on error
2009-06-27 13:44:25 -07:00
Giuseppe Bilotta
1bed73c64a gitweb/README: fix AliasMatch in example
When combining "dumb client" and human-friendly access by using the
'.git' extension to switch between the two, make sure the AliasMatch
covers the entire request. Without a full match, a request for

http://git.example.com/project/shortlog/branch..gitsomething

would result in a 404 because the server would try to access the
the project 'project/shortlog/branch.'

The solution is still not bulletproof, so document the possible failing
case.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-27 13:15:57 -07:00
Thomas Rast
0f7050469b Test grep --and/--or/--not
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-27 13:15:41 -07:00
Thomas Rast
4813926921 Test git archive --remote
Add a small test case for git archive --remote (and thus
git-upload-archive), which so far went untested.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-27 13:15:39 -07:00
Thomas Rast
0721c314a5 Use die_errno() instead of die() when checking syscalls
Lots of die() calls did not actually report the kind of error, which
can leave the user confused as to the real problem.  Use die_errno()
where we check a system/library call that sets errno on failure, or
one of the following that wrap such calls:

  Function              Passes on error from
  --------              --------------------
  odb_pack_keep         open
  read_ancestry         fopen
  read_in_full          xread
  strbuf_read           xread
  strbuf_read_file      open or strbuf_read_file
  strbuf_readlink       readlink
  write_in_full         xwrite

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
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