Commit Graph

358 Commits

Author SHA1 Message Date
Bert Wesarg
d1c7f8aa66 git-gui: handle special content lines only in the diff header section
These two also stop the diff header.

Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2011-01-28 09:01:17 +00:00
Bert Wesarg
6459d7c046 git-gui: always reset the current tag
Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2011-01-28 09:01:17 +00:00
Bert Wesarg
963ceab57e git-gui: move 3way diff autodetect up
Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2011-01-28 09:01:17 +00:00
Bert Wesarg
3c9ae64c81 git-gui: there is no "mode *" diff header line
Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2011-01-28 09:01:17 +00:00
Bert Wesarg
97b8ee1671 git-gui: name also new symlinks so
and rename them only in the diff header

Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2011-01-28 09:01:17 +00:00
Bert Wesarg
ebd143ff99 git-gui: handle index lines only in the diff header
Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2011-01-28 09:01:17 +00:00
Bert Wesarg
c976bbff3c git-gui: rework handling of diff header
The fix in ca53c3f (Fix diff parsing for lines starting with "--" or "++",
2008-09-05) got a bug report from Johannes Sixt, that new files in the
index now looks like:

  new file mode 100644
  --- /dev/null
  +++ b/foo
  @@ -0,0 +1 @@
  +foo

The introduced problem was that the 'in-diff-header'-flag was unconditially
disabled. Now it is only disabled when a hunk line is detected. And also
re-enabled when we encounter a new diff header.

The second part solves also the issue reported by me for diffs with file
type changes (i.e. the ''error: Unhandled 2 way diff marker: {d}"', which
comes from the second 'diff --git' line).

Reported-by: Johannes Sixt <j.sixt@viscovery.net>
Reported-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2011-01-28 09:01:17 +00:00
Bert Wesarg
7587f4d32f git-gui: learn more type change states
Support the following states with type change in git-gui: AT, MT, TD, TM

Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2011-01-28 00:16:50 +00:00
Bert Wesarg
4a065c8a6f git-gui: remove 'no such variable' for s error when encounter unknown file states
$s will be referenced in the error message. Which was broken since
"git-gui: Automatically update-index all included files before commit"
(bbe3b3b, 2006-11-16).

Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2011-01-28 00:16:46 +00:00
Bert Wesarg
88b21c2a40 git-gui: Fix use of hunk tag for non-hunk content.
The hunk tag d_@ lost its blue forground color in "apply color information
from git diff output" (2010-10-22, 8f85599). But this tag was also used
for non-hunk content like untracked file mime types or git submodules.

Introduce a new tag for this type of content which has the blue forground
again.

Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2010-12-06 22:01:01 +00:00
Bert Wesarg
c7ec31a36e git-gui: Fix use of renamed tag.
The d======= was renamed to d= in 4590307.

Fix this.

Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2010-12-06 21:09:53 +00:00
Bert Wesarg
1ab862862f git-gui: fix browsers [Up To Parent] in sub-sub-directories.
browser_path used to end with a slash, so the regexp matches the empty string
and therefore removes nothing.

Fix this.

Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2010-11-22 21:52:51 +00:00
Bert Wesarg
4590307a33 git-gui: respect conflict marker size
Respect the conflict-marker-size attribute on paths when detecting merge
conflicts.

[PT: fixed problem with variable substitution in the regexps]

Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2010-11-19 11:25:00 +00:00
Bert Wesarg
46a0431b99 git-gui: fix ANSI-color parsing
git diff always outputs color reset commands, even when the color for the
current part is disabled (ie. normal). But the current ANSI-color parsing code
assumes that color start and reset commands appear in matching pairs.

Relax this assumption.

Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2010-11-19 09:32:58 +00:00
Pat Thoyts
8f85599aba git-gui: apply color information from git diff output
This patch extracts the ANSI color sequences from git diff output and
applies these to the diff view window. This ensures that the gui view
makes use of the current git configuration for whitespace display.

ANSI codes may include attributes, foreground and background in a single
sequence. Handle this and support bold and reverse attributes. Ignore
all other attributes.

Suggested-by: Tor Arvid Lund <torarvid@gmail.com>
Suggested-by: Junio C Hamano <gitster@pobox.com>
Tested-by: Tor Arvid Lund <torarvid@gmail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2010-10-27 23:47:28 +01:00
Pat Thoyts
4c56d1ddc0 git-gui: use full dialog width for old name when renaming branch
Let the combobox/option menu expand to fill the width of the dialog.

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2010-10-07 23:00:33 +01:00
Pat Thoyts
d5257fb3c1 git-gui: handle textconv filter on Windows and in development
When developing/testing we run git-gui.sh directly and the makefile
configured variables are not properly set. Configure the new shellpath
accessor to handle this case.

On Windows we may not find the shell so in this case revert to simply
executing the filter command without the shell intermediate.

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2010-08-12 21:37:32 +01:00
Matthieu Moy
62f9a632c8 git-gui: use shell to launch textconv filter in "blame"
The textconv filters may include multiple arguments and may make use
of unix shell features. To maintain compatibility with 'git blame'
ensure these commands are passed through bash.

Reported-by: Kirill Smelkov <kirr@landau.phys.spbu.ru>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2010-08-12 21:35:09 +01:00
Clément Poulain
1fbaccad4d git-gui: use textconv filter for diff and blame
Create a checkbox "Use Textconv For Diffs and Blame" in git-gui options.
If checked and if the driver for the concerned file exists, git-gui calls diff
and blame with --textconv option

Signed-off-by: Clément Poulain <clement.poulain@ensimag.imag.fr>
Signed-off-by: Diane Gasselin <diane.gasselin@ensimag.imag.fr>
Signed-off-by: Axel Bonnet <axel.bonnet@ensimag.imag.fr>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2010-07-30 10:05:27 +01:00
Pat Thoyts
85123549f0 git-gui: Avoid using the <<Copy>> binding as a menu accelerator on win32
On Windows the Control-C binding is used to copy and is mapped to the Tk
virtual event <<Copy>>. In the initial git-gui dialog this is also bound
as an accelerator for the Clone menu item. The effect is that both bindings
run, copying the text but resetting the clone page or switching to the clone
page when the user tries to copy text from one of the entry fields.
This patch avoids this by using Control-L instead for Windows only.

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2010-07-30 10:05:27 +01:00
Heiko Voigt
fc17e5e5bd git-gui: fix shortcut creation on cygwin
When the user tried to create a desktop icon with git gui on cygwin
wscript was complaining about an unknown option and displaying the
non-native path as such.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2010-07-30 10:05:26 +01:00
Heiko Voigt
a197b1e89a git-gui: fix usage of _gitworktree when creating shortcut for windows
This fixes msysGit issue 425.

Signed-off-by: Heiko Voigt <heiko.voigt@mahr.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2010-07-30 09:57:26 +01:00
Heiko Voigt
b963d11827 git-gui: fix usage of themed widgets variable
There was one forgotten global so NS was not visible to the method
which resulted in an error.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
2010-07-10 23:41:54 +01:00
Pat Thoyts
c80d7be5e1 git-gui: use themed tk widgets with Tk 8.5
This patch enables the use of themed Tk widgets with Tk 8.5 and above.
These make a significant difference on Windows in making the
application appear native. On Windows and MacOSX ttk defaults to the
native look as much as possible. On X11 the user may select a theme
using the TkTheme XRDB resource class by adding an line to the
.Xresources file. The set of installed theme names is available using
the Tk command 'ttk::themes'. The default on X11 is similar to the current
un-themed style - a kind of thin bordered motif look.

A new git config variable 'gui.usettk' may be set to disable this if
the user prefers the classic Tk look. Using Tk 8.4 will also avoid the
use of themed widgets as these are only available since 8.5.

Some support is included for Tk 8.6 features (themed spinbox and native
font chooser for MacOSX and Windows).

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-01-27 17:13:52 -08:00
Giuseppe Bilotta
3748b03d92 git-gui: update shortcut tools to use _gitworktree
Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-01-23 15:15:55 -08:00
Jeff Epler
ff07c3b621 git-gui: Support applying a range of changes at once
Multiple lines can be selected in the diff viewer and applied all
at once, rather than selecting "Stage Line For Commit" on each
individual line.

Signed-off-by: Jeff Epler <jepler@unpythonic.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-01-23 15:14:15 -08:00
Jens Lehmann
a9ae14a1c5 git-gui: Use git diff --submodule when available
Doing so is much faster and gives the same output.
Here are some numbers:

  $ time git submodule summary
  real	0m0.219s
  user	0m0.050s
  sys	0m0.111s

  $ time git diff --submodule
  real	0m0.012s
  user	0m0.003s
  sys	0m0.009s

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-01-23 15:14:15 -08:00
Jeff Epler
390425bdef git-gui: Fix applying a line when all following lines are deletions
If a diff looked like:

 @@
  context
 -del1
 -del2

and you wanted to stage the deletion 'del1', the generated patch
wouldn't apply because it was missing the line 'del2' converted to
context, but this line was counted in the @@-line

Signed-off-by: Jeff Epler <jepler@unpythonic.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-01-23 15:00:09 -08:00
Christopher Beelby
3c6a287027 git-gui: Keep repo_config(gui.recentrepos) and .gitconfig in sync
When the number of recent repo's gets to ten there can be a
situation where an item is removed from the .gitconfig file via
a call to git config --unset, but the internal representation of
that file (repo_config(gui.recentrepo)) is not updated.  Then a
subsequent attempt to remove an item from the list fails because
git-gui attempts to call --unset on a value that has already
been removed.  This leads to duplicates in the .gitconfig file,
which then also cause errors if the git-gui tries to --unset them
(rather than using --unset-all. --unset-all is not used because it
is not expected that duplicates should ever be allowed to exist.)

When loading the list of recent repositories (proc _get_recentrepos)
if a repo in the list is not considered a valid git reposoitory
then we should go ahead and remove it so it doesn't take up a slot
in the list (since we limit to 10 items). This will prevent a bunch
of invalid entries in the list (which are not shown) from making
valid entries dissapear off the list even when there are less than
ten valid entries.

See: http://code.google.com/p/msysgit/issues/detail?id=362
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-01-23 14:46:12 -08:00
Pat Thoyts
ea888f84bd git-gui: handle really long error messages in updateindex.
As reported to msysGit (bug #340) it is possible to get some very
long error messages when updating the index. The use of a label to
display this prevents scrolling the output. This patch replaces the
label with a scrollable text widget configured to look like a label.

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-01-23 14:22:28 -08:00
Alexander Gavrilov
10852086d4 git-gui: Increase blame viewer usability on MacOS.
On MacOS raising a window causes the focus to be transferred
to it -- although it may actually be a bug in the Tcl/Tk port.
When this happens with the blame viewer tooltips, it makes
the interface less usable, because Entry and Leave handlers
on the text view cause the tip to disappear once the mouse
is moved even 1 pixel.

This commit makes the code raise the main window on MacOS
when Tk 8.5 is used. This version seems to properly support
wm transient by making the tip stay on top of the master,
so reraising the master does not cause it to disappear. Thus
the only remaining sign of problems is slight UI flicker
when focus is momentarily transferred to the tip and back.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2009-12-05 14:26:59 -08:00
Clemens Buchacher
88520cadf9 git-gui: search 4 directories to improve statistic of gc hint
On Windows, git-gui suggests running the garbage collector if it finds
1 or more files in .git/objects/42 (as opposed to 8 files on other
platforms). The probability of that happening if the repo contains
about 100 loose objects is 32%. The probability for the same to happen
when searching 4 directories is only 8%, which is bit more reasonable.

Also remove $objects_limit from the message, because we already know
that we are above (or close to) that limit. Telling the user about
that number does not really give him any useful information.

The following octave script shows the probability for at least m*q
objects to be found in q subdirectories of .git/objects if n is the
total number of objects.

q = 4;
m = [1 2 8];
n = 0:10:2000;

P = zeros(length(n), length(m));
for k = 1:length(n)
        P(k, :) = 1-binocdf(q*m-1, n(k), q/(256-q));
end
plot(n, P);

n \ q   1       4
50      18%     1%
100     32%     8%
200     54%     39%
500     86%     96%

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2009-12-05 13:48:03 -08:00
Heiko Voigt
c0d153295c git gui: make current branch default in "remote delete branch" merge check
We already do the same when locally deleting a branch.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2009-12-05 13:17:51 -08:00
Shawn O. Pearce
118d938812 git-gui: Ensure submodule path is quoted properly
When quoting an arbitrary user string in Tcl, its better to use
[list ...] than to use {...}, in case the user string has spaces
or { embedded within it.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2009-08-26 17:42:50 -07:00
Jens Lehmann
af413de47b git-gui: fix diff for partially staged submodule changes
When a submodule commit had already been staged and another commit had
been checked out inside the submodule, the diff always displayed the
submodule commit log messages between the last supermodule commit and
the working tree, totally ignoring the commit in the index.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2009-08-26 17:35:16 -07:00
Heiko Voigt
2112be7650 git-gui: remove warning when deleting correctly merged remote branch
If the user wants to delete a remote branch and selects the correct
"merged into" we should not warn that "Recovering deleted branches is
difficult". For local branches we do the same already.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2009-08-10 08:47:34 -07:00
Jens Lehmann
246295bdeb git-gui: display summary when showing diff of a submodule
As it is hard to say what changed in a submodule by looking at the hashes,
let's show the colored submodule summary instead.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2009-08-10 08:30:26 -07:00
Jens Lehmann
b4c813bc71 git-gui: run post-checkout hook after clone
git-gui is using "git-read-tree -u" when cloning which doesn't
invoke the post-checkout hook as a plain git-clone would.
So git-gui must call the hook itself.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2009-04-08 07:42:54 -07:00
Shawn O. Pearce
4339d5109c Merge branch 'maint'
* maint:
  git-gui: Ensure consistent usage of mergetool.keepBackup
  git-gui: fix use of undeclared variable diff_empty_count
2009-04-08 07:41:13 -07:00
Ferry Huberts
fb25092a88 git-gui: Ensure consistent usage of mergetool.keepBackup
In several places merge.keepBackup is used i.s.o.
mergetool.keepBackup. This patch makes it all
consistent.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2009-04-08 07:40:58 -07:00
Jens Lehmann
c9498339a4 git-gui: run post-checkout hook on checkout
git-gui is using "git-read-tree -u" for checkout which doesn't
invoke the post-checkout hook as a plain git-checkout would.
So git-gui must call the hook itself.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2009-04-05 12:58:26 -07:00
Jens Lehmann
f0d4eec99f git-gui: When calling post-commit hook wrong variable was cleared.
Before calling the post-commit hook, the variable "pc_err" is cleared
while later only "pch_error" is used. "pch_error$cmt_id" only appeared in
"upvar"-Statements (which were changed to "global") and was removed.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2009-04-05 12:45:40 -07:00
Sam Hocevar
966d0778db git-gui: minor spelling fix and string factorisation.
Properly spell "successful" and slightly rewrite a couple of strings
that actually say the same thing in order to reduce translation work.

Update .pot and .po files accordingly since no new translation is
required.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2009-03-24 16:17:30 -07:00
Shawn O. Pearce
b0d644b658 Merge branch 'maint' 2009-03-20 14:44:48 -07:00
Jens Lehmann
e27430e777 git-gui: Fix merge conflict display error when filename contains spaces
When a merge conflict occurs in a file with spaces in the filename,
git-gui showed wrongly "LOCAL: deleted".

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2009-03-20 14:44:28 -07:00
Shawn O. Pearce
73fea17364 Merge branch 'maint'
* maint:
  git-gui: don't hide the Browse button when resizing the repo chooser
2009-03-16 20:01:27 -07:00
Markus Heidelberg
379f84b8d1 git-gui: don't hide the Browse button when resizing the repo chooser
Rather shrink the input field for "Create New Repository" and "Open
Existing Repository" as it's already done for "Clone Existing
Repository".

Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2009-03-16 19:57:48 -07:00
Phil Lawrence
880fa117f1 Append ampersand to "Target" of lnk files created by do_cygwin_shortcut
The git-gui menu item "Repository | Create Desktop Icon" creates a
shortcut (.lnk file) on the Windows desktop.  The purpose of the
created shortcut is to make it easy for a user to launch git-gui
for a particular repo in the future.

A Windows user would expect to see git gui launch when they click
the shortcut; they would not expect (nor want) to see a cmd window
open and remain open in the background.

msysGit avoids opening a command window altogether when it's Git GUI
shortcut is used.  Ideally, git on cygwin would also have shortcuts
that simply open the GUI, but as a first step, this change allows
the shell window to politely disappear after starting git gui as a
background process.

Signed-off-by: Phil Lawrence <prlawrence@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2009-03-09 16:21:17 -07:00
Alexander Gavrilov
584fa9ccf4 git-gui: Avoid an infinite rescan loop in handle_empty_diff.
If the index update machinery and git diff happen to disagree
on whether a particular file is modified, it may cause git-gui
to enter an infinite index rescan loop, where an empty diff
starts a rescan, which finds the same set of files modified,
and tries to display the diff for the first one, which happens
to be the empty one. A current example of a possible disagreement
point is the autocrlf filter.

This patch breaks the loop by using a global counter to track
the auto-rescans. The variable is reset whenever a non-empty
diff is displayed.

Another suggested approach, which is based on giving the
--exit-code argument to git diff, cannot be used, because
diff-files seems to trust the timestamps in the index, and
returns a non-zero code even if the file is actually
unchanged, which essentially defeats the purpose of the
auto-rescan logic.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2009-02-08 11:50:11 -08:00
Alexander Gavrilov
06569cd5be git-gui: Fix post-commit status with subject in non-locale encoding
As pointed out in msysgit bug #181, when a non-locale encoding is
used for commits, post-commit status messages display the subject
incorrectly.  It happens because the file handle is not properly
configured before the subject is read back.

This patch fixes it by factoring out the code that is used to setup
the output handle into a separate function, and calling it from
the reading code.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Acked-by: Robin Rosenberg <robin.rosenberg@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2009-02-01 14:56:54 -08:00