Commit graph

182 commits

Author SHA1 Message Date
Junio C Hamano 0bbaa5c076 Merge branch 'jk/upload-archive-use-start-command'
* jk/upload-archive-use-start-command:
  upload-archive: use start_command instead of fork
2011-12-16 22:33:30 -08:00
Jeff King 1bc01efed1 upload-archive: use start_command instead of fork
The POSIX-function fork is not supported on Windows. Use our
start_command API instead, respawning ourselves in a special
"writer" mode to follow the alternate code path.

Remove the NOT_MINGW-prereq for t5000, as git-archive --remote
now works.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-21 14:32:40 -08:00
Junio C Hamano cbda121c99 fmt-merge-msg: package options into a structure
This way new features can be added more easily

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-07 15:34:30 -08:00
René Scharfe 6390c905dc repo-config: add deprecation warning
repo-config was deprecated in 5c66d0d4 on 2008-01-17.  Warn the
remaining users that it has been replaced by config and is going to
be removed eventually.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-13 15:13:41 -08:00
Junio C Hamano 3d90c79650 Merge branch 'il/remote-fd-ext'
* il/remote-fd-ext:
  remote-fd/ext: finishing touches after code review
  git-remote-ext
  git-remote-fd
  Add bidirectional_transfer_loop()

Conflicts:
	compat/mingw.h
2010-12-08 11:24:14 -08:00
Junio C Hamano 657072f3ac Merge branch 'jh/notes-merge'
* jh/notes-merge: (23 commits)
  Provide 'git merge --abort' as a synonym to 'git reset --merge'
  cmd_merge(): Parse options before checking MERGE_HEAD
  Provide 'git notes get-ref' to easily retrieve current notes ref
  git notes merge: Add testcases for merging notes trees at different fanouts
  git notes merge: Add another auto-resolving strategy: "cat_sort_uniq"
  git notes merge: --commit should fail if underlying notes ref has moved
  git notes merge: List conflicting notes in notes merge commit message
  git notes merge: Manual conflict resolution, part 2/2
  git notes merge: Manual conflict resolution, part 1/2
  Documentation: Preliminary docs on 'git notes merge'
  git notes merge: Add automatic conflict resolvers (ours, theirs, union)
  git notes merge: Handle real, non-conflicting notes merges
  builtin/notes.c: Refactor creation of notes commits.
  git notes merge: Initial implementation handling trivial merges only
  builtin/notes.c: Split notes ref DWIMmery into a separate function
  notes.c: Use two newlines (instead of one) when concatenating notes
  (trivial) t3303: Indent with tabs instead of spaces for consistency
  notes.h/c: Propagate combine_notes_fn return value to add_note() and beyond
  notes.h/c: Allow combine_notes functions to remove notes
  notes.c: Reorder functions in preparation for next commit
  ...

Conflicts:
	builtin.h
2010-12-08 11:24:12 -08:00
Junio C Hamano dd9d290bc9 Merge branch 'ks/no-textconv-symlink'
* ks/no-textconv-symlink:
  blame,cat-file --textconv: Don't assume mode is ``S_IFREF | 0664''
  blame,cat-file: Demonstrate --textconv is wrongly running converter on symlinks
  blame,cat-file: Prepare --textconv tests for correctly-failing conversion program
2010-11-17 14:59:27 -08:00
Johan Herland 56881843d4 builtin/notes.c: Refactor creation of notes commits.
Create new function create_notes_commit() which is slightly more general than
commit_notes() (accepts multiple commit parents and does not auto-update the
notes ref). This function will be used by the notes-merge functionality in
future patches.

Also rewrite builtin/notes.c:commit_notes() to reuse this new function.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-17 13:21:30 -08:00
Ilari Liusvaara 7f3ecebfcd git-remote-ext
This remote helper invokes external command and passes raw smart transport
stream through it. This is useful for instance for invoking ssh with
one-off odd options, connecting to git services in unix domain
sockets, in abstract namespace, using TLS or other secure protocols,
etc...

Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-13 16:09:28 -07:00
Ilari Liusvaara 3a9ed4bdee git-remote-fd
This remote helper reflects raw smart remote transport stream back to the
calling program. This is useful for example if some UI wants to handle
ssh itself and not use hacks via GIT_SSH.

Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-13 16:09:26 -07:00
Kirill Smelkov 900647104e blame,cat-file --textconv: Don't assume mode is ``S_IFREF | 0664''
We need to get the correct mode when blame reads the source from the
working tree, the index, or trees.  This allows us to omit running
textconv filters on symbolic links.

Signed-off-by: Kirill Smelkov <kirr@landau.phys.spbu.ru>
Reviewed-by: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-29 16:53:25 -07:00
Junio C Hamano 02ef0ed710 Merge branch 'rr/fmt-merge-msg'
* rr/fmt-merge-msg:
  t6200-fmt-merge-msg: Exercise '--log' to configure shortlog length
  t6200-fmt-merge-msg: Exercise 'merge.log' to configure shortlog length
  merge: Make 'merge.log' an integer or boolean option
  merge: Make '--log' an integer option for number of shortlog entries
  fmt_merge_msg: Change fmt_merge_msg API to accept shortlog_len

Conflicts:
	builtin/merge.c
2010-09-29 13:48:20 -07:00
Ramkumar Ramachandra 1876166aaa fmt_merge_msg: Change fmt_merge_msg API to accept shortlog_len
Give "shortlog_len" parameter to the fmt_merge_msg(), remove its
"merge_summary" parameter, and remove fmt_merge_msg_shortlog() function.
In the updated API, shortlog_len == 0 means no shortlog is given.

The parameter "merge_title" controls if the title of the merge commit is
autogenerated (it reads something like "Merge branch ..."), and typically
it is set to true when the caller does not give its own message.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Mentored-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-09 11:39:20 -07:00
Thiago Farina fd5c363da4 builtin.h: Move two functions definitions to help.h.
The two functions defined here are implemented in help.c, so makes more sense
to put the definition of those in help.h instead of in builtin.h.

Signed-off-by: Thiago Farina <tfransosi@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-01 08:00:51 -07:00
Junio C Hamano cf4403a010 Merge branch 'cp/textconv-cat-file'
* cp/textconv-cat-file:
  git-cat-file.txt: Document --textconv
  t/t8007: test textconv support for cat-file
  textconv: support for cat_file
  sha1_name: add get_sha1_with_context()
2010-06-27 12:07:55 -07:00
Junio C Hamano f526d120f6 Merge branch 'maint'
* maint:
  msvc: Fix some compiler warnings
  Documentation: grep: fix asciidoc problem with --
  msvc: Fix some "expr evaluates to function" compiler warnings
2010-06-25 11:45:27 -07:00
Ramsay Jones 4e0d7a8018 msvc: Fix some "expr evaluates to function" compiler warnings
In particular, the following warning is issued while compiling
notes.c:

    notes.c(927) : warning C4550: expression evaluates to a \
function which is missing an argument list

along with identical warnings on lines 928, 1016 and 1017.

In order to suppress the warning, we change the definition of
combine_notes_fn, so that the symbol type is an (explicit)
"pointer to function ...".  As a result, several other
declarations need some minor fix-up to take account of the
new typedef.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Acked-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-24 09:42:12 -07:00
Clément Poulain e5fba602e5 textconv: support for cat_file
Make the textconv_object function public, and add --textconv option to cat-file
to perform conversion on blob objects. Using --textconv implies that we are
working on a blob.
As files drivers need to be initialized, a new config is required in addition
to git_default_config. Therefore git_cat_file_config() is introduced

Signed-off-by: Clément Poulain <clement.poulain@ensimag.imag.fr>
Signed-off-by: Diane Gasselin <diane.gasselin@ensimag.imag.fr>
Signed-off-by: Axel Bonnet <axel.bonnet@ensimag.imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-18 12:57:21 -07:00
Junio C Hamano 8642abc764 Merge branch 'tc/merge-m-log'
* tc/merge-m-log:
  merge: --log appends shortlog to message if specified
  fmt-merge-msg: add function to append shortlog only
  fmt-merge-msg: refactor merge title formatting
  fmt-merge-msg: minor refactor of fmt_merge_msg()
  merge: rename variable
  merge: update comment
  t7604-merge-custom-message: show that --log doesn't append to -m
  t7604-merge-custom-message: shift expected output creation

Conflicts:
	builtin.h
2010-06-18 11:16:54 -07:00
Tay Ray Chuan 8c6bdfdf8b fmt-merge-msg: add function to append shortlog only
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-10 12:02:14 -07:00
Jeff King 40d52ff77b make commit_tree a library function
Until now, this has been part of the commit-tree builtin.
However, it is already used by other builtins (like commit,
merge, and notes), and it would be useful to access it from
library code.

The check_valid helper has to come along, too, but is given
a more library-ish name of "assert_sha1_type".

Otherwise, the code is unchanged. There are still a few
rough edges for a library function, like printing the utf8
warning to stderr, but we can address those if and when they
come up as inappropriate.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-01 23:53:54 -07:00
Thomas Rast 6956f858f6 notes: implement helpers needed for note copying during rewrite
Implement helper functions to load the rewriting config, and to
actually copy the notes.  Also document the config.

Secondly, also implement an undocumented --for-rewrite=<cmd> option to
'git notes copy' which is used like --stdin, but also puts the
configuration for <cmd> into effect.  It will be needed to support the
copying in git-rebase.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Acked-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-12 21:55:39 -08:00
Johan Herland cd067d3bf4 Builtin-ify git-notes
The builtin-ification includes some minor behavioural changes to the
command-line interface: It is no longer allowed to mix the -m and -F
arguments, and it is not allowed to use multiple -F options.

As part of the builtin-ification, we add the commit_notes() function
to the builtin API. This function (together with the notes.h API) can
be easily used from other builtins to manipulate the notes tree.

Also includes needed changes to t3301.

This patch has been improved by the following contributions:
- Stephen Boyd: Use die() instead of fprintf(stderr, ...) followed by exit(1)

Cc: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-13 19:36:13 -08:00
Linus Torvalds 3bb7256281 make "index-pack" a built-in
This required some fairly trivial packfile function 'const' cleanup,
since the builtin commands get a const char *argv[] array.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-22 10:10:27 -08:00
Linus Torvalds 377d0276ca make "git pack-redundant" a built-in
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-22 10:07:14 -08:00
Linus Torvalds b53258182b make "git unpack-file" a built-in
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-22 10:02:16 -08:00
Linus Torvalds 112dd51465 make "mktag" a built-in
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-22 10:01:33 -08:00
Linus Torvalds 0ecace728f make "merge-index" a built-in
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-22 10:01:21 -08:00
Linus Torvalds dedc0ec5d7 make "git patch-id" a built-in
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-21 22:06:12 -08:00
Linus Torvalds 55b6745d63 make "git var" a built-in
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-21 22:04:42 -08:00
Linus Torvalds b28a1ce04c make "git hash-object" a built-in
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-21 20:07:06 -08:00
Linus Torvalds 907a7cb51c make "git merge-tree" a built-in
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-21 20:06:58 -08:00
Jonathan Nieder fe9a215214 Retire fetch--tool helper to contrib/examples
When git-fetch was builtin-ized, the previous script was moved to
contrib/examples.  Now, it is the sole remaining user for
'git fetch--tool'.

The fetch--tool code is still worth keeping around so people can
try out the old git-fetch.sh, for example when investigating
regressions from the builtinifaction.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-09 17:08:44 -08:00
René Scharfe 53a1116c61 update-server-info: make builtin, use parseopt
Convert git update-server-info to a built-in command and use parseopt.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-29 14:07:25 -07:00
Junio C Hamano f00ecbe42b Merge branch 'cc/replace'
* cc/replace:
  t6050: check pushing something based on a replaced commit
  Documentation: add documentation for "git replace"
  Add git-replace to .gitignore
  builtin-replace: use "usage_msg_opt" to give better error messages
  parse-options: add new function "usage_msg_opt"
  builtin-replace: teach "git replace" to actually replace
  Add new "git replace" command
  environment: add global variable to disable replacement
  mktag: call "check_sha1_signature" with the replacement sha1
  replace_object: add a test case
  object: call "check_sha1_signature" with the replacement sha1
  sha1_file: add a "read_sha1_file_repl" function
  replace_object: add mechanism to replace objects found in "refs/replace/"
  refs: add a "for_each_replace_ref" function
2009-08-21 18:47:53 -07:00
Brandon Casey 6a2d3f50f5 builtin-mailsplit.c: remove read_line_with_nul() since it is no longer used
Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-05 12:13:58 -07:00
Christian Couder 54b0c1e041 Add new "git replace" command
This command can only be used now to list replace refs in
"refs/replace/" and to delete them.

The option to list replace refs is "-l".
The option to delete replace refs is "-d".

The behavior should be consistent with how "git tag" and "git branch"
are working.

The code has been copied from "builtin-tag.c" by Kristian Høgsberg
<krh@redhat.com> and Carlos Rica <jasampler@gmail.com> that was itself
based on git-tag.sh and mktag.c by Linus Torvalds.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-31 17:02:59 -07:00
Junio C Hamano 633e3556cc build-in git-mktree
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-10 12:41:35 -07:00
Christian Couder 1bf072e366 bisect--helper: implement "git bisect--helper"
This patch implements a new "git bisect--helper" builtin plumbing
command that will be used to migrate "git-bisect.sh" to C.

We start by implementing only the "--next-vars" option that will
read bisect refs from "refs/bisect/", and then compute the next
bisect step, and output shell variables ready to be eval'ed by
the shell.

At this step, "git bisect--helper" ignores the paths that may
have been put in "$GIT_DIR/BISECT_NAMES". This will be fixed in a
later patch.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-05 01:29:44 -07:00
Shawn O. Pearce 1ad6d46235 Merge branch 'jc/alternate-push'
* jc/alternate-push:
  push: receiver end advertises refs from alternate repositories
  push: prepare sender to receive extended ref information from the receiver
  receive-pack: make it a builtin
  is_directory(): a generic helper function
2008-09-25 09:39:24 -07:00
Miklos Vajna ee20a129de commit_tree(): add a new author parameter
In case it's NULL, it is still determined automatically, but now you
have the ability to specify one yourself.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-09-10 15:25:46 -07:00
Junio C Hamano be5908aed3 receive-pack: make it a builtin
It is a good thing to do in general, but more importantly, transport
routines can only be used by built-ins, which is what I'll be adding next.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-09-09 09:27:45 -07:00
Johannes Schindelin 8af84dadb1 git wrapper: DWIM mistyped commands
This patch introduces a modified Damerau-Levenshtein algorithm into
Git's code base, and uses it with the following penalties to show some
similar commands when an unknown command was encountered:

	swap = 0, insertion = 1, substitution = 2, deletion = 4

A typical output would now look like this:

	$ git sm
	git: 'sm' is not a git-command. See 'git --help'.

	Did you mean one of these?
		am
		rm

The cut-off is at similarity rating 6, which was empirically determined
to give sensible results.

As a convenience, if there is only one candidate, Git continues under
the assumption that the user mistyped it.  Example:

	$ git reabse
	WARNING: You called a Git program named 'reabse', which does
	not exist.
	Continuing under the assumption that you meant 'rebase'
	[...]

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-31 10:14:58 -07:00
Junio C Hamano 1e7abc593d Revert "Build-in "git-shell""
This reverts commit daa0cc9a92.
It was a stupid idea to do this; when run as a log-in shell,
it is spawned with argv[0] set to "-git-shell", so the usual
name-based dispatch would not work to begin with.
2008-08-25 22:39:17 -07:00
Junio C Hamano daa0cc9a92 Build-in "git-shell"
This trivially makes "git-shell" a built-in.  It makes the executable even
fatter, though.

And MinGW removed git-shell only because of the funny dependencies; there
is no reason to do so anymore.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Tested-on-MinGW-by: Johannes Sixt <johannes.sixt@telecom.at>
2008-08-20 01:36:10 -07:00
Alex Riesen 8f0359f0a6 Allow pager of diff command be enabled/disabled
See for example, status and show commands. Besides,
Documentation/RelNotes-1.6.0.txt mentions that pager.<cmd>
can be used to enable/disable paging behavior per command.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-23 11:14:47 -07:00
Miklos Vajna 1c7b76be7d Build in merge
Mentored-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-07 17:50:01 -07:00
Miklos Vajna 7b9c0a69a5 git-commit-tree: make it usable from other builtins
Move all functionality (except option parsing) from cmd_commit_tree() to
commit_tree(), so that other builtins can use it without a child
process.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-06 19:23:00 -07:00
Miklos Vajna 0b9a969e0f git-fmt-merge-msg: make it usable from other builtins
Move all functionality (except config and option parsing) from
cmd_fmt_merge_msg() to fmt_merge_msg(), so that other builtins can use
it without a child process.

All functions have been changed to use strbufs, and now only
cmd_fmt_merge_msg() reads directly from a file / writes anything to
stdout.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-30 22:45:51 -07:00
Teemu Likonen b7d9681974 Print info about "git help COMMAND" on git's main usage pages
Git's main usage pages did not show "git help" as a way to get more
information on a specific subcommand. This patch adds an info line after
the list of git commands currently printed by "git", "git help", "git
--help" and "git help --all".

Signed-off-by: Teemu Likonen <tlikonen@iki.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-06 09:22:18 -07:00