git.git
15 years agoverify_uptodate(): add ce_uptodate(ce) test
Kjetil Barvik [Thu, 19 Feb 2009 20:08:30 +0000 (21:08 +0100)]
verify_uptodate(): add ce_uptodate(ce) test

If we inside verify_uptodate() can already tell from the ce entry that
it is already uptodate by testing it with ce_uptodate(ce), there is no
need to call lstat(2) and ie_match_stat() afterwards.

And, reading from the commit log message from:

    commit eadb5831342bb2e756fa05c03642c4aa1929d4f5
    Author: Junio C Hamano <gitster@pobox.com>
    Date:   Fri Jan 18 23:45:24 2008 -0800

    Avoid running lstat(2) on the same cache entry.

this also seems to be correct usage of the ce_uptodate() macro
introduced by that patch.

This will avoid lots of lstat(2) calls in some cases, for example
by running the 'git checkout' command.

Signed-off-by: Kjetil Barvik <barvik@broadpark.no>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agomake USE_NSEC work as expected
Kjetil Barvik [Thu, 19 Feb 2009 20:08:29 +0000 (21:08 +0100)]
make USE_NSEC work as expected

Since the filesystem ext4 is now defined as stable in Linux v2.6.28,
and ext4 supports nanonsecond resolution timestamps natively, it is
time to make USE_NSEC work as expected.

This will make racy git situations less likely to happen.  For 'git
checkout' this means it will be less likely that we have to open, read
the contents of the file into RAM, and check if file is really
modified or not.  The result sould be a litle less used CPU time, less
pagefaults and a litle faster program, at least for 'git checkout'.

Since the number of possible racy git situations would increase when
disks gets faster, this patch would be more and more helpfull as times
go by.  For a fast Solid State Disk, this patch should be helpfull.

Note that, when file operations starts to take less than 1 nanosecond,
one would again start to get more racy git situations.

For more info on racy git, see Documentation/technical/racy-git.txt
For more info on ext4, see http://kernelnewbies.org/Ext4

Signed-off-by: Kjetil Barvik <barvik@broadpark.no>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agofix compile error when USE_NSEC is defined
Kjetil Barvik [Thu, 19 Feb 2009 20:08:28 +0000 (21:08 +0100)]
fix compile error when USE_NSEC is defined

'struct cache' does not have a 'usec' member, but a 'unsigned int
nsec' member.  Simmilar 'struct stat' does not have a 'st_mtim.usec'
member, and we should instead use 'st_mtim.tv_nsec'.

Signed-off-by: Kjetil Barvik <barvik@broadpark.no>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agocheck_updates(): effective removal of cache entries marked CE_REMOVE
Kjetil Barvik [Wed, 18 Feb 2009 22:18:03 +0000 (23:18 +0100)]
check_updates(): effective removal of cache entries marked CE_REMOVE

Below is oprofile output from GIT command 'git chekcout -q my-v2.6.25'
(move from tag v2.6.27 to tag v2.6.25 of the Linux kernel):

CPU: Core 2, speed 1999.95 MHz (estimated)
Counted CPU_CLK_UNHALTED events (Clock cycles when not halted) with a unit
                         mask of 0x00 (Unhalted core cycles) count 20000
Counted INST_RETIRED_ANY_P events (number of instructions retired) with a
                           unit mask of 0x00 (No unit mask) count 20000
CPU_CLK_UNHALT...|INST_RETIRED:2...|
  samples|      %|  samples|      %|
------------------------------------
   409247 100.000    342878 100.000 git
        CPU_CLK_UNHALT...|INST_RETIRED:2...|
          samples|      %|  samples|      %|
        ------------------------------------
           260476 63.6476    257843 75.1996 libz.so.1.2.3
           100876 24.6492     64378 18.7758 kernel-2.6.28.4_2.vmlinux
            30850  7.5382      7874  2.2964 libc-2.9.so
            14775  3.6103      8390  2.4469 git
             2020  0.4936      4325  1.2614 libcrypto.so.0.9.8
              191  0.0467        32  0.0093 libpthread-2.9.so
               58  0.0142        36  0.0105 ld-2.9.so
                1 2.4e-04         0       0 libldap-2.3.so.0.2.31

Detail list of the top 20 function entries (libz counted in one blob):

CPU_CLK_UNHALTED  INST_RETIRED_ANY_P
samples  %        samples  %        image name               symbol name
260476   63.6862  257843   75.2725  libz.so.1.2.3            /lib/libz.so.1.2.3
16587     4.0555  3636      1.0615  libc-2.9.so              memcpy
7710      1.8851  277       0.0809  libc-2.9.so              memmove
3679      0.8995  1108      0.3235  kernel-2.6.28.4_2.vmlinux d_validate
3546      0.8670  2607      0.7611  kernel-2.6.28.4_2.vmlinux __getblk
3174      0.7760  1813      0.5293  libc-2.9.so              _int_malloc
2396      0.5858  3681      1.0746  kernel-2.6.28.4_2.vmlinux copy_to_user
2270      0.5550  2528      0.7380  kernel-2.6.28.4_2.vmlinux __link_path_walk
2205      0.5391  1797      0.5246  kernel-2.6.28.4_2.vmlinux ext4_mark_iloc_dirty
2103      0.5142  1203      0.3512  kernel-2.6.28.4_2.vmlinux find_first_zero_bit
2077      0.5078  997       0.2911  kernel-2.6.28.4_2.vmlinux do_get_write_access
2070      0.5061  514       0.1501  git                      cache_name_compare
2043      0.4995  1501      0.4382  kernel-2.6.28.4_2.vmlinux rcu_irq_exit
2022      0.4944  1732      0.5056  kernel-2.6.28.4_2.vmlinux __ext4_get_inode_loc
2020      0.4939  4325      1.2626  libcrypto.so.0.9.8       /usr/lib/libcrypto.so.0.9.8
1965      0.4804  1384      0.4040  git                      patch_delta
1708      0.4176  984       0.2873  kernel-2.6.28.4_2.vmlinux rcu_sched_grace_period
1682      0.4112  727       0.2122  kernel-2.6.28.4_2.vmlinux sysfs_slab_alias
1659      0.4056  290       0.0847  git                      find_pack_entry_one
1480      0.3619  1307      0.3816  kernel-2.6.28.4_2.vmlinux ext4_writepage_trans_blocks

Notice the memmove line, where the CPU did 7710 / 277 = 27.8 cycles
per instruction, and compared to the total cycles spent inside the
source code of GIT for this command, all the memmove() calls
translates to (7710 * 100) / 14775 = 52.2% of this.

Retesting with a GIT program compiled for gcov usage, I found out that
the memmove() calls came from remove_index_entry_at() in read-cache.c,
where we have:

        memmove(istate->cache + pos,
                istate->cache + pos + 1,
                (istate->cache_nr - pos) * sizeof(struct cache_entry *));

remove_index_entry_at() is called 4902 times from check_updates() in
unpack-trees.c, and each time called we move each cache_entry pointers
(from the removed one) one step to the left.

Since we have 28828 entries in the cache this time, and if we on
average move half of them each time, we in total move approximately
4902 * 0.5 * 28828 * 4 = 282 629 712 bytes, or twice this amount if
each pointer is 8 bytes (64 bit).

OK, is seems that the function check_updates() is called 28 times, so
the estimated guess above had been more correct if check_updates() had
been called only once, but the point is: we get lots of bytes moved.

To fix this, and use an O(N) algorithm instead, where N is the number
of cache_entries, we delete/remove all entries in one loop through all
entries.

From a retest, the new remove_marked_cache_entries() from the patch
below, ended up with the following output line from oprofile:

46        0.0105  15        0.0041  git                      remove_marked_cache_entries

If we can trust the numbers from oprofile in this case, we saved
approximately ((7710 - 46) * 20000) / (2 * 1000 * 1000 * 1000) = 0.077
seconds CPU time with this fix for this particular test.  And notice
that now the CPU did only 46 / 15 = 3.1 cycles/instruction.

Signed-off-by: Kjetil Barvik <barvik@broadpark.no>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agolstat_cache(): print a warning if doing ping-pong between cache types
Kjetil Barvik [Mon, 9 Feb 2009 20:54:53 +0000 (21:54 +0100)]
lstat_cache(): print a warning if doing ping-pong between cache types

This is a debug patch which is only to be used while the lstat_cache()
is in the test stage, and should be removed/reverted before the final
relase.

I think it should be useful to catch these warnings, as I it could be
an indication of that the cache would not be very effective if it is
doing ping-pong by switching between different cache types too many
times.

Also, if someone is experimenting with the lstat_cache(), this patch
will maybe be useful while debugging.

If someone is able to trigger the warning, then send a mail to the GIT
mailing list, containing the first 15 lines of the warning, and a
short description of the GIT commands to trigger the warnings.

I hope someone is willing to use this patch for a while, to be able to
catch possible ping-pong's.

Signed-off-by: Kjetil Barvik <barvik@broadpark.no>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoshow_patch_diff(): remove a call to fstat()
Kjetil Barvik [Mon, 9 Feb 2009 20:54:52 +0000 (21:54 +0100)]
show_patch_diff(): remove a call to fstat()

Currently inside show_patch_diff() we have an fstat() call after an
ok lstat() call.  Since before the call to fstat() we have already
tested for the link case with S_ISLNK(), the fstat() can be removed.

Signed-off-by: Kjetil Barvik <barvik@broadpark.no>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agowrite_entry(): use fstat() instead of lstat() when file is open
Kjetil Barvik [Mon, 9 Feb 2009 20:54:51 +0000 (21:54 +0100)]
write_entry(): use fstat() instead of lstat() when file is open

Currently inside write_entry() we do an lstat(path, &st) call on a
file which have just been opened inside the exact same function.  It
should be better to call fstat(fd, &st) on the file while it is open,
and it should be at least as fast as the lstat() method.

Signed-off-by: Kjetil Barvik <barvik@broadpark.no>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agowrite_entry(): cleanup of some duplicated code
Kjetil Barvik [Mon, 9 Feb 2009 20:54:50 +0000 (21:54 +0100)]
write_entry(): cleanup of some duplicated code

The switch-cases for S_IFREG and S_IFLNK was so similar that it will
be better to do some cleanup and use the common parts of it.

And the entry.c file should now be clean for 'gcc -Wextra' warnings.

Signed-off-by: Kjetil Barvik <barvik@broadpark.no>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agocreate_directories(): remove some memcpy() and strchr() calls
Kjetil Barvik [Mon, 9 Feb 2009 20:54:08 +0000 (21:54 +0100)]
create_directories(): remove some memcpy() and strchr() calls

Remove the call to memcpy() and strchr() for each path component
tested, and instead add each path component as we go forward inside
the while-loop.

Impact: small optimisation

Signed-off-by: Kjetil Barvik <barvik@broadpark.no>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agounlink_entry(): introduce schedule_dir_for_removal()
Kjetil Barvik [Mon, 9 Feb 2009 20:54:07 +0000 (21:54 +0100)]
unlink_entry(): introduce schedule_dir_for_removal()

Currently inside unlink_entry() if we get a successful removal of one
file with unlink(), we try to remove the leading directories each and
every time.  So if one directory containing 200 files is moved to an
other location we get 199 failed calls to rmdir() and 1 successful
call.

To fix this and avoid some unnecessary calls to rmdir(), we schedule
each directory for removal and wait much longer before we do the real
call to rmdir().

Since the unlink_entry() function is called with alphabetically sorted
names, this new function end up being very effective to avoid
unnecessary calls to rmdir().  In some cases over 95% of all calls to
rmdir() is removed with this patch.

Signed-off-by: Kjetil Barvik <barvik@broadpark.no>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agolstat_cache(): swap func(length, string) into func(string, length)
Kjetil Barvik [Mon, 9 Feb 2009 20:54:06 +0000 (21:54 +0100)]
lstat_cache(): swap func(length, string) into func(string, length)

Swap function argument pair (length, string) into (string, length) to
conform with the commonly used order inside the GIT source code.

Also, add a note about this fact into the coding guidelines.

Signed-off-by: Kjetil Barvik <barvik@broadpark.no>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agolstat_cache(): generalise longest_match_lstat_cache()
Kjetil Barvik [Mon, 9 Feb 2009 20:54:05 +0000 (21:54 +0100)]
lstat_cache(): generalise longest_match_lstat_cache()

Rename the function to longst_path_match() and generalise it such that
it can also be used by other functions.

Signed-off-by: Kjetil Barvik <barvik@broadpark.no>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agolstat_cache(): small cleanup and optimisation
Kjetil Barvik [Mon, 9 Feb 2009 20:54:04 +0000 (21:54 +0100)]
lstat_cache(): small cleanup and optimisation

Simplify the if-else test in longest_match_lstat_cache() such that we
only have one simple if test.  Instead of testing for 'i == cache.len'
or 'i == len', we transform this to a common test for 'i == max_len'.

And to further optimise we use 'i >= max_len' instead of 'i ==
max_len', the reason is that it is now the exact opposite of one part
inside the while-loop termination expression 'i < max_len && name[i]
== cache.path[i]', and then the compiler can probably reuse a test
instruction from it.

We also throw away the arguments to reset_lstat_cache(), such that all
the safeguard logic inside lstat_cache() is handled at one place.

Signed-off-by: Kjetil Barvik <barvik@broadpark.no>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-web--browse: Fix check for /bin/start
Todd Zullinger [Sun, 8 Feb 2009 23:12:43 +0000 (18:12 -0500)]
git-web--browse: Fix check for /bin/start

The previous check in git-web--browse for /bin/start used test -n
/bin/start, which was always true.  This lead to "start" being tried
first in the browser list.  On systems with upstart installed, "start"
exists and might be in the PATH, but it makes a poor choice for a web
browser.  Instead, test that /bin/start exists and is executable.

Signed-off-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint'
Junio C Hamano [Mon, 9 Feb 2009 06:07:53 +0000 (22:07 -0800)]
Merge branch 'maint'

* maint:
  gitweb: add $prevent_xss option to prevent XSS by repository content
  rev-list: fix showing distance when using --bisect-all

15 years agocompletion: Get rid of tabbed indentation in comments. Replace with spaces.
Ted Pavlic [Fri, 6 Feb 2009 16:05:38 +0000 (11:05 -0500)]
completion: Get rid of tabbed indentation in comments. Replace with spaces.

Signed-off-by: Ted Pavlic <ted@tedpavlic.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agocompletion: Fix GIT_PS1_SHOWDIRTYSTATE to prevent unbound variable errors.
Ted Pavlic [Fri, 6 Feb 2009 16:05:37 +0000 (11:05 -0500)]
completion: Fix GIT_PS1_SHOWDIRTYSTATE to prevent unbound variable errors.

Signed-off-by: Ted Pavlic <ted@tedpavlic.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogitweb: add $prevent_xss option to prevent XSS by repository content
Matt McCutchen [Sun, 8 Feb 2009 00:00:09 +0000 (19:00 -0500)]
gitweb: add $prevent_xss option to prevent XSS by repository content

Add a gitweb configuration variable $prevent_xss that disables features
to prevent content in repositories from launching cross-site scripting
(XSS) attacks in the gitweb domain.  Currently, this option makes gitweb
ignore README.html (a better solution may be worked out in the future)
and serve a blob_plain file of an untrusted type with
"Content-Disposition: attachment", which tells the browser not to show
the file at its original URL.

The XSS prevention is currently off by default.

Signed-off-by: Matt McCutchen <matt@mattmccutchen.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agodoc/bundle: Use the more conventional suffix '.bundle'
Santi Béjar [Sat, 7 Feb 2009 22:21:49 +0000 (23:21 +0100)]
doc/bundle: Use the more conventional suffix '.bundle'

Although it does not matter in general it is handled different by
"git clone", as it removes it to make the "humanish" name of the
new repository.

Signed-off-by: Santi Béjar <santi@agolina.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoAdd two extra tests for git rebase
Johannes Schindelin [Mon, 9 Feb 2009 05:40:42 +0000 (21:40 -0800)]
Add two extra tests for git rebase

15 years agoDocumentation: clarify commits affected by gitk --merge
Sitaram Chamarty [Fri, 6 Feb 2009 04:40:53 +0000 (10:10 +0530)]
Documentation: clarify commits affected by gitk --merge

Signed-off-by: Sitaram Chamarty <sitaramc@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoadd -p: get rid of Git.pm warnings about unitialized values
Stephan Beyer [Sun, 8 Feb 2009 17:40:39 +0000 (18:40 +0100)]
add -p: get rid of Git.pm warnings about unitialized values

After invoking git add -p I always got the warnings:

 Use of uninitialized value $_[3] in exec at Git.pm line 1282.
 Use of uninitialized value $args[2] in join or string at Git.pm line 1264.

A bisect showed that these warnings occur in a301973 "add -p: print errors
in separate color" the first time.

They can be reproduced by setting color.ui (or color.interactive) to "auto"
and unsetting color.interactive.help and color.interactive.error.
I am using Perl 5.10.0.

The reason of the warning is that color.interactive.error defaults to
color.interactive.help which defaults to nothing in the specific codepath.
It defaults to 'red bold' some lines above which could lead to the wrong
assumption that it always defaults to 'red bold' now.

This patch lets it default to 'red bold', blowing the warnings away.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Acked-By: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agorev-list: fix showing distance when using --bisect-all
Christian Couder [Sun, 8 Feb 2009 14:54:47 +0000 (15:54 +0100)]
rev-list: fix showing distance when using --bisect-all

Before d467a52 ("Make '--decorate' set an explicit 'show_decorations'
flag", Nov 3 2008), commit decorations were shown whenever they exist, and
distances stored in them by "git rev-list --bisect-all" were automatically
shown.  d467a52 changed the rule so that commit decorations are not shown
unless rev_info explicitly asks to, with its show_decorations bit, but
forgot that the ones "git rev-list --bisect-all" adds need to be shown.

This patch fixes this old breakage.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoGIT 1.6.2-rc0 v1.6.2-rc0
Junio C Hamano [Sat, 7 Feb 2009 19:06:34 +0000 (11:06 -0800)]
GIT 1.6.2-rc0

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'tr/add-p-single'
Junio C Hamano [Sat, 7 Feb 2009 19:10:16 +0000 (11:10 -0800)]
Merge branch 'tr/add-p-single'

* tr/add-p-single:
  add -p: import Term::ReadKey with 'require'
  add -p: print errors in separate color
  add -p: prompt for single characters

15 years agoMerge branch 'js/filter-branch-submodule'
Junio C Hamano [Sat, 7 Feb 2009 19:09:48 +0000 (11:09 -0800)]
Merge branch 'js/filter-branch-submodule'

* js/filter-branch-submodule:
  filter-branch: do not consider diverging submodules a 'dirty worktree'
  filter-branch: Fix fatal error on bare repositories

15 years agoMerge branch 'maint'
Junio C Hamano [Sat, 7 Feb 2009 18:44:25 +0000 (10:44 -0800)]
Merge branch 'maint'

* maint:
  GIT 1.6.1.3

Conflicts:
GIT-VERSION-GEN
RelNotes

15 years agoemacs: Remove the no longer maintained vc-git package.
Alexandre Julliard [Sat, 7 Feb 2009 13:24:54 +0000 (14:24 +0100)]
emacs: Remove the no longer maintained vc-git package.

vc-git is distributed with Emacs since version 22.2, and is maintained
in the Emacs CVS tree. This file is obsolete and causes trouble for
people who want to add contrib/emacs to their load-path.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
15 years agogit.el: Add some notes about Emacs versions compatibility.
Alexandre Julliard [Sat, 7 Feb 2009 13:21:58 +0000 (14:21 +0100)]
git.el: Add some notes about Emacs versions compatibility.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
15 years agogit.el: Use integer instead of character constants in case statement.
Alexandre Julliard [Sat, 7 Feb 2009 13:01:26 +0000 (14:01 +0100)]
git.el: Use integer instead of character constants in case statement.

This is for compatibility with XEmacs. Reported by Vassili Karpov.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
15 years agogit.el: Set a regexp for paragraph-separate in log-edit mode.
Alexandre Julliard [Tue, 27 Jan 2009 10:59:54 +0000 (11:59 +0100)]
git.el: Set a regexp for paragraph-separate in log-edit mode.

This allows using fill-paragraph on the log message without
interference from the various header fields.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
15 years agogit.el: Make git-run-command-region display the error if any.
Alexandre Julliard [Sun, 23 Nov 2008 15:12:45 +0000 (16:12 +0100)]
git.el: Make git-run-command-region display the error if any.

This makes it easier to figure out why a commit has failed.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
15 years agogit.el: Add commands for cherry-pick and revert.
Alexandre Julliard [Sun, 23 Nov 2008 13:34:48 +0000 (14:34 +0100)]
git.el: Add commands for cherry-pick and revert.

Support for cherry-picking and reverting commits, with automatic
formatting of the commit log message. Bound to C-c C-p and C-c C-v
respectively.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
15 years agogit.el: Add a command to create a new branch.
Alexandre Julliard [Sun, 23 Nov 2008 13:25:50 +0000 (14:25 +0100)]
git.el: Add a command to create a new branch.

Prompts for a branch name, create a new branch at HEAD and switch to
it. Bound to C-c C-b by default.

Based on a patch by Rémi Vanicat <vanicat@debian.org>.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
15 years agogit.el: Add a checkout command.
Alexandre Julliard [Sun, 23 Nov 2008 13:16:22 +0000 (14:16 +0100)]
git.el: Add a checkout command.

Prompts for a branch name and checks it out. Bound to C-c C-o by
default.

Based on a patch by Rémi Vanicat <vanicat@debian.org>.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
15 years agoGIT 1.6.1.3 v1.6.1.3
Junio C Hamano [Sat, 7 Feb 2009 08:51:47 +0000 (00:51 -0800)]
GIT 1.6.1.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoadd -p: import Term::ReadKey with 'require'
Thomas Rast [Fri, 6 Feb 2009 19:30:01 +0000 (20:30 +0100)]
add -p: import Term::ReadKey with 'require'

eval{use...} is no good because the 'use' is evaluated at compile
time, so manually 'require' it.  We need to forward declare the
functions we use, otherwise Perl raises a compilation error.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'js/maint-remote-remove-mirror'
Junio C Hamano [Fri, 6 Feb 2009 03:40:41 +0000 (19:40 -0800)]
Merge branch 'js/maint-remote-remove-mirror'

* js/maint-remote-remove-mirror:
  builtin-remote: make rm operation safer in mirrored repository
  builtin-remote: make rm() use properly named variable to hold return value

15 years agoMerge branch 'js/notes'
Junio C Hamano [Fri, 6 Feb 2009 03:40:39 +0000 (19:40 -0800)]
Merge branch 'js/notes'

* js/notes:
  git-notes: fix printing of multi-line notes
  notes: fix core.notesRef documentation
  Add an expensive test for git-notes
  Speed up git notes lookup
  Add a script to edit/inspect notes
  Introduce commit notes

Conflicts:
pretty.c

15 years agoMerge branch 'jc/refuse-push-to-current'
Junio C Hamano [Fri, 6 Feb 2009 03:40:36 +0000 (19:40 -0800)]
Merge branch 'jc/refuse-push-to-current'

* jc/refuse-push-to-current:
  receive-pack: explain what to do when push updates the current branch

15 years agoMerge branch 'rc/http-push'
Junio C Hamano [Fri, 6 Feb 2009 03:40:36 +0000 (19:40 -0800)]
Merge branch 'rc/http-push'

* rc/http-push:
  http-push: wrap signature of get_remote_object_url
  http-push: add back underscore separator before lock token
  http-push.c: get_remote_object_url() is only used under USE_CURL_MULTI
  http-push: refactor request url creation

15 years agoMerge branch 'gt/utf8-width'
Junio C Hamano [Fri, 6 Feb 2009 03:40:35 +0000 (19:40 -0800)]
Merge branch 'gt/utf8-width'

* gt/utf8-width:
  builtin-blame.c: Use utf8_strwidth for author's names
  utf8: add utf8_strwidth()

15 years agoMerge branch 'jk/head-symref'
Junio C Hamano [Fri, 6 Feb 2009 03:40:35 +0000 (19:40 -0800)]
Merge branch 'jk/head-symref'

* jk/head-symref:
  symbolic ref: refuse non-ref targets in HEAD
  validate_headref: tighten ref-matching to just branches

15 years agoMerge branch 'cb/mergetool'
Junio C Hamano [Fri, 6 Feb 2009 03:40:35 +0000 (19:40 -0800)]
Merge branch 'cb/mergetool'

* cb/mergetool:
  mergetool: fix running mergetool in sub-directories
  mergetool: Add a test for running mergetool in a sub-directory
  mergetool: respect autocrlf by using checkout-index

15 years agoMerge branch 'maint'
Junio C Hamano [Fri, 6 Feb 2009 03:40:25 +0000 (19:40 -0800)]
Merge branch 'maint'

* maint:
  Fixed broken git help -w when installing from RPM

15 years agoMerge branch 'maint-1.6.0' into maint
Junio C Hamano [Fri, 6 Feb 2009 03:38:58 +0000 (19:38 -0800)]
Merge branch 'maint-1.6.0' into maint

* maint-1.6.0:
  Fixed broken git help -w when installing from RPM

15 years agoMerge branch 'jc/maint-apply-fix' into maint
Junio C Hamano [Fri, 6 Feb 2009 02:06:11 +0000 (18:06 -0800)]
Merge branch 'jc/maint-apply-fix' into maint

* jc/maint-apply-fix:
  builtin-apply.c: do not set bogus mode in check_preimage() for deleted path

15 years agoMerge branch 'am/maint-push-doc' into maint
Junio C Hamano [Fri, 6 Feb 2009 02:06:03 +0000 (18:06 -0800)]
Merge branch 'am/maint-push-doc' into maint

* am/maint-push-doc:
  Documentation: rework src/dst description in git push
  Documentation: more git push examples
  Documentation: simplify refspec format description

15 years agoMerge branch 'sg/maint-gitdir-in-subdir' into maint
Junio C Hamano [Fri, 6 Feb 2009 02:05:43 +0000 (18:05 -0800)]
Merge branch 'sg/maint-gitdir-in-subdir' into maint

* sg/maint-gitdir-in-subdir:
  Fix gitdir detection when in subdir of gitdir

15 years agoMerge branch 'lt/maint-wrap-zlib' into maint
Junio C Hamano [Fri, 6 Feb 2009 02:01:00 +0000 (18:01 -0800)]
Merge branch 'lt/maint-wrap-zlib' into maint

* lt/maint-wrap-zlib:
  Wrap inflate and other zlib routines for better error reporting

Conflicts:
http-push.c
http-walker.c
sha1_file.c

15 years agoMerge branch 'jc/maint-split-diff-metainfo' into maint
Junio C Hamano [Fri, 6 Feb 2009 01:54:17 +0000 (17:54 -0800)]
Merge branch 'jc/maint-split-diff-metainfo' into maint

* jc/maint-split-diff-metainfo:
  diff.c: output correct index lines for a split diff

15 years agoMerge branch 'js/maint-all-implies-HEAD' into maint
Junio C Hamano [Fri, 6 Feb 2009 01:54:12 +0000 (17:54 -0800)]
Merge branch 'js/maint-all-implies-HEAD' into maint

* js/maint-all-implies-HEAD:
  bundle: allow the same ref to be given more than once
  revision walker: include a detached HEAD in --all

15 years agoMerge branch 'kc/maint-diff-bwi-fix' into maint
Junio C Hamano [Fri, 6 Feb 2009 01:52:22 +0000 (17:52 -0800)]
Merge branch 'kc/maint-diff-bwi-fix' into maint

* kc/maint-diff-bwi-fix:
  Fix combined use of whitespace ignore options to diff
  test more combinations of ignore-whitespace options to diff

15 years agofilter-branch: do not consider diverging submodules a 'dirty worktree'
Johannes Schindelin [Thu, 5 Feb 2009 18:19:33 +0000 (19:19 +0100)]
filter-branch: do not consider diverging submodules a 'dirty worktree'

At the end of filter-branch in a non-bare repository, the work tree is
updated with "read-tree -m -u HEAD", to carry the change forward in case
the current branch was rewritten.  In order to avoid losing any local
change during this step, filter-branch refuses to work when there are
local changes in the work tree.

This "read-tree -m -u HEAD" operation does not affect what commit is
checked out in a submodule (iow, it does not touch .git/HEAD in a
submodule checkout), and checking if there is any local change to the
submodule is not useful.

Staged submodules _are_ considered to be 'dirty', however,  as the
"read-tree -m -u HEAD" could result in loss of staged information
otherwise.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoadd -p: print errors in separate color
Thomas Rast [Thu, 5 Feb 2009 08:28:27 +0000 (09:28 +0100)]
add -p: print errors in separate color

Print interaction error messages in color.interactive.error, which
defaults to the value of color.interactive.help.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoadd -p: prompt for single characters
Thomas Rast [Thu, 5 Feb 2009 08:28:26 +0000 (09:28 +0100)]
add -p: prompt for single characters

Use Term::ReadKey, if available and enabled with interactive.singlekey,
to let the user answer add -p's prompts by pressing a single key.  We're
not doing the same in the main 'add -i' interface because file selection
etc. may expect several characters.

Two commands take an argument: 'g' can easily cope since it'll just
offer a choice of chunks.  '/' now (unconditionally, even without
readkey) offers a chance to enter a regex if none was given.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMakefile: minor improvements for Mac OS X (Darwin)
Jay Soffian [Thu, 5 Feb 2009 06:09:08 +0000 (01:09 -0500)]
Makefile: minor improvements for Mac OS X (Darwin)

1) Instead of requesting OLD_ICONV on all Mac OS X versions except for 10.5
(which will break when 10.6 is released), exlicitly request it for versions
older than 10.5.

2) NO_STRLCPY is not needed since Mac OS X 10.2. Noticed by Benjamin Kramer.

Note that uname -r returns the underlying Darwin version, which can be mapped
to Mac OS X version at http://www.opensource.apple.com/darwinsource/

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoconfig.mak.in: define paths without trailing slash
Pascal Obry [Thu, 5 Feb 2009 07:37:24 +0000 (08:37 +0100)]
config.mak.in: define paths without trailing slash

The main Makefile defines gitexecdir and template_dir without trailing
slash.  config.mak.in should do the same to be consistent.

Signed-off-by: Pascal Obry <pascal@obry.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMakefile: fix misdetection of relative pathnames
Junio C Hamano [Thu, 5 Feb 2009 08:04:17 +0000 (00:04 -0800)]
Makefile: fix misdetection of relative pathnames

The installation rules wanted to differentiate between a template_dir that
is given as an absolute path (e.g. /usr/share/git-core/templates) and a
relative one (e.g. share/git-core/templates) but it was done by checking
if $(abspath $(template_dir)) and $(template_dir) yield the same string.

This was wrong in at least two ways.

 * The user can give template_dir with a trailing slash from the command
   line to invoke make or from the included config.mak.  A directory path
   ought to mean the same thing with or without such a trailing slash but
   use of $(abspath) means an absolute path with a trailing slash fails
   the test.

 * Versions of GNU make older than 3.81 do not have $(abspath) to begin
   with.

This changes the detection logic to see if the given path begins with a
slash.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoFixed broken git help -w when installing from RPM
David J. Mellor [Thu, 5 Feb 2009 04:14:29 +0000 (20:14 -0800)]
Fixed broken git help -w when installing from RPM

After the git-core package was renamed to git, git help -w was still looking
for files in /usr/share/doc/git-core-$VERSION instead of
/usr/share/doc/git-$VERSION.

Signed-off-by: David J. Mellor <dmellor@whistlingcat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'jc/fsck' (early part)
Junio C Hamano [Thu, 5 Feb 2009 00:40:15 +0000 (16:40 -0800)]
Merge branch 'jc/fsck' (early part)

* 'jc/fsck' (early part):
  fsck: check loose objects from alternate object stores by default
  fsck: HEAD is part of refs

15 years agobuiltin-blame.c: Use utf8_strwidth for author's names
Geoffrey Thomas [Fri, 30 Jan 2009 09:41:29 +0000 (04:41 -0500)]
builtin-blame.c: Use utf8_strwidth for author's names

git blame misaligns output if a author's name has a differing display width and
strlen; for instance, an accented Latin letter that takes two bytes to encode
will cause the rest of the line to be shifted to the left by one. To fix this,
use utf8_strwidth instead of strlen (and compute the padding ourselves, since
printf doesn't know about UTF-8).

Signed-off-by: Geoffrey Thomas <geofft@mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoutf8: add utf8_strwidth()
Geoffrey Thomas [Fri, 30 Jan 2009 09:41:28 +0000 (04:41 -0500)]
utf8: add utf8_strwidth()

I'm about to use this pattern more than once, so make it a common function.

Signed-off-by: Geoffrey Thomas <geofft@mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-bundle doc: update examples
Nanako Shiraishi [Wed, 4 Feb 2009 09:15:29 +0000 (18:15 +0900)]
git-bundle doc: update examples

This rewrites the example part of the bundle doucmentation to follow
the suggestion made by Junio during a recent discussion (gmane 108030).

Instead of just showing different ways to create and use bundles in a
disconnected fashion, the rewritten example first shows the simplest
"full cycle" of sneakernet workflow, and then introduces various
variations.

The words are mostly taken from Junio's outline. I only reformatted
them and proofread to make sure the end result flows naturally.

Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoReplace deprecated dashed git commands in usage
Alexander Potashev [Sun, 4 Jan 2009 18:39:27 +0000 (21:39 +0300)]
Replace deprecated dashed git commands in usage

Signed-off-by: Alexander Potashev <aspotashev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-show-branch doc: show -g as synonym to --reflog in the list
jidanni@jidanni.org [Tue, 6 Jan 2009 03:14:02 +0000 (11:14 +0800)]
git-show-branch doc: show -g as synonym to --reflog in the list

Signed-off-by: jidanni <jidanni@jidanni.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agocontrib git-resurrect: find traces of a branch name and resurrect it
Thomas Rast [Wed, 4 Feb 2009 10:04:18 +0000 (11:04 +0100)]
contrib git-resurrect: find traces of a branch name and resurrect it

Add a tool 'git-resurrect.sh <branch>' that tries to find traces of
the <branch> in the HEAD reflog and, optionally, all merge commits in
the repository.  It can then resurrect the branch, pointing it at the
most recent of all candidate commits found.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint'
Junio C Hamano [Wed, 4 Feb 2009 21:07:09 +0000 (13:07 -0800)]
Merge branch 'maint'

* maint:
  urls.txt: document optional port specification in git URLS
  builtin-mv.c: check for unversionned files before looking at the destination.
  Add a testcase for "git mv -f" on untracked files.
  Missing && in t/t7001.sh.

15 years agoMerge branch 'wp/add-patch-find'
Junio C Hamano [Wed, 4 Feb 2009 21:07:06 +0000 (13:07 -0800)]
Merge branch 'wp/add-patch-find'

* wp/add-patch-find:
  add -p: trap Ctrl-D in 'goto' mode
  add -p: change prompt separator for 'g'
  In add --patch, Handle K,k,J,j slightly more gracefully.
  Add / command in add --patch
  git-add -i/-p: Change prompt separater from slash to comma

15 years agoMerge branch 'ns/am-slacker'
Junio C Hamano [Wed, 4 Feb 2009 21:07:02 +0000 (13:07 -0800)]
Merge branch 'ns/am-slacker'

* ns/am-slacker:
  git-am: Add --ignore-date option
  am: Add --committer-date-is-author-date option

Conflicts:
git-am.sh

15 years agourls.txt: document optional port specification in git URLS
Stefan Naewe [Wed, 4 Feb 2009 20:49:35 +0000 (21:49 +0100)]
urls.txt: document optional port specification in git URLS

Signed-off-by: Stefan Naewe <stefan.naewe+git@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint-1.6.0' into maint
Junio C Hamano [Wed, 4 Feb 2009 19:49:07 +0000 (11:49 -0800)]
Merge branch 'maint-1.6.0' into maint

* maint-1.6.0:
  builtin-mv.c: check for unversionned files before looking at the destination.
  Add a testcase for "git mv -f" on untracked files.
  Missing && in t/t7001.sh.

15 years agobuiltin-mv.c: check for unversionned files before looking at the destination.
Matthieu Moy [Wed, 4 Feb 2009 09:32:08 +0000 (10:32 +0100)]
builtin-mv.c: check for unversionned files before looking at the destination.

The previous code was failing in the case where one moves an
unversionned file to an existing destination, with mv -f: the
"existing destination" was checked first, and the error was cancelled
by the force flag.

We now check the unrecoverable error first, which fixes the bug.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoAdd a testcase for "git mv -f" on untracked files.
Matthieu Moy [Wed, 4 Feb 2009 09:32:07 +0000 (10:32 +0100)]
Add a testcase for "git mv -f" on untracked files.

This currently fails with:
git: builtin-mv.c:217: cmd_mv: Assertion `pos >= 0' failed.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMissing && in t/t7001.sh.
Matthieu Moy [Wed, 4 Feb 2009 09:32:06 +0000 (10:32 +0100)]
Missing && in t/t7001.sh.

Without this, the exit status is only the one of the last line.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobuiltin-remote: make rm operation safer in mirrored repository
Jay Soffian [Wed, 4 Feb 2009 16:06:07 +0000 (11:06 -0500)]
builtin-remote: make rm operation safer in mirrored repository

"git remote rm <repo>" happily removes non-remote refs and their reflogs.
This may be okay if the repository truely is a mirror, but if the user
had done "git remote add --mirror <repo>" by accident and was just
undoing their mistake, then they are left in a situation that is
difficult to recover from.

After this commit, "git remote rm" skips over non-remote refs. The user
is advised on how remove branches using "git branch -d", which itself
has nice safety checks wrt to branch removal lacking from "git remote rm".
Non-remote non-branch refs are skipped silently.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoadd -p: trap Ctrl-D in 'goto' mode
Thomas Rast [Mon, 2 Feb 2009 21:46:29 +0000 (22:46 +0100)]
add -p: trap Ctrl-D in 'goto' mode

If the user hit Ctrl-D (EOF) while the script was in 'go to hunk?'
mode, it threw an undefined variable error.  Explicitly test for EOF
and have it re-enter the goto prompt loop.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoadd -p: change prompt separator for 'g'
Thomas Rast [Mon, 2 Feb 2009 21:46:28 +0000 (22:46 +0100)]
add -p: change prompt separator for 'g'

57886bc (git-add -i/-p: Change prompt separater from slash to comma,
2008-11-27) changed the prompt separator to ',', but forgot to adapt
the 'g' (goto) command.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint'
Junio C Hamano [Wed, 4 Feb 2009 08:12:19 +0000 (00:12 -0800)]
Merge branch 'maint'

* maint:
  User-manual: "git stash <comment>" form is long gone
  add test-dump-cache-tree in Makefile
  fix typo in Documentation
  apply: fix access to an uninitialized mode variable, found by valgrind

Conflicts:
Makefile

15 years agoMerge branch 'maint-1.6.0' into maint
Junio C Hamano [Wed, 4 Feb 2009 07:50:09 +0000 (23:50 -0800)]
Merge branch 'maint-1.6.0' into maint

* maint-1.6.0:
  User-manual: "git stash <comment>" form is long gone
  add test-dump-cache-tree in Makefile
  fix typo in Documentation
  apply: fix access to an uninitialized mode variable, found by valgrind

15 years agohttp-push: wrap signature of get_remote_object_url
Tay Ray Chuan [Tue, 3 Feb 2009 12:39:00 +0000 (20:39 +0800)]
http-push: wrap signature of get_remote_object_url

The signature of get_remote_object_url stands at 96 characters (as
pointed out by Dscho); this patch wraps it so that it conforms to the
80 characters guideline.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agohttp-push: add back underscore separator before lock token
Tay Ray Chuan [Tue, 3 Feb 2009 13:07:26 +0000 (21:07 +0800)]
http-push: add back underscore separator before lock token

817d14a (http-push: refactor request url creation, 2009-01-31) removed the
underscore separator between the object path and the appended lock token.

This patch adds it back.

This would be keeping in line with the aforementioned patch's objective
of refactoring, without changing the behaviour and effect, of the code.

This would also be useful for testing if the lock token has been
indeed appended to the object url.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoUser-manual: "git stash <comment>" form is long gone
William Pursell [Tue, 3 Feb 2009 22:41:14 +0000 (22:41 +0000)]
User-manual: "git stash <comment>" form is long gone

These days you must explicitly say "git stash save <comment>".

Signed-off-by: William Pursell <bill.pursell@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoadd test-dump-cache-tree in Makefile
Guanqun Lu [Wed, 4 Feb 2009 21:00:41 +0000 (05:00 +0800)]
add test-dump-cache-tree in Makefile

5c5ba73 (Makefile: Use generic rule to build test programs,
2007-05-31) tried to use generic rule to build test programs, but it
misses the file 'dump-cache-tree.c', since its name is not prefixed by
'test-'.  This commit solves this little problem by renaming this file
instead of carrying out an explicit rule in Makefile.

Signed-off-by: Guanqun Lu <guanqun.lu@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agofix typo in Documentation
Guanqun Lu [Wed, 4 Feb 2009 21:00:40 +0000 (05:00 +0800)]
fix typo in Documentation

Signed-off-by: Guanqun Lu <guanqun.lu@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobash: offer to show (un)staged changes
Thomas Rast [Tue, 3 Feb 2009 09:20:54 +0000 (10:20 +0100)]
bash: offer to show (un)staged changes

Add a bit of code to __git_ps1 that lets it append '*' to the branch
name if there are any unstaged changes, and '+' if there are any
staged changes.

Since this is a rather expensive operation and will force a lot of
data into the cache whenever you first enter a repository, you have to
enable it manually by setting GIT_PS1_SHOWDIRTYSTATE to a nonempty
value.  The configuration variable bash.showDirtyState can then be
used to disable it again for some repositories.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoapply: fix access to an uninitialized mode variable, found by valgrind
Johannes Schindelin [Wed, 4 Feb 2009 01:50:15 +0000 (02:50 +0100)]
apply: fix access to an uninitialized mode variable, found by valgrind

When 'tpatch' was initialized successfully, st_mode was already taken
from the previous diff.  We should not try to override it with data
from an lstat() that was never called.

This is a companion patch to 7a07841(git-apply: handle a patch that
touches the same path more than once better).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agofilter-branch: Fix fatal error on bare repositories
Eric Kidd [Tue, 3 Feb 2009 18:27:03 +0000 (13:27 -0500)]
filter-branch: Fix fatal error on bare repositories

When git filter-branch is run on a bare repository, it prints out a fatal
error message:

  $ git filter-branch branch
  Rewrite 476c4839280c219c2317376b661d9d95c1727fc3 (9/9)
  WARNING: Ref 'refs/heads/branch' is unchanged
  fatal: This operation must be run in a work tree

Note that this fatal error message doesn't prevent git filter-branch from
exiting successfully. (Why doesn't git filter-branch actually exit with an
error when a shell command fails? I'm not sure why it was designed this
way.)

This error message is caused by the following section of code at the end of
git-filter-branch.sh:

  if [ "$(is_bare_repository)" = false ]; then
          unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE
          test -z "$ORIG_GIT_DIR" || {
                  GIT_DIR="$ORIG_GIT_DIR" && export GIT_DIR
          }
          ... elided ...
          git read-tree -u -m HEAD
  fi

The problem is the call to $(is_bare_repository), which is made before
GIT_DIR and GIT_WORK_TREE are restored.  This call always returns "false",
even when we're running in a bare repository.  But this means that we will
attempt to call 'git read-tree' even in a bare repository, which will fail
and print an error.

This patch modifies git-filter-branch.sh to restore the original
environment variables before trying to call is_bare_repository.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agotests: fix test_commit() for case insensitive filesystems
Junio C Hamano [Wed, 4 Feb 2009 05:46:33 +0000 (21:46 -0800)]
tests: fix test_commit() for case insensitive filesystems

Brian Gernhardt noticed that t3411 was broken recently on case insensitive
filesystems.

0088496 (test-lib.sh: introduce test_commit() and test_merge() helpers,
2009-01-27) used a tag and a file with the same name, only different in
case, and converted many existing tests that needed only a file (or a
tag).

Some tests may want to refer to a rev or a file, but on a filesystem that
loses cases, referring to either without disambiguation mark ("--") on the
command line now triggers an error (t3411 was the only one such test).

Fix it by using a filename that is different from the tagname each step
creates.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobuiltin-remote: make rm() use properly named variable to hold return value
Jay Soffian [Tue, 3 Feb 2009 17:51:12 +0000 (12:51 -0500)]
builtin-remote: make rm() use properly named variable to hold return value

"i" is a loop counter and should not be used to hold a return value; use
"result" instead which is consistent with the rest of builtin-remote.c.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agot3412: further simplify setting of GIT_EDITOR
Junio C Hamano [Wed, 4 Feb 2009 05:07:07 +0000 (21:07 -0800)]
t3412: further simplify setting of GIT_EDITOR

2182896 (t3412: clean up GIT_EDITOR usage, 2009-01-30) tried to clean up
the script's use of GIT_EDITOR, but it can further be simplified, because
that is how test-lib.sh sets things up already.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoreceive-pack: explain what to do when push updates the current branch
Junio C Hamano [Sun, 1 Feb 2009 01:34:05 +0000 (17:34 -0800)]
receive-pack: explain what to do when push updates the current branch

This makes "git push" issue a more detailed instruction when a user pushes
into the current branch of a non-bare repository without having an
explicit configuration set to receive.denycurrentbranch.  In such a case,
it will also tell the user that the default will change to refusal in a
future version of git.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint'
Junio C Hamano [Tue, 3 Feb 2009 08:32:34 +0000 (00:32 -0800)]
Merge branch 'maint'

* maint:
  grep: pass -I (ignore binary) down to external grep

15 years agoMerge branch 'maint-1.6.0' into maint
Junio C Hamano [Tue, 3 Feb 2009 08:32:29 +0000 (00:32 -0800)]
Merge branch 'maint-1.6.0' into maint

* maint-1.6.0:
  grep: pass -I (ignore binary) down to external grep

15 years agoMerge branch 'jc/maint-add-u-remove-conflicted'
Junio C Hamano [Tue, 3 Feb 2009 08:26:17 +0000 (00:26 -0800)]
Merge branch 'jc/maint-add-u-remove-conflicted'

* jc/maint-add-u-remove-conflicted:
  add -u: do not fail to resolve a path as deleted

15 years agoMerge branch 'jk/maint-cleanup-after-exec-failure'
Junio C Hamano [Tue, 3 Feb 2009 08:26:12 +0000 (00:26 -0800)]
Merge branch 'jk/maint-cleanup-after-exec-failure'

* jk/maint-cleanup-after-exec-failure:
  git: use run_command() to execute dashed externals
  run_command(): help callers distinguish errors
  run_command(): handle missing command errors more gracefully
  git: s/run_command/run_builtin/

15 years agohttp-push.c: get_remote_object_url() is only used under USE_CURL_MULTI
Junio C Hamano [Tue, 3 Feb 2009 06:24:40 +0000 (22:24 -0800)]
http-push.c: get_remote_object_url() is only used under USE_CURL_MULTI

Otherwise -Wunused-function (which is implied by -Wall) triggers.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogrep: pass -I (ignore binary) down to external grep
Junio C Hamano [Mon, 2 Feb 2009 18:58:20 +0000 (10:58 -0800)]
grep: pass -I (ignore binary) down to external grep

We forgot to pass this option to the external grep process.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoIn add --patch, Handle K,k,J,j slightly more gracefully.
William Pursell [Thu, 27 Nov 2008 04:08:03 +0000 (04:08 +0000)]
In add --patch, Handle K,k,J,j slightly more gracefully.

Instead of printing the help menu, this will print "No next hunk" and then
process the given hunk again.

Signed-off-by: William Pursell <bill.pursell@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoAdd / command in add --patch
William Pursell [Thu, 27 Nov 2008 04:07:57 +0000 (04:07 +0000)]
Add / command in add --patch

This command allows the user to skip hunks that don't match the specified
regex.

Signed-off-by: William Pursell <bill.pursell@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>