Skip to content
Commits on Sep 17, 2007
  1. @spearce

    git-gui: Disable native platform text selection in "lists"

    spearce committed
    Sometimes we use a Tk text widget as though it were a listbox.
    This happens typically when we want to show an icon to the left
    of the text label or just when a text widget is generally a better
    choice then the native listbox widget.
    
    In these cases if we want the user to have control over the selection
    we implement our own "in_sel" tag that shows the selected region
    and we perform our own selection management in the background
    via keybindings and mouse bindings.  In such uses we don't want
    the user to be able to activate the native platform selection by
    dragging their mouse through the text widget.  Doing so creates a
    very confusing display and the user is left wondering what it may
    mean to have two different types of selection in the same widget.
    
    Tk doesn't allow us to delete the "sel" tag that it uses internally
    to manage the native selection but it will allow us to make it
    invisible by setting the tag to have the same display properties
    as unselected text.  So long as we don't actually use the "sel"
    tag for anything in code its effectively invisible.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Commits on Sep 14, 2007
  1. @spearce

    git-gui: Paper bag fix "Commit->Revert" format arguments

    spearce committed
    The recent bug fix to correctly handle filenames with %s (or any
    other valid Tcl format specifier) missed a \ on this line and
    caused the remaining format arguments to not be supplied when we
    updated the status bar.  This caused a Tcl error anytime the user
    was trying to perform a file revert.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  2. @spearce

    git-gui: Provide 'uninstall' Makefile target to undo an installation

    spearce committed
    Several users have requested a "make uninstall" target be provided
    in the stock git-gui Makefile so that they can undo an install
    if git-gui goes to the wrong place during the initial install,
    or if they are unhappy with the tool and want to remove it from
    their system.
    
    We currently assume that the complete set of files we need to delete
    are those defined by our Makefile and current source directory.
    This could differ from what the user actually has installed if they
    installed one version then attempt to use another to perform the
    uninstall.  Right now I'm just going to say that is "pilot error".
    Users should uninstall git-gui using the same version of source
    that they used to make the installation.  Perhaps in the future we
    could read tclIndex and base our uninstall decisions on its contents.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Commits on Sep 13, 2007
  1. @spearce

    git-gui: Font chooser to handle a large number of font families

    spearce committed
    Simon Sasburg noticed that on X11 if there are more fonts than can
    fit in the height of the screen Tk's native tk_optionMenu does not
    offer scroll arrows to the user and it is not possible to review
    all choices or to select those that are off-screen.  On Mac OS X
    the tk_optionMenu works properly but is awkward to navigate if the
    list is long.
    
    This is a rewrite of our font selection by providing a new modal
    dialog that the user can launch from the git-gui Options panel.
    The dialog offers the user a scrolling list of fonts in a pane.
    An example text shows the user what the font looks like at the size
    they have selected.  But I have to admit the example pane is less
    than ideal.  For example in the case of our diff font we really
    should show the user an example diff complete with our native diff
    syntax coloring.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
    Acked-by: Simon Sasburg <simon.sasburg@gmail.com>
  2. @spearce

    git-gui: Make backporting changes from i18n version easier

    spearce committed
    This is a very trivial hack to define a global mc procedure that
    does not actually perform i18n translations on its input strings.
    By declaring an mc procedure here in our maint version of git-gui
    we can take patches that are intended for the latest development
    version of git-gui and easily backport them without needing to
    tweak the mc calls first.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Commits on Sep 11, 2007
  1. @spearce

    git-gui: Don't delete send on Windows as it doesn't exist

    spearce committed
    The Windows port of Tk does not have the send command so we
    cannot delete it from our global namespace, but the Mac OS
    X and X11 ports do have it.  Switching this delete attempt
    into a catch makes send go away, or stay away.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Commits on Sep 10, 2007
  1. @spearce

    git-gui: Trim trailing slashes from untracked submodule names

    spearce committed
    Oddly enough `git ls-files --others` supplies us the name of an
    untracked submodule by including the trailing slash but that
    same git version will not accept the name with a trailing slash
    through `git update-index --stdin`.  Stripping off that final
    slash character before loading it into our file lists allows
    git-gui to stage changes to submodules just like any other file.
    
    This change should give git-gui users some basic submodule support,
    but it is strictly at the plumbing level as we do not actually know
    about calling the git-submodule porcelain that is a recent addition
    to git 1.5.3.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  2. @spearce

    git-gui: Assume untracked directories are Git submodules

    spearce committed
    If `git ls-files --others` returned us the name of a directory then
    it is because Git has decided that this directory itself contains a
    valid Git repository and its files shouldn't be listed as untracked
    for this repository.
    
    In such a case we should label the object as a Git repository and
    not just as a directory.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Commits on Sep 9, 2007
  1. @chunga @spearce

    git-gui: handle "deleted symlink" diff marker

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

    git-gui: show unstaged symlinks in diff viewer

    chunga committed with spearce
    git-gui has a minor problem with regards to symlinks that point
    to directories.
    
    	git init
    	mkdir realdir
    	ln -s realdir linkdir
    	git gui
    
    Now clicking on file names in the "unstaged changes" window,
    there's a problem coming from the "linkdir" symlink: git-gui
    complains with
    
    	error reading "file4": illegal operation on a directory
    
    ...even though git-gui can add that same symlink to the index just
    fine.
    
    This patch fix this by adding a check.
    
    [sp: Minor fix to use {link} instead of "link" in condition
         and to only open the path if it is not a symlink.]
    
    Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  3. @spearce

    git-gui: Avoid use of libdir in Makefile

    spearce committed
    Dmitry V. Levin pointed out that on GNU linux libdir is often used
    in Makefiles to mean "/usr/lib" or "/usr/lib64", a directory that
    is meant to hold platform-specific binary files.  Using a different
    libdir meaning here in git-gui's Makefile breaks idomatic expressions
    like rpm specifile "make libdir=%_libdir".
    
    Originally I asked that the git.git Makefile undefine libdir before
    it calls git-gui's own Makefile but it turns out this is very hard
    to do, if not impossible.  Renaming our libdir to gg_libdir resolves
    this case with a minimum amount of fuss on our part.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  4. @spearce

    git-gui: Disable Tk send in all git-gui sessions

    spearce committed
    The Tk designers blessed us with the "send" command, which on X11
    will allow anyone who can connect to your X server to evaluate any
    Tcl code they desire within any running Tk process.  This is just
    plain nuts.  If git-gui wants someone running Tcl code within it
    then would ask someone to supply that Tcl code to it; waiting for
    someone to drop any random Tcl code into us is not fantastic idea.
    
    By renaming send to the empty name the procedure will be removed
    from the global namespace and Tk will stop responding to random Tcl
    evaluation requests sent through the X server.  Since there is no
    facility to filter these requests it is unlikely that we will ever
    consider enabling this command.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  5. @spearce

    git-gui: lib/index.tcl: handle files with % in the filename properly

    Gerrit Pape committed with spearce
    Steps to reproduce the bug:
    
     $ mkdir repo && cd repo && git init
     Initialized empty Git repository in .git/
     $ touch 'foo%3Fsuite'
     $ git-gui
    
    Then click on the 'foo%3Fsuite' icon to include it in a changeset, a
    popup comes with:
    'Error: bad field specifier "F"'
    
    Vincent Danjean noticed the problem and also suggested the fix, reported
    through
     http://bugs.debian.org/441167
    
    Signed-off-by: Gerrit Pape <pape@smarden.org>
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Commits on Sep 4, 2007
  1. @spearce

    git-gui: Properly set the state of "Stage/Unstage Hunk" action

    spearce committed
    Today I found yet another way for the "Stage Hunk" and "Unstage
    Hunk" context menu actions to leave the wrong state enabled in
    the UI.  The problem this time was that I connected the state
    determination to the value of $::current_diff_side (the side the
    diff is from).  When the user was last looking at a diff from the
    index side and unstages everything the diff panel goes empty, but
    the action stayed enabled as we always assumed unstaging was a
    valid action.
    
    This change moves the logic for determining when the action is
    enabled away from the individual side selection, as they really
    are two unrelated concepts.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  2. @spearce

    git-gui: Fix detaching current branch during checkout

    spearce committed
    If the user tried to detach their HEAD while keeping the working
    directory on the same commit we actually did not completely do
    a detach operation internally.  The problem was caused by git-gui
    not forcing the HEAD symbolic ref to be updated to a SHA-1 hash
    when we were not switching revisions.  Now we update the HEAD ref
    if we aren't currently detached or the hashes don't match.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  3. @spearce

    git-gui: Correct starting of git-remote to handle -w option

    spearce committed
    Current versions of git-remote apparently are passing the -w option
    to Perl as part of the shbang line:
    
      #!/usr/bin/perl -w
    
    this caused a problem in git-gui and gave the user a Tcl error with
    the message: "git-remote not supported: #!/usr/bin/perl -w".
    
    The fix for this is to treat the shbang line as a Tcl list and look
    at the first element only for guessing the executable name.  Once
    we know the executable name we use the remaining elements (if any
    exist) as arguments to the executable, before the script filename.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Commits on Aug 25, 2007
  1. @spearce

    git-gui: Correct 'git gui blame' in a subdirectory

    spearce committed
    David Kastrup pointed out that the following sequence was not
    working as we had intended:
    
      $ cd lib
      $ git gui blame console.tcl
      fatal: cannot stat path lib/console.tcl: No such file or directory
    
    The problem here was we disabled the chdir to the root of the
    working tree when we are running with a "bare allowed" feature
    such as blame or browser, but we still kept the prefix we found via
    `git rev-parse --show-prefix`.  This caused us to try and look for
    the file "console.tcl" within the subdirectory but also include
    the subdirectory's own path from the root of the working tree.
    This is unlikely to succeed, unless the user just happened to have
    a "lib/lib/console.tcl" file in the repository, in which case we
    would produce the wrong result.
    
    In the case of a bare repository we shouldn't get back a value from
    `rev-parse --show-prefix`, so really $_prefix should only be set
    to the non-empty string if we are in a working tree and we are in a
    subdirectory of that working tree.  If this is true we really want
    to always be at the top level of the working tree, as all paths are
    accessed as though they were relative to the top of the working tree.
    Converting $_prefix to a ../ sequence is a fairly simple approach
    to moving up the requisite levels.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Commits on Aug 23, 2007
  1. @spearce

    git-gui: Do not offer to stage three-way diff hunks into the index

    spearce committed
    git-apply does not accept a patch that was generated as a three-way
    combined diff format such as we see during merge conflicts.  If we
    get such a diff in our diff viewer and try to send it to git-apply
    it just errors out and the user is left confused wondering why they
    cannot stage that hunk.
    
    Instead of feeding a known to be unacceptable hunk to git-apply we
    now just disable the stage/unstage context menu option if the hunk
    came from a three way diff.  The user may still be confused about
    why they cannot work with a combined diff, but at least they are
    only confused as to why git-gui is not offering them the action.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  2. @spearce

    git-gui: Refactor diff pane popup support for future improvements

    spearce committed
    The current popup_diff_menu procedure is somewhat messy as it has a
    few duplications of the same logic in each of the different legs of
    the routine.  We can simplify these by setting a few state variables
    in the different legs.
    
    No functional change, just a cleanup to make it easier to implement
    future functional changes within this block.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Commits on Aug 22, 2007
  1. @spearce

    git-gui: Fix "unoptimized loading" to not cause git-gui to crash

    spearce committed
    If the tclsh command was not available to us at the time we were
    "built" our lib/tclIndex just lists all of our library files and
    we source all of them at once during startup, rather than trying
    to lazily load only the procedures we need.  This is a problem as
    some of our library code now depends upon the git-version proc,
    and that proc is not defined until after the library was fully
    loaded.
    
    I'm moving the library loading until after we have determined the
    version of git we are talking to, as this ensures that the required
    git-reversion procedure is defined before any library code can be
    loaded.  Since error_popup is defined in the library we instead use
    tk_messageBox directly for errors found during the version detection.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Commits on Aug 21, 2007
  1. @spearce

    git-gui: Paper bag fix "Stage Hunk For Commit" in diff context menu

    spearce committed
    In a13ee29 I totally broke the
    "Stage Hunk For Commit" feature by making this menu item always
    appear in a disabled state, so it was never invokable.  A "teaser
    feature", just sitting there taunting the poor user who has become
    used to having it available.
    
    The issue caused by a13ee was I added a test to look at the data
    in $file_states, but I didn't do that test correctly as it was
    always looking at a procedure local $file_states array, which is
    not defined, so the test was always true and we always disabled
    the menu entry.
    
    Instead we only want to disable the menu entry if the current file
    we are looking at has no file state information (git-gui is just a
    very confused little process) or it is an untracked file (and we
    cannot stage individual hunks).
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Commits on Aug 20, 2007
  1. @spearce

    git-gui: Allow git-merge to use branch names in conflict markers

    spearce committed
    Earlier when I rewrote the merge implementation for git-gui I broke
    it such that the conflict markers for the "theirs" side of the hunk
    was using a full SHA-1 ID in hex, rather than the name of the branch
    the user had merged.  This was because I got paranoid and passed off
    the full SHA-1 to git-merge, instead of giving it the reference name
    the user saw in the merge dialog.
    
    I'd still like to resolve the SHA-1 upfront in git-gui and always use
    that value throughout the merge, but I can't do that until we have a
    full implementation of git-merge written in Tcl.  Until then its more
    important that the conflict markers be useful to the end-user, so we
    need to pass off the ref name and not the SHA-1 ID.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  2. @spearce

    git-gui: Fix window manager problems on ion3

    spearce committed
    cehteh on #git noticed that secondary windows such as console
    windows from push/fetch/merge or the blame browser failed on ion
    when we tried to open them a second time.
    
    The issue turned out to be the fact that on ion [winfo ismapped .]
    returns false if . is not visible right now because it has been
    obscured by another window in the same panel.  So we need to keep
    track of whether or not the root window has been displayed for this
    application, and once it has been we cannot ever assume that ismapped
    is going to return true.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Commits on Aug 4, 2007
  1. @spearce

    git-gui: Added support for OS X right click

    Väinö Järvelä committed with spearce
    OS X sends Button-2 on a "real" right click, such as with a three
    button mouse, or by using the two-finger trackpad click.
    
    Signed-off-by: Väinö Järvelä <v@pp.inet.fi>
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Commits on Aug 3, 2007
  1. @spearce

    git-gui: Avoid Tcl error in popup menu on diff viewer

    spearce committed
    If there is no path currently shown in the diff viewer then we
    were getting Tcl errors anytime the user right-clicked on the
    diff viewer to bring up its popup menu.  The bug here is caused
    by trying to get the file_state for the empty string; this path
    is never seen so we never have file_state for it.  In such cases
    we now disable the Stage Hunk For Commit option.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Commits on Jul 30, 2007
  1. @spearce

    git-gui: Minor refactoring of merge command line in merge support

    spearce committed
    This is just a small code movement to cleanup how we generate
    the command line for a merge.  I'm only doing it to make the
    next series of changes slightly more readable.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  2. @spearce

    git-gui: Use more modern looking icons in the tree browser

    spearce committed
    This is a replacement of all of the icons in our tree browser
    window, as the prior icons just looked too 1980s Tk-ish.  The
    icons used here are actually from a KDE themed look, so they
    might actually be familiar to some users of git-gui.
    
    Aside from using more modern looking icons we now have a special
    icon for executable blobs, to make them stand out from the normal
    non-executable blobs.  We also denote symlinks now with a different
    icon, so they stand out from the other types of objects in the tree.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  3. @spearce

    git-gui: Don't offer to stage hunks from untracked files

    spearce committed
    If the user looks at an untracked file in our diff pane we used
    to offer "Stage Hunk For Commit" in the context menu when they
    right-clicked in that pane.  The problem is we don't actually
    have any diff hunks in untracked files, so there is nothing to
    really select for staging.  So we now grey out the menu item,
    so the user cannot invoke it and think its broken when it does
    not perform any useful action.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  4. @spearce

    git-gui: Make sure remotes are loaded when picking revisions

    spearce committed
    If we are started for only a blame/browser/citool run we don't
    usually initialize the list of remotes, or determine which refs
    are tracking branches and which are local branch heads.  This is
    because some of that work is relatively expensive and is usually
    not going to be needed if we are started only for a blame, or to
    make a single commit.
    
    However by not loading the remote configuration we were crashing
    if the user tried to open a browser for another branch through
    the Repository menu, as our load_all_heads procedure was unable
    to decide which refs/heads/ items were actually local heads.  We
    now force all remote configuration data to be loaded if we have
    not done so already and we are trying to create a revision mega
    widget.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Commits on Jul 29, 2007
  1. @spearce

    git-gui: Use progress bar while resetting/aborting files

    spearce committed
    Resetting a large number of files on a slow filesystem can take
    considerable time, just as switching branches in such a case can
    take more than two seconds.  We now take advantage of the progress
    meter output by read-tree and show it in the main window status
    bar, just like we do during checkout (branch switch).
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  2. @spearce

    git-gui: Honor core.excludesfile when listing extra files

    spearce committed
    Recent git versions have a git-status that honors the core.excludesfile
    configuration option when it reports on untracked files.  Unfortunately
    I missed the introduction of this configuration option in the core
    porcelain implementation, so it was not reflected here in git-gui.
    
    Found and reported by Lars Noschinski <lars@public.noschinski.de>.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  3. @cstim @spearce

    git-gui: Unify wording to say "to stage" instead of "to add"

    cstim committed with spearce
    Also, the warning message when clicking "Reset" is adapted to
    the wording "Reset" rather than a confusion "Cancel commit?".
    
    Signed-off-by: Christian Stimming <stimming@tuhh.de>
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Commits on Jul 27, 2007
  1. @spearce

    git-gui: Don't kill modified commit message buffer with merge templates

    spearce committed
    If the user is in the middle of a merge and has already started to
    modify their commit message we were losing the user's changes when
    they pressed 'Rescan' after resolving issues or making changes in
    the working directory.
    
    The problem here was our background timer that saves the commit
    message buffer.  It marks the commit message buffer as not being
    modified when it writes it out to disk, so during the rescan we
    assumed the buffer should be replaced with what we read from the
    MERGE_MSG file.  So we now only read these files from .git if we
    have a valid backup file.  Since we clear it on commit this will
    only have an impact while the user is actively editing the current
    commit.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Commits on Jul 25, 2007
  1. @spearce

    git-gui: Remove usernames from absolute SSH urls during merging

    spearce committed
    If we are being asked to merge a tracking branch that comes from a
    remote repository accessed by the very common SSH URL format of
    "user@host:/path/to/repo" then we really don't need the username
    as part of the merge message, it only clutters up the history and
    makes things more confusing.  So we instead clip the username part
    off if the local filesystem path is absolute, as its probably not
    going to be an ambiguous URL even when it is missing the username.
    
    On the other hand we cannot clip the username off if the URL is
    not absolute, because in such cases (e.g. "user@host:myrepo") the
    directory that the repository path is resolved in is relative to
    the user's home directory, and the username becomes important.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  2. @spearce

    git-gui: Format tracking branch merges as though they were pulls

    spearce committed
    If we are merging a tracking branch we know exactly what remote URL
    that branch is fetched from, and what its name is on that remote
    repository.  In this case we can setup a merge message that looks
    just like a standard `git-pull $remote $branch` operation by filling
    out FETCH_HEAD before we start git-merge, and then run git-merge just
    like git-pull does.
    
    I think the result of this behavior is that merges look a lot nicer
    when the came off of local tracking branches, because they no longer
    say "commit 'origin/...'" to describe the commit being merged but
    instead now mention the specific repository we fetched those commits
    from.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Something went wrong with that request. Please try again.