* 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
* 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: [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
* 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: [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
* [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
* [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 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 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 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
* 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
* 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: [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: [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
* [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: [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
* [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
* [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] 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
* 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
* Re: [PATCH v3 11/12] Basic build infrastructure for Python scripts
From: Andrzej K. Haczewski @ 2009-11-06 23:23 UTC (permalink / raw)
To: Sverre Rabbelier
Cc: Git List, Johannes Schindelin, Daniel Barkalow, Johan Herland
In-Reply-To: <1257547966-14603-12-git-send-email-srabbelier@gmail.com>
Hi,
2009/11/6 Sverre Rabbelier <srabbelier@gmail.com>:
> This patch adds basic boilerplate support (based on corresponding Perl
> sections) for enabling the building and installation Python scripts.
>
> There are currently no Python scripts being built, and when Python
> scripts are added in future patches, their building and installation
> can be disabled by defining NO_PYTHON.
>
> Signed-off-by: Johan Herland <johan@herland.net>
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?
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.
--
Andrzej
^ permalink raw reply
* Re: [PATCH v3 08/12] Allow helper to map private ref names into normal names
From: Sverre Rabbelier @ 2009-11-06 23:19 UTC (permalink / raw)
To: Daniel Barkalow; +Cc: Git List, Johannes Schindelin, Johan Herland
In-Reply-To: <alpine.LNX.2.00.0911061755360.14365@iabervon.org>
Heya,
On Sat, Nov 7, 2009 at 00:12, Daniel Barkalow <barkalow@iabervon.org> wrote:
> At the very least, it needs documentation and memory leaks fixed (the
> refspec strings read from the helper, and the refspec structs and array on
> freeing the helper data).
Please send follow-ups against [0] and I will include them in the next round :).
> Is this actually working with your helper? Occasionally I write code that
> just works without any testing, but I don't usually expect it. :)
Not unless it has some very subtle bugs, it seems to work perfectly on
my helper.
[0] git://github.com/SRabbelier/git.git
--
Cheers,
Sverre Rabbelier
^ permalink raw reply
* Re: [PATCH v3 08/12] Allow helper to map private ref names into normal names
From: Daniel Barkalow @ 2009-11-06 23:12 UTC (permalink / raw)
To: Sverre Rabbelier; +Cc: Git List, Johannes Schindelin, Johan Herland
In-Reply-To: <1257547966-14603-9-git-send-email-srabbelier@gmail.com>
On Fri, 6 Nov 2009, Sverre Rabbelier wrote:
> From: Daniel Barkalow <barkalow@iabervon.org>
>
> This allows a helper to say that, when it handles "import
> refs/heads/topic", the script it outputs will actually write to
> refs/svn/origin/branches/topic; therefore, transport-helper should
> read it from the latter location after git-fast-import completes.
> ---
>
> New in this series.
> Daniel, you did not include a S-o-b, I assume because you
> mean to add documentation?
I wasn't terribly convinced I'd actually implemented it correctly, since I
couldn't test it essentially at all; I was just going for something that
gave the right idea.
At the very least, it needs documentation and memory leaks fixed (the
refspec strings read from the helper, and the refspec structs and array on
freeing the helper data).
Is this actually working with your helper? Occasionally I write code that
just works without any testing, but I don't usually expect it. :)
-Daniel
*This .sig left intentionally blank*
^ permalink raw reply
* [PATCH v3 04/12] Allow fetch to modify refs
From: Sverre Rabbelier @ 2009-11-06 22:52 UTC (permalink / raw)
To: Git List, Johannes Schindelin, Daniel Barkalow, Johan Herland
Cc: Daniel Barkalow, Sverre Rabbelier
In-Reply-To: <1257547966-14603-4-git-send-email-srabbelier@gmail.com>
From: Daniel Barkalow <barkalow@iabervon.org>
This allows the transport to use the null sha1 for a ref reported to
be present in the remote repository to indicate that a ref exists but
its actual value is presently unknown and will be set if the objects
are fetched.
Also adds documentation to the API to specify exactly what the methods
should do and how they should interpret arguments.
Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com>
---
Unchanged.
builtin-clone.c | 3 ++-
transport-helper.c | 4 ++--
transport.c | 13 +++++++------
transport.h | 41 +++++++++++++++++++++++++++++++++++++++--
4 files changed, 50 insertions(+), 11 deletions(-)
diff --git a/builtin-clone.c b/builtin-clone.c
index caf3025..5df8b0f 100644
--- a/builtin-clone.c
+++ b/builtin-clone.c
@@ -362,9 +362,10 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
const char *repo_name, *repo, *work_tree, *git_dir;
char *path, *dir;
int dest_exists;
- const struct ref *refs, *remote_head, *mapped_refs;
+ const struct ref *refs, *remote_head;
const struct ref *remote_head_points_at;
const struct ref *our_head_points_at;
+ struct ref *mapped_refs;
struct strbuf key = STRBUF_INIT, value = STRBUF_INIT;
struct strbuf branch_top = STRBUF_INIT, reflog_msg = STRBUF_INIT;
struct transport *transport = NULL;
diff --git a/transport-helper.c b/transport-helper.c
index e24fcbb..53d8f08 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -75,7 +75,7 @@ static int release_helper(struct transport *transport)
}
static int fetch_with_fetch(struct transport *transport,
- int nr_heads, const struct ref **to_fetch)
+ int nr_heads, struct ref **to_fetch)
{
struct child_process *helper = get_helper(transport);
FILE *file = xfdopen(helper->out, "r");
@@ -99,7 +99,7 @@ static int fetch_with_fetch(struct transport *transport,
}
static int fetch(struct transport *transport,
- int nr_heads, const struct ref **to_fetch)
+ int nr_heads, struct ref **to_fetch)
{
struct helper_data *data = transport->data;
int i, count;
diff --git a/transport.c b/transport.c
index 9daa686..5ae8db6 100644
--- a/transport.c
+++ b/transport.c
@@ -204,7 +204,7 @@ static struct ref *get_refs_via_rsync(struct transport *transport, int for_push)
}
static int fetch_objs_via_rsync(struct transport *transport,
- int nr_objs, const struct ref **to_fetch)
+ int nr_objs, struct ref **to_fetch)
{
struct strbuf buf = STRBUF_INIT;
struct child_process rsync;
@@ -408,7 +408,7 @@ static struct ref *get_refs_from_bundle(struct transport *transport, int for_pus
}
static int fetch_refs_from_bundle(struct transport *transport,
- int nr_heads, const struct ref **to_fetch)
+ int nr_heads, struct ref **to_fetch)
{
struct bundle_transport_data *data = transport->data;
return unbundle(&data->header, data->fd);
@@ -486,7 +486,7 @@ static struct ref *get_refs_via_connect(struct transport *transport, int for_pus
}
static int fetch_refs_via_pack(struct transport *transport,
- int nr_heads, const struct ref **to_fetch)
+ int nr_heads, struct ref **to_fetch)
{
struct git_transport_data *data = transport->data;
char **heads = xmalloc(nr_heads * sizeof(*heads));
@@ -926,16 +926,17 @@ const struct ref *transport_get_remote_refs(struct transport *transport)
return transport->remote_refs;
}
-int transport_fetch_refs(struct transport *transport, const struct ref *refs)
+int transport_fetch_refs(struct transport *transport, struct ref *refs)
{
int rc;
int nr_heads = 0, nr_alloc = 0, nr_refs = 0;
- const struct ref **heads = NULL;
- const struct ref *rm;
+ struct ref **heads = NULL;
+ struct ref *rm;
for (rm = refs; rm; rm = rm->next) {
nr_refs++;
if (rm->peer_ref &&
+ !is_null_sha1(rm->old_sha1) &&
!hashcmp(rm->peer_ref->old_sha1, rm->old_sha1))
continue;
ALLOC_GROW(heads, nr_heads + 1, nr_alloc);
diff --git a/transport.h b/transport.h
index c14da6f..503db11 100644
--- a/transport.h
+++ b/transport.h
@@ -18,11 +18,48 @@ struct transport {
int (*set_option)(struct transport *connection, const char *name,
const char *value);
+ /**
+ * Returns a list of the remote side's refs. In order to allow
+ * the transport to try to share connections, for_push is a
+ * hint as to whether the ultimate operation is a push or a fetch.
+ *
+ * If the transport is able to determine the remote hash for
+ * the ref without a huge amount of effort, it should store it
+ * in the ref's old_sha1 field; otherwise it should be all 0.
+ **/
struct ref *(*get_refs_list)(struct transport *transport, int for_push);
- int (*fetch)(struct transport *transport, int refs_nr, const struct ref **refs);
+
+ /**
+ * Fetch the objects for the given refs. Note that this gets
+ * an array, and should ignore the list structure.
+ *
+ * If the transport did not get hashes for refs in
+ * get_refs_list(), it should set the old_sha1 fields in the
+ * provided refs now.
+ **/
+ int (*fetch)(struct transport *transport, int refs_nr, struct ref **refs);
+
+ /**
+ * Push the objects and refs. Send the necessary objects, and
+ * then, for any refs where peer_ref is set and
+ * peer_ref->new_sha1 is different from old_sha1, tell the
+ * remote side to update each ref in the list from old_sha1 to
+ * peer_ref->new_sha1.
+ *
+ * Where possible, set the status for each ref appropriately.
+ *
+ * The transport must modify new_sha1 in the ref to the new
+ * value if the remote accepted the change. Note that this
+ * could be a different value from peer_ref->new_sha1 if the
+ * process involved generating new commits.
+ **/
int (*push_refs)(struct transport *transport, struct ref *refs, int flags);
int (*push)(struct transport *connection, int refspec_nr, const char **refspec, int flags);
+ /** get_refs_list(), fetch(), and push_refs() can keep
+ * resources (such as a connection) reserved for futher
+ * use. disconnect() releases these resources.
+ **/
int (*disconnect)(struct transport *connection);
char *pack_lockfile;
signed verbose : 2;
@@ -74,7 +111,7 @@ int transport_push(struct transport *connection,
const struct ref *transport_get_remote_refs(struct transport *transport);
-int transport_fetch_refs(struct transport *transport, const struct ref *refs);
+int transport_fetch_refs(struct transport *transport, struct ref *refs);
void transport_unlock_pack(struct transport *transport);
int transport_disconnect(struct transport *transport);
char *transport_anonymize_url(const char *url);
--
1.6.5.2.158.g6dacb
^ permalink raw reply related
* [PATCH v3 07/12] Add support for "import" helper command
From: Sverre Rabbelier @ 2009-11-06 22:52 UTC (permalink / raw)
To: Git List, Johannes Schindelin, Daniel Barkalow, Johan Herland
Cc: Daniel Barkalow, Sverre Rabbelier
In-Reply-To: <1257547966-14603-7-git-send-email-srabbelier@gmail.com>
From: Daniel Barkalow <barkalow@iabervon.org>
This command, supported if the "import" capability is advertized,
allows a helper to support fetching by outputting a git-fast-import
stream.
If both "fetch" and "import" are advertized, git itself will use
"fetch" (although other users may use "import" in this case).
Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com>
---
Unchanged.
Documentation/git-remote-helpers.txt | 10 ++++++
transport-helper.c | 52 ++++++++++++++++++++++++++++++++++
2 files changed, 62 insertions(+), 0 deletions(-)
diff --git a/Documentation/git-remote-helpers.txt b/Documentation/git-remote-helpers.txt
index 173ee23..e9aa67e 100644
--- a/Documentation/git-remote-helpers.txt
+++ b/Documentation/git-remote-helpers.txt
@@ -43,6 +43,13 @@ Commands are given by the caller on the helper's standard input, one per line.
+
Supported if the helper has the "fetch" capability.
+'import' <name>::
+ Produces a fast-import stream which imports the current value
+ of the named ref. It may additionally import other refs as
+ needed to construct the history efficiently.
++
+Supported if the helper has the "import" capability.
+
If a fatal error occurs, the program writes the error message to
stderr and exits. The caller should expect that a suitable error
message has been printed if the child closes the connection without
@@ -57,6 +64,9 @@ CAPABILITIES
'fetch'::
This helper supports the 'fetch' command.
+'import'::
+ This helper supports the 'import' command.
+
REF LIST ATTRIBUTES
-------------------
diff --git a/transport-helper.c b/transport-helper.c
index 53d8f08..82caaae 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -11,6 +11,7 @@ struct helper_data
const char *name;
struct child_process *helper;
unsigned fetch : 1;
+ unsigned import : 1;
};
static struct child_process *get_helper(struct transport *transport)
@@ -48,6 +49,8 @@ static struct child_process *get_helper(struct transport *transport)
break;
if (!strcmp(buf.buf, "fetch"))
data->fetch = 1;
+ if (!strcmp(buf.buf, "import"))
+ data->import = 1;
}
return data->helper;
}
@@ -98,6 +101,52 @@ static int fetch_with_fetch(struct transport *transport,
return 0;
}
+static int get_importer(struct transport *transport, struct child_process *fastimport)
+{
+ struct child_process *helper = get_helper(transport);
+ memset(fastimport, 0, sizeof(*fastimport));
+ fastimport->in = helper->out;
+ fastimport->argv = xcalloc(5, sizeof(*fastimport->argv));
+ fastimport->argv[0] = "fast-import";
+ fastimport->argv[1] = "--quiet";
+
+ fastimport->git_cmd = 1;
+ return start_command(fastimport);
+}
+
+static int fetch_with_import(struct transport *transport,
+ int nr_heads, struct ref **to_fetch)
+{
+ struct child_process fastimport;
+ struct child_process *helper = get_helper(transport);
+ int i;
+ struct ref *posn;
+ struct strbuf buf = STRBUF_INIT;
+
+ if (get_importer(transport, &fastimport))
+ die("Couldn't run fast-import");
+
+ for (i = 0; i < nr_heads; i++) {
+ posn = to_fetch[i];
+ if (posn->status & REF_STATUS_UPTODATE)
+ continue;
+
+ strbuf_addf(&buf, "import %s\n", posn->name);
+ write_in_full(helper->in, buf.buf, buf.len);
+ strbuf_reset(&buf);
+ }
+ disconnect_helper(transport);
+ finish_command(&fastimport);
+
+ for (i = 0; i < nr_heads; i++) {
+ posn = to_fetch[i];
+ if (posn->status & REF_STATUS_UPTODATE)
+ continue;
+ read_ref(posn->name, posn->old_sha1);
+ }
+ return 0;
+}
+
static int fetch(struct transport *transport,
int nr_heads, struct ref **to_fetch)
{
@@ -115,6 +164,9 @@ static int fetch(struct transport *transport,
if (data->fetch)
return fetch_with_fetch(transport, nr_heads, to_fetch);
+ if (data->import)
+ return fetch_with_import(transport, nr_heads, to_fetch);
+
return -1;
}
--
1.6.5.2.158.g6dacb
^ 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