* [PATCH] t3200,t7201: replace '!' with test_must_fail
From: Brandon Casey @ 2008-07-22 21:16 UTC (permalink / raw)
To: Git Mailing List; +Cc: Junio C Hamano
In-Reply-To: <0GfECozN3g0ZvAESKMi76RyOVHEb2OhhwET9GWmEm7pbzYQJub50UlWpZtBa7MGn1UGb-7mzbzE@cipher.nrlssc.navy.mil>
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
---
t/t3200-branch.sh | 2 +-
t/t7201-co.sh | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index 7c583c8..7a83fbf 100755
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
@@ -200,7 +200,7 @@ test_expect_success \
test_expect_success \
'branch from non-branch HEAD w/--track causes failure' \
- '!(git branch --track my10 HEAD^)'
+ 'test_must_fail git branch --track my10 HEAD^'
# Keep this test last, as it changes the current branch
cat >expect <<EOF
diff --git a/t/t7201-co.sh b/t/t7201-co.sh
index 3111baa..9ad5d63 100755
--- a/t/t7201-co.sh
+++ b/t/t7201-co.sh
@@ -335,6 +335,6 @@ test_expect_success \
git checkout -b delete-me master &&
rm .git/refs/heads/delete-me &&
test refs/heads/delete-me = "$(git symbolic-ref HEAD)" &&
- !(git checkout --track -b track)'
+ test_must_fail git checkout --track -b track'
test_done
--
1.6.0.rc0.38.g8b8fb7
^ permalink raw reply related
* [PATCH] t/: Replace diff [-u|-U0] with test_cmp to allow compilation with old diff
From: Brandon Casey @ 2008-07-22 21:17 UTC (permalink / raw)
To: Git Mailing List; +Cc: Junio C Hamano
In-Reply-To: <0GfECozN3g0ZvAESKMi76RyOVHEb2OhhwET9GWmEm7pbzYQJub50UlWpZtBa7MGn1UGb-7mzbzE@cipher.nrlssc.navy.mil>
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
---
t/t0002-gitfile.sh | 2 +-
t/t1002-read-tree-m-u-2way.sh | 12 ++++++------
t/t2201-add-update-typechange.sh | 10 +++++-----
3 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/t/t0002-gitfile.sh b/t/t0002-gitfile.sh
index c5dbc72..4db4ac4 100755
--- a/t/t0002-gitfile.sh
+++ b/t/t0002-gitfile.sh
@@ -66,7 +66,7 @@ test_expect_success 'check hash-object' '
test_expect_success 'check cat-file' '
git cat-file blob $SHA >actual &&
- diff -u bar actual
+ test_cmp bar actual
'
test_expect_success 'check update-index' '
diff --git a/t/t1002-read-tree-m-u-2way.sh b/t/t1002-read-tree-m-u-2way.sh
index e04990e..aa9dd58 100755
--- a/t/t1002-read-tree-m-u-2way.sh
+++ b/t/t1002-read-tree-m-u-2way.sh
@@ -112,7 +112,7 @@ test_expect_success \
git update-index --add frotz &&
git read-tree -m -u $treeH $treeM &&
git ls-files --stage >6.out &&
- diff -U0 M.out 6.out &&
+ test_cmp M.out 6.out &&
check_cache_at frotz clean &&
sum bozbar frotz nitfol >actual3.sum &&
cmp M.sum actual3.sum &&
@@ -129,7 +129,7 @@ test_expect_success \
echo frotz frotz >frotz &&
git read-tree -m -u $treeH $treeM &&
git ls-files --stage >7.out &&
- diff -U0 M.out 7.out &&
+ test_cmp M.out 7.out &&
check_cache_at frotz dirty &&
sum bozbar frotz nitfol >actual7.sum &&
if cmp M.sum actual7.sum; then false; else :; fi &&
@@ -264,7 +264,7 @@ test_expect_success \
git update-index --add bozbar &&
git read-tree -m -u $treeH $treeM &&
git ls-files --stage >18.out &&
- diff -U0 M.out 18.out &&
+ test_cmp M.out 18.out &&
check_cache_at bozbar clean &&
sum bozbar frotz nitfol >actual18.sum &&
cmp M.sum actual18.sum'
@@ -278,7 +278,7 @@ test_expect_success \
echo gnusto gnusto >bozbar &&
git read-tree -m -u $treeH $treeM &&
git ls-files --stage >19.out &&
- diff -U0 M.out 19.out &&
+ test_cmp M.out 19.out &&
check_cache_at bozbar dirty &&
sum frotz nitfol >actual19.sum &&
grep -v bozbar M.sum > expected19.sum &&
@@ -297,7 +297,7 @@ test_expect_success \
git update-index --add bozbar &&
git read-tree -m -u $treeH $treeM &&
git ls-files --stage >20.out &&
- diff -U0 M.out 20.out &&
+ test_cmp M.out 20.out &&
check_cache_at bozbar clean &&
sum bozbar frotz nitfol >actual20.sum &&
cmp M.sum actual20.sum'
@@ -338,7 +338,7 @@ test_expect_success \
git update-index --add DF &&
git read-tree -m -u $treeDF $treeDFDF &&
git ls-files --stage >DFDFcheck.out &&
- diff -U0 DFDF.out DFDFcheck.out &&
+ test_cmp DFDF.out DFDFcheck.out &&
check_cache_at DF/DF clean'
test_done
diff --git a/t/t2201-add-update-typechange.sh b/t/t2201-add-update-typechange.sh
index e15e3eb..d24c7d9 100755
--- a/t/t2201-add-update-typechange.sh
+++ b/t/t2201-add-update-typechange.sh
@@ -106,12 +106,12 @@ test_expect_success modify '
test_expect_success diff-files '
git diff-files --raw >actual &&
- diff -u expect-files actual
+ test_cmp expect-files actual
'
test_expect_success diff-index '
git diff-index --raw HEAD -- >actual &&
- diff -u expect-index actual
+ test_cmp expect-index actual
'
test_expect_success 'add -u' '
@@ -119,7 +119,7 @@ test_expect_success 'add -u' '
cp -p ".git/index" ".git/saved-index" &&
git add -u &&
git ls-files -s >actual &&
- diff -u expect-final actual
+ test_cmp expect-final actual
'
test_expect_success 'commit -a' '
@@ -130,11 +130,11 @@ test_expect_success 'commit -a' '
fi &&
git commit -m "second" -a &&
git ls-files -s >actual &&
- diff -u expect-final actual &&
+ test_cmp expect-final actual &&
rm -f .git/index &&
git read-tree HEAD &&
git ls-files -s >actual &&
- diff -u expect-final actual
+ test_cmp expect-final actual
'
test_done
--
1.6.0.rc0.38.g8b8fb7
^ permalink raw reply related
* Re: [PATCH] bring description of git diff --cc up to date
From: Junio C Hamano @ 2008-07-22 21:21 UTC (permalink / raw)
To: Jonathan Nieder; +Cc: git, David Greaves
In-Reply-To: <7v63qxn8w2.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
> Jonathan Nieder <jrnieder@uchicago.edu> writes:
>
>> Just to make sure I understand, here is what I think --cc does:
>>
>> - In a two-parent merge, it is exactly as Linus has been
>> ...
>> - In a many-parent merge, the criterion is more stringent.
>> ...
>>
>> Is that correct?
>
> The logic in the code does not have separate criteria for two-parent and
> Octopus cases. Actually Linus talks about "when you have two versions to
> choose from, and if the result matches one of them, then it is not
> interesting". In a two-parent merge, you cannot have three or more
> possible versions to choose from by definition, can you?
To put it another way, I think what you wrote is correct, but two-parent
case is just a degenerated case of a more general rule, that is:
A hunk is not interesting if the person who merged had only two
choices offered by the parents to pick from, and the merge result
exactly matched one of the choices.
You can come up with examples that do not match the above criteria; they
are all interesting.
For example, if all the parent of a tripus disagreed, the person had more
than two choices to pick from, so no matter what the resolution is, the
hunk is interesting.
On the other hand, if 4 parents in a dodecapus lack a line that all other
8 parents have (see the first example in [*1*]), then the choice for the
person who merges these 12 parents is either to include or not include
that line. If the line was included, it is not interesting. If the line
was deleted (which is different from what happened in *1*), it is not
interesting, either.
One thing to note is "have only two choices to pick from" does not have a
direct connection to two-parent-ness. In a two-parent merge (di-pus?), by
definition you cannot have more than two choices, but that is not any
different from a Dodecapus that has only two groups of parents. Most
octopus merges have only two groups of parents like the "merge from hell"
does when we talk about individual paths (otherwise it would be very
painful to resolve so it is not done in practice).
[Reference]
*1* http://article.gmane.org/gmane.comp.version-control.git/15487
^ permalink raw reply
* [PATCH] t7502-commit.sh: rearrange test to make more portable
From: Brandon Casey @ 2008-07-22 21:21 UTC (permalink / raw)
To: Git Mailing List; +Cc: Junio C Hamano
In-Reply-To: <0GfECozN3g0ZvAESKMi76RyOVHEb2OhhwET9GWmEm7pbzYQJub50UlWpZtBa7MGn1UGb-7mzbzE@cipher.nrlssc.navy.mil>
Some shells have problems with one-shot variable assignment notation
and function calls. The sequence is rearranged to avoid the one-shot
and to allow the test script to be linked together with '&&'.
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
---
t/t7502-commit.sh | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/t/t7502-commit.sh b/t/t7502-commit.sh
index c25eff9..ad84c3d 100755
--- a/t/t7502-commit.sh
+++ b/t/t7502-commit.sh
@@ -228,10 +228,12 @@ EOF
test_expect_success 'a SIGTERM should break locks' '
echo >>negative &&
- "$SHELL_PATH" -c '\''
+ ! "$SHELL_PATH" -c '\''
echo kill -TERM $$ >> .git/FAKE_EDITOR
- GIT_EDITOR=.git/FAKE_EDITOR exec git commit -a'\'' && exit 1 # should fail
- ! test -f .git/index.lock
+ GIT_EDITOR=.git/FAKE_EDITOR
+ export GIT_EDITOR
+ exec git commit -a'\'' &&
+ test ! -f .git/index.lock
'
rm -f .git/MERGE_MSG .git/COMMIT_EDITMSG
--
1.6.0.rc0.38.g8b8fb7
^ permalink raw reply related
* [PATCH] t/t4202-log.sh: add newline at end of file
From: Brandon Casey @ 2008-07-22 21:23 UTC (permalink / raw)
To: Git Mailing List; +Cc: Junio C Hamano
In-Reply-To: <0GfECozN3g0ZvAESKMi76RyOVHEb2OhhwET9GWmEm7pbzYQJub50UlWpZtBa7MGn1UGb-7mzbzE@cipher.nrlssc.navy.mil>
Some shells hang when parsing the script if the last statement is not
followed by a newline. So add one.
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
---
I expect this is a bug in ksh. The ksh installed on my solaris box went
into some infinite loop on this script, continually allocating memory.
Adding the newline fixed it.
-brandon
t/t4202-log.sh | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/t/t4202-log.sh b/t/t4202-log.sh
index b536454..4c8af45 100755
--- a/t/t4202-log.sh
+++ b/t/t4202-log.sh
@@ -71,4 +71,5 @@ test_expect_success 'diff-filter=D' '
-test_done
\ No newline at end of file
+test_done
+
--
1.6.0.rc0.38.g8b8fb7
^ permalink raw reply related
* [PATCH] Add help.autocorrect to enable/disable autocorrecting
From: Alex Riesen @ 2008-07-22 21:26 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git
In-Reply-To: <alpine.DEB.1.00.0807222207110.8986@racer>
It is off by default, to avoid scaring people unless they asked to.
---
Johannes Schindelin, Tue, Jul 22, 2008 23:08:19 +0200:
> On Tue, 22 Jul 2008, Alex Riesen wrote:
>
> > + if (autocorrect && (main_cmds.cnt < 2 ||
> > + best_similarity < similarity(main_cmds.names[1]->name))) {
> > if (!*cwd)
> > exit(1);
> > if (chdir(cwd))
>
> In that case, you need to put in the "one of these" / "this" conditional
> again, which I ripped out because I do not need it any more.
>
Of course, missed it. Like this, then.
help.c | 20 ++++++++++++++------
1 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/help.c b/help.c
index 480befe..cf6b459 100644
--- a/help.c
+++ b/help.c
@@ -28,6 +28,7 @@ enum help_format {
HELP_FORMAT_WEB,
};
+static int autocorrect;
static int show_all = 0;
static enum help_format help_format = HELP_FORMAT_MAN;
static struct option builtin_help_options[] = {
@@ -269,6 +270,8 @@ static int git_help_config(const char *var, const char *value, void *cb)
}
if (!prefixcmp(var, "man."))
return add_man_viewer_info(var, value);
+ if (!strcmp(var, "help.autocorrect"))
+ autocorrect = git_config_bool(var,value);
return git_default_config(var, value, cb);
}
@@ -704,9 +707,10 @@ const char *help_unknown_cmd(const char *cmd)
if (!main_cmds.cnt)
die ("Uh oh. Your system reports no Git commands at all.");
+ git_config(git_help_config, NULL);
best_similarity = similarity(main_cmds.names[0]->name);
- if (main_cmds.cnt < 2 || best_similarity <
- similarity(main_cmds.names[1]->name)) {
+ if (autocorrect && (main_cmds.cnt < 2 ||
+ best_similarity < similarity(main_cmds.names[1]->name))) {
if (!*cwd)
exit(1);
if (chdir(cwd))
@@ -721,10 +725,14 @@ const char *help_unknown_cmd(const char *cmd)
fprintf(stderr, "git: '%s' is not a git-command. See 'git --help'.\n", cmd);
if (best_similarity < 6) {
- fprintf(stderr, "\nDid you mean one of these?\n");
-
- for (i = 0; i < main_cmds.cnt && best_similarity ==
- similarity(main_cmds.names[i]->name); i++)
+ int n = 0;
+ while (n < main_cmds.cnt &&
+ best_similarity == similarity(main_cmds.names[n]->name))
+ ++n;
+ fprintf(stderr, "\nDid you mean %s?\n",
+ n < 2 ? "this": "one of these");
+
+ for (i = 0; i < n; i++)
fprintf(stderr, "\t%s\n", main_cmds.names[i]->name);
}
--
1.6.0.rc0.48.ga184
^ permalink raw reply related
* Re: Patches for test suite on sunos
From: Brandon Casey @ 2008-07-22 21:30 UTC (permalink / raw)
To: Git Mailing List; +Cc: Junio C Hamano
In-Reply-To: <xBk5x6Gn4j_BxeOlNdnKZYx9EVCDUf3daWtIO2qp-b8jRKgjlQ8spQ@cipher.nrlssc.navy.mil>
Brandon Casey wrote:
> The following set of patches is a subset of patches
Well, those patches were all supposed to be sent as a
reply to this message, but I can't use git-send-email
and it turns out thunderbird replaces the message-id
for messages when you 'Edit As New...' (which is how
I have been submitting my patches).
-brandon
^ permalink raw reply
* Re: [PATCH/RFC] git add: do not add files from a submodule
From: Johannes Schindelin @ 2008-07-22 21:32 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <alpine.DEB.1.00.0807210256510.3305@eeepc-johanness>
Hi Junio,
On Mon, 21 Jul 2008, Johannes Schindelin wrote:
> It comes quite as a surprise to an unsuspecting Git user that calling
> "git add submodule/file" (which is a mistake, alright) _removes_
> the submodule in the index, and adds the file. Instead, complain loudly.
>
> While at it, be nice when the user said "git add submodule/" which is
> most likely the consequence of tab-completion, and stage the submodule,
> instead of trying to add the contents of that directory.
Do you plan to apply the split-up builtin-add enhancments you did a few
nights ago, so that this patch can be elegant? I think this fix should go
into 1.6.0.
Ciao,
Dscho
^ permalink raw reply
* [PATCH] rebase -i: only automatically amend commit if HEAD did not change
From: Johannes Schindelin @ 2008-07-22 21:36 UTC (permalink / raw)
To: git, gitster
If the user called "rebase -i", marked a commit as "edit", "rebase
--continue" would automatically amend the commit when there were
staged changes.
However, this is actively wrong when the current commit is not the
one marked with "edit". So guard against this.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
git-rebase--interactive.sh | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index e63a864..444f393 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -276,7 +276,7 @@ do_next () {
pick_one $sha1 ||
die_with_patch $sha1 "Could not apply $sha1... $rest"
make_patch $sha1
- : > "$DOTEST"/amend
+ git rev-parse HEAD > "$DOTEST"/amend
warn
warn "You can amend the commit now, with"
warn
@@ -419,7 +419,9 @@ do
else
. "$DOTEST"/author-script ||
die "Cannot find the author identity"
- if test -f "$DOTEST"/amend
+ if test -f "$DOTEST"/amend &&
+ test $(git rev-parse HEAD) = \
+ $(cat "$DOTEST"/amend)
then
git reset --soft HEAD^ ||
die "Cannot rewind the HEAD"
--
1.6.0.rc0.22.gf2096d.dirty
^ permalink raw reply related
* [PATCH] Ignore dirty submodule states in "git pull --rebase"
From: Johannes Schindelin @ 2008-07-22 21:41 UTC (permalink / raw)
To: git, gitster
This is a companion patch to 6848d58c(Ignore dirty submodule states
during rebase and stash).
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
git-pull.sh | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/git-pull.sh b/git-pull.sh
index 6afd4e2..75c3610 100755
--- a/git-pull.sh
+++ b/git-pull.sh
@@ -107,9 +107,9 @@ error_on_no_merge_candidates () {
}
test true = "$rebase" && {
- git update-index --refresh &&
- git diff-files --quiet &&
- git diff-index --cached --quiet HEAD -- ||
+ git update-index --ignore-submodules --refresh &&
+ git diff-files --ignore-submodules --quiet &&
+ git diff-index --ignore-submodules --cached --quiet HEAD -- ||
die "refusing to pull with rebase: your working tree is not up-to-date"
. git-parse-remote &&
--
1.6.0.rc0.22.gf2096d.dirty
^ permalink raw reply related
* Re: Hacks for AIX
From: Brandon Casey @ 2008-07-22 21:42 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Chris Cowan, git
In-Reply-To: <hT7kYDX9f_eBxi8JC0s7jG9oqm8sZ1QCTlEg1n8Dqus7U98hWLWnBA@cipher.nrlssc.navy.mil>
Brandon Casey wrote:
> Junio C Hamano wrote:
>> Junio C Hamano <gitster@pobox.com> writes:
>>
>>>> * /usr/bin/patch - really old version, doesn't do well with some
>>>> diff formats. I avoid using it.
>>> t4109 seems to use patch to produce expected output for the tests; we
>>> should ship a precomputed expected results. Do you know of any other
>>> places "patch" is used?
>> As usual, I won't commit this patch unless I hear from people who
>> potentially would benefit from it. I do not need such a patch myself and
>> I really shouldn't be spending too much of my time on these.
>
>
> Unless I'm doing something wrong, this doesn't apply cleanly to master.
I figured out that your patch was against maint.
I see it is now applied to master and it helps out on solaris with old patch.
Now I need to get rid of 'diff -U0' in t1002-read-tree-m-u-2way.sh.
-brandon
^ permalink raw reply
* Re: [PATCH] Add help.autocorrect to enable/disable autocorrecting
From: Johannes Schindelin @ 2008-07-22 21:44 UTC (permalink / raw)
To: Alex Riesen; +Cc: git
In-Reply-To: <20080722212633.GF5113@blimp.local>
Hi,
On Tue, 22 Jul 2008, Alex Riesen wrote:
> @@ -704,9 +707,10 @@ const char *help_unknown_cmd(const char *cmd)
>
> if (!main_cmds.cnt)
> die ("Uh oh. Your system reports no Git commands at all.");
> + git_config(git_help_config, NULL);
> best_similarity = similarity(main_cmds.names[0]->name);
> - if (main_cmds.cnt < 2 || best_similarity <
> - similarity(main_cmds.names[1]->name)) {
> + if (autocorrect && (main_cmds.cnt < 2 ||
> + best_similarity < similarity(main_cmds.names[1]->name))) {
> if (!*cwd)
> exit(1);
> if (chdir(cwd))
This "if" already checks if there is only one candidate. So you should
just add an inner "if (autocorrect) ... else single = 1;" or some such.
However, I think that the intention of this patch is too much DWIMery,
which might be good for me (just like my "git add remote" patch), but not
for the general audience.
Ciao,
Dscho
^ permalink raw reply
* Re: [PATCH] rebase -i: only automatically amend commit if HEAD did not change
From: Stephan Beyer @ 2008-07-22 21:48 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git, gitster
In-Reply-To: <alpine.DEB.1.00.0807222235520.8986@racer>
Hi,
Johannes Schindelin wrote:
> If the user called "rebase -i", marked a commit as "edit", "rebase
> --continue" would automatically amend the commit when there were
> staged changes.
>
> However, this is actively wrong when the current commit is not the
> one marked with "edit". So guard against this.
Hmm, I like it. ;-)
> @@ -419,7 +419,9 @@ do
> else
> . "$DOTEST"/author-script ||
> die "Cannot find the author identity"
> - if test -f "$DOTEST"/amend
> + if test -f "$DOTEST"/amend &&
> + test $(git rev-parse HEAD) = \
> + $(cat "$DOTEST"/amend)
> then
> git reset --soft HEAD^ ||
> die "Cannot rewind the HEAD"
So if this fails, a non-amending commit is done. Agreed. :)
Regards,
Stephan
--
Stephan Beyer <s-beyer@gmx.net>, PGP 0x6EDDD207FCC5040F
^ permalink raw reply
* [PATCH] git daemon: avoid waking up too often
From: Johannes Schindelin @ 2008-07-22 21:52 UTC (permalink / raw)
To: git, gitster
To avoid waking up unnecessarily, a pipe is set up that is only ever
written to by child_handler(), when a child disconnects, as suggested
per Junio.
This avoids waking up the main process every second to see if a child
was disconnected.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
I have this in production ever since I posted it the first time,
without problems.
Oh, and it removes more lines than it introduces ;-)
daemon.c | 24 +++++++++++-------------
1 files changed, 11 insertions(+), 13 deletions(-)
diff --git a/daemon.c b/daemon.c
index 7df41a6..850f6f9 100644
--- a/daemon.c
+++ b/daemon.c
@@ -16,6 +16,7 @@
static int log_syslog;
static int verbose;
static int reuseaddr;
+static int child_handler_pipe[2];
static const char daemon_usage[] =
"git daemon [--verbose] [--syslog] [--export-all]\n"
@@ -788,6 +789,7 @@ static void child_handler(int signo)
pid = -pid;
dead_child[reaped % MAX_CHILDREN] = pid;
children_reaped = reaped + 1;
+ write(child_handler_pipe[1], &status, 1);
continue;
}
break;
@@ -933,12 +935,17 @@ static int service_loop(int socknum, int *socklist)
struct pollfd *pfd;
int i;
- pfd = xcalloc(socknum, sizeof(struct pollfd));
+ if (pipe(child_handler_pipe) < 0)
+ die ("Could not set up pipe for child handler");
+
+ pfd = xcalloc(socknum + 1, sizeof(struct pollfd));
for (i = 0; i < socknum; i++) {
pfd[i].fd = socklist[i];
pfd[i].events = POLLIN;
}
+ pfd[socknum].fd = child_handler_pipe[0];
+ pfd[socknum].events = POLLIN;
signal(SIGCHLD, child_handler);
@@ -946,16 +953,7 @@ static int service_loop(int socknum, int *socklist)
int i;
int timeout;
- /*
- * This 1-sec timeout could lead to idly looping but it is
- * here so that children culled in child_handler() are reported
- * without too much delay. We could probably set up a pipe
- * to ourselves that we poll, and write to the fd from child_handler()
- * to wake us up (and consume it when the poll() returns...
- */
- timeout = (children_spawned != children_deleted) ? 1000 : -1;
- i = poll(pfd, socknum, timeout);
- if (i < 0) {
+ if (poll(pfd, socknum + 1, -1) < 0) {
if (errno != EINTR) {
error("poll failed, resuming: %s",
strerror(errno));
@@ -963,9 +961,9 @@ static int service_loop(int socknum, int *socklist)
}
continue;
}
- if (i == 0) {
+ if (pfd[socknum].revents & POLLIN) {
+ read(child_handler_pipe[0], &i, 1);
check_dead_children();
- continue;
}
for (i = 0; i < socknum; i++) {
--
1.6.0.rc0.22.gf2096d.dirty
^ permalink raw reply related
* [PATCH] Respect crlf attribute even if core.autocrlf has not been set
From: Johannes Schindelin @ 2008-07-22 21:56 UTC (permalink / raw)
To: git, gitster
When a file's crlf attribute is explicitely set, it does not make sense
to ignore it, just because the config variable core.autocrlf has not
been set.
This patch does not affect the case when the crlf attribute is unset.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
There have been no comments on this patch so far, however I think
that this is a valid fix which should be in 1.6.0.
convert.c | 2 +-
t/t0020-crlf.sh | 10 ++++++++++
2 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/convert.c b/convert.c
index 78efed8..d038d2f 100644
--- a/convert.c
+++ b/convert.c
@@ -126,7 +126,7 @@ static int crlf_to_git(const char *path, const char *src, size_t len,
struct text_stat stats;
char *dst;
- if ((action == CRLF_BINARY) || !auto_crlf || !len)
+ if ((action == CRLF_BINARY) || (!auto_crlf && action < 0) || !len)
return 0;
gather_stats(src, len, &stats);
diff --git a/t/t0020-crlf.sh b/t/t0020-crlf.sh
index 1be7446..0bb3e6f 100755
--- a/t/t0020-crlf.sh
+++ b/t/t0020-crlf.sh
@@ -436,4 +436,14 @@ test_expect_success 'invalid .gitattributes (must not crash)' '
'
+test_expect_success 'attribute crlf is heeded even without core.autocrlf' '
+
+ echo "allcrlf crlf=input" > .gitattributes &&
+ git config --unset core.autocrlf &&
+ git add allcrlf &&
+ git show :allcrlf | append_cr > expect &&
+ test_cmp allcrlf expect
+
+'
+
test_done
--
1.6.0.rc0.22.gf2096d.dirty
^ permalink raw reply related
* [PATCH v2] git daemon: avoid waking up too often
From: Johannes Schindelin @ 2008-07-22 22:03 UTC (permalink / raw)
To: git, gitster
In-Reply-To: <alpine.DEB.1.00.0807222251570.8986@racer>
To avoid waking up unnecessarily, a pipe is set up that is only ever
written to by child_handler(), when a child disconnects, as suggested
per Junio.
This avoids waking up the main process every second to see if a child
was disconnected.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
Darn. Forgot to commit after fixing the compiler warning:
The now-unused variable timeout is gone.
That is the only difference to the version I have running in
production ;-)
daemon.c | 25 +++++++++++--------------
1 files changed, 11 insertions(+), 14 deletions(-)
diff --git a/daemon.c b/daemon.c
index 7df41a6..4540e8d 100644
--- a/daemon.c
+++ b/daemon.c
@@ -16,6 +16,7 @@
static int log_syslog;
static int verbose;
static int reuseaddr;
+static int child_handler_pipe[2];
static const char daemon_usage[] =
"git daemon [--verbose] [--syslog] [--export-all]\n"
@@ -788,6 +789,7 @@ static void child_handler(int signo)
pid = -pid;
dead_child[reaped % MAX_CHILDREN] = pid;
children_reaped = reaped + 1;
+ write(child_handler_pipe[1], &status, 1);
continue;
}
break;
@@ -933,29 +935,24 @@ static int service_loop(int socknum, int *socklist)
struct pollfd *pfd;
int i;
- pfd = xcalloc(socknum, sizeof(struct pollfd));
+ if (pipe(child_handler_pipe) < 0)
+ die ("Could not set up pipe for child handler");
+
+ pfd = xcalloc(socknum + 1, sizeof(struct pollfd));
for (i = 0; i < socknum; i++) {
pfd[i].fd = socklist[i];
pfd[i].events = POLLIN;
}
+ pfd[socknum].fd = child_handler_pipe[0];
+ pfd[socknum].events = POLLIN;
signal(SIGCHLD, child_handler);
for (;;) {
int i;
- int timeout;
- /*
- * This 1-sec timeout could lead to idly looping but it is
- * here so that children culled in child_handler() are reported
- * without too much delay. We could probably set up a pipe
- * to ourselves that we poll, and write to the fd from child_handler()
- * to wake us up (and consume it when the poll() returns...
- */
- timeout = (children_spawned != children_deleted) ? 1000 : -1;
- i = poll(pfd, socknum, timeout);
- if (i < 0) {
+ if (poll(pfd, socknum + 1, -1) < 0) {
if (errno != EINTR) {
error("poll failed, resuming: %s",
strerror(errno));
@@ -963,9 +960,9 @@ static int service_loop(int socknum, int *socklist)
}
continue;
}
- if (i == 0) {
+ if (pfd[socknum].revents & POLLIN) {
+ read(child_handler_pipe[0], &i, 1);
check_dead_children();
- continue;
}
for (i = 0; i < socknum; i++) {
--
1.6.0.rc0.22.gf2096d.dirty
^ permalink raw reply related
* Re: [PATCH] rebase -i: only automatically amend commit if HEAD did not change
From: Avery Pennarun @ 2008-07-22 22:22 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git, gitster
In-Reply-To: <alpine.DEB.1.00.0807222235520.8986@racer>
On 7/22/08, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> If the user called "rebase -i", marked a commit as "edit", "rebase
> --continue" would automatically amend the commit when there were
> staged changes.
>
> However, this is actively wrong when the current commit is not the
> one marked with "edit". So guard against this.
This patch is perhaps a symptom of something I've been meaning to ask
about for a while.
Why doesn't "edit" just stage the commit and not auto-commit it at
all? That way an amend would *never* be necessary, and rebase
--continue would always do a commit -a (if there was anything left to
commit). The special case fixed by this patch would thus not be
needed.
It would also make it more obvious how to remove files from a commit,
for example, without having to learn about "git reset". For that
matter, you wouldn't have to learn about "git commit --amend" either,
and it would save typing.
It would also be a little more consistent with "squash", which already
lets you edit the commit message by default.
Just a thought. Presumably it was implemented the way it is for some
reason, but I haven't seen any discussion about it.
Have fun,
Avery
^ permalink raw reply
* [PATCH] Documentation/git-filter-branch: Remove Useless Use of Plumbing
From: Petr Baudis @ 2008-07-22 22:24 UTC (permalink / raw)
To: gitster; +Cc: git
The example to remove file using index-filter uses git update-index
--remove where git rm --cached works as well.
Signed-off-by: Petr Baudis <pasky@suse.cz>
---
Documentation/git-filter-branch.txt | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/Documentation/git-filter-branch.txt b/Documentation/git-filter-branch.txt
index a3edc00..7ba9dab 100644
--- a/Documentation/git-filter-branch.txt
+++ b/Documentation/git-filter-branch.txt
@@ -191,7 +191,7 @@ Thus you may instead want to use `rm -f filename` as the script.
A significantly faster version:
--------------------------------------------------------------------------
-git filter-branch --index-filter 'git update-index --remove filename' HEAD
+git filter-branch --index-filter 'git rm --cached filename' HEAD
--------------------------------------------------------------------------
Now, you will get the rewritten history saved in HEAD.
^ permalink raw reply related
* [PATCH] git-filter-branch.sh: Allow running in bare repositories
From: Petr Baudis @ 2008-07-22 22:37 UTC (permalink / raw)
To: gitster; +Cc: git, Johannes Schindelin
Commit 46eb449c restricted git-filter-branch to non-bare repositories
unnecessarily; git-filter-branch can work on bare repositories just
fine.
This also fixes suspicious shell boolean expression during a check
for dirty working tree.
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Petr Baudis <pasky@suse.cz>
---
git-filter-branch.sh | 36 ++++++++++++++++++++----------------
t/t7003-filter-branch.sh | 8 ++++++++
2 files changed, 28 insertions(+), 16 deletions(-)
diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index d04c346..dcfc6be 100755
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -97,9 +97,11 @@ USAGE="[--env-filter <command>] [--tree-filter <command>] \
OPTIONS_SPEC=
. git-sh-setup
-git diff-files --quiet &&
- git diff-index --cached --quiet HEAD -- ||
- die "Cannot rewrite branch(es) with a dirty working directory."
+if [ "$(is_bare_repository)" = false ]; then
+ (git diff-files --quiet &&
+ git diff-index --cached --quiet HEAD --) ||
+ die "Cannot rewrite branch(es) with a dirty working directory."
+fi
tempdir=.git-rewrite
filter_env=
@@ -434,18 +436,20 @@ rm -rf "$tempdir"
trap - 0
-unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE
-test -z "$ORIG_GIT_DIR" || {
- GIT_DIR="$ORIG_GIT_DIR" && export GIT_DIR
-}
-test -z "$ORIG_GIT_WORK_TREE" || {
- GIT_WORK_TREE="$ORIG_GIT_WORK_TREE" &&
- export GIT_WORK_TREE
-}
-test -z "$ORIG_GIT_INDEX_FILE" || {
- GIT_INDEX_FILE="$ORIG_GIT_INDEX_FILE" &&
- export GIT_INDEX_FILE
-}
-git read-tree -u -m HEAD
+if [ "$(is_bare_repository)" = false ]; then
+ unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE
+ test -z "$ORIG_GIT_DIR" || {
+ GIT_DIR="$ORIG_GIT_DIR" && export GIT_DIR
+ }
+ test -z "$ORIG_GIT_WORK_TREE" || {
+ GIT_WORK_TREE="$ORIG_GIT_WORK_TREE" &&
+ export GIT_WORK_TREE
+ }
+ test -z "$ORIG_GIT_INDEX_FILE" || {
+ GIT_INDEX_FILE="$ORIG_GIT_INDEX_FILE" &&
+ export GIT_INDEX_FILE
+ }
+ git read-tree -u -m HEAD
+fi
exit $ret
diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh
index e26f726..a0ab096 100755
--- a/t/t7003-filter-branch.sh
+++ b/t/t7003-filter-branch.sh
@@ -38,6 +38,14 @@ test_expect_success 'result is really identical' '
test $H = $(git rev-parse HEAD)
'
+test_expect_success 'rewrite bare repository identically' '
+ (git config core.bare true && cd .git && git-filter-branch branch)
+'
+git config core.bare false
+test_expect_success 'result is really identical' '
+ test $H = $(git rev-parse HEAD)
+'
+
test_expect_success 'rewrite, renaming a specific file' '
git-filter-branch -f --tree-filter "mv d doh || :" HEAD
'
^ permalink raw reply related
* Re: [PATCH] Documentation/git-ls-tree.txt: Add a caveat about prefixing pathspec
From: Petr Baudis @ 2008-07-22 22:47 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vd4l6sqqz.fsf@gitster.siamese.dyndns.org>
On Mon, Jul 21, 2008 at 05:32:20PM -0700, Junio C Hamano wrote:
> Petr Baudis <pasky@suse.cz> writes:
>
> >> commit. E.g.
> >>
> >> $ cd some/deep/path
> >> $ git ls-tree --name-only -r HEAD~20
> >>
> >> will list the files in some/deep/path (i.e. where you are) 20
> >> commits ago, just like running "/bin/ls" there will give you the
> >> list of files you have right now.
> >
> > Frankly, I think this is overdoing it. I'm all for being positive, but
> > it is obvious why this is good thing when you inspect a root tree and
> > there's no need to be too wordy about it...
>
> I mildly disagree.
We may throw a dice or go with your version, I don't care *that* much
about this change, I just wouldn't make it personally.
> If the person had truly understood that, why do we even have this thread
> to begin with?
To nudge the person to the "aha" moment.
> Description on *what* it does (i.e. "like what ls -a does in the current
> working directory" we have in the Description section) obviously was not
> good enough.
I don't understand; what does auto-prefixing have to do with the
"ls -a" mention?
> It will be better understood if you describe *why* it does
> it that way at the same time.
My version implies that for examining the root tree, without surplusage.
--
Petr "Pasky" Baudis
As in certain cults it is possible to kill a process if you know
its true name. -- Ken Thompson and Dennis M. Ritchie
^ permalink raw reply
* Re: [FYI PATCH] git wrapper: DWIM mistyped commands
From: Junio C Hamano @ 2008-07-22 23:05 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git
In-Reply-To: <alpine.DEB.1.00.0807222100150.8986@racer>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> So I mistyped 'reabse' for the hundred trillionth time, but I
> will never have to correct my mistakes again.
>
> Note: this patch is _not_ meant for inclusion.
Heh, I do "git emrge" all the time ;-)
Time to start a "gitster private edition" branch for my own use, I guess.
^ permalink raw reply
* Re: [PATCH] Add help.autocorrect to enable/disable autocorrecting
From: Junio C Hamano @ 2008-07-22 23:08 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Alex Riesen, git
In-Reply-To: <alpine.DEB.1.00.0807222242160.8986@racer>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> Hi,
>
> On Tue, 22 Jul 2008, Alex Riesen wrote:
>
>> @@ -704,9 +707,10 @@ const char *help_unknown_cmd(const char *cmd)
>>
>> if (!main_cmds.cnt)
>> die ("Uh oh. Your system reports no Git commands at all.");
>> + git_config(git_help_config, NULL);
>> best_similarity = similarity(main_cmds.names[0]->name);
>> - if (main_cmds.cnt < 2 || best_similarity <
>> - similarity(main_cmds.names[1]->name)) {
>> + if (autocorrect && (main_cmds.cnt < 2 ||
>> + best_similarity < similarity(main_cmds.names[1]->name))) {
>> if (!*cwd)
>> exit(1);
>> if (chdir(cwd))
>
> This "if" already checks if there is only one candidate. So you should
> just add an inner "if (autocorrect) ... else single = 1;" or some such.
>
> However, I think that the intention of this patch is too much DWIMery,
> which might be good for me (just like my "git add remote" patch), but not
> for the general audience.
Please make autocorrect not a binary but optionally the number of
deciseconds before it continues, so that I have a chance to hit ^C ;-)
^ permalink raw reply
* Re: [PATCH] perl/Makefile: update NO_PERL_MAKEMAKER section
From: Petr Baudis @ 2008-07-22 23:09 UTC (permalink / raw)
To: Brandon Casey; +Cc: Git Mailing List, Junio C Hamano
In-Reply-To: <XKT02T_QW2tKLHpR7e3VuZjLXv3RP2E0GD54gXKrdIFm8xQsKvAyjg@cipher.nrlssc.navy.mil>
On Tue, Jul 22, 2008 at 04:15:41PM -0500, Brandon Casey wrote:
> The perl modules must be copied to blib/lib so they are available for
> testing.
>
> Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
I don't understand why do you need to do this; perl.mak should do this
on its own during project-wide make all. What Perl version are you using?
How does the pm_to_blib target look like?
pm_to_blib : $(TO_INST_PM)
$(NOECHO) $(ABSPERLRUN) -MExtUtils::Install -e 'pm_to_blib({@ARGV}, '\''$(INST_LIB)/auto'\'', '\''$(PM_FILTER)'\'')' -- \
Git.pm $(INST_LIBDIR)/Git.pm
$(NOECHO) $(TOUCH) pm_to_blib
here. Is your INST_LIB = blib/lib and INST_LIBDIR = $(INST_LIB)?
--
Petr "Pasky" Baudis
As in certain cults it is possible to kill a process if you know
its true name. -- Ken Thompson and Dennis M. Ritchie
^ permalink raw reply
* Re: [FYI PATCH] git wrapper: DWIM mistyped commands
From: Sverre Rabbelier @ 2008-07-22 23:10 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Johannes Schindelin, git
In-Reply-To: <7vwsjdjz9e.fsf@gitster.siamese.dyndns.org>
On Wed, Jul 23, 2008 at 1:05 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
>> So I mistyped 'reabse' for the hundred trillionth time, but I
>> will never have to correct my mistakes again.
>>
>> Note: this patch is _not_ meant for inclusion.
>
> Heh, I do "git emrge" all the time ;-)
>
> Time to start a "gitster private edition" branch for my own use, I guess.
If it is the same typo all the time, wouldn't aliasses do the trick?
--
Cheers,
Sverre Rabbelier
^ permalink raw reply
* Re: [PATCH] Respect crlf attribute even if core.autocrlf has not been set
From: Dmitry Potapov @ 2008-07-22 23:11 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git, gitster
In-Reply-To: <alpine.DEB.1.00.0807222255450.8986@racer>
On Tue, Jul 22, 2008 at 10:56:04PM +0100, Johannes Schindelin wrote:
>
> When a file's crlf attribute is explicitely set, it does not make sense
> to ignore it, just because the config variable core.autocrlf has not
> been set.
Hmm... About a week ago, I was about to propose the same change, but
after reading documentation and some thinking I was not able to convince
myself that this change would be the right thing to do.
First, let's look at what Git's documentation says:
===
`crlf`
^^^^^^
This attribute controls the line-ending convention.
Set::
Setting the `crlf` attribute on a path is meant to mark
the path as a "text" file. 'core.autocrlf' conversion
takes place without guessing the content type by
inspection.
<snip>
The `core.autocrlf` conversion
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
If the configuration variable `core.autocrlf` is false, no
conversion is done.
===
So, my reading is that if I set the `crlf` attribute on some path, but
I have core.autocrlf=false, there will be no conversion.
And this can be used to mark text files in .gitattribute, which is
stored in the repository and thus it is shared among users with
different end-of-line ending, i.e. you can have something like this
in .gitattribute:
*.[ch] crlf
*.txt crlf
but on Unix, you have core.autocrlf=false, so no conversion is done,
while, on Windows, you set core.autocrlf=true, so you will have crlf
conversion without any guessing.
Now, I can agree with you that using the 'crlf' attribute to mark text
files may appear not very intuitive (you may expect that crlf means that
those files always need crlf conversion), but right now we do not have
any better way to mark text files and the using crlf in this role is
explicitly suggested by documentation. See above.
> diff --git a/t/t0020-crlf.sh b/t/t0020-crlf.sh
> index 1be7446..0bb3e6f 100755
> --- a/t/t0020-crlf.sh
> +++ b/t/t0020-crlf.sh
> @@ -436,4 +436,14 @@ test_expect_success 'invalid .gitattributes (must not crash)' '
>
> '
>
> +test_expect_success 'attribute crlf is heeded even without core.autocrlf' '
s/heeded/needed/
Dmitry
^ permalink raw reply
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