* Re: Newbie problem
From: Insitu @ 2007-07-28 8:50 UTC (permalink / raw)
To: git
In-Reply-To: <7vmyxht0r6.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <gitster@pobox.com> writes:
>
> [remote "origin"]
> url = satellite:.git/
> fetch = +refs/heads/*:refs/remotes/origin/*
> push = refs/heads/*:refs/remotes/origin/*
> [branch "master"]
> remote = origin
> merge = refs/heads/master
>
> On satellite laptop, in .git/config:
>
> [remote "origin"]
> url = mothership:.git/
> fetch = +refs/heads/*:refs/remotes/origin/*
> push = refs/heads/*:refs/remotes/origin/*
> [branch "master"]
> remote = origin
> merge = refs/heads/master
>
Thanks a lot for all these details !
Yes, I also find Git very well
documented (maybe too much docuemented :) ) and could have come to
the settings with info from the various man pages. But much less
quickly of course.
My question is: can I do this right now that my repositories are up
and running ?
Regards,
--
OQube < software engineering \ génie logiciel >
Arnaud Bailly, Dr.
\web> http://www.oqube.com
^ permalink raw reply
* Re: What's in git.git (stable)
From: David Kastrup @ 2007-07-28 8:56 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vvec4synj.fsf_-_@assigned-by-dhcp.cox.net>
Junio C Hamano <gitster@pobox.com> writes:
> It's been a while since I sent this the last time.
>
> We are nearing 1.5.3 final; I pulled gitk updates tonight, and
> expect git-gui updates to 0.8.0 over the weekend. There are a
> handful trivial fixes since 1.5.3-rc3.
I'd like to see some changes for mergetool's Emacs support: in
moderately current versions of Emacs and XEmacs, ediff is a much
preferable tool to emerge.
Also, the mergetool determines when to use emerge for merging by
looking at the EDITOR/VISUAL variables. While it recognizes the
presence of "emacsclient" and "gnuclient" there for offering the
emerge tool, it does not actually use those settings for calling
Emacs/XEmacs. If you use the desktop package, this means that you get
a bear of a startup time while a _new_ instance of Emacs gets loaded
against the wishes of the setup, and the command line parameters will
be interpreted relatively to the last file restored into the desktop
rather than the current directory (arguably a bug in the desktop
package which I plan to fix eventually, but in the meantime the
current package is farspread).
I'll try to come up with a fix this weekend if nobody beats me to it.
As it stands, the mergetool is somewhere between subpar and unusable
by default for a considerable number of Emacs users.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
^ permalink raw reply
* Re: suggestion for git rebase -i
From: Jeff King @ 2007-07-28 8:58 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Seth Falcon, git
In-Reply-To: <20070728084550.GA13993@sigill.intra.peff.net>
On Sat, Jul 28, 2007 at 04:45:51AM -0400, Jeff King wrote:
> > > a file in a pre-existing editor session. I realize this is a small
> > > nit, but how about renaming the file to "git-rebase-todo"?
> >
> > Why? This is an implementation detail, and should not concern the user.
>
> Because if you want to setup macros or syntax highlighting specific to
> editing git-rebase tempfiles, then you have to figure out somehow that
> you are editing one. Using a more informative name for the tempfile
> means that you can guess based on the filename.
Re-reading his original message, I actually don't think this is what he
wanted it for. But I think it's reasonable to give the tempfile a
meaningful name anyway for this reason.
-Peff
^ permalink raw reply
* Re: [PATCH 3/8] Clean up work-tree handling
From: Johannes Schindelin @ 2007-07-28 9:01 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, matled
In-Reply-To: <7vlkd1umwf.fsf@assigned-by-dhcp.cox.net>
Hi,
On Fri, 27 Jul 2007, Junio C Hamano wrote:
> Now, I think it is fair to say that if your worktree is somewhere
> totally unrelated to your cwd, no amount of going up will take you to
> the top. IOW, you have to come down after going up some levels. In
> such a case, it is easier to code the implementation of --show-cdup to
> give an absolute path.
>
> But in that case you are not even in the working tree to begin
> with, aren't you? Does git need to support that?
I'd say yes.
It is utterly _inconvenient_ to have to cd to the working tree when you
just want to check the status, for example. And git already knows about
the work-tree!
But you got me convinced about the relative path: it is true that nobody
who has not set core.worktree should be affected.
So I will do something like
if (!inside_work_tree()) {
puts(get_git_work_tree());
continue;
}
[do the old thing of outputting ../../[...]]
In fact, I had this in an unpublished version of the patch, and decided
that I could remove more lines without breaking the test suite.
Heck, I'll even add a test case to make sure that behavior is maintained.
Okay?
Ciao,
Dscho
P.S.: I'll be offline for a few hours, but then come back to finish it up.
^ permalink raw reply
* Re: What's in git.git (stable)
From: Junio C Hamano @ 2007-07-28 9:02 UTC (permalink / raw)
To: David Kastrup; +Cc: git, Theodore Ts'o
In-Reply-To: <85zm1g3nze.fsf@lola.goethe.zz>
David Kastrup <dak@gnu.org> writes:
> I'd like to see some changes for mergetool's Emacs support: in
> moderately current versions of Emacs and XEmacs, ediff is a much
> preferable tool to emerge.
Between ediff and emerge, I think Ted gave a well thought out
analysis on the list earlier, so you might want to consider the
issues he raised if/when you tackle this.
This is late in the game, however, so your change probably won't
be merged before I can tag 1.5.3 final, but I'd expect that a
better Emacs support will be widely welcomed.
^ permalink raw reply
* Re: [PATCH 0/2] git-stash last-minute fixes
From: しらいしななこ @ 2007-07-28 9:06 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Johannes Schindelin, git
In-Reply-To: <7vbqdxui72.fsf@assigned-by-dhcp.cox.net>
Quoting Junio C Hamano <gitster@pobox.com> writes:
> Here are a small patch series to git-stash.
>
> [1/2] Fix git-stash apply --index
>
> This fixes two rather embarrasing bugs in "apply --index".
>
> [2/2] git-stash apply --index: optimize postprocessing
>
> This builds on top of the previous one to avoid unnecessary
> index manipulations that is later wiped by a read-tree.
Thank you for the patch. I have not used the --index things
myself and did not notice these breakages.
--
Nanako Shiraishi
http://ivory.ap.teacup.com/nanako3/
----------------------------------------------------------------------
Get a free email address with REAL anti-spam protection.
http://www.bluebottle.com/tag/1
^ permalink raw reply
* Re: [PATCH] git-mergetool: add support for ediff
From: David Kastrup @ 2007-07-28 9:22 UTC (permalink / raw)
To: git
In-Reply-To: <20070703010955.GA5322@thunk.org>
[Picking up an old thread]
Theodore Tso <tytso@mit.edu> writes:
> On Tue, Jul 03, 2007 at 11:19:49AM +1200, Sam Vilain wrote:
>
> Hmm, well, here's a way of fixing it. (See attached, below.) It
> adds a new command 'x', which when you hit it in the ediff control
> window, exits with a error status of '1', indicating that the merge
> has failed. This is something which emerge, kdiff3, tkdiff, et. al
> all support; but which ediff doesn't.
>
>> I still don't really understand why having to save the merged buffer and
>> exit is such a huge issue. Already I have to select "-t emerge" to get
>> emerge. I would have thought it would be better to just make the other
>> mode available, and let the user figure it out.
>
> I'm just exploring alternatives. Basically, it just seems
> interesting that ediff has a lot of nice features, but also has some
> incredibly user-hostile features. The first time I tried using
> ediff, I indeed tried saving the buffer and exiting it. That's when
> I discovered that after I changed the focus to the merge window and
> saved it, when I tried typing ^X^C, the exit failed with the error
> message "Attempt to delete a surrogate minibuffer frame". That's
> the sort of thing that will cause non-elisp programmers to run
> screaming off into the distance.
Ted, I think you are somewhat missing the main audience here. The
main audience are people who actually _use_ Emacs, and those will be
comfortable with the concept "save to have changes persist, don't save
if you don't want changes to persist, exit using C-x # or C-x C-c as
appropriate". Basically, it would appear that you try figuring out
how to make ediff appeal to non-Emacs users. But those would not have
emacs/emacsclient in their EDITOR variable in the first place.
I have been bitten by mergetool calling emacs rather than emacsclient,
resulting in a non-working merge (since the default directory was set
differently from what the call expected due to my use of the desktop
package), and mergetool afterwards assuming that the not-even-started
merge was successful. A royal nuisance, and completely unworkable.
While it may be nice to have some Lisp preparation for people who
don't want to touch or learn Emacs _except_ for using it for merging
in git, I think we should first cater to people actually using Emacs
already.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
^ permalink raw reply
* Re: What's in git.git (stable)
From: David Kastrup @ 2007-07-28 9:35 UTC (permalink / raw)
To: git
In-Reply-To: <85zm1g3nze.fsf@lola.goethe.zz>
David Kastrup <dak@gnu.org> writes:
[...]
> If you use the desktop package, this means that you get a bear of a
> startup time while a _new_ instance of Emacs gets loaded against the
> wishes of the setup, and the command line parameters will be
> interpreted relatively to the last file restored into the desktop
> rather than the current directory (arguably a bug in the desktop
> package which I plan to fix eventually, but in the meantime the
> current package is farspread).
I can't reproduce anything similar outside of mergetool, so it appears
more likely that mergetool is passing wrong relative file names.
Have to leave now for the day.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
^ permalink raw reply
* git-svn rebase screwing up commit messages
From: Benoit SIGOURE @ 2007-07-28 10:07 UTC (permalink / raw)
To: git
[-- Attachment #1: Type: text/plain, Size: 418 bytes --]
Hello,
git version 1.5.2.3 over here, I've googled and searched in the ML
archives but did not find this: when I git-svn rebase, my commits in
Git (that are temporarily removed and then re-applied) get their
commit message flattened on a single line (needless to say this is
utterly annoying :D).
Is this a bug or something?
Thanks.
--
Benoit Sigoure aka Tsuna
EPITA Research and Development Laboratory
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 186 bytes --]
^ permalink raw reply
* Re: Gitweb and submodules
From: Jakub Narebski @ 2007-07-28 10:29 UTC (permalink / raw)
To: Sven Verdoolaege; +Cc: git
In-Reply-To: <20070727123229.GB31114MdfPADPa@greensroom.kotnet.org>
On Fri, 27 July 2007, Sven Verdoolaege wrote
> On Fri, Jul 27, 2007 at 01:22:49PM +0200, Jakub Narebski wrote:
> > But for that I need a question answered: how to find GIT_DIR of
> > repository which contains submodule objects? We have to assume in
> > gitweb that repositories are bare...
>
> You'll have to add a configuration variable for that.
> The submodule may not even be on the same server.
What do you think about using "submodule.$name.gitdir" configuration
variable for that? It has to be configuration variable because the
location of repository which has submodule objects doesn't change when
checking out (or rewinding) to different commit in supermodule.
As a special case I'd use 'no value' to note that submodule objects are
contained in the supermodule repository.
--
Jakub Narebski
Poland
^ permalink raw reply
* Re: [PATCH 1/2] gitk: Import msgcat for translation support
From: Christian Stimming @ 2007-07-28 10:40 UTC (permalink / raw)
To: Brett Schwarz; +Cc: Paul Mackerras, git
In-Reply-To: <157938.79347.qm@web38908.mail.mud.yahoo.com>
Am Samstag, 28. Juli 2007 09:28 schrieb Brett Schwarz:
> > > Import tcl's msgcat package to have the [mc...] procedure for
> > > translation available.
> >
> > if {[catch {
> > package require msgcat
> > # rest of your new stuff
> > }]} {
> > proc mc {str} {
> > return $str
> > }
> > }
> >
> > so that everything still works if msgcat isn't available.
>
> Junio already replied to this, and he was correct.
The conclusion is that tcl8.1 is old enough so that you can safely assume
msgcat exists? Or rather: Gitk probably requires tcl8.1 anyway (is there a
known required tcl version for gitk?), and hence this can be relied upon here
as well.
> However, this made me
> think of something (that probably should be in git-gui as well) to make it
> a little more robust. We should check that the msg directory is where we
> think it is, and either give a warning, or exit the app (I would vote for
> the former).
>From what I've seen during testing, if the directory passed to msgload doesn't
exists, the function simply does nothing. Its documentation doesn't say what
is going to happen on a non-existing directory, though:
http://www.tcl.tk/man/tcl8.4/TclCmd/msgcat.htm#M10
> set msgdir [file join . msgs] ;# or whatever this turns out to be
> if {[file exists $msgdir]} {
> ::msgcat::mcload $msgdir
> } else {
> puts stderr "WTF: can't find message catalog directory"
> }
>
> Or you could just use [catch] around the ::msgcat::mcload too.
I don't think [catch] changes anything, as the function rather seems to be
no-op on nonexisting directory. So I think this wouldn't
improve "robustness". I think this would only help in order to point out to
the user that no translation has been found; however, it can't be known at
this point whether this happens only because no translation exists, or
whether there was some error in the installation. Probably only the latter is
actually interesting to the user.
Well, in conclusion I think the msgcat function is already robust enough and
neither [catch] nor the directory checking buys us anything here.
Christian
^ permalink raw reply
* Re: Gitweb and submodules
From: Sven Verdoolaege @ 2007-07-28 10:40 UTC (permalink / raw)
To: Jakub Narebski; +Cc: git
In-Reply-To: <200707281229.17351.jnareb@gmail.com>
On Sat, Jul 28, 2007 at 12:29:16PM +0200, Jakub Narebski wrote:
> What do you think about using "submodule.$name.gitdir" configuration
> variable for that?
What will be the value? A path relative to the gitdir of the superproject?
> It has to be configuration variable because the
> location of repository which has submodule objects doesn't change when
> checking out (or rewinding) to different commit in supermodule.
Let's hope Pasky provides a way to set this information...
> As a special case I'd use 'no value' to note that submodule objects are
> contained in the supermodule repository.
How about using '.' for that and no value for submodules that
are not available on this server?
skimo
^ permalink raw reply
* Re: [PATCH 3/8] Clean up work-tree handling
From: Junio C Hamano @ 2007-07-28 11:15 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git, matled
In-Reply-To: <Pine.LNX.4.64.0707280956510.14781@racer.site>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>> Now, I think it is fair to say that if your worktree is somewhere
>> totally unrelated to your cwd, no amount of going up will take you to
>> the top. IOW, you have to come down after going up some levels. In
>> such a case, it is easier to code the implementation of --show-cdup to
>> give an absolute path.
>>
>> But in that case you are not even in the working tree to begin
>> with, aren't you? Does git need to support that?
>
> I'd say yes.
>
> It is utterly _inconvenient_ to have to cd to the working tree when you
> just want to check the status, for example. And git already knows about
> the work-tree!
That is a bit different issue. In such a case, I would agree it
would still be sensible for "git diff" to show the whole tree
diff, for example. In other words, my "does git need to support
that" is not about "even when the location of a worktree is
known, operations that require a work tree should fail when
invoked from outside of it".
Think about what the sensible thing to do is for "git diff ."
Within a work tree, it instructs git to behave as if the user
issued the command from the toplevel with prefix as the
argument. And scripts that want to mimick that behaviour would
use --show-prefix to obtain the prefix string, and --show-cdup
to obtain how to move to the toplevel.
Outside of a work tree, I think the only two semi-sensible
behaviours exist. Either tell the user that we cannot
understand what "." should mean in that context and error out
(IOW, "Not inside a work tree"), or assume that the user meant
"from the top". So in such a case, if we do not want to error
out to make things more "convenient", one possibility would be:
* give empty as prefix;
* give absolute or cwd relative path to the work tree for cdup
(it would not be a sequence of ../ anyway in this case).
I think this is in line with the traditional behaviour when
GIT_DIR is explicitly given. We assume the cwd is the toplevel,
and return empty prefix and empty cdup.
Having said that, I am not convinced that "assume toplevel
outside of a work tree" is a win for the end users. If the
command errors out with a message telling the user that relative
path does not make sense from outside a work tree, the user
would understand. If the command does not error out but always
works relative to the toplevel without explanation, it might
confuse the user more until the he realizes "assume toplevel
outside of a work tree" is the rule that is applying to his
case.
^ permalink raw reply
* Re: git-svn rebase screwing up commit messages
From: Junio C Hamano @ 2007-07-28 12:14 UTC (permalink / raw)
To: Benoit SIGOURE; +Cc: git
In-Reply-To: <724DFB31-0471-4A5E-95DF-F5F74876AC77@lrde.epita.fr>
Benoit SIGOURE <tsuna@lrde.epita.fr> writes:
> git version 1.5.2.3 over here, I've googled and searched in the ML
> archives but did not find this: when I git-svn rebase, my commits in
> Git (that are temporarily removed and then re-applied) get their
> commit message flattened on a single line...
Do you mean by "my commits in Git" a commit you created with git
in your git repository?
^ permalink raw reply
* Re: What's in git.git (stable)
From: Thomas Glanzmann @ 2007-07-28 12:28 UTC (permalink / raw)
To: Junio C Hamano; +Cc: GIT
In-Reply-To: <7vvec4synj.fsf_-_@assigned-by-dhcp.cox.net>
Hello Junio,
git HEAD compiles under 'Solaris 8/Forte 11' and 'Solaris 10/Forte 12'
for me.
Thomas
^ permalink raw reply
* Re: git-svn rebase screwing up commit messages
From: Sean @ 2007-07-28 12:35 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Benoit SIGOURE, git
In-Reply-To: <7v8x90sp25.fsf@assigned-by-dhcp.cox.net>
On Sat, 28 Jul 2007 05:14:26 -0700
Junio C Hamano <gitster@pobox.com> wrote:
Hi,
> Benoit SIGOURE <tsuna@lrde.epita.fr> writes:
>
> > git version 1.5.2.3 over here, I've googled and searched in the ML
> > archives but did not find this: when I git-svn rebase, my commits in
> > Git (that are temporarily removed and then re-applied) get their
> > commit message flattened on a single line...
>
> Do you mean by "my commits in Git" a commit you created with git
> in your git repository?
>
Tested this here (rc3.24.g83b3d) and can confirm the reported problem.
After making a commit in git and then running "git svn rebase" to
receive updates from the svn repo, the rebased commit has a borked
description (multi-lined commit message appears all on one line).
Sean
^ permalink raw reply
* [PATCH guilt] guilt-rebase: Make fast-forward work
From: Eric Lesh @ 2007-07-28 12:22 UTC (permalink / raw)
To: Josef Sipek; +Cc: Git mailing list
Merges created with --no-commit and a blank commit message didn't update
the branch's HEAD in a fast-forward merge. Rebasing didn't actually do
anything in that case.
Also quote the log message when displaying the new HEAD.
Signed-off-by: Eric Lesh <eclesh@ucla.edu>
---
guilt-rebase | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/guilt-rebase b/guilt-rebase
index cc8dcf6..f7de813 100755
--- a/guilt-rebase
+++ b/guilt-rebase
@@ -49,11 +49,11 @@ cp "$applied" "$rebase_dir/status"
echo "First, poping all patches..."
pop_all_patches
-git-merge --no-commit "" HEAD $upstream > /dev/null 2> /dev/null
+git-merge --no-commit $upstream > /dev/null 2> /dev/null
echo ""
log=`git-log -1 --pretty=oneline`
-echo "HEAD is now at `echo $log | cut -c 1-7`... `echo $log | cut -c 41-`"
+echo "HEAD is now at `echo $log | cut -c 1-7`... `echo "$log" | cut -c 41-`"
#
# For each previously applied patch:
--
1.5.2
^ permalink raw reply related
* Re: [PATCH 2/2] gitk: Markup many strings for translation.
From: Christian Stimming @ 2007-07-28 12:40 UTC (permalink / raw)
To: Paul Mackerras; +Cc: Brett Schwarz, git
In-Reply-To: <18090.44180.802184.747398@cargo.ozlabs.ibm.com>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=utf-8, Size: 44647 bytes --]
Markup many strings for translation.
2nd try: Correctly handle list-of-strings with translations.
Signed-off-by: Christian Stimming <stimming@tuhh.de>
---
Am Samstag, 28. Juli 2007 04:40 schrieb Paul Mackerras:
> > > - set commitinfo($id) {"No commit information available"}
> > > + set commitinfo($id) {[mc "No commit information available"]}
> >
> > I think this is probably a typo (on the original), and carrying that
> > forward will probably result in what was not intended.
> >
> > The original has the {} and "". I don't know if this was intended
> > (it will keep the quotes).
>
> Yes it is what was intended - it is a list with one element, which is
> a string.
Thanks for pointing this one out.
Below you find a patch against master of git.kernel.org/gitk.git that has the message markup with these two instances fixed (and is adapted to latest master on gitk.git). Also, I hope this time the mailer doesn't mess with the linebreaks.
gitk | 360 +++++++++++++++++++++++++++++++++---------------------------------
1 files changed, 180 insertions(+), 180 deletions(-)
diff --git a/gitk b/gitk
index b3c8230..7ac5f28 100755
--- a/gitk
+++ b/gitk
@@ -128,7 +128,7 @@ proc getcommits {} {
set phase getcommits
initlayout
start_rev_list $curview
- show_status "Reading commits..."
+ show_status [mc "Reading commits..."]
}
proc getcommitlines {fd view} {
@@ -277,7 +277,7 @@ proc chewcommits {view} {
#set ms [expr {[clock clicks -milliseconds] - $startmsecs}]
#puts "overall $ms ms for $numcommits commits"
} else {
- show_status "No commits selected"
+ show_status [mc "No commits selected"]
}
notbusy layout
set phase {}
@@ -382,7 +382,7 @@ proc getcommit {id} {
} else {
readcommit $id
if {![info exists commitinfo($id)]} {
- set commitinfo($id) {"No commit information available"}
+ set commitinfo($id) [list [mc "No commit information available"]]
}
}
return 1
@@ -481,7 +481,7 @@ proc removehead {id name} {
proc show_error {w top msg} {
message $w.m -text $msg -justify center -aspect 400
pack $w.m -side top -fill x -padx 20 -pady 20
- button $w.ok -text OK -command "destroy $top"
+ button $w.ok -text [mc OK] -command "destroy $top"
pack $w.ok -side bottom -fill x
bind $top <Visibility> "grab $top; focus $top"
bind $top <Key-Return> "destroy $top"
@@ -503,9 +503,9 @@ proc confirm_popup msg {
wm transient $w .
message $w.m -text $msg -justify center -aspect 400
pack $w.m -side top -fill x -padx 20 -pady 20
- button $w.ok -text OK -command "set confirm_ok 1; destroy $w"
+ button $w.ok -text [mc OK] -command "set confirm_ok 1; destroy $w"
pack $w.ok -side left -fill x
- button $w.cancel -text Cancel -command "destroy $w"
+ button $w.cancel -text [mc Cancel] -command "destroy $w"
pack $w.cancel -side right -fill x
bind $w <Visibility> "grab $w; focus $w"
tkwait window $w
@@ -525,32 +525,32 @@ proc makewindow {} {
global headctxmenu
menu .bar
- .bar add cascade -label "File" -menu .bar.file
+ .bar add cascade -label [mc "File"] -menu .bar.file
.bar configure -font $uifont
menu .bar.file
- .bar.file add command -label "Update" -command updatecommits
- .bar.file add command -label "Reread references" -command rereadrefs
- .bar.file add command -label "Quit" -command doquit
+ .bar.file add command -label [mc "Update"] -command updatecommits
+ .bar.file add command -label [mc "Reread references"] -command rereadrefs
+ .bar.file add command -label [mc "Quit"] -command doquit
.bar.file configure -font $uifont
menu .bar.edit
- .bar add cascade -label "Edit" -menu .bar.edit
- .bar.edit add command -label "Preferences" -command doprefs
+ .bar add cascade -label [mc "Edit"] -menu .bar.edit
+ .bar.edit add command -label [mc "Preferences"] -command doprefs
.bar.edit configure -font $uifont
menu .bar.view -font $uifont
- .bar add cascade -label "View" -menu .bar.view
- .bar.view add command -label "New view..." -command {newview 0}
- .bar.view add command -label "Edit view..." -command editview \
+ .bar add cascade -label [mc "View"] -menu .bar.view
+ .bar.view add command -label [mc "New view..."] -command {newview 0}
+ .bar.view add command -label [mc "Edit view..."] -command editview \
-state disabled
- .bar.view add command -label "Delete view" -command delview -state disabled
+ .bar.view add command -label [mc "Delete view"] -command delview -state disabled
.bar.view add separator
- .bar.view add radiobutton -label "All files" -command {showview 0} \
+ .bar.view add radiobutton -label [mc "All files"] -command {showview 0} \
-variable selectedview -value 0
menu .bar.help
- .bar add cascade -label "Help" -menu .bar.help
- .bar.help add command -label "About gitk" -command about
- .bar.help add command -label "Key bindings" -command keys
+ .bar add cascade -label [mc "Help"] -menu .bar.help
+ .bar.help add command -label [mc "About gitk"] -command about
+ .bar.help add command -label [mc "Key bindings"] -command keys
.bar.help configure -font $uifont
. configure -menu .bar
@@ -607,7 +607,7 @@ proc makewindow {} {
set sha1entry .tf.bar.sha1
set entries $sha1entry
set sha1but .tf.bar.sha1label
- button $sha1but -text "SHA1 ID: " -state disabled -relief flat \
+ button $sha1but -text [mc "SHA1 ID: "] -state disabled -relief flat \
-command gotocommit -width 8 -font $uifont
$sha1but conf -disabledforeground [$sha1but cget -foreground]
pack .tf.bar.sha1label -side left
@@ -638,7 +638,7 @@ proc makewindow {} {
-state disabled -width 26
pack .tf.bar.rightbut -side left -fill y
- button .tf.bar.findbut -text "Find" -command dofind -font $uifont
+ button .tf.bar.findbut -text [mc "Find"] -command dofind -font $uifont
pack .tf.bar.findbut -side left
set findstring {}
set fstring .tf.bar.findstring
@@ -648,13 +648,13 @@ proc makewindow {} {
pack $fstring -side left -expand 1 -fill x -in .tf.bar
set findtype Exact
set findtypemenu [tk_optionMenu .tf.bar.findtype \
- findtype Exact IgnCase Regexp]
+ findtype [mc Exact] [mc IgnCase] [mc Regexp]]
trace add variable findtype write find_change
.tf.bar.findtype configure -font $uifont
.tf.bar.findtype.menu configure -font $uifont
- set findloc "All fields"
- tk_optionMenu .tf.bar.findloc findloc "All fields" Headline \
- Comments Author Committer
+ set findloc [mc "All fields"]
+ tk_optionMenu .tf.bar.findloc findloc [mc "All fields"] [mc Headline] \
+ [mc Comments] [mc Author] [mc Committer]
trace add variable findloc write find_change
.tf.bar.findloc configure -font $uifont
.tf.bar.findloc.menu configure -font $uifont
@@ -662,12 +662,12 @@ proc makewindow {} {
pack .tf.bar.findtype -side right
# build up the bottom bar of upper window
- label .tf.lbar.flabel -text "Highlight: Commits " \
+ label .tf.lbar.flabel -text [mc "Highlight: Commits "] \
-font $uifont
pack .tf.lbar.flabel -side left -fill y
- set gdttype "touching paths:"
- set gm [tk_optionMenu .tf.lbar.gdttype gdttype "touching paths:" \
- "adding/removing string:"]
+ set gdttype [mc "touching paths:"]
+ set gm [tk_optionMenu .tf.lbar.gdttype gdttype [mc "touching paths:"] \
+ [mc "adding/removing string:"]]
trace add variable gdttype write hfiles_change
$gm conf -font $uifont
.tf.lbar.gdttype conf -font $uifont
@@ -677,19 +677,19 @@ proc makewindow {} {
trace add variable highlight_files write hfiles_change
lappend entries .tf.lbar.fent
pack .tf.lbar.fent -side left -fill x -expand 1
- label .tf.lbar.vlabel -text " OR in view" -font $uifont
+ label .tf.lbar.vlabel -text [mc " OR in view"] -font $uifont
pack .tf.lbar.vlabel -side left -fill y
global viewhlmenu selectedhlview
- set viewhlmenu [tk_optionMenu .tf.lbar.vhl selectedhlview None]
+ set viewhlmenu [tk_optionMenu .tf.lbar.vhl selectedhlview [mc None]]
$viewhlmenu entryconf None -command delvhighlight
$viewhlmenu conf -font $uifont
.tf.lbar.vhl conf -font $uifont
pack .tf.lbar.vhl -side left -fill y
- label .tf.lbar.rlabel -text " OR " -font $uifont
+ label .tf.lbar.rlabel -text [mc " OR "] -font $uifont
pack .tf.lbar.rlabel -side left -fill y
global highlight_related
- set m [tk_optionMenu .tf.lbar.relm highlight_related None \
- "Descendent" "Not descendent" "Ancestor" "Not ancestor"]
+ set m [tk_optionMenu .tf.lbar.relm highlight_related [mc None] \
+ [mc "Descendent"] [mc "Not descendent"] [mc "Ancestor"] [mc "Not ancestor"]]
$m conf -font $uifont
.tf.lbar.relm conf -font $uifont
trace add variable highlight_related write vrel_change
@@ -717,7 +717,7 @@ proc makewindow {} {
frame .bleft.top
frame .bleft.mid
- button .bleft.top.search -text "Search" -command dosearch \
+ button .bleft.top.search -text [mc "Search"] -command dosearch \
-font $uifont
pack .bleft.top.search -side left -padx 5
set sstring .bleft.top.sstring
@@ -725,11 +725,11 @@ proc makewindow {} {
lappend entries $sstring
trace add variable searchstring write incrsearch
pack $sstring -side left -expand 1 -fill x
- radiobutton .bleft.mid.diff -text "Diff" \
+ radiobutton .bleft.mid.diff -text [mc "Diff"] \
-command changediffdisp -variable diffelide -value {0 0}
- radiobutton .bleft.mid.old -text "Old version" \
+ radiobutton .bleft.mid.old -text [mc "Old version"] \
-command changediffdisp -variable diffelide -value {0 1}
- radiobutton .bleft.mid.new -text "New version" \
+ radiobutton .bleft.mid.new -text [mc "New version"] \
-command changediffdisp -variable diffelide -value {1 0}
pack .bleft.mid.diff .bleft.mid.old .bleft.mid.new -side left
set ctext .bleft.ctext
@@ -778,10 +778,10 @@ proc makewindow {} {
# lower right
frame .bright
frame .bright.mode
- radiobutton .bright.mode.patch -text "Patch" \
+ radiobutton .bright.mode.patch -text [mc "Patch"] \
-command reselectline -variable cmitmode -value "patch"
.bright.mode.patch configure -font $uifont
- radiobutton .bright.mode.tree -text "Tree" \
+ radiobutton .bright.mode.tree -text [mc "Tree"] \
-command reselectline -variable cmitmode -value "tree"
.bright.mode.tree configure -font $uifont
grid .bright.mode.patch .bright.mode.tree -sticky ew
@@ -886,35 +886,35 @@ proc makewindow {} {
set rowctxmenu .rowctxmenu
menu $rowctxmenu -tearoff 0
- $rowctxmenu add command -label "Diff this -> selected" \
+ $rowctxmenu add command -label [mc "Diff this -> selected"] \
-command {diffvssel 0}
- $rowctxmenu add command -label "Diff selected -> this" \
+ $rowctxmenu add command -label [mc "Diff selected -> this"] \
-command {diffvssel 1}
- $rowctxmenu add command -label "Make patch" -command mkpatch
- $rowctxmenu add command -label "Create tag" -command mktag
- $rowctxmenu add command -label "Write commit to file" -command writecommit
- $rowctxmenu add command -label "Create new branch" -command mkbranch
- $rowctxmenu add command -label "Cherry-pick this commit" \
+ $rowctxmenu add command -label [mc "Make patch"] -command mkpatch
+ $rowctxmenu add command -label [mc "Create tag"] -command mktag
+ $rowctxmenu add command -label [mc "Write commit to file"] -command writecommit
+ $rowctxmenu add command -label [mc "Create new branch"] -command mkbranch
+ $rowctxmenu add command -label [mc "Cherry-pick this commit"] \
-command cherrypick
- $rowctxmenu add command -label "Reset HEAD branch to here" \
+ $rowctxmenu add command -label [mc "Reset HEAD branch to here"] \
-command resethead
set fakerowmenu .fakerowmenu
menu $fakerowmenu -tearoff 0
- $fakerowmenu add command -label "Diff this -> selected" \
+ $fakerowmenu add command -label [mc "Diff this -> selected"] \
-command {diffvssel 0}
- $fakerowmenu add command -label "Diff selected -> this" \
+ $fakerowmenu add command -label [mc "Diff selected -> this"] \
-command {diffvssel 1}
- $fakerowmenu add command -label "Make patch" -command mkpatch
-# $fakerowmenu add command -label "Commit" -command {mkcommit 0}
-# $fakerowmenu add command -label "Commit all" -command {mkcommit 1}
-# $fakerowmenu add command -label "Revert local changes" -command revertlocal
+ $fakerowmenu add command -label [mc "Make patch"] -command mkpatch
+# $fakerowmenu add command -label [mc "Commit"] -command {mkcommit 0}
+# $fakerowmenu add command -label [mc "Commit all"] -command {mkcommit 1}
+# $fakerowmenu add command -label [mc "Revert local changes"] -command revertlocal
set headctxmenu .headctxmenu
menu $headctxmenu -tearoff 0
- $headctxmenu add command -label "Check out this branch" \
+ $headctxmenu add command -label [mc "Check out this branch"] \
-command cobranch
- $headctxmenu add command -label "Remove this branch" \
+ $headctxmenu add command -label [mc "Remove this branch"] \
-command rmbranch
}
@@ -1086,17 +1086,17 @@ proc about {} {
return
}
toplevel $w
- wm title $w "About gitk"
- message $w.m -text {
+ wm title $w [mc "About gitk"]
+ message $w.m -text [mc "
Gitk - a commit viewer for git
Copyright © 2005-2006 Paul Mackerras
-Use and redistribute under the terms of the GNU General Public License} \
+Use and redistribute under the terms of the GNU General Public License"] \
-justify center -aspect 400 -border 2 -bg white -relief groove
pack $w.m -side top -fill x -padx 2 -pady 2
$w.m configure -font $uifont
- button $w.ok -text Close -command "destroy $w" -default active
+ button $w.ok -text [mc Close] -command "destroy $w" -default active
pack $w.ok -side bottom
$w.ok configure -font $uifont
bind $w <Visibility> "focus $w.ok"
@@ -1117,8 +1117,8 @@ proc keys {} {
set M1T Ctrl
}
toplevel $w
- wm title $w "Gitk key bindings"
- message $w.m -text "
+ wm title $w [mc "Gitk key bindings"]
+ message $w.m -text [mc "
Gitk key bindings:
<$M1T-Q> Quit
@@ -1156,11 +1156,11 @@ f Scroll diff view to next file
<$M1T-KP-> Decrease font size
<$M1T-minus> Decrease font size
<F5> Update
-" \
+"] \
-justify left -bg white -border 2 -relief groove
pack $w.m -side top -fill both -padx 2 -pady 2
$w.m configure -font $uifont
- button $w.ok -text Close -command "destroy $w" -default active
+ button $w.ok -text [mc Close] -command "destroy $w" -default active
pack $w.ok -side bottom
$w.ok configure -font $uifont
bind $w <Visibility> "focus $w.ok"
@@ -1608,7 +1608,7 @@ proc newview {ishighlight} {
set newviewname($nextviewnum) "View $nextviewnum"
set newviewperm($nextviewnum) 0
set newviewargs($nextviewnum) [shellarglist $revtreeargs]
- vieweditor $top $nextviewnum "Gitk view definition"
+ vieweditor $top $nextviewnum [mc "Gitk view definition"]
}
proc editview {} {
@@ -1633,20 +1633,20 @@ proc vieweditor {top n title} {
toplevel $top
wm title $top $title
- label $top.nl -text "Name" -font $uifont
+ label $top.nl -text [mc "Name"] -font $uifont
entry $top.name -width 20 -textvariable newviewname($n) -font $uifont
grid $top.nl $top.name -sticky w -pady 5
- checkbutton $top.perm -text "Remember this view" -variable newviewperm($n) \
+ checkbutton $top.perm -text [mc "Remember this view"] -variable newviewperm($n) \
-font $uifont
grid $top.perm - -pady 5 -sticky w
message $top.al -aspect 1000 -font $uifont \
- -text "Commits to include (arguments to git rev-list):"
+ -text [mc "Commits to include (arguments to git rev-list):"]
grid $top.al - -sticky w -pady 5
entry $top.args -width 50 -textvariable newviewargs($n) \
-background white -font $uifont
grid $top.args - -sticky ew -padx 5
message $top.l -aspect 1000 -font $uifont \
- -text "Enter files and directories to include, one per line:"
+ -text [mc "Enter files and directories to include, one per line:"]
grid $top.l - -sticky w
text $top.t -width 40 -height 10 -background white -font $uifont
if {[info exists viewfiles($n)]} {
@@ -1659,9 +1659,9 @@ proc vieweditor {top n title} {
}
grid $top.t - -sticky ew -padx 5
frame $top.buts
- button $top.buts.ok -text "OK" -command [list newviewok $top $n] \
+ button $top.buts.ok -text [mc "OK"] -command [list newviewok $top $n] \
-font $uifont
- button $top.buts.can -text "Cancel" -command [list destroy $top] \
+ button $top.buts.can -text [mc "Cancel"] -command [list destroy $top] \
-font $uifont
grid $top.buts.ok $top.buts.can
grid columnconfigure $top.buts 0 -weight 1 -uniform a
@@ -1908,11 +1908,11 @@ proc showview {n} {
}
if {$phase ne {}} {
if {$phase eq "getcommits"} {
- show_status "Reading commits..."
+ show_status [mc "Reading commits..."]
}
run chewcommits $n
} elseif {$numcommits == 0} {
- show_status "No commits selected"
+ show_status [mc "No commits selected"]
}
}
@@ -2203,9 +2203,9 @@ proc askfindhighlight {row id} {
set isbold 0
set fldtypes {Headline Author Date Committer CDate Comments}
foreach f $info ty $fldtypes {
- if {($findloc eq "All fields" || $findloc eq $ty) &&
+ if {($findloc eq [mc "All fields"] || $findloc eq $ty) &&
[doesmatch $f]} {
- if {$ty eq "Author"} {
+ if {$ty eq [mc "Author"]} {
set isbold 2
break
}
@@ -2254,7 +2254,7 @@ proc vrel_change {name ix op} {
global highlight_related
rhighlight_none
- if {$highlight_related ne "None"} {
+ if {$highlight_related ne [mc "None"]} {
run drawvisible
}
}
@@ -2268,7 +2268,7 @@ proc rhighlight_sel {a} {
set desc_todo [list $a]
catch {unset ancestor}
set anc_todo [list $a]
- if {$highlight_related ne "None"} {
+ if {$highlight_related ne [mc "None"]} {
rhighlight_none
run drawvisible
}
@@ -2351,20 +2351,20 @@ proc askrelhighlight {row id} {
if {![info exists selectedline]} return
set isbold 0
- if {$highlight_related eq "Descendent" ||
- $highlight_related eq "Not descendent"} {
+ if {$highlight_related eq [mc "Descendent"] ||
+ $highlight_related eq [mc "Not descendent"]} {
if {![info exists descendent($id)]} {
is_descendent $id
}
- if {$descendent($id) == ($highlight_related eq "Descendent")} {
+ if {$descendent($id) == ($highlight_related eq [mc "Descendent"])} {
set isbold 1
}
- } elseif {$highlight_related eq "Ancestor" ||
- $highlight_related eq "Not ancestor"} {
+ } elseif {$highlight_related eq [mc "Ancestor"] ||
+ $highlight_related eq [mc "Not ancestor"]} {
if {![info exists ancestor($id)]} {
is_ancestor $id
}
- if {$ancestor($id) == ($highlight_related eq "Ancestor")} {
+ if {$ancestor($id) == ($highlight_related eq [mc "Ancestor"])} {
set isbold 1
}
}
@@ -2402,7 +2402,7 @@ proc next_hlcont {} {
}
if {$nhighlights($row) > 0} break
}
- if {$highlight_related ne "None"} {
+ if {$highlight_related ne [mc "None"]} {
if {![info exists rhighlights($row)]} {
askrelhighlight $row $id
}
@@ -2439,7 +2439,7 @@ proc next_highlight {dirn} {
if {![info exists selectedline]} return
if {!([info exists hlview] || $findstring ne {} ||
- $highlight_related ne "None" || [info exists filehighlight])} return
+ $highlight_related ne [mc "None"] || [info exists filehighlight])} return
set fhl_row [expr {$selectedline + $dirn}]
set fhl_dirn $dirn
next_hlcont
@@ -2786,7 +2786,7 @@ proc readdiffindex {fd serial} {
if {$isdiff && $serial == $lserial && $localirow == -1} {
# add the line for the changes in the index to the graph
set localirow $commitrow($curview,$mainheadid)
- set hl "Local changes checked in to index but not committed"
+ set hl [mc "Local changes checked in to index but not committed"]
set commitinfo($nullid2) [list $hl {} {} {} {} " $hl\n"]
set commitdata($nullid2) "\n $hl\n"
insertrow $localirow $nullid2
@@ -2816,7 +2816,7 @@ proc readdifffiles {fd serial} {
} else {
set localfrow $commitrow($curview,$mainheadid)
}
- set hl "Local uncommitted changes, not checked in to index"
+ set hl [mc "Local uncommitted changes, not checked in to index"]
set commitinfo($nullid) [list $hl {} {} {} {} " $hl\n"]
set commitdata($nullid) "\n $hl\n"
insertrow $localfrow $nullid
@@ -2945,7 +2945,7 @@ proc addextraid {id row} {
set commitrow($curview,$id) $row
readcommit $id
if {![info exists commitinfo($id)]} {
- set commitinfo($id) {"No commit information available"}
+ set commitinfo($id) [list [mc "No commit information available"]]
}
if {![info exists children($curview,$id)]} {
set children($curview,$id) {}
@@ -3518,7 +3518,7 @@ proc drawcmitrow {row} {
if {$findstring ne {} && ![info exists nhighlights($row)]} {
askfindhighlight $row $id
}
- if {$highlight_related ne "None" && ![info exists rhighlights($row)]} {
+ if {$highlight_related ne [mc "None"] && ![info exists rhighlights($row)]} {
askrelhighlight $row $id
}
if {![info exists iddrawn($id)]} {
@@ -4018,11 +4018,11 @@ proc notbusy {what} {
proc findmatches {f} {
global findtype findstring
- if {$findtype == "Regexp"} {
+ if {$findtype == [mc "Regexp"]} {
set matches [regexp -indices -all -inline $findstring $f]
} else {
set fs $findstring
- if {$findtype == "IgnCase"} {
+ if {$findtype == [mc "IgnCase"]} {
set f [string tolower $f]
set fs [string tolower $fs]
}
@@ -4114,7 +4114,7 @@ proc findmore {} {
}
set info $commitinfo($id)
foreach f $info ty $fldtypes {
- if {($findloc eq "All fields" || $findloc eq $ty) &&
+ if {($findloc eq [mc "All fields"] || $findloc eq $ty) &&
[doesmatch $f]} {
findselectline $l
notbusy finding
@@ -4159,7 +4159,7 @@ proc findmorerev {} {
}
set info $commitinfo($id)
foreach f $info ty $fldtypes {
- if {($findloc eq "All fields" || $findloc eq $ty) &&
+ if {($findloc eq [mc "All fields"] || $findloc eq $ty) &&
[doesmatch $f]} {
findselectline $l
notbusy finding
@@ -4183,7 +4183,7 @@ proc findselectline {l} {
set markingmatches 1
set findcurline $l
selectline $l 1
- if {$findloc == "All fields" || $findloc == "Comments"} {
+ if {$findloc == [mc "All fields"] || $findloc == [mc "Comments"]} {
# highlight the matches in the comments
set f [$ctext get 1.0 $commentend]
set matches [findmatches $f]
@@ -4477,11 +4477,11 @@ proc selectline {l isnew} {
set linknum 0
set info $commitinfo($id)
set date [formatdate [lindex $info 2]]
- $ctext insert end "Author: [lindex $info 1] $date\n"
+ $ctext insert end "[mc "Author:"] [lindex $info 1] $date\n"
set date [formatdate [lindex $info 4]]
- $ctext insert end "Committer: [lindex $info 3] $date\n"
+ $ctext insert end "[mc "Committer:"] [lindex $info 3] $date\n"
if {[info exists idtags($id)]} {
- $ctext insert end "Tags:"
+ $ctext insert end [mc "Tags:"]
foreach tag $idtags($id) {
$ctext insert end " $tag"
}
@@ -4498,18 +4498,18 @@ proc selectline {l isnew} {
} else {
set tag m$np
}
- $ctext insert end "Parent: " $tag
+ $ctext insert end "[mc "Parent:"] " $tag
appendwithlinks [commit_descriptor $p] {}
incr np
}
} else {
foreach p $olds {
- append headers "Parent: [commit_descriptor $p]"
+ append headers "[mc "Parent:"] [commit_descriptor $p]"
}
}
foreach c $children($curview,$id) {
- append headers "Child: [commit_descriptor $c]"
+ append headers "[mc "Child:"] [commit_descriptor $c]"
}
# make anything that looks like a SHA1 ID be a clickable link
@@ -4518,13 +4518,13 @@ proc selectline {l isnew} {
if {![info exists allcommits]} {
getallcommits
}
- $ctext insert end "Branch: "
+ $ctext insert end "[mc "Branch:"] "
$ctext mark set branch "end -1c"
$ctext mark gravity branch left
- $ctext insert end "\nFollows: "
+ $ctext insert end "\n[mc "Follows:"] "
$ctext mark set follows "end -1c"
$ctext mark gravity follows left
- $ctext insert end "\nPrecedes: "
+ $ctext insert end "\n[mc "Precedes:"] "
$ctext mark set precedes "end -1c"
$ctext mark gravity precedes left
$ctext insert end "\n"
@@ -4541,7 +4541,7 @@ proc selectline {l isnew} {
$ctext conf -state disabled
set commentend [$ctext index "end - 1c"]
- init_flist "Comments"
+ init_flist [mc "Comments"]
if {$cmitmode eq "tree"} {
gettree $id
} elseif {[llength $olds] <= 1} {
@@ -5351,9 +5351,9 @@ proc sha1change {n1 n2 op} {
}
if {[$sha1but cget -state] == $state} return
if {$state == "normal"} {
- $sha1but conf -state normal -relief raised -text "Goto: "
+ $sha1but conf -state normal -relief raised -text "[mc "Goto:"] "
} else {
- $sha1but conf -state disabled -relief flat -text "SHA1 ID: "
+ $sha1but conf -state disabled -relief flat -text "[mc "SHA1 ID:"] "
}
}
@@ -5378,7 +5378,7 @@ proc gotocommit {} {
}
if {$matches ne {}} {
if {[llength $matches] > 1} {
- error_popup "Short SHA1 id $id is ambiguous"
+ error_popup [mc "Short SHA1 id %s is ambiguous" $id]
return
}
set id [lindex $matches 0]
@@ -5526,17 +5526,17 @@ proc lineclick {x y id isnew} {
$ctext tag conf link -foreground blue -underline 1
$ctext tag bind link <Enter> { %W configure -cursor hand2 }
$ctext tag bind link <Leave> { %W configure -cursor $curtextcursor }
- $ctext insert end "Parent:\t"
+ $ctext insert end "[mc "Parent:"]\t"
$ctext insert end $id [list link link0]
$ctext tag bind link0 <1> [list selbyid $id]
set info $commitinfo($id)
$ctext insert end "\n\t[lindex $info 0]\n"
- $ctext insert end "\tAuthor:\t[lindex $info 1]\n"
+ $ctext insert end "\t[mc "Author:"]\t[lindex $info 1]\n"
set date [formatdate [lindex $info 2]]
- $ctext insert end "\tDate:\t$date\n"
+ $ctext insert end "\t[mc "Date:"]\t$date\n"
set kids $children($curview,$id)
if {$kids ne {}} {
- $ctext insert end "\nChildren:"
+ $ctext insert end "\n[mc "Children:"]"
set i 0
foreach child $kids {
incr i
@@ -5546,9 +5546,9 @@ proc lineclick {x y id isnew} {
$ctext insert end $child [list link link$i]
$ctext tag bind link$i <1> [list selbyid $child]
$ctext insert end "\n\t[lindex $info 0]"
- $ctext insert end "\n\tAuthor:\t[lindex $info 1]"
+ $ctext insert end "\n\t[mc "Author:"]\t[lindex $info 1]"
set date [formatdate [lindex $info 2]]
- $ctext insert end "\n\tDate:\t$date\n"
+ $ctext insert end "\n\t[mc "Date:"]\t$date\n"
}
}
$ctext conf -state disabled
@@ -5592,13 +5592,13 @@ proc rowmenu {x y id} {
}
if {$id ne $nullid && $id ne $nullid2} {
set menu $rowctxmenu
- $menu entryconfigure 7 -label "Reset $mainhead branch to here"
+ $menu entryconfigure 7 -label [mc "Reset %s branch to here" $mainhead]
} else {
set menu $fakerowmenu
}
- $menu entryconfigure "Diff this*" -state $state
- $menu entryconfigure "Diff selected*" -state $state
- $menu entryconfigure "Make patch" -state $state
+ $menu entryconfigure [mc "Diff this*"] -state $state
+ $menu entryconfigure [mc "Diff selected*"] -state $state
+ $menu entryconfigure [mc "Make patch"] -state $state
tk_popup $menu $x $y
}
@@ -5623,8 +5623,8 @@ proc doseldiff {oldid newid} {
$ctext conf -state normal
clear_ctext
- init_flist "Top"
- $ctext insert end "From "
+ init_flist [mc "Top"]
+ $ctext insert end [mc "From "]
$ctext tag conf link -foreground blue -underline 1
$ctext tag bind link <Enter> { %W configure -cursor hand2 }
$ctext tag bind link <Leave> { %W configure -cursor $curtextcursor }
@@ -5632,7 +5632,7 @@ proc doseldiff {oldid newid} {
$ctext insert end $oldid [list link link0]
$ctext insert end "\n "
$ctext insert end [lindex $commitinfo($oldid) 0]
- $ctext insert end "\n\nTo "
+ $ctext insert end "\n\n[mc "To"] "
$ctext tag bind link1 <1> [list selbyid $newid]
$ctext insert end $newid [list link link1]
$ctext insert end "\n "
@@ -5655,9 +5655,9 @@ proc mkpatch {} {
set patchtop $top
catch {destroy $top}
toplevel $top
- label $top.title -text "Generate patch"
+ label $top.title -text [mc "Generate patch"]
grid $top.title - -pady 10
- label $top.from -text "From:"
+ label $top.from -text [mc "From:"]
entry $top.fromsha1 -width 40 -relief flat
$top.fromsha1 insert 0 $oldid
$top.fromsha1 conf -state readonly
@@ -5666,7 +5666,7 @@ proc mkpatch {} {
$top.fromhead insert 0 $oldhead
$top.fromhead conf -state readonly
grid x $top.fromhead -sticky w
- label $top.to -text "To:"
+ label $top.to -text [mc "To:"]
entry $top.tosha1 -width 40 -relief flat
$top.tosha1 insert 0 $newid
$top.tosha1 conf -state readonly
@@ -5675,16 +5675,16 @@ proc mkpatch {} {
$top.tohead insert 0 $newhead
$top.tohead conf -state readonly
grid x $top.tohead -sticky w
- button $top.rev -text "Reverse" -command mkpatchrev -padx 5
+ button $top.rev -text [mc "Reverse"] -command mkpatchrev -padx 5
grid $top.rev x -pady 10
- label $top.flab -text "Output file:"
+ label $top.flab -text [mc "Output file:"]
entry $top.fname -width 60
$top.fname insert 0 [file normalize "patch$patchnum.patch"]
incr patchnum
grid $top.flab $top.fname -sticky w
frame $top.buts
- button $top.buts.gen -text "Generate" -command mkpatchgo
- button $top.buts.can -text "Cancel" -command mkpatchcan
+ button $top.buts.gen -text [mc "Generate"] -command mkpatchgo
+ button $top.buts.can -text [mc "Cancel"] -command mkpatchcan
grid $top.buts.gen $top.buts.can
grid columnconfigure $top.buts 0 -weight 1 -uniform a
grid columnconfigure $top.buts 1 -weight 1 -uniform a
@@ -5737,9 +5737,9 @@ proc mktag {} {
set mktagtop $top
catch {destroy $top}
toplevel $top
- label $top.title -text "Create tag"
+ label $top.title -text [mc "Create tag"]
grid $top.title - -pady 10
- label $top.id -text "ID:"
+ label $top.id -text [mc "ID:"]
entry $top.sha1 -width 40 -relief flat
$top.sha1 insert 0 $rowmenuid
$top.sha1 conf -state readonly
@@ -5748,12 +5748,12 @@ proc mktag {} {
$top.head insert 0 [lindex $commitinfo($rowmenuid) 0]
$top.head conf -state readonly
grid x $top.head -sticky w
- label $top.tlab -text "Tag name:"
+ label $top.tlab -text [mc "Tag name:"]
entry $top.tag -width 60
grid $top.tlab $top.tag -sticky w
frame $top.buts
- button $top.buts.gen -text "Create" -command mktaggo
- button $top.buts.can -text "Cancel" -command mktagcan
+ button $top.buts.gen -text [mc "Create"] -command mktaggo
+ button $top.buts.can -text [mc "Cancel"] -command mktagcan
grid $top.buts.gen $top.buts.can
grid columnconfigure $top.buts 0 -weight 1 -uniform a
grid columnconfigure $top.buts 1 -weight 1 -uniform a
@@ -5767,11 +5767,11 @@ proc domktag {} {
set id [$mktagtop.sha1 get]
set tag [$mktagtop.tag get]
if {$tag == {}} {
- error_popup "No tag name specified"
+ error_popup [mc "No tag name specified"]
return
}
if {[info exists tagids($tag)]} {
- error_popup "Tag \"$tag\" already exists"
+ error_popup [mc "Tag \"%s\" already exists" $tag]
return
}
if {[catch {
@@ -5832,9 +5832,9 @@ proc writecommit {} {
set wrcomtop $top
catch {destroy $top}
toplevel $top
- label $top.title -text "Write commit to file"
+ label $top.title -text [mc "Write commit to file"]
grid $top.title - -pady 10
- label $top.id -text "ID:"
+ label $top.id -text [mc "ID:"]
entry $top.sha1 -width 40 -relief flat
$top.sha1 insert 0 $rowmenuid
$top.sha1 conf -state readonly
@@ -5843,16 +5843,16 @@ proc writecommit {} {
$top.head insert 0 [lindex $commitinfo($rowmenuid) 0]
$top.head conf -state readonly
grid x $top.head -sticky w
- label $top.clab -text "Command:"
+ label $top.clab -text [mc "Command:"]
entry $top.cmd -width 60 -textvariable wrcomcmd
grid $top.clab $top.cmd -sticky w -pady 10
- label $top.flab -text "Output file:"
+ label $top.flab -text [mc "Output file:"]
entry $top.fname -width 60
$top.fname insert 0 [file normalize "commit-[string range $rowmenuid 0 6]"]
grid $top.flab $top.fname -sticky w
frame $top.buts
- button $top.buts.gen -text "Write" -command wrcomgo
- button $top.buts.can -text "Cancel" -command wrcomcan
+ button $top.buts.gen -text [mc "Write"] -command wrcomgo
+ button $top.buts.can -text [mc "Cancel"] -command wrcomcan
grid $top.buts.gen $top.buts.can
grid columnconfigure $top.buts 0 -weight 1 -uniform a
grid columnconfigure $top.buts 1 -weight 1 -uniform a
@@ -5886,19 +5886,19 @@ proc mkbranch {} {
set top .makebranch
catch {destroy $top}
toplevel $top
- label $top.title -text "Create new branch"
+ label $top.title -text [mc "Create new branch"]
grid $top.title - -pady 10
- label $top.id -text "ID:"
+ label $top.id -text [mc "ID:"]
entry $top.sha1 -width 40 -relief flat
$top.sha1 insert 0 $rowmenuid
$top.sha1 conf -state readonly
grid $top.id $top.sha1 -sticky w
- label $top.nlab -text "Name:"
+ label $top.nlab -text [mc "Name:"]
entry $top.name -width 40
grid $top.nlab $top.name -sticky w
frame $top.buts
- button $top.buts.go -text "Create" -command [list mkbrgo $top]
- button $top.buts.can -text "Cancel" -command "catch {destroy $top}"
+ button $top.buts.go -text [mc "Create"] -command [list mkbrgo $top]
+ button $top.buts.can -text [mc "Cancel"] -command "catch {destroy $top}"
grid $top.buts.go $top.buts.can
grid columnconfigure $top.buts 0 -weight 1 -uniform a
grid columnconfigure $top.buts 1 -weight 1 -uniform a
@@ -5912,7 +5912,7 @@ proc mkbrgo {top} {
set name [$top.name get]
set id [$top.sha1 get]
if {$name eq {}} {
- error_popup "Please specify a name for the new branch"
+ error_popup [mc "Please specify a name for the new branch"]
return
}
catch {destroy $top}
@@ -5956,7 +5956,7 @@ proc cherrypick {} {
set newhead [exec git rev-parse HEAD]
if {$newhead eq $oldhead} {
notbusy cherrypick
- error_popup "No changes committed"
+ error_popup [mc "No changes committed"]
return
}
addnewchild $newhead $oldhead
@@ -5980,28 +5980,28 @@ proc resethead {} {
set w ".confirmreset"
toplevel $w
wm transient $w .
- wm title $w "Confirm reset"
+ wm title $w [mc "Confirm reset"]
message $w.m -text \
- "Reset branch $mainhead to [string range $rowmenuid 0 7]?" \
+ [mc "Reset branch %s to %s?" $mainhead [string range $rowmenuid 0 7]] \
-justify center -aspect 1000
pack $w.m -side top -fill x -padx 20 -pady 20
frame $w.f -relief sunken -border 2
- message $w.f.rt -text "Reset type:" -aspect 1000
+ message $w.f.rt -text [mc "Reset type:"] -aspect 1000
grid $w.f.rt -sticky w
set resettype mixed
radiobutton $w.f.soft -value soft -variable resettype -justify left \
- -text "Soft: Leave working tree and index untouched"
+ -text [mc "Soft: Leave working tree and index untouched"]
grid $w.f.soft -sticky w
radiobutton $w.f.mixed -value mixed -variable resettype -justify left \
- -text "Mixed: Leave working tree untouched, reset index"
+ -text [mc "Mixed: Leave working tree untouched, reset index"]
grid $w.f.mixed -sticky w
radiobutton $w.f.hard -value hard -variable resettype -justify left \
- -text "Hard: Reset working tree and index\n(discard ALL local changes)"
+ -text [mc "Hard: Reset working tree and index\n(discard ALL local changes)"]
grid $w.f.hard -sticky w
pack $w.f -side top -fill x
- button $w.ok -text OK -command "set confirm_ok 1; destroy $w"
+ button $w.ok -text [mc OK] -command "set confirm_ok 1; destroy $w"
pack $w.ok -side left -fill x -padx 20 -pady 20
- button $w.cancel -text Cancel -command "destroy $w"
+ button $w.cancel -text [mc Cancel] -command "destroy $w"
pack $w.cancel -side right -fill x -padx 20 -pady 20
bind $w <Visibility> "grab $w; focus $w"
tkwait window $w
@@ -6015,8 +6015,8 @@ proc resethead {} {
filerun $fd [list readresetstat $fd $w]
toplevel $w
wm transient $w
- wm title $w "Reset progress"
- message $w.m -text "Reset in progress, please wait..." \
+ wm title $w [mc "Reset progress"]
+ message $w.m -text [mc "Reset in progress, please wait..."] \
-justify center -aspect 1000
pack $w.m -side top -fill x -padx 20 -pady 5
canvas $w.c -width 150 -height 20 -bg white
@@ -6107,7 +6107,7 @@ proc rmbranch {} {
set id $headmenuid
# this check shouldn't be needed any more...
if {$head eq $mainhead} {
- error_popup "Cannot delete the currently checked-out branch"
+ error_popup [mc "Cannot delete the currently checked-out branch"]
return
}
set dheads [descheads $id]
@@ -7066,7 +7066,7 @@ proc showtag {tag isnew} {
if {[info exists tagcontents($tag)]} {
set text $tagcontents($tag)
} else {
- set text "Tag: $tag\nId: $tagids($tag)"
+ set text "[mc "Tag:"] $tag\n[mc "Id:"] $tagids($tag)"
}
appendwithlinks $text {}
$ctext conf -state disabled
@@ -7096,77 +7096,77 @@ proc doprefs {} {
set oldprefs($v) [set $v]
}
toplevel $top
- wm title $top "Gitk preferences"
- label $top.ldisp -text "Commit list display options"
+ wm title $top [mc "Gitk preferences"]
+ label $top.ldisp -text [mc "Commit list display options"]
$top.ldisp configure -font $uifont
grid $top.ldisp - -sticky w -pady 10
label $top.spacer -text " "
- label $top.maxwidthl -text "Maximum graph width (lines)" \
+ label $top.maxwidthl -text [mc "Maximum graph width (lines)"] \
-font optionfont
spinbox $top.maxwidth -from 0 -to 100 -width 4 -textvariable maxwidth
grid $top.spacer $top.maxwidthl $top.maxwidth -sticky w
- label $top.maxpctl -text "Maximum graph width (% of pane)" \
+ label $top.maxpctl -text [mc "Maximum graph width (% of pane)"] \
-font optionfont
spinbox $top.maxpct -from 1 -to 100 -width 4 -textvariable maxgraphpct
grid x $top.maxpctl $top.maxpct -sticky w
frame $top.showlocal
- label $top.showlocal.l -text "Show local changes" -font optionfont
+ label $top.showlocal.l -text [mc "Show local changes"] -font optionfont
checkbutton $top.showlocal.b -variable showlocalchanges
pack $top.showlocal.b $top.showlocal.l -side left
grid x $top.showlocal -sticky w
- label $top.ddisp -text "Diff display options"
+ label $top.ddisp -text [mc "Diff display options"]
$top.ddisp configure -font $uifont
grid $top.ddisp - -sticky w -pady 10
- label $top.diffoptl -text "Options for diff program" \
+ label $top.diffoptl -text [mc "Options for diff program"] \
-font optionfont
entry $top.diffopt -width 20 -textvariable diffopts
grid x $top.diffoptl $top.diffopt -sticky w
frame $top.ntag
- label $top.ntag.l -text "Display nearby tags" -font optionfont
+ label $top.ntag.l -text [mc "Display nearby tags"] -font optionfont
checkbutton $top.ntag.b -variable showneartags
pack $top.ntag.b $top.ntag.l -side left
grid x $top.ntag -sticky w
- label $top.tabstopl -text "tabstop" -font optionfont
+ label $top.tabstopl -text [mc "tabstop"] -font optionfont
spinbox $top.tabstop -from 1 -to 20 -width 4 -textvariable tabstop
grid x $top.tabstopl $top.tabstop -sticky w
- label $top.cdisp -text "Colors: press to choose"
+ label $top.cdisp -text [mc "Colors: press to choose"]
$top.cdisp configure -font $uifont
grid $top.cdisp - -sticky w -pady 10
label $top.bg -padx 40 -relief sunk -background $bgcolor
- button $top.bgbut -text "Background" -font optionfont \
+ button $top.bgbut -text [mc "Background"] -font optionfont \
-command [list choosecolor bgcolor 0 $top.bg background setbg]
grid x $top.bgbut $top.bg -sticky w
label $top.fg -padx 40 -relief sunk -background $fgcolor
- button $top.fgbut -text "Foreground" -font optionfont \
+ button $top.fgbut -text [mc "Foreground"] -font optionfont \
-command [list choosecolor fgcolor 0 $top.fg foreground setfg]
grid x $top.fgbut $top.fg -sticky w
label $top.diffold -padx 40 -relief sunk -background [lindex $diffcolors 0]
- button $top.diffoldbut -text "Diff: old lines" -font optionfont \
+ button $top.diffoldbut -text [mc "Diff: old lines"] -font optionfont \
-command [list choosecolor diffcolors 0 $top.diffold "diff old lines" \
[list $ctext tag conf d0 -foreground]]
grid x $top.diffoldbut $top.diffold -sticky w
label $top.diffnew -padx 40 -relief sunk -background [lindex $diffcolors 1]
- button $top.diffnewbut -text "Diff: new lines" -font optionfont \
+ button $top.diffnewbut -text [mc "Diff: new lines"] -font optionfont \
-command [list choosecolor diffcolors 1 $top.diffnew "diff new lines" \
[list $ctext tag conf d1 -foreground]]
grid x $top.diffnewbut $top.diffnew -sticky w
label $top.hunksep -padx 40 -relief sunk -background [lindex $diffcolors 2]
- button $top.hunksepbut -text "Diff: hunk header" -font optionfont \
+ button $top.hunksepbut -text [mc "Diff: hunk header"] -font optionfont \
-command [list choosecolor diffcolors 2 $top.hunksep \
"diff hunk header" \
[list $ctext tag conf hunksep -foreground]]
grid x $top.hunksepbut $top.hunksep -sticky w
label $top.selbgsep -padx 40 -relief sunk -background $selectbgcolor
- button $top.selbgbut -text "Select bg" -font optionfont \
+ button $top.selbgbut -text [mc "Select bg"] -font optionfont \
-command [list choosecolor selectbgcolor 0 $top.selbgsep background setselbg]
grid x $top.selbgbut $top.selbgsep -sticky w
frame $top.buts
- button $top.buts.ok -text "OK" -command prefsok -default active
+ button $top.buts.ok -text [mc "OK"] -command prefsok -default active
$top.buts.ok configure -font $uifont
- button $top.buts.can -text "Cancel" -command prefscan -default normal
+ button $top.buts.can -text [mc "Cancel"] -command prefscan -default normal
$top.buts.can configure -font $uifont
grid $top.buts.ok $top.buts.can
grid columnconfigure $top.buts 0 -weight 1 -uniform a
@@ -7179,7 +7179,7 @@ proc choosecolor {v vi w x cmd} {
global $v
set c [tk_chooseColor -initialcolor [lindex [set $v] $vi] \
- -title "Gitk: choose color for $x"]
+ -title [mc "Gitk: choose color for %s" $x]]
if {$c eq {}} return
$w conf -background $c
lset $v $vi $c
@@ -7681,7 +7681,7 @@ if {$cmdline_files ne {} || $revtreeargs ne {}} {
set curview 1
set selectedview 1
set nextviewnum 2
- set viewname(1) "Command line"
+ set viewname(1) [mc "Command line"]
set viewfiles(1) $cmdline_files
set viewargs(1) $revtreeargs
set viewperm(1) 0
--
1.5.2
^ permalink raw reply related
* [PATCH] gitk.git: Add Makefile with rules for po file creation.
From: Christian Stimming @ 2007-07-28 12:52 UTC (permalink / raw)
To: Paul Mackerras; +Cc: Brett Schwarz, git, Junio Hamano
In-Reply-To: <200707281440.26660.stimming@tuhh.de>
Signed-off-by: Christian Stimming <stimming@tuhh.de>
---
Similar to the previous patch with the message markup, this one has also been created against the kernel.org gitk.git. These would be the necessary Makefile rules for string extraction by gettext.
Makefile | 39 +++++++++++++++++++++++++++++++++++++++
1 files changed, 39 insertions(+), 0 deletions(-)
create mode 100644 Makefile
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..d7b75fb
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,39 @@
+# Set the installation directories; this section is needed only in
+# gitk.git but not in git.git.
+ifndef gitexecdir
+ gitexecdir := $(shell git --exec-path)
+endif
+ifndef sharedir
+ sharedir := $(dir $(gitexecdir))share
+endif
+
+# From here on, all is needed in git.git/Makefile.
+libdir ?= $(sharedir)/gitk/lib
+msgsdir ?= $(libdir)/msgs
+msgsdir_SQ = $(subst ','\'',$(msgsdir))
+
+## Beginning of po-file creation rules
+XGETTEXT ?= xgettext
+PO_TEMPLATE = po/gitk.pot
+ALL_POFILES = $(wildcard po/*.po)
+ALL_MSGFILES = $(subst .po,.msg,$(ALL_POFILES))
+
+$(PO_TEMPLATE): gitk
+ $(XGETTEXT) -kmc -LTcl -o $@ gitk
+update-po:: $(PO_TEMPLATE)
+ $(foreach p, $(ALL_POFILES), echo Updating $p ; msgmerge -U $p $(PO_TEMPLATE) ; )
+$(ALL_MSGFILES): %.msg : %.po
+ @echo Generating catalog $@
+ msgfmt --statistics --tcl $< -l $(basename $(notdir $<)) -d $(dir $@)
+
+all:: $(ALL_MSGFILES)
+
+clean::
+ rm -f $(ALL_PROGRAMS) po/*.msg
+## End of po-file creation rules
+
+# Install rules for po-files
+install: all
+ $(QUIET)$(INSTALL_D0)'$(DESTDIR_SQ)$(msgsdir_SQ)' $(INSTALL_D1)
+ $(QUIET)$(foreach p,$(ALL_MSGFILES), $(INSTALL_R0)$p $(INSTALL_R1) '$(DESTDIR_SQ)$(msgsdir_SQ)' &&) true
+
--
1.5.2
^ permalink raw reply related
* Re: git-svn rebase screwing up commit messages
From: Junio C Hamano @ 2007-07-28 13:10 UTC (permalink / raw)
To: Sean; +Cc: Benoit SIGOURE, git
In-Reply-To: <20070728083536.540e471d.seanlkml@sympatico.ca>
Sean <seanlkml@sympatico.ca> writes:
>> Do you mean by "my commits in Git" a commit you created with git
>> in your git repository?
>
> Tested this here (rc3.24.g83b3d) and can confirm the reported problem.
> After making a commit in git and then running "git svn rebase" to
> receive updates from the svn repo, the rebased commit has a borked
> description (multi-lined commit message appears all on one line).
In short, your original commit log message is broken.
The recommended convention for commit messages is to start it
with a single line that describes what it does, followed by a
blank line (i.e. the first paragraph consists of a single line),
followed by a longer explanation of why the change brought by
the commit is a good thing.
Following this convention is recommended to make other peoples'
lives more pleasant, and git assumes you follow this convention
at several places. For example, "git log --pretty=oneline",
"git reflog", and "git show-branch" are ways to get concise
listing of commits; git-shortlog gives the list of such commit
titles in its output, omitting the longer explanation. Patches
prepared for e-mail exchange ("git format-patch", and
--pretty=email) use the title on the Subject: line of the
message.
The behaviour of these tools are _not_ the primarly reasons why
you are better off following the commit message convention. The
reason behind the behaviour of these tools is to help readers of
your commit messages. The punch line comes at the beginning,
single line short-and-sweet, and when readers want to get the
birds-eye view, that is the only thing they see.
Try them on a commit that has several lines in its first
paragraph and you will see why this is a good convention.
Until recently, we chomped a multi-line first paragraph at the
first line, and used the resulting partial sentence as the
title. This had an interesting effect on badly formatted commit
like this:
tree 2a003266ee6fda9305833a4f6e6dc7194018805a
parent fef221460121c8a1b9e242422d8b521fbd0f6dc0
author Junio C Hamano <gitster@pobox.com> 1185621830 -0700
committer Junio C Hamano <gitster@pobox.com> 1185621830 -0700
A long and unsightly commit
log message that has more than
one lines in the first paragraph
Such a first paragraph is flattened by --pretty=email
When this was formatted for e-mail, it resulted in something
like this:
From: Junio C Hamano <gitster@pobox.com>
Date: Sat, 28 Jul 2007 04:23:50 -0700
Subject: [PATCH] A long and unsightly commit
log message that has more than
one lines in the first paragraph
Such a first paragraph is flattened by --pretty=email
As rebase/am uses the same machinery as e-mailed patch
acceptance, the paragraph was chomped at the first line, while
normalizing it for other git commands' use, like this:
tree 842c159f584fd4f970b6aceed21f479c1b62e333
parent 57887443c24e5a2b4b04e7db69b44b53d8e87b44
author Junio C Hamano <gitster@pobox.com> 1185621830 -0700
committer Junio C Hamano <gitster@pobox.com> 1185626445 -0700
A long and unsightly commit
log message that has more than
one lines in the first paragraph
Such a first paragraph is flattened by --pretty=email
This would mean that "oneline" format will see only the initial
part of the sentence. If your message is properly formatted,
it is not a problem.
Recent enough git instead uses RFC2822 line-folding like this,
to help noncomforming messages somewhat:
From 4c04a94...
From: Junio C Hamano <gitster@pobox.com>
Date: Sat, 28 Jul 2007 04:23:50 -0700
Subject: [PATCH] A long and unsightly commit
log message that has more than
one lines in the first paragraph
Such a first paragraph is flattened by --pretty=email
But this has an interesting side effect itself. Such a folded
line is logically treated as a single line, and rebase/am makes
a commit like this out of such a message:
tree 842c159f584fd4f970b6aceed21f479c1b62e333
parent 57887443c24e5a2b4b04e7db69b44b53d8e87b44
author Junio C Hamano <gitster@pobox.com> 1185621830 -0700
committer Junio C Hamano <gitster@pobox.com> 1185626469 -0700
A long and unsightly commit log message that has more than one lines in the first paragraph
Such a first paragraph is flattened by --pretty=email
which is still unsightly (but the original message is unfriendly
to oneline summary format to begin with). At least, this is an
improvement in that the new formatting does not lose information
when viewed in "oneline" format.
Having said all that, so that the readers understand the
background, here is a not-so-heavily-tested patch, which might
help. It passes all the test suite as before, but that tells
how existing git-svn tests do not test many things.
I am not considering this for inclusion right now, by the way.
-- >8 --
Rebase/am: preserve multi-line first paragraph better.
This is actually three patches folded into one; as such it
should not be applied as-is. It needs to be split into:
* Changes to refs.c::log_ref_write() to sanitize embedded
newlines from the log message, instead of chomping it at the
first newline;
* Changes to symbolic-ref and update-ref, so that they do not
refuse a reflog message that has embedded newlines. They
have no business in dictating what the reflog message should
look like.
* Changes to builtin-mailinfo.c to preserve LF in Subject:
header, when it is folded using RFC2822 header folding.
With this, the first paragraph of a commit message that has
multiple lines is reproduced by "am" without being squashed into
a single line.
---
builtin-mailinfo.c | 29 +++++++++++++++++++++++------
builtin-symbolic-ref.c | 2 --
builtin-update-ref.c | 2 --
refs.c | 39 +++++++++++++++++++++++----------------
4 files changed, 46 insertions(+), 26 deletions(-)
diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
index b4f6e91..9d2064a 100644
--- a/builtin-mailinfo.c
+++ b/builtin-mailinfo.c
@@ -272,15 +272,15 @@ static char *cleanup_subject(char *subject)
}
}
-static void cleanup_space(char *buf)
+static void cleanup_space(char *buf, int keep_LF)
{
unsigned char c;
while ((c = *buf) != 0) {
buf++;
- if (isspace(c)) {
+ if (isspace(c) && (!keep_LF || c != '\n')) {
buf[-1] = ' ';
c = *buf;
- while (isspace(c)) {
+ while (isspace(c) && (!keep_LF || c != '\n')) {
int len = strlen(buf);
memmove(buf, buf+1, len);
c = *buf;
@@ -425,6 +425,7 @@ static int read_one_header_line(char *line, int sz, FILE *in)
if (addlen >= sz - len)
addlen = sz - len - 1;
memcpy(line + len, continuation, addlen);
+ line[len] = '\n';
len += addlen;
}
}
@@ -846,6 +847,22 @@ static void handle_body(void)
return;
}
+static void output_header_lines(FILE *fout, const char *hdr, char *data)
+{
+ while (1) {
+ char *ep = strchr(data, '\n');
+ int len;
+ if (!ep)
+ len = strlen(data);
+ else
+ len = ep - data;
+ fprintf(fout, "%s: %.*s\n", hdr, len, data);
+ if (!ep)
+ break;
+ data = ep + 1;
+ }
+}
+
static void handle_info(void)
{
char *sub;
@@ -864,14 +881,14 @@ static void handle_info(void)
if (!memcmp(header[i], "Subject", 7)) {
sub = cleanup_subject(hdr);
- cleanup_space(sub);
- fprintf(fout, "Subject: %s\n", sub);
+ cleanup_space(sub, 1);
+ output_header_lines(fout, "Subject", sub);
} else if (!memcmp(header[i], "From", 4)) {
handle_from(hdr);
fprintf(fout, "Author: %s\n", name);
fprintf(fout, "Email: %s\n", email);
} else {
- cleanup_space(hdr);
+ cleanup_space(hdr, 0);
fprintf(fout, "%s: %s\n", header[i], hdr);
}
}
diff --git a/builtin-symbolic-ref.c b/builtin-symbolic-ref.c
index d41b406..9eb95e5 100644
--- a/builtin-symbolic-ref.c
+++ b/builtin-symbolic-ref.c
@@ -43,8 +43,6 @@ int cmd_symbolic_ref(int argc, const char **argv, const char *prefix)
msg = argv[1];
if (!*msg)
die("Refusing to perform update with empty message");
- if (strchr(msg, '\n'))
- die("Refusing to perform update with \\n in message");
}
else if (!strcmp("--", arg)) {
argc--;
diff --git a/builtin-update-ref.c b/builtin-update-ref.c
index feac2ed..8339cf1 100644
--- a/builtin-update-ref.c
+++ b/builtin-update-ref.c
@@ -23,8 +23,6 @@ int cmd_update_ref(int argc, const char **argv, const char *prefix)
msg = argv[++i];
if (!*msg)
die("Refusing to perform update with empty message.");
- if (strchr(msg, '\n'))
- die("Refusing to perform update with \\n in message.");
continue;
}
if (!strcmp("-d", argv[i])) {
diff --git a/refs.c b/refs.c
index 2694e70..98e3202 100644
--- a/refs.c
+++ b/refs.c
@@ -1036,6 +1036,27 @@ void unlock_ref(struct ref_lock *lock)
free(lock);
}
+static int copy_msg(char *buf, const char *msg)
+{
+ char *cp = buf;
+ char c;
+ int wasspace = 1;
+
+ *cp++ = '\t';
+ while ((c = *msg++)) {
+ if (wasspace && isspace(c))
+ continue;
+ wasspace = isspace(c);
+ if (wasspace)
+ c = ' ';
+ *cp++ = c;
+ }
+ while (buf < cp && isspace(cp[-1]))
+ cp--;
+ *cp++ = '\n';
+ return cp - buf;
+}
+
static int log_ref_write(const char *ref_name, const unsigned char *old_sha1,
const unsigned char *new_sha1, const char *msg)
{
@@ -1080,21 +1101,7 @@ static int log_ref_write(const char *ref_name, const unsigned char *old_sha1,
adjust_shared_perm(log_file);
- msglen = 0;
- if (msg) {
- /* clean up the message and make sure it is a single line */
- for ( ; *msg; msg++)
- if (!isspace(*msg))
- break;
- if (*msg) {
- const char *ep = strchr(msg, '\n');
- if (ep)
- msglen = ep - msg;
- else
- msglen = strlen(msg);
- }
- }
-
+ msglen = msg ? strlen(msg) : 0;
committer = git_committer_info(-1);
maxlen = strlen(committer) + msglen + 100;
logrec = xmalloc(maxlen);
@@ -1103,7 +1110,7 @@ static int log_ref_write(const char *ref_name, const unsigned char *old_sha1,
sha1_to_hex(new_sha1),
committer);
if (msglen)
- len += sprintf(logrec + len - 1, "\t%.*s\n", msglen, msg) - 1;
+ len += copy_msg(logrec + len - 1, msg) - 1;
written = len <= maxlen ? write_in_full(logfd, logrec, len) : -1;
free(logrec);
if (close(logfd) != 0 || written != len)
^ permalink raw reply related
* Re: git-svn rebase screwing up commit messages
From: Sean @ 2007-07-28 13:29 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Benoit SIGOURE, git
In-Reply-To: <7vodhwptba.fsf@assigned-by-dhcp.cox.net>
On Sat, 28 Jul 2007 06:10:49 -0700
Junio C Hamano <gitster@pobox.com> wrote:
> In short, your original commit log message is broken.
>
> The recommended convention for commit messages is to start it
> with a single line that describes what it does, followed by a
> blank line (i.e. the first paragraph consists of a single line),
> followed by a longer explanation of why the change brought by
> the commit is a good thing.
That explains why I hadn't seen the problem before, since I
usually follow the commit message convention. For testing
purposes I had simply mashed the home row to add five or
six lines without thinking...
> Following this convention is recommended to make other peoples'
> lives more pleasant, and git assumes you follow this convention
> at several places. For example, "git log --pretty=oneline",
> "git reflog", and "git show-branch" are ways to get concise
> listing of commits; git-shortlog gives the list of such commit
> titles in its output, omitting the longer explanation. Patches
> prepared for e-mail exchange ("git format-patch", and
> --pretty=email) use the title on the Subject: line of the
> message.
Yes, Bisecting shows this "problem" was introduced in your
commit 4234a76167 which mentions that commit messages following
the normal convention would be unaffected.
...[SNIPPED]...
> Having said all that, so that the readers understand the
> background, here is a not-so-heavily-tested patch, which might
> help. It passes all the test suite as before, but that tells
> how existing git-svn tests do not test many things.
>
> I am not considering this for inclusion right now, by the way.
FWIW your patch fixed my test case here.
Cheers,
Sean
^ permalink raw reply
* Re: git-svn rebase screwing up commit messages
From: Junio C Hamano @ 2007-07-28 13:38 UTC (permalink / raw)
To: Sean; +Cc: Benoit SIGOURE, git
In-Reply-To: <20070728092914.48f6305c.seanlkml@sympatico.ca>
Sean <seanlkml@sympatico.ca> writes:
>> Having said all that, so that the readers understand the
>> background, here is a not-so-heavily-tested patch, which might
>> help. It passes all the test suite as before, but that tells
>> how existing git-svn tests do not test many things.
>>
>> I am not considering this for inclusion right now, by the way.
>
> FWIW your patch fixed my test case here.
Actually the patched behaviour actively encourages a bad (not in
the sense that those oneline tools will not work well, but in
the sense that these messages are reader unfriendly) practice; I
do not think what the patch did deserves to be called "fixed".
And that is one of the reasons, other than that we are in -rc
freeze that we do not add anything but unarguable fixes, that I
am not considering the patch for inclusion right now.
^ permalink raw reply
* Re: git-svn rebase screwing up commit messages
From: Sean @ 2007-07-28 14:11 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Benoit SIGOURE, git
In-Reply-To: <7vk5skps1g.fsf@assigned-by-dhcp.cox.net>
On Sat, 28 Jul 2007 06:38:19 -0700
Junio C Hamano <gitster@pobox.com> wrote:
> Actually the patched behaviour actively encourages a bad (not in
> the sense that those oneline tools will not work well, but in
> the sense that these messages are reader unfriendly) practice; I
> do not think what the patch did deserves to be called "fixed".
> And that is one of the reasons, other than that we are in -rc
> freeze that we do not add anything but unarguable fixes, that I
> am not considering the patch for inclusion right now.
>
First, i didn't read the patch and i have no stake at all in
non-conforming commit messages; i always follow the convention.
Having said that, the current behavior of Git crosses the line
from advocating the common commit message format into the realm
of not-working properly with non-conforming commit messages.
I would argue that you shouldn't try to have it both ways. Either
Git supports non-conforming message formats, in which case the
current behavior seems buggy. Or Git does not support commit
messages that deviate from the standard, in which case the
documentation should be updated to state so bluntly.
If handling email-mangled commit messages means that non-conforming
formats can no longer be fully supported (while discouraged) then
perhaps the time has come to explicitly state that people should
not expect Git to handle anything but the 1+empty+description
commit message format.
Sean
^ permalink raw reply
* [PATCH] gitweb: Show submodule entries in the 'tree' view
From: Jakub Narebski @ 2007-07-28 14:27 UTC (permalink / raw)
To: git; +Cc: Luben Tuikov, Petr Baudis, Jakub Narebski
Add S_ISGITLINK subroutine and S_IFGITLINK, S_IFINVALID constants.
Add support for "commit" (submodule) entries in the tree object to
mode_str ('m---------', following cgit), file_type and file_type_long
('submodule') subroutines.
There is only link to the history of submodule entry in the
supermodule (current repository) for now, because gitweb doesn't know
where to search for submodule repository objects.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
Tested on repositories from t/t3040-subprojects-basic.sh and
t/t7400-submodule-basic.sh tests.
The 'm---------' symbolic mode is taken from cgit, C CGI web interface
for git; see:
http://hjemli.net/git/cgit/tree
The S_ISGITLINK subroutine and S_IFGITLINK, S_IFINVALID constants
are taken from cache.h
gitweb/gitweb.perl | 38 +++++++++++++++++++++++++++++++++++---
1 files changed, 35 insertions(+), 3 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index b381692..1aceede 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -890,11 +890,25 @@ sub age_string {
return $age_str;
}
+use constant {
+ S_IFINVALID => 0030000,
+ S_IFGITLINK => 0160000,
+};
+
+# submodule/subproject, a commit object reference
+sub S_ISGITLINK($) {
+ my $mode = shift;
+
+ return (($mode & S_IFMT) == S_IFGITLINK)
+}
+
# convert file mode in octal to symbolic file mode string
sub mode_str {
my $mode = oct shift;
- if (S_ISDIR($mode & S_IFMT)) {
+ if (S_ISGITLINK($mode)) {
+ return 'm---------';
+ } elsif (S_ISDIR($mode & S_IFMT)) {
return 'drwxr-xr-x';
} elsif (S_ISLNK($mode)) {
return 'lrwxrwxrwx';
@@ -920,7 +934,9 @@ sub file_type {
$mode = oct $mode;
}
- if (S_ISDIR($mode & S_IFMT)) {
+ if (S_ISGITLINK($mode)) {
+ return "submodule";
+ } elsif (S_ISDIR($mode & S_IFMT)) {
return "directory";
} elsif (S_ISLNK($mode)) {
return "symlink";
@@ -941,7 +957,9 @@ sub file_type_long {
$mode = oct $mode;
}
- if (S_ISDIR($mode & S_IFMT)) {
+ if (S_ISGITLINK($mode)) {
+ return "submodule";
+ } elsif (S_ISDIR($mode & S_IFMT)) {
return "directory";
} elsif (S_ISLNK($mode)) {
return "symlink";
@@ -2707,6 +2725,20 @@ sub git_print_tree_entry {
"history");
}
print "</td>\n";
+ } else {
+ # unknown object: we can only present history for it
+ # (this includes 'commit' object, i.e. submodule support)
+ print "<td class=\"list\">" .
+ esc_path($t->{'name'}) .
+ "</td>\n";
+ print "<td class=\"link\">";
+ if (defined $hash_base) {
+ print $cgi->a({-href => href(action=>"history",
+ hash_base=>$hash_base,
+ file_name=>"$basedir$t->{'name'}")},
+ "history");
+ }
+ print "</td>\n";
}
}
--
1.5.2.4
^ permalink raw reply related
* [PATCH] gitweb: Simplify 'opt' parameter validation, add "no merges" feeds
From: Jakub Narebski @ 2007-07-28 14:27 UTC (permalink / raw)
To: git; +Cc: Luben Tuikov, Petr Baudis, Jakub Narebski
Simplify and make more readable validation of 'opt' (extra options)
parameter, using exists($hash{key}) instead of grepping keys of a hash
for value.
Move 'opt' parameter to be the last (for now) in the URL.
Make use of '--no-merges' extra option ('opt') by adding "no merges"
RSS and Atom feeds to the HTML header. Note that alternate format
links in the RSS and Atom views do not use '--no-merges' option yet!
Adds tests for the 'opt' parameter to t9500-gitweb-standalone-no-errors.sh
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
This patch could (and probablu should) be split into four separate
patches: simplify 'opt' parameter validation, move 'opt' parameter
to be last in the generated URL, add tests for 'opt' parameter, and
add an example of using 'opt' parameter in the form of feeds without
merges. But I wanted to avoid generating micro-commits.
This patch is based on 'master'.
gitweb/gitweb.perl | 17 ++++++++++++-----
t/t9500-gitweb-standalone-no-errors.sh | 28 ++++++++++++++++++++++++++++
2 files changed, 40 insertions(+), 5 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index b381692..668be42 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -436,12 +436,11 @@ my %allowed_options = (
our @extra_options = $cgi->param('opt');
if (defined @extra_options) {
- foreach(@extra_options)
- {
- if (not grep(/^$_$/, keys %allowed_options)) {
+ foreach my $opt (@extra_options) {
+ if (not exists $allowed_options{$opt}) {
die_error(undef, "Invalid option parameter");
}
- if (not grep(/^$action$/, @{$allowed_options{$_}})) {
+ if (not grep(/^$action$/, @{$allowed_options{$opt}})) {
die_error(undef, "Invalid option parameter for this action");
}
}
@@ -598,7 +597,6 @@ sub href(%) {
action => "a",
file_name => "f",
file_parent => "fp",
- extra_options => "opt",
hash => "h",
hash_parent => "hp",
hash_base => "hb",
@@ -608,6 +606,7 @@ sub href(%) {
searchtext => "s",
searchtype => "st",
snapshot_format => "sf",
+ extra_options => "opt",
);
my %mapping = @mapping;
@@ -2267,9 +2266,17 @@ EOF
printf('<link rel="alternate" title="%s log RSS feed" '.
'href="%s" type="application/rss+xml" />'."\n",
esc_param($project), href(action=>"rss"));
+ printf('<link rel="alternate" title="%s log RSS feed (no merges)" '.
+ 'href="%s" type="application/rss+xml" />'."\n",
+ esc_param($project), href(action=>"rss",
+ extra_options=>"--no-merges"));
printf('<link rel="alternate" title="%s log Atom feed" '.
'href="%s" type="application/atom+xml" />'."\n",
esc_param($project), href(action=>"atom"));
+ printf('<link rel="alternate" title="%s log Atom feed (no merges)" '.
+ 'href="%s" type="application/atom+xml" />'."\n",
+ esc_param($project), href(action=>"atom",
+ extra_options=>"--no-merges"));
} else {
printf('<link rel="alternate" title="%s projects list" '.
'href="%s" type="text/plain; charset=utf-8"/>'."\n",
diff --git a/t/t9500-gitweb-standalone-no-errors.sh b/t/t9500-gitweb-standalone-no-errors.sh
index d948724..fa32598 100755
--- a/t/t9500-gitweb-standalone-no-errors.sh
+++ b/t/t9500-gitweb-standalone-no-errors.sh
@@ -521,4 +521,32 @@ test_expect_success \
'gitweb_run "p=.git;a=log"'
test_debug 'cat gitweb.log'
+# ----------------------------------------------------------------------
+# extra options
+
+test_expect_success \
+ 'opt: log --no-merges' \
+ 'gitweb_run "p=.git;a=log;opt=--no-merges"'
+test_debug 'cat gitweb.log'
+
+test_expect_success \
+ 'opt: atom --no-merges' \
+ 'gitweb_run "p=.git;a=log;opt=--no-merges"'
+test_debug 'cat gitweb.log'
+
+test_expect_success \
+ 'opt: "file" history --no-merges' \
+ 'gitweb_run "p=.git;a=history;f=file;opt=--no-merges"'
+test_debug 'cat gitweb.log'
+
+test_expect_success \
+ 'opt: log --no-such-option (invalid option)' \
+ 'gitweb_run "p=.git;a=log;opt=--no-such-option"'
+test_debug 'cat gitweb.log'
+
+test_expect_success \
+ 'opt: tree --no-merges (invalid option for action)' \
+ 'gitweb_run "p=.git;a=tree;opt=--no-merges"'
+test_debug 'cat gitweb.log'
+
test_done
--
1.5.2.4
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox