Code

git.git
16 years agoMerge branch 'maint'
Shawn O. Pearce [Thu, 20 Sep 2007 17:01:32 +0000 (13:01 -0400)]
Merge branch 'maint'

* maint:
  git-gui: Avoid using bold text in entire gui for some fonts

16 years agogit-gui: Avoid using bold text in entire gui for some fonts
Simon Sasburg [Tue, 18 Sep 2007 22:33:34 +0000 (00:33 +0200)]
git-gui: Avoid using bold text in entire gui for some fonts

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agoMerge branch 'maint'
Shawn O. Pearce [Mon, 17 Sep 2007 03:15:21 +0000 (23:15 -0400)]
Merge branch 'maint'

* maint:
  git-gui: Disable native platform text selection in "lists"

Conflicts:

lib/browser.tcl

16 years agogit-gui: Disable native platform text selection in "lists" gitgui-0.8.3
Shawn O. Pearce [Mon, 17 Sep 2007 03:12:19 +0000 (23:12 -0400)]
git-gui: Disable native platform text selection in "lists"

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

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

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

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Paper bag fix missing translated strings
Shawn O. Pearce [Fri, 14 Sep 2007 05:50:09 +0000 (01:50 -0400)]
git-gui: Paper bag fix missing translated strings

The Tcl expression "[append [mc Foo] Bar]" does not return the string
"FooBar" after translation; instead it is setting the variable Foo to
the value Bar, or if Foo is already defined it is appending Bar onto
the end of it.  This is *not* what we wanted to have happen here.

Tcl's join function is actually the correct function but its default
joinStr argument is a single space.  Unfortunately all of our call
sites do not want an extra space added to their string.  So we need
a small wrapper function to make the call to join with an empty
join string.  In C this is (roughly) the job of the strcat function.
Since strcat is not yet used at the global level it is a reasonable
name to use here.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Make the tree browser also use lightgray selection
Shawn O. Pearce [Fri, 14 Sep 2007 00:52:34 +0000 (20:52 -0400)]
git-gui: Make the tree browser also use lightgray selection

In 9adccb05 Matthijs Melchior changed our selection colors in the
main index/working directory file lists to use a lightgray as the
background color as this made the UI easier to read on all platforms.

When we did that change we missed doing also doing in the file
browser UI.  Doing so just makes the entire thing UI consistent.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: add some strings to translation
Michele Ballabio [Thu, 13 Sep 2007 13:19:05 +0000 (15:19 +0200)]
git-gui: add some strings to translation

Most of these changes were suggested by Shawn Pearce in an answer
to Johannes Schindelin.

Some strings for the blame module were added too.

[sp: Minor edits in blame module formatting]

Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agoMerge branch 'maint'
Shawn O. Pearce [Fri, 14 Sep 2007 00:13:59 +0000 (20:13 -0400)]
Merge branch 'maint'

* maint:
  git-gui: Paper bag fix "Commit->Revert" format arguments
  git-gui: Provide 'uninstall' Makefile target to undo an installation
  git-gui: Font chooser to handle a large number of font families

16 years agogit-gui: Paper bag fix "Commit->Revert" format arguments
Shawn O. Pearce [Fri, 14 Sep 2007 00:08:53 +0000 (20:08 -0400)]
git-gui: Paper bag fix "Commit->Revert" format arguments

The recent bug fix to correctly handle filenames with %s (or any
other valid Tcl format specifier) missed a \ on this line and
caused the remaining format arguments to not be supplied when we
updated the status bar.  This caused a Tcl error anytime the user
was trying to perform a file revert.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Provide 'uninstall' Makefile target to undo an installation
Shawn O. Pearce [Thu, 13 Sep 2007 23:50:35 +0000 (19:50 -0400)]
git-gui: Provide 'uninstall' Makefile target to undo an installation

Several users have requested a "make uninstall" target be provided
in the stock git-gui Makefile so that they can undo an install
if git-gui goes to the wrong place during the initial install,
or if they are unhappy with the tool and want to remove it from
their system.

We currently assume that the complete set of files we need to delete
are those defined by our Makefile and current source directory.
This could differ from what the user actually has installed if they
installed one version then attempt to use another to perform the
uninstall.  Right now I'm just going to say that is "pilot error".
Users should uninstall git-gui using the same version of source
that they used to make the installation.  Perhaps in the future we
could read tclIndex and base our uninstall decisions on its contents.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agoMerge branch 'maint'
Shawn O. Pearce [Thu, 13 Sep 2007 23:19:42 +0000 (19:19 -0400)]
Merge branch 'maint'

* maint:
  git-gui: Make backporting changes from i18n version easier

16 years agogit-gui: Font chooser to handle a large number of font families
Shawn O. Pearce [Thu, 13 Sep 2007 23:07:46 +0000 (19:07 -0400)]
git-gui: Font chooser to handle a large number of font families

Simon Sasburg noticed that on X11 if there are more fonts than can
fit in the height of the screen Tk's native tk_optionMenu does not
offer scroll arrows to the user and it is not possible to review
all choices or to select those that are off-screen.  On Mac OS X
the tk_optionMenu works properly but is awkward to navigate if the
list is long.

This is a rewrite of our font selection by providing a new modal
dialog that the user can launch from the git-gui Options panel.
The dialog offers the user a scrolling list of fonts in a pane.
An example text shows the user what the font looks like at the size
they have selected.  But I have to admit the example pane is less
than ideal.  For example in the case of our diff font we really
should show the user an example diff complete with our native diff
syntax coloring.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Acked-by: Simon Sasburg <simon.sasburg@gmail.com>
16 years agogit-gui: Make backporting changes from i18n version easier
Shawn O. Pearce [Thu, 13 Sep 2007 23:04:14 +0000 (19:04 -0400)]
git-gui: Make backporting changes from i18n version easier

This is a very trivial hack to define a global mc procedure that
does not actually perform i18n translations on its input strings.
By declaring an mc procedure here in our maint version of git-gui
we can take patches that are intended for the latest development
version of git-gui and easily backport them without needing to
tweak the mc calls first.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Document the new i18n context support
Shawn O. Pearce [Wed, 12 Sep 2007 21:03:27 +0000 (17:03 -0400)]
git-gui: Document the new i18n context support

Translators working on po files will likely need to know what the
@@noun and @@verb parts are in the original message text, and why
these are different messages in the po files.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Disambiguate "commit"
Harri Ilari Tapio Liusvaara [Wed, 12 Sep 2007 20:02:35 +0000 (23:02 +0300)]
git-gui: Disambiguate "commit"

Commit is used as both verb and noun. While these happen to be
the same in some languages, they are not the same in all
languages, so disambiguate them using context-sensitive i18n.

Signed-off-by: Harri Ilari Tapio Liusvaara <hliusvaa@cc.hut.fi>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Support context-sensitive i18n
Shawn O. Pearce [Wed, 12 Sep 2007 20:47:06 +0000 (16:47 -0400)]
git-gui: Support context-sensitive i18n

Ocassionally, one would want to translate the same string used in
different contexts in diffrent ways. This patch provides a wrapper
for msgcat::mc that trims "@@" and anything coming after it, whether
or not the string actually got translated.

Proposed-by: Harri Ilari Tapio Liusvaara <hliusvaa@cc.hut.fi>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agoMerge branch 'maint'
Shawn O. Pearce [Tue, 11 Sep 2007 22:57:26 +0000 (18:57 -0400)]
Merge branch 'maint'

* maint:
  git-gui: Don't delete send on Windows as it doesn't exist

16 years agogit-gui: Don't delete send on Windows as it doesn't exist
Shawn O. Pearce [Tue, 11 Sep 2007 17:37:45 +0000 (13:37 -0400)]
git-gui: Don't delete send on Windows as it doesn't exist

The Windows port of Tk does not have the send command so we
cannot delete it from our global namespace, but the Mac OS
X and X11 ports do have it.  Switching this delete attempt
into a catch makes send go away, or stay away.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Localize commit/author dates when displaying them
Shawn O. Pearce [Mon, 10 Sep 2007 05:54:16 +0000 (01:54 -0400)]
git-gui: Localize commit/author dates when displaying them

Currently the Git plumbing is not localized so it does not know how
to output weekday and month names that conform to the user's locale
preferences.  This doesn't fit with the rest of git-gui's UI as some
of our dates are formatted in Tcl and some are just read from the Git
plumbing so dates aren't consistently presented.

Since git-for-each-ref is presenting us formatted dates and it offers
no way to change that setting even in git 1.5.3.1 we need to first do
a parse of the text strings it produces, correct for timezones, then
reformat the timestamp using Tcl's formatting routines.

Not exactly what I wanted to do but it gets us consistently presented
date strings in areas like the blame viewer and the revision picker
mega-widget's tooltips.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Mark revision chooser tooltip for translation
Shawn O. Pearce [Mon, 10 Sep 2007 04:40:46 +0000 (00:40 -0400)]
git-gui: Mark revision chooser tooltip for translation

Someone on #git today pointed out that the revision chooser's tooltips
are were being drawn with untranslated strings for the fixed labels we
include, such as "updated", "commit" and "remote".  These strings are
now passed through mc to allow them to be localized.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agoMerge branch 'maint'
Shawn O. Pearce [Mon, 10 Sep 2007 00:56:04 +0000 (20:56 -0400)]
Merge branch 'maint'

* maint:
  git-gui: Trim trailing slashes from untracked submodule names
  git-gui: Assume untracked directories are Git submodules
  git-gui: handle "deleted symlink" diff marker
  git-gui: show unstaged symlinks in diff viewer

16 years agogit-gui: Trim trailing slashes from untracked submodule names
Shawn O. Pearce [Mon, 10 Sep 2007 00:38:05 +0000 (20:38 -0400)]
git-gui: Trim trailing slashes from untracked submodule names

Oddly enough `git ls-files --others` supplies us the name of an
untracked submodule by including the trailing slash but that
same git version will not accept the name with a trailing slash
through `git update-index --stdin`.  Stripping off that final
slash character before loading it into our file lists allows
git-gui to stage changes to submodules just like any other file.

This change should give git-gui users some basic submodule support,
but it is strictly at the plumbing level as we do not actually know
about calling the git-submodule porcelain that is a recent addition
to git 1.5.3.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Assume untracked directories are Git submodules
Shawn O. Pearce [Mon, 10 Sep 2007 00:13:10 +0000 (20:13 -0400)]
git-gui: Assume untracked directories are Git submodules

If `git ls-files --others` returned us the name of a directory then
it is because Git has decided that this directory itself contains a
valid Git repository and its files shouldn't be listed as untracked
for this repository.

In such a case we should label the object as a Git repository and
not just as a directory.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: handle "deleted symlink" diff marker
Michele Ballabio [Sun, 9 Sep 2007 19:09:07 +0000 (21:09 +0200)]
git-gui: handle "deleted symlink" diff marker

Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: show unstaged symlinks in diff viewer
Michele Ballabio [Sun, 9 Sep 2007 19:04:45 +0000 (21:04 +0200)]
git-gui: show unstaged symlinks in diff viewer

git-gui has a minor problem with regards to symlinks that point
to directories.

git init
mkdir realdir
ln -s realdir linkdir
git gui

Now clicking on file names in the "unstaged changes" window,
there's a problem coming from the "linkdir" symlink: git-gui
complains with

error reading "file4": illegal operation on a directory

...even though git-gui can add that same symlink to the index just
fine.

This patch fix this by adding a check.

[sp: Minor fix to use {link} instead of "link" in condition
     and to only open the path if it is not a symlink.]

Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agoMerge branch 'maint'
Shawn O. Pearce [Sun, 9 Sep 2007 09:03:56 +0000 (05:03 -0400)]
Merge branch 'maint'

* maint:
  git-gui: Avoid use of libdir in Makefile
  git-gui: Disable Tk send in all git-gui sessions
  git-gui: lib/index.tcl: handle files with % in the filename properly

16 years agogit-gui: Avoid use of libdir in Makefile
Shawn O. Pearce [Sun, 9 Sep 2007 03:05:43 +0000 (23:05 -0400)]
git-gui: Avoid use of libdir in Makefile

Dmitry V. Levin pointed out that on GNU linux libdir is often used
in Makefiles to mean "/usr/lib" or "/usr/lib64", a directory that
is meant to hold platform-specific binary files.  Using a different
libdir meaning here in git-gui's Makefile breaks idomatic expressions
like rpm specifile "make libdir=%_libdir".

Originally I asked that the git.git Makefile undefine libdir before
it calls git-gui's own Makefile but it turns out this is very hard
to do, if not impossible.  Renaming our libdir to gg_libdir resolves
this case with a minimum amount of fuss on our part.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Disable Tk send in all git-gui sessions
Shawn O. Pearce [Sun, 9 Sep 2007 03:47:00 +0000 (23:47 -0400)]
git-gui: Disable Tk send in all git-gui sessions

The Tk designers blessed us with the "send" command, which on X11
will allow anyone who can connect to your X server to evaluate any
Tcl code they desire within any running Tk process.  This is just
plain nuts.  If git-gui wants someone running Tcl code within it
then would ask someone to supply that Tcl code to it; waiting for
someone to drop any random Tcl code into us is not fantastic idea.

By renaming send to the empty name the procedure will be removed
from the global namespace and Tk will stop responding to random Tcl
evaluation requests sent through the X server.  Since there is no
facility to filter these requests it is unlikely that we will ever
consider enabling this command.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: lib/index.tcl: handle files with % in the filename properly
Gerrit Pape [Fri, 7 Sep 2007 17:16:59 +0000 (17:16 +0000)]
git-gui: lib/index.tcl: handle files with % in the filename properly

Steps to reproduce the bug:

 $ mkdir repo && cd repo && git init
 Initialized empty Git repository in .git/
 $ touch 'foo%3Fsuite'
 $ git-gui

Then click on the 'foo%3Fsuite' icon to include it in a changeset, a
popup comes with:
'Error: bad field specifier "F"'

Vincent Danjean noticed the problem and also suggested the fix, reported
through
 http://bugs.debian.org/441167

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agoMerge branch 'maint'
Shawn O. Pearce [Tue, 4 Sep 2007 03:07:59 +0000 (23:07 -0400)]
Merge branch 'maint'

* maint:
  git-gui: Properly set the state of "Stage/Unstage Hunk" action
  git-gui: Fix detaching current branch during checkout
  git-gui: Correct starting of git-remote to handle -w option

Conflicts:

git-gui.sh

16 years agogit-gui: Ensure msgfmt failure stops GNU make
Shawn O. Pearce [Mon, 3 Sep 2007 22:54:14 +0000 (18:54 -0400)]
git-gui: Ensure msgfmt failure stops GNU make

If we have a failure executing msgfmt (such as the process just
crashes no matter what arguments you supply it because its own
installation is borked) we should stop the build process rather
than letting it continue along its merry way as if the .msg files
were created.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Properly set the state of "Stage/Unstage Hunk" action
Shawn O. Pearce [Sun, 2 Sep 2007 19:38:04 +0000 (15:38 -0400)]
git-gui: Properly set the state of "Stage/Unstage Hunk" action

Today I found yet another way for the "Stage Hunk" and "Unstage
Hunk" context menu actions to leave the wrong state enabled in
the UI.  The problem this time was that I connected the state
determination to the value of $::current_diff_side (the side the
diff is from).  When the user was last looking at a diff from the
index side and unstages everything the diff panel goes empty, but
the action stayed enabled as we always assumed unstaging was a
valid action.

This change moves the logic for determining when the action is
enabled away from the individual side selection, as they really
are two unrelated concepts.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Fix detaching current branch during checkout
Shawn O. Pearce [Sun, 2 Sep 2007 19:30:26 +0000 (15:30 -0400)]
git-gui: Fix detaching current branch during checkout

If the user tried to detach their HEAD while keeping the working
directory on the same commit we actually did not completely do
a detach operation internally.  The problem was caused by git-gui
not forcing the HEAD symbolic ref to be updated to a SHA-1 hash
when we were not switching revisions.  Now we update the HEAD ref
if we aren't currently detached or the hashes don't match.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Correct starting of git-remote to handle -w option
Shawn O. Pearce [Sun, 2 Sep 2007 19:19:07 +0000 (15:19 -0400)]
git-gui: Correct starting of git-remote to handle -w option

Current versions of git-remote apparently are passing the -w option
to Perl as part of the shbang line:

  #!/usr/bin/perl -w

this caused a problem in git-gui and gave the user a Tcl error with
the message: "git-remote not supported: #!/usr/bin/perl -w".

The fix for this is to treat the shbang line as a Tcl list and look
at the first element only for guessing the executable name.  Once
we know the executable name we use the remaining elements (if any
exist) as arguments to the executable, before the script filename.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: remove dots in some UI strings
Michele Ballabio [Sun, 2 Sep 2007 12:43:00 +0000 (14:43 +0200)]
git-gui: remove dots in some UI strings

Dots in a UI string usually mean that a dialog box will
appear waiting for further input. So this patch removes
unneeded dots for actions that do not require user's
input.

Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Quiet the msgfmt part of the make process
Shawn O. Pearce [Mon, 3 Sep 2007 04:42:09 +0000 (00:42 -0400)]
git-gui: Quiet the msgfmt part of the make process

I really prefer having a very short and sweet makefile output that
does not flood the user's screen with a ton of commands that they
don't care much about.  Traditionally git-gui has hidden away the
actual commands from output by the $(QUIET*) series of macros but
allow them to be seen with either `make QUIET=` or `make V=1`.

This change makes our i18n message generation process to be a lot
shorter and easier to digest at a glance:

  GITGUI_VERSION = 0.8.2.19.gb868-dirty
    * new locations or Tcl/Tk interpreter
    GEN git-gui
    BUILTIN git-citool
    INDEX lib/
    MSGFMT    po/de.msg 268 translated.
    MSGFMT    po/hu.msg 268 translated.
    MSGFMT    po/it.msg 268 translated.
    MSGFMT    po/ja.msg 268 translated.
    MSGFMT    po/ru.msg 249 translated, 12 fuzzy, 4 untranslated.
    MSGFMT po/zh_cn.msg 60 translated, 37 fuzzy, 168 untranslated.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Correct stock message for 'Invalid font specified in %s'
Shawn O. Pearce [Mon, 3 Sep 2007 04:22:19 +0000 (00:22 -0400)]
git-gui: Correct stock message for 'Invalid font specified in %s'

This particular message is talking about a specific option in the
configuration file named "gui.$name".  This option is not localized
so we cannot localize the "gui." that denotes the section the option
$name is found within.  Currently there are no plans to localize the
configuration options for git-gui, but if that were to change in the
future then it would be necessary to localize not only the "gui."
section prefix but also the $name (fontui and fontdiff).

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Update po/README as symlink process is not necessary
Shawn O. Pearce [Mon, 3 Sep 2007 04:17:04 +0000 (00:17 -0400)]
git-gui: Update po/README as symlink process is not necessary

We don't actually need to create the lib/msgs symlink back to our
po directory in the source tree.  git-gui.sh is smart enough to
figure out this is where the msg files are and will load them from
the po directory if invoked as git-gui.sh.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Added initial version of po/glossary/zh_cn.po
Xudong Guan [Wed, 25 Jul 2007 12:47:17 +0000 (13:47 +0100)]
git-gui: Added initial version of po/glossary/zh_cn.po

with contributions from LI Yang, WANG Cong, ZHANG Le, and rae l
from the zh-kernel.org mailing list.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
16 years agoGerman glossary for translation
Christian Stimming [Tue, 24 Jul 2007 12:59:15 +0000 (14:59 +0200)]
German glossary for translation

Signed-off-by: Christian Stimming <christian.stimming@ibeo-as.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
16 years agoHungarian translation of git-gui
Miklos Vajna [Fri, 27 Jul 2007 12:37:33 +0000 (14:37 +0200)]
Hungarian translation of git-gui

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
16 years agogit-gui: initial version of russian translation
Irina Riesen [Sun, 22 Jul 2007 11:57:12 +0000 (13:57 +0200)]
git-gui: initial version of russian translation

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Irina Riesen <irina.riesen@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
16 years agoItalian translation of git-gui
Paolo Ciarrocchi [Sun, 22 Jul 2007 10:51:13 +0000 (12:51 +0200)]
Italian translation of git-gui

[jes: includes patches from Michele Ballabio]

Signed-off-by: Paolo Ciarrocchi <paolo.ciarrocchi@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
16 years agoJapanese translation of git-gui
しらいしななこ [Wed, 25 Jul 2007 08:59:58 +0000 (17:59 +0900)]
Japanese translation of git-gui

[jes: Also includes work from Junio Hamano]

Signed-off-by: しらいしななこ <nanako3@bluebottle.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
16 years agoInitial Chinese translation for git-gui
Xudong Guan [Sun, 22 Jul 2007 00:08:56 +0000 (01:08 +0100)]
Initial Chinese translation for git-gui

Simplified Chinese, in UTF-8 encoding.

Signed-off-by: Xudong Guan <xudong.guan@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
16 years agoGerman translation for git-gui
Christian Stimming [Sat, 21 Jul 2007 12:18:14 +0000 (14:18 +0200)]
German translation for git-gui

Signed-off-by: Christian Stimming <stimming@tuhh.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
16 years agoAdd glossary translation template into git.
Christian Stimming [Fri, 27 Jul 2007 17:24:45 +0000 (19:24 +0200)]
Add glossary translation template into git.

This way, it should be easier for new translators to actually find out
about the glossary.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
16 years agoAdd glossary that can be converted into a po file for each language.
Christian Stimming [Mon, 23 Jul 2007 20:11:12 +0000 (22:11 +0200)]
Add glossary that can be converted into a po file for each language.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
16 years agoIgnore po/*.msg
Johannes Schindelin [Sun, 22 Jul 2007 11:31:45 +0000 (12:31 +0100)]
Ignore po/*.msg

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
16 years agoAdd po/git-gui.pot
Johannes Schindelin [Sun, 22 Jul 2007 01:12:18 +0000 (02:12 +0100)]
Add po/git-gui.pot

Usually, generated files are not part of the tracked content in
a project.  However, translators may lack the tools to generate
git-gui.pot.  Besides, it is possible that a contributor does
not even check out the repository, but gets this file via gitweb.

Pointed out by Junio.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
16 years agogit-gui po/README: Guide to translators
Junio C Hamano [Fri, 27 Jul 2007 23:05:16 +0000 (16:05 -0700)]
git-gui po/README: Guide to translators

This short note is to help a translation contributor to help us
localizing git-gui message files by covering the basics.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMakefile rules for translation catalog generation and installation.
Christian Stimming [Sat, 21 Jul 2007 12:17:07 +0000 (14:17 +0200)]
Makefile rules for translation catalog generation and installation.

[jes: with fixes by the i18n team.]

Signed-off-by: Christian Stimming <stimming@tuhh.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
16 years agoMark strings for translation.
Christian Stimming [Sat, 21 Jul 2007 12:21:34 +0000 (14:21 +0200)]
Mark strings for translation.

The procedure [mc ...] will translate the strings through msgcat.
Strings must be enclosed in quotes, not in braces, because otherwise
xgettext cannot extract them properly, although on the Tcl side both
delimiters would work fine.

[jes: I merged the later patches to that end.]

Signed-off-by: Christian Stimming <stimming@tuhh.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
16 years agogit-gui: Initialize Tcl's msgcat library for internationalization
Shawn O. Pearce [Sun, 2 Sep 2007 02:22:42 +0000 (22:22 -0400)]
git-gui: Initialize Tcl's msgcat library for internationalization

Tcl's msgcat library and corresponding mc procedure can locate a
translated string for any user message, provided that it is first
given a directory where the *.msg files are located containing the
translations.

During installation we will place the translations in lib/msgs/,
so we need to inform msgcat of this location once we determine it
during startup.  Our source code tree however will store all of
the translations within the po/ directory, so we need to special
case this variant.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Locate the library directory early during startup
Shawn O. Pearce [Sun, 2 Sep 2007 01:58:29 +0000 (21:58 -0400)]
git-gui: Locate the library directory early during startup

To support a localized version of git-gui we need to locate the
library directory early so we can initialize Tcl's msgcat package
to load translated messages from.  This needs to occur before we
declare our git-version proc so that errors related to locating
git or assessing its version can be reported to the end-user in
their preferred language.  However we have to keep the library
loading until after git-version has been declared, otherwise we
will fail to start git-gui if we are using a fake tclIndex that
was generated by our Makefile.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Correct 'git gui blame' in a subdirectory gitgui-0.8.2
Shawn O. Pearce [Sat, 25 Aug 2007 03:15:50 +0000 (23:15 -0400)]
git-gui: Correct 'git gui blame' in a subdirectory

David Kastrup pointed out that the following sequence was not
working as we had intended:

  $ cd lib
  $ git gui blame console.tcl
  fatal: cannot stat path lib/console.tcl: No such file or directory

The problem here was we disabled the chdir to the root of the
working tree when we are running with a "bare allowed" feature
such as blame or browser, but we still kept the prefix we found via
`git rev-parse --show-prefix`.  This caused us to try and look for
the file "console.tcl" within the subdirectory but also include
the subdirectory's own path from the root of the working tree.
This is unlikely to succeed, unless the user just happened to have
a "lib/lib/console.tcl" file in the repository, in which case we
would produce the wrong result.

In the case of a bare repository we shouldn't get back a value from
`rev-parse --show-prefix`, so really $_prefix should only be set
to the non-empty string if we are in a working tree and we are in a
subdirectory of that working tree.  If this is true we really want
to always be at the top level of the working tree, as all paths are
accessed as though they were relative to the top of the working tree.
Converting $_prefix to a ../ sequence is a fairly simple approach
to moving up the requisite levels.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Do not offer to stage three-way diff hunks into the index
Shawn O. Pearce [Thu, 23 Aug 2007 06:44:13 +0000 (02:44 -0400)]
git-gui: Do not offer to stage three-way diff hunks into the index

git-apply does not accept a patch that was generated as a three-way
combined diff format such as we see during merge conflicts.  If we
get such a diff in our diff viewer and try to send it to git-apply
it just errors out and the user is left confused wondering why they
cannot stage that hunk.

Instead of feeding a known to be unacceptable hunk to git-apply we
now just disable the stage/unstage context menu option if the hunk
came from a three way diff.  The user may still be confused about
why they cannot work with a combined diff, but at least they are
only confused as to why git-gui is not offering them the action.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Refactor diff pane popup support for future improvements
Shawn O. Pearce [Thu, 23 Aug 2007 06:39:45 +0000 (02:39 -0400)]
git-gui: Refactor diff pane popup support for future improvements

The current popup_diff_menu procedure is somewhat messy as it has a
few duplications of the same logic in each of the different legs of
the routine.  We can simplify these by setting a few state variables
in the different legs.

No functional change, just a cleanup to make it easier to implement
future functional changes within this block.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Fix "unoptimized loading" to not cause git-gui to crash
Shawn O. Pearce [Wed, 22 Aug 2007 06:41:00 +0000 (02:41 -0400)]
git-gui: Fix "unoptimized loading" to not cause git-gui to crash

If the tclsh command was not available to us at the time we were
"built" our lib/tclIndex just lists all of our library files and
we source all of them at once during startup, rather than trying
to lazily load only the procedures we need.  This is a problem as
some of our library code now depends upon the git-version proc,
and that proc is not defined until after the library was fully
loaded.

I'm moving the library loading until after we have determined the
version of git we are talking to, as this ensures that the required
git-reversion procedure is defined before any library code can be
loaded.  Since error_popup is defined in the library we instead use
tk_messageBox directly for errors found during the version detection.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Paper bag fix "Stage Hunk For Commit" in diff context menu
Shawn O. Pearce [Tue, 21 Aug 2007 06:22:53 +0000 (02:22 -0400)]
git-gui: Paper bag fix "Stage Hunk For Commit" in diff context menu

In a13ee29b975d3a9a012983309e842d942b2bbd44 I totally broke the
"Stage Hunk For Commit" feature by making this menu item always
appear in a disabled state, so it was never invokable.  A "teaser
feature", just sitting there taunting the poor user who has become
used to having it available.

The issue caused by a13ee was I added a test to look at the data
in $file_states, but I didn't do that test correctly as it was
always looking at a procedure local $file_states array, which is
not defined, so the test was always true and we always disabled
the menu entry.

Instead we only want to disable the menu entry if the current file
we are looking at has no file state information (git-gui is just a
very confused little process) or it is an untracked file (and we
cannot stage individual hunks).

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Allow git-merge to use branch names in conflict markers
Shawn O. Pearce [Mon, 20 Aug 2007 06:17:05 +0000 (02:17 -0400)]
git-gui: Allow git-merge to use branch names in conflict markers

Earlier when I rewrote the merge implementation for git-gui I broke
it such that the conflict markers for the "theirs" side of the hunk
was using a full SHA-1 ID in hex, rather than the name of the branch
the user had merged.  This was because I got paranoid and passed off
the full SHA-1 to git-merge, instead of giving it the reference name
the user saw in the merge dialog.

I'd still like to resolve the SHA-1 upfront in git-gui and always use
that value throughout the merge, but I can't do that until we have a
full implementation of git-merge written in Tcl.  Until then its more
important that the conflict markers be useful to the end-user, so we
need to pass off the ref name and not the SHA-1 ID.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Fix window manager problems on ion3
Shawn O. Pearce [Mon, 20 Aug 2007 04:53:04 +0000 (00:53 -0400)]
git-gui: Fix window manager problems on ion3

cehteh on #git noticed that secondary windows such as console
windows from push/fetch/merge or the blame browser failed on ion
when we tried to open them a second time.

The issue turned out to be the fact that on ion [winfo ismapped .]
returns false if . is not visible right now because it has been
obscured by another window in the same panel.  So we need to keep
track of whether or not the root window has been displayed for this
application, and once it has been we cannot ever assume that ismapped
is going to return true.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Added support for OS X right click gitgui-0.8.1
Väinö Järvelä [Fri, 3 Aug 2007 09:27:39 +0000 (12:27 +0300)]
git-gui: Added support for OS X right click

OS X sends Button-2 on a "real" right click, such as with a three
button mouse, or by using the two-finger trackpad click.

Signed-off-by: Väinö Järvelä <v@pp.inet.fi>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Avoid Tcl error in popup menu on diff viewer
Shawn O. Pearce [Fri, 3 Aug 2007 02:55:22 +0000 (22:55 -0400)]
git-gui: Avoid Tcl error in popup menu on diff viewer

If there is no path currently shown in the diff viewer then we
were getting Tcl errors anytime the user right-clicked on the
diff viewer to bring up its popup menu.  The bug here is caused
by trying to get the file_state for the empty string; this path
is never seen so we never have file_state for it.  In such cases
we now disable the Stage Hunk For Commit option.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Minor refactoring of merge command line in merge support gitgui-0.8.0
Shawn O. Pearce [Mon, 30 Jul 2007 00:21:54 +0000 (20:21 -0400)]
git-gui: Minor refactoring of merge command line in merge support

This is just a small code movement to cleanup how we generate
the command line for a merge.  I'm only doing it to make the
next series of changes slightly more readable.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Use more modern looking icons in the tree browser
Shawn O. Pearce [Mon, 30 Jul 2007 01:19:54 +0000 (21:19 -0400)]
git-gui: Use more modern looking icons in the tree browser

This is a replacement of all of the icons in our tree browser
window, as the prior icons just looked too 1980s Tk-ish.  The
icons used here are actually from a KDE themed look, so they
might actually be familiar to some users of git-gui.

Aside from using more modern looking icons we now have a special
icon for executable blobs, to make them stand out from the normal
non-executable blobs.  We also denote symlinks now with a different
icon, so they stand out from the other types of objects in the tree.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Don't offer to stage hunks from untracked files
Shawn O. Pearce [Mon, 30 Jul 2007 00:29:52 +0000 (20:29 -0400)]
git-gui: Don't offer to stage hunks from untracked files

If the user looks at an untracked file in our diff pane we used
to offer "Stage Hunk For Commit" in the context menu when they
right-clicked in that pane.  The problem is we don't actually
have any diff hunks in untracked files, so there is nothing to
really select for staging.  So we now grey out the menu item,
so the user cannot invoke it and think its broken when it does
not perform any useful action.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Make sure remotes are loaded when picking revisions
Shawn O. Pearce [Mon, 30 Jul 2007 01:26:42 +0000 (21:26 -0400)]
git-gui: Make sure remotes are loaded when picking revisions

If we are started for only a blame/browser/citool run we don't
usually initialize the list of remotes, or determine which refs
are tracking branches and which are local branch heads.  This is
because some of that work is relatively expensive and is usually
not going to be needed if we are started only for a blame, or to
make a single commit.

However by not loading the remote configuration we were crashing
if the user tried to open a browser for another branch through
the Repository menu, as our load_all_heads procedure was unable
to decide which refs/heads/ items were actually local heads.  We
now force all remote configuration data to be loaded if we have
not done so already and we are trying to create a revision mega
widget.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Use progress bar while resetting/aborting files
Shawn O. Pearce [Sun, 29 Jul 2007 08:06:51 +0000 (04:06 -0400)]
git-gui: Use progress bar while resetting/aborting files

Resetting a large number of files on a slow filesystem can take
considerable time, just as switching branches in such a case can
take more than two seconds.  We now take advantage of the progress
meter output by read-tree and show it in the main window status
bar, just like we do during checkout (branch switch).

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Honor core.excludesfile when listing extra files
Shawn O. Pearce [Sun, 29 Jul 2007 07:22:27 +0000 (03:22 -0400)]
git-gui: Honor core.excludesfile when listing extra files

Recent git versions have a git-status that honors the core.excludesfile
configuration option when it reports on untracked files.  Unfortunately
I missed the introduction of this configuration option in the core
porcelain implementation, so it was not reflected here in git-gui.

Found and reported by Lars Noschinski <lars@public.noschinski.de>.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Unify wording to say "to stage" instead of "to add"
Christian Stimming [Sat, 28 Jul 2007 20:17:10 +0000 (22:17 +0200)]
git-gui: Unify wording to say "to stage" instead of "to add"

Also, the warning message when clicking "Reset" is adapted to
the wording "Reset" rather than a confusion "Cancel commit?".

Signed-off-by: Christian Stimming <stimming@tuhh.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Don't kill modified commit message buffer with merge templates
Shawn O. Pearce [Fri, 27 Jul 2007 06:30:15 +0000 (02:30 -0400)]
git-gui: Don't kill modified commit message buffer with merge templates

If the user is in the middle of a merge and has already started to
modify their commit message we were losing the user's changes when
they pressed 'Rescan' after resolving issues or making changes in
the working directory.

The problem here was our background timer that saves the commit
message buffer.  It marks the commit message buffer as not being
modified when it writes it out to disk, so during the rescan we
assumed the buffer should be replaced with what we read from the
MERGE_MSG file.  So we now only read these files from .git if we
have a valid backup file.  Since we clear it on commit this will
only have an impact while the user is actively editing the current
commit.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Remove usernames from absolute SSH urls during merging
Shawn O. Pearce [Wed, 25 Jul 2007 09:02:38 +0000 (05:02 -0400)]
git-gui: Remove usernames from absolute SSH urls during merging

If we are being asked to merge a tracking branch that comes from a
remote repository accessed by the very common SSH URL format of
"user@host:/path/to/repo" then we really don't need the username
as part of the merge message, it only clutters up the history and
makes things more confusing.  So we instead clip the username part
off if the local filesystem path is absolute, as its probably not
going to be an ambiguous URL even when it is missing the username.

On the other hand we cannot clip the username off if the URL is
not absolute, because in such cases (e.g. "user@host:myrepo") the
directory that the repository path is resolved in is relative to
the user's home directory, and the username becomes important.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Format tracking branch merges as though they were pulls
Shawn O. Pearce [Wed, 25 Jul 2007 08:54:53 +0000 (04:54 -0400)]
git-gui: Format tracking branch merges as though they were pulls

If we are merging a tracking branch we know exactly what remote URL
that branch is fetched from, and what its name is on that remote
repository.  In this case we can setup a merge message that looks
just like a standard `git-pull $remote $branch` operation by filling
out FETCH_HEAD before we start git-merge, and then run git-merge just
like git-pull does.

I think the result of this behavior is that merges look a lot nicer
when the came off of local tracking branches, because they no longer
say "commit 'origin/...'" to describe the commit being merged but
instead now mention the specific repository we fetched those commits
from.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Cleanup bindings within merge dialog
Shawn O. Pearce [Wed, 25 Jul 2007 08:32:18 +0000 (04:32 -0400)]
git-gui: Cleanup bindings within merge dialog

Misc. code cleanups in the merge dialog's binding setup and action
button creation.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Replace merge dialog with our revision picker widget
Shawn O. Pearce [Wed, 25 Jul 2007 07:44:50 +0000 (03:44 -0400)]
git-gui: Replace merge dialog with our revision picker widget

Now that we only support merging one branch we can offer the user
a better user interface experience by allowing them to select the
revision they want to merge through our revision picking widget.

This change neatly solves the problem of locating a branch out of
a sea of 200 tracking branches, and of dealing with very long branch
names that all have a common prefix.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Show ref last update times in revision chooser tooltips
Shawn O. Pearce [Wed, 25 Jul 2007 08:20:02 +0000 (04:20 -0400)]
git-gui: Show ref last update times in revision chooser tooltips

If we can we now show the last modification date of a loose ref as
part of the tooltip information shown in the revision picker.  This
gives the user an indication of when was the last time that the ref
was modified locally, and may especially be of interest when looking
at a tracking branch.

If we cannot find the loose ref file than we try to fallback on the
reflog and scan it for the date of the last record.  We don't start
with the reflog however as scanning it backwards from the end is not
an easy thing to do in Tcl.  So I'm being lazy here and just going
through the entire file, line by line.  Since that is less efficient
than a single stat system call, its our fallback strategy.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Display commit/tag/remote info in tooltip of revision picker
Shawn O. Pearce [Wed, 25 Jul 2007 08:13:00 +0000 (04:13 -0400)]
git-gui: Display commit/tag/remote info in tooltip of revision picker

Our revision chooser mega-widget now sets up tooltips for itself so
that it displays details about a commit (or a tag and the commit
it refers to) when the user mouses over that line in the filtered
ref list.  If the item is from a remote tracking branch then we also
show the remote url and what branch on that remote we fetch from, so
the user has a clear concept of where that revision data originated.

To help the merge dialog I've also added a new constructor that
makes the dialog only offer unmerged revisions (those not in HEAD),
as this allows users to avoid performing merges only to get "Already
up to date" messages back from core Git.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Save remote urls obtained from config/remotes setup
Shawn O. Pearce [Wed, 25 Jul 2007 07:27:57 +0000 (03:27 -0400)]
git-gui: Save remote urls obtained from config/remotes setup

I'm storing the URLs of any pre-configured remote repositories
that we happen to come across so that we can later use these
URLs to show to the user in parts of the UI that might care.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Avoid unnecessary symbolic-ref call during checkout
Shawn O. Pearce [Sun, 22 Jul 2007 08:49:06 +0000 (04:49 -0400)]
git-gui: Avoid unnecessary symbolic-ref call during checkout

If we are checking out the branch we are already on then there is no
need to call symbolic-ref to update the HEAD pointer to the "new"
branch name, it is already correct.

Currently this situation does not happen very often, but it can be
seen in some workflows where the user always recreates their local
branch from a remote tracking branch and more-or-less ignores what
branch he/she is on right now.  As they say, ignorance is bliss.

This case will however become a tad more common when we overload
checkout_op to actually also perform all of our merges.  In that
case we will likely see that the branch we want to "checkout" is
the current branch, as we are actually just merging into it.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Refactor current branch menu items to make i18n easier
Shawn O. Pearce [Mon, 23 Jul 2007 05:11:08 +0000 (01:11 -0400)]
git-gui: Refactor current branch menu items to make i18n easier

The i18n team has also identified a rather ugly block of code in
git-gui that is used to make a pair of Repository menu items show
the current branch name.  This code is difficult to convert to use
[mc ...] to lookup the translation, so I'm refactoring it into a
procedure.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Refactor diff popup into a procedure to ease i18n work
Shawn O. Pearce [Mon, 23 Jul 2007 04:36:39 +0000 (00:36 -0400)]
git-gui: Refactor diff popup into a procedure to ease i18n work

The folks working on the i18n version of git-gui have had some
trouble trying to convert these English strings into [mc] calls
due to the double evaluation.  Moving this block into a standard
procedure eliminates the double evaluation, making their work
easier.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Paper bag fix quitting crash after commit
Shawn O. Pearce [Mon, 23 Jul 2007 04:20:04 +0000 (00:20 -0400)]
git-gui: Paper bag fix quitting crash after commit

My earlier introduction of the GITGUI_BCK file (which saves the user's
commit message buffer while they are typing it) broke the Quit function.
If the user makes a commit we delete the GITGUI_BCK file; if they then
immediately quit the application we fail to rename the GITGUI_BCK file
to GITGUI_MSG.  This is because the file does not exist, but our flag
still says it does.  The root cause is we did not unset the flag during
commit.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Clarify meaning of add tracked menu option
Shawn O. Pearce [Mon, 23 Jul 2007 04:12:30 +0000 (00:12 -0400)]
git-gui: Clarify meaning of add tracked menu option

Junio recently pointed out on the mailing list that our "Add Existing"
feature is a lot like `git add -u`, which is generally described as
"(Re)Add Tracked Files".  This came up during discussion of how to
translate "Add Existing" into Japanese, as the individual working on
the translation was not quite sure what the option meant and therefore
had some trouble selecting the best translation.

I'm changing the menu option to "Add Tracked Files To Commit" and the
button to "Add Tracked".  This should help new users to better understand
the actions behind those GUI widgets.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Fix unnecessary fast-forward during checkout
Shawn O. Pearce [Sun, 22 Jul 2007 08:09:53 +0000 (04:09 -0400)]
git-gui: Fix unnecessary fast-forward during checkout

If we are trying to checkout a local branch which is matched to a
remote tracking branch, but the local branch is newer than the remote
tracking branch we actually just want to switch to the local branch.
The local branch is "Already up to date".

Unfortunately we tossed away the local branch's commit SHA-1 and kept
the remote tracking branch's SHA-1, which meant that the user lost the
local changes when we updated the working directory.  At least we did
not update the local branch ref, so the user's data was still intact.

We now toss the tracking branch's SHA-1 and replace with the local
branch's SHA-1 before the checkout, ensuring that we pass of the right
tree to git-read-tree when we update the working directory.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Completely remove my Tools/Migrate hack
Shawn O. Pearce [Sat, 21 Jul 2007 20:32:42 +0000 (16:32 -0400)]
git-gui: Completely remove my Tools/Migrate hack

This menu option of Tools/Migrate has been living inside of git-gui
as a local hack to support some coworkers of mine.  It has no value
to anyone outside of my day-job team and never really should have
been in a release version of git-gui.  So I'm pulling it out, so
that nobody else has to deal with this garbage.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Internally allow fetch without storing for future pull support
Shawn O. Pearce [Fri, 20 Jul 2007 08:10:13 +0000 (04:10 -0400)]
git-gui: Internally allow fetch without storing for future pull support

This is actually just an underlying code improvement that has no user
visible component yet.  UI improvements to actually fetch and merge via
an arbitrary remote with no tracking branches must still follow to make
this change useful for the end-user.

Our tracking branch specifications are a Tcl list of three components:

  - local tracking branch name
  - remote name/url
  - remote branch name/tag name

This change just makes the first element optional.  If it is an empty
string we will run the fetch, but have the value be saved only into the
special .git/FETCH_HEAD, where we can pick it up and use it for this one
time operation.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Skip unnecessary read-tree work during checkout
Shawn O. Pearce [Fri, 20 Jul 2007 07:56:06 +0000 (03:56 -0400)]
git-gui: Skip unnecessary read-tree work during checkout

I totally missed this obvious optimization in the checkout code path.
If our current repository HEAD is actually at the commit we are moving
to, and we agreed to perform this switch earlier, then we have no files
to update in the working directory and any stale mtimes are simply not
of consequence right now.  We can pretend like we ran a read-tree and
skip right into the post-read-tree work, such as updating the branch
and setting the symbolic-ref.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Simplify error case for unsupported merge types
Shawn O. Pearce [Fri, 20 Jul 2007 07:37:43 +0000 (03:37 -0400)]
git-gui: Simplify error case for unsupported merge types

If we are given a merge type we don't understand in checkout_op there
is probably a bug in git-gui somewhere that allowed this unknown merge
strategy to come into this part of the code path.  We currently only
recognize three merge types ('none', 'ff' and 'reset') but are going
to be supporting more in the future.  Rather than keep editing this
message I'm going with a very generic "Uh, we don't do that!" type of
error.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Factor out common fast-forward merge case
Shawn O. Pearce [Fri, 20 Jul 2007 07:34:56 +0000 (03:34 -0400)]
git-gui: Factor out common fast-forward merge case

In both the ff and reset merge_types supported by checkout_op the
result is the same if the merge base of our target commit and the
existing commit is the existing commit: its a fast-forward as the
existing commit is fully contained in the target commit.

This minor cleanup in logic will make it easier to implement a
new kind of merge_type that actually merges the two trees with a
real merge strategy, such as git-merge-recursive.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Save the merge base during checkout_op processing
Shawn O. Pearce [Fri, 20 Jul 2007 06:13:24 +0000 (02:13 -0400)]
git-gui: Save the merge base during checkout_op processing

I've decided to teach checkout_op how to perform more than just a
fast-forward and reset type of merge.  This way we can also do a full
recursive merge even when we are recreating an existing branch from
a remote.  To help with that process I'm saving the merge-base we
computed during the ff/reset/fail decision process, in case we need
it later on when we actually start a true merge operation.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Automatically backup the user's commit buffer
Shawn O. Pearce [Sat, 21 Jul 2007 08:57:57 +0000 (04:57 -0400)]
git-gui: Automatically backup the user's commit buffer

A few users have been seeing crashes in Tk when using the undo key
binding to undo the last few keystroke events in the commit buffer.
Unfortunately that means the user loses their commit message and
must start over from scratch when the user restarts the process.

git-gui now saves the user's commit message buffer every couple of
seconds to a temporary file under .git (specifically .git/GITGUI_BCK).
At exit time we rename this file to .git/GITGUI_MSG if there is a
message, the file exists, and it is currently synchronized with the
Tk buffer.  Otherwise we do our usual routine of saving the Tk buffer
to .git/GITGUI_MSG and delete .git/GITGUI_BCK, if it exists.

During startup we favor .git/GITGUI_BCK over .git/GITGUI_MSG.  This
way a crash doesn't take out the user's message buffer but instead
will cause the user to lose only a few keystrokes.  Most people do
not type more than 200 WPM, and with 30 possible saves per minute
we are unlikely to lose more than 7 words.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Completely remove support for creating octopus merges
Shawn O. Pearce [Thu, 19 Jul 2007 06:24:25 +0000 (02:24 -0400)]
git-gui: Completely remove support for creating octopus merges

I'm working on refactoring the UI of the merge dialog, because as it
currently stands the dialog is absolutely horrible, especially when
you have 200+ branches available from a single remote system.

In that refactoring I plan on using the choose_rev widget to allow
the user to select exactly which branch/commit they want to merge.
However since that only selects a single commit I'm first removing
the code that supports octopus merges.

A brief consultation on #git tonight seemed to indicate that the
octopus merge strategy is not as useful as originally thought when
it was invented, and that most people don't commonly use them.  So
making users fall back to the command line to create an octopus is
actually maybe a good idea here, as they might think twice before
they use it.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Don't show blame tooltips that we have no data for
Shawn O. Pearce [Thu, 19 Jul 2007 05:45:42 +0000 (01:45 -0400)]
git-gui: Don't show blame tooltips that we have no data for

If we haven't yet loaded any commit information for a given line but
our tooltip timer fired and tried to draw the tooltip we shouldn't;
there is nothing to show.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Translate standard encoding names to Tcl ones
Shawn O. Pearce [Thu, 19 Jul 2007 05:13:29 +0000 (01:13 -0400)]
git-gui: Translate standard encoding names to Tcl ones

This is a essentially a copy of Paul Mackerras encoding support from
gitk.  I stole the code from gitk commit fd8ccbec4f0161, as Paul has
already done all of the hard work setting up this translation table.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Avoid unnecessary global statements when possible
Shawn O. Pearce [Thu, 19 Jul 2007 04:43:16 +0000 (00:43 -0400)]
git-gui: Avoid unnecessary global statements when possible

Running global takes slightly longer than just accessing the variable
via its package name, especially if the variable is just only once in
the procedure, or isn't even used at all in the procedure.  So this is
a minor cleanup for some of our commonly invoked procedures.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Bind Ctrl/Cmd-M to merge action
Shawn O. Pearce [Thu, 19 Jul 2007 04:39:23 +0000 (00:39 -0400)]
git-gui: Bind Ctrl/Cmd-M to merge action

Users who merge often may want to access the merge action quickly,
so we now bind M to the merge action.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agoDon't offer my special Tools/Migrate hack unless in multicommit
Shawn O. Pearce [Wed, 18 Jul 2007 13:37:27 +0000 (09:37 -0400)]
Don't offer my special Tools/Migrate hack unless in multicommit

Users shouldn't see this menu option if they startup a browser or
blame from the command line, especially if they are doing so on a
bare repository.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Convert merge dialog to use class system
Shawn O. Pearce [Wed, 18 Jul 2007 06:56:44 +0000 (02:56 -0400)]
git-gui: Convert merge dialog to use class system

I've found that the class code makes it a whole lot easier to create
more complex GUI code, especially the dialogs.  So before I make any
major improvements to the merge dialog's interface I'm going to first
switch it to use the class system, so the code is slightly cleaner.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Increase the default height of the revision picker
Shawn O. Pearce [Wed, 18 Jul 2007 06:27:39 +0000 (02:27 -0400)]
git-gui: Increase the default height of the revision picker

Showing only five lines of heads/tags is not very useful to a user
when they have about 10 branches that match the filter expression.
The list is just too short to really be able to read easily, at
least not without scrolling up and down.  Expanding the list out
to 10 really makes the revision picker easier to read and access,
as you can read the matching branches much more quickly.

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