summaryrefslogtreecommitdiff
path: root/lib/commit.tcl
AgeCommit message (Collapse)AuthorFilesLines
2012-09-17git-gui: remove .git/CHERRY_PICK_HEAD after committingLibravatar Beat Bolli1-0/+1
Adding _git_ps1() to one's bash prompt displays various repo status info after each command. After committing a git cherry-pick -n using git-gui, the prompt still contains the "|CHERRY-PICKING" flag. Delete the file causing this flag when cleaning up. Signed-off-by: Beat Bolli <bbolli@ewanet.ch> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2012-09-17git-gui: Fix a loose/lose mistakeLibravatar Beat Bolli1-1/+1
Acked-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Beat Bolli <bbolli@ewanet.ch> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2011-11-05git-gui: don't warn for detached head when rebasingLibravatar Bert Wesarg1-1/+3
Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2011-11-05git-gui: make config gui.warndetachedcommit a booleanLibravatar Bert Wesarg1-1/+1
Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2011-05-20git-gui: warn when trying to commit on a detached headLibravatar Heiko Voigt1-0/+15
The commandline is already warning when checking out a detached head. Since the only thing thats potentially dangerous is to create commits on a detached head lets warn in case the user is about to do that. Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2011-01-28git-gui: learn more type change statesLibravatar Bert Wesarg1-1/+5
Support the following states with type change in git-gui: AT, MT, TD, TM Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2011-01-28git-gui: remove 'no such variable' for s error when encounter unknown file ↵Libravatar Bert Wesarg1-1/+2
states $s will be referenced in the error message. Which was broken since "git-gui: Automatically update-index all included files before commit" (bbe3b3b, 2006-11-16). Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2009-04-05git-gui: When calling post-commit hook wrong variable was cleared.Libravatar Jens Lehmann1-3/+3
Before calling the post-commit hook, the variable "pc_err" is cleared while later only "pch_error" is used. "pch_error$cmt_id" only appeared in "upvar"-Statements (which were changed to "global") and was removed. Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2009-02-01git-gui: Fix post-commit status with subject in non-locale encodingLibravatar Alexander Gavrilov1-10/+19
As pointed out in msysgit bug #181, when a non-locale encoding is used for commits, post-commit status messages display the subject incorrectly. It happens because the file handle is not properly configured before the subject is read back. This patch fixes it by factoring out the code that is used to setup the output handle into a separate function, and calling it from the reading code. Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com> Acked-by: Robin Rosenberg <robin.rosenberg@gmail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-12-08git-gui: Fix commit encoding handling.Libravatar Alexander Gavrilov1-4/+3
Commits without an encoding header are supposed to be encoded in utf8. While this apparently hasn't always been the case, currently it is the active convention, so it is better to follow it; otherwise people who have to use commitEncoding on their machines are unable to read utf-8 commits made by others. I also think that it is preferrable to display the warning about an unsupported value of commitEncoding more prominently, because this condition may lead to surprising behavior and, eventually, to loss of data. Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-09-24git-gui: Add more integration options to citool.Libravatar Alexander Gavrilov1-2/+6
- 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-04git-gui: Support conflict states _U & UT.Libravatar Alexander Gavrilov1-0/+1
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-08-24git-gui: Teach git gui about file type changesLibravatar Gustaf Hendeby1-0/+2
Signed-off-by: Gustaf Hendeby <hendeby@isy.liu.se> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-02-03git-gui: (i18n) Fix a bunch of still untranslated strings.Libravatar Christian Stimming1-8/+8
Signed-off-by: Christian Stimming <stimming@tuhh.de> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-01-20git-gui: Consolidate hook execution code into a single functionLibravatar Shawn O. Pearce1-39/+26
The code we use to test if a hook is executable or not differs on Cygwin from the normal POSIX case. Rather then repeating that for all three hooks we call in our commit code path we can place the common logic into a global procedure and invoke it when necessary. This also lets us get rid of the ugly "|& cat" we were using before as we can now rely on the Tcl 8.4 feature of "2>@1" or fallback to the "|& cat" when necessary. The post-commit hook is now run through the same API, but its outcome does not influence the commit status. As a result we now show any of the errors from the post-commit hook in a dialog window, instead of on the user's tty that was used to launch git-gui. This resolves a long standing bug related to not getting errors out of the post-commit hook when launched under git-gui. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-01-20git-gui: Honor the standard commit-msg hookLibravatar Shawn O. Pearce1-31/+83
Under core Git the git-commit tool will invoke the commit-msg hook if it exists and is executable to the user running git-commit. As a hook it has some limited value as it cannot alter the commit, but it can modify the message the user is attempting to commit. It is also able to examine the message to ensure it conforms to some local standards/conventions. Since the hook takes the name of a temporary file holding the message as its only parameter we need to move the code that creates the temp file up earlier in our commit code path, and then pass through that file name to the latest stage (where we call git-commit-tree). We let the hook alter the file as it sees fit and we don't bother to look at its content again until the commit succeeded and we need the subject for the reflog update. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-12-29git-gui: Make commit log messages end with a newlineLibravatar Bernt Hansen1-1/+1
Concatenating commit log messages from multiple commits works better when all of the commits end with a clean line break. Its good to be strict in what you create, and lenient in what you accept, and since we're creating here, we should always try to Do The Right Thing(tm). Signed-off-by: Bernt Hansen <bernt@alumni.uwaterloo.ca> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-11-22git-gui: fix a typo in lib/commit.tclLibravatar Michele Ballabio1-1/+1
Signed-off-by: Michele Ballabio <barra_cuda@katamail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-20Merge branch 'maint'Libravatar Shawn O. Pearce1-1/+1
* maint: git-gui: Don't display CR within console windows git-gui: Handle progress bars from newer gits git-gui: Correctly report failures from git-write-tree Conflicts: lib/commit.tcl lib/console.tcl
2007-10-20git-gui: Correctly report failures from git-write-treeLibravatar Shawn O. Pearce1-1/+1
If git-write-tree fails (such as if the index file is currently locked and it wants to write to it) we were not getting the error message as $tree_id was always the empty string so we shortcut through the catch and never got the output from stderr. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-09-14git-gui: Paper bag fix missing translated stringsLibravatar Shawn O. Pearce1-6/+6
The Tcl expression "[append [mc Foo] Bar]" does not return the string "FooBar" after translation; instead it is setting the variable Foo to the value Bar, or if Foo is already defined it is appending Bar onto the end of it. This is *not* what we wanted to have happen here. Tcl's join function is actually the correct function but its default joinStr argument is a single space. Unfortunately all of our call sites do not want an extra space added to their string. So we need a small wrapper function to make the call to join with an empty join string. In C this is (roughly) the job of the strcat function. Since strcat is not yet used at the global level it is a reasonable name to use here. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-09-13git-gui: add some strings to translationLibravatar Michele Ballabio1-2/+2
Most of these changes were suggested by Shawn Pearce in an answer to Johannes Schindelin. Some strings for the blame module were added too. [sp: Minor edits in blame module formatting] Signed-off-by: Michele Ballabio <barra_cuda@katamail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-09-02Mark strings for translation.Libravatar Christian Stimming1-26/+26
The procedure [mc ...] will translate the strings through msgcat. Strings must be enclosed in quotes, not in braces, because otherwise xgettext cannot extract them properly, although on the Tcl side both delimiters would work fine. [jes: I merged the later patches to that end.] Signed-off-by: Christian Stimming <stimming@tuhh.de> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2007-07-29git-gui: Unify wording to say "to stage" instead of "to add"Libravatar Christian Stimming1-2/+2
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>
2007-07-23git-gui: Paper bag fix quitting crash after commitLibravatar Shawn O. Pearce1-1/+1
My earlier introduction of the GITGUI_BCK file (which saves the user's commit message buffer while they are typing it) broke the Quit function. If the user makes a commit we delete the GITGUI_BCK file; if they then immediately quit the application we fail to rename the GITGUI_BCK file to GITGUI_MSG. This is because the file does not exist, but our flag still says it does. The root cause is we did not unset the flag during commit. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-21git-gui: Automatically backup the user's commit bufferLibravatar Shawn O. Pearce1-0/+4
A few users have been seeing crashes in Tk when using the undo key binding to undo the last few keystroke events in the commit buffer. Unfortunately that means the user loses their commit message and must start over from scratch when the user restarts the process. git-gui now saves the user's commit message buffer every couple of seconds to a temporary file under .git (specifically .git/GITGUI_BCK). At exit time we rename this file to .git/GITGUI_MSG if there is a message, the file exists, and it is currently synchronized with the Tk buffer. Otherwise we do our usual routine of saving the Tk buffer to .git/GITGUI_MSG and delete .git/GITGUI_BCK, if it exists. During startup we favor .git/GITGUI_BCK over .git/GITGUI_MSG. This way a crash doesn't take out the user's message buffer but instead will cause the user to lose only a few keystrokes. Most people do not type more than 200 WPM, and with 30 possible saves per minute we are unlikely to lose more than 7 words. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-19git-gui: Translate standard encoding names to Tcl onesLibravatar Shawn O. Pearce1-4/+16
This is a essentially a copy of Paul Mackerras encoding support from gitk. I stole the code from gitk commit fd8ccbec4f0161, as Paul has already done all of the hard work setting up this translation table. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-17git-gui: Always disable the Tcl EOF character when readingLibravatar Shawn O. Pearce1-1/+1
On Windows (which includes Cygwin) Tcl defaults to leaving the EOF character of input file streams set to the ASCII EOF character, but if that character were to appear in the data stream then Tcl will close the channel early. So we have to disable eofchar on Windows. Since the default is disabled on all platforms except Windows, we can just disable it everywhere to prevent any sort of read problem. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-12git-gui: Change prior tree SHA-1 verification to use git_readLibravatar Shawn O. Pearce1-1/+1
This cat-file was done on maint, where we did not have git_read available to us. But here on master we do, so we should make use of it. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-12Merge branch 'maint'Libravatar Shawn O. Pearce1-1/+12
* maint: git-gui: Work around bad interaction between Tcl and cmd.exe on ^{tree}
2007-07-12git-gui: Work around bad interaction between Tcl and cmd.exe on ^{tree}Libravatar Shawn O. Pearce1-1/+12
From Johannes Sixt <J.Sixt@eudaptics.com>: > It seems that MSYS's wish does some quoting for Bourne shells, > in particular, escape the first '{' of the "^{tree}" suffix, but > then it uses cmd.exe to run "git rev-parse". However, cmd.exe does > not remove the backslash, so that the resulting rev expression > ends up in git's guts as unrecognizable garbage: rev-parse fails, > and git-gui hickups in a way that it must be restarted. Johannes originally submitted a patch to this section of commit.tcl to use `git rev-parse $PARENT:`, but not all versions of Git will accept that format. So I'm just taking the really simple approach here of scanning the first line of the commit to grab its tree. About the same cost, but works everywhere. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-09git-gui: Always use absolute path to all git executablesLibravatar Shawn O. Pearce1-2/+2
Rather than making the C library search for git every time we want to execute it we now search for the main git wrapper at startup, do symlink resolution, and then always use the absolute path that we found to execute the binary later on. This should save us some cycles, especially on stat challenged systems like Cygwin/Win32. While I was working on this change I also converted all of our existing pipes ([open "| git ..."]) to use two new pipe wrapper functions. These functions take additional options like --nice and --stderr which instructs Tcl to take special action, like running the underlying git program through `nice` (if available) or redirect stderr to stdout for capture in Tcl. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-08git-gui: Refactor branch switch to support detached headLibravatar Shawn O. Pearce1-8/+0
This is a major rewrite of the way we perform switching between branches and the subsequent update of the working directory. Like core Git we now use a single code path to perform all changes: our new checkout_op class. We also use it for branch creation/update as it integrates the tracking branch fetch process along with a very basic merge (fast-forward and reset only currently). Because some users have literally hundreds of local branches we use the standard revision picker (with its branch filtering tool) to select the local branch, rather than keeping all of the local branches in the Branch menu. The branch menu listing out all of the available branches is simply not sane for those types of huge repositories. Users can now checkout a detached head by ticking off the option in the checkout dialog. This option is off by default for the obvious reason, but it can be easily enabled for any local branch by simply checking it. We also detach the head if any non local branch was selected, or if a revision expression was entered. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-08git-gui: Refactor our ui_status_value update techniqueLibravatar Shawn O. Pearce1-18/+15
I'm really starting to dislike global variables. The ui_status_value global varible is just one of those that seems to appear in a lot of code and in many cases we didn't even declare it "global" within the proc that updates it so we haven't always been getting all of the updates we expected to see. This change introduces two new global procs: ui_status $msg; # Sets the status bar to show $msg. ui_ready; # Changes the status bar to show "Ready." The second (special) form is used because we often update the area with this message once we are done processing a block of work and want the user to know we have completed it. I'm not fixing the cases that appear in lib/branch.tcl right now as I'm actually in the middle of a huge refactoring of that code to support making a detached HEAD checkout. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-08git-gui: Honor rerere.enabled configuration optionLibravatar Shawn O. Pearce1-1/+6
Recently in git.git change b4372ef136 Johannes Schindelin taught git-commit.sh to invoke (or skip) calling git-rerere based upon the rerere.enabled configuration setting: So, check the config variable "rerere.enabled". If it is set to "false" explicitely, do not activate rerere, even if .git/rr-cache exists. This should help when you want to disable rerere temporarily. If "rerere.enabled" is not set at all, fall back to detection of the directory .git/rr-cache. We now do the same logic in git-gui's own commit implementation. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-05-07git-gui: Refactor into multiple files to save my sanityLibravatar Shawn O. Pearce1-0/+410
I'm finding it difficult to work with a 6,000+ line Tcl script and not go insane while looking for a particular block of code. Since most of the program is organized into different units of functionality and not all users will need all units immediately on startup we can improve things by splitting procs out into multiple files and let auto_load handle things for us. This should help not only to better organize the source, but it may also improve startup times for some users as the Tcl parser does not need to read as much script before it can show the UI. In many cases the user can avoid reading at least half of git-gui now. Unfortunately we now need a library directory in our runtime location. This is currently assumed to be $(sharedir)/git-gui/lib and its expected that the Makefile invoker will setup some sort of reasonable sharedir value for us, or let us assume its going to be $(gitexecdir)/../share. We now also require a tclsh (in TCL_PATH) to just run the Makefile, as we use tclsh to generate the tclIndex for our lib directory. I'm hoping this is not an unncessary burden on end-users who are building from source. I haven't really made any functionality changes here, this is just a huge migration of code from one file to many smaller files. All of the new changes are to setup the library path and install the library files. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>