]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
16 years agostrbuf_read_file enhancement, and use it.
Pierre Habouzit [Thu, 27 Sep 2007 13:25:55 +0000 (15:25 +0200)] 
strbuf_read_file enhancement, and use it.

* make strbuf_read_file take a size hint (works like strbuf_read)
* use it in a couple of places.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agostrbuf change: be sure ->buf is never ever NULL.
Pierre Habouzit [Thu, 27 Sep 2007 10:58:23 +0000 (12:58 +0200)] 
strbuf change: be sure ->buf is never ever NULL.

For that purpose, the ->buf is always initialized with a char * buf living
in the strbuf module. It is made a char * so that we can sloppily accept
things that perform: sb->buf[0] = '\0', and because you can't pass "" as an
initializer for ->buf without making gcc unhappy for very good reasons.

strbuf_init/_detach/_grow have been fixed to trust ->alloc and not ->buf
anymore.

as a consequence strbuf_detach is _mandatory_ to detach a buffer, copying
->buf isn't an option anymore, if ->buf is going to escape from the scope,
and eventually be free'd.

API changes:
  * strbuf_setlen now always works, so just make strbuf_reset a convenience
    macro.
  * strbuf_detatch takes a size_t* optional argument (meaning it can be
    NULL) to copy the buffer's len, as it was needed for this refactor to
    make the code more readable, and working like the callers.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agodouble free in builtin-update-index.c
Pierre Habouzit [Thu, 27 Sep 2007 10:51:18 +0000 (12:51 +0200)] 
double free in builtin-update-index.c

path_name is either ptr that should not be freed, or a pointer to a strbuf
buffer that is deallocated when exiting the loop. Don't do that !

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoClean up stripspace a bit, use strbuf even more.
Kristian Høgsberg [Tue, 18 Sep 2007 00:06:45 +0000 (20:06 -0400)] 
Clean up stripspace a bit, use strbuf even more.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoAdd strbuf_read_file().
Kristian Høgsberg [Tue, 18 Sep 2007 00:06:46 +0000 (20:06 -0400)] 
Add strbuf_read_file().

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agorerere: Fix use of an empty strbuf.buf
Junio C Hamano [Thu, 27 Sep 2007 06:34:01 +0000 (23:34 -0700)] 
rerere: Fix use of an empty strbuf.buf

The code incorrectly assumed that strbuf.buf is always an
allocated piece of memory that has NUL at offset strbuf.len.
That assumption does not hold for a freshly initialized empty
strbuf.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoSmall cache_tree_write refactor.
Pierre Habouzit [Tue, 25 Sep 2007 08:22:44 +0000 (10:22 +0200)] 
Small cache_tree_write refactor.

This function cannot fail, make it void. Also make write_one act on a
const char* instead of a char*.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMake builtin-rerere use of strbuf nicer and more efficient.
Pierre Habouzit [Mon, 24 Sep 2007 09:25:04 +0000 (11:25 +0200)] 
Make builtin-rerere use of strbuf nicer and more efficient.

memory is now reused across hunks.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoAdd strbuf_cmp.
Pierre Habouzit [Mon, 24 Sep 2007 09:25:03 +0000 (11:25 +0200)] 
Add strbuf_cmp.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agostrbuf_setlen(): do not barf on setting length of an empty buffer to 0
Junio C Hamano [Wed, 26 Sep 2007 09:26:06 +0000 (02:26 -0700)] 
strbuf_setlen(): do not barf on setting length of an empty buffer to 0

strbuf_setlen() expect to be able to NUL terminate the buffer,
but a completely empty strbuf could have an empty buffer with 0
allocation; both the assert() and the assignment for NUL
termination would fail.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agosq_quote_argv and add_to_string rework with strbuf's.
Pierre Habouzit [Wed, 19 Sep 2007 22:42:13 +0000 (00:42 +0200)] 
sq_quote_argv and add_to_string rework with strbuf's.

* sq_quote_buf is made public, and works on a strbuf.
* sq_quote_argv also works on a strbuf.
* make sq_quote_argv take a "maxlen" argument to check the buffer won't grow
  too big.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFull rework of quote_c_style and write_name_quoted.
Pierre Habouzit [Wed, 19 Sep 2007 22:42:15 +0000 (00:42 +0200)] 
Full rework of quote_c_style and write_name_quoted.

* quote_c_style works on a strbuf instead of a wild buffer.
* quote_c_style is now clever enough to not add double quotes if not needed.

* write_name_quoted inherits those advantages, but also take a different
  set of arguments. Now instead of asking for quotes or not, you pass a
  "terminator". If it's \0 then we assume you don't want to escape, else C
  escaping is performed. In any case, the terminator is also appended to the
  stream. It also no longer takes the prefix/prefix_len arguments, as it's
  seldomly used, and makes some optimizations harder.

* write_name_quotedpfx is created to work like write_name_quoted and take
  the prefix/prefix_len arguments.

Thanks to those API changes, diff.c has somehow lost weight, thanks to the
removal of functions that were wrappers around the old write_name_quoted
trying to give it a semantics like the new one, but performing a lot of
allocations for this goal. Now we always write directly to the stream, no
intermediate allocation is performed.

As a side effect of the refactor in builtin-apply.c, the length of the bar
graphs in diffstats are not affected anymore by the fact that the path was
clipped.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
16 years agoRework unquote_c_style to work on a strbuf.
Pierre Habouzit [Wed, 19 Sep 2007 22:42:14 +0000 (00:42 +0200)] 
Rework unquote_c_style to work on a strbuf.

If the gain is not obvious in the diffstat, the resulting code is more
readable, _and_ in checkout-index/update-index we now reuse the same buffer
to unquote strings instead of always freeing/mallocing.

This also is more coherent with the next patch that reworks quoting
functions.

The quoting function is also made more efficient scanning for backslashes
and treating portions of strings without a backslash at once.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
16 years agostrbuf API additions and enhancements.
Pierre Habouzit [Wed, 19 Sep 2007 22:42:12 +0000 (00:42 +0200)] 
strbuf API additions and enhancements.

Add strbuf_remove, change strbuf_insert:
  As both are special cases of strbuf_splice, implement them as such.
  gcc is able to do the math and generate almost optimal code this way.

Add strbuf_swap:
  Exchange the values of its arguments.
  Use it in fast-import.c

Also fix spacing issues in strbuf.h

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
16 years agonfv?asprintf are broken without va_copy, workaround them.
Pierre Habouzit [Thu, 20 Sep 2007 08:43:11 +0000 (10:43 +0200)] 
nfv?asprintf are broken without va_copy, workaround them.

* drop nfasprintf.
* move nfvasprintf into imap-send.c back, and let it work on a 8k buffer,
  and die() in case of overflow. It should be enough for imap commands, if
  someone cares about imap-send, he's welcomed to fix it properly.
* replace nfvasprintf use in merge-recursive with a copy of the strbuf_addf
  logic, it's one place, we'll live with it.
  To ease the change, output_buffer string list is replaced with a strbuf ;)
* rework trace.c to call vsnprintf itself.  It's used to format strerror()s
  and git command names, it should never be more than a few octets long, let
  it work on a 8k static buffer with vsnprintf or die loudly.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
16 years agoFix the expansion pattern of the pseudo-static path buffer.
Pierre Habouzit [Wed, 19 Sep 2007 22:42:10 +0000 (00:42 +0200)] 
Fix the expansion pattern of the pseudo-static path buffer.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
16 years agobuiltin-for-each-ref.c::copy_name() - do not overstep the buffer.
Junio C Hamano [Wed, 19 Sep 2007 08:52:59 +0000 (01:52 -0700)] 
builtin-for-each-ref.c::copy_name() - do not overstep the buffer.

This was introduced during xmemdupz() conversion.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agobuiltin-apply.c: fix a tiny leak introduced during xmemdupz() conversion.
Junio C Hamano [Wed, 19 Sep 2007 08:37:50 +0000 (01:37 -0700)] 
builtin-apply.c: fix a tiny leak introduced during xmemdupz() conversion.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoUse xmemdupz() in many places.
Pierre Habouzit [Sat, 15 Sep 2007 22:32:36 +0000 (00:32 +0200)] 
Use xmemdupz() in many places.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'master' into ph/strbuf
Junio C Hamano [Wed, 19 Sep 2007 00:42:15 +0000 (17:42 -0700)] 
Merge branch 'master' into ph/strbuf

* master: (94 commits)
  Fixed update-hook example allow-users format.
  Documentation/git-svn: updated design philosophy notes
  t/t4014: test "am -3" with mode-only change.
  git-commit.sh: Shell script cleanup
  preserve executable bits in zip archives
  Fix lapsus in builtin-apply.c
  git-push: documentation and tests for pushing only branches
  git-svnimport: Use separate arguments in the pipe for git-rev-parse
  contrib/fast-import: add perl version of simple example
  contrib/fast-import: add simple shell example
  rev-list --bisect: Bisection "distance" clean up.
  rev-list --bisect: Move some bisection code into best_bisection.
  rev-list --bisect: Move finding bisection into do_find_bisection.
  Document ls-files --with-tree=<tree-ish>
  git-commit: partial commit of paths only removed from the index
  git-commit: Allow partial commit of file removal.
  send-email: make message-id generation a bit more robust
  git-apply: fix whitespace stripping
  git-gui: Disable native platform text selection in "lists"
  apply --index-info: fall back to current index for mode changes
  ...

16 years agoMerge branch 'maint'
Junio C Hamano [Wed, 19 Sep 2007 00:39:25 +0000 (17:39 -0700)] 
Merge branch 'maint'

* maint:
  Fixed update-hook example allow-users format.
  Documentation/git-svn: updated design philosophy notes
  t/t4014: test "am -3" with mode-only change.
  Fix lapsus in builtin-apply.c
  git-push: documentation and tests for pushing only branches
  git-svnimport: Use separate arguments in the pipe for git-rev-parse

16 years agoFixed update-hook example allow-users format.
Väinö Järvelä [Tue, 18 Sep 2007 12:26:09 +0000 (15:26 +0300)] 
Fixed update-hook example allow-users format.

The example provided with the update-hook-example does not work on
either bash 2.05b.0(1)-release nor 3.1.17(1)-release. The matcher did
not match the lines that it advertised to match, such as:

refs/heads/bw/        linus
refs/heads/tmp/*      *

In POSIX 1003.2 regular expressions, the star (*), is not an wildcard
meaning "match everything", it matches 0 or more matches of the atom
preceding it.

So to match "refs/heads/bw/topic-branch", the matcher should be written
as "refs/heads/bw/.*" to match "refs/heads/bw/" and everything after it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDocumentation/git-svn: updated design philosophy notes
Eric Wong [Tue, 18 Sep 2007 23:50:42 +0000 (16:50 -0700)] 
Documentation/git-svn: updated design philosophy notes

This section has not been updated in a while and
--branches/--tags/--trunk options are commonly used nowadays.

Noticed-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agot/t4014: test "am -3" with mode-only change.
Junio C Hamano [Tue, 18 Sep 2007 22:19:47 +0000 (15:19 -0700)] 
t/t4014: test "am -3" with mode-only change.

Earlier commit ece7b74903007cee8d280573647243d46a6f3a95 added a test
for rebase that uses "am -3", but this adds a test to check "am -3"
itself.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-commit.sh: Shell script cleanup
David Kastrup [Mon, 17 Sep 2007 20:56:44 +0000 (22:56 +0200)] 
git-commit.sh: Shell script cleanup

This moves "shift" out of the argument processing "case".  It also
replaces quite a bit of expr calls with ${parameter#word} constructs,
and uses ${parameter:+word} for avoiding conditionals where possible.

Signed-off-by: David Kastrup <dak@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agopreserve executable bits in zip archives
Dmitry Potapov [Sun, 16 Sep 2007 17:07:38 +0000 (21:07 +0400)] 
preserve executable bits in zip archives

Correct `git-archive --format=zip' command to preserve executable bits in
zip archives.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFix lapsus in builtin-apply.c
Pierre Habouzit [Tue, 18 Sep 2007 10:12:58 +0000 (12:12 +0200)] 
Fix lapsus in builtin-apply.c

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-push: documentation and tests for pushing only branches
Jeff King [Tue, 18 Sep 2007 08:15:34 +0000 (04:15 -0400)] 
git-push: documentation and tests for pushing only branches

Commit 098e711e caused git-push to match only branches when
considering which refs to push. This patch updates the
documentation accordingly and adds a test for this behavior.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-svnimport: Use separate arguments in the pipe for git-rev-parse
Matthias Urlichs [Tue, 18 Sep 2007 09:29:09 +0000 (11:29 +0200)] 
git-svnimport: Use separate arguments in the pipe for git-rev-parse

Some people seem to create SVN branch names with spaces
or other shell metacharacters.

Signed-off-by: Matthias Urlichs <smurf@smurf.noris.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agocontrib/fast-import: add perl version of simple example
Jeff King [Tue, 18 Sep 2007 07:26:27 +0000 (03:26 -0400)] 
contrib/fast-import: add perl version of simple example

This is based on the git-import.sh script, but is a little
more robust and efficient. More importantly, it should
serve as a quick template for interfacing fast-import with
perl scripts.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agocontrib/fast-import: add simple shell example
Nguyen Thai Ngoc Duy [Tue, 18 Sep 2007 07:26:01 +0000 (03:26 -0400)] 
contrib/fast-import: add simple shell example

This example just puts a directory under git control. It is
significantly slower than using the git tools directly, but
hopefully shows a bit how fast-import works.

  [jk: added header comments]

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoAdd xmemdupz() that duplicates a block of memory, and NUL terminates it.
Pierre Habouzit [Sat, 15 Sep 2007 21:53:05 +0000 (23:53 +0200)] 
Add xmemdupz() that duplicates a block of memory, and NUL terminates it.

A lot of places in git's code use code like:

  char *res;

  len = ... find length of an interesting segment in src ...;
  res = xmalloc(len + 1);
  memcpy(res, src, len);
  res[len] = '\0';
  return res;

A new function xmemdupz() captures the allocation, copy and NUL
termination.  Existing xstrndup() is reimplemented in terms of
this new function.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agorev-list --bisect: Bisection "distance" clean up.
Christian Couder [Mon, 17 Sep 2007 03:28:36 +0000 (05:28 +0200)] 
rev-list --bisect: Bisection "distance" clean up.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agorev-list --bisect: Move some bisection code into best_bisection.
Christian Couder [Mon, 17 Sep 2007 03:28:29 +0000 (05:28 +0200)] 
rev-list --bisect: Move some bisection code into best_bisection.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agorev-list --bisect: Move finding bisection into do_find_bisection.
Christian Couder [Mon, 17 Sep 2007 03:28:20 +0000 (05:28 +0200)] 
rev-list --bisect: Move finding bisection into do_find_bisection.

This factorises some code and make a big function smaller.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agofast-import optimization:
Pierre Habouzit [Mon, 17 Sep 2007 12:00:38 +0000 (14:00 +0200)] 
fast-import optimization:

Now that cmd_data acts on a strbuf, make last_object stashed buffer be a
strbuf as well. On new stash, don't free the last stashed buffer, rather
swap it with the one you will stash, this way, callers of store_object can
act on static strbufs, and at some point, fast-import won't allocate new
memory for objects buffers.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agofast-import was using dbuf's, replace them with strbuf's.
Pierre Habouzit [Mon, 17 Sep 2007 11:48:17 +0000 (13:48 +0200)] 
fast-import was using dbuf's, replace them with strbuf's.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDrop strbuf's 'eof' marker, and make read_line a first class citizen.
Pierre Habouzit [Mon, 17 Sep 2007 09:19:04 +0000 (11:19 +0200)] 
Drop strbuf's 'eof' marker, and make read_line a first class citizen.

read_line is now strbuf_getline, and is a first class citizen, it returns 0
when reading a line worked, EOF else.

The ->eof marker was used non-locally by fast-import.c, mimic the same
behaviour using a static int in "read_next_command", that now returns -1 on
EOF, and avoids to call strbuf_getline when it's in EOF state.

Also no longer automagically strbuf_release the buffer, it's counter
intuitive and breaks fast-import in a very subtle way.

Note: being at EOF implies that command_buf.len == 0.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'cr/reset'
Junio C Hamano [Tue, 18 Sep 2007 07:42:01 +0000 (00:42 -0700)] 
Merge branch 'cr/reset'

* cr/reset:
  Simplify cache API
  An additional test for "git-reset -- path"
  Make "git reset" a builtin.
  Move make_cache_entry() from merge-recursive.c into read-cache.c
  Add tests for documented features of "git reset".

16 years agoMerge branch 'maint'
Junio C Hamano [Tue, 18 Sep 2007 07:41:43 +0000 (00:41 -0700)] 
Merge branch 'maint'

* maint:
  Document ls-files --with-tree=<tree-ish>
  git-commit: partial commit of paths only removed from the index
  git-commit: Allow partial commit of file removal.
  send-email: make message-id generation a bit more robust
  git-gui: Disable native platform text selection in "lists"
  git-gui: Paper bag fix "Commit->Revert" format arguments
  git-gui: Provide 'uninstall' Makefile target to undo an installation
  git-gui: Font chooser to handle a large number of font families
  git-gui: Make backporting changes from i18n version easier
  git-gui: Don't delete send on Windows as it doesn't exist
  git-gui: Trim trailing slashes from untracked submodule names
  git-gui: Assume untracked directories are Git submodules
  git-gui: handle "deleted symlink" diff marker
  git-gui: show unstaged symlinks in diff viewer
  git-gui: Avoid use of libdir in Makefile
  git-gui: Disable Tk send in all git-gui sessions
  git-gui: lib/index.tcl: handle files with % in the filename properly
  git-gui: Properly set the state of "Stage/Unstage Hunk" action
  git-gui: Fix detaching current branch during checkout
  git-gui: Correct starting of git-remote to handle -w option

16 years agoDocument ls-files --with-tree=<tree-ish>
Junio C Hamano [Fri, 14 Sep 2007 23:59:04 +0000 (16:59 -0700)] 
Document ls-files --with-tree=<tree-ish>

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-commit: partial commit of paths only removed from the index
Junio C Hamano [Fri, 14 Sep 2007 23:53:58 +0000 (16:53 -0700)] 
git-commit: partial commit of paths only removed from the index

Because a partial commit is meant to be a way to ignore what are
staged in the index, "git rm --cached A && git commit A" should
just record what is in A on the filesystem.  The previous patch
made the command sequence to barf, saying that A has not been
added yet.  This fixes it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-commit: Allow partial commit of file removal.
Junio C Hamano [Wed, 12 Sep 2007 23:04:22 +0000 (16:04 -0700)] 
git-commit: Allow partial commit of file removal.

When making a partial commit, git-commit uses git-ls-files with
the --error-unmatch option to expand and sanity check the user
supplied path patterns.  When any path pattern does not match
with the paths known to the index, it errors out, in order to
catch a common mistake to say "git commit Makefiel cache.h"
and end up with a commit that touches only cache.h (notice the
misspelled "Makefile").  This detection however does not work
well when the path has already been removed from the index.

If you drop a path from the index and try to commit that
partially, i.e.

$ git rm COPYING
$ git commit -m 'Remove COPYING' COPYING

the command complains because git does not know anything about
COPYING anymore.

This introduces a new option --with-tree to git-ls-files and
uses it in git-commit when we build a temporary index to
write a tree object for the partial commit.

When --with-tree=<tree-ish> option is specified, names from the
given tree are added to the set of names the index knows about,
so we can treat COPYING file in the example as known.

Of course, there is no reason to use "git rm" and git-aware
people have long time done:

$ rm COPYING
$ git commit -m 'Remove COPYING' COPYING

which works just fine.  But this caused a constant confusion.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'jc/grep-c' into maint
Junio C Hamano [Tue, 18 Sep 2007 06:56:40 +0000 (23:56 -0700)] 
Merge branch 'jc/grep-c' into maint

* jc/grep-c:
  Split grep arguments in a way that does not requires to add /dev/null.

16 years agoMerge branch 'maint' of git://repo.or.cz/git-gui into maint
Junio C Hamano [Tue, 18 Sep 2007 06:50:17 +0000 (23:50 -0700)] 
Merge branch 'maint' of git://repo.or.cz/git-gui into maint

* 'maint' of git://repo.or.cz/git-gui:
  git-gui: Disable native platform text selection in "lists"
  git-gui: Paper bag fix "Commit->Revert" format arguments
  git-gui: Provide 'uninstall' Makefile target to undo an installation
  git-gui: Font chooser to handle a large number of font families
  git-gui: Make backporting changes from i18n version easier
  git-gui: Don't delete send on Windows as it doesn't exist
  git-gui: Trim trailing slashes from untracked submodule names
  git-gui: Assume untracked directories are Git submodules
  git-gui: handle "deleted symlink" diff marker
  git-gui: show unstaged symlinks in diff viewer
  git-gui: Avoid use of libdir in Makefile
  git-gui: Disable Tk send in all git-gui sessions
  git-gui: lib/index.tcl: handle files with % in the filename properly
  git-gui: Properly set the state of "Stage/Unstage Hunk" action
  git-gui: Fix detaching current branch during checkout
  git-gui: Correct starting of git-remote to handle -w option

16 years agosend-email: make message-id generation a bit more robust
Junio C Hamano [Tue, 18 Sep 2007 04:18:20 +0000 (21:18 -0700)] 
send-email: make message-id generation a bit more robust

Earlier code took Unix time and appended a few random digits.
If you are firing off many messages within a second, you could
issue the same id to different messages, which is a no-no.  If
you send out 31 messages within a single second, with random
integer taken out of rand(4200), you have about 10% chance of
producing the same message ID.

This fixes the problem by uses a prefix string which is
constant-per-invocation (time and pid), with a serial number for
each message generated by the process appended at the end.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'maint'
Junio C Hamano [Mon, 17 Sep 2007 09:21:43 +0000 (02:21 -0700)] 
Merge branch 'maint'

* maint:
  git-apply: fix whitespace stripping
  apply --index-info: fall back to current index for mode changes
  core-tutorial: minor cleanup
  documentation: replace Discussion section by link to user-manual chapter
  user-manual: todo updates and cleanup
  user-manual: fix introduction to packfiles
  user-manual: move packfile and dangling object discussion
  user-manual: rewrite object database discussion
  user-manual: reorder commit, blob, tree discussion
  user-manual: rewrite index discussion
  user-manual: create new "low-level git operations" chapter
  user-manual: rename "git internals" to "git concepts"
  user-manual: move object format details to hacking-git chapter
  user-manual: adjust section levels in "git internals"
  revision walker: --cherry-pick is a limited operation
  git-sh-setup: typofix in comments

16 years agogit-apply: fix whitespace stripping
J. Bruce Fields [Sun, 16 Sep 2007 22:49:00 +0000 (18:49 -0400)] 
git-apply: fix whitespace stripping

The algorithm isn't right here: it accumulates any set of 8 spaces into
tabs even if they're separated by tabs, so

<four spaces><tab><four spaces><tab>

is converted to

<tab><tab><tab>

when it should be just

<tab><tab>

So teach git-apply that a tab hides any group of less than 8 previous
spaces in a row.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-gui: Disable native platform text selection in "lists" gitgui-0.8.3
Shawn O. Pearce [Mon, 17 Sep 2007 03:12:19 +0000 (23:12 -0400)] 
git-gui: Disable native platform text selection in "lists"

Sometimes we use a Tk text widget as though it were a listbox.
This happens typically when we want to show an icon to the left
of the text label or just when a text widget is generally a better
choice then the native listbox widget.

In these cases if we want the user to have control over the selection
we implement our own "in_sel" tag that shows the selected region
and we perform our own selection management in the background
via keybindings and mouse bindings.  In such uses we don't want
the user to be able to activate the native platform selection by
dragging their mouse through the text widget.  Doing so creates a
very confusing display and the user is left wondering what it may
mean to have two different types of selection in the same widget.

Tk doesn't allow us to delete the "sel" tag that it uses internally
to manage the native selection but it will allow us to make it
invisible by setting the tag to have the same display properties
as unselected text.  So long as we don't actually use the "sel"
tag for anything in code its effectively invisible.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agoapply --index-info: fall back to current index for mode changes
Johannes Schindelin [Mon, 17 Sep 2007 00:24:57 +0000 (01:24 +0100)] 
apply --index-info: fall back to current index for mode changes

"git diff" does not record index lines for pure mode changes (i.e. no
lines changed).  Therefore, apply --index-info would call out a bogus
error.

Instead, fall back to reading the info from the current index.

Incidentally, this fixes an error where git-rebase would not rebase a
commit including a pure mode change, and changes requiring a threeway
merge.

Noticed and later tested by Chris Shoemaker.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoRemove preemptive allocations.
Pierre Habouzit [Sun, 16 Sep 2007 08:19:01 +0000 (10:19 +0200)] 
Remove preemptive allocations.

Careful profiling shows that we spend more time guessing what pattern
allocation will have, whereas we can delay it only at the point where
add_rfc2047 will be used and don't allocate huge memory area for the many
cases where it's not.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoRefactor replace_encoding_header.
Pierre Habouzit [Sat, 15 Sep 2007 21:50:12 +0000 (23:50 +0200)] 
Refactor replace_encoding_header.

* Be more clever in how we search for "encoding ...\n": parse for real
  instead of the sloppy strstr's.
* use strbuf_splice to do the substring replacements.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agobuiltin-apply: use strbuf's instead of buffer_desc's.
Pierre Habouzit [Sun, 16 Sep 2007 16:54:42 +0000 (18:54 +0200)] 
builtin-apply: use strbuf's instead of buffer_desc's.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoNow that cache.h needs strbuf.h, remove useless includes.
Pierre Habouzit [Sat, 15 Sep 2007 13:56:50 +0000 (15:56 +0200)] 
Now that cache.h needs strbuf.h, remove useless includes.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoRewrite convert_to_{git,working_tree} to use strbuf's.
Pierre Habouzit [Sun, 16 Sep 2007 13:51:04 +0000 (15:51 +0200)] 
Rewrite convert_to_{git,working_tree} to use strbuf's.

* Now, those functions take an "out" strbuf argument, where they store their
  result if any. In that case, it also returns 1, else it returns 0.
* those functions support "in place" editing, in the sense that it's OK to
  call them this way:
    convert_to_git(path, sb->buf, sb->len, sb);
  When doable, conversions are done in place for real, else the strbuf
  content is just replaced with the new one, transparentely for the caller.

If you want to create a new filter working this way, being the accumulation
of filter1, filter2, ... filtern, then your meta_filter would be:

    int meta_filter(..., const char *src, size_t len, struct strbuf *sb)
    {
        int ret = 0;
        ret |= filter1(...., src, len, sb);
        if (ret) {
            src = sb->buf;
            len = sb->len;
        }
        ret |= filter2(...., src, len, sb);
        if (ret) {
            src = sb->buf;
            len = sb->len;
        }
        ....
        return ret | filtern(..., src, len, sb);
    }

That's why subfilters the convert_to_* functions called were also rewritten
to work this way.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoNew strbuf APIs: splice and attach.
Pierre Habouzit [Sat, 15 Sep 2007 13:56:50 +0000 (15:56 +0200)] 
New strbuf APIs: splice and attach.

* strbuf_splice replace a portion of the buffer with another.
* strbuf_attach replace a strbuf buffer with the given one, that should be
  malloc'ed. Then it enforces strbuf's invariants. If alloc > len, then this
  function has negligible cost, else it will perform a realloc, possibly
  with a cost.

Also some style issues are fixed now.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'maint' of git://linux-nfs.org/~bfields/git into maint
Junio C Hamano [Sun, 16 Sep 2007 06:18:05 +0000 (23:18 -0700)] 
Merge branch 'maint' of git://linux-nfs.org/~bfields/git into maint

* 'maint' of git://linux-nfs.org/~bfields/git:
  core-tutorial: minor cleanup
  documentation: replace Discussion section by link to user-manual chapter
  user-manual: todo updates and cleanup
  user-manual: fix introduction to packfiles
  user-manual: move packfile and dangling object discussion
  user-manual: rewrite object database discussion
  user-manual: reorder commit, blob, tree discussion
  user-manual: rewrite index discussion
  user-manual: create new "low-level git operations" chapter
  user-manual: rename "git internals" to "git concepts"
  user-manual: move object format details to hacking-git chapter
  user-manual: adjust section levels in "git internals"

16 years agocore-tutorial: minor cleanup
J. Bruce Fields [Mon, 3 Sep 2007 14:34:27 +0000 (10:34 -0400)] 
core-tutorial: minor cleanup

Revise the introduction for concision, add pointers to the tutorial and
user manual as appropriate, delete cvsimport note from the end, as that
work's been done elsewhere already.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
16 years agodocumentation: replace Discussion section by link to user-manual chapter
J. Bruce Fields [Mon, 3 Sep 2007 04:01:19 +0000 (00:01 -0400)] 
documentation: replace Discussion section by link to user-manual chapter

The "Discussion" section has a lot of useful information, but is a
little wordy, especially for an already-long man page, and is designed
for an audience more of potential git hackers than users, which probably
doesn't make as much sense as git matures.  Also, I (perhaps foolishly)
forked a version in the user manual, which has been significantly
rewritten in an attempt to address some of the above problems.

So, remove this section and replace it by a (very terse) summary of the
original material--my attempt at the World's Shortest Git Overview--and
a reference to the appropriate chapter of the user manual.  It's
unfortunate to remove something that's been in this place for a long
time, as some people may still depend on finding it there.  But I think
we'll want to do this some day anyway.

Cc: Andreas Ericsson <ae@op5.se>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
16 years agouser-manual: todo updates and cleanup
J. Bruce Fields [Mon, 3 Sep 2007 03:28:49 +0000 (23:28 -0400)] 
user-manual: todo updates and cleanup

Format a couple lists.  Reminder that we may want to add submodule
documentation some day.

16 years agouser-manual: fix introduction to packfiles
J. Bruce Fields [Sun, 9 Sep 2007 02:27:18 +0000 (22:27 -0400)] 
user-manual: fix introduction to packfiles

Actually I don't think we've previously mentioned .git/objects, so we
need a different introduction here.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
16 years agouser-manual: move packfile and dangling object discussion
J. Bruce Fields [Sun, 9 Sep 2007 02:13:53 +0000 (22:13 -0400)] 
user-manual: move packfile and dangling object discussion

The discussions of packfiles and dangling objects both belong in the
object database section.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
16 years agouser-manual: rewrite object database discussion
J. Bruce Fields [Sun, 10 Jun 2007 19:15:08 +0000 (15:15 -0400)] 
user-manual: rewrite object database discussion

Rewrite the introduction.  Rewrite each section completely to make them
work in the new order, to add some examples, and to move plumbing
commands (like git-commit-tree) to the following chapter.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
16 years agouser-manual: reorder commit, blob, tree discussion
J. Bruce Fields [Sat, 1 Sep 2007 03:26:38 +0000 (23:26 -0400)] 
user-manual: reorder commit, blob, tree discussion

The bottom-up blog, tree, commit order makes sense unless you want to
give explicit examples--it's easier to discover objects to examine if
you go in the other order....,

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
16 years agouser-manual: rewrite index discussion
J. Bruce Fields [Mon, 3 Sep 2007 16:59:55 +0000 (12:59 -0400)] 
user-manual: rewrite index discussion

Add an example using git-ls-files, standardize on the new "index"
terminology (as opposed to "cache"), attempt to clarify discussion and
make it a little shorter, avoid some unnecessary jargon ("write-back
cache").

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
16 years agouser-manual: create new "low-level git operations" chapter
J. Bruce Fields [Mon, 3 Sep 2007 15:27:56 +0000 (11:27 -0400)] 
user-manual: create new "low-level git operations" chapter

The low-level index operations aren't as important to regular users as
the rest of this "git concepts" chapter; so move it into a separate
chapter, and do some minor cleanup.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
16 years agouser-manual: rename "git internals" to "git concepts"
J. Bruce Fields [Fri, 31 Aug 2007 03:10:05 +0000 (23:10 -0400)] 
user-manual: rename "git internals" to "git concepts"

"git internals" sounds like something only git developers must know
about, but this stuff should be of wider interest.  Rename the chapter
and give it a slightly friendlier introduction.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
16 years agouser-manual: move object format details to hacking-git chapter
J. Bruce Fields [Fri, 31 Aug 2007 03:07:05 +0000 (23:07 -0400)] 
user-manual: move object format details to hacking-git chapter

Most of this is probably only of interest to git developers.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
16 years agouser-manual: adjust section levels in "git internals"
J. Bruce Fields [Fri, 31 Aug 2007 02:49:33 +0000 (22:49 -0400)] 
user-manual: adjust section levels in "git internals"

The descriptions of the various object types should all be a subsection
of the "Object Database" section.

I cribbed most of this chapter from the README (now core-intro.txt and
git(7)), because there's stuff in there people need to know and I was
too lazy to rewrite it.  The audience isn't quite right, though--the
chapter is a mixture of user- and developer- level documentation that
isn't as appropriate now as it was originally.

So, reserve this chapter for stuff users need to know, and move the
source code introduction into a new "git hacking" chapter where we'll
also move any hacker-only technical details.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
16 years agorevision walker: --cherry-pick is a limited operation
Johannes Schindelin [Sat, 15 Sep 2007 17:39:52 +0000 (18:39 +0100)] 
revision walker: --cherry-pick is a limited operation

We used to rely on the fact that cherry-pick would trigger the code path
to set limited = 1 in handle_commit(), when an uninteresting commit was
encountered.

However, when cherry picking between two independent branches, i.e. when
there are no merge bases, and there is only linear development (which can
happen when you cvsimport a fork of a project), no uninteresting commit
will be encountered.

So set limited = 1 when --cherry-pick was asked for.

Noticed by Martin Bähr.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-sh-setup: typofix in comments
Junio C Hamano [Sat, 15 Sep 2007 23:32:23 +0000 (16:32 -0700)] 
git-sh-setup: typofix in comments

Noticed by Anupam Srivastava.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'js/remote'
Junio C Hamano [Sat, 15 Sep 2007 05:38:06 +0000 (22:38 -0700)] 
Merge branch 'js/remote'

* js/remote:
  Teach "git remote" a mirror mode

16 years agoMerge branch 'js/tag'
Junio C Hamano [Sat, 15 Sep 2007 05:37:55 +0000 (22:37 -0700)] 
Merge branch 'js/tag'

* js/tag:
  verify-tag: also grok CR/LFs in the tag signature

16 years agoMerge branch 'lh/svn-first-parent'
Junio C Hamano [Sat, 15 Sep 2007 05:37:43 +0000 (22:37 -0700)] 
Merge branch 'lh/svn-first-parent'

* lh/svn-first-parent:
  git-svn: always use --first-parent
  git-svn: add support for --first-parent

16 years agoMerge branch 'np/delta'
Junio C Hamano [Sat, 15 Sep 2007 05:33:28 +0000 (22:33 -0700)] 
Merge branch 'np/delta'

* np/delta:
  builtin-pack-objects.c: avoid bogus gcc warnings
  threaded delta search: proper locking for cache accounting
  threaded delta search: add pack.threads config variable
  fix threaded delta search locking
  threaded delta search: specify number of threads at run time
  threaded delta search: better chunck split point
  threaded delta search: refine work allocation
  basic threaded delta search
  rearrange delta search progress reporting
  localize window memory usage accounting
  straighten the list of objects to deltify

16 years agobuiltin-pack-objects.c: avoid bogus gcc warnings
Junio C Hamano [Sat, 15 Sep 2007 05:30:20 +0000 (22:30 -0700)] 
builtin-pack-objects.c: avoid bogus gcc warnings

These empty statement marcos can solicit bogus "statement with no effect"
warnings; squelch them.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'jc/pack'
Junio C Hamano [Sat, 15 Sep 2007 01:33:45 +0000 (18:33 -0700)] 
Merge branch 'jc/pack'

* jc/pack:
  Keep last used delta base in the delta window

16 years agoMerge branch 'dk/diff-delta'
Junio C Hamano [Sat, 15 Sep 2007 01:33:15 +0000 (18:33 -0700)] 
Merge branch 'dk/diff-delta'

* dk/diff-delta:
  diff-delta.c: Rationalize culling of hash buckets
  diff-delta.c: pack the index structure

16 years agoMerge branch 'jc/partial-remove'
Junio C Hamano [Sat, 15 Sep 2007 01:23:01 +0000 (18:23 -0700)] 
Merge branch 'jc/partial-remove'

* jc/partial-remove:
  Document ls-files --with-tree=<tree-ish>
  git-commit: partial commit of paths only removed from the index
  git-commit: Allow partial commit of file removal.

16 years agoDocument ls-files --with-tree=<tree-ish>
Junio C Hamano [Fri, 14 Sep 2007 23:59:04 +0000 (16:59 -0700)] 
Document ls-files --with-tree=<tree-ish>

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-commit: partial commit of paths only removed from the index
Junio C Hamano [Fri, 14 Sep 2007 23:53:58 +0000 (16:53 -0700)] 
git-commit: partial commit of paths only removed from the index

Because a partial commit is meant to be a way to ignore what are
staged in the index, "git rm --cached A && git commit A" should
just record what is in A on the filesystem.  The previous patch
made the command sequence to barf, saying that A has not been
added yet.  This fixes it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'jc/grep-c'
Junio C Hamano [Fri, 14 Sep 2007 22:17:07 +0000 (15:17 -0700)] 
Merge branch 'jc/grep-c'

* jc/grep-c:
  Split grep arguments in a way that does not requires to add /dev/null.
  Documentation/git-config.txt: AsciiDoc tweak to avoid leading dot
  Add test to check recent fix to "git add -u"
  Documentation/git-archive.txt: a couple of clarifications.
  Fix the rename detection limit checking
  diff --no-index: do not forget to run diff_setup_done()

16 years agoSplit grep arguments in a way that does not requires to add /dev/null.
Junio C Hamano [Fri, 14 Sep 2007 07:31:00 +0000 (00:31 -0700)] 
Split grep arguments in a way that does not requires to add /dev/null.

In order to (almost) always show the name of the file without
relying on "-H" option of GNU grep, we used to add /dev/null to
the argument list unless we are doing -l or -L.  This caused
"/dev/null:0" to show up when -c is given in the output.

It is not enough to add -c to the set of options we do not pass
/dev/null for.  When we have too many files, we invoke grep
multiple times and we need to avoid giving a widow filename to
the last invocation -- otherwise we will not see the name.

This keeps two filenames when the argv[] buffer is about to
overflow and we have not finished iterating over the index, so
that the last round will always have at least two paths to work
with (and not require /dev/null).

An obvious and the only exception is when there is only 1 file
that is given to the underlying grep, and in that case we avoid
passing /dev/null and let the external "grep -c" report only the
number of matches.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDocumentation/git-config.txt: AsciiDoc tweak to avoid leading dot
Junio C Hamano [Fri, 14 Sep 2007 21:51:08 +0000 (14:51 -0700)] 
Documentation/git-config.txt: AsciiDoc tweak to avoid leading dot

Bram Schoenmakers noticed that git-config document was formatted
incorrectly.  Depending on the version of AsciiDoc and docbook
toolchain, it is sometimes taken as a numbered example by AsciiDoc,
some other times passed intact to roff format to confuse "man".

Since we refer to the repository metadata directory as $GIT_DIR
elsewhere, work it around by using that symbolic name.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoAdd test to check recent fix to "git add -u"
Benoit Sigoure [Fri, 14 Sep 2007 08:29:04 +0000 (10:29 +0200)] 
Add test to check recent fix to "git add -u"

An earlier commit fixed type-change case in "git add -u".
This adds a test to make sure we do not introduce regression.

At the same time, it fixes a stupid typo in the error message.

Signed-off-by: Benoit Sigoure <tsuna@lrde.epita.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDocumentation/git-archive.txt: a couple of clarifications.
Jari Aalto [Fri, 14 Sep 2007 18:38:02 +0000 (21:38 +0300)] 
Documentation/git-archive.txt: a couple of clarifications.

The description of the option gave impression that there
were several formats available by using three dots. There are
no other formats than tar and gzip currently supported.

Clarify that the archive goes to the standard output.

Signed-off-by: Jari Aalto <jari.aalto@cante.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFix the rename detection limit checking
Linus Torvalds [Fri, 14 Sep 2007 17:39:48 +0000 (10:39 -0700)] 
Fix the rename detection limit checking

This adds more proper rename detection limits. Instead of just checking
the limit against the number of potential rename destinations, we verify
that the rename matrix (which is what really matters) doesn't grow
ridiculously large, and we also make sure that we don't overflow when
doing the matrix size calculation.

This also changes the default limits from unlimited, to a rename matrix
that is limited to 100 entries on a side. You can raise it with the config
entry, or by using the "-l<n>" command line flag, but at least the default
is now a sane number that avoids spending lots of time (and memory) in
situations that likely don't merit it.

The choice of default value is of course very debatable. Limiting the
rename matrix to a 100x100 size will mean that even if you have just one
obvious rename, but you also create (or delete) 10,000 files, the rename
matrix will be so big that we disable the heuristics. Sounds reasonable to
me, but let's see if people hit this (and, perhaps more importantly,
actually *care*) in real life.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agodiff --no-index: do not forget to run diff_setup_done()
Junio C Hamano [Fri, 14 Sep 2007 19:12:32 +0000 (12:12 -0700)] 
diff --no-index: do not forget to run diff_setup_done()

Code inspection by Linus found this.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'jc/cachetree' into cr/reset
Junio C Hamano [Fri, 14 Sep 2007 08:19:30 +0000 (01:19 -0700)] 
Merge branch 'jc/cachetree' into cr/reset

* jc/cachetree:
  Simplify cache API
  git-format-patch --in-reply-to: accept <message@id> with angle brackets
  git-add -u: do not barf on type changes
  Remove duplicate note about removing commits with git-filter-branch
  git-clone: improve error message if curl program is missing or not executable
  git.el: Allow the add and remove commands to be applied to ignored files.
  git.el: Allow selecting whether to display uptodate/unknown/ignored files.
  git.el: Keep the status buffer sorted by filename.
  hooks--update: Explicitly check for all zeros for a deleted ref.

16 years agoSimplify cache API
Junio C Hamano [Fri, 14 Sep 2007 03:33:11 +0000 (20:33 -0700)] 
Simplify cache API

Earlier, add_file_to_index() invalidated the path in the cache-tree
but remove_file_from_cache() did not, and the user of the latter
needed to invalidate the entry himself.  This led to a few bugs due to
missed invalidate calls already.  This patch makes the management of
cache-tree less error prone by making more invalidate calls from lower
level cache API functions.

The rules are:

 - If you are going to write the index, you should either maintain
   cache_tree correctly.

   - If you cannot, alternatively you can remove the entire cache_tree
     by calling cache_tree_free() before you call write_cache().

   - When you modify the index, cache_tree_invalidate_path() should be
     called with the path you are modifying, to discard the entry from
     the cache-tree structure.

 - The following cache API functions exported from read-cache.c (and
   the macro whose names have "cache" instead of "index")
   automatically call cache_tree_invalidate_path() for you:

   - remove_file_from_index();
   - add_file_to_index();
   - add_index_entry();

   You can modify the index bypassing the above API functions
   (e.g. find an existing cache entry from the index and modify it in
   place).  You need to call cache_tree_invalidate_path() yourself in
   such a case.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'maint'
Junio C Hamano [Fri, 14 Sep 2007 07:55:32 +0000 (00:55 -0700)] 
Merge branch 'maint'

* maint:
  git-format-patch --in-reply-to: accept <message@id> with angle brackets
  git-add -u: do not barf on type changes
  Remove duplicate note about removing commits with git-filter-branch
  git-clone: improve error message if curl program is missing or not executable
  hooks--update: Explicitly check for all zeros for a deleted ref.

16 years agogit-format-patch --in-reply-to: accept <message@id> with angle brackets
Junio C Hamano [Fri, 14 Sep 2007 05:30:45 +0000 (22:30 -0700)] 
git-format-patch --in-reply-to: accept <message@id> with angle brackets

This will allow RFC-literate users to say:

format-patch --in-reply-to='<message.id@site.name>'

without forcing them to strip the surrounding angle brackets
like this:

format-patch --in-reply-to='message.id@site.name'

We accept both forms, and the latter gets necessary < and >
around it as before.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-add -u: do not barf on type changes
Junio C Hamano [Fri, 14 Sep 2007 07:45:29 +0000 (00:45 -0700)] 
git-add -u: do not barf on type changes

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoarchive: fix subst file generation
René Scharfe [Thu, 13 Sep 2007 22:13:06 +0000 (00:13 +0200)] 
archive: fix subst file generation

Before the strbuf conversion, result was a char pointer.  The if
statement checked for it being not NULL, which meant that no
"$Format:...$" string had been found and no replacement had to be
made.  format_subst() returned NULL in that case -- the caller
then simply kept the original file content, as it was unaffected
by the expansion.

The length of the string being 0 is not the same as the string
being NULL (expansion to an empty string vs. no expansion at all),
so checking result.len != 0 is not a full replacement for the old
NULL check.

However, I doubt the subtle optimization explained above resulted
in a notable speed-up anyway.  Simplify the code and add the tail
of the file to the expanded string unconditionally.

[jc: added a test to expose the breakage this fixes]

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoRemove duplicate note about removing commits with git-filter-branch
Ulrik Sverdrup [Thu, 13 Sep 2007 15:57:56 +0000 (17:57 +0200)] 
Remove duplicate note about removing commits with git-filter-branch

A duplicate of an already existing section in the documentation of
git-filter-branch was added in commit
f95eef15f2f8a336b9a42749f5458c841a5a5d63.
This patch removes that redundant section.

Signed-off-by: Ulrik Sverdrup <ulrik.sverdrup@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-clone: improve error message if curl program is missing or not executable
Gerrit Pape [Thu, 13 Sep 2007 11:36:22 +0000 (11:36 +0000)] 
git-clone: improve error message if curl program is missing or not executable

If the curl program is not available (or not executable), and git clone is
started to clone a repository through http, this is the output

 Initialized empty Git repository in /tmp/puppet/.git/
 /usr/bin/git-clone: line 37: curl: command not found
 Cannot get remote repository information.
 Perhaps git-update-server-info needs to be run there?

This patch improves the error message by checking the return code when
running curl to exit immediately if it's 126 or 127; the error output now
is

 Initialized empty Git repository in /tmp/puppet/.git/
 /usr/bin/git-clone: line 37: curl: command not found

Adrian Bridgett noticed this and reported through
 http://bugs.debian.org/440976

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit.el: Allow the add and remove commands to be applied to ignored files.
Alexandre Julliard [Thu, 13 Sep 2007 09:50:29 +0000 (11:50 +0200)] 
git.el: Allow the add and remove commands to be applied to ignored files.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit.el: Allow selecting whether to display uptodate/unknown/ignored files.
Alexandre Julliard [Thu, 13 Sep 2007 09:50:08 +0000 (11:50 +0200)] 
git.el: Allow selecting whether to display uptodate/unknown/ignored files.

The default behavior for each state can be customized, and it can also
be toggled directly from the status buffer.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit.el: Keep the status buffer sorted by filename.
Alexandre Julliard [Thu, 13 Sep 2007 09:49:40 +0000 (11:49 +0200)] 
git.el: Keep the status buffer sorted by filename.

This makes insertions and updates much more efficient.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agohooks--update: Explicitly check for all zeros for a deleted ref.
Alexandre Julliard [Wed, 12 Sep 2007 21:36:03 +0000 (23:36 +0200)] 
hooks--update: Explicitly check for all zeros for a deleted ref.

The previous check caused the hook to reject as unannotated any tag
whose SHA1 starts with a zero.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>