* Re: [PATCH v3 11/12] Basic build infrastructure for Python scripts
From: Sverre Rabbelier @ 2009-11-06 23:25 UTC (permalink / raw)
To: Andrzej K. Haczewski
Cc: Git List, Johannes Schindelin, Daniel Barkalow, Johan Herland
In-Reply-To: <16cee31f0911061523v5b9754ebg9c846c0e96ac808@mail.gmail.com>
Heya,
On Sat, Nov 7, 2009 at 00:23, Andrzej K. Haczewski <ahaczewski@gmail.com> wrote:
> Does it mean, that it will be possible to write git-<cmd> scripts in
> python or, in example, port bash and / or perl scripts to python?
Technically that would be possible yes.
> I'm asking because bash+perl is a huge stopper for Windows platform,
> which requires basic unix environment to work, while python support
> for Windows is excellent and most of Windows developers already use
> python.
I don't know what the stance is on this though, currently it is
intended only for the remote helpers I think.
--
Cheers,
Sverre Rabbelier
^ permalink raw reply
* [gitk] [PATCH] 0/2 Merging master into dev
From: Pat Thoyts @ 2009-11-06 23:27 UTC (permalink / raw)
To: Paul Mackerras; +Cc: git, Johannes Schindelin
I've merged the current changes for gitk master onto the dev branch
and fixed some conflicts and then modified the default colour
assignments for windows to use the system colours so that it will pick
up the stock colours defined via the windows property pages.
However, I'm not too certain how to post such a merge commit. Usually
I do 'git format-patch -M' but in this case that emits all the commits
that were merged. It looks like 'git show -p' is producing a merge
patch so I am posting that for 1/2 and a normal patch for 2/2. If
there is better way let me know and I will redo.
Note: these patches are for the gitk dev branch.
Hopefully this themed tk version is suitable for merging up to master
soon as this will significantly improve the look of the application in
msysGit.
--
Pat Thoyts http://www.patthoyts.tk/
PGP fingerprint 2C 6E 98 07 2C 59 C8 97 10 CE 11 E6 04 E0 B9 DD
^ permalink raw reply
* [gitk] [PATCH] 1/2 Merging master into dev
From: Pat Thoyts @ 2009-11-06 23:27 UTC (permalink / raw)
To: Paul Mackerras; +Cc: git, Johannes Schindelin
commit 0dd59acf864aedc131e8b9daccc93afd8252a292
Merge: aa43561 8d84995
Author: Pat Thoyts <patthoyts@users.sourceforge.net>
Date: Fri Nov 6 15:35:48 2009 +0000
Merged master into dev
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
diff --cc gitk
index c0f38ad,db5ec54..6360077
--- a/gitk
+++ b/gitk
@@@ -1810,13 -1787,10 +1810,13 @@@ proc make_transient {window origin}
}
}
- proc show_error {w top msg} {
+ proc show_error {w top msg {mc mc}} {
+ global NS
+ if {![info exists NS]} {set NS ""}
+ if {[wm state $top] eq "withdrawn"} { wm deiconify $top }
message $w.m -text $msg -justify center -aspect 400
pack $w.m -side top -fill x -padx 20 -pady 20
- ${NS}::button $w.ok -default active -text [mc OK] -command "destroy $top"
- button $w.ok -text [$mc OK] -command "destroy $top"
++ ${NS}::button $w.ok -default active -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"
@@@ -2616,9 -2519,9 +2616,9 @@@ proc savestuff {w}
global maxwidth showneartags showlocalchanges
global viewname viewfiles viewargs viewargscmd viewperm nextviewnum
global cmitmode wrapcomment datetimeformat limitdiffs
- global colors bgcolor fgcolor diffcolors diffcontext selectbgcolor
+ global colors uicolor bgcolor fgcolor diffcolors diffcontext selectbgcolor
- global autoselect extdifftool perfile_attrs markbgcolor
- global hideremotes
+ global autoselect extdifftool perfile_attrs markbgcolor use_ttk
+ global hideremotes want_ttk
if {$stuffsaved} return
if {![winfo viewable .]} return
@@@ -2642,7 -2546,7 +2643,8 @@@
puts $f [list set showlocalchanges $showlocalchanges]
puts $f [list set datetimeformat $datetimeformat]
puts $f [list set limitdiffs $limitdiffs]
+ puts $f [list set want_ttk $want_ttk]
+ puts $f [list set uicolor $uicolor]
puts $f [list set bgcolor $bgcolor]
puts $f [list set fgcolor $fgcolor]
puts $f [list set colors $colors]
@@@ -10630,11 -10443,11 +10651,11 @@@ proc chg_fontparam {v sub op}
}
proc doprefs {} {
- global maxwidth maxgraphpct
+ global maxwidth maxgraphpct use_ttk NS
global oldprefs prefstop showneartags showlocalchanges
- global bgcolor fgcolor ctext diffcolors selectbgcolor markbgcolor
+ global uicolor bgcolor fgcolor ctext diffcolors selectbgcolor markbgcolor
global tabstop limitdiffs autoselect extdifftool perfile_attrs
- global hideremotes
+ global hideremotes want_ttk have_ttk
set top .gitkprefs
set prefstop $top
@@@ -10643,69 -10456,65 +10664,73 @@@
return
}
foreach v {maxwidth maxgraphpct showneartags showlocalchanges \
- limitdiffs tabstop perfile_attrs hideremotes} {
+ limitdiffs tabstop perfile_attrs hideremotes want_ttk} {
set oldprefs($v) [set $v]
}
- toplevel $top
+ ttk_toplevel $top
wm title $top [mc "Gitk preferences"]
make_transient $top .
- label $top.ldisp -text [mc "Commit list display options"]
+ ${NS}::label $top.ldisp -text [mc "Commit list display options"]
grid $top.ldisp - -sticky w -pady 10
- label $top.spacer -text " "
- label $top.maxwidthl -text [mc "Maximum graph width (lines)"] \
- -font optionfont
+ ${NS}::label $top.spacer -text " "
+ ${NS}::label $top.maxwidthl -text [mc "Maximum graph width (lines)"]
spinbox $top.maxwidth -from 0 -to 100 -width 4 -textvariable maxwidth
grid $top.spacer $top.maxwidthl $top.maxwidth -sticky w
- label $top.maxpctl -text [mc "Maximum graph width (% of pane)"] \
- -font optionfont
+ ${NS}::label $top.maxpctl -text [mc "Maximum graph width (% of pane)"]
spinbox $top.maxpct -from 1 -to 100 -width 4 -textvariable maxgraphpct
grid x $top.maxpctl $top.maxpct -sticky w
- checkbutton $top.showlocal -text [mc "Show local changes"] \
- -font optionfont -variable showlocalchanges
+ ${NS}::checkbutton $top.showlocal -text [mc "Show local changes"] \
+ -variable showlocalchanges
grid x $top.showlocal -sticky w
- checkbutton $top.autoselect -text [mc "Auto-select SHA1"] \
- -font optionfont -variable autoselect
+ ${NS}::checkbutton $top.autoselect -text [mc "Auto-select SHA1"] \
+ -variable autoselect
grid x $top.autoselect -sticky w
+ ${NS}::checkbutton $top.hideremotes -text [mc "Hide remote refs"] \
+ -variable hideremotes
+ grid x $top.hideremotes -sticky w
- label $top.ddisp -text [mc "Diff display options"]
+ ${NS}::label $top.ddisp -text [mc "Diff display options"]
grid $top.ddisp - -sticky w -pady 10
- label $top.tabstopl -text [mc "Tab spacing"] -font optionfont
+ ${NS}::label $top.tabstopl -text [mc "Tab spacing"]
spinbox $top.tabstop -from 1 -to 20 -width 4 -textvariable tabstop
grid x $top.tabstopl $top.tabstop -sticky w
- checkbutton $top.ntag -text [mc "Display nearby tags"] \
- -font optionfont -variable showneartags
+ ${NS}::checkbutton $top.ntag -text [mc "Display nearby tags"] \
+ -variable showneartags
grid x $top.ntag -sticky w
- checkbutton $top.hideremotes -text [mc "Hide remote refs"] \
- -font optionfont -variable hideremotes
- grid x $top.hideremotes -sticky w
- checkbutton $top.ldiff -text [mc "Limit diffs to listed paths"] \
- -font optionfont -variable limitdiffs
+ ${NS}::checkbutton $top.ldiff -text [mc "Limit diffs to listed paths"] \
+ -variable limitdiffs
grid x $top.ldiff -sticky w
- checkbutton $top.lattr -text [mc "Support per-file encodings"] \
- -font optionfont -variable perfile_attrs
+ ${NS}::checkbutton $top.lattr -text [mc "Support per-file encodings"] \
+ -variable perfile_attrs
grid x $top.lattr -sticky w
- entry $top.extdifft -textvariable extdifftool
- frame $top.extdifff
- label $top.extdifff.l -text [mc "External diff tool" ] -font optionfont \
- -padx 10
- button $top.extdifff.b -text [mc "Choose..."] -font optionfont \
- -command choose_extdiff
+ ${NS}::entry $top.extdifft -textvariable extdifftool
+ ${NS}::frame $top.extdifff
+ ${NS}::label $top.extdifff.l -text [mc "External diff tool" ]
+ ${NS}::button $top.extdifff.b -text [mc "Choose..."] -command choose_extdiff
pack $top.extdifff.l $top.extdifff.b -side left
- grid x $top.extdifff $top.extdifft -sticky w
+ pack configure $top.extdifff.l -padx 10
+ grid x $top.extdifff $top.extdifft -sticky ew
+
+ ${NS}::label $top.lgen -text [mc "General options"]
+ grid $top.lgen - -sticky w -pady 10
+ ${NS}::checkbutton $top.want_ttk -variable want_ttk \
+ -text [mc "Use themed widgets"]
+ if {$have_ttk} {
+ ${NS}::label $top.ttk_note -text [mc "(change requires restart)"]
+ } else {
+ ${NS}::label $top.ttk_note -text [mc "(currently unavailable)"]
+ }
+ grid x $top.want_ttk $top.ttk_note -sticky w
- label $top.cdisp -text [mc "Colors: press to choose"]
+ ${NS}::label $top.cdisp -text [mc "Colors: press to choose"]
grid $top.cdisp - -sticky w -pady 10
+ label $top.ui -padx 40 -relief sunk -background $uicolor
+ button $top.uibut -text [mc "Interface"] -font optionfont \
+ -command [list choosecolor uicolor {} $top.ui [mc "interface"] setui]
+ grid x $top.uibut $top.ui -sticky w
label $top.bg -padx 40 -relief sunk -background $bgcolor
- button $top.bgbut -text [mc "Background"] -font optionfont \
+ ${NS}::button $top.bgbut -text [mc "Background"] \
-command [list choosecolor bgcolor {} $top.bg [mc "background"] setbg]
grid x $top.bgbut $top.bg -sticky w
label $top.fg -padx 40 -relief sunk -background $fgcolor
^ permalink raw reply
* [gitk] [PATCH] 2/2 Merging master into dev
From: Pat Thoyts @ 2009-11-06 23:28 UTC (permalink / raw)
To: Paul Mackerras; +Cc: git, Johannes Schindelin
commit 2e67e0332adb6896df6e6a7d4d8aeff179d2b657
Author: Pat Thoyts <patthoyts@users.sourceforge.net>
Date: Fri Nov 6 22:19:09 2009 +0000
Default to the system colours on Windows
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
diff --git a/gitk b/gitk
index 6360077..e591d61 100755
--- a/gitk
+++ b/gitk
@@ -10726,7 +10726,7 @@ proc doprefs {} {
${NS}::label $top.cdisp -text [mc "Colors: press to choose"]
grid $top.cdisp - -sticky w -pady 10
label $top.ui -padx 40 -relief sunk -background $uicolor
- button $top.uibut -text [mc "Interface"] -font optionfont \
+ ${NS}::button $top.uibut -text [mc "Interface"] \
-command [list choosecolor uicolor {} $top.ui [mc "interface"] setui]
grid x $top.uibut $top.ui -sticky w
label $top.bg -padx 40 -relief sunk -background $bgcolor
@@ -11334,13 +11334,20 @@ if {[tk windowingsystem] eq "aqua"} {
}
set colors {green red blue magenta darkgrey brown orange}
-set uicolor grey85
-set bgcolor white
-set fgcolor black
+if {[tk windowingsystem] eq "win32"} {
+ set uicolor SystemButtonFace
+ set bgcolor SystemWindow
+ set fgcolor SystemButtonText
+ set selectbgcolor SystemHighlight
+} else {
+ set uicolor grey85
+ set bgcolor white
+ set fgcolor black
+ set selectbgcolor gray85
+}
set diffcolors {red "#00a000" blue}
set diffcontext 3
set ignorespace 0
-set selectbgcolor gray85
set markbgcolor "#e0e0ff"
set circlecolors {white blue gray blue blue}
^ permalink raw reply related
* Re: [PATCH] RFC Allow case insensitive search flag with git-grep for fixed-strings
From: Junio C Hamano @ 2009-11-07 0:00 UTC (permalink / raw)
To: Jeff King; +Cc: Brian Collins, git
In-Reply-To: <20091106101316.GA22549@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
> On Fri, Nov 06, 2009 at 02:00:11AM -0800, Junio C Hamano wrote:
>
>> But I didn't try hard to find out what _else_ we are depending on.
>
> It is not really _us_ depending on it. It is "things the user wants to
> do that _we_ support, but that their grep might not." So I don't think
> there is much point in enumerating features. If their system grep
> doesn't handle options that they want to use, then it won't work for
> them. If they don't use them, then they will be fine.
>
> Though "-e" might be the exception, as I think we might use it
> unconditionally. But something like "-F -i" really depends on whether
> the user wants to use it.
Yes and no.
Even though we currently punt on a few platforms for simplicity and build
with NO_EXTERNAL_GREP, we could check if the set of options given are
within the feature set of what the platform's grep understands and choose
to spawn "grep" unless some options that are unsupported are used, in
which case we fall back to the internal one.
We could certainly do something like this if it turns out to be a problem.
An invocation that does not use -F and -i together can still spawn
external grep if that is faster.
You are correct about "-e". Our NO_EXTERNAL_GREP on SunOS cannot be
avoided.
builtin-grep.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/builtin-grep.c b/builtin-grep.c
index 1df25b0..2905f64 100644
--- a/builtin-grep.c
+++ b/builtin-grep.c
@@ -357,6 +357,9 @@ static int external_grep(struct grep_opt *opt, const char **paths, int cached)
if (opt->extended || (opt->relative && opt->prefix_length))
return -1;
+ if (NO_GREP_FIXED_IGNORE_CASE &&
+ opt->fixed && (opt->regflags & REG_ICASE))
+ return -1;
len = nr = 0;
push_arg("grep");
if (opt->fixed)
^ permalink raw reply related
* [cgit PATCH] Close file descriptor on error in readfile()
From: Rys Sommefeldt @ 2009-11-07 2:01 UTC (permalink / raw)
To: git
Hi Lars,
My colleagues and I use cgit at work, and we've found that the scanning
process can consume all available fds pretty quickly on our cgit hosts,
because it doesn't close them properly on error. We have a few thousand
active repositories for cgit to scan, and we noticed it dying after a
certain amount.
I've attached a patch which should apply against current master,
although I developed it a while back on an older 0.8 version (sorry it
took so long to subscribe and send the patch in).
Cheers,
Rys Sommefeldt
---
From 6446cf839d2104cd40848e439bf97cd7fd6ccfee Mon Sep 17 00:00:00 2001
From: Rys Sommefeldt <rsommefeldt@plus.net>
Date: Fri, 6 Nov 2009 17:14:56 +0000
Subject: [PATCH] Close fd when done
---
shared.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/shared.c b/shared.c
index d7b2d5a..d5e54e6 100644
--- a/shared.c
+++ b/shared.c
@@ -404,14 +404,19 @@ int readfile(const char *path, char **buf, size_t
*size)
struct stat st;
fd = open(path, O_RDONLY);
- if (fd == -1)
+ if (fd == -1) {
+ close(fd);
return errno;
- if (fstat(fd, &st))
+ }
+ if (fstat(fd, &st)) {
+ close(fd);
return errno;
+ }
if (!S_ISREG(st.st_mode))
return EISDIR;
*buf = xmalloc(st.st_size + 1);
*size = read_in_full(fd, *buf, st.st_size);
(*buf)[*size] = '\0';
+ close(fd);
return (*size == st.st_size ? 0 : errno);
}
--
1.6.5.2
^ permalink raw reply related
* Re: [cgit PATCH] Close file descriptor on error in readfile()
From: Steven Noonan @ 2009-11-07 2:22 UTC (permalink / raw)
To: Rys Sommefeldt; +Cc: git
In-Reply-To: <4AF4D4EC.1040806@pixeltards.com>
On Fri, Nov 6, 2009 at 6:01 PM, Rys Sommefeldt <rys@pixeltards.com> wrote:
> Hi Lars,
>
> My colleagues and I use cgit at work, and we've found that the scanning
> process can consume all available fds pretty quickly on our cgit hosts,
> because it doesn't close them properly on error. We have a few thousand
> active repositories for cgit to scan, and we noticed it dying after a
> certain amount.
>
> I've attached a patch which should apply against current master, although I
> developed it a while back on an older 0.8 version (sorry it took so long to
> subscribe and send the patch in).
>
> Cheers,
>
> Rys Sommefeldt
> ---
>
> From 6446cf839d2104cd40848e439bf97cd7fd6ccfee Mon Sep 17 00:00:00 2001
> From: Rys Sommefeldt <rsommefeldt@plus.net>
> Date: Fri, 6 Nov 2009 17:14:56 +0000
> Subject: [PATCH] Close fd when done
>
> ---
> shared.c | 9 +++++++--
> 1 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/shared.c b/shared.c
> index d7b2d5a..d5e54e6 100644
> --- a/shared.c
> +++ b/shared.c
> @@ -404,14 +404,19 @@ int readfile(const char *path, char **buf, size_t
> *size)
> struct stat st;
>
> fd = open(path, O_RDONLY);
> - if (fd == -1)
> + if (fd == -1) {
> + close(fd);
> return errno;
> - if (fstat(fd, &st))
> + }
The above change looks bogus. If fd == -1, you close() it anyway?
> + if (fstat(fd, &st)) {
> + close(fd);
> return errno;
> + }
> if (!S_ISREG(st.st_mode))
> return EISDIR;
> *buf = xmalloc(st.st_size + 1);
> *size = read_in_full(fd, *buf, st.st_size);
> (*buf)[*size] = '\0';
> + close(fd);
> return (*size == st.st_size ? 0 : errno);
> }
> --
> 1.6.5.2
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply
* Re: [cgit PATCH] Close file descriptor on error in readfile()
From: Rys Sommefeldt @ 2009-11-07 2:26 UTC (permalink / raw)
To: Steven Noonan; +Cc: git
In-Reply-To: <f488382f0911061822y7d0b52d5sa5cf4b199554312f@mail.gmail.com>
Steven Noonan wrote:
> The above change looks bogus. If fd == -1, you close() it anyway?
>
Ah, of course, sorry. I'll redo the patch.
>> + if (fstat(fd, &st)) {
>> + close(fd);
>> return errno;
>> + }
>> if (!S_ISREG(st.st_mode))
>> return EISDIR;
>> *buf = xmalloc(st.st_size + 1);
>> *size = read_in_full(fd, *buf, st.st_size);
>> (*buf)[*size] = '\0';
>> + close(fd);
>> return (*size == st.st_size ? 0 : errno);
>> }
>> --
>> 1.6.5.2
>> --
>> To unsubscribe from this list: send the line "unsubscribe git" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
>>
> --
>
__________ Information from ESET NOD32 Antivirus, version of virus signature database 4580 (20091106) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com
^ permalink raw reply
* Re: gitk : french translation
From: Nicolas Sebrecht @ 2009-11-07 2:54 UTC (permalink / raw)
To: Emmanuel Trillaud; +Cc: Thomas Moulard, Git Mailing List, Nicolas Sebrecht
In-Reply-To: <9f50533b0911061259w54b57fcdo2c0b21e95dbbdc54@mail.gmail.com>
[
Please, conform to Documentation/SubmittingPatches of the git.git
project and send your patches inline to make the work for reviewers
easier.
Both of your patches lack the Signed-off-by but maybe you don't want
them to be merged?
]
The 06/11/09, Emmanuel Trillaud wrote:
> > Here is an updated translation with the following changes:
<...>
> > - make some consistency changes
> > * s/diff/différences/
> > * s/patch/correctif/ everywhere
I disagree here. Words like "diff", "commit", "patch", etc should be
kept as is. Translation of those terms make things harder for the users.
> > IMHO the most important should be to decide how to translate the git vocabulary.
> > The Subversion project has guidelines concerning that issue:
> > http://svn.collab.net/viewvc/svn/trunk/subversion/po/fr.po?revision=39920&view=markup
> > It may be a good idea to stick with what they are doing if possible.
No, no. SVN and Git vocabulary/operations are not identical (not only
for 'commit' as you stated). Please, don't make things harder than it
already is.
--
Nicolas Sebrecht
^ permalink raw reply
* Re: Preserving branches after merging on ancestor
From: Dilip M @ 2009-11-07 3:41 UTC (permalink / raw)
To: rhlee; +Cc: git
In-Reply-To: <1257520877359-3959325.post@n2.nabble.com>
On Fri, Nov 6, 2009 at 8:51 PM, rhlee <richard@webdezign.co.uk> wrote:
> Hi John, Björn and Eric,
>
> Thank you very much for your replies from which I gained a lot insight about
> git merging and different workflows.
>
> Yes, I have tried out --no-ff and it does the job for me. (Incidentally, doing
> that take it look neater in git gui as all the master nodes appear on top of
> each other. Using empty commits, the merged branches appear on top the master
> nodes in the graph.)
Thanks to Richard, John, Björn, and Eric.
I had a similar _confusion_ looking looking at graph. I always use "log --graph
--pretty=oneline". Now I have _opted_ to pull/merge with '--no-ff', to keep the
graph plain and simple for non-power users :)
-- Dilip
^ permalink raw reply
* [PATCH 0/4] Improve format-patch (mostly documentation)
From: Björn Gustavsson @ 2009-11-07 9:45 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano
Here is version 2 of my patch series to improve the consistency
between the documentation and implementation of format-patch.
It is implemented on top of Peff's recent commit to reinstate -p.
Björn Gustavsson (4):
format-patch: Always generate a patch
format-patch documentation: Remove diff options that are not useful
format-patch documentation: Fix formatting
format-patch: Add "--no-stat" as a synonym for "-p"
Documentation/diff-options.txt | 61 ++++++++++++++++++++++++------------
Documentation/git-format-patch.txt | 46 +++++++++++++-------------
builtin-log.c | 21 +++++++++---
t/t4014-format-patch.sh | 18 ++++++++++
4 files changed, 98 insertions(+), 48 deletions(-)
^ permalink raw reply
* [PATCH 1/4] format-patch: Always generate a patch
From: Björn Gustavsson @ 2009-11-07 9:51 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano
Jeff King recently reinstated -p to suppress the default diffstat
(as -p used to work before 68daa64, about 14 months ago).
However, -p is also needed in combination with certain options
(e.g. --stat or --numstat) in order to produce any patch at all.
The documentation does not mention this.
Since the purpose of format-patch is to produce a patch that
can be emailed, it does not make sense that certain combination
of options will suppress the generation of the patch itself.
Therefore:
* Update 'git format-patch' to always generate a patch.
* Since the --name-only, --name-status, and --check suppresses
the generation of the patch, disallow those options,
and remove the description of them in the documentation.
* Remove the reference to -p in the description of -U.
* Remove the descriptions of the options that are synonyms for -p
plus another option (--patch-with-raw and --patch-with-stat).
* While at it, slightly tweak the description of -p itself
to say that it generates "plain patches", so that you can
think of -p as "plain patch" as an mnemonic aid.
Signed-off-by: Björn Gustavsson <bgustavsson@gmail.com>
---
Compared to my previous patch, most of the changes are in
the commit message. It was straightforward to combine my
previous changes in the code with Peff's version. In the
documentation, -p is now included.
Documentation/diff-options.txt | 16 +++++++++++++---
builtin-log.c | 21 ++++++++++++++++-----
t/t4014-format-patch.sh | 18 ++++++++++++++++++
3 files changed, 47 insertions(+), 8 deletions(-)
diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index 9276fae..c58d085 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -14,7 +14,7 @@ endif::git-format-patch[]
ifdef::git-format-patch[]
-p::
- Generate patches without diffstat.
+ Generate plain patches without any diffstats.
endif::git-format-patch[]
ifndef::git-format-patch[]
@@ -27,14 +27,19 @@ endif::git-format-patch[]
-U<n>::
--unified=<n>::
Generate diffs with <n> lines of context instead of
- the usual three. Implies "-p".
+ the usual three.
+ifndef::git-format-patch[]
+ Implies "-p".
+endif::git-format-patch[]
--raw::
Generate the raw format.
{git-diff-core? This is the default.}
+ifndef::git-format-patch[]
--patch-with-raw::
Synonym for "-p --raw".
+endif::git-format-patch[]
--patience::
Generate a diff using the "patience diff" algorithm.
@@ -71,21 +76,24 @@ endif::git-format-patch[]
Output a condensed summary of extended header information
such as creations, renames and mode changes.
+ifndef::git-format-patch[]
--patch-with-stat::
Synonym for "-p --stat".
- {git-format-patch? This is the default.}
+endif::git-format-patch[]
-z::
NUL-line termination on output. This affects the --raw
output field terminator. Also output from commands such
as "git-log" will be delimited with NUL between commits.
+ifndef::git-format-patch[]
--name-only::
Show only names of changed files.
--name-status::
Show only names and status of changed files. See the description
of the `--diff-filter` option on what the status letters mean.
+endif::git-format-patch[]
--color::
Show colored diff.
@@ -115,11 +123,13 @@ override configuration settings.
Turn off rename detection, even when the configuration
file gives the default to do so.
+ifndef::git-format-patch[]
--check::
Warn if changes introduce trailing whitespace
or an indent that uses a space before a tab. Exits with
non-zero status if problems are found. Not compatible with
--exit-code.
+endif::git-format-patch[]
--full-index::
Instead of the first handful of characters, show the full
diff --git a/builtin-log.c b/builtin-log.c
index 7b91c91..9df8dac 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -925,6 +925,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
"show patch format instead of default (patch + stat)"),
OPT_BOOLEAN(0, "ignore-if-in-upstream", &ignore_if_in_upstream,
"don't include a patch matching a commit upstream"),
+ OPT_BOOLEAN('p', NULL, &use_patch_format,
+ "show patch format instead of default (patch + stat)"),
OPT_GROUP("Messaging"),
{ OPTION_CALLBACK, 0, "add-header", NULL, "header",
"add email header", PARSE_OPT_NONEG,
@@ -1030,11 +1032,20 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
if (argc > 1)
die ("unrecognized argument: %s", argv[1]);
- if (use_patch_format)
- rev.diffopt.output_format |= DIFF_FORMAT_PATCH;
- else if (!rev.diffopt.output_format ||
- rev.diffopt.output_format == DIFF_FORMAT_PATCH)
- rev.diffopt.output_format = DIFF_FORMAT_DIFFSTAT | DIFF_FORMAT_SUMMARY | DIFF_FORMAT_PATCH;
+ if (rev.diffopt.output_format & DIFF_FORMAT_NAME)
+ die("--name-only does not make sense");
+ if (rev.diffopt.output_format & DIFF_FORMAT_NAME_STATUS)
+ die("--name-status does not make sense");
+ if (rev.diffopt.output_format & DIFF_FORMAT_CHECKDIFF)
+ die("--check does not make sense");
+
+ if (!use_patch_format &&
+ (!rev.diffopt.output_format ||
+ rev.diffopt.output_format == DIFF_FORMAT_PATCH))
+ rev.diffopt.output_format = DIFF_FORMAT_DIFFSTAT | DIFF_FORMAT_SUMMARY;
+
+ /* Always generate a patch */
+ rev.diffopt.output_format |= DIFF_FORMAT_PATCH;
if (!DIFF_OPT_TST(&rev.diffopt, TEXT) && !no_binary_diff)
DIFF_OPT_SET(&rev.diffopt, BINARY);
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index cab6ce2..5689d59 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -536,4 +536,22 @@ test_expect_success 'format-patch --signoff' '
grep "^Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>"
'
+echo "fatal: --name-only does not make sense" > expect.name-only
+echo "fatal: --name-status does not make sense" > expect.name-status
+echo "fatal: --check does not make sense" > expect.check
+
+test_expect_success 'options no longer allowed for format-patch' '
+ test_must_fail git format-patch --name-only 2> output &&
+ test_cmp expect.name-only output &&
+ test_must_fail git format-patch --name-status 2> output &&
+ test_cmp expect.name-status output &&
+ test_must_fail git format-patch --check 2> output &&
+ test_cmp expect.check output'
+
+test_expect_success 'format-patch --numstat should produce a patch' '
+ git format-patch --numstat --stdout master..side |
+ grep "^diff --git a/" |
+ wc -l |
+ xargs test 6 = '
+
test_done
--
1.6.5.1.69.g36942
^ permalink raw reply related
* [PATCH 2/4] format-patch documentation: Remove diff options that are not useful
From: Björn Gustavsson @ 2009-11-07 9:52 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano
To simplify reading the documentation for format-patch, remove the
description of common diff options that are not useful for the
purpose of the command (i.e. "Prepare patches for e-mail submission").
Specifically, this removes the description of the following options:
--raw
-z
--color
--no-color
--color-words
--diff-filter
-S
--pickaxe-all
--pickaxe-regex
-R
--relative
--exit-code
--quiet
Signed-off-by: Björn Gustavsson <bgustavsson@gmail.com>
---
Documentation/diff-options.txt | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index c58d085..a03f1a7 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -32,9 +32,11 @@ ifndef::git-format-patch[]
Implies "-p".
endif::git-format-patch[]
+ifndef::git-format-patch[]
--raw::
Generate the raw format.
{git-diff-core? This is the default.}
+endif::git-format-patch[]
ifndef::git-format-patch[]
--patch-with-raw::
@@ -81,19 +83,18 @@ ifndef::git-format-patch[]
Synonym for "-p --stat".
endif::git-format-patch[]
+ifndef::git-format-patch[]
-z::
NUL-line termination on output. This affects the --raw
output field terminator. Also output from commands such
as "git-log" will be delimited with NUL between commits.
-ifndef::git-format-patch[]
--name-only::
Show only names of changed files.
--name-status::
Show only names and status of changed files. See the description
of the `--diff-filter` option on what the status letters mean.
-endif::git-format-patch[]
--color::
Show colored diff.
@@ -118,6 +119,7 @@ The regex can also be set via a diff driver or configuration option, see
linkgit:gitattributes[1] or linkgit:git-config[1]. Giving it explicitly
overrides any diff driver or configuration setting. Diff drivers
override configuration settings.
+endif::git-format-patch[]
--no-renames::
Turn off rename detection, even when the configuration
@@ -157,6 +159,7 @@ endif::git-format-patch[]
-C::
Detect copies as well as renames. See also `--find-copies-harder`.
+ifndef::git-format-patch[]
--diff-filter=[ACDMRTUXB*]::
Select only files that are Added (`A`), Copied (`C`),
Deleted (`D`), Modified (`M`), Renamed (`R`), have their
@@ -168,6 +171,7 @@ endif::git-format-patch[]
paths are selected if there is any file that matches
other criteria in the comparison; if there is no file
that matches other criteria, nothing is selected.
+endif::git-format-patch[]
--find-copies-harder::
For performance reasons, by default, `-C` option finds copies only
@@ -185,6 +189,7 @@ endif::git-format-patch[]
the number of rename/copy targets exceeds the specified
number.
+ifndef::git-format-patch[]
-S<string>::
Look for differences that introduce or remove an instance of
<string>. Note that this is different than the string simply
@@ -199,11 +204,13 @@ endif::git-format-patch[]
--pickaxe-regex::
Make the <string> not a plain string but an extended POSIX
regex to match.
+endif::git-format-patch[]
-O<orderfile>::
Output the patch in the order specified in the
<orderfile>, which has one shell glob pattern per line.
+ifndef::git-format-patch[]
-R::
Swap two inputs; that is, show differences from index or
on-disk file to tree contents.
@@ -215,6 +222,7 @@ endif::git-format-patch[]
not in a subdirectory (e.g. in a bare repository), you
can name which subdirectory to make the output relative
to by giving a <path> as an argument.
+endif::git-format-patch[]
-a::
--text::
@@ -239,6 +247,7 @@ endif::git-format-patch[]
Show the context between diff hunks, up to the specified number
of lines, thereby fusing hunks that are close to each other.
+ifndef::git-format-patch[]
--exit-code::
Make the program exit with codes similar to diff(1).
That is, it exits with 1 if there were differences and
@@ -246,6 +255,7 @@ endif::git-format-patch[]
--quiet::
Disable all output of the program. Implies --exit-code.
+endif::git-format-patch[]
--ext-diff::
Allow an external diff helper to be executed. If you set an
--
1.6.5.1.69.g36942
^ permalink raw reply related
* [PATCH 3/4] format-patch documentation: Fix formatting
From: Björn Gustavsson @ 2009-11-07 9:53 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano
Format git commands and options consistently using back quotes
(i.e. a fixed font in the resulting HTML document).
Signed-off-by: Björn Gustavsson <bgustavsson@gmail.com>
---
Documentation/diff-options.txt | 36 ++++++++++++++--------------
Documentation/git-format-patch.txt | 46 ++++++++++++++++++------------------
2 files changed, 41 insertions(+), 41 deletions(-)
diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index a03f1a7..9398329 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -29,7 +29,7 @@ endif::git-format-patch[]
Generate diffs with <n> lines of context instead of
the usual three.
ifndef::git-format-patch[]
- Implies "-p".
+ Implies `-p`.
endif::git-format-patch[]
ifndef::git-format-patch[]
@@ -40,7 +40,7 @@ endif::git-format-patch[]
ifndef::git-format-patch[]
--patch-with-raw::
- Synonym for "-p --raw".
+ Synonym for `-p --raw`.
endif::git-format-patch[]
--patience::
@@ -48,19 +48,19 @@ endif::git-format-patch[]
--stat[=width[,name-width]]::
Generate a diffstat. You can override the default
- output width for 80-column terminal by "--stat=width".
+ output width for 80-column terminal by `--stat=width`.
The width of the filename part can be controlled by
giving another width to it separated by a comma.
--numstat::
- Similar to \--stat, but shows number of added and
+ Similar to `\--stat`, but shows number of added and
deleted lines in decimal notation and pathname without
abbreviation, to make it more machine friendly. For
binary files, outputs two `-` instead of saying
`0 0`.
--shortstat::
- Output only the last line of the --stat format containing total
+ Output only the last line of the `--stat` format containing total
number of modified files, as well as number of added and deleted
lines.
@@ -68,11 +68,11 @@ endif::git-format-patch[]
Output the distribution of relative amount of changes (number of lines added or
removed) for each sub-directory. Directories with changes below
a cut-off percent (3% by default) are not shown. The cut-off percent
- can be set with "--dirstat=limit". Changes in a child directory is not
- counted for the parent directory, unless "--cumulative" is used.
+ can be set with `--dirstat=limit`. Changes in a child directory is not
+ counted for the parent directory, unless `--cumulative` is used.
--dirstat-by-file[=limit]::
- Same as --dirstat, but counts changed files instead of lines.
+ Same as `--dirstat`, but counts changed files instead of lines.
--summary::
Output a condensed summary of extended header information
@@ -80,14 +80,14 @@ endif::git-format-patch[]
ifndef::git-format-patch[]
--patch-with-stat::
- Synonym for "-p --stat".
+ Synonym for `-p --stat`.
endif::git-format-patch[]
ifndef::git-format-patch[]
-z::
- NUL-line termination on output. This affects the --raw
+ NUL-line termination on output. This affects the `--raw`
output field terminator. Also output from commands such
- as "git-log" will be delimited with NUL between commits.
+ as `git-log` will be delimited with NUL between commits.
--name-only::
Show only names of changed files.
@@ -139,16 +139,16 @@ endif::git-format-patch[]
line when generating patch format output.
--binary::
- In addition to --full-index, output "binary diff" that
- can be applied with "git apply".
+ In addition to `--full-index`, output a binary diff that
+ can be applied with `git-apply`.
--abbrev[=<n>]::
Instead of showing the full 40-byte hexadecimal object
name in diff-raw format output and diff-tree header
lines, show only a partial prefix. This is
- independent of --full-index option above, which controls
+ independent of the `--full-index` option above, which controls
the diff-patch output format. Non default number of
- digits can be specified with --abbrev=<n>.
+ digits can be specified with `--abbrev=<n>`.
-B::
Break complete rewrite changes into pairs of delete and create.
@@ -183,7 +183,7 @@ endif::git-format-patch[]
`-C` option has the same effect.
-l<num>::
- -M and -C options require O(n^2) processing time where n
+ The `-M` and `-C` options require O(n^2) processing time where n
is the number of potential rename/copy targets. This
option prevents rename/copy detection from running if
the number of rename/copy targets exceeds the specified
@@ -197,7 +197,7 @@ ifndef::git-format-patch[]
linkgit:gitdiffcore[7] for more details.
--pickaxe-all::
- When -S finds a change, show all the changes in that
+ When `-S` finds a change, show all the changes in that
changeset, not just the files that contain the change
in <string>.
@@ -254,7 +254,7 @@ ifndef::git-format-patch[]
0 means no differences.
--quiet::
- Disable all output of the program. Implies --exit-code.
+ Disable all output of the program. Implies `--exit-code`.
endif::git-format-patch[]
--ext-diff::
diff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt
index 687e667..f1fd0df 100644
--- a/Documentation/git-format-patch.txt
+++ b/Documentation/git-format-patch.txt
@@ -43,28 +43,28 @@ There are two ways to specify which commits to operate on.
The first rule takes precedence in the case of a single <commit>. To
apply the second rule, i.e., format everything since the beginning of
-history up until <commit>, use the '\--root' option: "git format-patch
-\--root <commit>". If you want to format only <commit> itself, you
-can do this with "git format-patch -1 <commit>".
+history up until <commit>, use the '\--root' option: `git format-patch
+\--root <commit>`. If you want to format only <commit> itself, you
+can do this with `git format-patch -1 <commit>`.
By default, each output file is numbered sequentially from 1, and uses the
first line of the commit message (massaged for pathname safety) as
-the filename. With the --numbered-files option, the output file names
+the filename. With the `--numbered-files` option, the output file names
will only be numbers, without the first line of the commit appended.
The names of the output files are printed to standard
-output, unless the --stdout option is specified.
+output, unless the `--stdout` option is specified.
-If -o is specified, output files are created in <dir>. Otherwise
+If `-o` is specified, output files are created in <dir>. Otherwise
they are created in the current working directory.
By default, the subject of a single patch is "[PATCH] First Line" and
the subject when multiple patches are output is "[PATCH n/m] First
-Line". To force 1/1 to be added for a single patch, use -n. To omit
-patch numbers from the subject, use -N
+Line". To force 1/1 to be added for a single patch, use `-n`. To omit
+patch numbers from the subject, use `-N`.
-If given --thread, 'git-format-patch' will generate In-Reply-To and
-References headers to make the second and subsequent patch mails appear
-as replies to the first mail; this also generates a Message-Id header to
+If given `--thread`, `git-format-patch` will generate `In-Reply-To` and
+`References` headers to make the second and subsequent patch mails appear
+as replies to the first mail; this also generates a `Message-Id` header to
reference.
OPTIONS
@@ -112,7 +112,7 @@ include::diff-options.txt[]
--attach[=<boundary>]::
Create multipart/mixed attachment, the first part of
which is the commit message and the patch itself in the
- second part, with "Content-Disposition: attachment".
+ second part, with `Content-Disposition: attachment`.
--no-attach::
Disable the creation of an attachment, overriding the
@@ -121,13 +121,13 @@ include::diff-options.txt[]
--inline[=<boundary>]::
Create multipart/mixed attachment, the first part of
which is the commit message and the patch itself in the
- second part, with "Content-Disposition: inline".
+ second part, with `Content-Disposition: inline`.
--thread[=<style>]::
--no-thread::
- Controls addition of In-Reply-To and References headers to
+ Controls addition of `In-Reply-To` and `References` headers to
make the second and subsequent mails appear as replies to the
- first. Also controls generation of the Message-Id header to
+ first. Also controls generation of the `Message-Id` header to
reference.
+
The optional <style> argument can be either `shallow` or `deep`.
@@ -136,16 +136,16 @@ series, where the head is chosen from the cover letter, the
`\--in-reply-to`, and the first patch mail, in this order. 'deep'
threading makes every mail a reply to the previous one.
+
-The default is --no-thread, unless the 'format.thread' configuration
-is set. If --thread is specified without a style, it defaults to the
+The default is `--no-thread`, unless the 'format.thread' configuration
+is set. If `--thread` is specified without a style, it defaults to the
style specified by 'format.thread' if any, or else `shallow`.
+
Beware that the default for 'git send-email' is to thread emails
-itself. If you want 'git format-patch' to take care of hreading, you
-will want to ensure that threading is disabled for 'git send-email'.
+itself. If you want `git format-patch` to take care of threading, you
+will want to ensure that threading is disabled for `git send-email`.
--in-reply-to=Message-Id::
- Make the first mail (or all the mails with --no-thread) appear as a
+ Make the first mail (or all the mails with `--no-thread`) appear as a
reply to the given Message-Id, which avoids breaking threads to
provide a new patch series.
@@ -160,16 +160,16 @@ will want to ensure that threading is disabled for 'git send-email'.
Instead of the standard '[PATCH]' prefix in the subject
line, instead use '[<Subject-Prefix>]'. This
allows for useful naming of a patch series, and can be
- combined with the --numbered option.
+ combined with the `--numbered` option.
--cc=<email>::
- Add a "Cc:" header to the email headers. This is in addition
+ Add a `Cc:` header to the email headers. This is in addition
to any configured headers, and may be used multiple times.
--add-header=<header>::
Add an arbitrary header to the email headers. This is in addition
to any configured headers, and may be used multiple times.
- For example, --add-header="Organization: git-foo"
+ For example, `--add-header="Organization: git-foo"`
--cover-letter::
In addition to the patches, generate a cover letter file
--
1.6.5.1.69.g36942
^ permalink raw reply related
* [PATCH 4/4] format-patch: Add "--no-stat" as a synonym for "-p"
From: Björn Gustavsson @ 2009-11-07 9:58 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano
"-p" means "generate patch" in 'git log' and 'git diff', so it's
quite surprising that it means "suppress diffstat" in
'git format-patch'.
Keep the "-p" option for backward compatibility, but add
"--no-stat" as a more intuitive synonym. For backward compatibility
with scripts, we must allow combinations of --stat and --no-stat.
Signed-off-by: Björn Gustavsson <bgustavsson@gmail.com>
---
This patch is new.
Unfortunately, we must allow --no-stat and --stat (or alternatively
complicate the implementation to allow -p and --stat, but not
--no-stat and --stat). If that seems too strange, perhaps we are
better off without this patch.
Documentation/diff-options.txt | 1 +
builtin-log.c | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index 9398329..c4d65ba 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -14,6 +14,7 @@ endif::git-format-patch[]
ifdef::git-format-patch[]
-p::
+--no-stat
Generate plain patches without any diffstats.
endif::git-format-patch[]
diff --git a/builtin-log.c b/builtin-log.c
index 9df8dac..968a038 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -925,7 +925,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
"show patch format instead of default (patch + stat)"),
OPT_BOOLEAN(0, "ignore-if-in-upstream", &ignore_if_in_upstream,
"don't include a patch matching a commit upstream"),
- OPT_BOOLEAN('p', NULL, &use_patch_format,
+ OPT_BOOLEAN('p', "no-stat", &use_patch_format,
"show patch format instead of default (patch + stat)"),
OPT_GROUP("Messaging"),
{ OPTION_CALLBACK, 0, "add-header", NULL, "header",
--
1.6.5.1.69.g36942
^ permalink raw reply related
* Re: [PATCHv5 2/5] gitweb: Incremental blame (using JavaScript)
From: Jakub Narebski @ 2009-11-07 11:04 UTC (permalink / raw)
To: Petr Baudis
Cc: git, Fredrik Kuivinen, Giuseppe Bilotta, Luben Tuikov,
Martin Koegler
In-Reply-To: <20091105202202.GC17748@machine.or.cz>
On Thu, 5 Nov 2009, Petr Baudis wrote:
>
> Many thanks for nurturing this patch.
You are welcome.
I have learned quite a bit about JavaScript when working on this
patch...
> On Tue, Sep 01, 2009 at 01:39:17PM +0200, Jakub Narebski wrote:
> > Roads not taken (perhaps that should be part of commit message?):
> > * Move most (or all) of "git blame --incremental" output parsing to
> > server side, and instead of sending direct output in text/plain,
> > send processed data in JSON format, e.g.
> >
> > {"commit": {
> > "sha1": "e83c5163316f89bfbde7d9ab23ca2e25604af290",
> > "info": "Kay Sievers, 2005-08-07 21:49:46 +0200",
> > "author-initials": "KS",
> > ...
> > },
> > "src-line": 13,
> > "dst-line": 16,
> > "numlines": 3,
> > "filename": "README"
> > }
> >
> > (line wrapping added for readibility). This would require however
> > taking care on Perl side to send properly formatted JSON, and on
> > JavaScript side including json2.js code to read JSON in gitweb.js
> > (unless we rely on eval).
>
> I don't know that much about web programming, what is wrong with
> relying on eval?
In general it is insecure. In this specific situation it shouldn't.
[...]
> > * Using some lightweight JavaScript library (framework), like jQuery,
> > Prototype, ExtJS, MooTools, etc. One one hand side this means not
> > having to worry about browser incompatibilities as this would be
> > taken care of by library; on the other hand side we want gitweb to
> > have as few dependences as possible.
>
> Normally, particular version of the library is simply included within
> the project. E.g. in Girocco, I use MooTools for the tiny bit of
> javascript I do. It is probably overkill to include it just for
> incremental blame, but if we ever do much more, I think the much easier
> web programming is worth the little trouble.
Alternate solution would be to load for example jQuery for example hosted
on Google as described in http://code.google.com/apis/ajaxlibs/documentation/
--
Jakub Narebski
Poland
^ permalink raw reply
* Re: [PATCH v3 11/12] Basic build infrastructure for Python scripts
From: Johannes Schindelin @ 2009-11-07 12:13 UTC (permalink / raw)
To: Sverre Rabbelier
Cc: Andrzej K. Haczewski, Git List, Daniel Barkalow, Johan Herland
In-Reply-To: <fabb9a1e0911061525n7c7ad7dl2d97d979a25335bf@mail.gmail.com>
Hi,
On Sat, 7 Nov 2009, Sverre Rabbelier wrote:
> On Sat, Nov 7, 2009 at 00:23, Andrzej K. Haczewski <ahaczewski@gmail.com> wrote:
>
> > I'm asking because bash+perl is a huge stopper for Windows platform,
> > which requires basic unix environment to work, while python support
> > for Windows is excellent and most of Windows developers already use
> > python.
>
> I don't know what the stance is on this though, currently it is intended
> only for the remote helpers I think.
Everybody who knows only a little bit about the history of msysGit knows
that Perl/Bash support was easy while Python seems to be impossible.
Before anybody says "but Python is Open Source, and available for
Windows": I will only listen when you have a script that builds Python
inside msysGit, not requiring a proprietary compiler nor Linux for a
cross-build.
Hth,
Dscho
^ permalink raw reply
* Re: [cgit PATCH] Close file descriptor on error in readfile()
From: Rys Sommefeldt @ 2009-11-07 12:23 UTC (permalink / raw)
To: git; +Cc: hjemli, steven
In-Reply-To: <4AF4D4EC.1040806@pixeltards.com>
All,
Sorry for the earlier HTML email, I'd misconfigured my mail client so
accept my apologies for that (and thanks Steven). Here's the reworked
patch:
From d928507bf4c8727c3848525f4744d7c8507de5e8 Mon Sep 17 00:00:00 2001
From: Rys Sommefeldt <rys@pixeltards.com>
Date: Sat, 7 Nov 2009 12:15:24 +0000
Subject: [PATCH] Close fd on error in readfile()
---
shared.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/shared.c b/shared.c
index d7b2d5a..a676fa3 100644
--- a/shared.c
+++ b/shared.c
@@ -406,12 +406,15 @@ int readfile(const char *path, char **buf, size_t
*size)
fd = open(path, O_RDONLY);
if (fd == -1)
return errno;
- if (fstat(fd, &st))
+ if (fstat(fd, &st)) {
+ close(fd);
return errno;
+ }
if (!S_ISREG(st.st_mode))
return EISDIR;
*buf = xmalloc(st.st_size + 1);
*size = read_in_full(fd, *buf, st.st_size);
(*buf)[*size] = '\0';
+ close(fd);
return (*size == st.st_size ? 0 : errno);
}
--
1.6.5.2
^ permalink raw reply related
* Helpers scripts to simplify work with submodules (git-sm-commit and git-sm-pull)
From: Pavel Pisa @ 2009-11-07 13:05 UTC (permalink / raw)
To: git; +Cc: Michal Sojka
Hello to all git developers and users,
we are dropping use of other SCMs for most of our projects
during time and switch to GIT. The actual one is uLan protocol
related stuff
http://sourceforge.net/projects/ulan/develop
git://ulan.git.sourceforge.net/gitroot/ulan/ulan
This project provided more libraries and targets support used
in other university and company projects. CVS allows to checkout
some subset/directory for use in such case. The GIT does not
support work with subtrees so we have split project into
multiple submodules, but actual GIT submodules support
makes committing and maintenance over whole tree a little painfull.
So there are hackish helper scripts which made us work simpler
and can be found usable by others as well
git-sm-pull - runs git pull (by default) or other option or shell specified
command
for all subprojects. It is not necessary to stay in the project top directory,
when invoked. If it can be instructed to work with top lever repository even
if current working directory is inside subproject directory if option -w
is specified.
http://ulan.git.sourceforge.net/git/gitweb.cgi?p=ulan/ulan-top;a=blob;f=scripts/git-sm-pull;hb=HEAD
Usage: git-sm-pull [options] [shell command]
-w --whole find top repository for whole project
-h --help help
-p --pull pull in all submodules
-P --push push in all submodules
-s --status status in all submodules
git-sm-pull - runs git gui (by default) or other option or shell specified
command
for all subproject where status reports that repository is not clean.
http://ulan.git.sourceforge.net/git/gitweb.cgi?p=ulan/ulan-top;a=blob;f=scripts/git-sm-commit;hb=HEAD
Usage: git-sm-commit [options] [shell command]
-h --help help
-w --whole find top repository for whole project
-m --message specify commit message on command line
-a --all commit all changes in tracked files
-s --status show status
The second stript can be used without parameters or with -w to do
select and commit changes interactively or if option -m and/or -a
are used int runs git commit. You can find quite strange trickeries
there to propagate correctly multiple word arguments through shell/bash
there so it works as expected.
git-sm-commit -> invokes GUI for modified submodules
and for top finally
git-sm-commit -a -m "my change" -> commits changes in all tracked files
in all submodules with provided message
and then does toplevel commit which
should ensure submodules versions tying
git-sm-commit qgit -> runs know fancy viewer for each modified
submodule and for top finally
The other git commands can be specified as well, so git-sm-commit
can be little misleading after script evolution from original single
purpose version, but commit preparation is it main use still.
Thanks for git and may it be that these scripts can be usable
for some other users,
Pavel Pisa
e-mail: pisa@cmp.felk.cvut.cz
www: http://cmp.felk.cvut.cz/~pisa
university: http://dce.felk.cvut.cz/
company: http://www.pikron.com/
^ permalink raw reply
* Re: Preserving branches after merging on ancestor
From: Björn Steinbrink @ 2009-11-07 13:28 UTC (permalink / raw)
To: rhlee; +Cc: git
In-Reply-To: <1257520877359-3959325.post@n2.nabble.com>
On 2009.11.06 07:21:17 -0800, rhlee wrote:
> Jonathan Nieder-2 wrote:
> >
> > Then your response pushed me towards the question of whether --no-ff is a
> > good idea in general
> >
>
> John, I get the feeling from what you say in general that fast forwards are
> default behaviour for merges for a reason and by using the --no-ff option I
> am making my workflow and git history uncessesarily awkward and working
> against best practices?
As Jonathan already said, there are pros and cons when the merge is
about merging topic branches to some "main" branch. In addition to that,
working with git often also involves other merges. For example, you
might have your private topic branch, on which you work on two different
boxes. So you push your topic branch to some private bare repo, fetch it
from the other box, work there, and push the result back to the bare
repo. And then, in the "original" repo, you of course want to update
your local branch head to reflect the new changes. So you fetch and
merge, but you really don't want a merge commit in that case, but the
default fast-forward behaviour. In some sense, that kind of "merge", is
more like an "update", for which the fast-forward behaviour is simply
better.
> Jonathan Nieder-2 wrote:
> >
> >> I guess Richard took the "branch topic1, merge topic1, branch topic2,
> >> merge topic2" thing just as an example because that ends up with two
> >> fast-forwards.
> >
> > Hmm, I found Richard’s example pretty realistic. I used to work like
> > that, and I don’t think I am the only one.
> >
>
> I'm not saying there is any one "right" workflow. But is there a more
> suitable workflow than than "branch topic1, merge topic1, branch topic2,
> merge topic2"?
That order of commands looks like a strict "Start a topic, finish a
topic, merge it, start next topic, ..." workflow. And that severely
limits what you can do, as you're forced to work on only one thing and
to finish it first before starting something else. Such a strict
workflow basically makes branching pointless. I often do things like:
git checkout -b new_feature master
*work & commit*
*get a bug report about the stable version*
git checkout -b bug_fix_foo maint
*work & commit*
*get a report about a trivial bug on master*
git checkout master
*fix bug & commit* # Yes, directly on master
git push
git checkout bug_fix_foo
*finish the bug_fix*
git checkout maint
git merge bug_fix_foo # Merge the bugfix to the oldest branch it applies to
git checkout master
git merge maint # Merge bugfixes forward to the more recent branches
git push
git checkout new_feature
*finish feature*
git checkout master
git merge new_feature
git push
So I could work on multiple things at the same time, and even merged
them in reverse order, compared to the order in which I started the
branches. It's just the strict "start, finish, merge, start next, ..."
order that looks suspicious, but that's totally unrelated to the --no-ff
thing. Even when working on multiple branches and merging them in a
random order, you can hit a fast-forward for the "first" merge.
Björn
^ permalink raw reply
* Re: Preserving branches after merging on ancestor
From: Björn Steinbrink @ 2009-11-07 13:31 UTC (permalink / raw)
To: Dilip M; +Cc: rhlee, git
In-Reply-To: <c94f8e120911061941l1fb62d84g9a5ba3f1a00d9156@mail.gmail.com>
On 2009.11.07 09:11:11 +0530, Dilip M wrote:
> On Fri, Nov 6, 2009 at 8:51 PM, rhlee <richard@webdezign.co.uk> wrote:
>
> > Hi John, Björn and Eric,
> >
> > Thank you very much for your replies from which I gained a lot
> > insight about git merging and different workflows.
> >
> > Yes, I have tried out --no-ff and it does the job for me.
> > (Incidentally, doing that take it look neater in git gui as all the
> > master nodes appear on top of each other. Using empty commits, the
> > merged branches appear on top the master nodes in the graph.)
>
> Thanks to Richard, John, Björn, and Eric.
>
> I had a similar _confusion_ looking looking at graph. I always use
> "log --graph --pretty=oneline". Now I have _opted_ to pull/merge with
> '--no-ff', to keep the graph plain and simple for non-power users :)
Just be careful with that. There are situations in which you clearly
don't want --no-ff, see the "working on a topic branch on multiple
boxes" example I gave in the mail I sent a minute ago. ;-)
Björn
^ permalink raw reply
* Re: [cgit PATCH] Close file descriptor on error in readfile()
From: Lars Hjemli @ 2009-11-07 14:59 UTC (permalink / raw)
To: Rys Sommefeldt; +Cc: git, steven
In-Reply-To: <4AF566C9.5090106@pixeltards.com>
On Sat, Nov 7, 2009 at 13:23, Rys Sommefeldt <rys@pixeltards.com> wrote:
> Sorry for the earlier HTML email, I'd misconfigured my mail client so accept
> my apologies for that (and thanks Steven). Here's the reworked patch:
Thanks. I've applied the following to my stable branch:
diff --git a/shared.c b/shared.c
index d7b2d5a..a27ab30 100644
--- a/shared.c
+++ b/shared.c
@@ -406,12 +406,17 @@ int readfile(const char *path, char **buf, size_t *size)
fd = open(path, O_RDONLY);
if (fd == -1)
return errno;
- if (fstat(fd, &st))
+ if (fstat(fd, &st)) {
+ close(fd);
return errno;
- if (!S_ISREG(st.st_mode))
+ }
+ if (!S_ISREG(st.st_mode)) {
+ close(fd);
return EISDIR;
+ }
*buf = xmalloc(st.st_size + 1);
*size = read_in_full(fd, *buf, st.st_size);
(*buf)[*size] = '\0';
+ close(fd);
return (*size == st.st_size ? 0 : errno);
}
--
larsh
^ permalink raw reply related
* [PATCHv2 0/3] gitweb: Smarter snapshot names
From: Jakub Narebski @ 2009-11-07 15:13 UTC (permalink / raw)
To: git; +Cc: Mark Rada, Jakub Narebski
This is the replacement for 'mr/gitweb-snapshot' branch (aba1076),
currently in 'pu'.
Compared to previous series the t9502-gitweb-standalone-parse-output
test is created in earlier commit, to better show changes in snapshot
behaviour in "gitweb: Smarter snapshot names".
The first commit in series is identical to the one in previous version
of this series. Changes in last commit in series are only about
tests.
Shortlog:
~~~~~~~~~
Jakub Narebski (2):
t/gitweb-lib.sh: Split gitweb output into headers and body
gitweb: Document current snapshot rules via new tests
Mark Rada (1):
gitweb: Smarter snapshot names
Table of contents:
~~~~~~~~~~~~~~~~~~
[PATCH 1/3] t/gitweb-lib.sh: Split gitweb output into headers and body
[PATCH 2/3] gitweb: Document current snapshot rules via new tests
[PATCH 3/3] gitweb: Smarter snapshot names
Diffstat:
~~~~~~~~~
gitweb/gitweb.perl | 76 +++++++++++++++----
t/gitweb-lib.sh | 6 +-
t/t9502-gitweb-standalone-parse-output.sh | 115 +++++++++++++++++++++++++++++
3 files changed, 180 insertions(+), 17 deletions(-)
create mode 100755 t/t9502-gitweb-standalone-parse-output.sh
--
Jakub Narebski
Poland
^ permalink raw reply
* [PATCH 1/3] t/gitweb-lib.sh: Split gitweb output into headers and body
From: Jakub Narebski @ 2009-11-07 15:13 UTC (permalink / raw)
To: git; +Cc: Mark Rada, Jakub Narebski
In-Reply-To: <1257606809-23287-1-git-send-email-jnareb@gmail.com>
Save HTTP headers into gitweb.headers, and the body of message into
gitweb.body in gitweb_run()
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
This version is identical to the one in previous version of this
series.
I hope that this use of sed is portable enough.
Please take into account that HTTP headers part contains at least one
line: HTTP status.
t/gitweb-lib.sh | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/t/gitweb-lib.sh b/t/gitweb-lib.sh
index 8452532..32b841d
--- a/t/gitweb-lib.sh
+++ b/t/gitweb-lib.sh
@@ -52,10 +52,14 @@ gitweb_run () {
rm -f gitweb.log &&
perl -- "$SCRIPT_NAME" \
>gitweb.output 2>gitweb.log &&
+ sed -e '/^\r$/q' <gitweb.output >gitweb.headers &&
+ sed -e '1,/^\r$/d' <gitweb.output >gitweb.body &&
if grep '^[[]' gitweb.log >/dev/null 2>&1; then false; else true; fi
# gitweb.log is left for debugging
- # gitweb.output is used to parse http output
+ # gitweb.output is used to parse HTTP output
+ # gitweb.headers contains only HTTP headers
+ # gitweb.body contains body of message, without headers
}
. ./test-lib.sh
--
1.6.5
^ permalink raw reply related
* [PATCHv7 3/3] gitweb: Smarter snapshot names
From: Jakub Narebski @ 2009-11-07 15:13 UTC (permalink / raw)
To: git; +Cc: Mark Rada, Shawn O. Pearce, Jakub Narebski
In-Reply-To: <1257606809-23287-1-git-send-email-jnareb@gmail.com>
From: Mark Rada <marada@uwaterloo.ca>
Teach gitweb how to produce nicer snapshot names by only using the
short hash id. If clients make requests using a tree-ish that is not
a partial or full SHA-1 hash, then the short hash will also be appended
to whatever they asked for. If clients request snapshot of a tag
(which means that $hash ('h') parameter has 'refs/tags/' prefix),
use only tag name.
Update tests cases in t9502-gitweb-standalone-parse-output.
Gitweb uses the following format for snapshot filenames:
<sanitized project name>-<version info>.<snapshot suffix>
where <sanitized project name> is project name with '.git' or '/.git'
suffix stripped, unless '.git' is the whole project name. For
snapshot prefix it uses:
<sanitized project name>-<version info>/
as compared to <sanitized project name>/ before (without version info).
Current rules for <version info>:
* if 'h' / $hash parameter is SHA-1 or shortened SHA-1, use SHA-1
shortened to to 7 characters
* otherwise if 'h' / $hash parameter is tag name (it begins with
'refs/tags/' prefix, use tag name (with 'refs/tags/' stripped
* otherwise if 'h' / $hash parameter starts with 'refs/heads/' prefix,
strip this prefix, convert '/' into '.', and append shortened SHA-1
after '-', i.e. use <sanitized hash>-<shortened sha1>
Signed-off-by: Mark Rada <marada@uwaterloo.ca>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
Changes since v6:
- use check_snapshot function to test snapshots; therefore separate
test checking archive prefix is not needed any more
- fixed checking that hierarchical branch names work correctly
gitweb/gitweb.perl | 76 +++++++++++++++++++++++------
t/t9502-gitweb-standalone-parse-output.sh | 38 ++++++++++++--
2 files changed, 93 insertions(+), 21 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 8d4a2ae..d8dfd95 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1983,16 +1983,27 @@ sub quote_command {
# get HEAD ref of given project as hash
sub git_get_head_hash {
- my $project = shift;
+ return git_get_full_hash(shift, 'HEAD');
+}
+
+sub git_get_full_hash {
+ return git_get_hash(@_);
+}
+
+sub git_get_short_hash {
+ return git_get_hash(@_, '--short=7');
+}
+
+sub git_get_hash {
+ my ($project, $hash, @options) = @_;
my $o_git_dir = $git_dir;
my $retval = undef;
$git_dir = "$projectroot/$project";
- if (open my $fd, "-|", git_cmd(), "rev-parse", "--verify", "HEAD") {
- my $head = <$fd>;
+ if (open my $fd, '-|', git_cmd(), 'rev-parse',
+ '--verify', '-q', @options, $hash) {
+ $retval = <$fd>;
+ chomp $retval if defined $retval;
close $fd;
- if (defined $head && $head =~ /^([0-9a-fA-F]{40})$/) {
- $retval = $1;
- }
}
if (defined $o_git_dir) {
$git_dir = $o_git_dir;
@@ -5179,6 +5190,43 @@ sub git_tree {
git_footer_html();
}
+sub snapshot_name {
+ my ($project, $hash) = @_;
+
+ # path/to/project.git -> project
+ # path/to/project/.git -> project
+ my $name = to_utf8($project);
+ $name =~ s,([^/])/*\.git$,$1,;
+ $name = basename($name);
+ # sanitize name
+ $name =~ s/[[:cntrl:]]/?/g;
+
+ my $ver = $hash;
+ if ($hash =~ /^[0-9a-fA-F]+$/) {
+ # shorten SHA-1 hash
+ my $full_hash = git_get_full_hash($project, $hash);
+ if ($full_hash =~ /^$hash/ && length($hash) > 7) {
+ $ver = git_get_short_hash($project, $hash);
+ }
+ } elsif ($hash =~ m!^refs/tags/(.*)$!) {
+ # tags don't need shortened SHA-1 hash
+ $ver = $1;
+ } else {
+ # branches and other need shortened SHA-1 hash
+ if ($hash =~ m!^refs/(?:heads|remotes)/(.*)$!) {
+ $ver = $1;
+ }
+ $ver .= '-' . git_get_short_hash($project, $hash);
+ }
+ # in case of hierarchical branch names
+ $ver =~ s!/!.!g;
+
+ # name = project-version_string
+ $name = "$name-$ver";
+
+ return wantarray ? ($name, $name) : $name;
+}
+
sub git_snapshot {
my $format = $input_params{'snapshot_format'};
if (!@snapshot_fmts) {
@@ -5203,24 +5251,20 @@ sub git_snapshot {
die_error(400, 'Object is not a tree-ish');
}
- my $name = $project;
- $name =~ s,([^/])/*\.git$,$1,;
- $name = basename($name);
- my $filename = to_utf8($name);
- $name =~ s/\047/\047\\\047\047/g;
- my $cmd;
- $filename .= "-$hash$known_snapshot_formats{$format}{'suffix'}";
- $cmd = quote_command(
+ my ($name, $prefix) = snapshot_name($project, $hash);
+ my $filename = "$name$known_snapshot_formats{$format}{'suffix'}";
+ my $cmd = quote_command(
git_cmd(), 'archive',
"--format=$known_snapshot_formats{$format}{'format'}",
- "--prefix=$name/", $hash);
+ "--prefix=$prefix/", $hash);
if (exists $known_snapshot_formats{$format}{'compressor'}) {
$cmd .= ' | ' . quote_command(@{$known_snapshot_formats{$format}{'compressor'}});
}
+ $filename =~ s/(["\\])/\\$1/g;
print $cgi->header(
-type => $known_snapshot_formats{$format}{'type'},
- -content_disposition => 'inline; filename="' . "$filename" . '"',
+ -content_disposition => 'inline; filename="' . $filename . '"',
-status => '200 OK');
open my $fd, "-|", $cmd
diff --git a/t/t9502-gitweb-standalone-parse-output.sh b/t/t9502-gitweb-standalone-parse-output.sh
index 741187b..dd83890 100755
--- a/t/t9502-gitweb-standalone-parse-output.sh
+++ b/t/t9502-gitweb-standalone-parse-output.sh
@@ -56,29 +56,57 @@ test_debug '
test_expect_success 'snapshot: full sha1' '
gitweb_run "p=.git;a=snapshot;h=$FULL_ID;sf=tar" &&
- check_snapshot ".git-$FULL_ID" ".git"
+ check_snapshot ".git-$SHORT_ID"
'
test_debug 'cat gitweb.headers && cat file_list'
test_expect_success 'snapshot: shortened sha1' '
gitweb_run "p=.git;a=snapshot;h=$SHORT_ID;sf=tar" &&
- check_snapshot ".git-$SHORT_ID" ".git"
+ check_snapshot ".git-$SHORT_ID"
+'
+test_debug 'cat gitweb.headers && cat file_list'
+
+test_expect_success 'snapshot: almost full sha1' '
+ ID=$(git rev-parse --short=30 HEAD) &&
+ gitweb_run "p=.git;a=snapshot;h=$ID;sf=tar" &&
+ check_snapshot ".git-$SHORT_ID"
'
test_debug 'cat gitweb.headers && cat file_list'
test_expect_success 'snapshot: HEAD' '
gitweb_run "p=.git;a=snapshot;h=HEAD;sf=tar" &&
- check_snapshot ".git-HEAD" ".git"
+ check_snapshot ".git-HEAD-$SHORT_ID"
'
test_debug 'cat gitweb.headers && cat file_list'
test_expect_success 'snapshot: short branch name (master)' '
gitweb_run "p=.git;a=snapshot;h=master;sf=tar" &&
- check_snapshot ".git-master" ".git"
+ ID=$(git rev-parse --verify --short=7 master) &&
+ check_snapshot ".git-master-$ID"
+'
+test_debug 'cat gitweb.headers && cat file_list'
+
+test_expect_success 'snapshot: short tag name (first)' '
+ gitweb_run "p=.git;a=snapshot;h=first;sf=tar" &&
+ ID=$(git rev-parse --verify --short=7 first) &&
+ check_snapshot ".git-first-$ID"
+'
+test_debug 'cat gitweb.headers && cat file_list'
+
+test_expect_success 'snapshot: full branch name (refs/heads/master)' '
+ gitweb_run "p=.git;a=snapshot;h=refs/heads/master;sf=tar" &&
+ ID=$(git rev-parse --verify --short=7 master) &&
+ check_snapshot ".git-master-$ID"
+'
+test_debug 'cat gitweb.headers && cat file_list'
+
+test_expect_success 'snapshot: full tag name (refs/tags/first)' '
+ gitweb_run "p=.git;a=snapshot;h=refs/tags/first;sf=tar" &&
+ check_snapshot ".git-first"
'
test_debug 'cat gitweb.headers && cat file_list'
-test_expect_failure 'snapshot: hierarchical branch name (xx/test)' '
+test_expect_success 'snapshot: hierarchical branch name (xx/test)' '
gitweb_run "p=.git;a=snapshot;h=xx/test;sf=tar" &&
! grep "filename=.*/" gitweb.headers
'
--
1.6.5
^ 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