gitweb.git
Update the po templateShawn O. Pearce Sun, 16 Nov 2008 21:56:55 +0000 (13:56 -0800)

Update the po template

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

git-gui: Implement automatic rescan after Tool execution.Alexander Gavrilov Sun, 16 Nov 2008 18:46:51 +0000 (21:46 +0300)

git-gui: Implement automatic rescan after Tool execution.

The Tools menu is generally intended for commands that
affect the working directory or repository state. Thus,
the user would usually want to initiate rescan after
execution of a tool. This commit implements it.

In case somebody would want to avoid rescanning after
certain tools, it also adds an option that controls it,
although it is not made available through the Add dialog.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Allow Tools request arguments from the user.Alexander Gavrilov Sun, 16 Nov 2008 18:46:50 +0000 (21:46 +0300)

git-gui: Allow Tools request arguments from the user.

While static commands are already useful, some tools need
additional parameters to reach maximum usability. This
commit adds support for passing them one revision name
parameter, and one arbitrary string. With this addition,
the tools menu becomes flexible enough to implement basic
rebase support:

[core]
editor = kwrite
[guitool "Rebase/Abort"]
cmd = git rebase --abort
confirm = yes
[guitool "Rebase/Continue"]
cmd = git rebase --continue
[guitool "Rebase/Skip Commit"]
cmd = git rebase --skip
confirm = yes
[guitool "Rebase/Start..."]
cmd = git rebase $ARGS $REVISION $CUR_BRANCH
title = Start Rebase
prompt = Rebase Current Branch
argprompt = Flags
revprompt = New Base
revunmerged = yes

Some of the options, like title or prompt, are intentionally
not included in the Add dialog to avoid clutter. Also, the
dialog handles argprompt and revprompt as boolean vars.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Add a Tools menu for arbitrary commands.Alexander Gavrilov Sun, 16 Nov 2008 18:46:49 +0000 (21:46 +0300)

git-gui: Add a Tools menu for arbitrary commands.

Due to the emphasis on scriptability in the git
design, it is impossible to provide 100% complete
GUI. Currently unaccounted areas include git-svn
and other source control system interfaces, TopGit,
all custom scripts.

This problem can be mitigated by providing basic
customization capabilities in Git Gui. This commit
adds a new Tools menu, which can be configured
to contain items invoking arbitrary shell commands.

The interface is powerful enough to allow calling
both batch text programs like git-svn, and GUI editors.
To support the latter use, the commands have access
to the name of the currently selected file through
the environment.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Fix the after callback execution in rescan.Alexander Gavrilov Sun, 16 Nov 2008 18:46:48 +0000 (21:46 +0300)

git-gui: Fix the after callback execution in rescan.

The rescan function receives a callback command
as its parameter, which is supposed to be executed
after the scan finishes. It is generally used to
update status. However, rescan may initiate a
loading of a diff, which always calls ui_ready after
completion. If the after handler is called before
that, ui_ready will override the new status.

This commit ensures that the after callback is
properly threaded through the diff machinery.

Since it uncovered the fact that force_first_diff
actually didn't work due to an undeclared global
variable, and the desired effects appeared only
because of the race condition between the diff
system and the rescan callback, I also reimplement
this function to make it behave as originally
intended.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Implement system-wide configuration handling.Alexander Gavrilov Sun, 16 Nov 2008 18:46:47 +0000 (21:46 +0300)

git-gui: Implement system-wide configuration handling.

With the old implementation any system-wide options appear
to be set locally in the current repository. This commit
adds explicit handling of system options, essentially
interpreting them as customized default_config.

The difficulty in interpreting system options stems from
the fact that simple 'git config' lists all values, while
'git config --global' only values set in ~/.gitconfig,
excluding both local and system options.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: try to provide a window icon under XGiuseppe Bilotta Sun, 16 Nov 2008 02:42:32 +0000 (03:42 +0100)

git-gui: try to provide a window icon under X

When running under X, we try to set up a window icon by providing a
hand-crafted 16x16 Tk photo image equivalent to the .ico. Wrap in a
catch because the earlier Tcl/Tk 8.4 releases didn't provide the 'wm
iconphoto' command.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Request blame metadata in utf-8.Alexander Gavrilov Sun, 9 Nov 2008 15:53:09 +0000 (18:53 +0300)

git-gui: Request blame metadata in utf-8.

The blame builtin now supports automatic conversion of
metadata encoding. By default it is converted to the
character set specified by i18n.logoutputencoding.

Since gui blame expects the data in utf-8, it is
necessary to specify the desired encoding directly.
An old version of the blame command will simply
ignore the option.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Add the Show SSH Key item to the clone dialog.Alexander Gavrilov Sun, 9 Nov 2008 15:51:16 +0000 (18:51 +0300)

git-gui: Add the Show SSH Key item to the clone dialog.

The user might need to see the key before cloning a repository.
This patch makes the relevant menu item available in the Select
Repository/Clone dialog.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Fix focus transition in the blame viewer.Alexander Gavrilov Sun, 9 Nov 2008 15:36:50 +0000 (18:36 +0300)

git-gui: Fix focus transition in the blame viewer.

Now that the blame viewer has a search panel, it should be
taken into account by the focus transition code. Otherwise
showing a commit tip (by accidentally moving the mouse to
the text frame) causes the focus to transfer away from the
search field.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Update German translation.Christian Stimming Sat, 25 Oct 2008 20:51:05 +0000 (22:51 +0200)

git-gui: Update German translation.

Not yet completed, though.

Signed-off-by: Christian Stimming <stimming@tuhh.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Do not munge conflict marker lines in a normal... Johannes Sixt Tue, 14 Oct 2008 11:48:37 +0000 (13:48 +0200)

git-gui: Do not munge conflict marker lines in a normal diff

Previously, conflict markers were highlighted in two ways: (1) They
received a distinguishing color; and (2) they had the '+' removed at the
beginning of the line. However, by doing (2), a hunk that contained
conflict markers could not be staged or unstaged because the resulting
patch was corrupted. With this change we no longer modify the diff text
of a 2-way diff, so that "Stage Hunk" and friends work.

Note that 3-way diff of a conflicted file is unaffected by this change,
and '++' before conflict markers is still removed. But this has no negative
impact because in this mode staging hunks or lines is disabled anyway.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Add a simple implementation of SSH_ASKPASS.Alexander Gavrilov Wed, 15 Oct 2008 09:28:21 +0000 (13:28 +0400)

git-gui: Add a simple implementation of SSH_ASKPASS.

OpenSSH allows specifying an external program to use
for direct user interaction. While most Linux systems
already have such programs, some environments, for
instance, msysgit, lack it. This patch adds a simple
fallback Tcl implementation of the tool.

In msysgit it is also necessary to set a fake value of
the DISPLAY variable, because otherwise ssh won't even
try to use SSH_ASKPASS handlers.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Acked-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Add a dialog that shows the OpenSSH public... Alexander Gavrilov Wed, 15 Oct 2008 09:28:20 +0000 (13:28 +0400)

git-gui: Add a dialog that shows the OpenSSH public key.

Generating a new SSH key or finding an existing one may
be a difficult task for non-technical users, especially
on Windows.

This commit adds a new dialog that shows the public key,
or allows the user to generate a new one if none were found.
Since this is a convenience/informational feature for new
users, and the dialog is mostly read-only, it is located
in the Help menu.

The command line used to invoke ssh-keygen is designed to
force it to use SSH_ASKPASS if available, or accept empty
passphrases, but _never_ wait for user response on the tty.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Acked-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Mark-up strings in show_{other,unmerged}_diff... Johannes Sixt Fri, 3 Oct 2008 11:13:42 +0000 (13:13 +0200)

git-gui: Mark-up strings in show_{other,unmerged}_diff() for localization

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Show a round number of bytes of large untracke... Johannes Sixt Fri, 3 Oct 2008 08:28:49 +0000 (10:28 +0200)

git-gui: Show a round number of bytes of large untracked text files

If an untracked text file is selected, then its contents are displayed
instead of a diff. If the file is large, then the following hint is
inserted at the top:

* Untracked file is 14774881 bytes.
* Showing only first 131072 bytes.

Why exactly 131072 bytes? With this patch it is 100000 bytes.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Fix the blame viewer destroy handler.Alexander Gavrilov Fri, 3 Oct 2008 07:36:54 +0000 (11:36 +0400)

git-gui: Fix the blame viewer destroy handler.

It did not delete the object, which is not very good.
Also, destroy may be fired up for subwindows, so we
should check %W.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Add a search command to the blame viewer.Alexander Gavrilov Fri, 3 Oct 2008 07:36:53 +0000 (11:36 +0400)

git-gui: Add a search command to the blame viewer.

One of the largest deficiencies in the blame viewer at
the moment is the impossibility to search for a text
string. This commit fixes it by adding a Firefox-like
search panel to the viewer.

The panel can be shown by pressing F7 or clicking a
menu entry, and is hidden by pressing Esc. Find Next
is available through the F3 key.

Implementation is based on the gitk code, but heavily
refactored. It now also supports case-insensitive
searches, and uses the text box background color to
signal success or failure of the search.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Fix the blame window shape.Alexander Gavrilov Fri, 3 Oct 2008 07:36:52 +0000 (11:36 +0400)

git-gui: Fix the blame window shape.

On modern high-resolution monitors the blame viewer
window is very high, yet too narrow. This patch
makes it gravitate to a more sane resolution, which
takes the font size into account.

It also changes the default text view size to 80% of
the window, and slightly modifies the border decorations
for better appearance.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Fix switch statement in lib/merge.tclJohannes Sixt Wed, 8 Oct 2008 08:03:54 +0000 (10:03 +0200)

git-gui: Fix switch statement in lib/merge.tcl

0aea2842 (Make Ctrl-T safe to use for conflicting files) introduced a new
case, but forgot the '-' to indicate that it shares the body with the
subsequent case label.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Fix fetching from remotes when adding themPetr Baudis Wed, 24 Sep 2008 23:39:13 +0000 (01:39 +0200)

git-gui: Fix fetching from remotes when adding them

As you can see, this particular code branch did not see a lot
of testing for some time now. Apologies for that.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Fix removing non-pushable remotesPetr Baudis Wed, 24 Sep 2008 23:32:47 +0000 (01:32 +0200)

git-gui: Fix removing non-pushable remotes

Git-gui does not add most of the remotes to the 'push' menu
since they are missing the "Push" line in their remotespec.
In that case, removing the remote would end up with an error.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Make input boxes in init/clone/open dialogs... Petr Baudis Wed, 24 Sep 2008 22:12:51 +0000 (00:12 +0200)

git-gui: Make input boxes in init/clone/open dialogs consistent

Before, the input boxes would not be sunken and would have larger border,
which is inconsistent with the rest of the inputboxes for repository
locations in the git-gui UI.

Signed-off-by: Petr Baudis <petr.baudis@novartis.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Avoid using the term URL when specifying repos... Petr Baudis Wed, 24 Sep 2008 22:12:50 +0000 (00:12 +0200)

git-gui: Avoid using the term URL when specifying repositories

Instead, 'Location' is used to label such inputs; in the Clone dialog,
'Source' and 'Target' are also introduced to further clarify the situation.
The intent is to increase GUI consistency in the case location templates
(upcoming) are used - then, other locators than URL may be used.

Signed-off-by: Petr Baudis <petr.baudis@novartis.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: gui.autoexplore makes explorer to pop up autom... Petr Baudis Wed, 24 Sep 2008 22:07:02 +0000 (00:07 +0200)

git-gui: gui.autoexplore makes explorer to pop up automatically after picking

Especially for Windows users used to work with the Windows Explorer,
it is very useful when after picking a repository (either opening
a local one or initializing/cloning a new one) in the "intro" window,
the explorer view of the working copy pops up along the standard
Git GUI window, so that the users can, well, actually work with
the repository.

Signed-off-by: Petr Baudis <petr.baudis@novartis.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Add Explore Working Copy to the Repository... Petr Baudis Wed, 24 Sep 2008 22:05:53 +0000 (00:05 +0200)

git-gui: Add Explore Working Copy to the Repository menu

Especially when cloning is finished, the Git GUI window pops up,
but there is not really much one can do within it - there needs to be
a way to easily start exploring and working with the new working copy
using the standard system interface: explorer.exe on Windows, open on
MacOS/X and xdg-open as a fallback (all modern Linux desktops).

This might be also a post-clone option instead (possibly opening the window
automagically) but I believe that this might be useful also in other
situations, e.g. you don't have to keep the working copy window around
if you work in multiple repositories.

This operation will not make sense on bare repositories.

Signed-off-by: Petr Baudis <petr.baudis@novartis.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Use git web--browser for web browsingPetr Baudis Wed, 24 Sep 2008 21:57:16 +0000 (23:57 +0200)

git-gui: Use git web--browser for web browsing

This patch removes git-gui specific webbrowser guessing and instead
relies on git web--browser to do the right thing, removing unnecessary
code duplication. New function start_browser encapsulates the browser
execution, for usage from other parts of code. This will also make
git-gui show the documentation menu item even in cases it might not
be able to start up a browser, these cases should be however only
very rare.

Signed-off-by: Petr Baudis <petr.baudis@novartis.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: mkdir -p when initializing new remote repositoryPetr Baudis Wed, 24 Sep 2008 20:44:03 +0000 (22:44 +0200)

git-gui: mkdir -p when initializing new remote repository

This allows the user to create repositories with arbitrary paths
on the server. The downside is that errorneously typed paths are
not caught but instead created remotely; YMMV.

Signed-off-by: Petr Baudis <petr.baudis@novartis.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Add support for removing remotesPetr Baudis Wed, 24 Sep 2008 20:44:02 +0000 (22:44 +0200)

git-gui: Add support for removing remotes

We introduce new submenu Remote -> Remove Remote, allowing to remove
remotes. In the future, we might consider a confirmation popup to avoid
misclicks, but removing a remote is not very lossy operation.

Signed-off-by: Petr Baudis <petr.baudis@novartis.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Add support for adding remotesPetr Baudis Wed, 24 Sep 2008 20:44:01 +0000 (22:44 +0200)

git-gui: Add support for adding remotes

When a remote is being added, it can also be automatically either fetched
or initialized and pushed; this patch adds capability for initializing
of local and ssh repositories. This also of course leaves a lot of space
for further customization features, like individually turning the
initialization phase on/off or tuning attributes of the remote
repository; I consider that out of scope of this patch, however.

Signed-off-by: Petr Baudis <petr.baudis@novartis.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Squash populate_{push,fetch}_menu to populate_... Petr Baudis Wed, 24 Sep 2008 20:44:00 +0000 (22:44 +0200)

git-gui: Squash populate_{push,fetch}_menu to populate_remotes_menu

The meat of the routines is now separated to add_fetch_entry() and
add_push_entry(). This refactoring will allow easy implementation of adding
individual remotes later.

Signed-off-by: Petr Baudis <petr.baudis@novartis.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Clarify the Remote -> Delete... actionPetr Baudis Wed, 24 Sep 2008 20:43:59 +0000 (22:43 +0200)

git-gui: Clarify the Remote -> Delete... action

Currently, it was not really clear what all does this perform. We rename
"Delete..." to "Delete Branch..." (since this does not delete the remote
as a whole) and relabel the window from "Delete Remote Branch" to "Delete
Branch Remotely" (since the action also involves pushing the delete out).

Signed-off-by: Petr Baudis <petr.baudis@novartis.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Remove space from the end of aspell's reply... Johannes Sixt Tue, 30 Sep 2008 06:39:29 +0000 (08:39 +0200)

git-gui: Remove space from the end of aspell's reply before processing

When git gui processes a reply from aspell it explicitly ignores an empty
line. The Windows version of aspell, however, terminates lines with CRLF,
but TCL's 'gets' does not remove CR, hence, a "visibly" empty line was not
actually recognized as empty. With this change we explicitly trim off
whitespace before the line is further processed.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Make Ctrl-T safe to use for conflicting files.Alexander Gavrilov Tue, 30 Sep 2008 08:12:16 +0000 (12:12 +0400)

git-gui: Make Ctrl-T safe to use for conflicting files.

A previous patch added a check for conflict markers, which
is done when the file is about to be staged due to a click
on the icon. However, pressing Ctrl-T still immediately
stages the file without confirmation. This patch fixes it.

The check requires a loaded diff, so staging multiple files
at once won't work if they are unmerged.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Do not automatically stage file after merge... Johannes Sixt Wed, 24 Sep 2008 19:08:01 +0000 (21:08 +0200)

git-gui: Do not automatically stage file after merge tool finishes

If a merge tool was invoked on a conflicted file and the tool completed,
then the conflicted file was staged automatically. However, the fact that
the user closed the merge tool cannot be understood as the unequivocal
sign that the conflict was completely resolved. For example, the user
could have decided to postpone the resolution of the conflict, or could
have accidentally closed the tool. We better leave the file unstaged and
let the user stage it explicitly.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Show/hide "Sign Off" based on nocommitmsg... Shawn O. Pearce Fri, 26 Sep 2008 14:44:40 +0000 (07:44 -0700)

git-gui: Show/hide "Sign Off" based on nocommitmsg option

If citool --nocommit is invoked we hide the Sign Off features, as
the commit message area is not editable. But we really want the
selection tied to the message area's editing ability.

Suggested-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Merge branch 'maint'Shawn O. Pearce Fri, 26 Sep 2008 14:07:40 +0000 (07:07 -0700)

Merge branch 'maint'

git-gui: Help identify aspell version on Windows tooGustaf Hendeby Thu, 25 Sep 2008 21:31:22 +0000 (23:31 +0200)

git-gui: Help identify aspell version on Windows too

On windows, git gui fails to correctly extract the aspell version
(experienced with aspell version 0.50.3) due to scilent white space at
the end of the version string. Trim the obtained version string to
work around this.

Signed-off-by: Gustaf Hendeby <hendeby@isy.liu.se>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Reenable staging unmerged files by clicking... Alexander Gavrilov Sat, 20 Sep 2008 08:19:18 +0000 (12:19 +0400)

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>

git-gui: Support the encoding menu in gui blame.Alexander Gavrilov Wed, 17 Sep 2008 21:07:36 +0000 (01:07 +0400)

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>

git-gui: Optimize encoding name resolution using a... Alexander Gavrilov Wed, 17 Sep 2008 21:07:35 +0000 (01:07 +0400)

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>

git-gui: Allow forcing display encoding for diffs using... Alexander Gavrilov Wed, 17 Sep 2008 21:07:34 +0000 (01:07 +0400)

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>

git-gui: Add a menu of available encodings.Alexander Gavrilov Wed, 17 Sep 2008 21:07:33 +0000 (01:07 +0400)

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>

git-gui: Cleanup handling of the default encoding.Alexander Gavrilov Wed, 17 Sep 2008 21:07:32 +0000 (01:07 +0400)

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>

git-gui: Assume `blame --incremental` output is in... Shawn O. Pearce Wed, 23 Jan 2008 05:39:50 +0000 (00:39 -0500)

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>

git-gui: Use gitattribute "encoding" for file content... Shawn O. Pearce Wed, 23 Jan 2008 05:37:10 +0000 (00:37 -0500)

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>

git-gui: Add support for calling out to the prepare... Joshua Williams Wed, 24 Sep 2008 19:11:53 +0000 (14:11 -0500)

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>

git-gui: Hide commit related UI during citool --nocommitShawn O. Pearce Wed, 24 Sep 2008 16:48:20 +0000 (09:48 -0700)

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>

git-gui: Add more integration options to citool.Alexander Gavrilov Fri, 12 Sep 2008 18:43:49 +0000 (22:43 +0400)

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>

git-gui: Updated German translation.Christian Stimming Sat, 13 Sep 2008 08:24:47 +0000 (10:24 +0200)

git-gui: Updated German translation.

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

git-gui: I18n fix sentence parts into full sentences... Christian Stimming Fri, 12 Sep 2008 09:17:38 +0000 (11:17 +0200)

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>

git-gui: Restore ability to Stage Working Copy for... Alexander Gavrilov Mon, 8 Sep 2008 16:37:11 +0000 (20:37 +0400)

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>

git-gui: Fix Blame Parent & Context for working copy... Alexander Gavrilov Mon, 8 Sep 2008 07:18:52 +0000 (11:18 +0400)

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>

Merge branch 'maint'Shawn O. Pearce Fri, 5 Sep 2008 04:53:06 +0000 (21:53 -0700)

Merge branch 'maint'

* maint:
git-gui: Fix diff parsing for lines starting with "--" or "++"

git-gui: Fix diff parsing for lines starting with ... Shawn O. Pearce Fri, 5 Sep 2008 04:46:56 +0000 (21:46 -0700)

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>

git-gui: Show special diffs for complex conflict cases.Alexander Gavrilov Sat, 30 Aug 2008 21:05:22 +0000 (01:05 +0400)

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>

git-gui: Make F5 reselect a diff, if an untracked file... Alexander Gavrilov Sat, 30 Aug 2008 21:04:10 +0000 (01:04 +0400)

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>

git-gui: Reimplement and enhance auto-selection of... Alexander Gavrilov Sat, 30 Aug 2008 21:02:56 +0000 (01:02 +0400)

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>

git-gui: Support conflict states _U & UT.Alexander Gavrilov Sat, 30 Aug 2008 21:00:49 +0000 (01:00 +0400)

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>

git-gui: Support more merge tools.Alexander Gavrilov Sat, 30 Aug 2008 20:59:47 +0000 (00:59 +0400)

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>

git-gui: Don't allow staging files with conflicts.Alexander Gavrilov Sat, 30 Aug 2008 20:54:19 +0000 (00:54 +0400)

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>

git-gui: Support calling merge tools.Alexander Gavrilov Sat, 30 Aug 2008 20:56:51 +0000 (00:56 +0400)

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>

git-gui: Support resolving conflicts via the diff conte... Alexander Gavrilov Sat, 30 Aug 2008 20:55:45 +0000 (00:55 +0400)

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>

git-gui: Mark forgotten strings for translation.Christian Stimming Thu, 4 Sep 2008 09:50:53 +0000 (11:50 +0200)

git-gui: Mark forgotten strings for translation.

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

Merge branch 'maint'Shawn O. Pearce Mon, 1 Sep 2008 22:39:56 +0000 (15:39 -0700)

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

git-gui: Fix string escaping in po2msg.shAlexander Gavrilov Sat, 30 Aug 2008 21:12:26 +0000 (01:12 +0400)

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>

git gui: show diffs with a minimum of 1 context lineClemens Buchacher Sat, 30 Aug 2008 16:45:27 +0000 (18:45 +0200)

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>

git-gui: Allow specifying an initial line for git gui... Alexander Gavrilov Sat, 23 Aug 2008 08:32:20 +0000 (12:32 +0400)

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>

git-gui: Better positioning in Blame Parent CommitAlexander Gavrilov Sat, 23 Aug 2008 08:31:35 +0000 (12:31 +0400)

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>

git-gui: Support passing blame to a parent commit.Alexander Gavrilov Sat, 23 Aug 2008 08:30:51 +0000 (12:30 +0400)

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>

git-gui: Support starting gitk from Gui BlameAlexander Gavrilov Sat, 23 Aug 2008 08:30:00 +0000 (12:30 +0400)

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>

git-gui: Teach git gui about file type changesGustaf Hendeby Fri, 22 Aug 2008 20:10:27 +0000 (22:10 +0200)

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>

git-gui: update all remaining translations to French.Alexandre Bourget Mon, 11 Aug 2008 21:19:17 +0000 (17:19 -0400)

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>

git-gui: Update french translationAlexandre Bourget Mon, 11 Aug 2008 21:19:16 +0000 (17:19 -0400)

git-gui: Update french translation

Signed-off-by: Alexandre Bourget <alexandre.bourget@savoirfairelinux.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui 0.11 gitgui-0.11.0Shawn O. Pearce Sun, 10 Aug 2008 07:02:08 +0000 (00:02 -0700)

git-gui 0.11

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

git-gui: Adapt discovery of oguilib to execdir 'libexec... Johannes Sixt Mon, 4 Aug 2008 20:09:46 +0000 (22:09 +0200)

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>

git-gui: add a part about format strings in po/READMEMichele Ballabio Sun, 3 Aug 2008 11:12:14 +0000 (13:12 +0200)

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>

git-gui: update po/it.poMichele Ballabio Wed, 21 May 2008 14:09:14 +0000 (16:09 +0200)

git-gui: update po/it.po

Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: update Japanese translationしらいしななこ Sun, 3 Aug 2008 08:01:50 +0000 (17:01 +0900)

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>

git-gui: Update swedish translation.Mikael Magnusson Sat, 2 Aug 2008 23:46:23 +0000 (01:46 +0200)

git-gui: Update swedish translation.

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

git-gui: Update git-gui.pot for 0.11 nearing releaseShawn O. Pearce Sat, 2 Aug 2008 21:48:33 +0000 (14:48 -0700)

git-gui: Update git-gui.pot for 0.11 nearing release

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

git-gui: Update German translationChristian Stimming Sat, 2 Aug 2008 07:54:51 +0000 (09:54 +0200)

git-gui: Update German translation

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

git-gui (Windows): Change wrapper to execdir 'libexec... Steffen Prohaska Sun, 27 Jul 2008 16:49:43 +0000 (18:49 +0200)

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>

git-gui (Windows): Switch to relative discovery of... Steffen Prohaska Sun, 27 Jul 2008 16:49:42 +0000 (18:49 +0200)

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>

git-gui: Correct installation of library to be $prefix... Steffen Prohaska Sun, 27 Jul 2008 21:23:30 +0000 (14:23 -0700)

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>

git-gui: Fix gitk search in $PATH to work on WindowsShawn O. Pearce Wed, 30 Jul 2008 05:36:58 +0000 (22:36 -0700)

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>

git-gui: Preserve scroll position on reshow_diff.Alexander Gavrilov Sun, 27 Jul 2008 06:35:38 +0000 (10:35 +0400)

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>

git-gui: Fix the Remote menu separator.Alexander Gavrilov Sun, 27 Jul 2008 06:34:21 +0000 (10:34 +0400)

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>

git-gui: "Stage Line": Treat independent changes in... Johannes Sixt Thu, 17 Jul 2008 13:21:51 +0000 (15:21 +0200)

git-gui: "Stage Line": Treat independent changes in adjacent lines better

Assume that we want to commit these states:

Old state == HEAD Intermediate state New state
--------------------------------------------------------
context before context before context before
old 1 new 1 new 1
old 2 old 2 new 2
context after context after context after

that is, want to commit two changes in this order:

1. transform "old 1" into "new 1"
2. transform "old 2" into "new 2"

[This discussion and this patch is about this very case and one other case
as outlined below; any other intermediate states that one could imagine are
not affected by this patch.]

Now assume further, that we have not staged and commited anything, but we
have already changed the working file to the new state. Then we will see
this hunk in the "Unstaged Changes":

@@ -1,4 +1,4 @@
context before
-old 1
-old 2
+new 1
+new 2
context after

The obvious way to stage the intermediate state is to apply "Stage This
Line" to "-old 1" and "+new 1". Unfortunately, this resulted in this
intermediate state:

context before
old 2
new 1
context after

which is not what we wanted. In fact, it was impossible to stage the
intermediate state using "Stage Line". The crux was that if a "+" line was
staged, then the "-" lines were converted to context lines and arranged
*before* the "+" line in the forged hunk that we fed to 'git apply'.

With this patch we now treat "+" lines that are staged differently. In
particular, the "-" lines before the "+" block are moved *after* the
staged "+" line. Now it is possible to get the correct intermediate state
by staging "-old 1" and "+new 1". Problem solved.

But there is a catch.

Noticing that we didn't get the right intermediate state by staging
"-old 1" and "+new 1", we could have had the idea to stage the complete
hunk and to *unstage* "-old 2" and "+new 2". But... the result is the same.
The reason is that there is the exact symmetric problem with unstaging the
last "-" and "+" line that are in adjacent blocks of "-" and "+" lines.

This patch does *not* change the way in which "-" lines are *unstaged*.

Why? Because if we did (i.e. move "+" lines before the "-" line after
converting them to context lines), then it would be impossible to stage
this intermediate state:

context before
old 1
new 2
context after

that is, it would be impossible to stage the two independet changes in the
opposite order.

Let's look at this case a bit further: The obvious way to get this
intermediate state would be to apply "Stage This Line" to "-old 2" and
"+new 2". Before this patch, this worked as expected. With this patch, it
does not work as expected, but it can still be achieved by first staging
the entire hunk, then *unstaging* "-old 1" and "+new 1".

In summary, this patch makes a common case possible, at the expense that
a less common case is made more complicated for the user.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Fix "Stage/Unstage Line" with one line of... Johannes Sixt Tue, 15 Jul 2008 21:11:00 +0000 (23:11 +0200)

git-gui: Fix "Stage/Unstage Line" with one line of context.

To "Stage/Unstage Line" we construct a patch that contains exactly one
change (either addition or removal); the hunk header was forged by counting
the old side and adjusting the count by +/-1 for the new side. But when we
counted the context we never counted the changed line itself. If the hunk
had only one removal line and one line of context, like this:

@@ -1,3 +1,2 @@
context 1
-removal
context 2

We had constructed this patch:

@@ -1,2 +1,1 @@
context 1
-removal
context 2

which does not apply because git apply deduces that it must apply at the
end of the file. ("context 2" is considered garbage and ignored.) The fix
is that removal lines must be counted towards the context of the old side.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Correct 'Visualize Branches' on Mac OS X to... Shawn O. Pearce Fri, 25 Jul 2008 22:08:33 +0000 (15:08 -0700)

git-gui: Correct 'Visualize Branches' on Mac OS X to start gitk

In Git 1.6 and later gitk is in $prefix/bin while git-gui and all
of the other commands are in $gitexecdir, which is typically not
the same as $prefix/bin. So we cannot launch $gitexecdir/gitk and
expect it to actually start gitk properly.

By allowing git-gui to locate the script via $PATH and then using
exactly that path when we source it during the application start
we can correctly run gitk on any Git 1.5 or later.

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

git-gui: Look for gitk in $PATH, not $LIBEXEC/git-coreAbhijit Menon-Sen Thu, 24 Jul 2008 13:28:53 +0000 (18:58 +0530)

git-gui: Look for gitk in $PATH, not $LIBEXEC/git-core

Signed-off-by: Abhijit Menon-Sen <ams@toroid.org>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Add a menu item to invoke full copy detection in blame.Alexander Gavrilov Wed, 16 Jul 2008 20:51:20 +0000 (00:51 +0400)

Add a menu item to invoke full copy detection in blame.

Add a context menu item to invoke blame -C -C -C on a chunk
of the file. The results are used to update the 'original
location' column of the blame display.

The chunk is computed as the smallest line range that covers
both the 'last change' and 'original location' ranges of the
line that was clicked to open the menu.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Kill the blame back-end on window close.Alexander Gavrilov Wed, 16 Jul 2008 20:48:08 +0000 (00:48 +0400)

Kill the blame back-end on window close.

Currently 'git-gui blame' does not kill its back-end
process, hoping that it will die anyway when the pipe
is closed. However, in some cases the process works
for a long time without producing any output. This
behavior results in a runaway CPU hog.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Add options to control the search for copies in blame.Alexander Gavrilov Wed, 16 Jul 2008 20:43:48 +0000 (00:43 +0400)

Add options to control the search for copies in blame.

On huge repositories, -C -C can be way too slow to be
unconditionally enabled, and it can also be useful to control
its precision.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Fix pre-commit hooks under MinGW/MSYSAlexander Gavrilov Wed, 16 Jul 2008 20:12:28 +0000 (00:12 +0400)

Fix pre-commit hooks under MinGW/MSYS

Apply the work-around for checking the executable
permission of hook files not only on Cygwin, but on
Windows in general.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: MERGE_RR lives in .git/ directly with newer... Johannes Schindelin Sat, 12 Jul 2008 14:56:59 +0000 (15:56 +0100)

git-gui: MERGE_RR lives in .git/ directly with newer Git versions

Now that MERGE_RR was moved out of .git/rr-cache/, we have to delete
it somewhere else. Just in case somebody wants to use a newer git-gui
with an older Git, the file .git/rr-cache/MERGE_RR is removed, too (if
it exists).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Exit shortcut in MacOSX repairedSoeren Finster Mon, 7 Jul 2008 16:50:13 +0000 (18:50 +0200)

git-gui: Exit shortcut in MacOSX repaired

Now, as in all OSX apps, there is only one quit menu entry.
It's automatically in the wish menu and calls ::tk::mac::Quit when used.

Signed-off-by: Soeren Finster <sf@9by6.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Implement "Stage/Unstage Line"Johannes Sixt Fri, 27 Jun 2008 07:22:01 +0000 (09:22 +0200)

git-gui: Implement "Stage/Unstage Line"

This adds a context menu entry below "Stage/Unstage Hunk" that stages or
unstages just the line under the mouse pointer.

This is by itself useful, for example, if there are unrelated changes in
the same hunk and the hunk cannot be split by reducing the context.

The feature can also be used to split a hunk by staging a number of
additions (or unstaging a number of removals) until there are enough
context lines that the hunk gets split.

The implementation reads the complete hunk that the line lives in, and
constructs a new hunk by picking existing context lines, removing unneeded
change lines and transforming other change lines to context lines. The
resulting hunk is fed through 'git apply' just like in the "Stage/Unstage
Hunk" case.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Don't select the wrong file if the last listed... Abhijit Menon-Sen Wed, 25 Jun 2008 10:36:50 +0000 (16:06 +0530)

git-gui: Don't select the wrong file if the last listed file is staged.

Johannes Sixt noticed that if the last file in the list was staged, my
earlier patch would display the diff for the penultimate file, but show
the file _before_ that as being selected.

This was due to my misunderstanding the lno argument to show_diff.

This patch fixes the problem: lno is not decremented in the special case
to handle the last item in the list (though we still need to use $lno-1
to find the right path for the next diff).

Signed-off-by: Abhijit Menon-Sen <ams@toroid.org>
Tested-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>