1
0
mirror of https://github.com/git/git.git synced 2024-10-20 23:58:49 +02:00
Commit Graph

854 Commits

Author SHA1 Message Date
Alexander Gavrilov
3e34838caf git-gui: Reenable staging unmerged files by clicking the icon.
This restores functionality of the file icon for unmerged files.
Safety is enforced by loading the diff and checking for lines
that look like conflict markers. If such lines are found, or
the conflict involves deletion and/or symlinks, a confirmation
dialog is presented. Otherwise, the icon immediately stages the
working copy version of the file.

Includes a revert of 2fe5b2ee42897a3acc78e5ddaace3775eb2713ca
(Restore ability to Stage Working Copy for conflicts)

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Tested-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-09-24 12:51:43 -07:00
Alexander Gavrilov
6fc835a3f3 git-gui: Support the encoding menu in gui blame.
Allow dynamically changing the encoding from the blame
viewer as well.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Tested-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-09-24 12:48:32 -07:00
Alexander Gavrilov
a1c3feb7fa git-gui: Optimize encoding name resolution using a lookup table.
Encoding menu construction does almost a hundred of encoding
resolutions, which with the old implementation led to a
small but noticeable delay.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Tested-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-09-24 12:48:32 -07:00
Alexander Gavrilov
3fe0162362 git-gui: Allow forcing display encoding for diffs using a submenu.
Add a submenu to allow dynamically changing the encoding to use
for diffs. Encoding settings are remembered while git-gui runs.
The rules are:

1) Encoding set for a specific file overrides gitattributes.
2) Last explicitly set value of the encoding overrides gui.encoding

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Tested-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-09-24 12:48:32 -07:00
Alexander Gavrilov
50102c5687 git-gui: Add a menu of available encodings.
To make encoding selection easier, add a menu that
lists available encodings to the Options window.

Menu structure is borrowed from Firefox.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Tested-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-09-24 12:48:32 -07:00
Alexander Gavrilov
72e6b00202 git-gui: Cleanup handling of the default encoding.
- Make diffs and blame default to the system (locale)
  encoding instead of hard-coding UTF-8.
- Add a gui.encoding option to allow overriding it.
- gitattributes still have the final word.

The rationale for this is Windows support:

1) Windows people are accustomed to using legacy encodings
   for text files. For many of them defaulting to utf-8
   will be counter-intuitive.
2) Windows doesn't support utf-8 locales, and switching
   the system encoding is a real pain. Thus the option.

This patch also adds proper encoding conversion to Apply Hunk/Line.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Tested-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-09-24 12:48:32 -07:00
Shawn O. Pearce
696235c6c1 git-gui: Assume blame --incremental output is in UTF-8
Most commits have author name encoded in UTF-8, but the incremental
blame output dumps raw bytes and doesn't give us the encoding header
from the commit.  Rather than fixing up tooltip data after we have
viewed that particular commit in the blame viewer we can assume all
names are in UTF-8.

This is still going to cause problems when the author name is not
encoded in UTF-8, but the only (efficient) way to solve that is to
add an "encoding" header to the blame --incremental mode output,
as otherwise we need to run `git cat-file commit $sha1` for each
and every commit identified and that would be horribly expensive
on any platform.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-09-24 12:48:31 -07:00
Shawn O. Pearce
1ffca60f0b git-gui: Use gitattribute "encoding" for file content display
Most folks using git-gui on internationalized files have complained
that it doesn't recognize UTF-8 correctly.  In the past we have just
ignored the problem and showed the file contents as binary/US-ASCII,
which is wrong no matter how you look at it.

This really should be a per-file attribute, managed by .gitattributes,
so we now pull the "encoding" attribute data for the given path from
the .gitattributes (if available) and use that, falling back to UTF-8
if the attributes are unavailable, git-check-attr is broken, or an
encoding for this path not specified.

We apply the encoding anytime we show file content, which currently
is limited to only the diff viewer and the blame viewer.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-09-24 12:48:31 -07:00
Joshua Williams
2cd1fd1f6d git-gui: Add support for calling out to the prepare-commit-msg hook
Signed-off-by: Joshua Williams <joshua.williams@qlogic.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-09-24 12:43:00 -07:00
Shawn O. Pearce
1e02b32e72 git-gui: Hide commit related UI during citool --nocommit
If the user started git-gui as "git citool --nocommit" then they
don't need the new commit / amend commit radio buttons, or the sign
off button in the UI.  Rather than use up space with options the
user cannot activate they are simply not installed into the UI.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-09-24 09:53:35 -07:00
Alexander Gavrilov
1e65c6225d git-gui: Add more integration options to citool.
- Make citool return nonzero exit code if it did not commit.
- Add a mode where it does not actually commit and simply
  exits with zero code. Commit message is either disabled,
  or simply dumped to GITGUI_EDITMSG before exiting.
- Add an option to immediately start it in amend mode.

Rationale:

1) Use 'git citool --nocommit' instead of mergetool in scripts.
2) Use 'git citool --amend' to edit commits while rebasing.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-09-24 09:53:01 -07:00
Christian Stimming
146ed90f02 git-gui: Updated German translation.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-09-13 14:24:16 -07:00
Christian Stimming
8b56a18dea git-gui: I18n fix sentence parts into full sentences for translation again.
For translations, it is almost always impossible to correctly translate
parts of sentences in almost any other language. Hence, messages like this
must be re-organized into full sentences.

Signed-off-by: Christian Stimming <stimming@tuhh.de>
Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-09-12 08:38:42 -07:00
Alexander Gavrilov
2fe5b2ee42 git-gui: Restore ability to Stage Working Copy for conflicts.
Tools like rerere leave files marked as conflicts in the index,
while actually resolving them in the working copy. Also, some
people like to use an external editor to resolve conflicts.

This patch restores functionality previously removed in
commit 617ceee653 by adding a new context menu item.
It still ensures that the user does not stage conflicting files
accidentally by clicking on the icon instead of the name.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Tested-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-09-12 08:09:09 -07:00
Alexander Gavrilov
a9786bb42f git-gui: Fix Blame Parent & Context for working copy lines.
Make Blame Parent Commit and Show History Context work
properly for lines blamed on the working copy.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-09-12 08:09:09 -07:00
Shawn O. Pearce
95b6a2db25 Merge branch 'maint'
* maint:
  git-gui: Fix diff parsing for lines starting with "--" or "++"
2008-09-04 21:53:06 -07:00
Shawn O. Pearce
ca53c3fdcf git-gui: Fix diff parsing for lines starting with "--" or "++"
Languages like Lua and SQL use "--" to mark a line as commented out.
If this appears at column 0 and is part of the pre-image we may see
"--- foo" in the diff, indicating that the line whose content is
 "-- foo" has been removed from the new version.

git-gui was incorrectly parsing "--- foo" as the old file name
in the file header, causing it to generate a bad patch file when
the user tried to stage or unstage a hunk or the selected line.
We need to keep track of where we are in the parsing so that we do
not misread a deletion or addition record as part of the header.

Reported-by: Alexander Gladysh <agladysh@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-09-04 21:52:56 -07:00
Alexander Gavrilov
b2ca414973 git-gui: Show special diffs for complex conflict cases.
Add special handling for displaying diffs of modified/deleted,
and symlink/mode conflicts. Currently the display is completely
unusable for deciding how to resolve the conflict.

New display modes:

1) Deleted/Modified conflict: e.g.
	LOCAL: deleted
	REMOTE:
	[diff :1:$path :3:$path]

2) Conflict involving symlinks:
	LOCAL:
	[diff :1:$path :2:$path]
	REMOTE:
	[diff :1:$path :3:$path]

In order to be able to display multiple diffs, this
patch adds a queue of commands to call.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-09-04 21:28:55 -07:00
Alexander Gavrilov
8056cc4f29 git-gui: Make F5 reselect a diff, if an untracked file is selected.
If an untracked file is selected, F5 and other manual rescan synonyms
would try to select a tracked file instead. Also, clicking on an icon
in the unstaged changes list skips over untracked files, unless the
file clicked is untracked itself.

The objective is to make it easier to ignore untracked files showing
up in the Unstaged Changes list, and ensure that no modifications
to tracked objects are left unstaged.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-09-04 21:28:55 -07:00
Alexander Gavrilov
29853b9010 git-gui: Reimplement and enhance auto-selection of diffs.
Generalize the next_diff system, and implement auto-reselection
for merge tool resolution and reshow_diff. Also add auto-selection
of diffs after rescan, if no diff is already selected.

New auto-select rules:

- Rescan auto-selects the first conflicting file, or if none
  a modified tracked file, if nothing was selected previously.
- Resolving a conflict auto-selects the nearest conflicting
  file, or nothing if everything is resolved.
- Staging the last remaining hunk auto-selects the nearest
  modified staged file.
- Staging a file through its icon auto-selects the nearest file.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-09-04 21:28:55 -07:00
Alexander Gavrilov
ff515d81fa git-gui: Support conflict states _U & UT.
Support _U (local deleted, remote modified) and
UT (file type changed in conflict) modes.

Note that 'file type changed' does not refer to
changes in the executable bit, instead it denotes
replacing a file with a link, or vice versa.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-09-04 21:28:55 -07:00
Alexander Gavrilov
48c74a58b1 git-gui: Support more merge tools.
Add native support for Araxis Merge, WinMerge and Perforce merge.

Custom merge tools are not implemented by mergetool.tcl; besides,
native support allows constructing the command lines in a more
intelligent way.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-09-04 21:28:55 -07:00
Alexander Gavrilov
617ceee653 git-gui: Don't allow staging files with conflicts.
Prevent staging files with conflict markers by clicking
on the icon in the 'Unstaged Changes' list. Instead, pretend
that the user clicked the name, and show the diff.

Originally it made some sense to allow staging conflicting
files, because git-gui did not provide any tools to resolve
them from within the GUI. But now that we have added mergetool
capabilities, it is more likely to cause accidental and
non-undoable errors.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-09-04 21:28:55 -07:00
Alexander Gavrilov
7e30682ce0 git-gui: Support calling merge tools.
Adds an item to the diff context menu in conflict mode,
which invokes a merge tool for the selected file. Tool
command-line handling code was ported from git-mergetool.

Automatic default tool selection and custom merge tools
are not supported. If merge.tool is not set, git-gui
defaults to meld.

This implementation uses a checkout-index hack in order
to retrieve all stages with autocrlf and filters properly
applied. It requires temporarily moving the original
conflict file out of the way.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-09-04 21:28:54 -07:00
Alexander Gavrilov
042c232535 git-gui: Support resolving conflicts via the diff context menu.
If the file has merge conflicts, show a special version of the
diff context menu, which includes conflict resolution commands
instead of Stage Hunk/Line. This patch only supports resolving
by discarding all sides except one.

Discarding is the only way to resolve conflicts involving symlinks
and/or deletion, excluding manual editing.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-09-04 21:28:54 -07:00
Christian Stimming
700e560341 git-gui: Mark forgotten strings for translation.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-09-04 21:28:48 -07:00
Shawn O. Pearce
961a628fdd Merge branch 'maint'
* maint:
  git-gui: Fix string escaping in po2msg.sh
  git gui: show diffs with a minimum of 1 context line

Conflicts:
	lib/option.tcl
2008-09-01 15:39:56 -07:00
Alexander Gavrilov
9dc3793166 git-gui: Fix string escaping in po2msg.sh
Escape '$', because otherwise git-gui crashes while
trying to load malformed Japanese localization strings.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-09-01 15:39:11 -07:00
Clemens Buchacher
55ba8a3474 git gui: show diffs with a minimum of 1 context line
Staging hunks without context does not work, because line number
information would have to be recomputed for individual hunks.

Since it is already possible to stage individual lines using
'Stage Line for Commit', zero context diffs are not really
necessary for git gui.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-09-01 12:45:46 -07:00
Alexander Gavrilov
f7078b4091 git-gui: Allow specifying an initial line for git gui blame.
Add a command-line option to make git gui blame automatically
scroll to a specific line in the file. Useful for integration
with other tools.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-08-24 22:00:01 -07:00
Alexander Gavrilov
823f7cf81d git-gui: Better positioning in Blame Parent Commit
Invoke diff-tree between the commit and its parent,
and use the hunks to fix the target line number,
accounting for addition and removal of lines.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-08-24 22:00:01 -07:00
Alexander Gavrilov
80fd76bd58 git-gui: Support passing blame to a parent commit.
Add a context menu item that switches the view to the
parent of the commit under cursor. It is useful to see
how the file looked before the change, and find older
changes in the same lines.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-08-24 22:00:01 -07:00
Alexander Gavrilov
a9c80b83d4 git-gui: Support starting gitk from Gui Blame
Add a context menu command to load commits
that are within a certain time range from the
selected commit into gitk.

It can be useful for understanding of the code,
especially if the repository is imported from
a VCS that does not support atomic commits.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-08-24 22:00:01 -07:00
Gustaf Hendeby
e681cb7d6a git-gui: Teach git gui about file type changes
Signed-off-by: Gustaf Hendeby <hendeby@isy.liu.se>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-08-24 21:36:17 -07:00
Alexandre Bourget
f2816b3d34 git-gui: update all remaining translations to French.
Simply..

Signed-off-by: Alexandre Bourget <alexandre.bourget@savoirfairelinux.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-08-12 19:50:03 -07:00
Alexandre Bourget
186f8aa908 git-gui: Update french translation
Signed-off-by: Alexandre Bourget <alexandre.bourget@savoirfairelinux.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-08-12 19:50:03 -07:00
Shawn O. Pearce
1c1fe1005c git-gui 0.11
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
gitgui-0.11.0
2008-08-10 00:02:08 -07:00
Johannes Sixt
9534c9fb31 git-gui: Adapt discovery of oguilib to execdir 'libexec/git-core'
The new execdir is two levels below the root directory, while
the old execdir 'bin' was only one level below.  This commit
adapts the discovery of oguilib that uses relative paths
accordingly. We determine whether we have the extra level in the same
way in which the Makefile defines sharedir, i.e. whether the last
directory part is 'git-core'.

Inspired-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-08-04 17:38:17 -07:00
Michele Ballabio
fbbdaa5f42 git-gui: add a part about format strings in po/README
This should help tranlators that need to reorder words and strings.
Original explanation by Christian Stimming.

Also remove unneeded backslashes.

Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-08-03 13:53:42 -07:00
Michele Ballabio
7cce5b2cbc git-gui: update po/it.po
Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-08-03 13:51:26 -07:00
しらいしななこ
6b312253cb git-gui: update Japanese translation
This updates Japanese translation to match the updated git-gui.pot.

Signed-off-by: しらいしななこ <nanako3@lavabit.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-08-03 13:49:53 -07:00
Mikael Magnusson
d049f6c27a git-gui: Update swedish translation.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-08-02 16:53:15 -07:00
Shawn O. Pearce
1be7bf6e33 git-gui: Update git-gui.pot for 0.11 nearing release
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-08-02 14:48:33 -07:00
Christian Stimming
1e5ed425f3 git-gui: Update German translation
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-08-02 14:09:41 -07:00
Steffen Prohaska
5fc6edab76 git-gui (Windows): Change wrapper to execdir 'libexec/git-core'
git-gui needs bindir in PATH to be able to run 'git'.  bindir
however is not necessarily in PATH if started directly through a
Windows shortcut.  Therefore, we used to add the directory
git-gui is located in.  But with the new 'libexec/git-core'
layout this directory is no longer identical to bindir.

This commit modifies the wrapper script to discover the bindir
and add it to PATH.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-07-29 22:43:37 -07:00
Steffen Prohaska
f57ddcc5ec git-gui (Windows): Switch to relative discovery of oguilib
Instead of using an absolute path, git-gui can discover its
gui library using a relative path from execdir.  We want to
use the relative path discovery on MinGW to avoid issues
with translation of absolute paths.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-07-29 22:43:37 -07:00
Steffen Prohaska
f8f1acf339 git-gui: Correct installation of library to be $prefix/share
We always wanted the library for git-gui to install into the
$prefix/share directory, not $prefix/libexec/share.  All of
the files in our library are platform independent and may
be reused across systems, like any other content stored in
the share directory.

Our computation of where our library should install to was broken
when git itself started installing to $prefix/libexec/git-core,
which was one level down from where we expected it to be.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-07-29 22:43:37 -07:00
Shawn O. Pearce
79317e5df1 git-gui: Fix gitk search in $PATH to work on Windows
Back in 15430be5a1 ("Look for gitk in $PATH, not $LIBEXEC/git-core")
git-gui learned to use [_which gitk] to locate where gitk's script
is as Git 1.6 will install gitk to $prefix/bin (in $PATH) and all
of the other tools are in $gitexecdir.

This failed on Windows because _which adds the ".exe" suffix as it
searches for the program on $PATH, under the assumption that we can
only execute something from Tcl if it is a proper Windows executable.

When scanning for gitk on Windows we need to omit the ".exe" suffix.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-07-29 22:41:23 -07:00
Alexander Gavrilov
25b8fb1e49 git-gui: Preserve scroll position on reshow_diff.
It is especially useful for Stage/Unstage Line, because
they invoke full state scan and diff reload, which originally
would reset the scroll position to the top of the file.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-07-27 08:08:10 -07:00
Alexander Gavrilov
7e09b1531f git-gui: Fix the Remote menu separator.
It was positioned incorrectly (offset by one position)
if the menu had a tear-off handle.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-07-27 08:08:09 -07:00