Граф коммитов

122 Коммитов

Автор SHA1 Сообщение Дата
Pierre Habouzit d828f6ddf8 remove ugly shadowing of loop indexes in subloops.
builtin-mv.c and git.c has a nested loop that is governed by a
variable 'i', but they shadow it with another instance of 'i'.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-23 18:47:39 -07:00
David Rientjes 96f1e58f52 remove unnecessary initializations
[jc: I needed to hand merge the changes to the updated codebase,
 so the result needs to be checked.]

Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-15 21:22:20 -07:00
Rene Scharfe 2e3ed670eb git-verify-pack: make builtin
Convert git-verify-pack to a builtin command.  Also rename ac to argc
and av to argv for consistancy.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-10 14:19:06 -07:00
Junio C Hamano 102cb08521 Merge branch 'master' into mk/rename 2006-08-08 15:42:20 -07:00
Jeff King 6c8d06aff1 git-push: allow pushing from subdirectories
The semantics are equivalent to pushing from the root; we just try harder to
find the .git directory.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-08 13:30:10 -07:00
Junio C Hamano efffea0334 git.c: Rename NEEDS_PREFIX to RUN_SETUP
As Matthias Kestenholz noted, the flag does not quite mean
"needs prefix" -- it is more like "run setup_git_directory()
before running this command", so rename it to avoid future
confusion.

While we are at it, rewrite the definition of options to make it
obvious that we are talking about flag bits by using standard (1<<n)
notation.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-04 02:04:00 -07:00
Junio C Hamano f754fa9c54 builtins: Makefile clean-up
This cleans up the build procedure for built-in commands by:

 - generating mostly redundant definition of BUILT_INS from
   BUILTIN_OBJS in the Makefile,
 - renaming a few files to make the above possible, and
 - sorting the built-in command table in git.c.

It might be a good idea to binary search (or perfect hash) the built-in
command table, but that can be done later when somebody feels like.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-04 01:51:04 -07:00
Junio C Hamano e414156ab6 Make git-checkout-index a builtin
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-04 01:23:19 -07:00
Matthias Kestenholz 640ce1052b Make git-symbolic-ref a builtin
Signed-off-by: Matthias Kestenholz <matthias@spinlock.ch>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-03 23:15:11 -07:00
Matthias Kestenholz 6441363079 Make git-unpack-objects a builtin
Signed-off-by: Matthias Kestenholz <matthias@spinlock.ch>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-03 23:15:11 -07:00
Matthias Kestenholz 5d4a600335 Make git-pack-objects a builtin
Signed-off-by: Matthias Kestenholz <matthias@spinlock.ch>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-03 23:15:11 -07:00
Matthias Kestenholz d6b64ed0f3 Make git-name-rev a builtin
Signed-off-by: Matthias Kestenholz <matthias@spinlock.ch>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-03 23:15:11 -07:00
Matthias Kestenholz e12c095aa6 Make git-repo-config a builtin
Signed-off-by: Matthias Kestenholz <matthias@spinlock.ch>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-02 17:05:14 -07:00
Matthias Kestenholz 53bb2c002a Make git-prune-packed a builtin
Signed-off-by: Matthias Kestenholz <matthias@spinlock.ch>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-02 11:36:01 -07:00
Ramsay Allan Jones 822a7d5071 Remove cmd_usage() routine and re-organize the help/usage code.
The cmd_usage() routine was causing warning messages due to a NULL
format parameter being passed in three out of four calls. This is a
problem if you want to compile with -Werror. A simple solution is to
simply remove the GNU __attribute__ format pragma from the cmd_usage()
declaration in the header file. The function interface was somewhat
muddled anyway, so re-write the code to finesse the problem.

[jc: this incidentally revealed that t9100 test assumed that the output
 from "git help" to be fixed in stone, but this patch lower-cases
 "Usage" to "usage".  Update the test not to rely on "git help" output.]

Signed-off-by: Ramsay Allan Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-02 00:27:18 -07:00
Junio C Hamano 9590b041ea Builtins: control the use of pager from the command table.
This moves the built-in "always-use-pager" logic for log family
to the command dispatch table of git wrapper.  This makes it
easier to change the default use of pager, and has an added
benefit that we fork and exec the pager early before packs are
mmapped.

Pointed out by Juergen Ruehle <j.ruehle@bmiag.de>.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-31 15:32:23 -07:00
Matthias Lederhofer 0347a8c764 git.c: allow alias expansion without a git directory
With this, the configuration mechanism can be used to say:

	[alias]
		init = init-db --template=/path/to/template

Signed-off-by: Matthias Lederhofer <matled@gmx.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-30 17:45:57 -07:00
Junio C Hamano 7061cf0f20 Merge branch 'lt/setup' into __/setup-n-mv
This merges the new built-in calling convention code into Johannes's
builtin-mv topic in order to resolve their conflicts early on.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-29 01:54:54 -07:00
Linus Torvalds a633fca0c0 Call setup_git_directory() much earlier
This changes the calling convention of built-in commands and
passes the "prefix" (i.e. pathname of $PWD relative to the
project root level) down to them.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-29 01:34:07 -07:00
Johannes Schindelin 11be42a476 Make git-mv a builtin
This also moves add_file_to_index() to read-cache.c. Oh, and while
touching builtin-add.c, it also removes a duplicate git_config() call.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-26 13:36:36 -07:00
Johannes Schindelin 6acbcb927f git wrapper: add --git-dir=<path> and --bare options
With this, you can say

	git --bare repack -a -d

inside a bare repository, and it will actually work. While at it,
also move the --version, --help and --exec-path options to the
handle_options() function.

While at documenting the new options, also document the --paginate
option.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-25 14:15:47 -07:00
Johannes Schindelin 4ab243a944 Allow an alias to start with "-p"
Now, something like

	[alias]
		pd = -p diff

works as expected.

[jc: a follow-up fix from Jeff King folded in.]

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-25 14:15:46 -07:00
Matthias Lederhofer d5b9e6cfa7 argv created by handle_alias should be NULL terminated
Signed-off-by: Matthias Lederhofer <matled@gmx.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-14 11:32:39 -07:00
Junio C Hamano d3ba675aae Merge branch 'ml/trace'
* ml/trace:
  test-lib: unset GIT_TRACE
  GIT_TRACE: fix a mixed declarations and code warning
  GIT_TRACE: show which built-in/external commands are executed
2006-07-12 23:09:10 -07:00
Junio C Hamano 3939b805f4 Merge branch 'lt/prune'
* lt/prune:
  builtin "git prune"
2006-07-12 22:31:55 -07:00
Junio C Hamano 85fb65ed6e "git -p cmd" to page anywhere
This allows you to say:

	git -p diff v2.6.16-rc5..

and the command pipes the output of any git command to your pager.

[jc: this resurrects a month old RFC patch with improvement
 suggested by Linus to call it --paginate instead of --less.]

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-09 03:27:03 -07:00
Matthias Lederhofer 575ba9d69d GIT_TRACE: show which built-in/external commands are executed
With the environment variable GIT_TRACE set git will show
 - alias expansion
 - built-in command execution
 - external command execution
on stderr.

Signed-off-by: Matthias Lederhofer <matled@gmx.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-09 00:57:23 -07:00
Linus Torvalds ba84a797e7 builtin "git prune"
This actually removes the objects to be pruned, unless you specify "-n"
(at which point it will just tell you which files it would prune).

This doesn't do the pack-file pruning that the shell-script used to do,
but if somebody really wants to, they could add it easily enough. I wonder
how useful it is, though, considering that "git repack -a -d" is just a
lot more efficient and generates a better end result.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-09 00:57:22 -07:00
Johannes Schindelin 00449f992b Make git-fmt-merge-msg a builtin
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-03 19:42:41 -07:00
Johannes Schindelin 47e5c0ca2c Save errno in handle_alias()
git.c:main() relies on the value of errno being set by the last attempt to
execute the command. However, if something goes awry in handle_alias(),
that assumption is wrong. So restore errno before returning from
handle_alias().

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-28 03:55:36 -07:00
Timo Hirvonen 554fe20d80 Make some strings const
Signed-off-by: Timo Hirvonen <tihirvon@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-28 03:24:37 -07:00
Andreas Ericsson 33ebb8717f git wrapper: fix command name in an error message.
When the command execution by execv_git_cmd() fails with an errno
other than ENOENT, we used an uninitialized variable instead of
the string that holds the command name to report what failed.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-28 03:20:51 -07:00
Lukas Sandström 854b4629f9 Make git-update-ref a builtin
Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-18 22:12:20 -07:00
Lukas Sandström fefe81c996 Make git-update-index a builtin
Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-18 22:12:19 -07:00
Lukas Sandström 7499c99615 Make git-stripspace a builtin
Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-18 22:12:16 -07:00
Lukas Sandström 34488e3c37 Make git-mailinfo a builtin
[jc: with a bit of constness tightening]

Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-18 22:10:28 -07:00
Lukas Sandström e690e84315 Make git-mailsplit a builtin
Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-18 21:58:20 -07:00
Lukas Sandström 8ed05fb5e9 Make git-write-tree a builtin
Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-18 21:58:19 -07:00
Junio C Hamano d8498500ba fix git alias
When extra command line arguments are given to a command that
was alias-expanded, the code generated a wrong argument list,
leaving the original alias in the result, and forgetting to
terminate the new argv list.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-16 22:34:09 -07:00
Rene Scharfe 52ba03cbb1 Built-in git-get-tar-commit-id
By being an internal command git-get-commit-id can make use of
struct ustar_header and other stuff and stops wasting precious
disk space.

Note: I recycled one of the two "tar-tree" entries instead of
splitting that cleanup into a separate patch.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-10 11:14:00 -07:00
Junio C Hamano a025463bc0 git alias: try alias last.
This disables alias "foo" from being used for git-foo, and when
we do use alias we check the built-in and then existing command
names first and then alias as the fallback.  This avoids the
problem of common commands used in scripts getting clobbered by
user specific aliases.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-05 18:09:40 -07:00
Johannes Schindelin 2b11e3170e If you have a config containing something like this:
[alias]
		l = "log --stat -M ORIG_HEAD.."

you can call

	git l

and it will do the same as

	git log --stat -M ORIG_HEAD..

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-05 17:49:17 -07:00
Christian Couder 895f10c3b5 Builtin git-rev-parse.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-03 23:45:30 -07:00
Timo Hirvonen f81daefe56 Builtin git-cat-file
Signed-off-by: Timo Hirvonen <tihirvon@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-24 13:35:35 -07:00
Junio C Hamano 73f0a1577b Merge branch 'js/fmt-patch'
This makes "git format-patch" a built-in.

* js/fmt-patch:
  git-rebase: use canonical A..B syntax to format-patch
  git-format-patch: now built-in.
  fmt-patch: Support --attach
  fmt-patch: understand old <his> notation
  Teach fmt-patch about --keep-subject
  Teach fmt-patch about --numbered
  fmt-patch: implement -o <dir>
  fmt-patch: output file names to stdout
  Teach fmt-patch to write individual files.
  Use RFC2822 dates from "git fmt-patch".
  git-fmt-patch: thinkofix to show [PATCH] properly.
  rename internal format-patch wip
  Minor tweak on subject line in --pretty=email
  Tentative built-in format-patch.
2006-05-24 12:19:47 -07:00
Junio C Hamano f2054be4c4 Merge branch 'jc/builtin-n-tar-tree'
This pulls in "make many commands built-in" branches.

* jc/builtin-n-tar-tree:
  built-in tar-tree and remote tar-tree
  Builtin git-diff-files, git-diff-index, git-diff-stages, and git-diff-tree.
  Builtin git-show-branch.
  Builtin git-apply.
  Builtin git-commit-tree.
  Builtin git-read-tree.
  Builtin git-tar-tree.
  Builtin git-ls-tree.
  Builtin git-ls-files.
2006-05-24 11:24:50 -07:00
Junio C Hamano 376bb3a352 Merge branch 'lt/dirwalk'
This makes 'git add' and 'git rm' built-ins.

* lt/dirwalk:
  Add builtin "git rm" command
  Move pathspec matching from builtin-add.c into dir.c
  Prevent bogus paths from being added to the index.
  builtin-add: fix unmatched pathspec warnings.
  Remove old "git-add.sh" remnants
  builtin-add: warn on unmatched pathspecs
  Do "git add" as a builtin
  Clean up git-ls-file directory walking library interface
  libify git-ls-files directory traversal
2006-05-24 11:04:16 -07:00
Junio C Hamano 1af0d11283 Merge branch 'jc/tartree' into jc/builtin-n-tar-tree
* jc/tartree:
  built-in tar-tree and remote tar-tree
2006-05-23 14:44:31 -07:00
Peter Eriksen e8cc9cd98e Builtin git-diff-files, git-diff-index, git-diff-stages, and git-diff-tree.
Signed-off-by: Peter Eriksen <s022018@student.dtu.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-23 13:11:13 -07:00
Peter Eriksen 51ce34b992 Builtin git-show-branch.
Signed-off-by: Peter Eriksen <s022018@student.dtu.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-23 13:11:13 -07:00