Commit graph

21212 commits

Author SHA1 Message Date
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
Linus Torvalds a5031214c4 slim down "git show-index"
As the documentation says, this is primarily for debugging, and
in the longer term we should rename it to test-show-index or something.

In the meantime, just avoid xmalloc (which slurps in the rest of git), and
separating out the trivial hex functions into "hex.o".

This results in

  [torvalds@nehalem git]$ size git-show-index
       text    data     bss     dec     hex filename
     222818    2276  112688  337782   52776 git-show-index (before)
       5696     624    1264    7584    1da0 git-show-index (after)

which is a whole lot better.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-21 20:03:45 -08:00
Linus Torvalds fb7d3f32b2 Remove diff machinery dependency from read-cache
Exal Sibeaz pointed out that some git files are way too big, and that
add_files_to_cache() brings in all the diff machinery to any git binary
that needs the basic git SHA1 object operations from read-cache.c. Which
is pretty much all of them.

It's doubly silly, since add_files_to_cache() is only used by builtin
programs (add, checkout and commit), so it's fairly easily fixed by just
moving the thing to builtin-add.c, and avoiding the dependency entirely.

I initially argued to Exal that it would probably be best to try to depend
on smart compilers and linkers, but after spending some time trying to
make -ffunction-sections work and giving up, I think Exal was right, and
the fix is to just do some trivial cleanups like this.

This trivial cleanup results in pretty stunning file size differences.
The diff machinery really is mostly used by just the builtin programs, and
you have things like these trivial before-and-after numbers:

  -rwxr-xr-x 1 torvalds torvalds 1727420 2010-01-21 10:53 git-hash-object
  -rwxrwxr-x 1 torvalds torvalds  940265 2010-01-21 11:16 git-hash-object

Now, I'm not saying that 940kB is good either, but that's mostly all the
debug information - you can see the real code with 'size':

   text	   data	    bss	    dec	    hex	filename
 418675	   3920	 127408	 550003	  86473	git-hash-object (before)
 230650	   2288	 111728	 344666	  5425a	git-hash-object (after)

ie we have a nice 24% size reduction from this trivial cleanup.

It's not just that one file either. I get:

	[torvalds@nehalem git]$ du -s /home/torvalds/libexec/git-core
	45640	/home/torvalds/libexec/git-core (before)
	33508	/home/torvalds/libexec/git-core (after)

so we're talking 12MB of diskspace here.

(Of course, stripping all the binaries brings the 33MB down to 9MB, so the
whole debug information thing is still the bulk of it all, but that's a
separate issue entirely)

Now, I'm sure there are other things we should do, and changing our
compiler flags from -O2 to -Os would bring the text size down by an
additional almost 20%, but this thing Exal pointed out seems to be some
good low-hanging fruit.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-21 17:05:13 -08:00
Junio C Hamano 19c6a4f836 merge-recursive: do not return NULL only to cause segfault
merge-recursive calls write_tree_from_memory() to come up with a virtual
tree, with possible conflict markers inside the blob contents, while
merging multiple common ancestors down.  It is a bug to call the function
with unmerged entries in the index, even if the merge to come up with the
common ancestor resulted in conflicts.  Otherwise the result won't be
expressible as a tree object.

We _might_ want to suggest the user to set GIT_MERGE_VERBOSITY to 5 and
re-run the merge in the message.  At least we will know which part of
process_renames() or process_entry() functions is not correctly handling
the unmerged paths, and it might help us diagnosing the issue.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-21 17:02:30 -08:00
Horst H. von Brand 42cfcd20a7 git-rebase.txt: Fix spelling
Signed-off-by: Horst H. von Brand <vonbrand@inf.utfsm.cl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-21 15:02:45 -08:00
Tay Ray Chuan 703e6e76a1 retry request without query when info/refs?query fails
When "info/refs" is a static file and not behind a CGI handler, some
servers may not handle a GET request for it with a query string
appended (eg. "?foo=bar") properly.

If such a request fails, retry it sans the query string. In addition,
ensure that the "smart" http protocol is not used (a service has to be
specified with "?service=<service name>" to be conformant).

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Reported-and-tested-by: Yaroslav Halchenko <debian@onerussian.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-21 15:01:37 -08:00
Junio C Hamano 7dccadf363 Fix "log --oneline" not to show notes
This option should be treated pretty much the same as --format="%h %s".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-21 14:57:41 -08:00
Johannes Sixt 5a9f039529 Make 'rerere forget' work from a subdirectory.
It forgot to apply the prefix to the paths given on the command line.

[jc: added test]

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-21 00:42:20 -08:00
Johannes Sixt 28414b6b3a Make test case numbers unique
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-21 00:01:00 -08:00
Junio C Hamano 4c734803cb conflict-marker-size: add test and docs
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-20 23:49:27 -08:00
Junio C Hamano 2eb41d7200 Update draft release notes to 1.7.0
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-20 23:30:45 -08:00
Junio C Hamano d4556c49ee Merge branch 'bw/cvsimport'
* bw/cvsimport:
  cvsimport: standarize system() calls to external git tools
  cvsimport: standarize open() calls to external git tools
  cvsimport: modernize callouts to git subcommands
2010-01-20 20:28:51 -08:00
Junio C Hamano b3ce9a0874 Merge branch 'jc/checkout-merge-base'
* jc/checkout-merge-base:
  Fix "checkout A..." synonym for "checkout A...HEAD" on Windows
2010-01-20 20:28:51 -08:00
Junio C Hamano 41905647fc Merge branch 'ag/patch-header-verify'
* ag/patch-header-verify:
  builtin-apply.c: fix the --- and +++ header filename consistency check
2010-01-20 20:28:51 -08:00
Junio C Hamano 06dbc1ea57 Merge branch 'jc/conflict-marker-size'
* jc/conflict-marker-size:
  rerere: honor conflict-marker-size attribute
  rerere: prepare for customizable conflict marker length
  conflict-marker-size: new attribute
  rerere: use ll_merge() instead of using xdl_merge()
  merge-tree: use ll_merge() not xdl_merge()
  xdl_merge(): allow passing down marker_size in xmparam_t
  xdl_merge(): introduce xmparam_t for merge specific parameters
  git_attr(): fix function signature

Conflicts:
	builtin-merge-file.c
	ll-merge.c
	xdiff/xdiff.h
	xdiff/xmerge.c
2010-01-20 20:28:51 -08:00
Junio C Hamano df91d0e4d3 Merge branch 'ag/maint-apply-too-large-p'
* ag/maint-apply-too-large-p:
  builtin-apply.c: Skip filenames without enough components
2010-01-20 20:28:50 -08:00
Junio C Hamano fcb2a7e4a3 Merge branch 'ap/merge-backend-opts'
* ap/merge-backend-opts:
  Document that merge strategies can now take their own options
  Extend merge-subtree tests to test -Xsubtree=dir.
  Make "subtree" part more orthogonal to the rest of merge-recursive.
  pull: Fix parsing of -X<option>
  Teach git-pull to pass -X<option> to git-merge
  git merge -X<option>
  git-merge-file --ours, --theirs

Conflicts:
	git-compat-util.h
2010-01-20 20:28:50 -08:00
Junio C Hamano e98f80f50b Merge branch 'nd/status-partial-refresh'
* nd/status-partial-refresh:
  rm: only refresh entries that we may touch
  status: only touch path we may need to check
2010-01-20 20:28:50 -08:00
Junio C Hamano add0951ab0 Merge remote branch 'remotes/trast-doc/for-next'
* remotes/trast-doc/for-next:
  Documentation: spell 'git cmd' without dash throughout
  Documentation: format full commands in typewriter font
  Documentation: warn prominently against merging with dirty trees
  Documentation/git-merge: reword references to "remote" and "pull"

Conflicts:
	Documentation/config.txt
	Documentation/git-config.txt
	Documentation/git-merge.txt
2010-01-20 20:28:49 -08:00
Junio C Hamano 5fc9df08b5 Merge branch 'jh/notes' (early part)
* 'jh/notes' (early part):
  Add more testcases to test fast-import of notes
  Rename t9301 to t9350, to make room for more fast-import tests
  fast-import: Proper notes tree manipulation
2010-01-20 20:28:49 -08:00
Junio C Hamano 9ca8f83411 Merge branch 'maint'
* maint:
  status: don't require the repository to be writable

Conflicts:
	builtin-commit.c
2010-01-20 20:28:39 -08:00
Junio C Hamano 8f376a50ec Merge branch 'jc/maint-refresh-index-is-optional-for-status' into maint
* jc/maint-refresh-index-is-optional-for-status:
  status: don't require the repository to be writable
2010-01-20 20:25:11 -08:00
Nguyễn Thái Ngọc Duy 45d76f1718 Fix memory corruption when .gitignore does not end by \n
Commit b5041c5 (Avoid writing to buffer in add_excludes_from_file_1())
tried not to append '\n' at the end because the next commit
may return a buffer that does not have extra space for that.

Unfortunately it left this assignment in the loop:

  buf[i - (i && buf[i-1] == '\r')] = 0;

that can corrupt memory if "buf" is not '\n' terminated. But even if
it does not corrupt memory, the last line would not be
NULL-terminated, leading to errors later inside add_exclude().

This patch fixes it by reverting the faulty commit and make
sure "buf" is always \n terminated.

While at it, free unused memory properly.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-20 20:01:52 -08:00
Junio C Hamano 66b2ed09c2 Fix "log" family not to be too agressive about showing notes
Giving "Notes" information in the default output format of "log" and
"show" is a sensible progress (the user has asked for it by having the
notes), but for some commands (e.g. "format-patch") spewing notes into the
formatted commit log message without being asked is too aggressive.

Enable notes output only for "log", "show", "whatchanged" by default and
only when the user didn't ask any specific --pretty/--format from the
command line; users can explicitly override this default with --show-notes
and --no-notes option.

Parts of tests are taken from Jeff King's fix.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-20 19:57:02 -08:00
Junio C Hamano 19c61a58cf Merge branch 'rr/core-tutorial'
* rr/core-tutorial:
  Documentation: Update git core tutorial clarifying reference to scripts
2010-01-20 15:24:42 -08:00
Junio C Hamano 6751e0471d Merge branch 'jc/cache-unmerge'
* jc/cache-unmerge:
  rerere forget path: forget recorded resolution
  rerere: refactor rerere logic to make it independent from I/O
  rerere: remove silly 1024-byte line limit
  resolve-undo: teach "update-index --unresolve" to use resolve-undo info
  resolve-undo: "checkout -m path" uses resolve-undo information
  resolve-undo: allow plumbing to clear the information
  resolve-undo: basic tests
  resolve-undo: record resolved conflicts in a new index extension section
  builtin-merge.c: use standard active_cache macros

Conflicts:
	builtin-ls-files.c
	builtin-merge.c
	builtin-rerere.c
2010-01-20 14:46:35 -08:00
Junio C Hamano 030b1a77f7 Merge branch 'js/exec-error-report'
* js/exec-error-report:
  Improve error message when a transport helper was not found
  start_command: detect execvp failures early
  run-command: move wait_or_whine earlier
  start_command: report child process setup errors to the parent's stderr

Conflicts:
	Makefile
2010-01-20 14:44:12 -08:00
Junio C Hamano 3af59e6f31 Merge branch 'jc/ls-files-ignored-pathspec'
* jc/ls-files-ignored-pathspec:
  ls-files: fix overeager pathspec optimization
  read_directory(): further split treat_path()
  read_directory_recursive(): refactor handling of a single path into a separate function
  t3001: test ls-files -o ignored/dir
2010-01-20 14:43:54 -08:00
Junio C Hamano 34349bea60 Merge branch 'jc/grep-lookahead'
* jc/grep-lookahead:
  grep --no-index: allow use of "git grep" outside a git repository
  grep: prepare to run outside of a work tree
  grep: rip out pessimization to use fixmatch()
  grep: rip out support for external grep
  grep: optimize built-in grep by skipping lines that do not hit

Conflicts:
	builtin-grep.c
	t/t7002-grep.sh
2010-01-20 14:43:41 -08:00
Junio C Hamano 886932e281 Merge branch 'jc/maint-strbuf-add-fix-doubling'
* jc/maint-strbuf-add-fix-doubling:
  strbuf_addbuf(): allow passing the same buf to dst and src
2010-01-20 14:43:09 -08:00
Junio C Hamano 71b3ef11fa Merge branch 'mm/conflict-advice'
* mm/conflict-advice:
  Be more user-friendly when refusing to do something because of conflict.

Conflicts:
	Documentation/config.txt
	advice.c
	advice.h
2010-01-20 14:42:59 -08:00
Junio C Hamano f922df8655 Merge branch 'da/difftool'
* da/difftool:
  difftool: Update copyright notices to list each year separately
  difftool: Use eval to expand '--extcmd' expressions
  difftool: Add '-x' and as an alias for '--extcmd'
  t7800-difftool.sh: Simplify the --extcmd test
  git-diff.txt: Link to git-difftool
  difftool: Allow specifying unconfigured commands with --extcmd
  difftool--helper: Remove use of the GIT_MERGE_TOOL variable
  difftool--helper: Update copyright and remove distracting comments
  git-difftool: Add '--gui' for selecting a GUI tool
  t7800-difftool: Set a bogus tool for use by tests
2010-01-20 14:42:20 -08:00
Junio C Hamano 668993ff19 Merge branch 'mh/rebase-fixup'
* mh/rebase-fixup:
  rebase -i: Retain user-edited commit messages after squash/fixup conflicts
  t3404: Set up more of the test repo in the "setup" step
  rebase -i: For fixup commands without squashes, do not start editor
  rebase -i: Change function make_squash_message into update_squash_message
  rebase -i: Extract function do_with_author
  rebase -i: Handle the author script all in one place in do_next
  rebase -i: Extract a function "commit_message"
  rebase -i: Simplify commit counting for generated commit messages
  rebase -i: Improve consistency of commit count in generated commit messages
  t3404: Test the commit count in commit messages generated by "rebase -i"
  rebase -i: Introduce a constant AMEND
  rebase -i: Introduce a constant AUTHOR_SCRIPT
  rebase -i: Document how temporary files are used
  rebase -i: Use symbolic constant $MSG consistently
  rebase -i: Use "test -n" instead of "test ! -z"
  rebase -i: Inline expression
  rebase -i: Remove dead code
  rebase -i: Make the condition for an "if" more transparent
2010-01-20 14:42:07 -08:00
Junio C Hamano cea20f2473 Merge branch 'ns/rebase-auto-squash'
* ns/rebase-auto-squash:
  rebase -i --autosquash: auto-squash commits

Conflicts:
	git-rebase--interactive.sh
2010-01-20 14:42:04 -08:00
Junio C Hamano cc6b41cc7d Merge branch 'mh/rebase-fixup' (early part)
* 'mh/rebase-fixup' (early part):
  rebase-i: Ignore comments and blank lines in peek_next_command
  lib-rebase: Allow comments and blank lines to be added to the rebase script
  lib-rebase: Provide clearer debugging info about what the editor did
  Add a command "fixup" to rebase --interactive
  t3404: Use test_commit to set up test repository
2010-01-20 14:41:48 -08:00
Junio C Hamano 533e8af50e Merge branch 'il/push-set-upstream'
* il/push-set-upstream:
  Add push --set-upstream

Conflicts:
	transport.c
2010-01-20 14:40:48 -08:00
Junio C Hamano 0877510ad4 Merge branch 'jk/warn-author-committer-after-commit'
* jk/warn-author-committer-after-commit:
  user_ident_sufficiently_given(): refactor the logic to be usable from elsewhere
  commit.c::print_summary: do not release the format string too early
  commit: allow suppression of implicit identity advice
  commit: show interesting ident information in summary
  strbuf: add strbuf_addbuf_percentquote
  strbuf_expand: convert "%%" to "%"

Conflicts:
	builtin-commit.c
	ident.c
2010-01-20 14:40:12 -08:00
Junio C Hamano 15a873d6e8 Merge branch 'jc/ident'
* jc/ident:
  ident.c: replace fprintf with fputs to suppress compiler warning
  user_ident_sufficiently_given(): refactor the logic to be usable from elsewhere
  ident.c: treat $EMAIL as giving user.email identity explicitly
  ident.c: check explicit identity for name and email separately
  ident.c: remove unused variables
2010-01-20 14:39:52 -08:00
Junio C Hamano 07301eaa76 Merge branch 'tr/http-push-ref-status'
* tr/http-push-ref-status:
  transport-helper.c::push_refs(): emit "no refs" error message
  transport-helper.c::push_refs(): ignore helper-reported status if ref is not to be pushed
  transport.c::transport_push(): make ref status affect return value
  refactor ref status logic for pushing
  t5541-http-push.sh: add test for unmatched, non-fast-forwarded refs
  t5541-http-push.sh: add tests for non-fast-forward pushes

Conflicts:
	transport-helper.c
2010-01-20 14:39:48 -08:00
Junio C Hamano bd0d1916de Merge branch 'bk/fix-relative-gitdir-file'
* bk/fix-relative-gitdir-file:
  Handle relative paths in submodule .git files
  Test update-index for a gitlink to a .git file
2010-01-20 14:38:34 -08:00
Junio C Hamano c757c52f63 Merge branch 'sd/cd-p-show-toplevel'
* sd/cd-p-show-toplevel:
  Use $(git rev-parse --show-toplevel) in cd_to_toplevel().
  Add 'git rev-parse --show-toplevel' option.
2010-01-20 14:38:30 -08:00
Junio C Hamano 56eb8b43eb Merge branch 'jc/symbol-static'
* jc/symbol-static:
  date.c: mark file-local function static
  Replace parse_blob() with an explanatory comment
  symlinks.c: remove unused functions
  object.c: remove unused functions
  strbuf.c: remove unused function
  sha1_file.c: remove unused function
  mailmap.c: remove unused function
  utf8.c: mark file-local function static
  submodule.c: mark file-local function static
  quote.c: mark file-local function static
  remote-curl.c: mark file-local function static
  read-cache.c: mark file-local functions static
  parse-options.c: mark file-local function static
  entry.c: mark file-local function static
  http.c: mark file-local functions static
  pretty.c: mark file-local function static
  builtin-rev-list.c: mark file-local function static
  bisect.c: mark file-local function static
2010-01-20 14:37:25 -08:00
Junio C Hamano 23418ea95f date.c: mark file-local function static
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-20 14:37:17 -08:00
Junio C Hamano c216830f38 Sync with 1.6.6.1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-20 14:01:41 -08:00
Junio C Hamano 9504f3d3d2 Git 1.6.6.1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-20 13:29:21 -08:00
Junio C Hamano 66276d972c Merge branch 'bg/maint-remote-update-default' into maint
* bg/maint-remote-update-default:
  Fix "git remote update" with remotes.defalt set
2010-01-20 13:23:59 -08:00
Junio C Hamano ce67b3eed8 Merge branch 'sb/maint-octopus' into maint
* sb/maint-octopus:
  octopus: remove dead code
  octopus: reenable fast-forward merges
  octopus: make merge process simpler to follow

Conflicts:
	git-merge-octopus.sh
2010-01-20 13:02:24 -08:00
Junio C Hamano cae7151e25 Merge branch 'bg/maint-add-all-doc' into maint
* bg/maint-add-all-doc:
  git-rm doc: Describe how to sync index & work tree
  git-add/rm doc: Consistently back-quote
  Documentation: 'git add -A' can remove files
2010-01-20 13:01:33 -08:00
Junio C Hamano f0b0d78489 Merge branch 'maint-1.6.5' into maint
* maint-1.6.5:
  Git 1.6.5.8
  Fix mis-backport of t7002
  bash completion: factor submodules into dirty state
  reset: unbreak hard resets with GIT_WORK_TREE

Conflicts:
	Documentation/git.txt
	GIT-VERSION-GEN
	RelNotes
2010-01-20 13:01:19 -08:00
Junio C Hamano 35eabd1579 Git 1.6.5.8
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-20 12:44:59 -08:00