gitweb.git
Add 'merge' mode to 'git reset'Linus Torvalds Mon, 1 Dec 2008 17:30:31 +0000 (09:30 -0800)

Add 'merge' mode to 'git reset'

We have always had a nice way to reset a working tree to another state
while carrying our changes around: "git read-tree -u -m". Yes, it fails if
the target tree is different in the paths that are dirty in the working
tree, but this is how we used to switch branches in "git checkout", and it
worked fine.

However, perhaps exactly _because_ we've supported this from very early
on, another low-level command, namely "git reset", never did.

But as time went on, 'git reset' remains as a very common command, while
'git read-tree' is now a very odd and low-level plumbing thing that nobody
sane should ever use, because it only makes sense together with other
operations like either switching branches or just rewriting HEAD.

Which means that we have effectively lost the ability to do something very
common: jump to another point in time without always dropping all our
dirty state.

So add this kind of mode to "git reset", and since it merges your changes
to what you are resetting to, just call it that: "git reset --merge".

I've wanted this for a long time, since I very commonly carry a dirty
tree while working on things. My main 'Makefile' file quite often has the
next version already modified, and sometimes I have local modifications
that I don't want to commit, but I still do pulls and patch applications,
and occasionally want to do "git reset" to undo them - while still keeping
my local modifications.

(Maybe we could eventually change it to something like "if we have a
working tree, default to --merge, otherwise default to --mixed").

NOTE! This new mode is certainly not perfect. There's a few things to look
out for:

- if the index has unmerged entries, "--merge" will currently simply
refuse to reset ("you need to resolve your current index first").
You'll need to use "--hard" or similar in this case.

This is sad, because normally a unmerged index means that the working
tree file should have matched the source tree, so the correct action is
likely to make --merge reset such a path to the target (like --hard),
regardless of dirty state in-tree or in-index. But that's not how
read-tree has ever worked, so..

- "git checkout -m" actually knows how to do a three-way merge, rather
than refuse to update the working tree. So we do know how to do that,
and arguably that would be even nicer behavior.

At the same time it's also arguably true that there is a chance of loss
of state (ie you cannot get back to the original tree if the three-way
merge ends up resolving cleanly to no diff at all), so the "refuse to
do it" is in some respects the safer - but less user-friendly - option.

In other words, I think 'git reset --merge' could become a bit more
friendly, but this is already a big improvement. It allows you to undo a
recent commit without having to throw your current work away.

Yes, yes, with a dirty tree you could always do

git stash
git reset --hard
git stash apply

instead, but isn't "git reset --merge" a nice way to handle one particular
simple case?

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
--

Hmm? Maybe I'm the only one that does a lot of work with a dirty tree, and
sure, I can do other things like the "git stash" thing, or using "git
checkout" to actually create a new branch, and then playing games with
branch renaming etc to make it work like this one.

But I suspect others dislike how "git reset" works too. But see the
suggested improvements above.

builtin-reset.c | 26 ++++++++++++++++++--------
1 files changed, 18 insertions(+), 8 deletions(-)

GIT 1.6.1-rc1 v1.6.1-rc1Junio C Hamano Mon, 1 Dec 2008 07:01:53 +0000 (23:01 -0800)

GIT 1.6.1-rc1

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Include git-gui--askpass in git-gui RPM packageJunio C Hamano Mon, 1 Dec 2008 08:53:54 +0000 (00:53 -0800)

Include git-gui--askpass in git-gui RPM package

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge git://git.kernel.org/pub/scm/gitk/gitkJunio C Hamano Mon, 1 Dec 2008 06:59:41 +0000 (22:59 -0800)

Merge git://git.kernel.org/pub/scm/gitk/gitk

* git://git.kernel.org/pub/scm/gitk/gitk:
gitk: Avoid handling the Return key twice in Add Branch
gitk: Show local changes properly when we have a path limit
gitk: Fix switch statement in parseviewargs
gitk: Index line[hnd]tag arrays by id rather than row number

Merge git://repo.or.cz/git-guiJunio C Hamano Mon, 1 Dec 2008 06:54:39 +0000 (22:54 -0800)

Merge git://repo.or.cz/git-gui

* git://repo.or.cz/git-gui:
git-gui: update Japanese translation
git-gui: french translation update
Updated Swedish translation (514t0f0u).
git gui: update Italian translation
Update Hungarian translation. 100% completed.

send-email: do not reverse the command line argumentsJunio C Hamano Mon, 1 Dec 2008 06:38:20 +0000 (22:38 -0800)

send-email: do not reverse the command line arguments

The loop picks elements from @ARGV one by one, sifts them into arguments
meant for format-patch and the script itself, and pushes them to @files
and @rev_list_opts arrays. Pick elements from @ARGV starting at the
beginning using shift, instead of at the end using pop, as push appends
them to the end of the array.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'maint'Junio C Hamano Mon, 1 Dec 2008 02:43:56 +0000 (18:43 -0800)

Merge branch 'maint'

* maint:
Update draft release notes to 1.6.0.5
generate-cmdlist.sh: avoid selecting synopsis at wrong place

Update draft release notes to 1.6.0.5Junio C Hamano Mon, 1 Dec 2008 02:33:20 +0000 (18:33 -0800)

Update draft release notes to 1.6.0.5

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'st/maint-tag' into maintJunio C Hamano Mon, 1 Dec 2008 02:18:50 +0000 (18:18 -0800)

Merge branch 'st/maint-tag' into maint

* st/maint-tag:
tag: Add more tests about mixing incompatible modes and options
tag: Check that options are only allowed in the appropriate mode

Merge branch 'mk/maint-cg-push' into maintJunio C Hamano Mon, 1 Dec 2008 02:18:11 +0000 (18:18 -0800)

Merge branch 'mk/maint-cg-push' into maint

* mk/maint-cg-push:
git push: Interpret $GIT_DIR/branches in a Cogito compatible way

generate-cmdlist.sh: avoid selecting synopsis at wrong... Nguyễn Thái Ngọc Duy Sun, 30 Nov 2008 10:54:31 +0000 (17:54 +0700)

generate-cmdlist.sh: avoid selecting synopsis at wrong place

In "common" man pages there is luckily no "NAME" anywhere except at
beginning of documents. If there is another "NAME", sed could
mis-select it and lead to common-cmds.h corruption. So better nail it
at beginning of line, which would reduce corruption chance.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'cc/bisect-skip'Junio C Hamano Fri, 28 Nov 2008 03:25:25 +0000 (19:25 -0800)

Merge branch 'cc/bisect-skip'

* cc/bisect-skip:
bisect: teach "skip" to accept special arguments like "A..B"

Merge branch 'js/mingw-rename-fix'Junio C Hamano Fri, 28 Nov 2008 03:25:06 +0000 (19:25 -0800)

Merge branch 'js/mingw-rename-fix'

* js/mingw-rename-fix:
compat/mingw.c: Teach mingw_rename() to replace read-only files

Merge branch 'st/levenshtein'Junio C Hamano Fri, 28 Nov 2008 03:24:47 +0000 (19:24 -0800)

Merge branch 'st/levenshtein'

* st/levenshtein:
Document levenshtein.c
Fix deletion of last character in levenshtein distance

Merge branch 'cr/remote-update-v'Junio C Hamano Fri, 28 Nov 2008 03:24:40 +0000 (19:24 -0800)

Merge branch 'cr/remote-update-v'

* cr/remote-update-v:
git-remote: add verbose mode to git remote update

Merge branch 'rs/strbuf-expand'Junio C Hamano Fri, 28 Nov 2008 03:24:36 +0000 (19:24 -0800)

Merge branch 'rs/strbuf-expand'

* rs/strbuf-expand:
remove the unused files interpolate.c and interpolate.h
daemon: deglobalize variable 'directory'
daemon: inline fill_in_extra_table_entries()
daemon: use strbuf_expand() instead of interpolate()
merge-recursive: use strbuf_expand() instead of interpolate()
add strbuf_expand_dict_cb(), a helper for simple cases

Merge branch 'mv/clone-strbuf'Junio C Hamano Fri, 28 Nov 2008 03:24:25 +0000 (19:24 -0800)

Merge branch 'mv/clone-strbuf'

* mv/clone-strbuf:
builtin_clone: use strbuf in cmd_clone()
builtin-clone: use strbuf in clone_local() and copy_or_link_directory()
builtin-clone: use strbuf in guess_dir_name()

Merge branch 'lt/preload-lstat'Junio C Hamano Fri, 28 Nov 2008 03:24:13 +0000 (19:24 -0800)

Merge branch 'lt/preload-lstat'

* lt/preload-lstat:
Fix index preloading for racy dirty case
Add cache preload facility

Merge branch 'ta/quiet-pull'Junio C Hamano Fri, 28 Nov 2008 03:24:11 +0000 (19:24 -0800)

Merge branch 'ta/quiet-pull'

* ta/quiet-pull:
Retain multiple -q/-v occurrences in git pull
Teach/Fix pull/fetch -q/-v options

Merge branch 'ph/send-email'Junio C Hamano Fri, 28 Nov 2008 03:24:00 +0000 (19:24 -0800)

Merge branch 'ph/send-email'

* ph/send-email:
git send-email: ask less questions when --compose is used.
git send-email: add --annotate option
git send-email: interpret unknown files as revision lists
git send-email: make the message file name more specific.

Merge branch 'maint'Junio C Hamano Fri, 28 Nov 2008 03:23:51 +0000 (19:23 -0800)

Merge branch 'maint'

* maint:
sha1_file.c: resolve confusion EACCES vs EPERM
sha1_file: avoid bogus "file exists" error message
git checkout: don't warn about unborn branch if -f is already passed
bash: offer refs instead of filenames for 'git revert'
bash: remove dashed command leftovers
git-p4: fix keyword-expansion regex
fast-export: use an unsorted string list for extra_refs
Add new testcase to show fast-export does not always exports all tags

Merge branch 'mv/fast-export' into maintJunio C Hamano Fri, 28 Nov 2008 03:23:27 +0000 (19:23 -0800)

Merge branch 'mv/fast-export' into maint

* mv/fast-export:
fast-export: use an unsorted string list for extra_refs
Add new testcase to show fast-export does not always exports all tags

sha1_file.c: resolve confusion EACCES vs EPERMSam Vilain Fri, 14 Nov 2008 07:19:34 +0000 (20:19 +1300)

sha1_file.c: resolve confusion EACCES vs EPERM

An earlier commit 916d081 (Nicer error messages in case saving an object
to db goes wrong, 2006-11-09) confused EACCES with EPERM, the latter of
which is an unlikely error from mkstemp().

Signed-off-by: Sam Vilain <sam@vilain.net>

sha1_file: avoid bogus "file exists" error messageJoey Hess Thu, 20 Nov 2008 18:56:28 +0000 (13:56 -0500)

sha1_file: avoid bogus "file exists" error message

This avoids the following misleading error message:

error: unable to create temporary sha1 filename ./objects/15: File exists

mkstemp can fail for many reasons, one of which, ENOENT, can occur if
the directory for the temp file doesn't exist. create_tmpfile tried to
handle this case by always trying to mkdir the directory, even if it
already existed. This caused errno to be clobbered, so one cannot tell
why mkstemp really failed, and it truncated the buffer to just the
directory name, resulting in the strange error message shown above.

Note that in both occasions that I've seen this failure, it has not been
due to a missing directory, or bad permissions, but some other, unknown
mkstemp failure mode that did not occur when I ran git again. This code
could perhaps be made more robust by retrying mkstemp, in case it was a
transient failure.

Signed-off-by: Joey Hess <joey@kitenet.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git checkout: don't warn about unborn branch if -f... Matt McCutchen Mon, 24 Nov 2008 06:55:22 +0000 (01:55 -0500)

git checkout: don't warn about unborn branch if -f is already passed

I think it's unnecessary to warn that the checkout has been forced due to an
unborn current branch if -f has been explicitly passed. For one project, I am
using git-new-workdir to create workdirs from a bare repository whose HEAD is
set to an unborn branch, and this warning started to irritate me.

Signed-off-by: Matt McCutchen <matt@mattmccutchen.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

bash: offer refs instead of filenames for 'git revert'SZEDER Gábor Thu, 27 Nov 2008 13:35:53 +0000 (14:35 +0100)

bash: offer refs instead of filenames for 'git revert'

The completion script for 'git revert' currently offers options and
filenames. However, 'git revert' doesn't take any filenames from the
command line, but a single commit. Therefore, it's more sane to offer
refs instead.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

bash: complete full refsSZEDER Gábor Fri, 28 Nov 2008 00:46:38 +0000 (01:46 +0100)

bash: complete full refs

Sometimes it's handy to complete full refs, e.g. the user has some
refs outside of refs/{heads,remotes,tags} or the user wants to
complete some git command's special refs (like 'git show
refs/bisect/bad').

To do that, we check whether the ref to be completed starts with
'refs/' or is 'refs' (to reduce the risk of matching 'refs-'). If it
does, then we offer full refs for completion; otherwise everything
works as usual.

This way the impact on the common case is fairly small (hopefully not
many users have branches or tags starting with 'refs'), and in the
special case the cost of typing out 'refs' is bearable.

While at it, also remove the unused 'cmd' variable from '__git_refs'.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

bash: remove dashed command leftoversSZEDER Gábor Thu, 27 Nov 2008 13:35:38 +0000 (14:35 +0100)

bash: remove dashed command leftovers

Commit 5a625b07 (bash: remove fetch, push, pull dashed form leftovers,
2008-10-03) did that already, but there were still some git-cmd left
here and there.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'pw/maint-p4' into maintJunio C Hamano Thu, 27 Nov 2008 21:18:25 +0000 (13:18 -0800)

Merge branch 'pw/maint-p4' into maint

* pw/maint-p4:
git-p4: fix keyword-expansion regex

git-p4: fix keyword-expansion regexPete Wyckoff Wed, 26 Nov 2008 18:52:15 +0000 (13:52 -0500)

git-p4: fix keyword-expansion regex

This text:

my $dir = $File::Find::dir;
return if ($dir !~ m,$options->{dirpat}$,);

was improperly converted to:

my $dir = $File$dir !~ m,$options->{dirpat}$,);

by the keyword identifier expansion code. Add a \n
to make sure the regex doesn't go across end-of-line
boundaries.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Acked-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Fix typos in the documentation.Ralf Wildenhues Thu, 27 Nov 2008 07:32:01 +0000 (08:32 +0100)

Fix typos in the documentation.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'rw/maint-typofix' into rw/typofixJunio C Hamano Thu, 27 Nov 2008 09:17:09 +0000 (01:17 -0800)

Merge branch 'rw/maint-typofix' into rw/typofix

* rw/maint-typofix:
Fix typos in the documentation.

Fix typos in the documentation.Ralf Wildenhues Thu, 27 Nov 2008 07:32:01 +0000 (08:32 +0100)

Fix typos in the documentation.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-gui: update Japanese translationNanako Shiraishi Wed, 26 Nov 2008 10:21:44 +0000 (19:21 +0900)

git-gui: update Japanese translation

Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Merge branch 'maint'Junio C Hamano Wed, 26 Nov 2008 19:57:31 +0000 (11:57 -0800)

Merge branch 'maint'

* maint:
Teach "git diff" to honour --[no-]ext-diff

Merge branch 'mm/sort-config-doc'Junio C Hamano Wed, 26 Nov 2008 19:57:28 +0000 (11:57 -0800)

Merge branch 'mm/sort-config-doc'

* mm/sort-config-doc:
config.txt: alphabetize configuration sections

Merge branch 'mm/maint-sort-config-doc' into maintJunio C Hamano Wed, 26 Nov 2008 19:57:15 +0000 (11:57 -0800)

Merge branch 'mm/maint-sort-config-doc' into maint

* mm/maint-sort-config-doc:
config.txt: alphabetize configuration sections

Merge branch 'mm/maint-sort-config-doc' into mm/sort... Junio C Hamano Wed, 26 Nov 2008 19:11:18 +0000 (11:11 -0800)

Merge branch 'mm/maint-sort-config-doc' into mm/sort-config-doc

* mm/maint-sort-config-doc:
config.txt: alphabetize configuration sections

Conflicts:
Documentation/config.txt

config.txt: alphabetize configuration sectionsMatt McCutchen Wed, 26 Nov 2008 08:26:50 +0000 (03:26 -0500)

config.txt: alphabetize configuration sections

I figured the sections might as well be in some order, so I chose alphabetical
but with "core" at the beginning. This should help people add new variables
in the right places.

Signed-off-by: Matt McCutchen <matt@mattmccutchen.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

xdiff-interface.c: remove 10 duplicated linesJim Meyering Wed, 26 Nov 2008 13:27:10 +0000 (14:27 +0100)

xdiff-interface.c: remove 10 duplicated lines

Remove an accidentally duplicated sequence of 10 lines.
This happens to plug a leak, too.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

t9129-git-svn-i18n-commitencoding: Make compare_svn_hea... Marcel Koeppen Wed, 26 Nov 2008 16:51:01 +0000 (17:51 +0100)

t9129-git-svn-i18n-commitencoding: Make compare_svn_head_with() compatible with OSX sed

The sed call used in compare_svn_head_with() uses the + quantifier, which
is not supported in the OSX version of sed. It is replaced by the
equivalent \{1,\}.

Signed-off-by: Marcel Koeppen <git-dev@marzelpan.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Teach "git diff" to honour --[no-]ext-diffJunio C Hamano Wed, 26 Nov 2008 17:58:41 +0000 (09:58 -0800)

Teach "git diff" to honour --[no-]ext-diff

The original intention of 72909be (Add diff-option --ext-diff, 2007-06-30)
was to optionally allow the use of external diff viewer in "git log"
family (while keeping them disabled by default). It exposed the "allow
external diff" bit to the UI, but forgot to adjust the "git diff" codepath
that was set up to always allow use of the external diff viewer.

Noticed by Nazri Ramliy; tests by René Scharfe squashed in.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

send-email: Fix Pine address book parsingTrent Piepho Wed, 26 Nov 2008 02:55:00 +0000 (18:55 -0800)

send-email: Fix Pine address book parsing

See: http://www.washington.edu/pine/tech-notes/low-level.html

Entries with a fcc or comment field after the address weren't parsed
correctly.

Continuation lines, identified by leading spaces, were also not handled.

Distribution lists which had ( ) around a list of addresses did not have
the parenthesis removed.

Signed-off-by: Trent Piepho <tpiepho@freescale.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'for-junio' of git://source.winehq.org... Junio C Hamano Wed, 26 Nov 2008 05:52:28 +0000 (21:52 -0800)

Merge branch 'for-junio' of git://source.winehq.org/~julliard/git/git

* 'for-junio' of git://source.winehq.org/~julliard/git/git:
git.el: Allow to commit even if there are no marked files.
git.el: Add possibility to mark files directly in git-update-status-files.
git.el: Add an insert file command.
git.el: Never clear the status buffer, only update the files.
git.el: Fix git-amend-commit to support amending an initial commit.
git.el: Properly handle merge commits in git-amend-commit.
git.el: Simplify handling of merge heads in the commit log-edit buffer.
git.el: Remove the env parameter in git-call-process and git-call-process-string.
git.el: Improve error handling for commits.

bisect: teach "skip" to accept special arguments like... Christian Couder Sun, 23 Nov 2008 21:02:49 +0000 (22:02 +0100)

bisect: teach "skip" to accept special arguments like "A..B"

The current "git bisect skip" syntax is "git bisect skip [<rev>...]"
so it's already possible to skip a range of revisions using
something like:

$ git bisect skip $(git rev-list A..B)

where A and B are the bounds of the range we want to skip.

This patch teaches "git bisect skip" to accept:

$ git bisect skip A..B

as an abbreviation for the former command.

This is done by checking each argument to see if it contains two
dots one after the other ('..'), and by expending it using
"git rev-list" if that is the case.

Note that this patch will not make "git bisect skip" accept all
that "git rev-list" accepts, as things like "^A B" for exemple
will not work. But things like "A B..C D E F.. ..G H...I" should
work as expected.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

builtin_clone: use strbuf in cmd_clone()Miklos Vajna Fri, 21 Nov 2008 00:45:01 +0000 (01:45 +0100)

builtin_clone: use strbuf in cmd_clone()

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

builtin-clone: use strbuf in clone_local() and copy_or_... Miklos Vajna Fri, 21 Nov 2008 00:45:00 +0000 (01:45 +0100)

builtin-clone: use strbuf in clone_local() and copy_or_link_directory()

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

builtin-clone: use strbuf in guess_dir_name()Miklos Vajna Fri, 21 Nov 2008 00:44:59 +0000 (01:44 +0100)

builtin-clone: use strbuf in guess_dir_name()

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'maint'Junio C Hamano Mon, 24 Nov 2008 04:36:54 +0000 (20:36 -0800)

Merge branch 'maint'

* maint:
Fix misleading wording for git-cherry-pick

remove the unused files interpolate.c and interpolate.hRené Scharfe Sat, 22 Nov 2008 23:16:59 +0000 (00:16 +0100)

remove the unused files interpolate.c and interpolate.h

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

daemon: deglobalize variable 'directory'René Scharfe Sat, 22 Nov 2008 23:21:52 +0000 (00:21 +0100)

daemon: deglobalize variable 'directory'

Remove the global variable 'directory' and pass it as a parameter of
the two functions that use it instead, (almost) restoring their
interface to how it was before 49ba83fb67d9e447b86953965ce5f949c6a93b81.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

daemon: inline fill_in_extra_table_entries()René Scharfe Sat, 22 Nov 2008 23:19:09 +0000 (00:19 +0100)

daemon: inline fill_in_extra_table_entries()

Having fill_in_extra_table_entries() as a separate function has no
advantage -- a function with no parameters and return values might as
well be an anonymous block of code. Its name still refers to the table
of interpolate() which has been removed earlier, so it's better to
inline it at its only call site.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

daemon: use strbuf_expand() instead of interpolate()René Scharfe Sat, 22 Nov 2008 23:15:01 +0000 (00:15 +0100)

daemon: use strbuf_expand() instead of interpolate()

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

merge-recursive: use strbuf_expand() instead of interpo... René Scharfe Sat, 22 Nov 2008 23:13:00 +0000 (00:13 +0100)

merge-recursive: use strbuf_expand() instead of interpolate()

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

add strbuf_expand_dict_cb(), a helper for simple casesRené Scharfe Sat, 22 Nov 2008 23:09:30 +0000 (00:09 +0100)

add strbuf_expand_dict_cb(), a helper for simple cases

The new callback function strbuf_expand_dict_cb() can be used together
with strbuf_expand() if there is only a small number of placeholders
for static replacement texts. It expects its dictionary as an array of
placeholder+value pairs as context parameter, terminated by an entry
with the placeholder member set to NULL.

The new helper is intended to aid converting the remaining calls of
interpolate(). strbuf_expand() is smaller, more flexible and can be
used to go faster than interpolate(), so it should replace the latter.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

fast-export: use an unsorted string list for extra_refsJohannes Schindelin Sun, 23 Nov 2008 11:55:54 +0000 (12:55 +0100)

fast-export: use an unsorted string list for extra_refs

The list extra_refs contains tags and the objects referenced by them,
so that they can be handled at the end. When a tag references a
commit, that commit is added to the list using the same name.

Also, the function handle_tags_and_duplicates() relies on the order
the items were added to extra_refs, so clearly we do not want to
use a sorted list here.

Noticed by Miklos Vajna.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Tested-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Add new testcase to show fast-export does not always... Miklos Vajna Sat, 22 Nov 2008 18:22:48 +0000 (19:22 +0100)

Add new testcase to show fast-export does not always exports all tags

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sha1_file: avoid bogus "file exists" error messageJoey Hess Thu, 20 Nov 2008 18:56:28 +0000 (13:56 -0500)

sha1_file: avoid bogus "file exists" error message

This avoids the following misleading error message:

error: unable to create temporary sha1 filename ./objects/15: File exists

mkstemp can fail for many reasons, one of which, ENOENT, can occur if
the directory for the temp file doesn't exist. create_tmpfile tried to
handle this case by always trying to mkdir the directory, even if it
already existed. This caused errno to be clobbered, so one cannot tell
why mkstemp really failed, and it truncated the buffer to just the
directory name, resulting in the strange error message shown above.

Note that in both occasions that I've seen this failure, it has not been
due to a missing directory, or bad permissions, but some other, unknown
mkstemp failure mode that did not occur when I ran git again. This code
could perhaps be made more robust by retrying mkstemp, in case it was a
transient failure.

Signed-off-by: Joey Hess <joey@kitenet.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Fix misleading wording for git-cherry-pickBryan Drewery Thu, 20 Nov 2008 05:11:42 +0000 (23:11 -0600)

Fix misleading wording for git-cherry-pick

Documentation for -n implies that -x is normally
used, however this is no longer true.

Signed-off-by: Bryan Drewery <bryan@shatow.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Fix t4030-diff-textconv.shAlex Riesen Wed, 19 Nov 2008 11:14:50 +0000 (12:14 +0100)

Fix t4030-diff-textconv.sh

Avoid passing cygwin pathnames to Perl. Some Perls have problems using them

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Fix handle leak in sha1_file/unpack_objects if there... Alex Riesen Wed, 19 Nov 2008 11:14:05 +0000 (12:14 +0100)

Fix handle leak in sha1_file/unpack_objects if there were damaged object data

In the case of bad packed object CRC, unuse_pack wasn't called after
check_pack_crc which calls use_pack.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Acked-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

compat/mingw.c: Teach mingw_rename() to replace read... Johannes Sixt Wed, 19 Nov 2008 16:25:27 +0000 (17:25 +0100)

compat/mingw.c: Teach mingw_rename() to replace read-only files

On POSIX, rename() can replace files that are not writable. On Windows,
however, read-only files cannot be replaced without additional efforts:
We have to make the destination writable first.

Since the situations where the destination is read-only are rare, we do not
make the destination writable on every invocation, but only if the first
try to rename a file failed with an "access denied" error.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Document levenshtein.cJohannes Schindelin Thu, 20 Nov 2008 13:27:27 +0000 (14:27 +0100)

Document levenshtein.c

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Fix deletion of last character in levenshtein distanceSamuel Tardieu Tue, 18 Nov 2008 18:53:26 +0000 (19:53 +0100)

Fix deletion of last character in levenshtein distance

Without this change, "git tags" will not suggest "git tag"
(it will only suggest "git status"), and "git statusx" will
not suggest anything.

Signed-off-by: Samuel Tardieu <sam@rfc1149.net>
Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-gui: french translation updateChristian Couder Sun, 23 Nov 2008 19:52:20 +0000 (20:52 +0100)

git-gui: french translation update

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git.el: Allow to commit even if there are no marked... Alexandre Julliard Fri, 7 Nov 2008 13:28:09 +0000 (14:28 +0100)

git.el: Allow to commit even if there are no marked files.

This can be useful to commit a merge that didn't result in any
changes.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>

git.el: Add possibility to mark files directly in git... Alexandre Julliard Sat, 1 Nov 2008 19:14:10 +0000 (20:14 +0100)

git.el: Add possibility to mark files directly in git-update-status-files.

This avoids the need to go through the list twice, which helps
performance on large file lists.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>

git.el: Add an insert file command.Alexandre Julliard Mon, 4 Aug 2008 07:30:42 +0000 (09:30 +0200)

git.el: Add an insert file command.

This allows to insert a file in the buffer no matter what its state
is, making it possible for instance to remove an up-to-date file.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>

git.el: Never clear the status buffer, only update... Alexandre Julliard Sat, 2 Aug 2008 18:35:52 +0000 (20:35 +0200)

git.el: Never clear the status buffer, only update the files.

This makes it unnecessary to save/restore the file marks.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>

git.el: Fix git-amend-commit to support amending an... Alexandre Julliard Sat, 2 Aug 2008 18:35:20 +0000 (20:35 +0200)

git.el: Fix git-amend-commit to support amending an initial commit.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>

git.el: Properly handle merge commits in git-amend... Alexandre Julliard Sat, 2 Aug 2008 16:05:58 +0000 (18:05 +0200)

git.el: Properly handle merge commits in git-amend-commit.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>

git.el: Simplify handling of merge heads in the commit... Alexandre Julliard Sat, 2 Aug 2008 16:04:31 +0000 (18:04 +0200)

git.el: Simplify handling of merge heads in the commit log-edit buffer.

Use a single Merge: header instead of one Parent: header for each
parent, and don't list the current HEAD as a merged head. Support
symbolic references too.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>

git.el: Remove the env parameter in git-call-process... Alexandre Julliard Sat, 1 Nov 2008 19:42:39 +0000 (20:42 +0100)

git.el: Remove the env parameter in git-call-process and git-call-process-string.

All callers that need to change the environment now set
process-environment themselves.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>

git.el: Improve error handling for commits.Alexandre Julliard Sat, 1 Nov 2008 19:34:33 +0000 (20:34 +0100)

git.el: Improve error handling for commits.

Display all errors happening in the various subcommands of the commit
sequence, and abort on any error.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>

Updated Swedish translation (514t0f0u).Peter Krefting Fri, 21 Nov 2008 07:35:53 +0000 (08:35 +0100)

Updated Swedish translation (514t0f0u).

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git gui: update Italian translationMichele Ballabio Tue, 26 Aug 2008 22:49:54 +0000 (00:49 +0200)

git gui: update Italian translation

Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-commit.txt - mention that files listed on the comma... Mark Burton Tue, 18 Nov 2008 22:33:44 +0000 (22:33 +0000)

git-commit.txt - mention that files listed on the command line must be known to git.

Signed-off-by: Mark Burton <markb@ordern.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Retain multiple -q/-v occurrences in git pullTuncer Ayaz Mon, 17 Nov 2008 22:09:30 +0000 (23:09 +0100)

Retain multiple -q/-v occurrences in git pull

To support counting -q/-v options in git pull retain
them by concatenating.

Signed-off-by: Tuncer Ayaz <tuncer.ayaz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation: rev-list-options.txt: added --branches... Mark Burton Mon, 17 Nov 2008 21:03:59 +0000 (21:03 +0000)

Documentation: rev-list-options.txt: added --branches, --tags & --remotes.

Added simple descriptions of these options (based on description of --all).

Signed-off-by: Mark Burton <markb@ordern.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

builtin-branch: use strbuf in rename_branch()Miklos Vajna Mon, 17 Nov 2008 20:48:37 +0000 (21:48 +0100)

builtin-branch: use strbuf in rename_branch()

In case the length of branch name is greather then PATH_MAX-11, we write
to unallocated memory otherwise.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

builtin-branch: use strbuf in fill_tracking_info()Miklos Vajna Mon, 17 Nov 2008 20:48:36 +0000 (21:48 +0100)

builtin-branch: use strbuf in fill_tracking_info()

This is just about using the API, though in case of ~ 10^100 commits,
this would fix the problem of writing to unallocated memory as well. ;-)

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

builtin-branch: use strbuf in delete_branches()Miklos Vajna Mon, 17 Nov 2008 20:48:35 +0000 (21:48 +0100)

builtin-branch: use strbuf in delete_branches()

In case the length of branch name is greather then PATH_MAX-7, we write
to unallocated memory otherwise.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-remote: add verbose mode to git remote updateCheng Renquan Tue, 18 Nov 2008 11:04:02 +0000 (19:04 +0800)

git-remote: add verbose mode to git remote update

Pass the verbose mode parameter to the underlying fetch command.

$ ./git remote -v update
Updating origin
From git://git.kernel.org/pub/scm/git/git
= [up to date] html -> origin/html
= [up to date] maint -> origin/maint
= [up to date] man -> origin/man
= [up to date] master -> origin/master
= [up to date] next -> origin/next
= [up to date] pu -> origin/pu
= [up to date] todo -> origin/todo

Signed-off-by: Cheng Renquan <crquan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

gitk: Avoid handling the Return key twice in Add BranchAlexander Gavrilov Thu, 13 Nov 2008 20:09:18 +0000 (23:09 +0300)

gitk: Avoid handling the Return key twice in Add Branch

This reverts commit 63767d5fb8fe236d8fdeba44297ac925701b27a0.

A similar change was made as part of commit 76f15947af7, that added
bindings to all dialogs, and this duplication causes mkbrgo to be
called twice, the second time after the window has been destroyed.
As a result, an error window appears when the code tries to access
widgets.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>

gitk: Show local changes properly when we have a path... Paul Mackerras Tue, 18 Nov 2008 08:54:14 +0000 (19:54 +1100)

gitk: Show local changes properly when we have a path limit

Since gitk looks for the HEAD commit to attach the fake commits for
local changes to, we can miss out on seeing the fake commits if we
have a path limit and the HEAD commit doesn't alter any of the files
in the path limit.

This fixes it by running

git rev-list -1 $head -- $paths

if we have a path limit, and taking the result of that as the commit
to attach the fake commits to. This means that we can be attaching
the fake commits to a different commit in each view, so we use a new
$viewmainhead($view) for that.

This also fixes a buglet where updatecommits would only fix up the
fake commits if the HEAD changed since the last call to updatecommits,
whereas it should fix them up if the HEAD has changed since this view
was last created or updated.

Signed-off-by: Paul Mackerras <paulus@samba.org>

gitk: Fix switch statement in parseviewargsPaul Mackerras Tue, 18 Nov 2008 08:44:20 +0000 (19:44 +1100)

gitk: Fix switch statement in parseviewargs

In Tcl, a comment in a switch command where a pattern would be expected
doesn't do what one would expect, so this moves the comments inside the
actions. Doing that shows up an extra "-" which this also removes.

With this, --merge is now handled properly.

Signed-off-by: Paul Mackerras <paulus@samba.org>

Update Hungarian translation. 100% completed.Miklos Vajna Mon, 17 Nov 2008 22:11:43 +0000 (23:11 +0100)

Update Hungarian translation. 100% completed.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Fix index preloading for racy dirty caseLinus Torvalds Mon, 17 Nov 2008 17:01:20 +0000 (09:01 -0800)

Fix index preloading for racy dirty case

In the threaded index preloading case, we must be sure to always use the
CE_MATCH_RACY_IS_DIRTY flag when calling ie_match_stat(), in order to make
sure that we only ever look at the stat() data, and don't try to do
anything fancy.

Because most of git internals are not thread-safe, and must not be called
in parallel.

Otherwise, what happens is that if the timestamps indicate that an entry
_might_ be dirty, we might start actually comparing filesystem data with
the object database. And we mustn't do that, because that would involve
looking up and creating the object structure, and that whole code sequence
with read_sha1_file() where we look up and add objects to the hashes is
definitely not thread-safe.

Nor do we want to add locking, because the whole point of the preload was
to be simple and not affect anything else. With CE_MATCH_RACY_IS_DIRTY, we
get what we wanted, and we'll just leave the hard cases well alone, to be
done later in the much simpler serial case.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'maint'Junio C Hamano Mon, 17 Nov 2008 16:30:14 +0000 (08:30 -0800)

Merge branch 'maint'

* maint:
request-pull: make usage string match manpage

Documentation: tutorial: add information about "git... Christian Couder Mon, 17 Nov 2008 15:43:04 +0000 (16:43 +0100)

Documentation: tutorial: add information about "git help" at the beginning

Talking about "git help" is useful because it has a few more
features (like when using it without arguments or with "-a") and
it may work on non unix like platforms.

Also add a few links to git-help(1) in "See also" sections.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation: user-manual: add information about ... Christian Couder Mon, 17 Nov 2008 15:42:47 +0000 (16:42 +0100)

Documentation: user-manual: add information about "git help" at the beginning

Talking about "git help" is useful because it has a few more
features (like when using it without arguments or with "-a") and
it may work on non unix like platforms.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

builtin-remote.c: plug a small memory leak in get_one_r... Junio C Hamano Mon, 17 Nov 2008 15:54:07 +0000 (07:54 -0800)

builtin-remote.c: plug a small memory leak in get_one_remote_for_updates()

We know that the string pointed at by remote->name won't change. It can
be borrowed as the key in the string_list without copying. Other parts of
existing code such as get_one_entry() already rely on this fact.

Noticed by Cheng Renquan.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-remote: match usage string with the manual pagesCheng Renquan Mon, 17 Nov 2008 11:15:49 +0000 (19:15 +0800)

git-remote: match usage string with the manual pages

Signed-off-by: Cheng Renquan <crquan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

request-pull: make usage string match manpageStefan Naewe Mon, 17 Nov 2008 08:57:19 +0000 (09:57 +0100)

request-pull: make usage string match manpage

The usage string of 'git request-pull' differs from he manpage
which gives the correct 'synopsis'.

Signed-off-by: Stefan Naewe <stefan.naewe@atlas-elektronik.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge git://repo.or.cz/git-guiJunio C Hamano Sun, 16 Nov 2008 23:51:11 +0000 (15:51 -0800)

Merge git://repo.or.cz/git-gui

* git://repo.or.cz/git-gui:
git-gui: Fix the search bar destruction handler.
Update the po template
git-gui: Implement automatic rescan after Tool execution.
git-gui: Allow Tools request arguments from the user.
git-gui: Add a Tools menu for arbitrary commands.
git-gui: Fix the after callback execution in rescan.
git-gui: Implement system-wide configuration handling.
git-gui: try to provide a window icon under X

git-gui: Fix the search bar destruction handler.Alexander Gavrilov Thu, 13 Nov 2008 18:52:52 +0000 (21:52 +0300)

git-gui: Fix the search bar destruction handler.

Since delete_this is an ordinary function, it
should not be passed to cb; otherwise it produces
errors when blame windows are closed. Unfortunately,
it is not noticeable when blame is shown in the
master window, so I missed this bug.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Update the po templateShawn O. Pearce Sun, 16 Nov 2008 21:56:55 +0000 (13:56 -0800)

Update the po template

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Implement automatic rescan after Tool execution.Alexander Gavrilov Sun, 16 Nov 2008 18:46:51 +0000 (21:46 +0300)

git-gui: Implement automatic rescan after Tool execution.

The Tools menu is generally intended for commands that
affect the working directory or repository state. Thus,
the user would usually want to initiate rescan after
execution of a tool. This commit implements it.

In case somebody would want to avoid rescanning after
certain tools, it also adds an option that controls it,
although it is not made available through the Add dialog.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Allow Tools request arguments from the user.Alexander Gavrilov Sun, 16 Nov 2008 18:46:50 +0000 (21:46 +0300)

git-gui: Allow Tools request arguments from the user.

While static commands are already useful, some tools need
additional parameters to reach maximum usability. This
commit adds support for passing them one revision name
parameter, and one arbitrary string. With this addition,
the tools menu becomes flexible enough to implement basic
rebase support:

[core]
editor = kwrite
[guitool "Rebase/Abort"]
cmd = git rebase --abort
confirm = yes
[guitool "Rebase/Continue"]
cmd = git rebase --continue
[guitool "Rebase/Skip Commit"]
cmd = git rebase --skip
confirm = yes
[guitool "Rebase/Start..."]
cmd = git rebase $ARGS $REVISION $CUR_BRANCH
title = Start Rebase
prompt = Rebase Current Branch
argprompt = Flags
revprompt = New Base
revunmerged = yes

Some of the options, like title or prompt, are intentionally
not included in the Add dialog to avoid clutter. Also, the
dialog handles argprompt and revprompt as boolean vars.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Add a Tools menu for arbitrary commands.Alexander Gavrilov Sun, 16 Nov 2008 18:46:49 +0000 (21:46 +0300)

git-gui: Add a Tools menu for arbitrary commands.

Due to the emphasis on scriptability in the git
design, it is impossible to provide 100% complete
GUI. Currently unaccounted areas include git-svn
and other source control system interfaces, TopGit,
all custom scripts.

This problem can be mitigated by providing basic
customization capabilities in Git Gui. This commit
adds a new Tools menu, which can be configured
to contain items invoking arbitrary shell commands.

The interface is powerful enough to allow calling
both batch text programs like git-svn, and GUI editors.
To support the latter use, the commands have access
to the name of the currently selected file through
the environment.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>