* Re: gitweb wishlist
From: Kay Sievers @ 2005-05-14 2:34 UTC (permalink / raw)
To: Jonas Fonseca; +Cc: git
In-Reply-To: <20050513120618.GA26263@diku.dk>
On Fri, 2005-05-13 at 14:06 +0200, Jonas Fonseca wrote:
> I don't know if this is intentional, but it looks like gitweb discards
> everything after the first line starting with 'Signed-off-by:' on the
> log page. This will in some cases remove valuable log information when
> a second author or the committer adds additional comments to a commit:
>
> <log message by author>
>
> Signed-off-by: <author>
>
> <log message by committer>
>
> Signed-off-by: <committer>
>
> The commit page gets it right, which is why I suspect it might just be a
> way to trim the amount of text on the log page.
>
> I also noticed that there is a 'faulty' signed-off-by line in commit
> 14ebb908e10f068dc1901d35f4b716bc69143d19 in case the above is
> intentional. Dunno if that should be matched by relaxing the regexp a
> little.
All that should work now.
Thanks,
Kay
^ permalink raw reply
* [PATCH 3/3] Rename git-diff-tree-helper to git-diff-helper (part 2).
From: Junio C Hamano @ 2005-05-14 1:41 UTC (permalink / raw)
To: pasky, torvalds; +Cc: git
It used to be that diff-tree needed helper support to parse its
raw output to generate diffs, but these days git-diff-* family
produces the same output and the helper is not tied to diff-tree
anymore. Drop "tree" from its name.
This follows the "rename only" commit to adjust the contents of
the files involved.
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
Documentation/diff-format.txt | 2 +-
Documentation/git-diff-helper.txt | 10 +++++-----
Documentation/git.txt | 2 +-
Makefile | 4 ++--
diff-helper.c | 12 ++++++------
diff.h | 2 +-
6 files changed, 16 insertions(+), 16 deletions(-)
--- a/Documentation/diff-format.txt
+++ b/Documentation/diff-format.txt
@@ -45,7 +45,7 @@
instead they produce a patch file.
The patch generation can be customized at two levels. This
-customization also applies to "git-diff-tree-helper".
+customization also applies to "git-diff-helper".
1. When the environment variable 'GIT_EXTERNAL_DIFF' is not set,
these commands internally invoke "diff" like this:
--- a/Documentation/git-diff-helper.txt
+++ b/Documentation/git-diff-helper.txt
@@ -1,15 +1,15 @@
-git-diff-tree-helper(1)
+git-diff-helper(1)
=======================
v0.1, May 2005
NAME
----
-git-diff-tree-helper - Generates patch format output for git-diff-*
+git-diff-helper - Generates patch format output for git-diff-*
SYNOPSIS
--------
-'git-diff-tree-helper' [-z] [-R]
+'git-diff-helper' [-z] [-R]
DESCRIPTION
-----------
@@ -26,8 +26,8 @@
"git-diff-cache" which always compares tree with cache or working
file. E.g.
- git-diff-cache <tree> | git-diff-tree-helper -R file.c
-+
+ git-diff-cache <tree> | git-diff-helper -R file.c
+
would show a diff to bring the working file back to what is in the <tree>.
See Also
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -149,7 +149,7 @@
Interogators:
-link:git-diff-tree-helper.html[git-diff-tree-helper]::
+link:git-diff-helper.html[git-diff-helper]::
Generates patch format output for git-diff-*
link:git-rpush.html[git-rpush]::
--- a/Makefile
+++ b/Makefile
@@ -27,7 +27,7 @@
git-check-files git-ls-tree git-merge-base git-merge-cache \
git-unpack-file git-export git-diff-cache git-convert-cache \
git-http-pull git-rpush git-rpull git-rev-list git-mktag \
- git-diff-tree-helper git-tar-tree git-local-pull git-write-blob \
+ git-diff-helper git-tar-tree git-local-pull git-write-blob \
git-get-tar-commit-id
all: $(PROG)
@@ -101,7 +101,7 @@
git-rpull: rsh.c pull.c
git-rev-list: rev-list.c
git-mktag: mktag.c
-git-diff-tree-helper: diff-tree-helper.c
+git-diff-helper: diff-helper.c
git-tar-tree: tar-tree.c
git-write-blob: write-blob.c
--- a/diff-helper.c
+++ b/diff-helper.c
@@ -45,8 +45,8 @@
return 0;
}
-static int parse_diff_tree_output(const char *buf,
- const char **spec, int cnt, int reverse)
+static int parse_diff_raw_output(const char *buf,
+ const char **spec, int cnt, int reverse)
{
struct diff_spec old, new;
char path[PATH_MAX];
@@ -109,8 +109,8 @@
return 0;
}
-static const char *diff_tree_helper_usage =
-"diff-tree-helper [-R] [-z] paths...";
+static const char *diff_helper_usage =
+"git-diff-helper [-R] [-z] paths...";
int main(int ac, const char **av) {
struct strbuf sb;
@@ -125,7 +125,7 @@
else if (av[1][1] == 'z')
line_termination = 0;
else
- usage(diff_tree_helper_usage);
+ usage(diff_helper_usage);
ac--; av++;
}
/* the remaining parameters are paths patterns */
@@ -135,7 +135,7 @@
read_line(&sb, stdin, line_termination);
if (sb.eof)
break;
- status = parse_diff_tree_output(sb.buf, av+1, ac-1, reverse);
+ status = parse_diff_raw_output(sb.buf, av+1, ac-1, reverse);
if (status)
fprintf(stderr, "cannot parse %s\n", sb.buf);
}
--- a/diff.h
+++ b/diff.h
@@ -17,7 +17,7 @@
extern void diff_unmerge(const char *path);
-/* These are for diff-tree-helper */
+/* These are for diff-helper */
struct diff_spec {
unsigned char blob_sha1[20];
------------------------------------------------
^ permalink raw reply
* [PATCH 2/3] Rename git-diff-tree-helper to git-diff-helper.
From: Junio C Hamano @ 2005-05-14 1:40 UTC (permalink / raw)
To: pasky, torvalds; +Cc: git
It used to be that diff-tree needed helper support to parse its
raw output to generate diffs, but these days git-diff-* family
produces the same output and the helper is not tied to diff-tree
anymore. Drop "tree" from its name.
This commit is done separately to record just the rename and no
file content changes. Makefiles and documentation needs to be
adjusted, which is done in the next commit.
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
Documentation/git-diff-helper.txt | 49 +++++++++++
Documentation/git-diff-tree-helper.txt | 49 -----------
diff-helper.c | 143 +++++++++++++++++++++++++++++++++
diff-tree-helper.c | 143 ---------------------------------
4 files changed, 192 insertions(+), 192 deletions(-)
Documentation/git-diff-helper.txt (. --> 100644)
Documentation/git-diff-tree-helper.txt (100644 --> .)
diff-helper.c (. --> 100644)
diff-tree-helper.c (100644 --> .)
--- a/Documentation/git-diff-helper.txt
+++ b/Documentation/git-diff-helper.txt
@@ -0,0 +1,49 @@
+git-diff-tree-helper(1)
+=======================
+v0.1, May 2005
+
+NAME
+----
+git-diff-tree-helper - Generates patch format output for git-diff-*
+
+
+SYNOPSIS
+--------
+'git-diff-tree-helper' [-z] [-R]
+
+DESCRIPTION
+-----------
+Reads output from "git-diff-cache", "git-diff-tree" and "git-diff-files" and
+generates patch format output.
+
+OPTIONS
+-------
+-z::
+ \0 line termination on input
+
+-R::
+ Output diff in reverse. This is useful for displaying output from
+ "git-diff-cache" which always compares tree with cache or working
+ file. E.g.
+
+ git-diff-cache <tree> | git-diff-tree-helper -R file.c
++
+would show a diff to bring the working file back to what is in the <tree>.
+
+See Also
+--------
+The section on generating patches in link:git-diff-cache.html[git-diff-cache]
+
+
+Author
+------
+Written by Linus Torvalds <torvalds@osdl.org>
+
+Documentation
+--------------
+Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
+
+GIT
+---
+Part of the link:git.html[git] suite
+
--- a/Documentation/git-diff-tree-helper.txt
+++ b/Documentation/git-diff-tree-helper.txt
@@ -1,49 +0,0 @@
-git-diff-tree-helper(1)
-=======================
-v0.1, May 2005
-
-NAME
-----
-git-diff-tree-helper - Generates patch format output for git-diff-*
-
-
-SYNOPSIS
---------
-'git-diff-tree-helper' [-z] [-R]
-
-DESCRIPTION
------------
-Reads output from "git-diff-cache", "git-diff-tree" and "git-diff-files" and
-generates patch format output.
-
-OPTIONS
--------
--z::
- \0 line termination on input
-
--R::
- Output diff in reverse. This is useful for displaying output from
- "git-diff-cache" which always compares tree with cache or working
- file. E.g.
-
- git-diff-cache <tree> | git-diff-tree-helper -R file.c
-+
-would show a diff to bring the working file back to what is in the <tree>.
-
-See Also
---------
-The section on generating patches in link:git-diff-cache.html[git-diff-cache]
-
-
-Author
-------
-Written by Linus Torvalds <torvalds@osdl.org>
-
-Documentation
---------------
-Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
-
-GIT
----
-Part of the link:git.html[git] suite
-
--- a/diff-helper.c
+++ b/diff-helper.c
@@ -0,0 +1,143 @@
+/*
+ * Copyright (C) 2005 Junio C Hamano
+ */
+#include <limits.h>
+#include "cache.h"
+#include "strbuf.h"
+#include "diff.h"
+
+static int matches_pathspec(const char *name, const char **spec, int cnt)
+{
+ int i;
+ int namelen = strlen(name);
+ for (i = 0; i < cnt; i++) {
+ int speclen = strlen(spec[i]);
+ if (! strncmp(spec[i], name, speclen) &&
+ speclen <= namelen &&
+ (name[speclen] == 0 ||
+ name[speclen] == '/'))
+ return 1;
+ }
+ return 0;
+}
+
+static int parse_oneside_change(const char *cp, struct diff_spec *one,
+ char *path)
+{
+ int ch;
+
+ one->file_valid = one->sha1_valid = 1;
+ one->mode = 0;
+ while ((ch = *cp) && '0' <= ch && ch <= '7') {
+ one->mode = (one->mode << 3) | (ch - '0');
+ cp++;
+ }
+
+ if (strncmp(cp, "\tblob\t", 6))
+ return -1;
+ cp += 6;
+ if (get_sha1_hex(cp, one->blob_sha1))
+ return -1;
+ cp += 40;
+ if (*cp++ != '\t')
+ return -1;
+ strcpy(path, cp);
+ return 0;
+}
+
+static int parse_diff_tree_output(const char *buf,
+ const char **spec, int cnt, int reverse)
+{
+ struct diff_spec old, new;
+ char path[PATH_MAX];
+ const char *cp = buf;
+ int ch;
+
+ switch (*cp++) {
+ case 'U':
+ if (!cnt || matches_pathspec(cp + 1, spec, cnt))
+ diff_unmerge(cp + 1);
+ return 0;
+ case '+':
+ old.file_valid = 0;
+ parse_oneside_change(cp, &new, path);
+ break;
+ case '-':
+ new.file_valid = 0;
+ parse_oneside_change(cp, &old, path);
+ break;
+ case '*':
+ old.file_valid = old.sha1_valid =
+ new.file_valid = new.sha1_valid = 1;
+ old.mode = new.mode = 0;
+ while ((ch = *cp) && ('0' <= ch && ch <= '7')) {
+ old.mode = (old.mode << 3) | (ch - '0');
+ cp++;
+ }
+ if (strncmp(cp, "->", 2))
+ return -1;
+ cp += 2;
+ while ((ch = *cp) && ('0' <= ch && ch <= '7')) {
+ new.mode = (new.mode << 3) | (ch - '0');
+ cp++;
+ }
+ if (strncmp(cp, "\tblob\t", 6))
+ return -1;
+ cp += 6;
+ if (get_sha1_hex(cp, old.blob_sha1))
+ return -1;
+ cp += 40;
+ if (strncmp(cp, "->", 2))
+ return -1;
+ cp += 2;
+ if (get_sha1_hex(cp, new.blob_sha1))
+ return -1;
+ cp += 40;
+ if (*cp++ != '\t')
+ return -1;
+ strcpy(path, cp);
+ break;
+ default:
+ return -1;
+ }
+ if (!cnt || matches_pathspec(path, spec, cnt)) {
+ if (reverse)
+ run_external_diff(path, &new, &old);
+ else
+ run_external_diff(path, &old, &new);
+ }
+ return 0;
+}
+
+static const char *diff_tree_helper_usage =
+"diff-tree-helper [-R] [-z] paths...";
+
+int main(int ac, const char **av) {
+ struct strbuf sb;
+ int reverse = 0;
+ int line_termination = '\n';
+
+ strbuf_init(&sb);
+
+ while (1 < ac && av[1][0] == '-') {
+ if (av[1][1] == 'R')
+ reverse = 1;
+ else if (av[1][1] == 'z')
+ line_termination = 0;
+ else
+ usage(diff_tree_helper_usage);
+ ac--; av++;
+ }
+ /* the remaining parameters are paths patterns */
+
+ while (1) {
+ int status;
+ read_line(&sb, stdin, line_termination);
+ if (sb.eof)
+ break;
+ status = parse_diff_tree_output(sb.buf, av+1, ac-1, reverse);
+ if (status)
+ fprintf(stderr, "cannot parse %s\n", sb.buf);
+ }
+ return 0;
+}
--- a/diff-tree-helper.c
+++ b/diff-tree-helper.c
@@ -1,143 +0,0 @@
-/*
- * Copyright (C) 2005 Junio C Hamano
- */
-#include <limits.h>
-#include "cache.h"
-#include "strbuf.h"
-#include "diff.h"
-
-static int matches_pathspec(const char *name, const char **spec, int cnt)
-{
- int i;
- int namelen = strlen(name);
- for (i = 0; i < cnt; i++) {
- int speclen = strlen(spec[i]);
- if (! strncmp(spec[i], name, speclen) &&
- speclen <= namelen &&
- (name[speclen] == 0 ||
- name[speclen] == '/'))
- return 1;
- }
- return 0;
-}
-
-static int parse_oneside_change(const char *cp, struct diff_spec *one,
- char *path)
-{
- int ch;
-
- one->file_valid = one->sha1_valid = 1;
- one->mode = 0;
- while ((ch = *cp) && '0' <= ch && ch <= '7') {
- one->mode = (one->mode << 3) | (ch - '0');
- cp++;
- }
-
- if (strncmp(cp, "\tblob\t", 6))
- return -1;
- cp += 6;
- if (get_sha1_hex(cp, one->blob_sha1))
- return -1;
- cp += 40;
- if (*cp++ != '\t')
- return -1;
- strcpy(path, cp);
- return 0;
-}
-
-static int parse_diff_tree_output(const char *buf,
- const char **spec, int cnt, int reverse)
-{
- struct diff_spec old, new;
- char path[PATH_MAX];
- const char *cp = buf;
- int ch;
-
- switch (*cp++) {
- case 'U':
- if (!cnt || matches_pathspec(cp + 1, spec, cnt))
- diff_unmerge(cp + 1);
- return 0;
- case '+':
- old.file_valid = 0;
- parse_oneside_change(cp, &new, path);
- break;
- case '-':
- new.file_valid = 0;
- parse_oneside_change(cp, &old, path);
- break;
- case '*':
- old.file_valid = old.sha1_valid =
- new.file_valid = new.sha1_valid = 1;
- old.mode = new.mode = 0;
- while ((ch = *cp) && ('0' <= ch && ch <= '7')) {
- old.mode = (old.mode << 3) | (ch - '0');
- cp++;
- }
- if (strncmp(cp, "->", 2))
- return -1;
- cp += 2;
- while ((ch = *cp) && ('0' <= ch && ch <= '7')) {
- new.mode = (new.mode << 3) | (ch - '0');
- cp++;
- }
- if (strncmp(cp, "\tblob\t", 6))
- return -1;
- cp += 6;
- if (get_sha1_hex(cp, old.blob_sha1))
- return -1;
- cp += 40;
- if (strncmp(cp, "->", 2))
- return -1;
- cp += 2;
- if (get_sha1_hex(cp, new.blob_sha1))
- return -1;
- cp += 40;
- if (*cp++ != '\t')
- return -1;
- strcpy(path, cp);
- break;
- default:
- return -1;
- }
- if (!cnt || matches_pathspec(path, spec, cnt)) {
- if (reverse)
- run_external_diff(path, &new, &old);
- else
- run_external_diff(path, &old, &new);
- }
- return 0;
-}
-
-static const char *diff_tree_helper_usage =
-"diff-tree-helper [-R] [-z] paths...";
-
-int main(int ac, const char **av) {
- struct strbuf sb;
- int reverse = 0;
- int line_termination = '\n';
-
- strbuf_init(&sb);
-
- while (1 < ac && av[1][0] == '-') {
- if (av[1][1] == 'R')
- reverse = 1;
- else if (av[1][1] == 'z')
- line_termination = 0;
- else
- usage(diff_tree_helper_usage);
- ac--; av++;
- }
- /* the remaining parameters are paths patterns */
-
- while (1) {
- int status;
- read_line(&sb, stdin, line_termination);
- if (sb.eof)
- break;
- status = parse_diff_tree_output(sb.buf, av+1, ac-1, reverse);
- if (status)
- fprintf(stderr, "cannot parse %s\n", sb.buf);
- }
- return 0;
-}
^ permalink raw reply
* [PATCH 1/3] Update mode-change strings in diff output.
From: Junio C Hamano @ 2005-05-14 1:40 UTC (permalink / raw)
To: pasky, torvalds; +Cc: git
This updates the mode change strings to be a bit more machine
friendly. Although this might go against the spirit of
readability for human consumption, these mode bits strings are
shown only when unusual things (mode change, file creation and
deletion) happens, output normalized for machine consumption
would be permissible.
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
diff.c | 22 ++++++++++++----------
1 files changed, 12 insertions(+), 10 deletions(-)
--- a/diff.c
+++ b/diff.c
@@ -83,6 +83,7 @@
struct diff_tempfile *temp)
{
int i, next_at;
+ const char *git_prefix = "# mode: ";
const char *diff_cmd = "diff -L'%s%s' -L'%s%s'";
const char *diff_arg = "'%s' '%s'||:"; /* "||:" is to return 0 */
const char *input_name_sq[2];
@@ -123,17 +124,18 @@
diff_arg, input_name_sq[0], input_name_sq[1]);
if (!path1[0][0])
- printf("Created: %s (mode:%s)\n", name, temp[1].mode);
+ printf("%s. %s %s\n", git_prefix, temp[1].mode, name);
else if (!path1[1][0])
- printf("Deleted: %s\n", name);
- else if (strcmp(temp[0].mode, temp[1].mode)) {
- printf("Mode changed: %s (%s->%s)\n", name,
- temp[0].mode, temp[1].mode);
- /* Be careful. We do not want to diff between
- * symlink and a file.
- */
- if (strncmp(temp[0].mode, "120", 3) !=
- strncmp(temp[1].mode, "120", 3))
+ printf("%s%s . %s\n", git_prefix, temp[0].mode, name);
+ else {
+ if (strcmp(temp[0].mode, temp[1].mode))
+ printf("%s%s %s %s\n", git_prefix,
+ temp[0].mode, temp[1].mode, name);
+
+ if (strncmp(temp[0].mode, temp[1].mode, 3))
+ /* we do not run diff between different kind
+ * of objects.
+ */
exit(0);
}
fflush(NULL);
^ permalink raw reply
* [PATCH 0/3] diff overhaul
From: Junio C Hamano @ 2005-05-14 1:39 UTC (permalink / raw)
To: pasky, torvalds; +Cc: git
Here are three patches to update diff we discussed earlier.
[PATCH 1/3] Update mode-change strings in diff output.
[PATCH 2/3] Rename git-diff-tree-helper to git-diff-helper.
[PATCH 3/3] Rename git-diff-tree-helper to git-diff-helper (part 2).
The first one is to normalize the mode bits output to be more
machine friendly, which we discussed.
The second commit records only renames for two files and there
is no content change. The third one is to change the Makefiles,
documentation, and also usage string in git-diff-helper itself.
I am deliverately doing the 2 and 3 in separate steps for two
reasons. (1) to reduce the possibility of mistakes during the
rename for myself; (2) people doing the git repository browser
can use the commit trail for practicing their rename detection
logic. So please keep these two steps separate when you commit.
^ permalink raw reply
* Re: [PATCH] Resurrect diff-tree-helper -R
From: Junio C Hamano @ 2005-05-14 0:33 UTC (permalink / raw)
To: Petr Baudis; +Cc: Linus Torvalds, git
In-Reply-To: <7vmzqy7k47.fsf@assigned-by-dhcp.cox.net>
Another possibility. How about generating the following _only_
when mode changes (including create and delete), even for human
consumption? There will be _no_ such line when mode or type
does not change.
# mode: 100644 100755 path/to/a/file/that/changed/mode
# mode: 100644 120000 path/to/a/file/that/changed/to/symlink
# mode: 100644 100644 path/to/a/file/with/no/mode/change
# mode: . 100644 path/to/a/new/file
# mode: 100644 . path/to/a/deleted/file
This is not "something like this", but a proposal for the exact
output format specification (I am going to code immediately).
Each token above is separated with exactly one ' ' (ASCII 0x20)
each, and such a line comes immediately before the patch for the
file. Showing both mode bits is to prepare for the case you
would want to apply the patch in reverse.
This is for machine consumption and there is no need to force
them to parse out -> and (), so I dropped them. And mode or
type change happens so rarely, it would be OK for human
consumption if we show these garbage (from human point of view)
only when things change. Can you parse this, or do you always
want to have them even if nothing changes?
Let's see how this would look like to humans.
# mode: 100644 100755 path0
--- a/path0
+++ b/path0
@@ -1,3 +1,3 @@
Line 1
Line 2
-line 3
+Line 3
# mode: 100644 . path1
--- a/path1
+++ /dev/null
@@ -1,3 +0,0 @@
-Line 1
-Line 2
-line 3
--- a/path2
+++ b/path2
@@ -1,3 +1,3 @@
Line 1
Line 2
-line 3
+Line 3
# mode: . 100755 t/t2000-diff.sh
--- /dev/null
+++ b/t/t2000-diff.sh
@@ -0,0 +1,41 @@
...
Doesn't look too bad, does it?
^ permalink raw reply
* Re: [PATCH] Resurrect diff-tree-helper -R
From: Junio C Hamano @ 2005-05-14 0:03 UTC (permalink / raw)
To: Petr Baudis; +Cc: Linus Torvalds, git
In-Reply-To: <20050513233354.GK32232@pasky.ji.cz>
>>>>> "PB" == Petr Baudis <pasky@ucw.cz> writes:
PB> .... Even if you think I shouldn't grep
I do not mean you should never grep. There are cases when there
is no alternative. One case I did not mention is that you would
want to accept patches via e-mail and apply. In such a case,
GIT_EXTERNAL_DIFF with git-apply-patch-script way would not work
because that approach is essentially to patch while you are
generating diff locally.
^ permalink raw reply
* Re: [PATCH] Resurrect diff-tree-helper -R
From: Junio C Hamano @ 2005-05-13 23:59 UTC (permalink / raw)
To: Petr Baudis; +Cc: Linus Torvalds, git
In-Reply-To: <20050513233354.GK32232@pasky.ji.cz>
>>>>> "PB" == Petr Baudis <pasky@ucw.cz> writes:
PB> Dear diary, on Sat, May 14, 2005 at 12:59:31AM CEST, I got a letter
PB> where Junio C Hamano <junkio@cox.net> told me that...
>> Created: t/t2000-diff.sh (mode:100755)
>> +Mode changed: path0 (100644->100755)
PB> Great, so it's even worse than before. :/
Depends on the definition of "before". At the beginning, we did
not do anything special and always said l/foo k/foo even when
create/delete was involved. Then we did a misguided attempt to
minimally be cg-diff compatible, which Linus complained that it
was too distracting for human consumption. The current one is
something in between, a lot more human side.
Yes, it is off course worse than the minimally cg-diff
compatible one, from cg-patch'es point of view.
You have seen what the current "something in between" does.
What I think is that in order not to distract human (read:
Linus) who reads patches, they should not share the same special
characters like "@". Which unfortunately completely contradicts
what you are attempting to do. Another thing we did while you
were looking other way ;-) was that we say mode changed only
when things change, so in that sense it is "inconsistent" from
the scripting point of view. These were all done to make the
output more readable by and less distracting for humans, per
request from Linus.
I do not think nobody uses that current textual "comment"
information in automated tools (I do not), so changing them
should not be a problem. How about we do something like this:
1. Invent an environment variable you can define. Let's say
GIT_DIFF_SHOW_MODES. It could alternatively a flag you
pass from git-diff-{files,cache,tree,tree-helper} to the
internal diff engine but then you need to add the necessary
command line parameter for all these commands. I can be
persuaded in either way.
2. When it is defined, we are not interested in pleasing Linus
by trying not to be distracting. We are more interested in
producing patch that is easily script processible.
3. Keep the current behaviour for human comsumption when we
are operating without the option we define in 1.
4. Change the mode stuff when GIT_DIFF_SHOW_MODES is defined.
It would produce one of the following for _all_ entries;
@. (100644->100755) path/to/a/file/that/changed/mode
@. (100644->120000) path/to/a/file/that/changed/to/symlink
@. (100644->100644) path/to/a/file/with/no/mode/change
@. (.->100644) path/to/a/new/file
@. (100644->.) path/to/a/deleted/file
I have to stress that these would come immediately before
the patch for each file. Not upfront, not grouped together
at the beginning.
BTW, what do you think about renaming git-diff-tree-helper to
just git-diff-helper? It used to be for grokking diff-tree's
output but now the family have the same raw output format it
does not make much sense to keep "tree" in its name.
^ permalink raw reply
* Re: [PATCH] [RFD] Add repoid identifier to commit [its a workspace id, isn't it?]
From: Jon Seymour @ 2005-05-13 23:49 UTC (permalink / raw)
To: Petr Baudis; +Cc: H. Peter Anvin, tglx, git
In-Reply-To: <20050513222502.GD32232@pasky.ji.cz>
On 5/14/05, Petr Baudis <pasky@ucw.cz> wrote:
> Dear diary, on Fri, May 13, 2005 at 03:37:47AM CEST, I got a letter
> where Jon Seymour <jon.seymour@gmail.com> told me that...
> > >
> > > I would like to suggest a few limiters are set on the repoid. In
> > > particular, I'd like to suggest that a repoid is a UUID, that a file is
> > > used to track it (.git/repoid), and that if it doesn't exist, a new one
> > > is created from /dev/urandom.
> > >
> >
> > I think I understand what Thomas is trying to achieve, but I think
> > there is a naming problem here. The marker really isn't a repoid - it
> > is a workspace id.
>
> Why not just call the thing "branch"? It's as well eligible for that
> term as anything. :-)
>
I very nearly agreed with you except for one thing. In a traditional
SCM, a branch is something that can be contributed by multiple people
but I don't think we want that meaning here.
Consider this graph where there is a main Trunk R, and a branch B and
two programmers Ba and Bb working on a branch B. Thomas wants to be
able to form views of the merge order of 3 workspaces (W(R), W(Ba) and
W(Bb)), even though Ba and Bb are working on the same "branch" in SCM
terms.
Rn -------------
| \ \
Rn-1 Ba,n Bb,n
| / |
Rn-2 |
| \ |
Rn-3 Ba,n-1 |
| / /
Rn-4 -----------
Also, most times in a traditional SCM, branches diverge, but the
behaviour we are interested in here is the repeated converging and
diverging of workspaces on the same "branch" [ I know, a branches can
be used in that way in traditional SCMs, but that is a degenerate case
of their intended use - maintaining paths of long term divergence ].
So, while I think there may well be some value is a separate
"branchid" attribute in a commit, I think they are describing
(slightly) different things.
jon
--
homepage: http://www.zeta.org.au/~jon/
blog: http://orwelliantremors.blogspot.com/
^ permalink raw reply
* Re: [PATCH] [RFD] Add repoid identifier to commit [its a workspace id, isn't it?]
From: Petr Baudis @ 2005-05-13 23:39 UTC (permalink / raw)
To: H. Peter Anvin; +Cc: Jon Seymour, tglx, git
In-Reply-To: <428529AD.5000401@zytor.com>
Dear diary, on Sat, May 14, 2005 at 12:26:53AM CEST, I got a letter
where "H. Peter Anvin" <hpa@zytor.com> told me that...
> Petr Baudis wrote:
> >
> >Why not just call the thing "branch"? It's as well eligible for that
> >term as anything. :-)
> >
>
> Because cogito already calls too many things "branches"?
Well, I know of one thing cogito calls "branch", and incidentally the
meaning if effectively same as this "branch" would have.
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
^ permalink raw reply
* Re: [PATCH 0/4] Pulling refs files
From: Petr Baudis @ 2005-05-13 23:37 UTC (permalink / raw)
To: Daniel Barkalow; +Cc: git, Linus Torvalds
In-Reply-To: <Pine.LNX.4.21.0505131853020.30848-100000@iabervon.org>
Dear diary, on Sat, May 14, 2005 at 01:14:22AM CEST, I got a letter
where Daniel Barkalow <barkalow@iabervon.org> told me that...
> On Sat, 14 May 2005, Petr Baudis wrote:
>
> > Hmm, I've honestly expected something different - a generic way to
> > specify any file in the repository to be pulled along, instead of a
> > introducing refs awareness at this level of git. What would be the
> > advantages of that approach against just specifying list of other files
> > to pull along?
>
> The point is to specify the commit to pull by fetching a file from the
> other side, not just to move a file. So you need to be specifying that the
> file is a hex encoding of the sha1 hash of the starting point of the pull,
> and the refs/ area is where these are expected to be. (Note that it still
> doesn't have any knowledge about the meanings of files in refs/; you tell
> it which one you want to use, and optionally which one you want to write
> to, and it will use the names you provide).
>
> It wouldn't help much to download the head file if you had to know the
> contents of that file already in order to do everything as a single
> transfer.
So what about just something like
git-wormhole-pull remote:refs/head/master wormhole://localhost/
That is, you could just specify remote:path_relative_to_url instead of
SHA1 id as the commit.
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
^ permalink raw reply
* Re: [PATCH] Resurrect diff-tree-helper -R
From: Petr Baudis @ 2005-05-13 23:33 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Linus Torvalds, git
In-Reply-To: <7vhdh691gs.fsf@assigned-by-dhcp.cox.net>
Dear diary, on Sat, May 14, 2005 at 12:59:31AM CEST, I got a letter
where Junio C Hamano <junkio@cox.net> told me that...
> Created: t/t2000-diff.sh (mode:100755)
> +Mode changed: path0 (100644->100755)
Great, so it's even worse than before. :/
My issues:
* Highly inconsistent format. Created has the "old-style" mode stuff
while changed mode looks completely differently. If you look at the
regular diffs, do you notice any format differences between creating
a file and modifying it?
Actually, I think it should just always look as
@ Mode changed: A->B C
where either A or B may be empty (for file creation/deletion).
I can see no point in further Created/Deleted lines.
* Filename not last. That'd be much friendlier to scripting, then you
could just split the line by spaces and at a certain point slurp the
rest and say that that would be a filename.
* No special prefix. Even if you think I shouldn't grep (it makes no
sense to me to redo half of the stuff when I already have something
reusable done, for no apparent benefit), I feel quite uncomfortable with
picking up and interpreting random pieces of surrounding text which
aren't marked as special in any way.
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
^ permalink raw reply
* Re: [PATCH] Ignore file filter
From: Petr Baudis @ 2005-05-13 23:12 UTC (permalink / raw)
To: David Greaves; +Cc: GIT Mailing Lists
In-Reply-To: <4283CAF8.3050304@dgreaves.com>
Dear diary, on Thu, May 12, 2005 at 11:30:32PM CEST, I got a letter
where David Greaves <david@dgreaves.com> told me that...
> # This doesn't allow the -h which is the [ arg for symlinks...
But so is -L. And I'd just use -l...
> #. ${COGITO_LIB}cg-Xlib
> _git=${GIT_DIR:-.git}
...but it makes no sense anyway I think to reinclude this stuff from a
cg-Xfile you are including from other scripts anyway.
> if [[ $file =~ $patt ]]; then
I'm sorry but this is really nothing my bash-2.05.0(1)-release supports.
We're already bash-only, but further reducing that to bash3 really won't
work. I *might* get convinced to add some bash2+-only feature, but only
if you'll be really good at explaining that it makes sense.
Besides, I'd prefer just the shell globs in the ignore file, as it is
done in the rest of the world, and in all the real-world scenarios I've
seen, the globs were powerful enough.
Also, how does this interact with git-ls-files --exclude and
.git/exclude? We would have two ignoring mechanisms...
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
^ permalink raw reply
* Re: [PATCH 0/4] Pulling refs files
From: Daniel Barkalow @ 2005-05-13 23:14 UTC (permalink / raw)
To: Petr Baudis; +Cc: git, Linus Torvalds
In-Reply-To: <20050513221935.GC32232@pasky.ji.cz>
On Sat, 14 May 2005, Petr Baudis wrote:
> Hmm, I've honestly expected something different - a generic way to
> specify any file in the repository to be pulled along, instead of a
> introducing refs awareness at this level of git. What would be the
> advantages of that approach against just specifying list of other files
> to pull along?
The point is to specify the commit to pull by fetching a file from the
other side, not just to move a file. So you need to be specifying that the
file is a hex encoding of the sha1 hash of the starting point of the pull,
and the refs/ area is where these are expected to be. (Note that it still
doesn't have any knowledge about the meanings of files in refs/; you tell
it which one you want to use, and optionally which one you want to write
to, and it will use the names you provide).
It wouldn't help much to download the head file if you had to know the
contents of that file already in order to do everything as a single
transfer.
-Daniel
*This .sig left intentionally blank*
^ permalink raw reply
* Re: [PATCH] Resurrect diff-tree-helper -R
From: Junio C Hamano @ 2005-05-13 22:59 UTC (permalink / raw)
To: Petr Baudis; +Cc: Linus Torvalds, git
In-Reply-To: <20050513224529.GF32232@pasky.ji.cz>
PB> Sorry for replying after so much time, it looks like I missed this and
PB> got here only after checking what change removed the mode: bits...
PB> What do you think?
FYI, here is a demonsrtation of what you have right now.
Temporarily slurp in the test framework patch you hate so much
to get t/test-lib.sh ;-), apply this to get t/t2000-diff.sh, cd
to t and say sh ./t2000-diff.sh
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
jit-diff 1: t/t2000-diff.sh
# - HEAD: Fix git-diff-files for symlinks.
# + (working tree)
Created: t/t2000-diff.sh (mode:100755)
--- /dev/null
+++ b/t/t2000-diff.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+#
+# Copyright (c) 2005 Junio C Hamano
+#
+
+test_description='Test built-in diff output engine.
+
+'
+. ./test-lib.sh
+
+echo >path0 'Line 1
+Line 2
+line 3'
+cat path0 >path1
+chmod +x path1
+git-update-cache --add path0 path1
+mv path0 path0-
+sed -e 's/line/Line/' <path0- >path0
+chmod +x path0
+rm -f path1
+git-diff-files -p >current
+cat >expected <<\EOF
+Mode changed: path0 (100644->100755)
+--- a/path0
++++ b/path0
+@@ -1,3 +1,3 @@
+ Line 1
+ Line 2
+-line 3
++Line 3
+Deleted: path1
+--- a/path1
++++ /dev/null
+@@ -1,3 +0,0 @@
+-Line 1
+-Line 2
+-line 3
+EOF
+
+test_expect_success 'cmp -s current expected'
+test_done
^ permalink raw reply
* Re: [PATCH] update README and #include in git.txt
From: Petr Baudis @ 2005-05-13 22:57 UTC (permalink / raw)
To: David Greaves; +Cc: GIT Mailing Lists
In-Reply-To: <42852A44.7010806@dgreaves.com>
Dear diary, on Sat, May 14, 2005 at 12:29:24AM CEST, I got a letter
where David Greaves <david@dgreaves.com> told me that...
> >>Index: README
> >>===================================================================
> >>--- 3c79088f1832d78012ccdb63e5da1ab88fcf408e/README (mode:100644)
> >>+++ e0e578bb02a7d8db1c105fddf5b5168ad0c79088/README (mode:100644)
> >>@@ -1,9 +1,13 @@
> >>+////////////////////////////////////////////////////////////////
> >>+ GIT - the stupid content tracker
> >>
> >>
> >>-
> >>- GIT - the stupid content tracker
> >>+Note that this README is written in asciidoc format and is #include'd
> >>+in the git.txt docs
> >>
> >>
> >>+The rest of this README is #included in the git.txt file
> >>+////////////////////////////////////////////////////////////////
> >> "git" can mean anything, depending on your mood.
> >>
> >> - random three-letter combination that is pronounceable, and not
> >>
> >>
> >
> >I'd probably prefer this being much less prominent. Can it be rather at
> >the bottom of the file?
> >
> >
> If you mean the header in the ///'s?
> yes - but I wanted editors to realise it is asciidoc so kept it at the top.
But it's called README, not EDITME. And I think it's cluttering for the
readers.
> >You're reintroducing the "typos" fixed before, apparently.
> >
> >
> I didn't notice the i.e. vs ie - I'm not that bothered ;)
But there were other typo fixes there and the big reindenting won't show
up any further changes to the text. I don't want to lose them so I'm
concerned now.
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
^ permalink raw reply
* Re: [PATCH] Resurrect diff-tree-helper -R
From: Junio C Hamano @ 2005-05-13 23:05 UTC (permalink / raw)
To: Petr Baudis; +Cc: Linus Torvalds, git
In-Reply-To: <20050513224529.GF32232@pasky.ji.cz>
>>>>> "PB" == Petr Baudis <pasky@ucw.cz> writes:
PB> that is, using a '@.' prefix for those. It seems to be unique enough and
PB> '@' is one of the four magic characters prefixing diff lines. Just using
PB> the plain string seems too volatile, and I need to grep all the
PB> interesting bits out of the diff file. This is because patch can
PB> otherwise complain "only garbage found in the patch" when processing the
PB> diff, which confuses my users greatly.
PB> What do you think?
Personally what I think is that grepping in the diff, especially
if the diff is something you are generating (I am assuming that
you are taling about cg-diff fed to cg-patch to port work tree
changes forward), is a wrong way to do things.
The way JIT does the equivalent is via git-apply-patch-script.
You run git-diff-{files,cache,tree}, setting GIT_EXTERNAL_DIFF
environment variable to git-apply-patch-script, and have the
apply-patch-script to take care of the mode changes, creation,
etc. See the implementation of the jit-patch command if you are
interested.
^ permalink raw reply
* Re: [PATCH] Resurrect diff-tree-helper -R
From: Junio C Hamano @ 2005-05-13 22:50 UTC (permalink / raw)
To: Petr Baudis; +Cc: Linus Torvalds, git
In-Reply-To: <20050513224529.GF32232@pasky.ji.cz>
Have you checked what the current one does?
^ permalink raw reply
* Re: [PATCH 2/2] update cg-* to use cg-Xignore
From: Petr Baudis @ 2005-05-13 22:55 UTC (permalink / raw)
To: David Greaves; +Cc: GIT Mailing Lists
In-Reply-To: <E1DWihi-0007DQ-SD@ash.dgreaves.com>
Dear diary, on Sat, May 14, 2005 at 12:32:22AM CEST, I got a letter
where David Greaves <david@dgreaves.com> told me that...
> Updated
> cg-add
> cg-commit
I consider this Bad Thing (tm). Or could you please point a situation
where this would be actually useful? If you explicitly cg-add, you
likely know what are you doing, and same thing with cg-commit - if it's
already added, it should be watches, no matter what ignore patterns, I
think.
> --- d2490ad0bc8b38647c6baff9da3e72c0f25e9f35/cg-commit (mode:100755)
> +++ 03662df7d089d4a84987ef9edb50a017b8b42439/cg-commit (mode:100755)
> @@ -65,6 +65,15 @@
> [ -s $_git/merging ] && merging=$(cat $_git/merging | sed 's/^/-p /')
> fi
>
> +# strip ignored files - *1 at a time* - any attempt to stream from 1
> +# while loop to another uses a subprocess and can't pass the variable
> +# back
> +# Also I don't know if this can be put in a shell function
> +for file in ${commitfiles[@]}
> + do
> + commitfiles[$i]=`echo $file | cg-Xignore`
> + ((i++))
> +done
>
> LOGMSG=$(mktemp -t gitci.XXXXXX)
> LOGMSG2=$(mktemp -t gitci.XXXXXX)
The variable? What variable?
> Index: cg-status
> ===================================================================
> --- d2490ad0bc8b38647c6baff9da3e72c0f25e9f35/cg-status (mode:100755)
> +++ 03662df7d089d4a84987ef9edb50a017b8b42439/cg-status (mode:100755)
> @@ -15,21 +15,11 @@
>
> {
> git-ls-files -z -t --others --deleted --unmerged $EXCLUDE
> -} | sort -z -k 2 | xargs -0 sh -c '
> -while [ "$1" ]; do
> - tag=${1% *};
> - filename=${1#* };
> - case "$filename" in
> - *.[ao] | tags | ,,merge*) ;;
> - *) echo "$tag $filename";;
> - esac
> - shift
> -done
> -' padding
> +} | sort -z -k 2 | cg-Xignore -0 -t | tr "\000" "\n"
So you have two ignores now - exclude and Xignore.
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
^ permalink raw reply
* Re: [PATCH] Resurrect diff-tree-helper -R
From: Petr Baudis @ 2005-05-13 22:45 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Junio C Hamano, git
In-Reply-To: <Pine.LNX.4.58.0504301805300.2296@ppc970.osdl.org>
Dear diary, on Sun, May 01, 2005 at 03:09:53AM CEST, I got a letter
where Linus Torvalds <torvalds@osdl.org> told me that...
>
>
> On Sat, 30 Apr 2005, Junio C Hamano wrote:
> >
> > Diff-tree-helper take two patch inadvertently dropped the
> > support of -R option
>
> Talking about the diffs, I'm beginning to hate those "mode" things.
>
> Not only do they screw up diffstat (big deal), but they are pointless,
> since 99.9% of the time the mode stays the same.
>
> So it would be much nicer (I think) if mode changes are handled
> separately, with a simple separate line before the diff saying
>
> "Mode change: %o->%o %s", oldmode, newmode, path
>
> and not mess up the diff header. That way, you only see it when it
> actually makes any difference, and it's more readable both for humans
> _and_ machines as a result.
>
> Normal "patch" will just ignore the extra lines before the diff anyway, so
> it won't matter there.
>
> Comments?
Sorry for replying after so much time, it looks like I missed this and
got here only after checking what change removed the mode: bits...
I'd personally prefer something like
@.Mode change:
that is, using a '@.' prefix for those. It seems to be unique enough and
'@' is one of the four magic characters prefixing diff lines. Just using
the plain string seems too volatile, and I need to grep all the
interesting bits out of the diff file. This is because patch can
otherwise complain "only garbage found in the patch" when processing the
diff, which confuses my users greatly.
What do you think?
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
^ permalink raw reply
* [PATCH 2/2] update cg-* to use cg-Xignore
From: David Greaves @ 2005-05-13 22:32 UTC (permalink / raw)
To: Petr Baudis; +Cc: GIT Mailing Lists
Updated
cg-add
cg-commit
cg-init
cg-status
to use the cg-Xignore
Signed-off-by: David Greaves <david@dgreaves.com>
---
commit 80e8dbdd3cf5e8d4ca0b6e446911d1ac17c5064e
tree 03662df7d089d4a84987ef9edb50a017b8b42439
parent 2fca920e6d3ccb92e9782bcf02f860b8333e23d9
author David Greaves <david@dgreaves.com> Fri, 13 May 2005 23:18:20 +0100
committer David Greaves <david@ash.(none)> Fri, 13 May 2005 23:18:20 +0100
cg-add | 13 +++++--------
cg-commit | 9 +++++++++
cg-init | 7 ++++++-
cg-status | 14 ++------------
4 files changed, 22 insertions(+), 21 deletions(-)
Index: cg-add
===================================================================
--- d2490ad0bc8b38647c6baff9da3e72c0f25e9f35/cg-add (mode:100755)
+++ 03662df7d089d4a84987ef9edb50a017b8b42439/cg-add (mode:100755)
@@ -11,11 +11,8 @@
[ "$1" ] || die "usage: cg-add FILE..."
for file in "$@"; do
- if [ -f "$file" ] || [ -h "$file" ]; then
- echo "Adding file $file"
- else
- die "$file does not exist"
- fi
-done
-
-git-update-cache --add -- "$@"
+ if [ -f "$file" ] || [ -h "$file" ]; then
+ echo "Adding file $file" >&2
+ fi
+ echo "$file"
+done | cg-Xignore -f -h | xargs git-update-cache --add --
Index: cg-commit
===================================================================
--- d2490ad0bc8b38647c6baff9da3e72c0f25e9f35/cg-commit (mode:100755)
+++ 03662df7d089d4a84987ef9edb50a017b8b42439/cg-commit (mode:100755)
@@ -65,6 +65,15 @@
[ -s $_git/merging ] && merging=$(cat $_git/merging | sed 's/^/-p /')
fi
+# strip ignored files - *1 at a time* - any attempt to stream from 1
+# while loop to another uses a subprocess and can't pass the variable
+# back
+# Also I don't know if this can be put in a shell function
+for file in ${commitfiles[@]}
+ do
+ commitfiles[$i]=`echo $file | cg-Xignore`
+ ((i++))
+done
LOGMSG=$(mktemp -t gitci.XXXXXX)
LOGMSG2=$(mktemp -t gitci.XXXXXX)
Index: cg-init
===================================================================
--- d2490ad0bc8b38647c6baff9da3e72c0f25e9f35/cg-init (mode:100755)
+++ 03662df7d089d4a84987ef9edb50a017b8b42439/cg-init (mode:100755)
@@ -7,6 +7,9 @@
# remote repository. Note that this usage is DEPRECATED - use cg-clone
# (possibly with the -s parameter) for doing this. This functionality
# will go away from cg-init soon.
+#
+# if there is a file called cogito.ignore then it is used to prime the
+# .git/ignore patterns
. ${COGITO_LIB}cg-Xlib
@@ -19,6 +22,8 @@
touch $_git/refs/heads/master
ln -s refs/heads/master $_git/HEAD
+[ -f cogito.ignore ] && mv cogito.ignore .git/ignore
+
if [ "$uri" ]; then
echo "$uri" >$_git/branches/origin
cg-pull origin || die "pull failed"
@@ -31,7 +36,7 @@
echo "Cloned (origin $uri available as branch \"origin\")"
else
git-read-tree # Seed the dircache
- find * -type f | xargs cg-add
+ find * | cg-Xignore -f -h | xargs cg-add
cg-commit -C -m"Initial commit" -e
fi
exit 0
Index: cg-status
===================================================================
--- d2490ad0bc8b38647c6baff9da3e72c0f25e9f35/cg-status (mode:100755)
+++ 03662df7d089d4a84987ef9edb50a017b8b42439/cg-status (mode:100755)
@@ -15,21 +15,11 @@
{
git-ls-files -z -t --others --deleted --unmerged $EXCLUDE
-} | sort -z -k 2 | xargs -0 sh -c '
-while [ "$1" ]; do
- tag=${1% *};
- filename=${1#* };
- case "$filename" in
- *.[ao] | tags | ,,merge*) ;;
- *) echo "$tag $filename";;
- esac
- shift
-done
-' padding
+} | sort -z -k 2 | cg-Xignore -0 -t | tr "\000" "\n"
{
git-update-cache --refresh
-} | cut -f 1 -d ":" | xargs sh -c '
+} | cut -f 1 -d ":" | cg-Xignore | xargs sh -c '
while [ "$1" ]; do
tag="M";
filename=${1%: *};
^ permalink raw reply
* [PATCH 1/2] update cg-Xignore
From: David Greaves @ 2005-05-13 22:31 UTC (permalink / raw)
To: Petr Baudis; +Cc: GIT Mailing Lists
Update Documentation to Jonas' style
Add -0 to allow null terminated lines (slightly buggy)
Add -t to cope with git-ls-files -t output
Signed-off-by: David Greaves <david@dgreaves.com>
---
commit 2fca920e6d3ccb92e9782bcf02f860b8333e23d9
tree d2490ad0bc8b38647c6baff9da3e72c0f25e9f35
parent fbb4054b80189c58f0b289dc34320f2b2de56d24
author David Greaves <david@dgreaves.com> Fri, 13 May 2005 23:17:18 +0100
committer David Greaves <david@ash.(none)> Fri, 13 May 2005 23:17:18 +0100
cg-Xignore | 57 +++++++++++++++++++++++++++++++++++++++++----------------
1 files changed, 41 insertions(+), 16 deletions(-)
Index: cg-Xignore
===================================================================
--- 9a39ca9b1e7dd28ddb4a1908ccb59787f432d752/cg-Xignore (mode:100755)
+++ d2490ad0bc8b38647c6baff9da3e72c0f25e9f35/cg-Xignore (mode:100755)
@@ -1,14 +1,20 @@
#!/usr/bin/env bash
#
-# Takes a list of files on stdin and only passes valid ones agording to .git/ignore
+# Takes a list of files on stdin and only passes valid ones according to .git/ignore
# Copyright (c) David Greaves, 2005
#
+# DESCRIPTION
+# -----------
# This filter implements cogito ignore rules and should typically be used in find pipelines
#
-# Synopsis
-# cg-Xignore [-debug] [-f] [-h] [-d] < file-list >useful-file-list
#
-# Options
+# OPTIONS
+# -------
+# -0::
+# processes null terminated lines
+# this is buggy and uses \n internally so any files with a \n
+# in will break it. Tough - don't use shell scripts.
+#
# -debug::
# produce helpful debug output
#
@@ -24,18 +30,26 @@
# -h::
# passes symbolic links
#
-# The default is to pass all file types that are not ignored.
+# -t::
+# cope with files preceded by a 'tag'. eg from git-ls-files -t
+#
+# The default is to pass all file types.
#
# Note that the .git/ignore file contains multiple expressions, 1 per line
# Lines beginning with a '#' are ignored (allowing comments)
# These are 'bash regular expressions' not glob patterns
# This allows ignore rules to take the directory into account
-# Suggested contents:
+#
+# Example .git/ignore
+# -------------------
+#
# # bash regexps (not globs)
# ^\.[^/]
# /\.
# /$
# .*\.o$
+#
+USAGE="cg-Xignore [-0] [-debug] [-q] [-f] [-h] [-d] [-t] < file-list >useful-file-list"
# This doesn't allow the -h which is the [ arg for symlinks...
@@ -44,19 +58,22 @@
IGNORE_FILE="$_git/ignore"
-if [ "$1" = "-0" ]; then
- # doesn't work :(
- zerosep=$'-d "\0"'
- shift
-fi
# Defaults
pass_files=0
pass_dirs=0
pass_links=0
pass_all=1
+stripzero='cat'
+rezero='cat'
while [ $# -gt 0 ]; do
case $1 in
+ "-0")
+ # doesn't work :(
+ #zerosep=$'-d \0'
+ stripzero='tr "\000" "\n"'
+ rezero='tr "\n" "\000"'
+ ;;
"-f")
pass_all=0
pass_files=1
@@ -75,6 +92,9 @@
"-debug")
debug=1
;;
+ "-t")
+ tagged=1
+ ;;
esac
shift
done
@@ -92,10 +112,15 @@
exec 4>/dev/null
fi
-
# Strip out the common leading ./ allowing "find ."
-sed 's:^./::' | \
+$stripzero | sed "s:^./::" | \
while read $zerosep file; do
+ tag=""
+ if [ $tagged ]; then
+ tag=${file% *}
+ fname=${file#* }
+ file=$fname
+ fi
echo "consider file: $file" >&4
ignore=0
if [ -f $IGNORE_FILE ]; then
@@ -112,7 +137,6 @@
fi
done
fi
- echo "passing file: $file" >&4
if [ $ignore != "1" \
-a \( $pass_all -eq 1 \
@@ -121,6 +145,7 @@
-o \( $pass_links -eq 1 -a -h "$file" \) \
\) \
]; then
- echo "$file"
+ echo "passing file: $file" >&4
+ echo "$tag$file"
fi
-done
+done | $rezero
^ permalink raw reply
* Re: [PATCH] update README and #include in git.txt
From: David Greaves @ 2005-05-13 22:29 UTC (permalink / raw)
To: Petr Baudis; +Cc: GIT Mailing Lists
In-Reply-To: <20050513221306.GB32232@pasky.ji.cz>
Petr Baudis wrote:
>Dear diary, on Thu, May 12, 2005 at 11:31:05PM CEST, I got a letter
>where David Greaves <david@dgreaves.com> told me that...
>
>
>>Makefile understands the includes git.txt #includes README
>>README reformatted to asciidoc to allow inclusion in git.txt
>>
>>Signed-off-by: David Greaves <david@dgreaves.com>
>>
>>
>
>Is it just me or this commit message is really weird? :-)
>
>
I know, I saw it when I pushed send. Somehow a \n became a space... I
blame vi. Should be:
Makefile understands the includes
git.txt #includes README
README reformatted to asciidoc to allow inclusion in git.txt
>
>
>>Index: README
>>===================================================================
>>--- 3c79088f1832d78012ccdb63e5da1ab88fcf408e/README (mode:100644)
>>+++ e0e578bb02a7d8db1c105fddf5b5168ad0c79088/README (mode:100644)
>>@@ -1,9 +1,13 @@
>>+////////////////////////////////////////////////////////////////
>>+ GIT - the stupid content tracker
>>
>>
>>-
>>- GIT - the stupid content tracker
>>+Note that this README is written in asciidoc format and is #include'd
>>+in the git.txt docs
>>
>>
>>+The rest of this README is #included in the git.txt file
>>+////////////////////////////////////////////////////////////////
>> "git" can mean anything, depending on your mood.
>>
>> - random three-letter combination that is pronounceable, and not
>>
>>
>
>I'd probably prefer this being much less prominent. Can it be rather at
>the bottom of the file?
>
>
If you mean the header in the ///'s?
yes - but I wanted editors to realise it is asciidoc so kept it at the top.
It could also be toned down by using fewer ////s - but that looked a bit
odd.
(the /// /// lines act as comment block markers so asciidoc ignores the
header
Or the "git can mean anything" speech?
That's how it was originally.
>
>
>>-the object (i.e. how it is used, and how it can refer to other objects).
>>-There are currently three different object types: "blob", "tree" and
>>-"commit".
>>+the object (ie how it is used, and how it can refer to other objects).
>>+There are currently four different object types: "blob", "tree",
>>+"commit" and "tag".
>>
>>
>
>You're reintroducing the "typos" fixed before, apparently.
>
>
I didn't notice the i.e. vs ie - I'm not that bothered ;)
>
>
>> A "blob" object cannot refer to any other object, and is, like the tag
>> implies, a pure storage object containing some user data. It is used to
>>@@ -48,7 +50,7 @@
>> directory structure. In addition, a tree object can refer to other tree
>> objects, thus creating a directory hierarchy.
>>
>>-Finally, a "commit" object ties such directory hierarchies together into
>>+A "commit" object ties such directory hierarchies together into
>> a DAG of revisions - each "commit" is associated with exactly one tree
>> (the directory hierarchy at the time of the commit). In addition, a
>> "commit" refers to one or more "parent" commit objects that describe the
>>@@ -62,12 +64,17 @@
>> just going to confuse people. So aim for the notion of "one root object
>> per project", even if git itself does not enforce that.
>>
>>+A "tag" object symbolically identifies and can be used to sign other
>>+objects. It contains the identifier and type of another object, a
>>+symbolic name (of course!) and, optionally, a signature.
>>+
>>
>>
>
>I think those changes should be either sent as a separate patch or noted
>as being done in the commit message.
>
>
makes sense.
I'd rather note them in the message if that's OK
>
>
>>@@ -245,216 +274,209 @@
>>
>>
>>
>>- The Workflow
>>-
>>-
>>+The Workflow
>>+------------
>>
>>
>
>
>Cannot at least the newlines be preserved?
>
>
Yes - I must have been in an anti-whitespace mood.
Will see to this in the am...
David
--
^ permalink raw reply
* Re: [PATCH] [RFD] Add repoid identifier to commit [its a workspace id, isn't it?]
From: Petr Baudis @ 2005-05-13 22:25 UTC (permalink / raw)
To: Jon Seymour; +Cc: H. Peter Anvin, tglx, git
In-Reply-To: <2cfc4032050512183788e01fc@mail.gmail.com>
Dear diary, on Fri, May 13, 2005 at 03:37:47AM CEST, I got a letter
where Jon Seymour <jon.seymour@gmail.com> told me that...
> >
> > I would like to suggest a few limiters are set on the repoid. In
> > particular, I'd like to suggest that a repoid is a UUID, that a file is
> > used to track it (.git/repoid), and that if it doesn't exist, a new one
> > is created from /dev/urandom.
> >
>
> I think I understand what Thomas is trying to achieve, but I think
> there is a naming problem here. The marker really isn't a repoid - it
> is a workspace id.
Why not just call the thing "branch"? It's as well eligible for that
term as anything. :-)
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
^ permalink raw reply
* Re: [PATCH] [RFD] Add repoid identifier to commit [its a workspace id, isn't it?]
From: H. Peter Anvin @ 2005-05-13 22:26 UTC (permalink / raw)
To: Petr Baudis; +Cc: Jon Seymour, tglx, git
In-Reply-To: <20050513222502.GD32232@pasky.ji.cz>
Petr Baudis wrote:
>
> Why not just call the thing "branch"? It's as well eligible for that
> term as anything. :-)
>
Because cogito already calls too many things "branches"?
-hpa
^ 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