1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-20 13:26:08 +02:00
Commit Graph

105 Commits

Author SHA1 Message Date
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
Peter Eriksen ac6245e31a Builtin git-apply.
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 6d96ac18e5 Builtin git-commit-tree.
Signed-off-by: Peter Eriksen <s022018@student.dtu.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-23 13:11:12 -07:00
Peter Eriksen d147e501f3 Builtin git-read-tree.
Signed-off-by: Peter Eriksen <s022018@student.dtu.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-23 13:11:12 -07:00
Peter Eriksen 56d1398ad3 Builtin git-tar-tree.
Signed-off-by: Peter Eriksen <s022018@student.dtu.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-23 13:11:12 -07:00
Peter Eriksen aae01bda7f Builtin git-ls-tree.
Signed-off-by: Peter Eriksen <s022018@student.dtu.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-23 13:11:12 -07:00
Peter Eriksen 0864f26421 Builtin git-ls-files.
Signed-off-by: Peter Eriksen <s022018@student.dtu.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-23 13:11:12 -07:00
Junio C Hamano 685637381a git-format-patch: now built-in.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-21 02:48:21 -07:00
Junio C Hamano 328b710d80 Merge branch 'master' into js/fmt-patch
* master: (119 commits)
  diff family: add --check option
  Document that "git add" only adds non-ignored files.
  Add a conversion tool to migrate remote information into the config
  fetch, pull: ask config for remote information
  Fix build procedure for builtin-init-db
  read-tree -m -u: do not overwrite or remove untracked working tree files.
  apply --cached: do not check newly added file in the working tree
  Implement a --dry-run option to git-quiltimport
  Implement git-quiltimport
  Revert "builtin-grep: workaround for non GNU grep."
  builtin-grep: workaround for non GNU grep.
  builtin-grep: workaround for non GNU grep.
  git-am: use apply --cached
  apply --cached: apply a patch without using working tree.
  apply --numstat: show new name, not old name.
  Documentation/Makefile: create tarballs for the man pages and html files
  Allow pickaxe and diff-filter options to be used by git log.
  Libify the index refresh logic
  Builtin git-init-db
  Remove unnecessary local in get_ref_sha1.
  ...
2006-05-21 01:34:54 -07:00
Junio C Hamano 217542640e built-in tar-tree and remote tar-tree
This makes tar-tree a built-in.  As an added bonus, you can now
say:

	git tar-tree --remote=remote-repository <ent> [<base>]

This does not work with git-daemon yet, but should work with
localhost and git over ssh transports.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-19 17:48:34 -07:00
Linus Torvalds d9b814cc97 Add builtin "git rm" command
This changes semantics very subtly, because it adds a new atomicity
guarantee.

In particular, if you "git rm" several files, it will now do all or
nothing. The old shell-script really looped over the removed files one by
one, and would basically randomly fail in the middle if "-f" was used and
one of the files didn't exist in the working directory.

This C builtin one will not re-write the index after each remove, but
instead remove all files at once. However, that means that if "-f" is used
(to also force removal of the file from the working directory), and some
files have already been removed from the workspace, it won't stop in the
middle in some half-way state like the old one did.

So what happens is that if the _first_ file fails to be removed with "-f",
we abort the whole "git rm". But once we've started removing, we don't
leave anything half done. If some of the other files don't exist, we'll
just ignore errors of removal from the working tree.

This is only an issue with "-f", of course.

I think the new behaviour is strictly an improvement, but perhaps more
importantly, it is _different_. As a special case, the semantics are
identical for the single-file case (which is the only one our test-suite
seems to test).

The other question is what to do with leading directories. The old "git
rm" script didn't do anything, which is somewhat inconsistent. This one
will actually clean up directories that have become empty as a result of
removing the last file, but maybe we want to have a flag to decide the
behaviour?

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-19 17:28:33 -07:00
Timo Hirvonen c3c8835fbb Builtin git-init-db
Basically this just renames init-db.c to builtin-init-db.c and makes
some strings const.

Signed-off-by: Timo Hirvonen <tihirvon@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-19 15:31:20 -07:00
Lukas Sandström 9370bae2ce Make git-check-format-ref a builtin.
Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-18 15:51:38 -07:00
Linus Torvalds 5fb61b8dcf Make "git rev-list" be a builtin
This was surprisingly easy. The diff is truly minimal: rename "main()" to
"cmd_rev_list()" in rev-list.c, and rename the whole file to reflect its
new built-in status.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-18 15:46:11 -07:00
Linus Torvalds 0d78153952 Do "git add" as a builtin
First try. Let's see how well this works.

In many ways, the hard parts of "git commit" are not so different from
this, and a builtin commit would share a lot of the code, I think.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-17 11:52:40 -07:00
Junio C Hamano efca578eec Merge branch 'jc/grep'
* jc/grep: (22 commits)
  Fix silly typo in new builtin grep
  builtin-grep: unparse more command line options.
  builtin-grep: use external grep when we can take advantage of it
  builtin-grep: -F (--fixed-strings)
  builtin-grep: -w fix
  builtin-grep: typofix
  builtin-grep: tighten argument parsing.
  builtin-grep: documentation
  Teach -f <file> option to builtin-grep.
  builtin-grep: -L (--files-without-match).
  builtin-grep: binary files -a and -I
  builtin-grep: terminate correctly at EOF
  builtin-grep: tighten path wildcard vs tree traversal.
  builtin-grep: support -w (--word-regexp).
  builtin-grep: support -c (--count).
  builtin-grep: allow more than one patterns.
  builtin-grep: allow -<n> and -[ABC]<n> notation for context lines.
  builtin-grep: printf %.*s length is int, not ptrdiff_t.
  builtin-grep: do not use setup_revisions()
  builtin-grep: support '-l' option.
  ...
2006-05-15 18:12:06 -07:00
Junio C Hamano c66b6c067e Merge branch 'master' into js/fmt-patch
* master: (109 commits)
  t1300-repo-config: two new config parsing tests.
  Another config file parsing fix.
  update-index: plug memory leak from prefix_path()
  checkout-index: plug memory leak from prefix_path()
  update-index --unresolve: work from a subdirectory.
  pack-object: squelch eye-candy on non-tty
  core.prefersymlinkrefs: use symlinks for .git/HEAD
  repo-config: trim white-space before comment
  Fix for config file section parsing.
  Clarify git-cherry documentation.
  Update git-unpack-objects documentation.
  Fix up docs where "--" isn't displayed correctly.
  Several trivial documentation touch ups.
  git-svn 1.0.0
  git-svn: documentation updates
  delta: stricter constness
  Makefile: do not link rev-list any specially.
  builtin-push: --all and --tags _are_ explicit refspecs
  builtin-log/whatchanged/show: make them official.
  show-branch: omit uninteresting merges.
  ...
2006-05-06 14:42:59 -07:00
Junio C Hamano 230f544e87 Merge branch 'jc/diff'
* jc/diff:
  builtin-diff: call it "git-diff", really.
  builtin-diff.c: die() formatting type fix.
  built-in diff: assorted updates.
  built-in diff.
2006-05-03 23:54:34 -07:00