Commit graph

13902 commits

Author SHA1 Message Date
Junio C Hamano 2b459b483c diff: make sure work tree side is shown as 0{40} when different
Ping Yin noticed that "git diff-index --raw" shows 0{40} when work tree
has submodule difference, but "git diff --raw" didn't correctly do so.

There was a mistake in the diffcore_skip_stat_unmatch() that was meant to
clean up the stat-only difference for running diff between the index and
work tree and diff between the tree and the work tree, to cause it re-read
from the submodule repository HEAD.  When ce_stat_match() says work tree
is different, we should always say 0{40} on the work tree side.

This patch fixes the issue, and adds tests.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-02 01:08:34 -08:00
Junio C Hamano c8c16f2865 diff-lib.c: constness strengthening
The internal implementation of diff-index codepath used to use non const
pointer to pass sha1 around, but it did not have to.  With this, we can
also lose the private no_sha1[] array, as we can use the public null_sha1[]
array that exists exactly for the same purpose.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-02 01:00:30 -08:00
Junio C Hamano 2efb3b0617 Clean up find_unique_abbrev() callers
Now find_unique_abbrev() never returns NULL, there is no need for callers
to prepare for seeing NULL and fall back to giving the full 40-hexdigits.

While we are at it, drop "..." in the "git reset" output that reports the
location of the new HEAD, between the abbreviated commit object name and
the one line commit summary.  Because we are always showing the HEAD
(which cannot be missing!), we never had a case where we show the full 40
hexdigits that is not followed by three dots, and these three dots were
stealing 3 columns from the precious horizontal screen real estate out of
80 that can better be used for the one line commit summary.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-01 23:52:13 -08:00
Junio C Hamano b66fde9a28 find_unique_abbrev(): redefine semantics
The function returned NULL when no object that matches the name
was found, but that made the callers more complicated, as nobody
used that NULL return as an indication that no object with such
a name exists.  They (at least the careful ones) instead took
the full 40-hexdigit and used in such a case, and the careless
ones segfaulted.

With this "git rev-parse --short 5555555555555555555555555555555555555555"
would stop segfaulting.

This is based on Jeff King's rewrite to my RFC patch, but "missing"
logic swapped to "exists".  The final logic reads:

    For existing objects, make sure the abbreviated string uniquely
    identifies it.  Otherwise, make sure the abbreviated string is
    long enough so that it would not name any existing object.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-01 23:52:13 -08:00
Mike Hommey 48411d2233 git rebase --abort: always restore the right commit
Previously, --abort would end by git resetting to ORIG_HEAD, but some
commands, such as git reset --hard (which happened in git rebase --skip,
but could just as well be typed by the user), would have already modified
ORIG_HEAD.

Just use the orig-head we store in $dotest instead.

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-01 23:52:00 -08:00
Mike Hommey f32086becc Documentation/git-rebase.txt: Add --strategy to synopsys
Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-01 19:45:15 -08:00
Junio C Hamano 009c98ee17 CodingGuidelines: spell out how we use grep in our scripts
Our scripts try to stick to fairly limited subset of POSIX BRE for
portability.  It is unclear from manual page from GNU grep which is GNU
extension and which is portable, so let's spell it out to help new people
to keep their contributions from hurting porters.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-01 18:18:16 -08:00
Johannes Schindelin 4ebc914c88 builtin-remote: prune remotes correctly that were added with --mirror
This adds special handling for mirror remotes.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-01 01:51:44 -08:00
Johannes Schindelin 211c89682e Make git-remote a builtin
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-01 01:51:44 -08:00
Johannes Schindelin 4704640b61 Test "git remote show" and "git remote prune"
While at it, also fix a few instances where a cd was done outside of a
subshell.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-01 01:51:44 -08:00
Johannes Schindelin a0ec9d25d9 parseopt: add flag to stop on first non option
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-01 01:51:44 -08:00
Johannes Schindelin 363d59df1a path-list: add functions to work with unsorted lists
Up to now, path-lists were sorted at all times.  But sometimes it
is much more convenient to build the list and sort it at the end,
or sort it not at all.

Add path_list_append() and sort_path_list() to allow that.

Also, add the unsorted_path_list_has_path() function, to do a linear
search.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-01 01:51:44 -08:00
Nicolas Pitre 5f4347bba3 add storage size output to 'git verify-pack -v'
This can possibly break external scripts that depend on the previous
output, but those script can't possibly be critical to Git usage, and
fixing them should be trivial.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-01 01:44:46 -08:00
Nicolas Pitre 70f5d5d31c fix unimplemented packed_object_info_detail() features
Since commit eb32d236df, there was a TODO
comment in packed_object_info_detail() about the SHA1 of base object to
OBJ_OFS_DELTA objects.  So here it is at last.

While at it, providing the actual storage size information as well is now
trivial.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-01 01:44:46 -08:00
Nicolas Pitre 340814636d make verify_one_pack() a bit less wrong wrt packed_git structure
Simply freeing it is wrong.  There are many things attached to this
structure that are not cleaned up.  In practice this doesn't matter much
since this happens just before the program exits, but it is still
a bit more "correct" to leak it implicitly rather than explicitly.

And therefore it is also a good idea to register it with
install_packed_git().  Not only might it have better chance of being
properly cleaned up if such functionality is implemented for the general
case, but some functions like init_revindex() expect all packed_git
instances to be globally accessible.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-01 01:44:45 -08:00
Nicolas Pitre 3449f8c4cb factorize revindex code out of builtin-pack-objects.c
No functional change. This is needed to fix verify-pack in a later patch.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-01 01:44:45 -08:00
Jeff King c14918415a allow git-am to run in a subdirectory
We just move to the top of the tree and proceed. This
shouldn't break any existing callers, since the behavior was
previously disallowed.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-01 01:31:18 -08:00
Jeff King ee542ee3fc rename: warn user when we have turned off rename detection
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-01 01:30:15 -08:00
Mike Hommey 3ebfe63a82 Add test for git rebase --abort
We expect git rebase --abort to come back to the original (pre-rebase)
head, independently from when it's run during a rebase.

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-01 01:15:32 -08:00
Junio C Hamano c3b088d9da t6024: move "git reset" to prepare for a test inside the test itself
Noticed by Mike Hommey.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-01 01:10:12 -08:00
Frank Lichtenheld a0c14cbb2e gc: Add --quiet option
Pass -q option to git-repack.

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-01 01:09:06 -08:00
Philippe Bruhat (BooK 3c832a78b1 cvsimport: document that -M can be used multiple times
Also document the capture behaviour (source branch name in $1)

Signed-off-by: Philippe Bruhat (BooK) <book@cpan.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-01 00:55:39 -08:00
Philippe Bruhat (BooK bc434e829c cvsimport: allow for multiple -M options
Use Getopt::Long instead of Getopt::Std to handle multiple -M options,
for all the cases when having a single custom regex is not enough.

Signed-off-by: Philippe Bruhat (BooK) <book@cpan.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-01 00:55:38 -08:00
Philippe Bruhat (BooK fbbbc362ab cvsimport: have default merge regex allow for dashes in the branch name
The default value of @mergerx uses \w, which matches word
character; a branch name like policy-20050608-br will not be
matched.

Signed-off-by: Philippe Bruhat (BooK) <book@cpan.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-01 00:55:38 -08:00
Junio C Hamano dfb9a34aba Merge branch 'master' of git://repo.or.cz/git-gui
* 'master' of git://repo.or.cz/git-gui:
  git-gui: fix typo in lib/spellcheck.tcl
  git-gui: Shorten Aspell version strings to just Aspell version number
  git-gui: Gracefully display non-aspell version errors to users
  git-gui: Catch and display aspell startup failures to the user
  git-gui: Only bind the spellcheck popup suggestion hook once
  git-gui: Remove explicit references to 'aspell' in message strings
  git-gui: Ensure all spellchecker 'class' variables are initialized
  git-gui: Update German translation.
  git-gui: (i18n) Add newly added translation strings to template.
2008-02-29 21:22:52 -08:00
Junio C Hamano df4a824341 Merge branch 'maint'
* maint:
  Documentation cherry-pick: Fix cut-and-paste error
  git.el: find the git-status buffer whatever its name is
  git-gui: Paper bag fix info dialog when no files are staged at commit
2008-02-29 21:22:31 -08:00
Mike Ralphson 84989bd820 Documentation cherry-pick: Fix cut-and-paste error
Signed-off-by: Mike Ralphson <mike@abacus.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-29 21:22:22 -08:00
Rémi Vanicat a1eebfb3a9 git.el: find the git-status buffer whatever its name is
git-status used the buffer name to find git-status buffers, and that
can fail if the buffer has another name, for example when multiple
working directories is tracked.

Signed-off-by: Rémi Vanicat <vanicat@debian.org>
Acked-by: Alexandre Julliard <julliard@winehq.org>
Tested-by: Xavier Maillard <xma@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-29 21:22:18 -08:00
Junio C Hamano f1a8cc6354 Merge branch 'maint' of git://repo.or.cz/git-gui into maint
* 'maint' of git://repo.or.cz/git-gui:
  git-gui: Paper bag fix info dialog when no files are staged at commit
2008-02-29 21:19:43 -08:00
Santi Béjar c6fef0bbea clone: support cloning full bundles
The "humanish" part of a bundle is made removing the ".bundle" suffix.

Signed-off-by: Santi Béjar <sbejar@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-29 16:27:25 -08:00
Junio C Hamano 97b97c58e6 Update draft release notes for 1.5.5
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-29 00:12:44 -08:00
Junio C Hamano 7435982102 tests: introduce test_must_fail
When we expect a git command to notice and signal errors, we
carelessly wrote in our tests:

    test_expect_success 'reject bogus request' '
        do something &&
        do something else &&
        ! git command
    '

but a non-zero exit could come from the "git command" segfaulting.

A new helper function "tset_must_fail" is introduced and it is
meant to be used to make sure the command gracefully fails (iow,
dying and exiting with non zero status is counted as a failure
to "gracefully fail").  The above example should be written as:

    test_expect_success 'reject bogus request' '
        do something &&
        do something else &&
        test_must_fail git command
    '

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-29 00:00:29 -08:00
Jeff King 7cf7f54a65 use build-time SHELL_PATH in test scripts
The top-level Makefile now creates a GIT-BUILD-OPTIONS file
which stores any options selected by the make process that
may be of use to further parts of the build process.
Specifically, we store the SHELL_PATH so that it can be used
by tests to construct shell scripts on the fly.

The format of the GIT-BUILD-OPTIONS file is Bourne shell,
and it is sourced by test-lib.sh; all tests can rely on just
having $SHELL_PATH correctly set in the environment.

The GIT-BUILD-OPTIONS file is written every time the
toplevel 'make' is invoked. Since the only users right now
are the test scripts, there's no drawback to updating its
timestamp. If something build-related depends on this, we
can do a trick similar to the one used by GIT-CFLAGS.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-29 00:00:29 -08:00
Alex Riesen 301e42edc3 Fix builtin checkout crashing when given an invalid path
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-29 00:00:29 -08:00
Daniel Barkalow 75336878c7 Write index file on any checkout of files
We need to rewrite the index file when we check out files, even if we
haven't modified the blob info by reading from another tree, so that
we get the stat cache to include the fact that we just modified the
file so it doesn't need to be refreshed.

While we're at it, move everything that needs to be done to check out
some paths from a tree (or the current index) into checkout_paths().

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-29 00:00:29 -08:00
Uwe Kleine-König a5aa930d50 rev-list: add --branches, --tags and --remotes
These flags are already known to rev-parse and have the same meaning.

This patch allows to run gitk as follows:

	gitk --branches --not --remotes

to show only your local work.

Signed-off-by: Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-29 00:00:29 -08:00
Miklos Vajna 419e38337a Improve t6029 to check the real "subtree" case
t6029 already checks if subtree available and works like recursive. This
patch adds code to test test the extra functionality the subtree merge
strategy provides.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-29 00:00:29 -08:00
Daniel Barkalow 39fe578bdc Use diff_tree() directly in making cover letter
Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-29 00:00:29 -08:00
Daniel Barkalow 00183cbb3d Always use the current connection's remote ref list in git protocol
We always report to the user the list of refs we got from the first
connection, even if we do multiple connections. But we should always
use each connection's own list of refs in the communication with the
server, in case we got a different server out of DNS rotation or the
timing was surprising or something.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-29 00:00:29 -08:00
Junio C Hamano 25c4f61c51 Merge branch 'maint'
* maint:
  templates/Makefile: don't depend on local umask setting
  Correct name of diff_flush() in API documentation
  Start preparing for 1.5.4.4

Conflicts:

	RelNotes
2008-02-29 00:00:09 -08:00
Martin Koegler 28f72a0f23 receive-pack: use strict mode for unpacking objects
Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-28 21:56:12 -08:00
Martin Koegler 0153be05ae index-pack: introduce checking mode
Adds strict option, which bails out if the pack would
introduces broken object or links in the repository.

Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-28 21:56:02 -08:00
Martin Koegler d5ef408b9a unpack-objects: prevent writing of inconsistent objects
This patch introduces a strict mode, which ensures that:
- no malformed object will be written
- no object with broken links will be written

The patch ensures this by delaying the write of all non blob object.
These object are written, after all objects they link to are written.

An error can only result in unreferenced objects.

Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-28 21:55:26 -08:00
Martin Koegler 2add1e6db4 unpack-object: cache for non written objects
Preventing objects with broken links entering the repository
means, that write of some objects must be delayed.

This patch adds a cache to keep the object data in memory. The delta
resolving code must also search in the cache.

Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-28 21:54:14 -08:00
Shawn O. Pearce 212945d4a8 Teach git-describe to verify annotated tag names before output
If an annotated tag describes a commit we want to favor the name
listed in the body of the tag, rather than whatever name it has
been stored under locally.  By doing so it is easier to converse
about tags with others, even if the tags happen to be fetched to
a different name than it was given by its creator.

To avoid confusion when a tag is stored under a different name
(and thus is not readable via git-rev-parse --verify, etc.) we show
a warning message if the name of the tag does not match the ref
we found it under and if that tag was also selected for output.
For example:

  $ git tag -a -m "i am a test" testtag
  $ mv .git/refs/tags/testtag .git/refs/tags/bobbytag

  $ ./git-describe HEAD
  warning: tag 'testtag' is really 'bobbytag' here
  testtag

  $ git tag -d testtag
  error: tag 'testtag' not found.
  $ git tag -d bobbytag
  Deleted tag 'bobbytag'

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-28 14:28:15 -08:00
Gerrit Pape 9907721501 templates/Makefile: don't depend on local umask setting
Don't take the local umask setting into account when installing the
templates/* files and directories, running 'make install' with umask set
to 077 resulted in template/* installed with permissions 700 and 600.

The problem was discovered by Florian Zumbiehl, reported through
 http://bugs.debian.org/467518

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-28 13:36:50 -08:00
Daniel Barkalow a6f13ccf24 Correct name of diff_flush() in API documentation
Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-28 13:35:09 -08:00
Junio C Hamano b75bb1d695 Start preparing for 1.5.4.4
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-27 23:37:39 -08:00
Shawn O. Pearce f49b6c10b7 Merge branch 'maint'
* maint:
  git-gui: Paper bag fix info dialog when no files are staged at commit
2008-02-28 01:29:19 -05:00
Shawn O. Pearce 094fbbf964 git-gui: Paper bag fix info dialog when no files are staged at commit
If the user tries to commit their changes without actually staging
anything we used to display an informational dialog suggesting they
first stage those changes, then retry the commit feature.

Unfortunately I broke this in aba15f7 ("Ensure error dialogs always
appear over all other windows") and failed to fix it in the paper
bag fix that came one day after it.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-02-28 01:28:45 -05:00