Commit graph

585 commits

Author SHA1 Message Date
Paul Mackerras 76d64ca6b5 gitk: Indent word-wrapped lines in commit display header
In the cases where the lines starting with Precedes:, Follows: and
Branches: in the commit display are long enough to be word-wrapped,
this adds a 1cm margin on the left of the wrapped lines, to make
the display more readable.  Suggested by Stephen Rothwell.

Signed-off-by: Paul Mackerras <paulus@samba.org>
2014-01-23 22:06:22 +11:00
Astril Hayato 8f86339858 gitk: Comply with XDG base directory specification
Write the gitk config data to $XDG_CONFIG_HOME/git/gitk ($HOME/.config/git/gitk
by default) in line with the XDG specification. This makes it consistent with
git which also follows the spec.

If $HOME/.gitk already exists use that for backward compatibility, so only new
installations are affected.

Signed-off-by: Astril Hayato <astrilhayato@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2014-01-22 22:05:32 +11:00
Marc Branchaud 786f15c849 gitk: Replace "next" and "prev" buttons with down and up arrows
Users often find that "next" and "prev" do the opposite of what they
expect.  For example, "next" moves to the next match down the list, but
that is almost always backwards in time.  Replacing the text with arrows
makes it clear where the buttons will take the user.

Signed-off-by: Marc Branchaud <marcnarc@xiplink.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2014-01-21 22:18:23 +11:00
Paul Mackerras 6c626a031a gitk: Update copyright dates
Signed-off-by: Paul Mackerras <paulus@samba.org>
2014-01-21 22:02:27 +11:00
Max Kirillov 1f3c8726cd gitk: Fix mistype
Signed-off-by: Max Kirillov <max@max630.net>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2014-01-21 21:57:03 +11:00
Thomas Rast ce2c58cdaa gitk: Recognize -L option
This gives line-log support to gitk, by exploiting the new support for
processing and showing "inline" diffs straight from the git-log
output.

Note that we 'set allknown 0', which is a bit counterintuitive since
this is a "known" option.  But that flag prevents gitk from thinking
it can optimize the view by running rev-list to see the topology; in
the -L case that doesn't work.

Signed-off-by: Thomas Rast <trast@inf.ethz.ch>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2013-12-02 09:24:20 +11:00
Thomas Rast 9403bd02dd gitk: Support showing the gathered inline diffs
The previous commit split the diffs into a separate field.  Now we
actually want to show them.

To that end we use the stored diff, and

- process it once to build a fake "tree diff", i.e., a list of all
  changed files;

- feed it through parseblobdiffline to actually format it into the
  $ctext field, like the existing diff machinery would.

Signed-off-by: Thomas Rast <trast@inf.ethz.ch>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2013-12-02 09:24:20 +11:00
Thomas Rast b449eb2cb3 gitk: Split out diff part in $commitinfo
So far we just parsed everything after the headers into the "comment"
bit of $commitinfo, including notes and -- if you gave weird options
-- the diff.

Split out the diff, if any, into a separate field.  It's easy to
recognize, since it always starts with /^diff/ and is preceded by an
empty line.

We take care to snip away said empty line.  The display code already
properly spaces the end of the message from the first diff, and
leaving another empty line at the end looks ugly.

Signed-off-by: Thomas Rast <trast@inf.ethz.ch>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2013-12-02 09:24:20 +11:00
Thomas Rast 5de460a2cf gitk: Refactor per-line part of getblobdiffline and its support
For later use with data sources other than a pipe, refactor the big
worker part of getblobdiffline to a separate function
parseblobdiffline.  Also refactor its initialization and wrap-up to
separate routines.

Signed-off-by: Thomas Rast <trast@inf.ethz.ch>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2013-12-02 09:24:20 +11:00
Thomas Rast 71846c5caf gitk: Support -G option from the command line
The -G option's usage is exactly analogous to that of -S, so
supporting it is easy.

Signed-off-by: Thomas Rast <trast@inf.ethz.ch>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2013-12-02 09:24:20 +11:00
Paul Mackerras 4399fe3372 gitk: Tag display improvements
When a commit has many tags, the tag icons in the graph display can
easily become so wide as to push the commit message off the right-hand
edge of the graph display pane.  This changes the display so that if
there are more than 3 tags or they would take up more than a quarter
of the width of the pane, we instead display a single tag icon with
a legend inside it like "4 tags...".  If the user clicks on the tag
icon, gitk then displays all the tags in the diff display pane.

Signed-off-by: Paul Mackerras <paulus@samba.org>
2013-10-31 20:03:28 +11:00
Tair Sabirgaliev 76bf6ff93e gitk: On OSX, bring the gitk window to front
On OSX, Tcl/Tk application windows are created behind all
the applications down the stack of windows.  This is very
annoying, because once a gitk window appears, it's the
downmost window and switching to it is pain.

The patch is: if we are on OSX, use osascript to
bring the current Wish process window to front.

Signed-off-by: Tair Sabirgaliev <tair.sabirgaliev@gmail.com>
Thanks-to: Stefan Haller <lists@haller-berlin.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2013-05-13 21:29:43 +10:00
Martin Langhoff c33cb9083e gitk: Add support for -G'regex' pickaxe variant
git log -G'regex' is a very useful alternative to the classic
pickaxe.  Minimal patch to make it usable from gitk.

[zj: reword message]
[paulus@samba.org: reword droplist item]
Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2013-05-13 21:29:40 +10:00
Knut Franke 8f3ff9339f gitk: Add menu item for reverting commits
Sometimes it's helpful (at least psychologically) to have this feature
easily accessible.  Code borrows heavily from cherrypick.

Signed-off-by: Knut Franke <Knut.Franke@gmx.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2013-05-11 18:31:50 +10:00
Felipe Contreras 2c8cd905d1 gitk: Simplify file filtering
git diff is perfectly able to do this with '-- files', no need for
manual filtering.  This makes gettreediffs consistent with getblobdiffs.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2013-05-11 17:37:08 +10:00
Anand Kumria 685316c419 gitk: Display the date of a tag in a human-friendly way
By selecting a tag within gitk you can display information about it.
This information is output by using the command

 'git cat-file tag <tagid>'

This outputs the *raw* information from the tag, amongst which is the
time - in seconds since the epoch. As useful as that value is, I find it
a lot easier to read and process time which it is something like:

 "Mon Dec 31 14:26:11 2012 -0800"

This change will modify the display of tags in gitk like so:

  @@ -1,7 +1,7 @@
   object 5d417842ef
   type commit
   tag v1.8.1
  -tagger Junio C Hamano <gitster@pobox.com> 1356992771 -0800
  +tagger Junio C Hamano <gitster@pobox.com> Mon Dec 31 14:26:11 2012 -0800

   Git 1.8.1
   -----BEGIN PGP SIGNATURE-----

Signed-off-by: Anand Kumria <wildfire@progsoc.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2013-05-11 17:09:27 +10:00
Paul Mackerras 39c126914b gitk: Improve behaviour of drop-down lists
The drop-down lists used for things like the criteria for finding
commits (containing/touching paths/etc.) use a combobox if we are
using the ttk widgets.  By default the combobox exports its value
as the selection when it is changed, which is unnecessary, and sometimes
the combobox wouldn't release the selection, which is annoying.

To fix this, we make these comboboxes not export their selection,
and also clear their selection whenever they are changed.  This makes
them more like a simple selection of alternatives, improving the look
and feel of gitk.

Signed-off-by: Paul Mackerras <paulus@samba.org>
2013-05-11 17:08:41 +10:00
Gauthier Östervall 252c52df9d gitk: Move hard-coded colors to .gitk
The Preferences dialog gives control of the colors of some elements of
the gitk user interface, but many are hard-coded in the gitk script.
In order to allow these to be customized through the gitk config
file, these other colors are stored in variables which can be set
in the config file, thus providing a way for color schemes to be stored
and shared.

For win32, this makes the default foreground color that of window text
rather than button text.

Signed-off-by: Gauthier Östervall <gauthier@ostervall.se>
[paulus@samba.org: Reworded commit message to be clearer,
 changed filesepfgcolor to black]
Signed-off-by: Paul Mackerras <paulus@samba.org>
2013-04-01 17:57:23 +11:00
Paul Mackerras 386befb773 gitk: Display important heads even when there are many
When there are more than $maxrefs descendant heads to display in the
Branches field of the commit display, we currently just display "many",
which is not very informative.  To make the display more informative,
we now look for "master" and whichever head is currently checked out,
and display them even if there are too many heads to display them all.
The display then looks like "Branches: master and many more (33)" for
instance.

Signed-off-by: Paul Mackerras <paulus@samba.org>
2013-01-02 15:25:29 +11:00
Paul Mackerras d34835c939 gitk: Improve display of list of nearby tags and heads
This provides a control in the preferences pane for the limit on
how many tags or heads are displayed with the commit details under
the Branch(es), Precedes and Follows headings.  This limit is now
saved in ~/.gitk so that changes are persistent.

This also applies word-wrapping to the list of tags or heads under
the Branch, Precedes and Follows headings, so that long lists are
more readable.

Signed-off-by: Paul Mackerras <paulus@samba.org>
2013-01-01 23:08:12 +11:00
Paul Mackerras d809fb17b0 gitk: Fix display of branch names on some commits
Sometimes the code that divides commits up into arcs creates two
successive arcs, but the commit between them (the commit at the end
of the first arc and the beginning of the second arc) has only one
parent and one child.  If that commit is also the head of one or more
branches, those branches get omitted from the "Branches" field in the
commit display.

The omission occurs because the commit gets erroneously identified as
a commit which is part-way along an arc in [descheads].  This fixes it
by changing the test to look at the arcouts array, which only contains
elements for the commits at the start or end of an arc.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2013-01-01 16:51:03 +11:00
Stefan Haller 978904bf16 gitk: When searching, only highlight files when in Patch mode
This fixes another regression that was introduced in b967135 ("gitk:
Synchronize highlighting in file view when scrolling diff"): when
searching for a string in tree mode, jumping to the next search hit
would highlight the "Comments" entry in the file list.

Signed-off-by: Stefan Haller <stefan@haller-berlin.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2012-10-22 09:24:47 +11:00
Stefan Haller ce837c9de5 gitk: Fix error message when clicking on a connecting line
When clicking on the line that connects two commit nodes, gitk
would bring up an error dialog saying "can't read "cflist_top":
no such variable".

This fixes a regression that was introduced with b967135 ("gitk:
Synchronize highlighting in file view when scrolling diff").

Signed-off-by: Stefan Haller <stefan@haller-berlin.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2012-10-22 09:24:46 +11:00
Marcus Karlsson 62e9ac5edf gitk: Fix crash when not using themed widgets
When configured not to use themed widgets gitk may crash on launch with
a message that says that the image "bm-left disabled bm-left-gray"
doesn't exist. This happens when the left and right arrow buttons are
created.

The crash can be avoided by configuring the buttons differently
depending on whether or not themed widgets are used. If themed widgets
are not used then only set the images to bm-left and bm-right
respectively, and keep the old behavior when themed widgets are used.

The previous behaviour was added in f062e50f to work around a bug in Tk
on OS X where the disabled state did not display properly. The buttons
may still not display correctly, however the workaround added in
f062e50f will still apply if gitk is used with themed widgets.

Make gitk not crash on launch when not using themed widgets.

Signed-off-by: Marcus Karlsson <mk@acc.umu.se>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2012-10-22 09:21:56 +11:00
Andrew Wong ebb91db8df gitk: Use bindshiftfunctionkey to bind Shift-F5
Signed-off-by: Andrew Wong <andrew.kw.w@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2012-10-22 09:16:31 +11:00
Andrew Wong 69ecfcd6eb gitk: Refactor code for binding modified function keys
The function includes a workaround for systems where F* keys are mapped
to XF86_Switch_VT_* when modifiers are used.

Signed-off-by: Andrew Wong <andrew.kw.w@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2012-10-22 09:16:31 +11:00
Stefan Haller f062e50fe6 gitk: Work around empty back and forward images when buttons are disabled
On Mac, the back and forward buttons show an empty rectange instead of
a grayed-out arrow when they are disabled. The reason is a Tk bug on Mac
that causes disabled images not to draw correctly (not to draw at all,
that is); see
<https://groups.google.com/forum/?fromgroups=#!topic/comp.lang.tcl/V-nW1JBq0eU>.

To work around this, we explicitly provide gray images for the disabled
state; I think this looks better than the default stipple effect that you
get on Windows as well, but that may be a matter of taste.

Signed-off-by: Stefan Haller <stefan@haller-berlin.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2012-09-23 16:14:58 +10:00
Stefan Haller 30441a6f2d gitk: Highlight first search result immediately on incremental search
When typing in the "Search" field, select the current search result (so
that it gets highlighted in orange). This makes it easier to understand
what will happen if you then type Ctrl-S.

Signed-off-by: Stefan Haller <stefan@haller-berlin.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2012-09-23 15:03:18 +10:00
Stefan Haller c46149942a gitk: Highlight current search hit in orange
When searching for text in the diff, and there are multiple occurrences
of the search string, the current one is highlighted in orange, and the
other ones in yellow. This makes it much easier to understand what happens
when you then click the Search button or hit Ctrl-S repeatedly.

Signed-off-by: Stefan Haller <stefan@haller-berlin.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2012-09-23 15:03:18 +10:00
Stefan Haller b967135d89 gitk: Synchronize highlighting in file view when scrolling diff
Whenever the diff pane scrolls, highlight the corresponding file in the
file list on the right.  For a large commit with many files and long
per-file diffs, this makes it easier to keep track of what you're looking
at.

This allows simplifying the prevfile and nextfile functions, because
all they have to do is scroll the diff pane.

In some situations we want to suppress this mechanism, for example when
clicking on a file in the file list to select it, or when searching in the
diff, in which case we want to highlight based on the current search hit
and not the top line visible. In these cases it's not sufficient to set
a "suppress" flag before scrolling and reset it afterwards, because the
scrolltext notification is sent deferred from a timer or some such; so we
need to remember the scroll position for which we want to suppress the
auto-highlighting until the next call to scrolltext; a bit ugly, but does
the job.

Signed-off-by: Stefan Haller <stefan@haller-berlin.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2012-09-23 15:03:18 +10:00
Paul Mackerras 5be4d354d9 Merge branch 'da/gitk-reload-tag-contents' of git://github.com/gitster/git
to get two commits from David Aguilar.
2012-09-12 22:34:24 +10:00
David Aguilar 587277fea3 gitk: Rename 'tagcontents' to 'cached_tagcontent'
Name the 'tagcontents' variable similarly to the rest of the
variables cleared in the changedrefs() function.

This makes the naming consistent and provides a hint that it
should be cleared when reloading gitk's cache.

Suggested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-08 20:25:09 -07:00
David Aguilar 9b5bdf5913 gitk: Teach "Reread references" to reload tags
Tag contents, once read, are forever cached in memory.
This makes gitk unable to notice when tag contents change.

Allow users to cause a reload of the tag contents by using
the "File->Reread references" action.

Reported-by: Tim McCormack <cortex@brainonfire.net>
Suggested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-08 20:25:09 -07:00
Aske Olsson 0ae103574e gitk: Fix GIT_TRACE issues
Check if GIT_TRACE env var is set and unset it if it is.

If the environment var GIT_TRACE=1 exists gitk will fail when trying
to find gitdir:
$ git rev-parse --git-dir
trace: built-in: git 'rev-parse' '--git-dir'
.git

Other git commands will also show debug output hence not work as
intended.

Signed-off-by: Aske Olsson <askeolsson@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2012-08-04 19:32:40 +10:00
Felipe Contreras a135f214e3 gitk: Avoid Meta1-F5
Meta1-F5 is commonly mapped by window managers and what not.
Use Shift-F5 instead.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2012-04-25 13:44:31 +10:00
Pat Thoyts 39ddf99c1d gitk: fix setting font display with new tabbed dialog layout.
The changes to the dialog window tree broke the preview of the selected
font on the button. This corrects that issue.

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-02 10:21:10 -07:00
Pat Thoyts 28cb707472 gitk: fix tabbed preferences construction when using tcl 8.4
In 8.5 the incr command creates the target variable if it does not exist
but in 8.4 using incr on a non-existing variable raises an error. Ensure
we have created our counter variable when creating the tabbed dialog for
non-themed preferences.

Reported-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-02 10:21:08 -07:00
Marcus Karlsson b2b76d1069 gitk: Teach gitk to respect log.showroot
In early days, all projects managed by git (except for git itself) had the
product of a fairly mature development history in their first commit, and
it was deemed unnecessary clutter to show additions of these thousands of
paths as a patch.

"git log" learned to show the patch for the initial commit without requiring
--root command line option at 0f03ca9 (config option log.showroot to show
the diff of root commits, 2006-11-23).

Teach gitk to respect log.showroot.

[paulus@samba.org: Cleaned up the Tcl a bit, use --bool on the
 git config call]

Signed-off-by: Marcus Karlsson <mk@acc.umu.se>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2012-03-24 16:44:12 +11:00
Paul Mackerras 6febdede5a gitk: Add menu items for comparing a commit with the marked commit
Sometimes one wants to see the different between two commits that are
a long distance apart in the graph display.  This is difficult to do
with the "Diff this -> selected" and "Diff selected -> this" menu
items because the need to maintain the selection means that one can't
use the find facilities or the reference list window to navigate from
one to the other.

This provides an alternative using the mark.  Having found one commit,
one marks it with the "Mark this commit" menu item, then navigates to
the other commit and uses the new "Diff this -> marked commit" and/or
"Diff marked commit -> this" menu items.

Signed-off-by: Paul Mackerras <paulus@samba.org>
2012-03-23 22:07:27 +11:00
Paul Mackerras 22387f2395 gitk: Speed up resolution of short SHA1 ids
On large repositories such as the Linux kernel, it can take quite a
noticeable time (several seconds) for gitk to resolve short SHA1 IDs
to their long form.  This speeds up the process by maintaining lists
of IDs indexed by the first 4 characters of the SHA1 ID, speeding up
the search by a factor of 65536 on large repositories.

Signed-off-by: Paul Mackerras <paulus@samba.org>
2012-03-19 11:21:08 +11:00
Jonathan Nieder 5c9096f747 gitk: Use symbolic font names "sans" and "monospace" when available
The following only concerns systems using X and the client-side font
rendering framework from freedesktop.org.  Windows and Mac OS X are
not affected.

Starting with version 8.5, Tk uses freetype and fontconfig by default
to render fonts on platforms that support it.  Gitk currently defaults
to the font Helvetica for the interface and Courier for diffs, and
both unfortunately look rather bad on screen in the default
configuration on many Linux distros with anti-aliasing and poor
hinting.

It is better to default to "sans" and "monospace", which are mapped by
fontconfig to some appropriate font of the sysadmin and user's
choosing (typically Bitstream Vera Sans and Mono).  The result looks
more sensible and it makes gitk feel like a well-behaved software
citizen since its fonts match other native apps.

This patch does not change the appearance of gitk for users that have
already run it, since gitk uses the remembered UI and diff font names
from ~/.gitk.

Requested-by: Michael Biebl <biebl@debian.org>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Acked-by: Mark Hills <mark@pogo.org.uk>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2012-03-19 10:23:43 +11:00
Frédéric Brière 585c27cb22 gitk: Skip over AUTHOR/COMMIT_DATE when searching all fields
This prevents a search for a number like "105" on "All Fields" from
matching against the raw author and commit timestamps.  These
timestamps were already not searchable by themselves, and the
displayed format does not match the query string anyway.

Signed-off-by: Frédéric Brière <fbriere@fbriere.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2012-03-19 10:23:43 +11:00
Jim Meyering 6c9e2d1842 gitk: Make "git describe" output clickable, too
Automake's contribution guidelines suggest using "git describe" output
in commit logs to reference previous commits.  By contrast, in
coreutils, I had acquired the habit of using a bare SHA1 prefix (8 hex
digits), since gitk creates clickable links for that, and not for "git
describe" output.

I prefer the readability of the full "git describe" output, yet want
to retain the gitk links, so this renders as clickable not just
SHA1-like strings, but also an SHA1-like string that is prefixed by
"-g".

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2012-03-19 10:16:53 +11:00
Pat Thoyts 65bb0bda75 gitk: Fix the display of files when filtered by path
Launching 'gitk -- .' or 'gitk -- ..\t' restricts the display to files
under the given directory but the file list is left empty. This is because
the path_filter function fails to match the filenames which are relative
to the working tree to the filter which is filessytem relative.
This solves the problem by making both names fully qualified filesystem
paths before performing the comparison.

Tested-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2012-03-19 10:10:59 +11:00
Pat Thoyts 44acce0bef gitk: Use a tabbed dialog to edit preferences
This commit converts the user preferences dialog into a tabbed property
sheet grouping general properties, colours and font selections onto
separate pages. The previous implementation was exceeding the screen
height on some systems and this avoids such problems and permits extension
using new pages in the future.

If themed Tk is unavailable or undesired a reasonable facsimile of the
tabbed notebook widget is used instead.

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2012-03-19 10:04:43 +11:00
Zbigniew Jędrzejewski-Szmek 3878e636c6 gitk: Use "gitk: repo-top-level-dir" as window title
Previously, when run in a subdirectory, gitk would show the name
of this subdirectory as title, which was misleading. When run with
GIT_DIR set, it would show the cwd, which is even more misleading.

In case of non-bare repos, the .git suffix in the path is skipped.

Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
2012-03-19 10:00:22 +11:00
Jonathan Nieder 811c70fc83 gitk: Make vi-style keybindings more vi-like
When commit 6e2dda35 (Add new keybindings, 2005-09-22) added vi-style
keybindings to gitk (an excellent idea!), instead of adopting the
usual "hjkl = left, down, up, right" bindings used by less, vi, rogue,
and many other programs, it used "ijkl = up, left, down, right" to
mimic the inverted-T formation of the arrow keys on a qwerty keyboard,
in the style of Lode runner.  So using 'j' and 'k' to scroll through
commits produces utterly confusing results to the vi user, as 'k'
moves down and 'j' moves to the previous commit.

Luckily most non-vi-users are probably using an alternate set of keys
(cursor keys or z/x + n/p) anyway.  Switch to the expected vi/nethack
convention.

Requested-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2011-10-08 18:01:54 +11:00
Yggy King de665fd3cf gitk: Make "touching paths" search support backslashes
Gitk can search for commits touching a specified path. The search text is
always treated as a regular expression, regardless of the matching option
selected (Exact, IgnCase, or Regexp). In particular, backslashes escape
the next character. This is inconvenient on Windows systems, where backslashes
are the norm for path specifiers, for example when copy/pasting from
Windows Explorer or a cmd shell -- these copy-pasted paths must be manually
modified in the gitk search text edit box before they will work.

This change uses the match option "Exact" to mean that a slash is a slash,
not part of a regular expression. Backslashes are converted to frontslashes
before searching, thus allowing easy copy/pasting of paths on Windows
systems. If the previous behaviour of "touching paths" search is desired,
simply select the "Regexp" search mode.

One potential drawback is that the default setting for the match option
($findtype in the code) is "Exact", and so this change alters the default
behaviour, which may confuse users and lead to bug reports.

Signed-off-by: Yggy King <yggy@zeroandone.ca>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2011-07-24 15:52:53 +10:00
Martin von Zweigbergk 74cb884faa gitk: Show modified files with separate work tree
"git rev-parse --is-inside-work-tree" is currently used to determine
whether to show modified files in gitk (the red and green fake
commits). This does not work if the current directory is not inside
the work tree, as can be the case e.g. if GIT_WORK_TREE is
set. Instead, check if the repository is not bare and that we are not
inside the .git directory.

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2011-07-24 15:34:54 +10:00
Martin von Zweigbergk 86e847bcbf gitk: Simplify calculation of gitdir
Since 5024baa ([PATCH] Make gitk work when launched in a subdirectory,
2007-01-09), gitk has used 'git rev-parse --git-dir' to find the .git
directory. However, gitk still first checks for the $GIT_DIR
environment variable and that the value returned from git-rev-parse
does not point to a file. Since git-rev-parse does both of these
checks already, the checks can safely be removed from gitk. This makes
the gitdir procedure small enough to inline.

This cleanup introduces a UI regression in that the error message will
now be "Cannot find a git repository here." even in the case where
GIT_DIR points to a file, for which the error message was previously
"Cannot find the git directory \"%s\".". It should be noted, though,
that even before this patch, 'gitk --git-dir=path/to/some/file' would
give the former error message.

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2011-07-24 15:34:54 +10:00
Martin von Zweigbergk da616db5e5 gitk: Run 'git rev-parse --git-dir' only once
It seems like gitk has been setting the global variable 'gitdir' at
startup since aa81d97 (gitk: Fix Update menu item, 2006-02-28).  It
should therefore no longer be necessary to call the procedure with the
same name (more than once to set the global variable).  Remove the
other call sites and use the global variable instead.

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2011-07-24 15:34:54 +10:00
Martin von Zweigbergk 929f577e0a gitk: Put temporary directory inside .git
When running "External diff" from gitk, the "from" and "to" files will
first be copied into a directory that is currently
".git/../.gitk-tmp.$pid".  When gitk is closed, the directory is
deleted. When the work tree is not at ".git/.." (which is supported
since the previous commit), that directory may not even be git-related
and it does not seem unlikely that permissions may not allow the
temporary directory to be created there.  Move the directory inside
.git instead.

This introduces a regression in the case that the .git directory
is readonly, but .git/.. is writeable.

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2011-07-24 15:34:54 +10:00
Martin von Zweigbergk 784b7e2f25 gitk: Fix "External diff" with separate work tree
Running "External diff" to compare the index and work tree currently
brings up an empty blame view when the work tree is not the parent of
the git directory.  This is because the file that is taken from the
work tree is assumed to be in
$GIT_DIR/../<repo-relative-file-name>.  Fix it by feeding the diff tool
a path under $GIT_WORK_TREE instead of "$GIT_DIR/..".

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2011-07-24 15:34:54 +10:00
Martin von Zweigbergk 0a2a979310 gitk: Fix "blame parent commit" with separate work tree
Running "blame parent commit" currently brings up an empty blame view
when the the work tree is not the parent of the git directory.  Fix it
by feeding git-blame paths relative to $GIT_WORK_TREE instead of
"$GIT_DIR/..".

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2011-07-24 15:34:54 +10:00
Martin von Zweigbergk 9b6adf3433 gitk: Fix "show origin of this line" with separate work tree
Running "show origin of this line" currently fails when the the work
tree is not the parent of the git directory.  Fix it by feeding
git-blame paths relative to $GIT_WORK_TREE instead of "$GIT_DIR/..".

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2011-07-24 15:34:54 +10:00
Martin von Zweigbergk c332f44514 gitk: Fix file highlight when run in subdirectory
The "highlight this only" and "highlight this too" commands in gitk
add the path relative to $GIT_WORK_TREE to the "Find" input box. When
the search (using git-diff-tree) is run, the paths are used
unmodified, except for some shell escaping. Since the search is run
from gitk's working directory, no commits matching the paths will be
found if gitk was started in a subdirectory.

Make the paths passed to git-diff-tree relative to gitk's working
directory instead of being relative to $GIT_WORK_TREE. If, however,
gitk is run outside of the working directory (e.g. with $GIT_WORK_TREE
set), we still need to use the path relative to $GIT_WORK_TREE.

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2011-07-24 15:34:54 +10:00
Paul Mackerras bb3e86a119 gitk: Update copyright
Signed-off-by: Paul Mackerras <paulus@samba.org>
2011-07-24 15:34:48 +10:00
Raphael Zimmerer 36242490cd gitk: When a commit contains a note, mark it with a yellow box
It is desirable to see at a glance which commits do contain notes.
Therefore mark them with a yellow rectangle.

That can be suppressed with `gitk --no-notes`.

Signed-off-by: Raphael Zimmerer <killekulla@rdrz.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2011-05-29 14:51:06 +10:00
Anders Kaseorg f5974d97af gitk: Remember time zones from author and commit timestamps
When resolving a conflicted cherry-pick, this lets us pass
GIT_AUTHOR_DATE to git citool with the correct timezone.
It does this by making elements 2 and 4 of the commitinfo array
entries, which store the author and committer dates of the commit,
be 2-element lists storing the numerical date and timezone offset,
rather than just the numerical date.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2011-05-29 14:46:16 +10:00
Anders Kaseorg ef73896b2b gitk: Remove unused $cdate array
It was unused since commit 9f1afe05c3 ("gitk: New improved gitk").

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2011-05-29 14:46:16 +10:00
Anders Kaseorg b74307f6a5 gitk: Update cherry-pick error message parsing
Commit 981ff5c37a changed the error
message from git cherry-pick from
    Automatic cherry-pick failed.  [...advice...]
to
    error: could not apply 7ab78c9... Do something neat.
    [...advice...]

Update gitk’s regex to match this, restoring the ability to launch git
citool to resolve conflicted cherry-picks.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2011-04-09 22:19:38 +10:00
Pat Thoyts 8dd60f5401 gitk: Quote tag names in event bindings to avoid problems with % chars
Tag names that contain a % character require quoting when used in event
bindings or the name may be mis-recognised for percent substitution in
the event script.

Reported-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2011-03-09 21:05:02 +11:00
Paul Mackerras 21ac8a8d0b gitk: Allow user to control how much of the SHA1 ID gets auto-selected
This adds a new spinbox on the Edit Preferences pane to allow the user
to control how many characters of the SHA1 ID get autoselected.

Signed-off-by: Paul Mackerras <paulus@samba.org>
2011-03-09 20:52:38 +11:00
Anders Kaseorg 7add5aff86 gitk: Take only numeric version components when computing $git_version
This fixes errors running with release candidate versions of Git:
  Error in startup script: expected version number but got "1.7.4-rc0"

Also, $git_version is no longer artificially limited to three
components.  That limitation was added by commit 194bbf6cc8
("gitk: Handle msysGit version during version comparisons") to deal
with msysGit version strings like “1.6.4.msysgit.0”, and we don’t need
it now.  Hence as another side effect, this enables showing notes with
git version 1.6.6.2 or 1.6.6.3, as originally intended by commit
7defefb134 ("gitk: Show notes by default (like git log does").

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Reported-by: Mathias Lafeldt <misfire@debugon.org>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2011-01-19 20:31:21 +11:00
Stefan Haller 4adcbea06e gitk: Make text selectable on Mac
Stolen from git-gui, 23effa79f7 (original log message by
Shawn O. Pearce <spearce@spearce.org> follows):

    git-gui: Force focus to the diff viewer on mouse click.

    Apparently a "feature" of Tcl/Tk on Mac OS X is that a disabled text
    widget cannot receive focus or receive a selection within it.  This
    makes the diff viewer almost useless on that platform as you cannot
    select individual parts of the buffer.

    Now we force focus into the diff viewer when its clicked on with
    button 1.  This works around the feature and allows selection to
    work within the viewer just like it does on other less sane systems,
    like Microsoft Windows.

Signed-off-by: Stefan Haller <stefan@haller-berlin.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2010-12-12 15:24:09 +11:00
Stefan Haller 120ea892a0 gitk: Prevent the text pane from becoming editable
When setting the "Patch/Tree" radio buttons to "Tree" and
clicking on a file to display it, the text pane would
accidentally become editable (because of the early return
in getblobline).

Signed-off-by: Stefan Haller <stefan@haller-berlin.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2010-12-12 15:24:09 +11:00
Thomas Rast ae4e3ff93d gitk: Add the equivalent of diff --color-words
Use the newly added 'diff --word-diff=porcelain' to teach gitk a
color-words mode, with two different modes analogous to the
--word-diff=plain and --word-diff=color settings.  These are selected
by a dropdown box.

As an extra twist, automatically enable this word-diff support when
the user mentions a word-diff related option on the command line.
These options were previously ignored because they would break diff
parsing.

Both of these features are only enabled if we have a version of git
that supports --word-diff=porcelain, meaning at least 1.7.2.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2010-12-12 10:46:52 +11:00
Kirill Smelkov 7defefb134 gitk: Show notes by default (like git log does)
Starting from ~ git-1.6.6, log, show & whatchanged show notes by default.

On the other hand, gitk does not show notes by default, because under
the hood it calls 'git log --pretty=raw ...' to get the log, and in
'git log' notes are turned off when user specifies format or pretty
settings.

Yes, it is possible to invoke 'gitk --show-notes' explicitly, but since
from user's perspective, gitk is gui enabled git log, it would be
logical for gitk to show notes by default too for consistency.

In git, --show-notes was introduced in 66b2ed (Fix "log" family not to
be too agressive about showing notes) which predates 1.6.6.2.

Notes can still be supressed with 'gitk --no-notes'.

Cc: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2010-05-30 11:54:54 +10:00
Jens Lehmann a1d383c5ab gitk: Display dirty submodules correctly
Since recently "git diff --submodule" prints out extra lines when the
submodule contains untracked or modified files. Show all those lines of
one submodule under the same header.

Also for newly added or removed submodules the submodule name contained
trailing garbage because the extraction of the name was not done right.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2010-04-17 18:53:24 +10:00
Pat Thoyts e7d516b67b gitk: Fix display of copyright symbol
The script file uses utf-8 encoding but when sourced it will be read
using the default system encoding which is never utf8 on windows.
This causes the copyright symbol to display incorrectly in the about
dialog.  Using the unicode escape sequence avoids incorrect decoding
but does require a double escape in the .po files.

Also adjusted the year range.

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2010-03-20 20:53:21 +11:00
Pat Thoyts adab0dabcc gitk: Add emacs editor variable block
Help contributors use the correct indentation style.

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2010-03-20 20:53:21 +11:00
Pat Thoyts 2e58c944cd gitk: Avoid calling tk_setPalette on Windows
This just messes up the system colors.  Leave them alone.

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2010-03-20 20:53:21 +11:00
Jonathan Nieder 5d11f794de gitk: Don't clobber "Remember this view" setting
In the View → Edit View... dialog, the "Remember this view" option
always starts out unset.  Using the dialog to change an existing view
and ignoring the parts of the dialog that aren’t relevant results in
both the old and new versions of the view being lost.

The cause: right after newviewopts($curview,perm) is set to an
appropriate value, decode_view_opts is clobbering it with the default
value.  If that call is moved a little earlier, the "Remember this
view" option gets properly set to its previous value, fixing the
problem.

Reported-by: Steve Cotton <steve0001@s.cotton.clara.co.uk>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2010-03-20 20:53:21 +11:00
Jonathan Nieder e7feb695bf gitk: Add comments to explain encode_view_opts and decode_view_opts
Summarize these functions to save the reader some time.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2010-03-20 20:53:21 +11:00
Mark Hills b9b142ffa2 gitk: Use consistent font for all text input fields
Instead of setting the font for specific widgets, set the font for the
widget type. If themed widgets are not available, this is via the X
resources. If themed widgets are available, the theme font is used.

The exception is the SHA1 ID which is forced to use the fixed-width
font, even where themed widgets are used.

Signed-off-by: Mark Hills <mark@pogo.org.uk>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2010-03-20 20:53:21 +11:00
Mark Hills 207ad7b887 gitk: Set the font for all listbox widgets
This affects the font chooser.

Signed-off-by: Mark Hills <mark@pogo.org.uk>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2010-03-20 20:53:21 +11:00
Mark Hills 0933b04e52 gitk: Set the font for all spinbox widgets
Use the X resources to set the font, removing the need to set the font
for specific widgets.

Signed-off-by: Mark Hills <mark@pogo.org.uk>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2010-03-20 20:53:21 +11:00
Mark Hills 75eb2af0e0 gitk: Remove forced use of sans-serif font
The X resources set using uifont cover this case.

Signed-off-by: Mark Hills <mark@pogo.org.uk>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2010-03-20 20:53:21 +11:00
Jens Lehmann decd0a1ea5 gitk: Add Ctrl-W shortcut for closing the active window
To make the user experience between git gui and gitk more homogeneous,
use Ctrl-W in gitk for closing the active window.  When closing the
main window doquit is called for proper cleanup.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2010-03-20 20:53:21 +11:00
Paul Mackerras 7963791e1f gitk: Fix copyright symbol in About box message
Somehow it got corrupted in commit d93f1713 ("gitk: Use themed tk
widgets").

Signed-off-by: Paul Mackerras <paulus@samba.org>
2010-02-04 08:49:00 +11:00
Markus Heidelberg 0359ba72bb gitk: Adjust two equal strings which differed in whitespace
There were the two strings "SHA1 ID: " and "SHA1 ID:" as description
for the SHA1 search textbox.  Change it to two equal strings, the
space is now outside of the translated string.

Furthermore the German translation wasn't unique, but "SHA1:" resp.
"SHA1-Hashwert:". The former was displayed after initialisation, the
latter after changes to the textbox, for example when clearing the text.
But it was too long to be displayed fully, so use a shorter translation.

Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2010-01-12 22:20:18 +11:00
Kirill Smelkov 1f2cecfd53 gitk: Display submodule diffs with appropriate encoding
Previously, when submodule commit headings contained non-latin-1
characters, they were displayed incorrectly in gitk, because $line was
not properly decoded, for example:

----------------------------- Documentation/Dokko -----------------------------
Submodule Documentation/Dokko 2ca20c7..0ea204d:
  > Протоколы сопряжения ИМС "Мостик-21631"  (ЛИ2 и Сандал)
  > hardware: документация на InnoDisk SATA 10000
  > hardware: документация на IEI PCISA-6770E2 v3.0
  > hardware: документация на Fastwel NIB941
  > hardware: документация на IEI IPX-9S
  > hardware: документация на Hirschmann 5TX-EEC

instead of

----------------------------- Documentation/Dokko -----------------------------
Submodule Documentation/Dokko 2ca20c7..0ea204d:
  > Протоколы сопряжения ИМС "Мостик-21631"  (ЛИ2 и Сандал)
  > hardware: документация на InnoDisk SATA 10000
  > hardware: документация на IEI PCISA-6770E2 v3.0
  > hardware: документация на Fastwel NIB941
  > hardware: документация на IEI IPX-9S
  > hardware: документация на Hirschmann 5TX-EEC

This fixes it.

Signed-off-by: Kirill Smelkov <kirr@landau.phys.spbu.ru>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2010-01-12 22:20:18 +11:00
Dave Dulson fcacf48957 gitk: Fix display of newly-created tags
If the user creates a tag with the "create tag" dialog in gitk and
then clicks on the newly-created tag, its contents don't get
displayed.  The reason is that rereadrefs hasn't been called, meaning
the tag doesn't exist in $tagobjid.  This causes the cat-file to fail.
Instead of using $tagobjid, pass the $tag directly, ensuring the tag
contents are populated correctly.

Signed-off-by: David Dulson <dave@dulson.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2010-01-12 22:04:46 +11:00
Dave Dulson dfb891e351 gitk: Enable gitk to create tags with messages
Currently, tags created using the "create tag" dialog in gitk are
always lightweight tags, i.e., they don't have any annotation
(message).  This enables the user to specify a message; if they do,
gitk will create an unsigned, annotated tag object.

Signed-off-by: David Dulson <dave@dulson.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2010-01-12 22:04:46 +11:00
Christian Couder c2f2dab971 gitk: Add "--no-replace-objects" option
Replace refs are useful to change some git objects after they
have started to be shared between different repositories. One
might want to ignore them to see the original state, and
"--no-replace-objects" option can be used from the command
line to do so.

This option simply sets the GIT_NO_REPLACE_OBJECTS environment
variable, and that is enough to make gitk ignore replace refs.

The GIT_NO_REPLACE_OBJECTS is set to "1" instead of "" as it is
safer on some platforms, thanks to Johannes Sixt and Michael J
Gruber.

Tested-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2009-12-14 10:08:18 +11:00
Pat Thoyts a80e82f6ee gitk: Fix selection of tags
When a tag is clicked an error is raised due to a missing parameter in
a function call.

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2009-11-19 20:32:45 +11:00
Pat Thoyts 1924d1bc0d gitk: Default to the system colours on Windows
Also convert a button to use the themed widget set.

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2009-11-14 21:28:26 +11:00
Paul Mackerras 7a0ebbf829 gitk: Merge branch 'dev' into master
Signed-off-by: Paul Mackerras <paulus@samba.org>
2009-11-14 21:26:31 +11:00
Markus Heidelberg a4390ace1a gitk: Fix "git gui blame" invocation when called from top-level directory
When run in the top-level directory of a git repository, "git
rev-parse --git-dir" doesn't return an absolute path, but merely
".git", so the selected file for "git gui blame" has a relative path.
The function make_relative then tries to make the already relative
path relative, which results in a path like "../../../../Makefile"
with as many ".." as there are elements of [pwd].

This regression was introduced by commit 9712b81 (gitk: Fix bugs in
blaming code, 2008-12-06), which fixed "git gui blame" when called from
subdirs.

This also fixes it for bare repositories.

Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2009-11-14 21:19:12 +11:00
Sitaram Chamarty 70a5fc443a gitk: Disable checkout of remote branches
At the command line, trying to check out a remote branch gives you a
detailed warning message, but the gitk GUI currently allows it without
any fuss.

Since the GUI is often used by people much less familiar with git, it
seems reasonable to make the GUI more restrictive than the command line,
not less.

This prevents a lot of detached HEAD commits by new users.

Signed-off-by: Sitaram Chamarty <sitaramc@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2009-11-14 21:19:11 +11:00
Paul Mackerras 51a7e8b654 gitk: Improve appearance of radiobuttons and checkbuttons
Commit 5497f7a23a ("gitk: Add configuration
for UI colour scheme") added a call to tk_setPalette at startup.
Unfortunately, tk_setPalette always chooses a dark red color for
the selectColor value if none is given explicitly, and this makes
checkbuttons and radiobuttons look rather bad.

This restores the previous appearance by specifying selectColor
explicitly.  For light backgrounds we use white for selectColor, and
for dark backgrounds we use black.  The formula and threshold for
distinguishing light from dark are the same as used in tk_setPalette
for choosing the foreground color.

Signed-off-by: Paul Mackerras <paulus@samba.org>
2009-11-14 21:15:01 +11:00
Bernt Hansen 8d849957d8 gitk: Skip translation of "wrong Tcl version" message
We check the required Tcl version number before we setup msgcat for
language translation.  If the Tcl version is too old just display the
untranslated error text.

The caller of show_error can now pass an alternative function for mc.
The Tcl list function turns the translation into a no-op.

This fixes the error:
    Error in startup script: invalid command name "mc"
when attempting to start gitk with Tcl 8.3.

Tested with both Tcl 8.3 and 8.4.

Signed-off-by: Bernt Hansen <bernt@norang.ca>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2009-11-03 22:28:42 +11:00
Jens Lehmann 5c838d23aa gitk: Use the --submodule option for displaying diffs when available
When displaying diffs in a submodule, this makes gitk display the
headlines of the commits being diffed, instead of just showing
not-quite-helpful SHA-1 pairs, if the underlying git installation
supports this.  That makes it much easier to evaluate the changes, as
it eliminates the need to start a gitk inside the submodule and use
the superprojects hashes there to find out what the commits are about.

Since the --submodule option of git diff is new in git version 1.6.6,
this only uses the --submodule option when a git version of 1.6.6 or
higher is detected.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2009-11-03 22:28:42 +11:00
Jens Lehmann 90a7792541 gitk: Fix diffing committed -> staged (typo in diffcmd)
When highlighting a commit, using the context menu over the staged changes
and then selecting "Diff this -> selected" the diff was empty.  The same
happened when highlighting the staged changes and using "Diff selected ->
this" over a commit.  The reason was a copy/paste error in [diffcmd].
This fixes it.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2009-11-03 22:28:34 +11:00
Guillermo S. Romero 5497f7a23a gitk: Add configuration for UI colour scheme
This adds an option to control the global colour scheme in the
Edit > Preferences dialog so that the whole interface can have
a non-default main colour.

Signed-off-by: Guillermo S. Romero <gsromero@infernal-iceberg.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2009-11-03 22:28:20 +11:00
Pat Thoyts 9bedb0e185 gitk: Work around leftover temporary save file
If a file exists and is hidden on Windows the Tcl open command will
fail as the attributes provided in the CREAT call fail to match those
of the existing file.  Forcing removal of the temporary file before we
begin solves any problems caused by previous failures to save the
application settings.  An alternative would be to remove the hidden
attribute before calling 'open'.

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2009-09-21 13:04:48 +10:00
Paul Mackerras aa43561ac0 gitk: Don't compare fake children when comparing commits
This fixes a bug where the compare-commits function would advance
to a fake node (one representing local changes, either checked in
but not committed, or not checked in) and then get an error when
trying to get the patch-id.  This fixes it by only considering the
real children of each commit.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2009-09-10 21:58:40 +10:00
Paul Mackerras c21398be6d gitk: Show diff of commits at end of compare-commits output
When comparing a string of commits, when we find two non-merge commits
that differ, we now write the two commits to files and diff the files.
This pulls out the logic for creating a temporary directory from
external_diff into a separate procedure so that the new diffcommits
procedure can use it.

Because the diff command returns an exit status of 1 when the files
differ, and Tcl treats that as an error, this adds catch {} around the
close statements in getblobdiffline.

At present this only removes the temporary files when gitk exits.  It
should remove them when the diff is done.

Signed-off-by: Paul Mackerras <paulus@samba.org>
2009-09-10 21:46:28 +10:00
Paul Mackerras 4a3da5d91a gitk: Show diff of commits at end of compare-commits output
When comparing a string of commits, when we find two non-merge commits
that differ, we now write the two commits to files and diff the files.
This pulls out the logic for creating a temporary directory from
external_diff into a separate procedure so that the new diffcommits
procedure can use it.

Because the diff command returns an exit status of 1 when the files
differ, and Tcl treats that as an error, this adds catch {} around the
close statements in getblobdiffline.

At present this only removes the temporary files when gitk exits.  It
should remove them when the diff is done.

Signed-off-by: Paul Mackerras <paulus@samba.org>
2009-09-07 10:08:21 +10:00
Paul Mackerras 0cc08ff7dd gitk: Add a user preference to enable/disable use of themed widgets
Also move the hide-remotes option up into the commit display options
in the Edit->Preferences panel, since it affects the commit display
more than the diff display.

Signed-off-by: Paul Mackerras <paulus@samba.org>
2009-09-05 22:06:46 +10:00