* [PATCH v2 2/2] Forbid DEL characters in reference names
From: Michael Haggerty @ 2011-08-27 4:12 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, cmn, Michael Haggerty
In-Reply-To: <1314418364-2532-1-git-send-email-mhagger@alum.mit.edu>
DEL is an ASCII control character and therefore should not be
permitted in reference names. Add tests for this and other unusual
characters.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
---
Please check that the uses of "printf" in the test script are portable
and quoted correctly.
refs.c | 2 +-
t/t1402-check-ref-format.sh | 3 +++
2 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/refs.c b/refs.c
index 3a8789d..0fa8dcf 100644
--- a/refs.c
+++ b/refs.c
@@ -837,7 +837,7 @@ int for_each_rawref(each_ref_fn fn, void *cb_data)
static inline int bad_ref_char(int ch)
{
- if (((unsigned) ch) <= ' ' ||
+ if (((unsigned) ch) <= ' ' || ch == 0x7f ||
ch == '~' || ch == '^' || ch == ':' || ch == '\\')
return 1;
/* 2.13 Pattern Matching Notation */
diff --git a/t/t1402-check-ref-format.sh b/t/t1402-check-ref-format.sh
index 7563043..ed4275a 100755
--- a/t/t1402-check-ref-format.sh
+++ b/t/t1402-check-ref-format.sh
@@ -30,6 +30,9 @@ invalid_ref 'heads/foo.lock'
valid_ref 'heads/foo@bar'
invalid_ref 'heads/v@{ation'
invalid_ref 'heads/foo\bar'
+invalid_ref "$(printf 'heads/foo\t')"
+invalid_ref "$(printf 'heads/foo\177')"
+valid_ref "$(printf 'heads/fu\303\237')"
test_expect_success "check-ref-format --branch @{-1}" '
T=$(git write-tree) &&
--
1.7.6.8.gd2879
^ permalink raw reply related
* [PATCH v2 1/2] check-ref-format --print: Normalize refnames that start with slashes
From: Michael Haggerty @ 2011-08-27 4:12 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, cmn, Michael Haggerty
In-Reply-To: <1314418364-2532-1-git-send-email-mhagger@alum.mit.edu>
And add tests that such refnames are accepted and normalized
correctly.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
---
This patch includes the simplification suggested by Junio on the
mailing list.
builtin/check-ref-format.c | 6 +++---
t/t1402-check-ref-format.sh | 6 ++++++
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/builtin/check-ref-format.c b/builtin/check-ref-format.c
index ae3f281..0723cf2 100644
--- a/builtin/check-ref-format.c
+++ b/builtin/check-ref-format.c
@@ -12,8 +12,8 @@ static const char builtin_check_ref_format_usage[] =
" or: git check-ref-format --branch <branchname-shorthand>";
/*
- * Replace each run of adjacent slashes in src with a single slash,
- * and write the result to dst.
+ * Remove leading slashes and replace each run of adjacent slashes in
+ * src with a single slash, and write the result to dst.
*
* This function is similar to normalize_path_copy(), but stripped down
* to meet check_ref_format's simpler needs.
@@ -21,7 +21,7 @@ static const char builtin_check_ref_format_usage[] =
static void collapse_slashes(char *dst, const char *src)
{
char ch;
- char prev = '\0';
+ char prev = '/';
while ((ch = *src++) != '\0') {
if (prev == '/' && ch == prev)
diff --git a/t/t1402-check-ref-format.sh b/t/t1402-check-ref-format.sh
index 1b0f82f..7563043 100755
--- a/t/t1402-check-ref-format.sh
+++ b/t/t1402-check-ref-format.sh
@@ -18,6 +18,9 @@ invalid_ref 'foo'
valid_ref 'foo/bar/baz'
valid_ref 'refs///heads/foo'
invalid_ref 'heads/foo/'
+valid_ref '/heads/foo'
+valid_ref '///heads/foo'
+invalid_ref '/foo'
invalid_ref './foo'
invalid_ref '.refs/foo'
invalid_ref 'heads/foo..bar'
@@ -70,7 +73,10 @@ invalid_ref_normalized() {
valid_ref_normalized 'heads/foo' 'heads/foo'
valid_ref_normalized 'refs///heads/foo' 'refs/heads/foo'
+valid_ref_normalized '/heads/foo' 'heads/foo'
+valid_ref_normalized '///heads/foo' 'heads/foo'
invalid_ref_normalized 'foo'
+invalid_ref_normalized '/foo'
invalid_ref_normalized 'heads/foo/../bar'
invalid_ref_normalized 'heads/./foo'
invalid_ref_normalized 'heads\foo'
--
1.7.6.8.gd2879
^ permalink raw reply related
* [PATCH v2 0/2] Fix reference name format check and normalization
From: Michael Haggerty @ 2011-08-27 4:12 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, cmn, Michael Haggerty
This patch series consists of "Do not allow refnames to start with a
slash" as previously submitted (and improved by Junio) and a second
patch that forbids DEL characters in reference names and adds tests of
control characters in reference names. It should be applied to maint.
Michael Haggerty (2):
check-ref-format --print: Normalize refnames that start with slashes
Forbid DEL characters in reference names
builtin/check-ref-format.c | 6 +++---
refs.c | 2 +-
t/t1402-check-ref-format.sh | 9 +++++++++
3 files changed, 13 insertions(+), 4 deletions(-)
--
1.7.6.8.gd2879
^ permalink raw reply
* Re: [PATCH 4/4] git-stash: remove untracked/ignored directories when stashed
From: Hilco Wijbenga @ 2011-08-27 1:04 UTC (permalink / raw)
To: Brandon Casey; +Cc: gitster, git, david
In-Reply-To: <1314406767-17832-4-git-send-email-drafnel@gmail.com>
On 26 August 2011 17:59, Brandon Casey <drafnel@gmail.com> wrote:
> The two new stash options --include-untracked and --all do not remove the
> untracked and/or ignored files that are stashed if those files reside in
> a subdirectory. e.g. the following sequence fails:
>
> mkdir untracked &&
> echo hello >untracked/file.txt &&
> git stash --include-untracked &&
> test ! -f untracked/file.txt
>
> Within the git-stash script, git-clean is used to remove the
> untracked/ignored files, but since the -d option was not supplied, it does
> not remove directories.
>
> So, add -d to the git-clean arguments, and update the tests to test this
> functionality.
>
> Reported-by: Hilco Wijbenga <hilco.wijbenga@gmail.com>
> Signed-off-by: Brandon Casey <drafnel@gmail.com>
> ---
> git-stash.sh | 2 +-
> t/t3905-stash-include-untracked.sh | 26 +++++++++++++++++++++++---
> 2 files changed, 24 insertions(+), 4 deletions(-)
>
> diff --git a/git-stash.sh b/git-stash.sh
> index 9d65250..c766692 100755
> --- a/git-stash.sh
> +++ b/git-stash.sh
> @@ -240,7 +240,7 @@ save_stash () {
> test "$untracked" = "all" && CLEAN_X_OPTION=-x || CLEAN_X_OPTION=
> if test -n "$untracked"
> then
> - git clean --force --quiet $CLEAN_X_OPTION
> + git clean --force --quiet -d $CLEAN_X_OPTION
> fi
>
> if test "$keep_index" = "t" && test -n $i_tree
> diff --git a/t/t3905-stash-include-untracked.sh b/t/t3905-stash-include-untracked.sh
> index ca1a46c..ef44fb2 100755
> --- a/t/t3905-stash-include-untracked.sh
> +++ b/t/t3905-stash-include-untracked.sh
> @@ -17,6 +17,8 @@ test_expect_success 'stash save --include-untracked some dirty working directory
> echo 3 > file &&
> test_tick &&
> echo 1 > file2 &&
> + mkdir untracked &&
> + echo untracked >untracked/untracked &&
> git stash --include-untracked &&
> git diff-files --quiet &&
> git diff-index --cached --quiet HEAD
> @@ -40,14 +42,23 @@ index 0000000..d00491f
> +++ b/file2
> @@ -0,0 +1 @@
> +1
> +diff --git a/untracked/untracked b/untracked/untracked
> +new file mode 100644
> +index 0000000..5a72eb2
> +--- /dev/null
> ++++ b/untracked/untracked
> +@@ -0,0 +1 @@
> ++untracked
> EOF
> cat > expect.lstree <<EOF
> file2
> +untracked
> EOF
>
> test_expect_success 'stash save --include-untracked stashed the untracked files' '
> test "!" -f file2 &&
> - git diff HEAD..stash^3 -- file2 >actual &&
> + test ! -e untracked &&
> + git diff HEAD stash^3 -- file2 untracked >actual &&
> test_cmp expect.diff actual &&
> git ls-tree --name-only stash^3: >actual &&
> test_cmp expect.lstree actual
> @@ -67,15 +78,18 @@ cat > expect <<EOF
> ?? actual
> ?? expect
> ?? file2
> +?? untracked/
> EOF
>
> test_expect_success 'stash pop after save --include-untracked leaves files untracked again' '
> git stash pop &&
> git status --porcelain >actual &&
> - test_cmp expect actual
> + test_cmp expect actual &&
> + test "1" = "`cat file2`" &&
> + test untracked = "`cat untracked/untracked`"
> '
>
> -git clean --force --quiet
> +git clean --force --quiet -d
>
> test_expect_success 'stash save -u dirty index' '
> echo 4 > file3 &&
> @@ -125,12 +139,16 @@ test_expect_success 'stash save --include-untracked removed files got stashed' '
> cat > .gitignore <<EOF
> .gitignore
> ignored
> +ignored.d/
> EOF
>
> test_expect_success 'stash save --include-untracked respects .gitignore' '
> echo ignored > ignored &&
> + mkdir ignored.d &&
> + echo ignored >ignored.d/untracked &&
> git stash -u &&
> test -s ignored &&
> + test -s ignored.d/untracked &&
> test -s .gitignore
> '
>
> @@ -143,12 +161,14 @@ test_expect_success 'stash save -u can stash with only untracked files different
> test_expect_success 'stash save --all does not respect .gitignore' '
> git stash -a &&
> test "!" -f ignored &&
> + test "!" -e ignored.d &&
> test "!" -f .gitignore
> '
>
> test_expect_success 'stash save --all is stash poppable' '
> git stash pop &&
> test -s ignored &&
> + test -s ignored.d/untracked &&
> test -s .gitignore
> '
>
> --
> 1.7.6
Thanks Brandon! Especially for making me famous. ;-)
^ permalink raw reply
* [PATCH 4/4] git-stash: remove untracked/ignored directories when stashed
From: Brandon Casey @ 2011-08-27 0:59 UTC (permalink / raw)
To: gitster; +Cc: git, hilco.wijbenga, david, Brandon Casey
In-Reply-To: <1314406767-17832-1-git-send-email-drafnel@gmail.com>
The two new stash options --include-untracked and --all do not remove the
untracked and/or ignored files that are stashed if those files reside in
a subdirectory. e.g. the following sequence fails:
mkdir untracked &&
echo hello >untracked/file.txt &&
git stash --include-untracked &&
test ! -f untracked/file.txt
Within the git-stash script, git-clean is used to remove the
untracked/ignored files, but since the -d option was not supplied, it does
not remove directories.
So, add -d to the git-clean arguments, and update the tests to test this
functionality.
Reported-by: Hilco Wijbenga <hilco.wijbenga@gmail.com>
Signed-off-by: Brandon Casey <drafnel@gmail.com>
---
git-stash.sh | 2 +-
t/t3905-stash-include-untracked.sh | 26 +++++++++++++++++++++++---
2 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/git-stash.sh b/git-stash.sh
index 9d65250..c766692 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -240,7 +240,7 @@ save_stash () {
test "$untracked" = "all" && CLEAN_X_OPTION=-x || CLEAN_X_OPTION=
if test -n "$untracked"
then
- git clean --force --quiet $CLEAN_X_OPTION
+ git clean --force --quiet -d $CLEAN_X_OPTION
fi
if test "$keep_index" = "t" && test -n $i_tree
diff --git a/t/t3905-stash-include-untracked.sh b/t/t3905-stash-include-untracked.sh
index ca1a46c..ef44fb2 100755
--- a/t/t3905-stash-include-untracked.sh
+++ b/t/t3905-stash-include-untracked.sh
@@ -17,6 +17,8 @@ test_expect_success 'stash save --include-untracked some dirty working directory
echo 3 > file &&
test_tick &&
echo 1 > file2 &&
+ mkdir untracked &&
+ echo untracked >untracked/untracked &&
git stash --include-untracked &&
git diff-files --quiet &&
git diff-index --cached --quiet HEAD
@@ -40,14 +42,23 @@ index 0000000..d00491f
+++ b/file2
@@ -0,0 +1 @@
+1
+diff --git a/untracked/untracked b/untracked/untracked
+new file mode 100644
+index 0000000..5a72eb2
+--- /dev/null
++++ b/untracked/untracked
+@@ -0,0 +1 @@
++untracked
EOF
cat > expect.lstree <<EOF
file2
+untracked
EOF
test_expect_success 'stash save --include-untracked stashed the untracked files' '
test "!" -f file2 &&
- git diff HEAD..stash^3 -- file2 >actual &&
+ test ! -e untracked &&
+ git diff HEAD stash^3 -- file2 untracked >actual &&
test_cmp expect.diff actual &&
git ls-tree --name-only stash^3: >actual &&
test_cmp expect.lstree actual
@@ -67,15 +78,18 @@ cat > expect <<EOF
?? actual
?? expect
?? file2
+?? untracked/
EOF
test_expect_success 'stash pop after save --include-untracked leaves files untracked again' '
git stash pop &&
git status --porcelain >actual &&
- test_cmp expect actual
+ test_cmp expect actual &&
+ test "1" = "`cat file2`" &&
+ test untracked = "`cat untracked/untracked`"
'
-git clean --force --quiet
+git clean --force --quiet -d
test_expect_success 'stash save -u dirty index' '
echo 4 > file3 &&
@@ -125,12 +139,16 @@ test_expect_success 'stash save --include-untracked removed files got stashed' '
cat > .gitignore <<EOF
.gitignore
ignored
+ignored.d/
EOF
test_expect_success 'stash save --include-untracked respects .gitignore' '
echo ignored > ignored &&
+ mkdir ignored.d &&
+ echo ignored >ignored.d/untracked &&
git stash -u &&
test -s ignored &&
+ test -s ignored.d/untracked &&
test -s .gitignore
'
@@ -143,12 +161,14 @@ test_expect_success 'stash save -u can stash with only untracked files different
test_expect_success 'stash save --all does not respect .gitignore' '
git stash -a &&
test "!" -f ignored &&
+ test "!" -e ignored.d &&
test "!" -f .gitignore
'
test_expect_success 'stash save --all is stash poppable' '
git stash pop &&
test -s ignored &&
+ test -s ignored.d/untracked &&
test -s .gitignore
'
--
1.7.6
^ permalink raw reply related
* [PATCH 2/4] git-stash.sh: fix typo in error message
From: Brandon Casey @ 2011-08-27 0:59 UTC (permalink / raw)
To: gitster; +Cc: git, hilco.wijbenga, david, Brandon Casey
In-Reply-To: <1314406767-17832-1-git-send-email-drafnel@gmail.com>
Signed-off-by: Brandon Casey <drafnel@gmail.com>
---
git-stash.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/git-stash.sh b/git-stash.sh
index 31dec0a..9d65250 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -211,7 +211,7 @@ save_stash () {
if test -n "$patch_mode" && test -n "$untracked"
then
- die "Can't use --patch and ---include-untracked or --all at the same time"
+ die "Can't use --patch and --include-untracked or --all at the same time"
fi
stash_msg="$*"
--
1.7.6
^ permalink raw reply related
* [PATCH 3/4] t/t3905: add missing '&&' linkage
From: Brandon Casey @ 2011-08-27 0:59 UTC (permalink / raw)
To: gitster; +Cc: git, hilco.wijbenga, david, Brandon Casey
In-Reply-To: <1314406767-17832-1-git-send-email-drafnel@gmail.com>
Signed-off-by: Brandon Casey <drafnel@gmail.com>
---
t/t3905-stash-include-untracked.sh | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/t/t3905-stash-include-untracked.sh b/t/t3905-stash-include-untracked.sh
index adc2524..ca1a46c 100755
--- a/t/t3905-stash-include-untracked.sh
+++ b/t/t3905-stash-include-untracked.sh
@@ -28,7 +28,7 @@ cat > expect <<EOF
EOF
test_expect_success 'stash save --include-untracked cleaned the untracked files' '
- git status --porcelain >actual
+ git status --porcelain >actual &&
test_cmp expect actual
'
@@ -71,7 +71,7 @@ EOF
test_expect_success 'stash pop after save --include-untracked leaves files untracked again' '
git stash pop &&
- git status --porcelain >actual
+ git status --porcelain >actual &&
test_cmp expect actual
'
@@ -136,7 +136,7 @@ test_expect_success 'stash save --include-untracked respects .gitignore' '
test_expect_success 'stash save -u can stash with only untracked files different' '
echo 4 > file4 &&
- git stash -u
+ git stash -u &&
test "!" -f file4
'
--
1.7.6
^ permalink raw reply related
* [PATCH 1/4] t/t3905: use the name 'actual' for test output, swap arguments to test_cmp
From: Brandon Casey @ 2011-08-27 0:59 UTC (permalink / raw)
To: gitster; +Cc: git, hilco.wijbenga, david, Brandon Casey
It is common practice in the git test suite to use the file names 'actual'
and 'expect' to hold the actual and expected output of commands. So change
the name 'output' to 'actual'.
Additionally, swap the order of arguments to test_cmp when comparing
expected output and actual output so that if diff output is produced, it
describes how the actual output differs from what was expected rather than
the other way around.
Signed-off-by: Brandon Casey <drafnel@gmail.com>
---
t/t3905-stash-include-untracked.sh | 24 ++++++++++++------------
1 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/t/t3905-stash-include-untracked.sh b/t/t3905-stash-include-untracked.sh
index 4f2eedf..adc2524 100755
--- a/t/t3905-stash-include-untracked.sh
+++ b/t/t3905-stash-include-untracked.sh
@@ -23,13 +23,13 @@ test_expect_success 'stash save --include-untracked some dirty working directory
'
cat > expect <<EOF
+?? actual
?? expect
-?? output
EOF
test_expect_success 'stash save --include-untracked cleaned the untracked files' '
- git status --porcelain > output
- test_cmp output expect
+ git status --porcelain >actual
+ test_cmp expect actual
'
cat > expect.diff <<EOF
@@ -47,10 +47,10 @@ EOF
test_expect_success 'stash save --include-untracked stashed the untracked files' '
test "!" -f file2 &&
- git diff HEAD..stash^3 -- file2 > output &&
- test_cmp output expect.diff &&
- git ls-tree --name-only stash^3: > output &&
- test_cmp output expect.lstree
+ git diff HEAD..stash^3 -- file2 >actual &&
+ test_cmp expect.diff actual &&
+ git ls-tree --name-only stash^3: >actual &&
+ test_cmp expect.lstree actual
'
test_expect_success 'stash save --patch --include-untracked fails' '
test_must_fail git stash --patch --include-untracked
@@ -64,15 +64,15 @@ git clean --force --quiet
cat > expect <<EOF
M file
+?? actual
?? expect
?? file2
-?? output
EOF
test_expect_success 'stash pop after save --include-untracked leaves files untracked again' '
git stash pop &&
- git status --porcelain > output
- test_cmp output expect
+ git status --porcelain >actual
+ test_cmp expect actual
'
git clean --force --quiet
@@ -96,8 +96,8 @@ EOF
test_expect_success 'stash save --include-untracked dirty index got stashed' '
git stash pop --index &&
- git diff --cached > output &&
- test_cmp output expect
+ git diff --cached >actual &&
+ test_cmp expect actual
'
git reset > /dev/null
--
1.7.6
^ permalink raw reply related
* Re: 1.7.7-rc0 tagged and pushed out
From: Junio C Hamano @ 2011-08-26 23:20 UTC (permalink / raw)
To: git
In-Reply-To: <7vwrdzbwrt.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
> ... and I think I've collected all the recent leftover topics from the
> list that are at least going in the right direction if not perfect and
> queued them to update 'pu'.
Here is a preview of the "New Topics" section of the next "What's
cooking".
[New Topics]
* mg/maint-notes-C-doc (2011-08-25) 1 commit
- git-notes.txt: clarify -C vs. copy and -F
* jc/clean-exclude-doc (2011-08-26) 1 commit
- Documentation: clarify "git clean -e <pattern>"
* mh/check-ref-format-print-normalize (2011-08-25) 1 commit
- check-ref-format --print: Normalize refnames that start with slashes
These tiny clean-up topics could go to 1.7.7 final. On the other hand,
they are not urgent, either.
* bk/ancestry-path (2011-08-25) 3 commits
- revision: do not include sibling history in --ancestry-path output
- revision: keep track of the end-user input from the command line
- rev-list: Demonstrate breakage with --ancestry-path --all
The topic came up a bit too late in the cycle.
* mg/branch-list (2011-08-26) 5 commits
- branch: allow pattern arguments
- branch: introduce --list option
- git-branch: introduce missing long forms for the options
- git-tag: introduce long forms for the options
- t6040: test branch -vv
(this branch uses nk/branch-v-abbrev.)
The topic came up a bit too late in the cycle.
* mm/rebase-i-exec-edit (2011-08-26) 2 commits
- rebase -i: notice and warn if "exec $cmd" modifies the index or the working tree
- rebase -i: clean error message for --continue after failed exec
The topic came up a bit too late in the cycle.
* jk/default-attr (2011-08-26) 1 commit
- attr: map builtin userdiff drivers to well-known extensions
I fixed up the test breakage just for fun, but this is not urgent.
* hv/submodule-merge-search (2011-08-26) 4 commits
- submodule: Search for merges only at end of recursive merge
- allow multiple calls to submodule merge search for the same path
- submodule: Demonstrate known breakage during recursive merge
- push: Don't push a repository with unpushed submodules
(this branch uses fg/submodule-ff-check-before-push, fg/submodule-ff-check-before-push and jc/combine-diff-callback.)
The topic came up a bit too late in the cycle.
The bottom one needs to be replaced with a properly written commit log message.
* mm/mediawiki-as-a-remote (2011-08-26) 1 commit
- Add a remote helper to interact with mediawiki (fetch & push)
Fun.
* nd/maint-autofix-tag-in-head (2011-08-26) 3 commits
- Accept tags in HEAD or MERGE_HEAD
- merge: remove global variable head[]
- merge: keep stash[] a local variable
Probably needs a re-roll to aim a bit higher.
^ permalink raw reply
* Re: How do I get a readable diff?
From: Junio C Hamano @ 2011-08-26 23:17 UTC (permalink / raw)
To: Brandon Casey; +Cc: Bruce Korb, GIT Development
In-Reply-To: <YLOHfGzBBJxbxqM1qsJcnw-e9_g2VtXOgnU8xvQ_IlNrU6zqGVsN05yN5fm1zRD8rr_rz_2cO52ZPfqe5_03kZm5DwGQebZf_9jzyEsmGQw@cipher.nrlssc.navy.mil>
Brandon Casey <brandon.casey.ctr@nrlssc.navy.mil> writes:
> On 08/26/2011 05:42 PM, Bruce Korb wrote:
>> I know I can pipe it through "cat", but I'd rather the clutter be gone.
>> There has to be a way.
>
>> ESC[1mdiff --git a/lustre/include/lustre_disk.h b/lustre/include/lustre_disk.hESC[m
> ...
> Your terminal does not support color. Are you on an ancient system?
> or something exotic?
>
> You can disable it by setting the color.ui config variable in your
> "user" config file ~/.gitconfig like this:
>
> git config --global color.ui never
>
> -Brandon
Another possibility is that the user has a LESS environment defined, but
without "R" to let it interpret the color. When we do not see "LESS" in
the environment, we play nice and give them FRSX, but if the user already
has LESS, we assume the user knows better than us and do not touch the
environment. Compare:
$ LESS=N git show
$ LESS=NR git show
^ permalink raw reply
* 1.7.7-rc0 tagged and pushed out
From: Junio C Hamano @ 2011-08-26 23:03 UTC (permalink / raw)
To: git
... and I think I've collected all the recent leftover topics from the
list that are at least going in the right direction if not perfect and
queued them to update 'pu'.
Hopefully I can tag 1.7.7-rc1 by the end of the month. Please help find
regressions in the "master" branch, and the topics still in "next" that
are slated for 1.7.7 (see the latest "What's cooking").
Thanks.
^ permalink raw reply
* Re: How do I get a readable diff?
From: Brandon Casey @ 2011-08-26 22:58 UTC (permalink / raw)
To: Bruce Korb; +Cc: GIT Development
In-Reply-To: <4E58216A.8060508@gmail.com>
On 08/26/2011 05:42 PM, Bruce Korb wrote:
> I know I can pipe it through "cat", but I'd rather the clutter be gone.
> There has to be a way.
Your terminal does not support color. Are you on an ancient system?
or something exotic?
You can disable it by setting the color.ui config variable in your
"user" config file ~/.gitconfig like this:
git config --global color.ui never
-Brandon
> ESC[1mdiff --git a/lustre/include/lustre_disk.h b/lustre/include/lustre_disk.hESC[m
> ESC[1mindex 10f6328..564fc08 100644ESC[m
> ESC[1m--- a/lustre/include/lustre_disk.hESC[m
> ESC[1m+++ b/lustre/include/lustre_disk.hESC[m
> ESC[36m@@ -185,6 +185,7 @@ESC[m ESC[mstruct lustre_mount_data {ESC[m
> int lmd_exclude_count;ESC[m
> int lmd_recovery_time_soft;ESC[m
> int lmd_recovery_time_hard;ESC[m
> ESC[32m+ESC[mESC[32m int lmd_reserved_inodes; /* preferred value */ESC[m
> char *lmd_dev; /* device name */ESC[m
> char *lmd_profile; /* client only */ESC[m
> char *lmd_mgssec; /* sptlrpc flavor to mgs */ESC[m
> ESC[36m@@ -202,6 +203,8 @@ESC[m ESC[mstruct lustre_mount_data {ESC[m
> existing MGS services */ESC[m
> #define LMD_FLG_WRITECONF 0x0040 /* Rewrite config log */ESC[m
> ESC[m
> ESC[32m+ESC[mESC[32m#define LMD_RESERVED_INODES_DEFAULT 100ESC[m
> ESC[32m+ESC[m
> #define lmd_is_client(x) ((x)->lmd_flags & LMD_FLG_CLIENT)ESC[m
> ESC[m
> ESC[m
> --
> 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
* How do I get a readable diff?
From: Bruce Korb @ 2011-08-26 22:42 UTC (permalink / raw)
To: GIT Development
I know I can pipe it through "cat", but I'd rather the clutter be gone.
There has to be a way.
ESC[1mdiff --git a/lustre/include/lustre_disk.h b/lustre/include/lustre_disk.hESC[m
ESC[1mindex 10f6328..564fc08 100644ESC[m
ESC[1m--- a/lustre/include/lustre_disk.hESC[m
ESC[1m+++ b/lustre/include/lustre_disk.hESC[m
ESC[36m@@ -185,6 +185,7 @@ESC[m ESC[mstruct lustre_mount_data {ESC[m
int lmd_exclude_count;ESC[m
int lmd_recovery_time_soft;ESC[m
int lmd_recovery_time_hard;ESC[m
ESC[32m+ESC[mESC[32m int lmd_reserved_inodes; /* preferred value */ESC[m
char *lmd_dev; /* device name */ESC[m
char *lmd_profile; /* client only */ESC[m
char *lmd_mgssec; /* sptlrpc flavor to mgs */ESC[m
ESC[36m@@ -202,6 +203,8 @@ESC[m ESC[mstruct lustre_mount_data {ESC[m
existing MGS services */ESC[m
#define LMD_FLG_WRITECONF 0x0040 /* Rewrite config log */ESC[m
ESC[m
ESC[32m+ESC[mESC[32m#define LMD_RESERVED_INODES_DEFAULT 100ESC[m
ESC[32m+ESC[m
#define lmd_is_client(x) ((x)->lmd_flags & LMD_FLG_CLIENT)ESC[m
ESC[m
ESC[m
^ permalink raw reply
* Re: [PATCH] gitweb: highlight: strip non-printable characters via col(1)
From: Jakub Narebski @ 2011-08-26 22:06 UTC (permalink / raw)
To: Junio C Hamano
Cc: Christopher M. Fuhrman, git, Christopher Wilson, Sylvain Rabot
In-Reply-To: <7v8vqfdf0l.fsf@alter.siamese.dyndns.org>
On Fri, 26 Aug 2011, Junio C Hamano wrote:
> Jakub Narebski <jnareb@gmail.com> writes:
>
> > Why use external program (which ming be not installed, or might not
> > strip control-characters), instead of making gitweb sanitize highlighter
> > output itself. Something like the patch below (which additionally
> > shows where there are control characters):
>
> I agree that that would be a more sensible approach. What does your sample
> code below do to a HT by the way?
Actually the line earlier
$line = untabify($line);
replaces HT ("\t") with spaces.
> > -- >8 --
> > diff --git i/gitweb/gitweb.perl w/gitweb/gitweb.perl
> > index 7cf12af..192db2c 100755
> > --- i/gitweb/gitweb.perl
> > +++ w/gitweb/gitweb.perl
> > @@ -1517,6 +1517,17 @@ sub esc_path {
> > return $str;
> > }
> >
> > +# Sanitize for use in XHTML + application/xml+xhtml
> > +sub sanitize {
> > + my $str = shift;
> > +
> > + return undef unless defined $str;
> > +
> > + $str = to_utf8($str);
> > + $str =~ s|([[:cntrl:]])|quot_cec($1)|eg;
> > + return $str;
> > +}
Anyway, it could well be
+ $str =~ s|([[:cntrl:]])|(($1 ne "\t") ? quot_cec($1) : $1)|eg;
+ return $str;
like in esc_html rather than like in esc_path.
> > @@ -6546,7 +6557,8 @@ sub git_blob {
> > $nr++;
> > $line = untabify($line);
^^^^^^^^^^^^^^^^^^^^^^^^
> > printf qq!<div class="pre"><a id="l%i" href="%s#l%i" class="linenr">%4i</a> %s</div>\n!,
> > - $nr, esc_attr(href(-replay => 1)), $nr, $nr, $syntax ? to_utf8($line) : esc_html($line, -nbsp=>1);
> > + $nr, esc_attr(href(-replay => 1)), $nr, $nr,
> > + $syntax ? sanitize($line) : esc_html($line, -nbsp=>1);
> > }
> > }
> > close $fd
--
Jakub Narebski
Poland
^ permalink raw reply
* Re: git diff annoyance / feature request
From: Junio C Hamano @ 2011-08-26 21:52 UTC (permalink / raw)
To: Boaz Harrosh; +Cc: René Scharfe, git discussion list
In-Reply-To: <4E581213.6070304@panasas.com>
Boaz Harrosh <bharrosh@panasas.com> writes:
> On 08/26/2011 02:16 PM, René Scharfe wrote:
>> Am 25.08.2011 21:14, schrieb Boaz Harrosh:
>>
>> Cheap trick: change your coding style to place a single space before
>> labels instead of having them start right at the beginning of a line.
>>
>> René
>>
>
> Nope, does not work! and I have no choice about it, it's Linux coding
> style
I too thought it was in the Documentation/CodingStyle, but I don't find it
in my copy. "Chapter 7" has an example of using goto and it does have
label at the left edge of the page without indentation, but does not seem
to say it should not be indented.
Taken together with the output from "grep '#goto label' scripts/checkpatch.pl"
I concluded that "it's Linux coding style" was a myth.
^ permalink raw reply
* Re: [PATCH] gitweb: highlight: strip non-printable characters via col(1)
From: Junio C Hamano @ 2011-08-26 21:44 UTC (permalink / raw)
To: Jakub Narebski; +Cc: Christopher M. Fuhrman, git, cwilson, sylvain
In-Reply-To: <201108262154.14493.jnareb@gmail.com>
Jakub Narebski <jnareb@gmail.com> writes:
> Why use external program (which ming be not installed, or might not
> strip control-characters), instead of making gitweb sanitize highlighter
> output itself. Something like the patch below (which additionally
> shows where there are control characters):
I agree that that would be a more sensible approach. What does your sample
code below do to a HT by the way?
> -- >8 --
> diff --git i/gitweb/gitweb.perl w/gitweb/gitweb.perl
> index 7cf12af..192db2c 100755
> --- i/gitweb/gitweb.perl
> +++ w/gitweb/gitweb.perl
> @@ -1517,6 +1517,17 @@ sub esc_path {
> return $str;
> }
>
> +# Sanitize for use in XHTML + application/xml+xhtml
> +sub sanitize {
> + my $str = shift;
> +
> + return undef unless defined $str;
> +
> + $str = to_utf8($str);
> + $str =~ s|([[:cntrl:]])|quot_cec($1)|eg;
> + return $str;
> +}
> +
> # Make control characters "printable", using character escape codes (CEC)
> sub quot_cec {
> my $cntrl = shift;
> @@ -6546,7 +6557,8 @@ sub git_blob {
> $nr++;
> $line = untabify($line);
> printf qq!<div class="pre"><a id="l%i" href="%s#l%i" class="linenr">%4i</a> %s</div>\n!,
> - $nr, esc_attr(href(-replay => 1)), $nr, $nr, $syntax ? to_utf8($line) : esc_html($line, -nbsp=>1);
> + $nr, esc_attr(href(-replay => 1)), $nr, $nr,
> + $syntax ? sanitize($line) : esc_html($line, -nbsp=>1);
> }
> }
> close $fd
>
> -- 8< --
^ permalink raw reply
* Re: git diff annoyance / feature request
From: Boaz Harrosh @ 2011-08-26 21:37 UTC (permalink / raw)
To: René Scharfe; +Cc: git discussion list
In-Reply-To: <4E580D49.1070006@lsrfire.ath.cx>
On 08/26/2011 02:16 PM, René Scharfe wrote:
> Am 25.08.2011 21:14, schrieb Boaz Harrosh:
>
> Cheap trick: change your coding style to place a single space before
> labels instead of having them start right at the beginning of a line.
>
> René
>
Nope, does not work! and I have no choice about it, it's Linux coding
style
Boaz
^ permalink raw reply
* Re: git diff annoyance / feature request
From: René Scharfe @ 2011-08-26 21:16 UTC (permalink / raw)
To: Boaz Harrosh; +Cc: git discussion list
In-Reply-To: <4E569F10.8060808@panasas.com>
Am 25.08.2011 21:14, schrieb Boaz Harrosh:
>
> git diff has this very annoying miss-fixture where it will state
> as hunk header the closest label instead of the function name.
>
> So I get:
> @@ -675,9 +670,23 @@ try_again:
> }
>
> if (flag) {
> - foo();
> + bazz();
> }
>
>
> Instead of what I'd like:
> @@ -563,12 +563,7 @@ static int write_exec(struct page_collect *pcol)
> }
>
> if (flag) {
> - foo();
> + bazz();
> }
Cheap trick: change your coding style to place a single space before
labels instead of having them start right at the beginning of a line.
René
^ permalink raw reply
* Re: Files that cannot be added to the index
From: Shaun Ruffell @ 2011-08-26 21:12 UTC (permalink / raw)
To: git
In-Reply-To: <20110826205919.GB8107@sooty-2.local>
On Fri, Aug 26, 2011 at 10:59:19PM +0200, seanh wrote:
> I'm using git version 1.7.4.4 on OSX Lion, from macports. (I was
> having the problem on Snow Leopard too.)
Not sure if this is your problem exactly but awhile back I ran into
something similar to what you describe and tracked it down to the
fact that my filesystem was case insensitive. i.e.
$ git clone git://github.com/sruffell/dahdi-linux
Cloning into dahdi-linux...
done.
$ cd dahdi-linux/
$ ls
LICENSE Makefile UPGRADE.txt drivers
LICENSE.LGPL README build_tools include
$ git ls-files -m
$ rm Makefile
$ touch makefile
$ git add makefile
$ git ls-files -m
Makefile
$ git commit
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: Makefile
#
no changes added to commit (use "git add" and/or "git commit -a")
$ git add makefile
$ git commit
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: Makefile
#
no changes added to commit (use "git add" and/or "git commit -a")
^ permalink raw reply
* Re: [PATCH] .gitattributes: Enable cpp diff parsing for .[ch] files
From: Linus Torvalds @ 2011-08-26 20:59 UTC (permalink / raw)
To: Junio C Hamano
Cc: Boaz Harrosh, Andrew Morton, Git Mailing List, linux-kernel
In-Reply-To: <7vfwkndhc4.fsf@alter.siamese.dyndns.org>
On Fri, Aug 26, 2011 at 1:54 PM, Junio C Hamano <gitster@pobox.com> wrote:
>
> Not quite sure what you exactly mean by "extend it from just binary-vs-text".
> Do you mean update buffer_is_binary() and add source language detection?
Yes. Except the "detection" would be just "if we auto-detect it as
text, then use the standard file extensions to also make an automatic
hunk rule detection".
So it would do the most common cases (*.[Cch] etc)
Linus
^ permalink raw reply
* Re: Files that cannot be added to the index
From: seanh @ 2011-08-26 20:59 UTC (permalink / raw)
To: git
In-Reply-To: <4E57A93A.6090405@drmicha.warpmail.net>
Unfortunately I can't share the repos, but I've pasted actual output
showing the problem below. I'm using git version 1.7.4.4 on OSX Lion,
from macports. (I was having the problem on Snow Leopard too.) I am
using `git clone` to make the clone, but it's possible that at some
point the repo was moved or copied with things like mv, cp, rsync, maybe
moving across different filesystems.
seanh@sooty-2:~ % cd /tmp
seanh@sooty-2:/tmp % git clone ~/Dotfiles/home
Cloning into home...
done.
seanh@sooty-2:/tmp % cd home
seanh@sooty-2:/tmp/home % git status
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: Text/LOG.txt
#
no changes added to commit (use "git add" and/or "git commit -a")
seanh@sooty-2:/tmp/home % git diff
diff --git a/Text/LOG.txt b/Text/LOG.txt
index 317c80b..13edf26 100644
--- a/Text/LOG.txt
+++ b/Text/LOG.txt
@@ -1,2 +1,21 @@
CONTENTS OF DIFF SNIPPED
seanh@sooty-2:/tmp/home % git add Text/LOG.txt
seanh@sooty-2:/tmp/home % git status
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: Text/LOG.txt
#
no changes added to commit (use "git add" and/or "git commit -a")
seanh@sooty-2:/tmp/home % git add .; git commit
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: Text/LOG.txt
#
no changes added to commit (use "git add" and/or "git commit -a")
seanh@sooty-2:/tmp/home % (1) :(
On Fri, Aug 26, 2011 at 04:10:02PM +0200, Michael J Gruber wrote:
> seanh venit, vidit, dixit 26.08.2011 14:26:
> > Can anyone guess what's going on when I have a modified file that
> > shows up in `git status`, but the file cannot be added to the index
> > (or committed)? `git add FILE` does nothing, the file still shows as
> > modified but not added in `git status`.
> >
> > I have two different repos that have each developed this problem with
> > two different files. I don't know how it happened. The problem occurs
> > wherever the repos are cloned. Even if I delete the local copy (where
> > I'm seeing the problem) and clone the repo again from elsewhere,
> > problem persists.
>
> A log of your commands (or access to the repo) would help diagnose that,
> along with information about the system and the git version.
>
> Do you "clone" by making a copy, by any chance?
>
> Michael
^ permalink raw reply related
* Re: [PATCH] .gitattributes: Enable cpp diff parsing for .[ch] files
From: Boaz Harrosh @ 2011-08-26 20:55 UTC (permalink / raw)
To: Linus Torvalds
Cc: Andrew Morton, Git Mailing List, linux-kernel, Junio C Hamano
In-Reply-To: <CA+55aFxNXK-AJdrHBBycM5W632qUBi4E=jangcdRoefQiHzbug@mail.gmail.com>
On 08/26/2011 01:27 PM, Linus Torvalds wrote:
> On Thu, Aug 25, 2011 at 3:37 PM, Boaz Harrosh <bharrosh@panasas.com> wrote:
>>
>> Add a .gitattributes file to the Linux tree to enable cpp parsing
>> of the source files.
>
> Hmm. I'm not entirely conviced. If people really think that the hunk
> description matters that much, maybe we should just instead improve on
> the automatic diff detection, and extend it from just binary-vs-text,
> to also do the common hunk-headers.
>
> After all, not having a diff pattern already *does* mean "automatic",
> so it would be just a rather trivial extension to that.
>
> Junio?
>
There was a patch submitted for new git version to auto detect file
extensions and do the right thing.
(Look for the thread "git diff annoyance / feature request" on the git
mailing list)
But this patch is for all the people and distributions that are going
to use the old git versions for a while, (Years).
It is important for the Linux mailing-list review, because you get
patches with:
@@@ lable out:
- change foo
+ to bazz
And how the hell are you suppose to know where in the file it is.
This is such a trivial addition, that can help unify everyone's
usage. I don't see the down sides.
Thanks
Boaz
> Linus
^ permalink raw reply
* Re: [PATCH] .gitattributes: Enable cpp diff parsing for .[ch] files
From: Junio C Hamano @ 2011-08-26 20:54 UTC (permalink / raw)
To: Linus Torvalds
Cc: Boaz Harrosh, Andrew Morton, Git Mailing List, linux-kernel
In-Reply-To: <CA+55aFxNXK-AJdrHBBycM5W632qUBi4E=jangcdRoefQiHzbug@mail.gmail.com>
Linus Torvalds <torvalds@linux-foundation.org> writes:
> On Thu, Aug 25, 2011 at 3:37 PM, Boaz Harrosh <bharrosh@panasas.com> wrote:
>>
>> Add a .gitattributes file to the Linux tree to enable cpp parsing
>> of the source files.
>
> Hmm. I'm not entirely conviced. If people really think that the hunk
> description matters that much, maybe we should just instead improve on
> the automatic diff detection, and extend it from just binary-vs-text,
> to also do the common hunk-headers.
>
> After all, not having a diff pattern already *does* mean "automatic",
> so it would be just a rather trivial extension to that.
Not quite sure what you exactly mean by "extend it from just binary-vs-text".
Do you mean update buffer_is_binary() and add source language detection?
See also:
http://thread.gmane.org/gmane.comp.version-control.git/180103/focus=180113
^ permalink raw reply
* Re: [PATCH] .gitattributes: Enable cpp diff parsing for .[ch] files
From: Linus Torvalds @ 2011-08-26 20:27 UTC (permalink / raw)
To: Boaz Harrosh
Cc: Andrew Morton, Git Mailing List, linux-kernel, Junio C Hamano
In-Reply-To: <4E56CE8F.8080501@panasas.com>
On Thu, Aug 25, 2011 at 3:37 PM, Boaz Harrosh <bharrosh@panasas.com> wrote:
>
> Add a .gitattributes file to the Linux tree to enable cpp parsing
> of the source files.
Hmm. I'm not entirely conviced. If people really think that the hunk
description matters that much, maybe we should just instead improve on
the automatic diff detection, and extend it from just binary-vs-text,
to also do the common hunk-headers.
After all, not having a diff pattern already *does* mean "automatic",
so it would be just a rather trivial extension to that.
Junio?
Linus
^ permalink raw reply
* Re: Looking up objects that point to other objects
From: Jeff King @ 2011-08-26 20:10 UTC (permalink / raw)
To: Ævar Arnfjörð Bjarmason; +Cc: Git Mailing List
In-Reply-To: <CACBZZX6sydEmuwj_C-KNocjra=6ynud5KFoezPd_Rr3bN4wh2w@mail.gmail.com>
On Fri, Aug 26, 2011 at 09:01:22PM +0200, Ævar Arnfjörð Bjarmason wrote:
> Here's a couple of tasks that require brute-force with the Git object
> format that I've wanted to do at some point.
>
> * Associate a blob with trees
>
> Given a blob sha1 find trees that reference it.
>
> * Associate trees with commits / other trees.
>
> Given a tree find which commit points to that tree, or a parent
> tree N levels up the stack that a commit points to.
I've more frequently wanted to find the entrance and exit points of a
particular blob in history, and used something like:
git log --all --no-abbrev -c --raw --format='commit %H' |
perl -le '
my @blobs = map { qr/$_/ } @ARGV;
while(<STDIN>) {
if (/^commit (.*)/) {
$commit = $1;
}
else {
foreach my $re (@blobs) {
next unless /$re/;
print $commit;
last;
}
}
}
' $blobs
which is fairly efficient. It's brute-force, but at least it all happens
in O(1) processes. It can find blobs in git.git in about a minute or so
on my machine.
I don't think there's a way to ask for all of the trees in a commit in a
single process. It wouldn't be hard to write in C, of course, but it's
not something the current tools support. However, you can use the above
script to narrow the range of commits that you know contain a blob, and
then individually run ls-tree each one. It's better at least than running
ls-tree on every commit in the repo.
Anything that iterates over commits is going to end up seeing the same
trees again and again. I think you could probably do better by thinking
of it like a directed graph problem. Nodes are sha1s, and edges are any
references of interest:
1. For a commit, make an edge from the commit to its tree.
2. For a tree, make an edge from the tree to each of its entries.
And then the problem is reduced to "find all commit nodes that have a
path to $blob". Which you can do by breadth-first search from the
commits (or backwards from the blob).
-Peff
^ 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