Commit graph

489 commits

Author SHA1 Message Date
Jonathan Nieder 60a2e3320f remote-ext: do not segfault for blank lines
Instead of stripping space characters past the beginning of the
line and overflowing a buffer, stop at the beginning of the line
(mimicking the corresponding fix in remote-fd).

The argument to isspace does not need to be cast explicitly because
git isspace takes care of that already.

Noticed-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-01-18 10:18:25 -08:00
Junio C Hamano d2f15e29a6 Merge branch 'maint'
* maint:
  commit: suggest --amend --reset-author to fix commiter identity
2011-01-12 21:26:51 -08:00
Matthieu Moy 3f14246899 commit: suggest --amend --reset-author to fix commiter identity
Since the message advises to fix the configuration first, the
advantage of using this command is that it is cut-and-paste ready,
while using --author='...' requires the user to type his name and
email again.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-01-12 12:43:58 -08:00
Junio C Hamano f3bb8b4b84 Merge branch 'nd/setup'
* nd/setup: (47 commits)
  setup_work_tree: adjust relative $GIT_WORK_TREE after moving cwd
  git.txt: correct where --work-tree path is relative to
  Revert "Documentation: always respect core.worktree if set"
  t0001: test git init when run via an alias
  Remove all logic from get_git_work_tree()
  setup: rework setup_explicit_git_dir()
  setup: clean up setup_discovered_git_dir()
  t1020-subdirectory: test alias expansion in a subdirectory
  setup: clean up setup_bare_git_dir()
  setup: limit get_git_work_tree()'s to explicit setup case only
  Use git_config_early() instead of git_config() during repo setup
  Add git_config_early()
  git-rev-parse.txt: clarify --git-dir
  t1510: setup case #31
  t1510: setup case #30
  t1510: setup case #29
  t1510: setup case #28
  t1510: setup case #27
  t1510: setup case #26
  t1510: setup case #25
  ...
2010-12-28 11:26:55 -08:00
Junio C Hamano 3ea3860758 Merge branch 'jk/commit-die-on-bogus-ident'
* jk/commit-die-on-bogus-ident:
  commit: die before asking to edit the log message
  ident: die on bogus date format

Conflicts:
	builtin/commit.c
2010-12-22 14:41:14 -08:00
Junio C Hamano 716958c9a2 Merge branch 'tf/commit-list-prefix'
* tf/commit-list-prefix:
  commit: Add commit_list prefix in two function names.

Conflicts:
	sha1_name.c
2010-12-22 14:40:17 -08:00
Nguyễn Thái Ngọc Duy 835183603b Remove all logic from get_git_work_tree()
This logic is now only used by cmd_init_db(). setup_* functions do not
rely on it any more. Move all the logic to cmd_init_db() and turn
get_git_work_tree() into a simple function.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-22 14:34:24 -08:00
Nguyễn Thái Ngọc Duy e6aea2dba2 setup: limit get_git_work_tree()'s to explicit setup case only
get_git_work_tree() takes input as core.worktree, core.bare,
GIT_WORK_TREE and decides correct worktree setting.

Unfortunately it does not do its job well. core.worktree and
GIT_WORK_TREE should only be taken into account, if GIT_DIR is set
(which is handled by setup_explicit_git_dir). For other setup cases,
only core.bare matters.

Add a temporary variable setup_explicit to adjust get_git_work_tree()
behavior as such. This variable will be gone once setup_* rework is
done.

Also remove is_bare_repository_cfg check in set_git_work_tree() to
ease the rework. We are going to check for core.bare and core.worktree
early before setting worktree. For example, if core.bare is true, no
need to set worktree.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-22 14:34:24 -08:00
Junio C Hamano 4c28e4ada0 commit: die before asking to edit the log message
When determine_author_info() returns to the calling prepare_to_commit(),
we already know the pieces of information necessary to determine what
author ident will be used in the final message, but deferred making a call
to fmt_ident() before the final commit_tree().  Most importantly, we would
open the editor to ask the user to compose the log message before it.

As one important side effect of fmt_ident() is to error out when the given
information is malformed, this resulted in us spawning the editor first
and then refusing to commit due to error, even though we had enough
information to detect the error before starting the editor, which was
annoying.

Move the fmt_ident() call to the end of determine_author_info() where we
have final determination of author info to rectify this.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-20 17:45:51 -08:00
Thiago Farina 834d9eb6b7 builtin/rm.c: Use ALLOC_GROW instead of alloc_nr and xrealloc.
Signed-off-by: Thiago Farina <tfransosi@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-19 10:44:06 -08:00
Thiago Farina fcbc0d8e82 builtin/branch.c: Use ALLOC_GROW instead of alloc_nr and xrealloc.
Signed-off-by: Thiago Farina <tfransosi@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-19 10:43:53 -08:00
Junio C Hamano 4bb4d30095 Merge branch 'jl/fetch-submodule-recursive'
* jl/fetch-submodule-recursive:
  fetch_populated_submodules(): document dynamic allocation
  Submodules: Add the "fetchRecurseSubmodules" config option
  Add the 'fetch.recurseSubmodules' config setting
  fetch/pull: Add the --recurse-submodules option

Conflicts:
	builtin/fetch.c
2010-12-16 12:57:15 -08:00
Junio C Hamano f68b780b25 Merge branch 'aa/status-hilite-branch'
* aa/status-hilite-branch:
  default color.status.branch to "same as header"
  status: show branchname with a configurable color
2010-12-16 12:50:03 -08:00
Junio C Hamano b932c3c1c1 Merge branch 'ak/describe-exact'
* ak/describe-exact:
  describe: Delay looking up commits until searching for an inexact match
  describe: Store commit_names in a hash table by commit SHA1
  describe: Do not use a flex array in struct commit_name
  describe: Use for_each_rawref
2010-12-16 12:49:59 -08:00
Junio C Hamano 6e67619d0c Merge branch 'jn/parse-options-extra'
* jn/parse-options-extra:
  update-index: migrate to parse-options API
  setup: save prefix (original cwd relative to toplevel) in startup_info
  parse-options: make resuming easier after PARSE_OPT_STOP_AT_NON_OPTION
  parse-options: allow git commands to invent new option types
  parse-options: never suppress arghelp if LITERAL_ARGHELP is set
  parse-options: do not infer PARSE_OPT_NOARG from option type
  parse-options: sanity check PARSE_OPT_NOARG flag
  parse-options: move NODASH sanity checks to parse_options_check
  parse-options: clearer reporting of API misuse
  parse-options: Don't call parse_options_check() so much
2010-12-12 21:49:53 -08:00
Junio C Hamano 33935dca6d Merge branch 'tc/format-patch-p'
* tc/format-patch-p:
  format-patch: page output with --stdout
2010-12-12 21:49:52 -08:00
Junio C Hamano 6758af89e4 Merge branch 'jn/git-cmd-h-bypass-setup'
* jn/git-cmd-h-bypass-setup:
  update-index -h: show usage even with corrupt index
  merge -h: show usage even with corrupt index
  ls-files -h: show usage even with corrupt index
  gc -h: show usage even with broken configuration
  commit/status -h: show usage even with broken configuration
  checkout-index -h: show usage even in an invalid repository
  branch -h: show usage even in an invalid repository

Conflicts:
	builtin/merge.c
2010-12-12 21:49:50 -08:00
Junio C Hamano aa78384156 Merge branch 'mg/maint-tag-rfc1991' into maint
* mg/maint-tag-rfc1991:
  tag: recognize rfc1991 signatures
  tag: factor out sig detection for tag display
  tag: factor out sig detection for body edits
  verify-tag: factor out signature detection
  t/t7004-tag: test handling of rfc1991 signatures
2010-12-10 16:13:03 -08:00
Junio C Hamano b361888dd5 thread-utils.h: simplify the inclusion
All files that include this header file use the same four line
incantation:

    #ifndef NO_PTHREADS
    #include <pthread.h>
    #include "thread-utils.h"
    #endif

Move the responsibility for that gymnastics to the header file from the
files that include it.  This approach makes it easier to later declare new
services that are related to threading in thread-utils.h and have them
available to all the threading code.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-10 12:58:06 -08:00
Anders Kaseorg d1645d02de describe: Delay looking up commits until searching for an inexact match
Now that struct commit.util is not used until after we've checked that
the argument doesn't exactly match a tag, we can wait until then to
look up the commits for each tag.

This avoids a lot of I/O on --exact-match queries in repositories with
many tags.  For example, 'git describe --exact-match HEAD' becomes
about 12 times faster on a cold cache (3.2s instead of 39s) in a
linux-2.6 repository with 2000 packed tags.  That is a huge win for the
interactivity of the __git_ps1 shell prompt helper when on a detached
HEAD.

Signed-off-by: Anders Kaseorg <andersk@ksplice.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-09 11:20:26 -08:00
Anders Kaseorg 3cfa4db322 describe: Store commit_names in a hash table by commit SHA1
describe is currently forced to look up the commit at each tag in
order to store the struct commit_name pointers in struct commit.util.
For --exact-match queries, those lookups are wasteful.  In preparation
for removing them, put the commit_names into a hash table, indexed by
commit SHA1, that can be used to quickly check for exact matches.

Signed-off-by: Anders Kaseorg <andersk@ksplice.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-09 11:20:26 -08:00
Anders Kaseorg 1e1ade1833 describe: Do not use a flex array in struct commit_name
Now add_to_known_names overwrites commit_names in place when multiple
tags point to the same commit.  This will make it easier to store
commit_names in a hash table.

Signed-off-by: Anders Kaseorg <andersk@ksplice.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-09 11:20:25 -08:00
Anders Kaseorg 56a5f3afa7 describe: Use for_each_rawref
Don't waste time checking for dangling refs; they wouldn't affect the
output of 'git describe' anyway.  Although this does not gain much
performance by itself, it does in conjunction with the next commits.

Signed-off-by: Anders Kaseorg <andersk@ksplice.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-09 11:20:25 -08:00
Junio C Hamano 6aa6a92fb6 Merge branch 'jn/cherry-pick-refresh-index' into maint
* jn/cherry-pick-refresh-index:
  cherry-pick/revert: transparently refresh index
2010-12-09 10:36:51 -08:00
Junio C Hamano a59c87265b Merge branch 'fc/apply-p2-get-header-name' into maint
* fc/apply-p2-get-header-name:
  test: git-apply -p2 rename/chmod only
  Fix git-apply with -p greater than 1
2010-12-09 10:36:36 -08:00
Junio C Hamano 5605685a71 Merge branch 'np/pack-broken-boundary' into maint
* np/pack-broken-boundary:
  make pack-objects a bit more resilient to repo corruption
2010-12-09 10:36:23 -08:00
Junio C Hamano ded4dfd519 Merge branch 'ak/apply-non-git-epoch' into maint
* ak/apply-non-git-epoch:
  apply: handle patches with funny filename and colon in timezone
  apply: Recognize epoch timestamps with : in the timezone
2010-12-09 10:36:16 -08:00
Junio C Hamano f80b6de4ec Merge branch 'nd/maint-fix-add-typo-detection' (early part)
* 'nd/maint-fix-add-typo-detection' (early part):
  add: do not rely on dtype being NULL behavior
2010-12-08 11:25:52 -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 a5066a0b07 Merge branch 'mg/maint-tag-rfc1991'
* mg/maint-tag-rfc1991:
  tag: recognize rfc1991 signatures
  tag: factor out sig detection for tag display
  tag: factor out sig detection for body edits
  verify-tag: factor out signature detection
  t/t7004-tag: test handling of rfc1991 signatures
2010-12-08 11:24:13 -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
Jonathan Nieder 309be813c9 update-index: migrate to parse-options API
--refresh and --really-refresh accept flags (like -q) and modify
an error indicator.  It might make sense to make the error
indicator global, but just pass the flags and a pointer to the error
indicator in a struct instead.

--cacheinfo wants 3 arguments.  Use the OPTION_LOWLEVEL_CALLBACK
extension to grab them and PARSE_OPT_NOARG to disallow the "sticked"
--cacheinfo=foo form.  (The resulting message

	$ git update-index --cacheinfo=foo
	error: option `cacheinfo' takes no value

is unfortunately incorrect.)

--assume-unchanged and --no-assume-unchanged probably should use the
OPT_UYN feature; but use a callback for now so the existing MARK_FLAG
and UNMARK_FLAG values can be used.

--stdin and --index-info are still constrained to be the last argument
(implemented using the OPTION_LOWLEVEL_CALLBACK extension).

--unresolve and --again consume all arguments that come after them
(also using OPTION_LOWLEVEL_CALLBACK).

The order of options matters.  Each path on the command line is
affected only by the options that come before it.  A custom
argument-parsing loop with parse_options_step() brings that about.

In exchange for all the fuss, we get the usual perks: support for
un-sticked options, better usage error messages, more useful -h
output, and argument parsing code that should be easier to tweak
in the future.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-07 14:19:32 -08:00
Stephen Boyd 9ca1169fd9 parse-options: Don't call parse_options_check() so much
parse_options_check() is being called for each invocation of
parse_options_step which can be quite a bit for some commands. The
commit introducing this function cb9d398 (parse-options: add
parse_options_check to validate option specs., 2009-06-09) had the
correct motivation and explicitly states that parse_options_check()
should be called from parse_options_start(). However, the implementation
differs from the motivation. Fix it.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-06 16:51:36 -08:00
Junio C Hamano 39f04dbaac Merge branch 'jn/thinner-wrapper'
* jn/thinner-wrapper:
  Remove pack file handling dependency from wrapper.o
  pack-objects: mark file-local variable static
  wrapper: give zlib wrappers their own translation unit
  strbuf: move strbuf_branchname to sha1_name.c
  path helpers: move git_mkstemp* to wrapper.c
  wrapper: move odb_* to environment.c
  wrapper: move xmmap() to sha1_file.c
2010-12-03 16:13:06 -08:00
Junio C Hamano 9bec60d3a5 Merge branch 'pn/commit-autosquash'
* pn/commit-autosquash:
  add tests of commit --squash
  commit: --squash option for use with rebase --autosquash
  add tests of commit --fixup
  commit: --fixup option for use with rebase --autosquash
  pretty.c: teach format_commit_message() to reencode the output
  commit: helper methods to reduce redundant blocks of code

Conflicts:
	Documentation/git-commit.txt
	t/t3415-rebase-autosquash.sh
2010-12-03 16:13:06 -08:00
Junio C Hamano 45a7b55d6f Merge branch 'sn/diff-doc'
* sn/diff-doc:
  docs: clarify git diff modes of operation
  diff,difftool: Don't use the {0,2} notation in usage strings
  CodingGuidelines: Add a section on writing documentation
2010-12-03 16:10:36 -08:00
Junio C Hamano 47f16e8b11 Merge branch 'cb/maint-orphan-merge-noclobber' into maint
* cb/maint-orphan-merge-noclobber:
  do not overwrite untracked during merge from unborn branch
2010-12-02 11:27:13 -08:00
Junio C Hamano a49e9af493 Merge branch 'tr/maint-merge-file-subdir' into maint
* tr/maint-merge-file-subdir:
  merge-file: correctly find files when called in subdir
  prefix_filename(): safely handle the case where pfx_len=0
2010-12-02 11:26:40 -08:00
Junio C Hamano 9f6774ed86 Merge branch 'ks/no-textconv-symlink' into maint
* 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-12-02 11:26:24 -08:00
Junio C Hamano 94fdb6f6eb Merge branch 'maint'
* maint:
  add: introduce add.ignoreerrors synonym for add.ignore-errors
  bash: Match lightweight tags in prompt
  git-commit.txt: (synopsis): move -i and -o before "--"
2010-12-01 16:41:13 -08:00
Junio C Hamano 5501bf854c Merge branch 'maint-1.7.2' into maint
* maint-1.7.2:
  add: introduce add.ignoreerrors synonym for add.ignore-errors
  bash: Match lightweight tags in prompt
  git-commit.txt: (synopsis): move -i and -o before "--"
2010-12-01 16:40:26 -08:00
Junio C Hamano 2de132f884 Merge branch 'maint-1.7.1' into maint-1.7.2
* maint-1.7.1:
  add: introduce add.ignoreerrors synonym for add.ignore-errors
2010-12-01 16:40:20 -08:00
Junio C Hamano e760924cbe Merge branch 'maint-1.7.0' into maint-1.7.1
* maint-1.7.0:
  add: introduce add.ignoreerrors synonym for add.ignore-errors
2010-12-01 16:37:34 -08:00
Junio C Hamano 106e3afa6f Merge branch 'jl/clone-recurse-sm-synonym'
* jl/clone-recurse-sm-synonym:
  clone: Add the --recurse-submodules option as alias for --recursive
2010-11-29 17:52:34 -08:00
Junio C Hamano 5eee142c89 Merge branch 'jn/cherry-pick-refresh-index'
* jn/cherry-pick-refresh-index:
  cherry-pick/revert: transparently refresh index
2010-11-29 17:52:34 -08:00
Junio C Hamano 09efc4510d Merge branch 'np/pack-broken-boundary'
* np/pack-broken-boundary:
  make pack-objects a bit more resilient to repo corruption
2010-11-29 17:52:33 -08:00
Junio C Hamano f3f973a017 Merge branch 'fc/apply-p2-get-header-name'
* fc/apply-p2-get-header-name:
  test: git-apply -p2 rename/chmod only
  Fix git-apply with -p greater than 1
2010-11-29 17:52:33 -08:00
Junio C Hamano 4ef927a995 Merge branch 'kb/blame-author-email'
* kb/blame-author-email:
  blame: Add option to show author email instead of name

Conflicts:
	t/annotate-tests.sh
2010-11-29 17:52:32 -08:00
Junio C Hamano f565f6e065 Merge branch 'ak/apply-non-git-epoch'
* ak/apply-non-git-epoch:
  apply: handle patches with funny filename and colon in timezone
  apply: Recognize epoch timestamps with : in the timezone
2010-11-29 17:52:31 -08:00
Aleksi Aalto 1d282327d7 status: show branchname with a configurable color
You can tell "git status" to paint the name of the current branch in its
output (the line that says "On branch ...") by setting the configuration
variable color.status.branch; it is by default turned off.

Signed-off-by: Aleksi Aalto <aga@iki.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-29 16:31:34 -08:00