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>
"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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Help contributors use the correct indentation style.
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Paul Mackerras <paulus@samba.org>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>