* [PATCH 1/4] diff.c: pass struct diff_words into find_word_boundaries
From: Thomas Rast @ 2010-12-15 15:13 UTC (permalink / raw)
To: Scott Johnson; +Cc: Michael J Gruber, Matthijs Kooijman, git
In-Reply-To: <cover.1292424926.git.trast@student.ethz.ch>
We need the word_regex_check member. Instead of adding another
argument, just pass in the whole struct for future extensibility.
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
diff.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/diff.c b/diff.c
index a16ce69..8758a51 100644
--- a/diff.c
+++ b/diff.c
@@ -778,12 +778,13 @@ static void fn_out_diff_words_aux(void *priv, char *line, unsigned long len)
}
/* This function starts looking at *begin, and returns 0 iff a word was found. */
-static int find_word_boundaries(mmfile_t *buffer, regex_t *word_regex,
+static int find_word_boundaries(mmfile_t *buffer, struct diff_words_data *diff_words,
int *begin, int *end)
{
- if (word_regex && *begin < buffer->size) {
+ if (diff_words->word_regex && *begin < buffer->size) {
regmatch_t match[1];
- if (!regexec(word_regex, buffer->ptr + *begin, 1, match, 0)) {
+ if (!regexec(diff_words->word_regex, buffer->ptr + *begin,
+ 1, match, 0)) {
char *p = memchr(buffer->ptr + *begin + match[0].rm_so,
'\n', match[0].rm_eo - match[0].rm_so);
*end = p ? p - buffer->ptr : match[0].rm_eo + *begin;
@@ -813,7 +814,7 @@ static int find_word_boundaries(mmfile_t *buffer, regex_t *word_regex,
* in buffer->orig.
*/
static void diff_words_fill(struct diff_words_buffer *buffer, mmfile_t *out,
- regex_t *word_regex)
+ struct diff_words_data *diff_words)
{
int i, j;
long alloc = 0;
@@ -827,7 +828,7 @@ static void diff_words_fill(struct diff_words_buffer *buffer, mmfile_t *out,
buffer->orig_nr = 1;
for (i = 0; i < buffer->text.size; i++) {
- if (find_word_boundaries(&buffer->text, word_regex, &i, &j))
+ if (find_word_boundaries(&buffer->text, diff_words, &i, &j))
return;
/* store original boundaries */
--
1.7.3.3.807.g6ee1f
^ permalink raw reply related
* [PATCH 2/4] diff.c: implement a sanity check for word regexes
From: Thomas Rast @ 2010-12-15 15:13 UTC (permalink / raw)
To: Scott Johnson; +Cc: Michael J Gruber, Matthijs Kooijman, git
In-Reply-To: <cover.1292424926.git.trast@student.ethz.ch>
Word regexes are a bit of a dangerous beast, since it is easily
possible to not match a non-space part, which is subsequently ignored
for the purposes of emitting the word diff. This was clearly stated
in the docs, but users still tripped over it.
Implement a safeguard that verifies two basic sanity assumptions:
* The word regex matches anything that is !isspace().
* The word regex does not match '\n'. (This case is not very harmful,
but we used to silently cut off at the '\n' which may go against
user expectations.)
This is configurable via 'diff.wordRegexCheck', and defaults to
'warn'.
Reported-by: Scott Johnson <scottj75074@yahoo.com>
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
Documentation/config.txt | 8 ++++
diff.c | 93 +++++++++++++++++++++++++++++++++++++++++++--
diff.h | 1 +
t/t4034-diff-words.sh | 65 +++++++++++++++++++++++++++++++-
4 files changed, 161 insertions(+), 6 deletions(-)
diff --git a/Documentation/config.txt b/Documentation/config.txt
index bf9479e..2e033ea 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -897,6 +897,14 @@ diff.wordRegex::
sequences that match the regular expression are "words", all other
characters are *ignorable* whitespace.
+diff.wordRegexCheck::
+ Perform a simple sanity check on matches of the word regex.
+ Currently this check ensures that the word regex matches all
+ non-space characters, and that the word regex does not match a
+ newline. The setting controls what to do when the check
+ fails: 'false'/'off'/'ignore' ignore, 'true'/'on'/'warn' emit
+ a warning, and 'error' abort with an error message.
+
fetch.recurseSubmodules::
A boolean value which changes the behavior for fetch and pull, the
default is to not recursively fetch populated sumodules unless
diff --git a/diff.c b/diff.c
index 8758a51..becefcf 100644
--- a/diff.c
+++ b/diff.c
@@ -22,11 +22,17 @@
#define FAST_WORKING_DIRECTORY 1
#endif
+#define REGEX_CHECK_UNSET -1
+#define REGEX_CHECK_OFF 0
+#define REGEX_CHECK_WARN 1
+#define REGEX_CHECK_ERROR 2
+
static int diff_detect_rename_default;
static int diff_rename_limit_default = 200;
static int diff_suppress_blank_empty;
int diff_use_color_default = -1;
static const char *diff_word_regex_cfg;
+static int diff_word_regex_check_cfg = REGEX_CHECK_UNSET;
static const char *external_diff_cmd_cfg;
int diff_auto_refresh_index = 1;
static int diff_mnemonic_prefix;
@@ -75,6 +81,19 @@ static int git_config_rename(const char *var, const char *value)
return git_config_bool(var,value) ? DIFF_DETECT_RENAME : 0;
}
+static int parse_regex_check_level(int *b, const char *k, const char *v)
+{
+ if (v && !strcasecmp(v, "ignore"))
+ *b = REGEX_CHECK_OFF;
+ else if (v && !strcasecmp(v, "warn"))
+ *b = REGEX_CHECK_WARN;
+ else if (v && !strcasecmp(v, "error"))
+ *b = REGEX_CHECK_ERROR;
+ else
+ *b = git_config_bool(k, v);
+ return 1;
+}
+
/*
* These are to give UI layer defaults.
* The core-level commands such as git-diff-files should
@@ -107,6 +126,8 @@ int git_diff_ui_config(const char *var, const char *value, void *cb)
return git_config_string(&external_diff_cmd_cfg, var, value);
if (!strcmp(var, "diff.wordregex"))
return git_config_string(&diff_word_regex_cfg, var, value);
+ if (!strcmp(var, "diff.wordregexcheck"))
+ return parse_regex_check_level(&diff_word_regex_check_cfg, var, value);
if (!strcmp(var, "diff.ignoresubmodules"))
handle_ignore_submodules_arg(&default_diff_options, value);
@@ -777,6 +798,50 @@ static void fn_out_diff_words_aux(void *priv, char *line, unsigned long len)
diff_words->last_minus = minus_first;
}
+
+static void check_word_regex_match(struct diff_words_data *diff_words,
+ char *start, int len, int unmatched)
+{
+ int check = diff_words->opt->word_regex_check;
+ void (*report_fn)(const char *, ...);
+
+ if (check == REGEX_CHECK_OFF)
+ return;
+
+ if (check == REGEX_CHECK_WARN)
+ report_fn = warning;
+ else if (check == REGEX_CHECK_ERROR)
+ report_fn = die;
+ else
+ assert(!"expected REGEX_CHECK_WARN or _ERROR");
+
+ if (unmatched) {
+ int i;
+ char *match_str;
+ for (i = 0; i < len; i++) {
+ if (isspace(start[i]))
+ continue;
+ match_str = xmemdupz(start, len);
+ report_fn("The following snippet contains non-space "
+ "characters, but was not\nmatched by the "
+ "word regex:\n'%s'\n"
+ "They would be ignored for the purposes of "
+ "the diff, which is\nusually not what you want.",
+ match_str);
+ free(match_str);
+ break;
+ }
+ } else {
+ if (memchr(start, '\n', len)) {
+ char *match_str = xmemdupz(start, len);
+ report_fn("The following word regex match contains a newline "
+ "and will be truncated there:\n'%s'",
+ match_str);
+ free(match_str);
+ }
+ }
+}
+
/* This function starts looking at *begin, and returns 0 iff a word was found. */
static int find_word_boundaries(mmfile_t *buffer, struct diff_words_data *diff_words,
int *begin, int *end)
@@ -785,8 +850,15 @@ static int find_word_boundaries(mmfile_t *buffer, struct diff_words_data *diff_w
regmatch_t match[1];
if (!regexec(diff_words->word_regex, buffer->ptr + *begin,
1, match, 0)) {
- char *p = memchr(buffer->ptr + *begin + match[0].rm_so,
- '\n', match[0].rm_eo - match[0].rm_so);
+ char *prev_start = buffer->ptr + *begin;
+ char *match_start = prev_start + match[0].rm_so;
+ int match_len = match[0].rm_eo - match[0].rm_so;
+ char *p;
+ check_word_regex_match(diff_words, prev_start,
+ match_start-prev_start, 1);
+ check_word_regex_match(diff_words, match_start,
+ match_len, 0);
+ p = memchr(match_start, '\n', match_len);
*end = p ? p - buffer->ptr : match[0].rm_eo + *begin;
*begin += match[0].rm_so;
return *begin >= *end;
@@ -829,7 +901,7 @@ static void diff_words_fill(struct diff_words_buffer *buffer, mmfile_t *out,
for (i = 0; i < buffer->text.size; i++) {
if (find_word_boundaries(&buffer->text, diff_words, &i, &j))
- return;
+ break;
/* store original boundaries */
ALLOC_GROW(buffer->orig, buffer->orig_nr + 1,
@@ -846,6 +918,11 @@ static void diff_words_fill(struct diff_words_buffer *buffer, mmfile_t *out,
i = j - 1;
}
+
+ /* no more boundaries, check any non-matched chunk remaining */
+ if (i < buffer->text.size)
+ check_word_regex_match(diff_words, buffer->text.ptr + i,
+ buffer->text.size-i, 1);
}
/* this executes the word diff on the accumulated buffers */
@@ -882,8 +959,8 @@ static void diff_words_show(struct diff_words_data *diff_words)
memset(&xpp, 0, sizeof(xpp));
memset(&xecfg, 0, sizeof(xecfg));
- diff_words_fill(&diff_words->minus, &minus, diff_words->word_regex);
- diff_words_fill(&diff_words->plus, &plus, diff_words->word_regex);
+ diff_words_fill(&diff_words->minus, &minus, diff_words);
+ diff_words_fill(&diff_words->plus, &plus, diff_words);
xpp.flags = 0;
/* as only the hunk header will be parsed, we need a 0-context */
xecfg.ctxlen = 0;
@@ -2021,6 +2098,10 @@ static void builtin_diff(const char *name_a,
o->word_regex = userdiff_word_regex(two);
if (!o->word_regex)
o->word_regex = diff_word_regex_cfg;
+ if (o->word_regex_check == REGEX_CHECK_UNSET)
+ o->word_regex_check = diff_word_regex_check_cfg;
+ if (o->word_regex_check == REGEX_CHECK_UNSET)
+ o->word_regex_check = REGEX_CHECK_WARN;
if (o->word_regex) {
ecbdata.diff_words->word_regex = (regex_t *)
xmalloc(sizeof(regex_t));
@@ -2861,6 +2942,8 @@ void diff_setup(struct diff_options *options)
options->a_prefix = "a/";
options->b_prefix = "b/";
}
+
+ options->word_regex_check = REGEX_CHECK_UNSET;
}
int diff_setup_done(struct diff_options *options)
diff --git a/diff.h b/diff.h
index 165f368..5f6a7be 100644
--- a/diff.h
+++ b/diff.h
@@ -123,6 +123,7 @@ struct diff_options {
int stat_width;
int stat_name_width;
const char *word_regex;
+ int word_regex_check;
enum diff_words_type word_diff;
/* this is set by diffcore for DIFF_FORMAT_PATCH */
diff --git a/t/t4034-diff-words.sh b/t/t4034-diff-words.sh
index 8096d8a..ebe72ce 100755
--- a/t/t4034-diff-words.sh
+++ b/t/t4034-diff-words.sh
@@ -8,7 +8,8 @@ test_expect_success setup '
git config diff.color.old red &&
git config diff.color.new green &&
- git config diff.color.func magenta
+ git config diff.color.func magenta &&
+ git config diff.wordRegexCheck off
'
@@ -331,4 +332,66 @@ test_expect_success '--word-diff=none' '
'
+echo abcd > pre
+echo aXYd > post
+
+test_expect_success 'diff.wordRegexCheck="error" catches nonspaces' '
+
+ git config diff.wordRegexCheck error &&
+ test_must_fail git diff --no-index --word-diff-regex="a|d" pre post 2>out &&
+ grep "fatal.*contains non-space characters" out
+
+'
+
+newline="
+"
+
+test_expect_success 'diff.wordRegexCheck="error" catches newlines' '
+
+ git config diff.wordRegexCheck error &&
+ test_must_fail git diff --no-index --word-diff-regex=".|$newline" pre post 2>out &&
+ grep "fatal.*contains a newline" out
+
+'
+
+test_expect_success 'diff.wordRegexCheck="warn" works' '
+
+ git config diff.wordRegexCheck warn &&
+ test_must_fail git diff --no-index --word-diff-regex="a|d" pre post 2>out &&
+ grep "warning.*contains non-space characters" out
+
+'
+
+test_expect_success 'diff.wordRegexCheck="ignore" works' '
+
+ git config diff.wordRegexCheck ignore &&
+ test_must_fail git diff --no-index --word-diff-regex="a|d" pre post 2>out &&
+ ! grep "contains non-space characters" out
+
+'
+
+test_expect_success 'diff.wordRegexCheck="false" is like "ignore"' '
+
+ git config diff.wordRegexCheck false &&
+ test_must_fail git diff --no-index --word-diff-regex="a|d" pre post 2>out &&
+ ! grep "contains non-space characters" out
+
+'
+
+test_expect_success 'diff.wordRegexCheck="true" is like "warn"' '
+
+ git config diff.wordRegexCheck true &&
+ test_must_fail git diff --no-index --word-diff-regex="a|d" pre post 2>out &&
+ grep "warning.*contains non-space characters" out
+
+'
+
+test_expect_success 'diff.wordRegexCheck unset is like "warn"' '
+
+ git config --unset diff.wordRegexCheck &&
+ test_must_fail git diff --no-index --word-diff-regex="a|d" pre post 2>out &&
+ grep "warning.*contains non-space characters" out
+
+'
+
test_done
--
1.7.3.3.807.g6ee1f
^ permalink raw reply related
* [PATCH 3/4] userdiff: fix typo in ruby word regex
From: Thomas Rast @ 2010-12-15 15:13 UTC (permalink / raw)
To: Scott Johnson; +Cc: Michael J Gruber, Matthijs Kooijman, git
In-Reply-To: <cover.1292424926.git.trast@student.ethz.ch>
The regex had an unclosed ] that pretty much ruined the safeguard
against not matching a non-space char.
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
userdiff.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/userdiff.c b/userdiff.c
index f9e05b5..4d6433b 100644
--- a/userdiff.c
+++ b/userdiff.c
@@ -81,7 +81,7 @@
"(@|@@|\\$)?[a-zA-Z_][a-zA-Z0-9_]*"
"|[-+0-9.e]+|0[xXbB]?[0-9a-fA-F]+|\\?(\\\\C-)?(\\\\M-)?."
"|//=?|[-+*/<>%&^|=!]=|<<=?|>>=?|===|\\.{1,3}|::|[!=]~"
- "|[^[:space:]|[\x80-\xff]+"),
+ "|[^[:space:]]|[\x80-\xff]+"),
PATTERNS("bibtex", "(@[a-zA-Z]{1,}[ \t]*\\{{0,1}[ \t]*[^ \t\"@',\\#}{~%]*).*$",
"[={}\"]|[^={}\" \t]+"),
PATTERNS("tex", "^(\\\\((sub)*section|chapter|part)\\*{0,1}\\{.*)$",
--
1.7.3.3.807.g6ee1f
^ permalink raw reply related
* [PATCH 0/4] --word-regex sanity checking and such
From: Thomas Rast @ 2010-12-15 15:13 UTC (permalink / raw)
To: Scott Johnson; +Cc: Michael J Gruber, Matthijs Kooijman, git
In-Reply-To: <561247.22837.qm@web110707.mail.gq1.yahoo.com>
[Forgot the list and Matthijs on the first sending. Sorry for the
spam!]
Scott Johnson wrote [trimmed and wraps fixed up]:
> Here's the default `git diff --word-diff`:
> [-<li class="yws-maps"><em></em><a-]{+<li><em></em><a+} href="#">yws-maps</a></li>
> [-<li class="ydn-delicious"><em></em><a-]{+<li><em></em><a+} href="#">ydn-delicious</a></li>
>
> Which is correct, but less than ideal because it highlights much more than the
> actual changes.
>
> So I create a .gitattributes file with one line:
> *.html diff=html
>
> And rerun `git diff --word-diff`:
> <li[-class="yws-maps"-]><em></em><a href="#">yws-maps</a></li>
> <li><em></em><a href="#">ydn-delicious</a></li>
>
> Yikes! What happened to the second line of changes? The removed code is not
> displayed at all.
Michael J Gruber wrote:
> Yep, I just found out myself experimenting with a wordRegex for csv.
> Seems like quite a "Gimme rope" feature...
>
> So, it's the regex.
Well. Yes. No. Maybe.
Thanks for bringing this to my attention. I currently have enough
more serious work to avoid that this actually motivated me to hack up
a sanity check. It's just far too error prone as it is now.
But I cannot reproduce the problem! I put Scott's two offending lines
(taken from his "straight" diff) into t4034/html/{pre,post}, and I
think the output is valid. Also, the word regex for html has long
included the |[^[:space:]] safeguard (actually they all do except for
bibtex, which is even more lenient on what it matches). So you either
found an example that depends on more context (which would be *really*
bad) or there is another source of bad regexes. Anyway, the safeguard
should easily catch the latter case.
This did unearth a bug in the ruby regex, though, so it's been worth
the trouble.
Various small issues with this patch series:
* [4/4] I stole the html test from Scott's mail, and some of the rest
from various Wikibooks sources on "Hello World" in each language,
usually extended by a bit of code that tests the world-splitting
power. I hope this is ok with Scott and the Copyright overlords.
There are only so many ways to spell "Hello World", and only so many
languages I know myself.
* [4/4] Many patterns do not split 1+2, probably because they stick +2
together as a signed integer literal, even though I think they
should. I ran out of time to investigate however.
* [3/4] was actually detected with the help of [4/4], but putting it
after would require heavy special casing.
* [2/4] It's a weird idiosyncrasy of the word-diff code that the exit
status of git-diff does not depend on whether word-diff found any
differences, and in fact the shown hunks do not either. So the
tests are "test_must_fail" regardless of word regex, because the
input files differ at a byte level. Maybe at least hunks without
word differences should be suppressed?
Thomas Rast (4):
diff.c: pass struct diff_words into find_word_boundaries
diff.c: implement a sanity check for word regexes
userdiff: fix typo in ruby word regex
t4034: bulk verify builtin word regex sanity
Documentation/config.txt | 8 ++++
diff.c | 104 +++++++++++++++++++++++++++++++++++++++++----
diff.h | 1 +
t/t4034-diff-words.sh | 85 +++++++++++++++++++++++++++++++++++++-
t/t4034/bibtex/expect | 15 +++++++
t/t4034/bibtex/post | 10 ++++
t/t4034/bibtex/pre | 9 ++++
t/t4034/cpp/expect | 10 ++++
t/t4034/cpp/post | 5 ++
t/t4034/cpp/pre | 4 ++
t/t4034/csharp/expect | 12 +++++
t/t4034/csharp/post | 8 ++++
t/t4034/csharp/pre | 8 ++++
t/t4034/fortran/expect | 12 +++++
t/t4034/fortran/post | 7 +++
t/t4034/fortran/pre | 7 +++
t/t4034/html/expect | 7 +++
t/t4034/html/post | 2 +
t/t4034/html/pre | 2 +
t/t4034/java/expect | 11 +++++
t/t4034/java/post | 6 +++
t/t4034/java/pre | 6 +++
t/t4034/objc/expect | 11 +++++
t/t4034/objc/post | 7 +++
t/t4034/objc/pre | 7 +++
t/t4034/pascal/expect | 12 +++++
t/t4034/pascal/post | 7 +++
t/t4034/pascal/pre | 7 +++
t/t4034/php/expect | 7 +++
t/t4034/php/post | 2 +
t/t4034/php/pre | 2 +
t/t4034/python/expect | 8 ++++
t/t4034/python/post | 3 +
t/t4034/python/pre | 3 +
t/t4034/ruby/expect | 7 +++
t/t4034/ruby/post | 2 +
t/t4034/ruby/pre | 2 +
t/t4034/tex/expect | 9 ++++
t/t4034/tex/post | 4 ++
t/t4034/tex/pre | 4 ++
userdiff.c | 2 +-
41 files changed, 433 insertions(+), 12 deletions(-)
create mode 100644 t/t4034/bibtex/expect
create mode 100644 t/t4034/bibtex/post
create mode 100644 t/t4034/bibtex/pre
create mode 100644 t/t4034/cpp/expect
create mode 100644 t/t4034/cpp/post
create mode 100644 t/t4034/cpp/pre
create mode 100644 t/t4034/csharp/expect
create mode 100644 t/t4034/csharp/post
create mode 100644 t/t4034/csharp/pre
create mode 100644 t/t4034/fortran/expect
create mode 100644 t/t4034/fortran/post
create mode 100644 t/t4034/fortran/pre
create mode 100644 t/t4034/html/expect
create mode 100644 t/t4034/html/post
create mode 100644 t/t4034/html/pre
create mode 100644 t/t4034/java/expect
create mode 100644 t/t4034/java/post
create mode 100644 t/t4034/java/pre
create mode 100644 t/t4034/objc/expect
create mode 100644 t/t4034/objc/post
create mode 100644 t/t4034/objc/pre
create mode 100644 t/t4034/pascal/expect
create mode 100644 t/t4034/pascal/post
create mode 100644 t/t4034/pascal/pre
create mode 100644 t/t4034/php/expect
create mode 100644 t/t4034/php/post
create mode 100644 t/t4034/php/pre
create mode 100644 t/t4034/python/expect
create mode 100644 t/t4034/python/post
create mode 100644 t/t4034/python/pre
create mode 100644 t/t4034/ruby/expect
create mode 100644 t/t4034/ruby/post
create mode 100644 t/t4034/ruby/pre
create mode 100644 t/t4034/tex/expect
create mode 100644 t/t4034/tex/post
create mode 100644 t/t4034/tex/pre
--
1.7.3.3.807.g6ee1f
^ permalink raw reply
* [PATCH 4/4] t4034: bulk verify builtin word regex sanity
From: Thomas Rast @ 2010-12-15 15:13 UTC (permalink / raw)
To: Scott Johnson; +Cc: Michael J Gruber, Matthijs Kooijman, git
In-Reply-To: <cover.1292424926.git.trast@student.ethz.ch>
The builtin word regexes should be tested with some simple examples
against simple issues, like failing to match a non-space character.
Do this in bulk. Many of these patterns are a rather ad-hoc
combination of a few simple lines of code, so they can certainly be
improved. However, they already unearthed a typo in the ruby pattern
(previous commit).
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
t/t4034-diff-words.sh | 20 ++++++++++++++++++++
t/t4034/bibtex/expect | 15 +++++++++++++++
t/t4034/bibtex/post | 10 ++++++++++
t/t4034/bibtex/pre | 9 +++++++++
t/t4034/cpp/expect | 10 ++++++++++
t/t4034/cpp/post | 5 +++++
t/t4034/cpp/pre | 4 ++++
t/t4034/csharp/expect | 12 ++++++++++++
t/t4034/csharp/post | 8 ++++++++
t/t4034/csharp/pre | 8 ++++++++
t/t4034/fortran/expect | 12 ++++++++++++
t/t4034/fortran/post | 7 +++++++
t/t4034/fortran/pre | 7 +++++++
t/t4034/html/expect | 7 +++++++
t/t4034/html/post | 2 ++
t/t4034/html/pre | 2 ++
t/t4034/java/expect | 11 +++++++++++
t/t4034/java/post | 6 ++++++
t/t4034/java/pre | 6 ++++++
t/t4034/objc/expect | 11 +++++++++++
t/t4034/objc/post | 7 +++++++
t/t4034/objc/pre | 7 +++++++
t/t4034/pascal/expect | 12 ++++++++++++
t/t4034/pascal/post | 7 +++++++
t/t4034/pascal/pre | 7 +++++++
t/t4034/php/expect | 7 +++++++
t/t4034/php/post | 2 ++
t/t4034/php/pre | 2 ++
t/t4034/python/expect | 8 ++++++++
t/t4034/python/post | 3 +++
t/t4034/python/pre | 3 +++
t/t4034/ruby/expect | 7 +++++++
t/t4034/ruby/post | 2 ++
t/t4034/ruby/pre | 2 ++
t/t4034/tex/expect | 9 +++++++++
t/t4034/tex/post | 4 ++++
t/t4034/tex/pre | 4 ++++
37 files changed, 265 insertions(+), 0 deletions(-)
create mode 100644 t/t4034/bibtex/expect
create mode 100644 t/t4034/bibtex/post
create mode 100644 t/t4034/bibtex/pre
create mode 100644 t/t4034/cpp/expect
create mode 100644 t/t4034/cpp/post
create mode 100644 t/t4034/cpp/pre
create mode 100644 t/t4034/csharp/expect
create mode 100644 t/t4034/csharp/post
create mode 100644 t/t4034/csharp/pre
create mode 100644 t/t4034/fortran/expect
create mode 100644 t/t4034/fortran/post
create mode 100644 t/t4034/fortran/pre
create mode 100644 t/t4034/html/expect
create mode 100644 t/t4034/html/post
create mode 100644 t/t4034/html/pre
create mode 100644 t/t4034/java/expect
create mode 100644 t/t4034/java/post
create mode 100644 t/t4034/java/pre
create mode 100644 t/t4034/objc/expect
create mode 100644 t/t4034/objc/post
create mode 100644 t/t4034/objc/pre
create mode 100644 t/t4034/pascal/expect
create mode 100644 t/t4034/pascal/post
create mode 100644 t/t4034/pascal/pre
create mode 100644 t/t4034/php/expect
create mode 100644 t/t4034/php/post
create mode 100644 t/t4034/php/pre
create mode 100644 t/t4034/python/expect
create mode 100644 t/t4034/python/post
create mode 100644 t/t4034/python/pre
create mode 100644 t/t4034/ruby/expect
create mode 100644 t/t4034/ruby/post
create mode 100644 t/t4034/ruby/pre
create mode 100644 t/t4034/tex/expect
create mode 100644 t/t4034/tex/post
create mode 100644 t/t4034/tex/pre
diff --git a/t/t4034-diff-words.sh b/t/t4034-diff-words.sh
index ebe72ce..b085948 100755
--- a/t/t4034-diff-words.sh
+++ b/t/t4034-diff-words.sh
@@ -394,4 +394,24 @@ test_expect_success 'diff.wordRegexCheck unset is like "warn"' '
'
+test_expect_success 'set diff.wordRegexCheck=error for language tests' '
+
+ git config diff.wordRegexCheck error
+
+'
+
+word_diff_for_language () {
+ cp $TEST_DIRECTORY/t4034/$1/pre $TEST_DIRECTORY/t4034/$1/post \
+ $TEST_DIRECTORY/t4034/$1/expect . &&
+ echo "* diff=$1" > .gitattributes &&
+ word_diff --color-words
+}
+
+for lang_dir in $TEST_DIRECTORY/t4034/*; do
+ lang=${lang_dir#$TEST_DIRECTORY/t4034/}
+ test_expect_success "diff driver '$lang' has sane word regex" "
+ word_diff_for_language $lang
+ "
+done
+
test_done
diff --git a/t/t4034/bibtex/expect b/t/t4034/bibtex/expect
new file mode 100644
index 0000000..a157774
--- /dev/null
+++ b/t/t4034/bibtex/expect
@@ -0,0 +1,15 @@
+<BOLD>diff --git a/pre b/post<RESET>
+<BOLD>index 95cd55b..ddcba9b 100644<RESET>
+<BOLD>--- a/pre<RESET>
+<BOLD>+++ b/post<RESET>
+<CYAN>@@ -1,9 +1,10 @@<RESET>
+@article{aldous1987uie,<RESET>
+ title={{Ultimate instability of exponential back-off protocol for acknowledgment-based transmission control of random access communication channels}},<RESET>
+ author={Aldous, <RED>D.<RESET><GREEN>David<RESET>},
+ journal={Information Theory, IEEE Transactions on},<RESET>
+ volume={<RED>33<RESET><GREEN>Bogus.<RESET>},
+ number={<RED>2<RESET><GREEN>4<RESET>},
+ pages={219--223},<RESET>
+ year=<GREEN>1987,<RESET>
+<GREEN> note={This is in fact a rather funny read since ethernet works well in practice. The<RESET> {<RED>1987<RESET><GREEN>\em pre} reference is the right one, however.<RESET>}<RED>,<RESET>
+}<RESET>
diff --git a/t/t4034/bibtex/post b/t/t4034/bibtex/post
new file mode 100644
index 0000000..ddcba9b
--- /dev/null
+++ b/t/t4034/bibtex/post
@@ -0,0 +1,10 @@
+@article{aldous1987uie,
+ title={{Ultimate instability of exponential back-off protocol for acknowledgment-based transmission control of random access communication channels}},
+ author={Aldous, David},
+ journal={Information Theory, IEEE Transactions on},
+ volume={Bogus.},
+ number={4},
+ pages={219--223},
+ year=1987,
+ note={This is in fact a rather funny read since ethernet works well in practice. The {\em pre} reference is the right one, however.}
+}
diff --git a/t/t4034/bibtex/pre b/t/t4034/bibtex/pre
new file mode 100644
index 0000000..95cd55b
--- /dev/null
+++ b/t/t4034/bibtex/pre
@@ -0,0 +1,9 @@
+@article{aldous1987uie,
+ title={{Ultimate instability of exponential back-off protocol for acknowledgment-based transmission control of random access communication channels}},
+ author={Aldous, D.},
+ journal={Information Theory, IEEE Transactions on},
+ volume={33},
+ number={2},
+ pages={219--223},
+ year={1987},
+}
diff --git a/t/t4034/cpp/expect b/t/t4034/cpp/expect
new file mode 100644
index 0000000..e529842
--- /dev/null
+++ b/t/t4034/cpp/expect
@@ -0,0 +1,10 @@
+<BOLD>diff --git a/pre b/post<RESET>
+<BOLD>index 5517c3c..17aa265 100644<RESET>
+<BOLD>--- a/pre<RESET>
+<BOLD>+++ b/post<RESET>
+<CYAN>@@ -1,4 +1,5 @@<RESET>
+class Foo : public Thing{
+ Foo() : x(0<RED>&&1<RESET><GREEN>&42<RESET>) {
+ <GREEN>bar(x);<RESET>
+ }
+}<GREEN>;<RESET>
diff --git a/t/t4034/cpp/post b/t/t4034/cpp/post
new file mode 100644
index 0000000..17aa265
--- /dev/null
+++ b/t/t4034/cpp/post
@@ -0,0 +1,5 @@
+class Foo : public Thing{
+ Foo() : x(0&42) {
+ bar(x);
+ }
+};
diff --git a/t/t4034/cpp/pre b/t/t4034/cpp/pre
new file mode 100644
index 0000000..5517c3c
--- /dev/null
+++ b/t/t4034/cpp/pre
@@ -0,0 +1,4 @@
+class Foo:public Thing{
+ Foo():x(0&&1){}
+}
+
diff --git a/t/t4034/csharp/expect b/t/t4034/csharp/expect
new file mode 100644
index 0000000..c8b6b8f
--- /dev/null
+++ b/t/t4034/csharp/expect
@@ -0,0 +1,12 @@
+<BOLD>diff --git a/pre b/post<RESET>
+<BOLD>index 8ff9319..9869fa9 100644<RESET>
+<BOLD>--- a/pre<RESET>
+<BOLD>+++ b/post<RESET>
+<CYAN>@@ -2,7 +2,7 @@<RESET> <RESET><MAGENTA>class Program<RESET>
+{<RESET>
+ static void Main()<RESET>
+ {<RESET>
+ Console.WriteLine("Hello, <GREEN>New<RESET> World!");
+ int i = <RED>5<RESET><GREEN>5+0<RESET>;
+ }<RESET>
+}<RESET>
diff --git a/t/t4034/csharp/post b/t/t4034/csharp/post
new file mode 100644
index 0000000..9869fa9
--- /dev/null
+++ b/t/t4034/csharp/post
@@ -0,0 +1,8 @@
+class Program
+{
+ static void Main()
+ {
+ Console.WriteLine("Hello, New World!");
+ int i = 5+0;
+ }
+}
diff --git a/t/t4034/csharp/pre b/t/t4034/csharp/pre
new file mode 100644
index 0000000..8ff9319
--- /dev/null
+++ b/t/t4034/csharp/pre
@@ -0,0 +1,8 @@
+class Program
+{
+ static void Main()
+ {
+ Console.WriteLine("Hello, World!");
+ int i=5;
+ }
+}
diff --git a/t/t4034/fortran/expect b/t/t4034/fortran/expect
new file mode 100644
index 0000000..5a25663
--- /dev/null
+++ b/t/t4034/fortran/expect
@@ -0,0 +1,12 @@
+<BOLD>diff --git a/pre b/post<RESET>
+<BOLD>index 08b4e5a..fb7cb51 100644<RESET>
+<BOLD>--- a/pre<RESET>
+<BOLD>+++ b/post<RESET>
+<CYAN>@@ -1,7 +1,7 @@<RESET>
+program hello<RESET>
+ print *, "Hello World<RED>!<RESET><GREEN>?<RESET>"
+
+ DO10I = 1,10<RESET>
+ <RED>DO10I<RESET><GREEN>DO 10 I<RESET> = 1,10
+ <RED>DO10I<RESET><GREEN>DO 1 0 I<RESET> = 1,10
+end program hello<RESET>
diff --git a/t/t4034/fortran/post b/t/t4034/fortran/post
new file mode 100644
index 0000000..fb7cb51
--- /dev/null
+++ b/t/t4034/fortran/post
@@ -0,0 +1,7 @@
+program hello
+ print *, "Hello World?"
+
+ DO10I = 1,10
+ DO 10 I = 1,10
+ DO 1 0 I = 1,10
+end program hello
diff --git a/t/t4034/fortran/pre b/t/t4034/fortran/pre
new file mode 100644
index 0000000..08b4e5a
--- /dev/null
+++ b/t/t4034/fortran/pre
@@ -0,0 +1,7 @@
+program hello
+ print *, "Hello World!"
+
+ DO10I = 1,10
+ DO10I = 1,10
+ DO10I = 1,10
+end program hello
diff --git a/t/t4034/html/expect b/t/t4034/html/expect
new file mode 100644
index 0000000..78d28d4
--- /dev/null
+++ b/t/t4034/html/expect
@@ -0,0 +1,7 @@
+<BOLD>diff --git a/pre b/post<RESET>
+<BOLD>index 8bf936a..125bdd5 100644<RESET>
+<BOLD>--- a/pre<RESET>
+<BOLD>+++ b/post<RESET>
+<CYAN>@@ -1,2 +1,2 @@<RESET>
+<li<RED>class="yws-maps"<RESET>><em></em><a href="#">yws-maps</a></li>
+<li<RED>class="ydn-delicious"<RESET>><em></em><a href="#">ydn-delicious</a></li>
diff --git a/t/t4034/html/post b/t/t4034/html/post
new file mode 100644
index 0000000..125bdd5
--- /dev/null
+++ b/t/t4034/html/post
@@ -0,0 +1,2 @@
+<li><em></em><a href="#">yws-maps</a></li>
+<li><em></em><a href="#">ydn-delicious</a></li>
diff --git a/t/t4034/html/pre b/t/t4034/html/pre
new file mode 100644
index 0000000..8bf936a
--- /dev/null
+++ b/t/t4034/html/pre
@@ -0,0 +1,2 @@
+<li class="yws-maps"><em></em><a href="#">yws-maps</a></li>
+<li class="ydn-delicious"><em></em><a href="#">ydn-delicious</a></li>
diff --git a/t/t4034/java/expect b/t/t4034/java/expect
new file mode 100644
index 0000000..9d99523
--- /dev/null
+++ b/t/t4034/java/expect
@@ -0,0 +1,11 @@
+<BOLD>diff --git a/pre b/post<RESET>
+<BOLD>index ae11cd3..fd61213 100644<RESET>
+<BOLD>--- a/pre<RESET>
+<BOLD>+++ b/post<RESET>
+<CYAN>@@ -1,6 +1,6 @@<RESET>
+public class HelloWorld {<RESET>
+ public static void main(String[] args) {<RESET>
+ System.out.println("Hello <RED>,<RESET><GREEN>--<RESET> world!");
+ int i = <RED>1+2<RESET><GREEN>1 + 2<RESET>;
+ }<RESET>
+}<RESET>
diff --git a/t/t4034/java/post b/t/t4034/java/post
new file mode 100644
index 0000000..fd61213
--- /dev/null
+++ b/t/t4034/java/post
@@ -0,0 +1,6 @@
+public class HelloWorld {
+ public static void main(String[] args) {
+ System.out.println("Hello -- world!");
+ int i = 1 + 2;
+ }
+}
diff --git a/t/t4034/java/pre b/t/t4034/java/pre
new file mode 100644
index 0000000..ae11cd3
--- /dev/null
+++ b/t/t4034/java/pre
@@ -0,0 +1,6 @@
+public class HelloWorld {
+ public static void main(String[] args) {
+ System.out.println("Hello, world!");
+ int i = 1+2;
+ }
+}
diff --git a/t/t4034/objc/expect b/t/t4034/objc/expect
new file mode 100644
index 0000000..a29fec5
--- /dev/null
+++ b/t/t4034/objc/expect
@@ -0,0 +1,11 @@
+<BOLD>diff --git a/pre b/post<RESET>
+<BOLD>index 8eb298d..e728a08 100644<RESET>
+<BOLD>--- a/pre<RESET>
+<BOLD>+++ b/post<RESET>
+<CYAN>@@ -2,6 +2,6 @@<RESET>
+ <RESET>
+int main (void)<RESET>
+{<RESET>
+ int i = <RED>1+2<RESET><GREEN>1 + 2<RESET>;
+ printf ("Hello<GREEN>, new<RESET> world!\n");
+}<RESET>
diff --git a/t/t4034/objc/post b/t/t4034/objc/post
new file mode 100644
index 0000000..e728a08
--- /dev/null
+++ b/t/t4034/objc/post
@@ -0,0 +1,7 @@
+#import <stdio.h>
+
+int main (void)
+{
+ int i = 1 + 2;
+ printf ("Hello, new world!\n");
+}
diff --git a/t/t4034/objc/pre b/t/t4034/objc/pre
new file mode 100644
index 0000000..8eb298d
--- /dev/null
+++ b/t/t4034/objc/pre
@@ -0,0 +1,7 @@
+#import <stdio.h>
+
+int main (void)
+{
+ int i = 1+2;
+ printf ("Hello world!\n");
+}
diff --git a/t/t4034/pascal/expect b/t/t4034/pascal/expect
new file mode 100644
index 0000000..10953cf
--- /dev/null
+++ b/t/t4034/pascal/expect
@@ -0,0 +1,12 @@
+<BOLD>diff --git a/pre b/post<RESET>
+<BOLD>index 7c5fbef..bdd5df9 100644<RESET>
+<BOLD>--- a/pre<RESET>
+<BOLD>+++ b/post<RESET>
+<CYAN>@@ -1,7 +1,7 @@<RESET>
+program HelloWorld;<RESET>
+var<RESET>
+ i : integer;
+begin<RESET>
+ i = i <RED>+1<RESET><GREEN>+ 1<RESET>;
+ writeln('Hello<GREEN>, new<RESET> world!');
+end.<RESET>
diff --git a/t/t4034/pascal/post b/t/t4034/pascal/post
new file mode 100644
index 0000000..bdd5df9
--- /dev/null
+++ b/t/t4034/pascal/post
@@ -0,0 +1,7 @@
+program HelloWorld;
+var
+ i : integer;
+begin
+ i = i + 1;
+ writeln('Hello, new world!');
+end.
diff --git a/t/t4034/pascal/pre b/t/t4034/pascal/pre
new file mode 100644
index 0000000..7c5fbef
--- /dev/null
+++ b/t/t4034/pascal/pre
@@ -0,0 +1,7 @@
+program HelloWorld;
+var
+ i: integer;
+begin
+ i = i+1;
+ writeln('Hello world!');
+end.
diff --git a/t/t4034/php/expect b/t/t4034/php/expect
new file mode 100644
index 0000000..171cfd5
--- /dev/null
+++ b/t/t4034/php/expect
@@ -0,0 +1,7 @@
+<BOLD>diff --git a/pre b/post<RESET>
+<BOLD>index 646a13d..1b1fe22 100644<RESET>
+<BOLD>--- a/pre<RESET>
+<BOLD>+++ b/post<RESET>
+<CYAN>@@ -1,2 +1,2 @@<RESET>
+$i =<RED>$i+1<RESET><GREEN>CONSTANT + 1<RESET>;
+echo "Hello, <GREEN>New<RESET> World!\n";
diff --git a/t/t4034/php/post b/t/t4034/php/post
new file mode 100644
index 0000000..1b1fe22
--- /dev/null
+++ b/t/t4034/php/post
@@ -0,0 +1,2 @@
+$i =CONSTANT + 1;
+echo "Hello, New World!\n";
diff --git a/t/t4034/php/pre b/t/t4034/php/pre
new file mode 100644
index 0000000..646a13d
--- /dev/null
+++ b/t/t4034/php/pre
@@ -0,0 +1,2 @@
+$i=$i+1;
+echo "Hello, World!\n";
diff --git a/t/t4034/python/expect b/t/t4034/python/expect
new file mode 100644
index 0000000..bf6a30b
--- /dev/null
+++ b/t/t4034/python/expect
@@ -0,0 +1,8 @@
+<BOLD>diff --git a/pre b/post<RESET>
+<BOLD>index 2261a37..1076af0 100644<RESET>
+<BOLD>--- a/pre<RESET>
+<BOLD>+++ b/post<RESET>
+<CYAN>@@ -1,3 +1,3 @@<RESET>
+<RED>foo.bar()<RESET><GREEN>foo . bar (stuff)<RESET>
+i = <RED>i+1<RESET><GREEN>i + 1<RESET>
+print "Hello, <GREEN>New<RESET> World!\n"
diff --git a/t/t4034/python/post b/t/t4034/python/post
new file mode 100644
index 0000000..1076af0
--- /dev/null
+++ b/t/t4034/python/post
@@ -0,0 +1,3 @@
+foo . bar (stuff)
+i = i + 1
+print "Hello, New World!\n"
diff --git a/t/t4034/python/pre b/t/t4034/python/pre
new file mode 100644
index 0000000..2261a37
--- /dev/null
+++ b/t/t4034/python/pre
@@ -0,0 +1,3 @@
+foo.bar()
+i = i+1
+print "Hello, World!\n"
diff --git a/t/t4034/ruby/expect b/t/t4034/ruby/expect
new file mode 100644
index 0000000..72ff72b
--- /dev/null
+++ b/t/t4034/ruby/expect
@@ -0,0 +1,7 @@
+<BOLD>diff --git a/pre b/post<RESET>
+<BOLD>index 1961e79..d954376 100644<RESET>
+<BOLD>--- a/pre<RESET>
+<BOLD>+++ b/post<RESET>
+<CYAN>@@ -1,2 +1,2 @@<RESET>
+10.downto(<RED>1<RESET><GREEN>2<RESET>) { |x| puts x }
+puts 'Hello <GREEN>new<RESET> world'
diff --git a/t/t4034/ruby/post b/t/t4034/ruby/post
new file mode 100644
index 0000000..d954376
--- /dev/null
+++ b/t/t4034/ruby/post
@@ -0,0 +1,2 @@
+10.downto(2) { |x| puts x }
+puts 'Hello new world'
diff --git a/t/t4034/ruby/pre b/t/t4034/ruby/pre
new file mode 100644
index 0000000..1961e79
--- /dev/null
+++ b/t/t4034/ruby/pre
@@ -0,0 +1,2 @@
+10.downto(1) {|x| puts x}
+puts 'Hello world'
diff --git a/t/t4034/tex/expect b/t/t4034/tex/expect
new file mode 100644
index 0000000..604969b
--- /dev/null
+++ b/t/t4034/tex/expect
@@ -0,0 +1,9 @@
+<BOLD>diff --git a/pre b/post<RESET>
+<BOLD>index 2b2dfcb..65cab61 100644<RESET>
+<BOLD>--- a/pre<RESET>
+<BOLD>+++ b/post<RESET>
+<CYAN>@@ -1,4 +1,4 @@<RESET>
+\section{Something <GREEN>new<RESET>}
+<RED>\emph<RESET><GREEN>\textbf<RESET>{Macro style}
+{<RED>\em<RESET><GREEN>\bfseries<RESET> State toggle style}
+\\[<RED>1em<RESET><GREEN>1cm<RESET>]
diff --git a/t/t4034/tex/post b/t/t4034/tex/post
new file mode 100644
index 0000000..65cab61
--- /dev/null
+++ b/t/t4034/tex/post
@@ -0,0 +1,4 @@
+\section{Something new}
+\textbf{Macro style}
+{\bfseries State toggle style}
+\\[1cm]
diff --git a/t/t4034/tex/pre b/t/t4034/tex/pre
new file mode 100644
index 0000000..2b2dfcb
--- /dev/null
+++ b/t/t4034/tex/pre
@@ -0,0 +1,4 @@
+\section{Something}
+\emph{Macro style}
+{\em State toggle style}
+\\[1em]
--
1.7.3.3.807.g6ee1f
^ permalink raw reply related
* Re: [PATCH] branch: do not attempt to track HEAD implicitly
From: Thomas Rast @ 2010-12-15 15:26 UTC (permalink / raw)
To: Martin von Zweigbergk; +Cc: git
In-Reply-To: <AANLkTi=PPx-pLEeR4gLw0KzV_=ZnuqqH_CGc6L7RzU7M@mail.gmail.com>
Martin von Zweigbergk wrote:
> On Tue, Dec 14, 2010 at 1:38 PM, Thomas Rast <trast@student.ethz.ch> wrote:
> > Silently drop the HEAD candidate in the implicit (i.e. without -t
> > flag) case, so that the branch starts out without an upstream.
>
> Thanks. This has been on my todo list for a while.
>
> Should it only check for HEAD? How about ORIG_HEAD and FETCH_HEAD?
> Simply anything outside of refs/ maybe? Would that make sense?
Good point. It seems HEAD wins the dwim_ref() over the rest:
$ g rev-parse HEAD ORIG_HEAD FETCH_HEAD
79f9a226d33659f0e6a69429931d66b5f70c9708
79f9a226d33659f0e6a69429931d66b5f70c9708
79f9a226d33659f0e6a69429931d66b5f70c9708
$ g branch test
$ g config -l | grep branch.test.
Not sure through which mechanism, however.
--
Thomas Rast
trast@{inf,student}.ethz.ch
^ permalink raw reply
* Re: TopGit release?
From: Uwe Kleine-König @ 2010-12-15 15:32 UTC (permalink / raw)
To: Bert Wesarg
Cc: Peter Simons, git, martin f krafft, Per Cederqvist, Olaf Dabrunz,
Thomas Moschny
In-Reply-To: <AANLkTi=E2H8n8jZPQ0Rz5gxaQTeLtJXeCFFZv08dip0E@mail.gmail.com>
Hi Bert,
On Wed, Dec 15, 2010 at 03:54:28PM +0100, Bert Wesarg wrote:
> 2010/12/15 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:
> > [1] http://thread.gmane.org/gmane.comp.version-control.git/159433
> > hint to Bert: this series doesn't apply to master
>
> I know, you applied a patch, which was rendered obsolete with this
> patch series. you commited on Nov 02, and I send the series Oct 20.
If you tell me the commit you based your series on I can use the same
and merge the result into master.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply
* Re: [PATCH v3 0/5] make open/unlink failures user friendly on windows using retry/abort
From: Erik Faye-Lund @ 2010-12-15 15:52 UTC (permalink / raw)
To: Heiko Voigt; +Cc: Johannes Sixt, Pat Thoyts, msysgit, git, Junio C Hamano
In-Reply-To: <20101214220604.GA4084@sandbox>
On Tue, Dec 14, 2010 at 11:06 PM, Heiko Voigt <hvoigt@hvoigt.net> wrote:
> Hi,
>
> On Wed, Nov 10, 2010 at 09:32:00PM +0100, Johannes Sixt wrote:
>> On Dienstag, 9. November 2010, Heiko Voigt wrote:
>> > So it seems that unlink also has the problem of getting an
>> > ERROR_ACCESS_DENIED (Code 5) sometimes. Johannes would you agree that
>> > including this code into the is_file_in_use_error() function and thus
>> > having the potential risk of a 71ms delay for real access denials for
>> > these calls makes sense?
>>
>> Of course, it matches my own observations.
>
> Sorry for the delay. Here is finally a new iteration of the patch
> series. I hope I have addressed all raised issues. An extra pair of eyes
> is appreciated.
>
> This series has been ported to Junios tree.
>
> I also added one patch from Johannes which I think should be part of
> this series.
>
> Cheers Heiko
>
> Heiko Voigt (4):
> mingw: move unlink wrapper to mingw.c
> mingw: work around irregular failures of unlink on windows
> mingw: make failures to unlink or move raise a question
> mingw: add fallback for rmdir in case directory is in use
>
> Johannes Schindelin (1):
> mingw_rmdir: set errno=ENOTEMPTY when appropriate
>
> compat/mingw.c | 172 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
> compat/mingw.h | 14 ++---
> 2 files changed, 177 insertions(+), 9 deletions(-)
>
I like the goal of the series (and enjoy the end-result on mingw), but
the more I think of this the more I wonder if this is solving the
problem on the wrong abstraction level.
POSIX says that unlink et al can set errno to EBUSY if a file is in
use and the implementation considers that an error. I suspect they had
a reason for adding that, and I doubt that reason was Windows. POSIX
is already pretty incompatible with Windows. Some Googling have
suggested (but I haven't found definitive proof) that some flavors of
QNX (depending on the file system used, it seems) and Solaris might be
affected. Even Linux seems to be affected if the NTFS 3G driver is
used. Perhaps we've only seen this on Windows so far because
anti-virus is uncommon on these other systems? Perhaps something like
Dropbox-syncing on a mounted NTFS drive under Linux can cause this in
real life as well?
Perhaps instead we would be better of with something like an xunlink
(etc) in wrapper.c that deals with this on all platforms (and make
sure that unlink sets errno to EBUSY correctly if it doesn't already)?
^ permalink raw reply
* Re: TopGit release?
From: Bert Wesarg @ 2010-12-15 16:48 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Peter Simons, git, martin f krafft, Per Cederqvist, Olaf Dabrunz,
Thomas Moschny
In-Reply-To: <20101215153226.GF28971@pengutronix.de>
Hi,
2010/12/15 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:
> Hi Bert,
>
> On Wed, Dec 15, 2010 at 03:54:28PM +0100, Bert Wesarg wrote:
>> 2010/12/15 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:
>> > [1] http://thread.gmane.org/gmane.comp.version-control.git/159433
>> > hint to Bert: this series doesn't apply to master
>>
>> I know, you applied a patch, which was rendered obsolete with this
>> patch series. you commited on Nov 02, and I send the series Oct 20.
> If you tell me the commit you based your series on I can use the same
> and merge the result into master.
8b0f1f9d215d767488542a7853320d1789838d92
But I just refreshed my repo.or.cz fork (topgit/bertw), where I pushed
a rebased series (I've done this some time ago already)
git://repo.or.cz/topgit/bertw.git index-wt
Bert
>
> Best regards
> Uwe
^ permalink raw reply
* disallowing non-trivial merges on integration branches
From: Adam Monsen @ 2010-12-15 18:27 UTC (permalink / raw)
To: git
Does anyone have or want to help with a hook script to prevent trivial merges?
Here's some context:
I'm using the phrase "trivial merge" to refer to a merge without conflicts,
like, when two distinct files are edited.
In the Mifos project, the "head" repo at sf.net--for all intents and purposes--
is the authoritative place to find Mifos source code. At my request, many of the
devs pushing to "head" have started using rebase more often than merge when
their local copy of a branch diverges from the corresponding remote[1] (for
example, I commit to my "master", but must fetch then merge or rebase before
pushing to origin/master). Liberal use of rebase has really cleaned up our
version history graph... it's much easier to see what was pushed and when, and
the progression of patches. Trivial merges just don't add anything helpful to
the commit history graph, IMHO. Non-trivial merges are of course still allowed.
Rebasing commits extant in the "head" repo at sf.net is disallowed.
I've been working on a hook script[2] to disallow trivial merges to further
enforce our policy. Well, really I'm just working on the test suite[3], another
guy (also named Adam, coincidentally) is working on the hook script.
A blocking bug with the hook script (might be a design flaw) is that it prevents
non-trivial merges.
Wanna help fix it?
I don't understand the hook script... is it doing something that makes sense?
This was my first time writing a test harness in Bash script. Kinda fun,
actually. Git certainly lends well to scripting, and it feels intentional. Good
stuff.
References (links) from the above email:
1. http://article.gmane.org/gmane.comp.finance.mifos.devel/9597
2. http://stackoverflow.com/questions/4138285
3. https://gist.github.com/737842
^ permalink raw reply
* Re: [PATCH 0/4] --word-regex sanity checking and such
From: Thomas Rast @ 2010-12-15 19:51 UTC (permalink / raw)
To: Scott Johnson; +Cc: Michael J Gruber, Matthijs Kooijman, git
In-Reply-To: <913156.57703.qm@web110711.mail.gq1.yahoo.com>
Scott Johnson wrote:
> I've attached a pre and post with the complete file that is showing this
> problem. I hope you'll be able to reproduce the issue with this.
I can't reproduce. I did this:
$ ls -l
total 16
-rw-r--r-- 1 thomas users 2128 2010-12-15 20:42 post.html
-rw-r--r-- 1 thomas users 2354 2010-12-15 20:42 pre.html
$ echo '*.html diff=html' >.gitattributes
$ git diff --no-index pre.html post.html
diff --git 1/pre.html 2/post.html
[...]
- <li class="ydn-patterns"><em></em><a href="#">ydn-patterns</a></li>
- <li class="ydn-mail"><em></em><a href="#">ydn-mail</a></li>
- <li class="yws-maps"><em></em><a href="#">yws-maps</a></li>
- <li class="ydn-delicious"><em></em><a href="#">ydn-delicious</a></li>
- <li class="yws-flickr"><em></em><a href="#">yws-flickr</a></li>
- <li class="yws-events"><em></em><a href="#">yws-events</a></li>
+ <li><em></em><a href="#">ydn-patterns</a></li>
+ <li><em></em><a href="#">ydn-mail</a></li>
+ <li><em></em><a href="#">yws-maps</a></li>
+ <li><em></em><a href="#">ydn-delicious</a></li>
+ <li><em></em><a href="#">yws-flickr</a></li>
+ <li><em></em><a href="#">yws-events</a></li>
</ul>
</div><!-- wrap -->
</div><!-- folder_list -->
$ git diff --word-diff --no-index pre.html post.html
diff --git 1/pre.html 2/post.html
[...]
<li[-class="ydn-patterns"-]><em></em><a href="#">ydn-patterns</a></li>
<li[-class="ydn-mail"-]><em></em><a href="#">ydn-mail</a></li>
<li[-class="yws-maps"-]><em></em><a href="#">yws-maps</a></li>
<li[-class="ydn-delicious"-]><em></em><a href="#">ydn-delicious</a></li>
<li[-class="yws-flickr"-]><em></em><a href="#">yws-flickr</a></li>
<li[-class="yws-events"-]><em></em><a href="#">yws-events</a></li>
</ul>
</div><!-- wrap -->
</div><!-- folder_list -->
That's running bleeding-edge git, like I always do, but the userdiff
stuff hasn't changed in ages.
What does
git config diff.html.wordregex
say on your system?
--
Thomas Rast
trast@{inf,student}.ethz.ch
^ permalink raw reply
* Re: [PATCH v3 0/5] make open/unlink failures user friendly on windows using retry/abort
From: Junio C Hamano @ 2010-12-15 20:45 UTC (permalink / raw)
To: kusmabite; +Cc: Heiko Voigt, Johannes Sixt, Pat Thoyts, msysgit, git
In-Reply-To: <AANLkTiks1drfpu9eR6S7KQ9X2MgVy91QAfKs-SRF_voG@mail.gmail.com>
Erik Faye-Lund <kusmabite@gmail.com> writes:
> Perhaps instead we would be better of with something like an xunlink
> (etc) in wrapper.c that deals with this on all platforms (and make
> sure that unlink sets errno to EBUSY correctly if it doesn't already)?
That is superficially similar to the way we let xread() silently handle
short read to give us an easier to use API. Especially, the part to
silently retry for a few times is similar to xread() recovering by
repeating short reads.
I do not think "ask the user one last time" part belongs to such a
wrapper, though.
^ permalink raw reply
* Re: [PATCH 0/4] --word-regex sanity checking and such
From: Scott Johnson @ 2010-12-15 20:48 UTC (permalink / raw)
To: Thomas Rast; +Cc: Michael J Gruber, Matthijs Kooijman, git
In-Reply-To: <201012152051.15159.trast@student.ethz.ch>
Turns out to be system-dependent. I built v1.7.3.3 from source on three
different boxes and only one of them is broken.
The /etc/redhat-release shows:
Broken:
Fedora Core release 6 (Zod)
Correct:
Red Hat Enterprise Linux WS release 4 (Nahant Update 6)
Fedora release 9 (Sulphur)
So I guess that means the problem is in some library that has most likely been
fixed since Fedora 6.
----- Original Message ----
From: Thomas Rast <trast@student.ethz.ch>
To: Scott Johnson <scottj75074@yahoo.com>
Cc: Michael J Gruber <git@drmicha.warpmail.net>; Matthijs Kooijman
<matthijs@stdin.nl>; git@vger.kernel.org
Sent: Wed, December 15, 2010 11:51:14 AM
Subject: Re: [PATCH 0/4] --word-regex sanity checking and such
Scott Johnson wrote:
> I've attached a pre and post with the complete file that is showing this
> problem. I hope you'll be able to reproduce the issue with this.
I can't reproduce. I did this:
$ ls -l
total 16
-rw-r--r-- 1 thomas users 2128 2010-12-15 20:42 post.html
-rw-r--r-- 1 thomas users 2354 2010-12-15 20:42 pre.html
$ echo '*.html diff=html' >.gitattributes
$ git diff --no-index pre.html post.html
diff --git 1/pre.html 2/post.html
[...]
- <li class="ydn-patterns"><em></em><a href="#">ydn-patterns</a></li>
- <li class="ydn-mail"><em></em><a href="#">ydn-mail</a></li>
- <li class="yws-maps"><em></em><a href="#">yws-maps</a></li>
- <li class="ydn-delicious"><em></em><a href="#">ydn-delicious</a></li>
- <li class="yws-flickr"><em></em><a href="#">yws-flickr</a></li>
- <li class="yws-events"><em></em><a href="#">yws-events</a></li>
+ <li><em></em><a href="#">ydn-patterns</a></li>
+ <li><em></em><a href="#">ydn-mail</a></li>
+ <li><em></em><a href="#">yws-maps</a></li>
+ <li><em></em><a href="#">ydn-delicious</a></li>
+ <li><em></em><a href="#">yws-flickr</a></li>
+ <li><em></em><a href="#">yws-events</a></li>
</ul>
</div><!-- wrap -->
</div><!-- folder_list -->
$ git diff --word-diff --no-index pre.html post.html
diff --git 1/pre.html 2/post.html
[...]
<li[-class="ydn-patterns"-]><em></em><a href="#">ydn-patterns</a></li>
<li[-class="ydn-mail"-]><em></em><a href="#">ydn-mail</a></li>
<li[-class="yws-maps"-]><em></em><a href="#">yws-maps</a></li>
<li[-class="ydn-delicious"-]><em></em><a
href="#">ydn-delicious</a></li>
<li[-class="yws-flickr"-]><em></em><a href="#">yws-flickr</a></li>
<li[-class="yws-events"-]><em></em><a href="#">yws-events</a></li>
</ul>
</div><!-- wrap -->
</div><!-- folder_list -->
That's running bleeding-edge git, like I always do, but the userdiff
stuff hasn't changed in ages.
What does
git config diff.html.wordregex
say on your system?
--
Thomas Rast
trast@{inf,student}.ethz.ch
^ permalink raw reply
* Re: [PATCH/RFC] ident: die on bogus date format
From: Junio C Hamano @ 2010-12-15 21:53 UTC (permalink / raw)
To: Jeff King; +Cc: Sergio, git
In-Reply-To: <20101213170225.GA16033@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
> There are two down-sides to this approach:
>
> 1. Technically this breaks somebody doing something like
> "git commit --date=now", which happened to work because
> bogus data is the same as "now". Though we do
> explicitly handle the empty string, so anybody passing
> an empty variable through the environment will still
> work.
These days I think the bogodate parser knows what "now" is, but you can
change the example to use "ahora" instead of "now" and your argument does
not change. But if you force user to change something in order to work
with a new version of git, it is a regression, no matter how small that
change is.
Having said that, I don't think --date=ahora is something we need to worry
about within the context of "git commit", as the regression feels purely
technical (the author-date defaults to the current time anyway, so there
is no reason to give --date=ahora to the command, even though giving an
explicit date via the flag may have some uses). On the other hand, as
fmt_ident() is fairly low-level, there might be other callers to which it
made sense to give "now" to them, and we wouldn't know without looking.
> If the error is too much, perhaps it can be downgraded
> to a warning?
I think dying is actually Ok for this caller, as we already pass
IDENT_ERROR_ON_NO_NAME to fmt_ident() expecting it to die for us upon a
bad input. Even though I suspect that we do not need to be conditional on
this (the only reason ON_NO_NAME exists is because reflogs may record your
name when you switch branches, and if you are only sightseeing it doesn't
matter if your name is "johndoe@(null)"), using IDENT_ERROR_ON_NO_DATE may
be safer perhaps?
> 2. The error checking happens _after_ the commit message
> is written, which can be annoying to the user. We can
> put explicit checks closer to the beginning of
> git-commit, but that feels a little hack-ish; suddenly
> git-commit has to care about how fmt_ident works. Maybe
> we could simply call fmt_ident earlier?
After determine_author_info() returns to prepare_to_commit(), we have a
call to git_committer_info() only to discard the outcome from. I think
this call was an earlier attempt to catch "You do not exist" and related
low-level errors, and the codepath feels the right place to catch more
recent errors like the one under discussion. Instead of passing 0, how
about passing IDENT_ERROR_ON_NO_NAME and IDENT_ERROR_ON_NO_DATE there,
store and return its output from the prepare_to_commit(), and then give
that string to commit_tree() later in cmd_commit(). We can do this by
adding a new parameter (strbuf) to prepare_to_commit(), I think.
^ permalink raw reply
* RE: disallowing non-trivial merges on integration branches
From: Vallon, Justin @ 2010-12-15 22:04 UTC (permalink / raw)
To: 'Adam Monsen', git@vger.kernel.org
In-Reply-To: <loom.20101215T185931-347@post.gmane.org>
My two cents:
* Rebase is evil (grab your pitchforks!).
* One thing that I have found is that if you fetch/merge --no-ff in the authoritative repo, then you actually end up with a better graph. Why? If you allow fast-forward to the contributor, then in the case of a trivial merge on the contributor branch, the contributor will have merged master *into* the contributor branch, making the contributor the left-parent, and the master the right-parent. If you 'merge --no-ff', then you insure that in the merge on master, the left-parent is master, and the right-parent is your contributor. Then, you should be able to follow left-parents to trace your mainline. Not sure if that would help your gitk graph.
* It sounds like you have a problem following the merges. Maybe the grapher needs to be enhanced?
--
-Justin
-----Original Message-----
From: git-owner@vger.kernel.org [mailto:git-owner@vger.kernel.org] On Behalf Of Adam Monsen
Sent: Wednesday, December 15, 2010 1:27 PM
To: git@vger.kernel.org
Subject: disallowing non-trivial merges on integration branches
Does anyone have or want to help with a hook script to prevent trivial merges?
Here's some context:
I'm using the phrase "trivial merge" to refer to a merge without conflicts,
like, when two distinct files are edited.
In the Mifos project, the "head" repo at sf.net--for all intents and purposes--
is the authoritative place to find Mifos source code. At my request, many of the
devs pushing to "head" have started using rebase more often than merge when
their local copy of a branch diverges from the corresponding remote[1] (for
example, I commit to my "master", but must fetch then merge or rebase before
pushing to origin/master). Liberal use of rebase has really cleaned up our
version history graph... it's much easier to see what was pushed and when, and
the progression of patches. Trivial merges just don't add anything helpful to
the commit history graph, IMHO. Non-trivial merges are of course still allowed.
Rebasing commits extant in the "head" repo at sf.net is disallowed.
I've been working on a hook script[2] to disallow trivial merges to further
enforce our policy. Well, really I'm just working on the test suite[3], another
guy (also named Adam, coincidentally) is working on the hook script.
A blocking bug with the hook script (might be a design flaw) is that it prevents
non-trivial merges.
Wanna help fix it?
I don't understand the hook script... is it doing something that makes sense?
This was my first time writing a test harness in Bash script. Kinda fun,
actually. Git certainly lends well to scripting, and it feels intentional. Good
stuff.
References (links) from the above email:
1. http://article.gmane.org/gmane.comp.finance.mifos.devel/9597
2. http://stackoverflow.com/questions/4138285
3. https://gist.github.com/737842
^ permalink raw reply
* git-archive and core.eol
From: Erik Faye-Lund @ 2010-12-15 22:32 UTC (permalink / raw)
To: Git Mailing List, msysGit; +Cc: eyvind.bernhardsen
I recently tried the following on Windows:
$ git init
Initialized empty Git repository in c:/Users/kusma/test/.git/
$ echo "foo
bar" > test.txt
$ git -c core.autocrlf=true add test.txt
warning: LF will be replaced by CRLF in test.txt.
The file will have its original line endings in your working directory.
$ git commit -m.
1 files changed, 2 insertions(+), 0 deletions(-)
create mode 100644 test.txt
$ git -c core.autocrlf=true -c core.eol=lf archive --format=tar HEAD > test.tar
$ tar xvf test.tar
$ od -c test.txt
0000000 f o o \r \n b a r \r \n
0000012
Just to be sure, I checked this:
$ git show HEAD:test.txt | od -c
0000000 f o o \n b a r \n
0000010
Yep, the file has LF in the repo, as expected... the warning from
git-add is a bit confusing, but OK.
Hmm, so git-archive writes CRLF even if I said I wanted LF. But then I
tried this on Linux:
$ git init
Initialized empty Git repository in /home/kusma/src/test/.git/
$ echo "foo
bar" > test.txt
$ git add test.txt
$ git commit -m.
[master (root-commit) c6f195e] .
1 files changed, 2 insertions(+), 0 deletions(-)
create mode 100644 test.txt
$ git -c core.autocrlf=true -c core.eol=crlf archive --format=tar HEAD
> test.tar
$ tar xvf test.tar
test.txt
$ od -c test.txt
0000000 f o o \r \n b a r \r \n
0000012
This leaves me a bit puzzled. On Linux, I can override the default
new-line style CRLF for git-archive, but I can't override it to LF on
Windows?
I expected it to work because sha1_file_to_archive calls
convert_to_working_tree. I've tried stepping through the code, but I
don't quite understand where it goes wrong. Or even how the code is
supposed to work :P
Does anyone have any clue what's going on? I'm running with the
current master, git version 1.7.3.3.585.g74f6e.
^ permalink raw reply
* Re: [PATCH] get_sha1: handle special case $commit^{/}
From: Junio C Hamano @ 2010-12-15 23:44 UTC (permalink / raw)
To: Nguyễn Thái Ngọc Duy
Cc: git, Jonathan Niedier, Kevin Ballard, Yann Dirson, Jeff King,
Jakub Narebski, Thiago Farina
In-Reply-To: <1292403774-361-1-git-send-email-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:
> Empty regex pattern should always match. But the exact behavior of
> regexec() may vary. Because it always matches anyway, we can just
> return 'matched' without calling regex machinery.
Hmm, I just noticed that "git grep -e '' Makefile" fails on FBSD8 for
the same reason.
I'd prefer a solution that is not about "special case $commit^{/}" but is
about "work around regcomp that cannot compile an empty regexp".
Wisdoms?
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
> On top of nd/oneline-sha1-name-from-specific-ref
>
> sha1_name.c | 7 +++++++
> 1 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/sha1_name.c b/sha1_name.c
> index 1ba4bc3..c5c59ce 100644
> --- a/sha1_name.c
> +++ b/sha1_name.c
> @@ -599,6 +599,13 @@ static int peel_onion(const char *name, int len, unsigned char *sha1)
> int ret;
> struct commit_list *list = NULL;
>
> + /*
> + * $commit^{/}. Some regex implementation may reject.
> + * We don't need regex anyway. '' pattern always matches.
> + */
> + if (sp[1] == '}')
> + return 0;
> +
> prefix = xstrndup(sp + 1, name + len - 1 - (sp + 1));
> commit_list_insert((struct commit *)o, &list);
> ret = get_sha1_oneline(prefix, sha1, list);
> --
> 1.7.3.3.476.g10a82
^ permalink raw reply
* Re: [PATCH] get_sha1: handle special case $commit^{/}
From: Nguyen Thai Ngoc Duy @ 2010-12-16 0:23 UTC (permalink / raw)
To: Junio C Hamano
Cc: git, Jonathan Niedier, Kevin Ballard, Yann Dirson, Jeff King,
Jakub Narebski, Thiago Farina
In-Reply-To: <7v8vzqppo3.fsf@alter.siamese.dyndns.org>
2010/12/16 Junio C Hamano <gitster@pobox.com>:
> Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:
>
>> Empty regex pattern should always match. But the exact behavior of
>> regexec() may vary. Because it always matches anyway, we can just
>> return 'matched' without calling regex machinery.
>
> Hmm, I just noticed that "git grep -e '' Makefile" fails on FBSD8 for
> the same reason.
>
> I'd prefer a solution that is not about "special case $commit^{/}" but is
> about "work around regcomp that cannot compile an empty regexp".
Hmm.. if there is no compilation phase, we can redefine a macro to
workaround. Perhaps prefer compat/regex to FBSD's implementation?
--
Duy
^ permalink raw reply
* Re: [PATCH] branch: do not attempt to track HEAD implicitly
From: Martin von Zweigbergk @ 2010-12-15 18:30 UTC (permalink / raw)
To: Thomas Rast; +Cc: Martin von Zweigbergk, git
In-Reply-To: <201012151626.35366.trast@student.ethz.ch>
On Wed, 15 Dec 2010, Thomas Rast wrote:
> Martin von Zweigbergk wrote:
> > On Tue, Dec 14, 2010 at 1:38 PM, Thomas Rast <trast@student.ethz.ch> wrote:
> > > Silently drop the HEAD candidate in the implicit (i.e. without -t
> > > flag) case, so that the branch starts out without an upstream.
> >
> > Thanks. This has been on my todo list for a while.
> >
> > Should it only check for HEAD? How about ORIG_HEAD and FETCH_HEAD?
> > Simply anything outside of refs/ maybe? Would that make sense?
>
> Good point. It seems HEAD wins the dwim_ref() over the rest:
>
> $ g rev-parse HEAD ORIG_HEAD FETCH_HEAD
> 79f9a226d33659f0e6a69429931d66b5f70c9708
> 79f9a226d33659f0e6a69429931d66b5f70c9708
> 79f9a226d33659f0e6a69429931d66b5f70c9708
Probably a stupid question, but why are all three of them pointing to
the same commit? I guess that is what you want to show, but how did
you get there? If I run the same command (I assume your 'g' alias
simply calls git), I get three different commits (in general, of
course).
> $ g branch test
> $ g config -l | grep branch.test.
>
> Not sure through which mechanism, however.
The scenario I meant is the following:
$ git config branch.autosetupmerge always
$ git branch test ORIG_HEAD
Branch test set up to track local ref ORIG_HEAD.
$ git config -l | grep branch.test
branch.test.remote=.
branch.test.merge=ORIG_HEAD
/Martin
^ permalink raw reply
* Re: [PATCH] completion: add missing configuration variables
From: Martin von Zweigbergk @ 2010-12-15 19:44 UTC (permalink / raw)
To: Jeff King; +Cc: Martin von Zweigbergk, git, Junio C Hamano
In-Reply-To: <20101215130046.GB25647@sigill.intra.peff.net>
On Wed, 15 Dec 2010, Jeff King wrote:
> On Wed, Dec 15, 2010 at 07:46:53AM +0100, Martin von Zweigbergk wrote:
>
> > The color.grep.external option has been deleted. Should it be deleted
> > from here or do we want to help users run e.g.
> > 'git config --unset color.grep.external'? Same goes for
> > add.ignore-errors.
>
> IMHO, they should go away. People who have them can figure out how to
> delete them, but it is more important not to advertise them to people
> who are adding variables.
Sounds good to me. If no one disagrees, I'll send an updated patch in
a day or two, removing both color.grep.external and add.ignore-errors.
> As an aside, I would think "--unset" should actually choose from the set
> of configured variables for completion (i.e., "git config --list | cut
> -d= -f1"). But that would obviously be a separate patch.
Good point. I'll put it on my todo.
> > Some variables are documented with camelCase but read in all
> > lowercase in the code. Not worth updating the code just for that, is
> > it?
>
> All variables are case-insensitive.
That I knew...
> The config parser down-cases them,
> so all code should treat tham as all-lowercase.
... but not that. Thanks. I could/should have figured that out if I
had noticed that *all* of them were lowercase in the code :-P.
> One note:
>
> > color.diff
> > color.diff.commit
> > color.diff.frag
> > + color.diff.func
> > color.diff.meta
> > color.diff.new
> > color.diff.old
> > color.diff.plain
> > color.diff.whitespace
>
> We have color.diff.branch coming soon (I think it is in 'next' now).
Strictly speaking, that note is for Junio to think of when he merges,
right? But adding it early is pretty harmless and if that relieves him
of some work, I would be happy to add it in the next submission of
this patch. Is that better?
Thinking a bit more, maybe what you are suggesting is that I base the
next revision of this patch on the branch that adds that variable?
/Martin
^ permalink raw reply
* Re: [solved] how to create a diff in old file new file format (for code reviews)
From: Seshu Parvataneni @ 2010-12-16 3:33 UTC (permalink / raw)
To: Michael J Gruber; +Cc: git
In-Reply-To: <4D073619.2010103@drmicha.warpmail.net>
Hi Michael,
Thanks very much for the reply. Your example with the difftool worked. This was what I was looking for.
--- On Tue, 12/14/10, Michael J Gruber <git@drmicha.warpmail.net> wrote:
> From: Michael J Gruber <git@drmicha.warpmail.net>
> Subject: Re: how to create a diff in old file new file format (for code reviews)
> To: "aerosmith" <parvata@rocketmail.com>
> Cc: git@vger.kernel.org
> Date: Tuesday, December 14, 2010, 1:17 AM
> aerosmith venit, vidit, dixit
> 14.12.2010 01:07:
> >
> > Hi,
> >
> > I am trying to create a diff such that the original
> file (entire file) is
> > saved something like file1.h.old and the new modified
> file as file1.h.new. I
> > have read the various options for git-diff* tools but
> could not find one
> > such utility. All I get is the removals and additions
> as a diff. Does anyone
> > know how to create one with the help the available git
> utils? The only
> > method that I can think of is to do everything
> manually. Any help w.r.t.
> > this is really appreciated. Thanks in advance.
>
> You could script around this e.g. with an external
> diff-helper. The
> easiest way is to reuse difftool. For example,
>
> git difftool -y -x echo <revexpression>
>
> will give you pairs of names of temporary files for
> old/new, where
> <revexpression> is what you would give to "git diff"
> to specify what to
> diff.
>
> With the patch I'm sending in a minute, the helper you
> specify with "-x"
> can also access the basename easily, so that you could use
> "-x oldnew"
> with a script "oldnew" containing
>
> #!/bin/sh
> cp "$1" "$BASE".old
> cp "$2" "$BASE".new
>
> Even without the patch, you could use
>
> git difftool -y -x 'cp "$LOCAL" "$BASE".old; cp "$REMOTE"
> "$BASE.new";
> #' <revexpression>
>
> (all on one line) directly. But this requires insider
> knowledge and may
> break some day.
>
> Cheers,
> Michael
> --
> To unsubscribe from this list: send the line "unsubscribe
> git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply
* Re: [PATCH] completion: add missing configuration variables
From: Jeff King @ 2010-12-16 4:23 UTC (permalink / raw)
To: Martin von Zweigbergk; +Cc: git, Junio C Hamano
In-Reply-To: <alpine.DEB.1.10.1012151931030.25560@debian>
On Wed, Dec 15, 2010 at 08:44:45PM +0100, Martin von Zweigbergk wrote:
> > One note:
> >
> > > color.diff
> > > color.diff.commit
> > > color.diff.frag
> > > + color.diff.func
> > > color.diff.meta
> > > color.diff.new
> > > color.diff.old
> > > color.diff.plain
> > > color.diff.whitespace
> >
> > We have color.diff.branch coming soon (I think it is in 'next' now).
>
> Strictly speaking, that note is for Junio to think of when he merges,
> right? But adding it early is pretty harmless and if that relieves him
> of some work, I would be happy to add it in the next submission of
> this patch. Is that better?
>
> Thinking a bit more, maybe what you are suggesting is that I base the
> next revision of this patch on the branch that adds that variable?
The "correct" thing to do from a topic branch standpoint is to submit
this patch without it as its own topic, submit a patch with just
color.diff.branch on top of the other topic, and then the merge
resolution will include both sets.
In this case, it might be OK to just start shipping color.diff.branch in
the completion list. It doesn't hurt anything to have the extra
completion before the feature is in, and the feature seems very likely
to make it in soon.
But I'll let Junio decide how meticulous about history he wants to be.
:)
-Peff
^ permalink raw reply
* [ANNOUNCE] Git 1.7.3.4, 1.6.6.3 and others
From: Junio C Hamano @ 2010-12-16 6:02 UTC (permalink / raw)
To: git
The latest maintenance release Git 1.7.3.4 is available at the
usual places:
http://www.kernel.org/pub/software/scm/git/
git-1.7.3.4.tar.{gz,bz2} (source tarball)
git-htmldocs-1.7.3.4.tar.{gz,bz2} (preformatted docs)
git-manpages-1.7.3.4.tar.{gz,bz2} (preformatted docs)
The RPM binary packages for a few architectures are found in:
RPMS/$arch/git-*-1.7.3.4-1.fc13.$arch.rpm (RPM)
Among many fixes since v1.7.3.3, it contains a fix to a recently
discovered XSS vulnerability in Gitweb (CVE 2010-3906). A backport
to an earlier maintenance track 1.6.6.3 is available (replace 1.7.3.4 with
1.6.6.3 above).
The Gitweb fix has also been backported to maintenance tracks of other
earlier releases (1.7.2.5, 1.7.1.4, 1.7.0.9, 1.6.5.9, and 1.6.4.5) and are
available from the main repository and shortly will be available from its
mirrors:
git://git.kernel.org/pub/scm/git/git.git/
git://repo.or.cz/alt-git.git/
git://git-core.git.sourceforge.net/gitroot/git-core/git-core/
git://github.com/git/git.git/
----------------------------------------------------------------
Git v1.7.3.4 Release Notes
==========================
Fixes since v1.7.3.3
--------------------
* Smart HTTP transport used to incorrectly retry redirected POST
request with GET request.
* "git apply" did not correctly handle patches that only change modes
if told to apply while stripping leading paths with -p option.
* "git apply" can deal with patches with timezone formatted with a
colon between the hours and minutes part (e.g. "-08:00" instead of
"-0800").
* "git checkout" removed an untracked file "foo" from the working
tree when switching to a branch that contains a tracked path
"foo/bar". Prevent this, just like the case where the conflicting
path were "foo" (c752e7f..7980872d).
* "git cherry-pick" or "git revert" refused to work when a path that
would be modified by the operation was stat-dirty without a real
difference in the contents of the file.
* "git diff --check" reported an incorrect line number for added
blank lines at the end of file.
* "git imap-send" failed to build under NO_OPENSSL.
* Setting log.decorate configuration variable to "0" or "1" to mean
"false" or "true" did not work.
* "git push" over dumb HTTP protocol did not work against WebDAV
servers that did not terminate a collection name with a slash.
* "git tag -v" did not work with GPG signatures in rfc1991 mode.
* The post-receive-email sample hook was accidentally broken in 1.7.3.3
update.
* "gitweb" can sometimes be tricked into parrotting a filename argument
given in a request without properly quoting.
Other minor fixes and documentation updates are also included.
^ permalink raw reply
* [PATCH v2 resend] bash completion: add basic support for git-reflog
From: Tay Ray Chuan @ 2010-12-16 6:56 UTC (permalink / raw)
To: Git Mailing List; +Cc: Junio C Hamano, SZEDER Gábor, Jonathan Nieder
"Promote" the reflog command out of plumbing, so that we now run
completion for it. After all, it's listed under porcelain (ancillary),
and we do run completion for those commands.
Add basic completion for the three subcommands - show, expire, delete.
Try completing refs for these too.
Helped-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
---
resend note:
This didn't seem to have been picked up. FYI, Johnathan
made a comment, but it was non-blocking, so I didn't change anything.
Changed from v1:
- picked up Gábor's suggestion on using __git_find_on_cmdline()
to correctly handle situations where subcommands are used with dashed
options.
- don't "hide" reflog anymore - run completion for it too.
Gábor: hmm, it really seems that reflog is treated as plumbing - no completion
is done for it. Even get-tar-commit-id (I've never used this before) is treated
better than reflog. Shall do something about it!
contrib/completion/git-completion.bash | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index f710469..6732b1d 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -735,7 +735,6 @@ __git_list_porcelain_commands ()
quiltimport) : import;;
read-tree) : plumbing;;
receive-pack) : plumbing;;
- reflog) : plumbing;;
remote-*) : transport;;
repo-config) : deprecated;;
rerere) : plumbing;;
@@ -1632,6 +1631,18 @@ _git_rebase ()
__gitcomp "$(__git_refs)"
}
+_git_reflog ()
+{
+ local subcommands="show delete expire"
+ local subcommand="$(__git_find_on_cmdline "$subcommands")"
+
+ if [ -z "$subcommand" ]; then
+ __gitcomp "$subcommands"
+ else
+ __gitcomp "$(__git_refs)"
+ fi
+}
+
__git_send_email_confirm_options="always never auto cc compose"
__git_send_email_suppresscc_options="author self cc bodycc sob cccmd body all"
--
1.7.3.2.493.g2b058
^ permalink raw reply related
* Re: [PATCH v2 resend] bash completion: add basic support for git-reflog
From: Jonathan Nieder @ 2010-12-16 7:15 UTC (permalink / raw)
To: Tay Ray Chuan; +Cc: Git Mailing List, Junio C Hamano, SZEDER Gábor
In-Reply-To: <20101216145608.000004df@unknown>
Tay Ray Chuan wrote:
> "Promote" the reflog command out of plumbing, so that we now run
> completion for it. After all, it's listed under porcelain (ancillary),
> and we do run completion for those commands.
Good point.
[...]
> Even get-tar-commit-id (I've never used this before) is treated
> better than reflog.
It's handy from time to time. :)
Thanks, and sorry to miss the point before. The patch looks good.
^ 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