1
0
mirror of https://github.com/git/git.git synced 2024-10-01 08:21:24 +02:00
Commit Graph

14073 Commits

Author SHA1 Message Date
Mike Hommey
4201bb5f7e 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.

[jc: cherry-picked from 48411d and 4947cf9 on 'master']

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-11 19:30:33 -07:00
Paul Mackerras
494d3b8a6c gitk: Avoid Tcl error when switching views
Michele Ballabio <barra_cuda@katamail.com> pointed out that gitk
sometimes throws a Tcl error (can't read "yscreen") when switching
views, and proposed a patch.  This is a different way of fixing it
which is a bit neater.  Basically, in showview we only set yscreen if
the selected commit is on screen to start with, and then we only
scroll the canvas to bring it onscreen if yscreen is set and the
same commit exists in the new view.

Signed-off-by: Paul Mackerras <paulus@samba.org>
2008-03-11 22:11:19 +11:00
David Aguilar
cb8329aa9a [PATCH] gitk: Don't show local changes when we there is no work tree
Launching gitk on a bare repository or a .git directory
would previously show the work tree as having removed all
files.  We now inhibit showing local changes when gitk
is not launched from within a work tree.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2008-03-11 20:22:39 +11:00
Michal Rokos
8ce1f243e5 autoconf: Test FREAD_READS_DIRECTORIES
Add test for FREAD_READS_DIRECTORIES to detect when fread() reads fopen'ed
directory.

Tested on these platforms:

  AIX 5.3 - FREAD_READS_DIRECTORIES=UnfortunatelyYes
  HP-UX B.11.11 - FREAD_READS_DIRECTORIES=UnfortunatelyYes
  HP-UX B.11.23 - FREAD_READS_DIRECTORIES=UnfortunatelyYes
  Linux 2.6.25-rc4 - FREAD_READS_DIRECTORIES=
  Tru64 V5.1 - FREAD_READS_DIRECTORIES=UnfortunatelyYes
  Windows - FREAD_READS_DIRECTORIES=

Signed-off-by: Michal Rokos <michal.rokos@nextsoft.cz>
Tested-by: Mike Ralphson <mike@abacus.co.uk>
Tested-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-11 02:10:43 -07:00
Junio C Hamano
5d921e2931 Merge branch 'jc/cherry-pick' (early part)
* 'jc/cherry-pick' (early part):
  expose a helper function peel_to_type().
  merge-recursive: split low-level merge functions out.

Conflicts:

	Makefile
	builtin-merge-recursive.c
	sha1_name.c
2008-03-11 02:05:12 -07:00
Junio C Hamano
1c53606978 Merge branch 'maint'
* maint:
  git-pull documentation: warn about the option order
2008-03-11 01:54:46 -07:00
Junio C Hamano
92aeb994d3 Merge branch 'kb/maint-filter-branch-disappear' into maint
* kb/maint-filter-branch-disappear:
  filter-branch: handle "disappearing tree" case correctly in subdir filter
2008-03-11 00:38:29 -07:00
Junio C Hamano
b50396d16c Merge branch 'aw/maint-shortlog-blank-lines' into maint
* aw/maint-shortlog-blank-lines:
  shortlog: take the first populated line of the description
2008-03-11 00:37:38 -07:00
Linus Torvalds
20a16eb33e unpack_trees(): fix diff-index regression.
When skip_unmerged option is not given, unpack_trees() should not just
skip unmerged cache entries but keep them in the result for the caller to
sort them out.

For callers other than diff-index, the incoming index should never be
unmerged, but diff-index is a special case caller.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-10 23:51:13 -07:00
SZEDER Gábor
702088afc6 update 'git rebase' documentation
Being in the project's top directory when starting or continuing a rebase
is not necessary since 533b703 (Allow whole-tree operations to be started
from a subdirectory, 2007-01-12).

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-10 17:38:03 -07:00
SZEDER Gábor
5447aac755 bash: fix long option with argument double completion
Pressing TAB right after 'git command --long-option=' results in
'git command --long-option=--long-option=' when the long option requires
an argument, but we don't provide completion for its arguments (e.g.
commit --author=, apply --exclude=).  This patch detects these long
options and provides empty completion array for them.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-03-10 20:02:15 -04:00
Teemu Likonen
ce5a2c956f bash: Add more long options to be completed with "git --<TAB>"
Add the following long options to be completed with command "git":

	--paginate
	--work-tree=
	--help

Signed-off-by: Teemu Likonen <tlikonen@iki.fi>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-03-10 20:00:40 -04:00
SZEDER Gábor
51fe120903 bash: use __gitdir when completing 'git rebase' options
When doing completion of rebase options in a subdirectory of the work
tree during an ongoing rebase, wrong options were offered because of the
hardcoded .git/.dotest-merge path.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-03-10 19:55:07 -04:00
Shawn O. Pearce
6753f2aa55 bash: Remove completion of core.legacyheaders option
This option is no longer recognized by git.  Completing it is
not worthwhile.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-03-10 19:49:28 -04:00
SZEDER Gábor
47f6ee2838 bash: add 'git svn' subcommands and options
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-03-10 19:45:40 -04:00
SZEDER Gábor
88b302f5e2 bash: add new 'git stash' subcommands
Namely 'save', 'drop', 'pop' and 'create'

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-03-10 19:45:20 -04:00
SZEDER Gábor
3ff1320d4b bash: refactor searching for subcommands on the command line
This patch adds the __git_find_subcommand function, which takes one
argument: a string containing all subcommands separated by spaces.  The
function searches through the command line whether a subcommand is
already present.  The first found subcommand will be printed to standard
output.

This enables us to remove code duplications from completion functions
for commands having subcommands.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-03-10 19:45:20 -04:00
SZEDER Gábor
1d17b22ebf bash: remove unnecessary conditions when checking for subcommands
Checking emptyness of $command is sufficient.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-03-10 19:45:20 -04:00
Kevin Ballard
a5c4f85b16 bash: Properly quote the GIT_DIR at all times to fix subdirectory paths with spaces
Signed-off-by: Kevin Ballard <kevin@sb.org>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-03-10 19:44:40 -04:00
Junio C Hamano
542c264b01 traverse_trees_recursive(): propagate merge errors up
There were few places where merge errors detected deeper in the call chain
were ignored and not propagated up the callchain to the caller.

Most notably, this caused switching branches with "git checkout" to ignore
a path modified in a work tree are different between the HEAD version and
the commit being switched to, which it internally notices but ignores it,
resulting in an incorrect two-way merge and loss of the change in the work
tree.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-10 01:26:23 -07:00
Junio C Hamano
5b10a3c124 git-pull documentation: warn about the option order
We might eventually be loosening this rule, but there is a longstanding
restriction that the users currently need to be aware of.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-10 01:22:03 -07:00
Pierre Habouzit
9dd5bded1b git-quiltimport: better parser to grok "enhanced" series files.
The previous parser wasn't able to grok:

 * empty lines;
 * annotated patch levels (trailing -pNNN annotations);
 * trailing comments.

Now it understands them and uses the patch level hints as a git apply
argument.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-09 23:45:12 -07:00
Pekka Kaitaniemi
8809d691ec [PATCH] gitk: Add horizontal scrollbar to the diff view
Adding horizontal scroll bar makes the scrolling feature more
discoverable to the users.  The horizontal scrollbar is a bit narrower
than vertical ones so we don't make too big impact on available screen
real estate.  The text and scrollbar widget layout is done using grid
geometry manager.

An interesting side effect of Tk scrollbars is that the "elevator"
size changes depending on the visible content. So the horizontal
scrollbar "elevator" changes as the user scrolls the view up and down.

Signed-off-by: Pekka Kaitaniemi <kaitanie@cc.helsinki.fi>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2008-03-10 17:42:26 +11:00
Jeff King
95293b58eb [PATCH] gitk: make autoselect optional
Whenever a commit is selected in the graph pane, its SHA1 is
automatically put into the selection buffer for cut and paste.
However, some users may find this behavior annoying since it can
overwrite something they actually wanted to keep in the buffer.

This makes the behavior optional under the name "Auto-select SHA1",
but continues to default to "on".

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2008-03-10 17:42:23 +11:00
Michele Ballabio
a3a1f57959 [PATCH] gitk: Mark another string for translation
Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2008-03-10 17:40:51 +11:00
Yann Dirson
2d48085661 [PATCH] Add an --argscmd flag to get the list of refs to show
This allows gitk to be used to display a different set of refs each
the display is refreshed.  This is useful when gitk is called from
other porcelain suites, for doing such things as displaying the set of
patches in a patch stack.

The user specifies a command as the argument to the --argscmd option.
The command is run initially and each time the display is refreshed,
and is expected to generate a list of commit IDs, one per line.  Those
commits are appended to the commits passed on the command-line when
constructing the git log command to be executed.

The command is considered to be an attribute of a view, and has its
own field in the saved view, and an edit field in the view editor.

Signed-off-by: Yann Dirson <ydirson@altern.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2008-03-10 17:39:46 +11:00
Paul Mackerras
b9bee11526 gitk: Only restore window size from ~/.gitk, not position
This also limits the window size to the screen size.  That is better
than nothing, but it isn't perfect, since ideally we would take into
account window decorations, and things such as gnome panels or the
Mac OS X dock and menu bar, but I don't know how to do that.

On Cygwin this is as good as restoring the whole geometry (size and
position) at working around the Cygwin Tk bugs, according to Mark
Levedahl.

Tested-by: Mark Levedahl <mlevedahl@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2008-03-10 16:50:34 +11:00
Linus Torvalds
1caeacc1f2 unpack_trees(): minor memory leak fix in unused destination index
This adds a "discard_index(&o->result)" to the failure path, to reclaim
memory from an in-core index we built but ended up not using.

The *big* memory leak comes from the fact that we leak the cache_entry
things left and right. That's a very traditional and deliberate leak:
because we used to build up the cache entries by just mapping them
directly in from the index file (and we emulate that in modern times
by allocating them from one big array), we can't actually free them
one-by-one.

So doing the "discard_index()" will free the hash tables etc, which is
good, and it will free the "istate->alloc" but that is never set on the
result because we don't get the result from the index read. So we don't
actually free the individual cache entries themselves that got created
from the trees.

That's not something new, btw. We never did. But some day we should just
add a flag to the cache_entry() that it's a "free one by one" kind, and
then we could/should do it. In the meantime, this one-liner will fix
*some* of the memory leaks, but not that old traditional one.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-09 01:03:45 -08:00
Linus Torvalds
34110cd4e3 Make 'unpack_trees()' have a separate source and destination index
We will always unpack into our own internal index, but we will take the
source from wherever specified, and we will optionally write the result
to a specified index (optionally, because not everybody even _wants_ any
result: the index diffing really wants to just walk the tree and index
in parallel).

This ends up removing a fair number more lines than it adds, for the
simple reason that we can now skip all the crud that tried to be
oh-so-careful about maintaining our position in the index as we were
traversing and modifying it.  Since we don't actually modify the source
index any more, we can just update the 'o->pos' pointer without worrying
about whether an index entry got removed or replaced or added to.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-09 01:03:38 -08:00
Linus Torvalds
bc052d7f43 Make 'unpack_trees()' take the index to work on as an argument
This is just a very mechanical conversion, and makes everybody set it to
'&the_index' before calling, but at least it makes it more explicit
where we work with the index.

The next stage would be to split that index usage up into a 'source' and
a 'destination' index, so that we can unpack into a different index than
we started out from.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-09 00:43:48 -08:00
Linus Torvalds
d1f128b050 Add 'const' where appropriate to index handling functions
This is in an effort to make the source index of 'unpack_trees()' as
being const, and thus making the compiler help us verify that we only
access it for reading.

The constification also extended to some of the hashing helpers that get
called indirectly.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-09 00:43:48 -08:00
Linus Torvalds
bcbe5a515e Fix tree-walking compare_entry() in the presense of --prefix
When we make the "root" tree-walk info entry have a pathname in it, we
need to have a ->prev pointer so that compare_entry will actually notice
and traverse into the root.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-09 00:43:47 -08:00
Linus Torvalds
01904572a5 Move 'unpack_trees()' over to 'traverse_trees()' interface
This not only deletes more code than it adds, it gets rid of a
singularly hard-to-understand function (unpack_trees_rec()), and
replaces it with a set of smaller and simpler functions that use the
generic tree traversal mechanism to walk over one or more git trees in
parallel.

It's still not the most wonderful interface, and by no means is the new
code easy to understand either, but it's at least a bit less opaque.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-09 00:43:47 -08:00
Linus Torvalds
91e4f03604 Make 'traverse_trees()' traverse conflicting DF entries in parallel
This makes the traverse_trees() entry comparator routine use the more
relaxed form of name comparison that considers files and directories
with the same name identical.

We pass in a separate mask for just the directory entries, so that the
callback routine can decide (if it wants to) to only handle one or the
other type, but generally most (all?) users are expected to really want
to see the case of a name 'foo' showing up in one tree as a file and in
another as a directory at the same time.

In particular, moving 'unpack_trees()' over to use this tree traversal
mechanism requires this.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-09 00:43:47 -08:00
Linus Torvalds
5803c6f8a2 Add return value to 'traverse_tree()' callback
This allows the callback to return an error value, but it can also
specify which of the tree entries that it actually used up by returning
a positive mask value.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-09 00:43:47 -08:00
Linus Torvalds
40d934df72 Make 'traverse_tree()' use linked structure rather than 'const char *base'
This makes the calling convention a bit less obvious, but a lot more
flexible.  Instead of allocating and extending a new 'base' string, we
just link the top-most name into a linked list of the 'info' structure
when traversing a subdirectory, and we can generate the basename by
following the list.

Perhaps even more importantly, the linked list of info structures also
gives us a place to naturally save off other information than just the
directory name.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-09 00:43:47 -08:00
Linus Torvalds
0ab9e1e8cd Add 'df_name_compare()' helper function
This new helper is identical to base_name_compare(), except it compares
conflicting directory/file entries as equal in order to help handling DF
conflicts (thus the name).

Note that while a directory name compares as equal to a regular file
with the new helper, they then individually compare _differently_ to a
filename that has a dot after the basename (because '\0' < '.' < '/').

So a directory called "foo/" will compare equal to a file "foo", even
though "foo.c" will compare after "foo" and before "foo/"

This will be used by routines that want to traverse the git namespace
but then handle conflicting entries together when possible.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-09 00:43:46 -08:00
Johannes Schindelin
3b9dcff5df builtin remote rm: remove symbolic refs, too
"git remote add" can add a symbolic ref "HEAD", and "rm" should delete
it, too.

Noticed by Teemu Likonen.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-08 21:30:22 -08:00
Jeff King
50753d00d6 Add a test for read-tree -u --reset with a D/F conflict
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-08 21:30:05 -08:00
Junio C Hamano
1cbcefb107 Merge branch 'ph/parseopt'
* ph/parseopt:
  parse-options: new option type to treat an option-like parameter as an argument.
  parse-opt: bring PARSE_OPT_HIDDEN and NONEG to git-rev-parse --parseopt
2008-03-08 21:29:59 -08:00
Junio C Hamano
175f559551 Merge branch 'dp/clean-fix'
* dp/clean-fix:
  git-clean: add tests for relative path
  git-clean: correct printing relative path
  Make private quote_path() in wt-status.c available as quote_path_relative()
  Revert part of d089eba (setup: sanitize absolute and funny paths in get_pathspec())
  Revert part of 1abf095 (git-add: adjust to the get_pathspec() changes)
  Revert part of 744dacd (builtin-mv: minimum fix to avoid losing files)
  get_pathspec(): die when an out-of-tree path is given
2008-03-08 21:29:56 -08:00
Junio C Hamano
0ae496ccd8 Merge branch 'ml/submodule-add-existing'
* ml/submodule-add-existing:
  git-submodule - Allow adding a submodule in-place
2008-03-08 21:29:52 -08:00
Junio C Hamano
6e79a88585 Merge branch 'mr/compat-snprintf'
* mr/compat-snprintf:
  Add compat/snprintf.c for systems that return bogus
2008-03-08 21:29:50 -08:00
Junio C Hamano
5b278ebe87 Merge branch 'sp/fetch-optim'
* sp/fetch-optim:
  Teach git-fetch to exploit server side automatic tag following
  Teach fetch-pack/upload-pack about --include-tag
  git-pack-objects: Automatically pack annotated tags if object was packed
  Teach git-fetch to grab a tag at the same time as a commit
  Make git-fetch follow tags we already have objects for sooner
  Teach upload-pack to log the received need lines to an fd
  Free the path_lists used to find non-local tags in git-fetch
  Allow builtin-fetch's find_non_local_tags to append onto a list
  Ensure tail pointer gets setup correctly when we fetch HEAD only
  Remove unnecessary delaying of free_refs(ref_map) in builtin-fetch
  Remove unused variable in builtin-fetch find_non_local_tags
2008-03-08 20:11:35 -08:00
Junio C Hamano
686bc52a89 Merge branch 'jc/describe-always'
* jc/describe-always:
  describe --always: fall back to showing an abbreviated object name
2008-03-08 20:10:09 -08:00
Junio C Hamano
dabc42c713 Merge branch 'jc/am'
* jc/am:
  am: --rebasing
  am: remove support for -d .dotest
  am: read from the right mailbox when started from a subdirectory
2008-03-08 20:10:05 -08:00
Junio C Hamano
b59fd2098e Merge branch 'cr/reset-parseopt'
* cr/reset-parseopt:
  Make builtin-reset.c use parse_options.
2008-03-08 20:09:55 -08:00
Junio C Hamano
11a1d351cf Merge branch 'jn/gitweb-pickaxe'
* jn/gitweb-pickaxe:
  gitweb: Fix and simplify pickaxe search
2008-03-08 20:09:51 -08:00
Junio C Hamano
832d586a0c Merge branch 'kb/maint-filter-branch-disappear'
* kb/maint-filter-branch-disappear:
  filter-branch: handle "disappearing tree" case correctly in subdir filter
2008-03-08 20:09:13 -08:00
Junio C Hamano
ad416ed433 Merge branch 'maint' to sync with 1.5.4.4
* maint:
  GIT 1.5.4.4
  ident.c: reword error message when the user name cannot be determined
  Fix dcommit, rebase when rewriteRoot is in use
  Really make the LF after reset in fast-import optional
2008-03-08 20:07:57 -08:00