* [PATCH v6 6/6] fast-import: test the new option command
From: Sverre Rabbelier @ 2009-09-02 17:57 UTC (permalink / raw)
To: Junio C Hamano, Shawn O. Pearce, Johannes Schindelin, Git List,
Ian Clatworthy <ian.cla
Cc: Sverre Rabbelier
In-Reply-To: <1251914223-31435-6-git-send-email-srabbelier@gmail.com>
Test three options (quiet and import/export-marks) and verify that the
commandline options override these.
Also make sure that a option command without a preceeding feature
git-options command is rejected and that non-git options are ignored.
Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com>
---
Tests updated to match the new 'option git' syntax. Also added a
test to ensure that an option command without a preceeding 'feature
git-options' is rejected and that non-git options are ignored.
t/t9300-fast-import.sh | 84 +++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 83 insertions(+), 1 deletions(-)
diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index 564ed6b..fb795bb 100755
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
@@ -1089,7 +1089,7 @@ test_expect_success 'P: fail on blob mark in gitlink' '
test_must_fail git fast-import <input'
###
-### series R (feature)
+### series R (feature and option)
###
cat >input <<EOF
@@ -1108,4 +1108,86 @@ test_expect_success 'R: supported feature is accepted' '
git fast-import <input
'
+cat >input << EOF
+feature git-options
+option git quiet
+blob
+data 3
+hi
+
+EOF
+
+touch empty
+
+test_expect_success 'R: quiet option results in no stats being output' '
+ cat input | git fast-import 2> output &&
+ test_cmp empty output
+'
+
+cat >input << EOF
+feature git-options
+option git export-marks=git.marks
+blob
+mark :1
+data 3
+hi
+
+EOF
+
+test_expect_success \
+ 'R: export-marks option results in a marks file being created' \
+ 'cat input | git fast-import &&
+ grep :1 git.marks'
+
+test_expect_success \
+ 'R: export-marks options can be overriden by commandline options' \
+ 'cat input | git fast-import --export-marks=other.marks &&
+ grep :1 other.marks'
+
+cat >input << EOF
+feature git-options
+option git import-marks=marks.out
+option git export-marks=marks.new
+EOF
+
+test_expect_success \
+ 'R: import to output marks works without any content' \
+ 'cat input | git fast-import &&
+ test_cmp marks.out marks.new'
+
+cat >input <<EOF
+feature git-options
+option git import-marks=nonexistant.marks
+option git export-marks=marks.new
+EOF
+
+test_expect_success \
+ 'R: import marks uses the commandline marks file when the stream specifies one' \
+ 'cat input | git fast-import --import-marks=marks.out &&
+ test_cmp marks.out marks.new'
+
+cat >input <<EOF
+feature git-options
+EOF
+
+test_expect_success 'R: feature option is accepted' '
+ git fast-import <input
+'
+
+cat >input <<EOF
+option git quiet
+EOF
+
+test_expect_success \
+ 'R: option without preceeding feature command is rejected' \
+ 'test_must_fail git fast-import <input'
+
+cat >input <<EOF
+option non-existing-vcs non-existing-option
+EOF
+
+test_expect_success 'R: ignore non-git options' '
+ git fast-import <input
+'
+
test_done
--
1.6.4.16.g72c66.dirty
^ permalink raw reply related
* [PATCH v6 5/6] fast-import: add option command
From: Sverre Rabbelier @ 2009-09-02 17:57 UTC (permalink / raw)
To: Junio C Hamano, Shawn O. Pearce, Johannes Schindelin, Git List,
Ian Clatworthy <ian.cla
Cc: Sverre Rabbelier
In-Reply-To: <1251914223-31435-5-git-send-email-srabbelier@gmail.com>
This allows the frontend to specify any of the supported options as
long as no non-option command has been given. This way the
user does not have to include any frontend-specific options, but
instead she can rely on the frontend to tell fast-import what it
needs.
Also factor out parsing of argv and have it execute when we reach the
first non-option command, or after all commands have been read and
no non-option command has been encountered.
Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com>
---
Main difference with v5 is that the syntax is now 'option git ...'
as per a discussion with the other fast-import devs. Other options,
e.g. 'option hg' are ignored. Also fixed the docs to say that
feature commands are allowed before git option commands.
Documentation/git-fast-import.txt | 24 ++++++++++++
fast-import.c | 75 +++++++++++++++++++++++++++++++------
2 files changed, 87 insertions(+), 12 deletions(-)
diff --git a/Documentation/git-fast-import.txt b/Documentation/git-fast-import.txt
index 1e293f2..f1c94b4 100644
--- a/Documentation/git-fast-import.txt
+++ b/Documentation/git-fast-import.txt
@@ -307,6 +307,11 @@ and control the current import process. More detailed discussion
Require that fast-import supports the specified feature, or
abort if it does not.
+`option`::
+ Specify any of the options listed under OPTIONS to change
+ fast-import's behavior to suit the frontend's needs. This command
+ is optional and is not needed to perform an import.
+
`commit`
~~~~~~~~
Create or update a branch with a new commit, recording one logical
@@ -829,6 +834,25 @@ it does not.
The <feature> part of the command may be any string matching
[a-zA-Z-] and should be understood by a version of fast-import.
+`option`
+~~~~~~~~
+Processes the specified option so that git fast-import behaves in a
+way that suits the frontend's needs.
+Note that options specified by the frontend are overridden by any
+options the user may specify to git fast-import itself.
+
+....
+ 'option' SP <option> LF
+....
+
+The `<option>` part of the command may contain any of the options
+listed in the OPTIONS section, without the leading '--' and is
+treated in the same way.
+
+Option commands must be the first commands on the input (not counting
+feature commands), to give an option command after any non-option
+command is an error.
+
Crash Reports
-------------
If fast-import is supplied invalid input it will terminate with a
diff --git a/fast-import.c b/fast-import.c
index 9bf06a4..bad93dc 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -292,6 +292,8 @@ static unsigned long branch_load_count;
static int failure;
static FILE *pack_edges;
static unsigned int show_stats = 1;
+static int global_argc;
+static const char **global_argv;
/* Memory pools */
static size_t mem_pool_alloc = 2*1024*1024 - sizeof(struct mem_pool);
@@ -349,6 +351,10 @@ static struct recent_command *rc_free;
static unsigned int cmd_save = 100;
static uintmax_t next_mark;
static struct strbuf new_data = STRBUF_INIT;
+static int options_enabled;
+static int seen_non_option_command;
+
+static void parse_argv(void);
static void write_branch_report(FILE *rpt, struct branch *b)
{
@@ -1700,6 +1706,12 @@ static int read_next_command(void)
if (stdin_eof)
return EOF;
+ if (!seen_non_option_command
+ && prefixcmp(command_buf.buf, "feature ")
+ && prefixcmp(command_buf.buf, "option ")) {
+ parse_argv();
+ }
+
rc = rc_free;
if (rc)
rc_free = rc->next;
@@ -2456,11 +2468,31 @@ static void parse_feature(void)
if (!prefixcmp(feature, "date-format=")) {
option_date_format(feature + 12);
+ } else if (!strcmp("git-options", feature)) {
+ options_enabled = 1;
} else {
die("This version of fast-import does not support feature %s.", feature);
}
}
+static void parse_option(void)
+{
+ char* option = command_buf.buf + 11;
+
+ if (!options_enabled)
+ die("Got option command '%s' before options feature'", option);
+
+ if (seen_non_option_command)
+ die("Got option command '%s' after non-option command", option);
+
+ parse_one_option(option);
+}
+
+static void parse_nongit_option(void)
+{
+ // do nothing
+}
+
static int git_pack_config(const char *k, const char *v, void *cb)
{
if (!strcmp(k, "pack.depth")) {
@@ -2485,6 +2517,26 @@ static int git_pack_config(const char *k, const char *v, void *cb)
static const char fast_import_usage[] =
"git fast-import [--date-format=f] [--max-pack-size=n] [--depth=n] [--active-branches=n] [--export-marks=marks.file]";
+static void parse_argv(void)
+{
+ unsigned int i;
+
+ for (i = 1; i < global_argc; i++) {
+ const char *a = global_argv[i];
+
+ if (*a != '-' || !strcmp(a, "--"))
+ break;
+
+ parse_one_option(a + 2);
+ }
+ if (i != global_argc)
+ usage(fast_import_usage);
+
+ seen_non_option_command = 1;
+ if (input_file)
+ read_marks();
+}
+
int main(int argc, const char **argv)
{
unsigned int i;
@@ -2503,18 +2555,8 @@ int main(int argc, const char **argv)
avail_tree_table = xcalloc(avail_tree_table_sz, sizeof(struct avail_tree_content*));
marks = pool_calloc(1, sizeof(struct mark_set));
- for (i = 1; i < argc; i++) {
- const char *a = argv[i];
-
- if (*a != '-' || !strcmp(a, "--"))
- break;
-
- parse_one_option(a + 2);
- }
- if (i != argc)
- usage(fast_import_usage);
- if (input_file)
- read_marks();
+ global_argc = argc;
+ global_argv = argv;
rc_free = pool_alloc(cmd_save * sizeof(*rc_free));
for (i = 0; i < (cmd_save - 1); i++)
@@ -2539,9 +2581,18 @@ int main(int argc, const char **argv)
parse_progress();
else if (!prefixcmp(command_buf.buf, "feature "))
parse_feature();
+ else if (!prefixcmp(command_buf.buf, "option git "))
+ parse_option();
+ else if (!prefixcmp(command_buf.buf, "option "))
+ parse_nongit_option();
else
die("Unsupported command: %s", command_buf.buf);
}
+
+ // argv hasn't been parsed yet, do so
+ if (!seen_non_option_command)
+ parse_argv();
+
end_packfile();
dump_branches();
--
1.6.4.16.g72c66.dirty
^ permalink raw reply related
* [PATCH v6 4/6] fast-import: test the new feature command
From: Sverre Rabbelier @ 2009-09-02 17:57 UTC (permalink / raw)
To: Junio C Hamano, Shawn O. Pearce, Johannes Schindelin, Git List,
Ian Clatworthy <ian.cla
Cc: Sverre Rabbelier
In-Reply-To: <1251914223-31435-4-git-send-email-srabbelier@gmail.com>
Test that an unknown feature causes fast-import to abort, and that a
known feature is accepted.
Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com>
---
t/t9300-fast-import.sh | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index 821be7c..564ed6b 100755
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
@@ -1088,4 +1088,24 @@ INPUT_END
test_expect_success 'P: fail on blob mark in gitlink' '
test_must_fail git fast-import <input'
+###
+### series R (feature)
+###
+
+cat >input <<EOF
+feature no-such-feature-exists
+EOF
+
+test_expect_success 'R: abort on unsupported feature' '
+ test_must_fail git fast-import <input
+'
+
+cat >input <<EOF
+feature date-format=now
+EOF
+
+test_expect_success 'R: supported feature is accepted' '
+ git fast-import <input
+'
+
test_done
--
1.6.4.16.g72c66.dirty
^ permalink raw reply related
* [PATCH v6 2/6] fast-import: put marks reading in it's own function
From: Sverre Rabbelier @ 2009-09-02 17:56 UTC (permalink / raw)
To: Junio C Hamano, Shawn O. Pearce, Johannes Schindelin, Git List,
Ian Clatworthy <ian.cla
Cc: Sverre Rabbelier
In-Reply-To: <1251914223-31435-2-git-send-email-srabbelier@gmail.com>
All options do nothing but set settings, with the exception of the
--input-marks option. Delay the reading of the marks file till after
all options have been parsed.
Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com>
---
No change since v5.
fast-import.c | 73 ++++++++++++++++++++++++++++++++-------------------------
1 files changed, 41 insertions(+), 32 deletions(-)
diff --git a/fast-import.c b/fast-import.c
index b904f20..812fcf0 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -315,6 +315,7 @@ static struct object_entry_pool *blocks;
static struct object_entry *object_table[1 << 16];
static struct mark_set *marks;
static const char *mark_file;
+static const char *input_file;
/* Our last blob */
static struct last_object last_blob = { STRBUF_INIT, 0, 0, 0 };
@@ -1643,6 +1644,42 @@ static void dump_marks(void)
}
}
+static void read_marks(void)
+{
+ char line[512];
+ FILE *f = fopen(input_file, "r");
+ if (!f)
+ die_errno("cannot read '%s'", input_file);
+ while (fgets(line, sizeof(line), f)) {
+ uintmax_t mark;
+ char *end;
+ unsigned char sha1[20];
+ struct object_entry *e;
+
+ end = strchr(line, '\n');
+ if (line[0] != ':' || !end)
+ die("corrupt mark line: %s", line);
+ *end = 0;
+ mark = strtoumax(line + 1, &end, 10);
+ if (!mark || end == line + 1
+ || *end != ' ' || get_sha1(end + 1, sha1))
+ die("corrupt mark line: %s", line);
+ e = find_object(sha1);
+ if (!e) {
+ enum object_type type = sha1_object_info(sha1, NULL);
+ if (type < 0)
+ die("object not found: %s", sha1_to_hex(sha1));
+ e = insert_object(sha1);
+ e->type = type;
+ e->pack_id = MAX_PACK_ID;
+ e->offset = 1; /* just not zero! */
+ }
+ insert_mark(mark, e);
+ }
+ fclose(f);
+}
+
+
static int read_next_command(void)
{
static int stdin_eof = 0;
@@ -2338,39 +2375,9 @@ static void parse_progress(void)
skip_optional_lf();
}
-static void option_import_marks(const char *input_file)
+static void option_import_marks(const char *marks)
{
- char line[512];
- FILE *f = fopen(input_file, "r");
- if (!f)
- die_errno("cannot read '%s'", input_file);
- while (fgets(line, sizeof(line), f)) {
- uintmax_t mark;
- char *end;
- unsigned char sha1[20];
- struct object_entry *e;
-
- end = strchr(line, '\n');
- if (line[0] != ':' || !end)
- die("corrupt mark line: %s", line);
- *end = 0;
- mark = strtoumax(line + 1, &end, 10);
- if (!mark || end == line + 1
- || *end != ' ' || get_sha1(end + 1, sha1))
- die("corrupt mark line: %s", line);
- e = find_object(sha1);
- if (!e) {
- enum object_type type = sha1_object_info(sha1, NULL);
- if (type < 0)
- die("object not found: %s", sha1_to_hex(sha1));
- e = insert_object(sha1);
- e->type = type;
- e->pack_id = MAX_PACK_ID;
- e->offset = 1; /* just not zero! */
- }
- insert_mark(mark, e);
- }
- fclose(f);
+ input_file = xstrdup(marks);
}
static void option_date_format(const char *fmt)
@@ -2495,6 +2502,8 @@ int main(int argc, const char **argv)
}
if (i != argc)
usage(fast_import_usage);
+ if (input_file)
+ read_marks();
rc_free = pool_alloc(cmd_save * sizeof(*rc_free));
for (i = 0; i < (cmd_save - 1); i++)
--
1.6.4.16.g72c66.dirty
^ permalink raw reply related
* [PATCH v6 3/6] fast-import: add feature command
From: Sverre Rabbelier @ 2009-09-02 17:57 UTC (permalink / raw)
To: Junio C Hamano, Shawn O. Pearce, Johannes Schindelin, Git List,
Ian Clatworthy <ian.cla
Cc: Sverre Rabbelier
In-Reply-To: <1251914223-31435-3-git-send-email-srabbelier@gmail.com>
This allows the fronted to require a specific feature to be supported
by the frontend, or abort.
Also add support for the first feature, date-format=.
Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com>
---
No longer RFC.
Documentation/git-fast-import.txt | 16 ++++++++++++++++
fast-import.c | 13 +++++++++++++
2 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/Documentation/git-fast-import.txt b/Documentation/git-fast-import.txt
index c2f483a..1e293f2 100644
--- a/Documentation/git-fast-import.txt
+++ b/Documentation/git-fast-import.txt
@@ -303,6 +303,10 @@ and control the current import process. More detailed discussion
standard output. This command is optional and is not needed
to perform an import.
+`feature`::
+ Require that fast-import supports the specified feature, or
+ abort if it does not.
+
`commit`
~~~~~~~~
Create or update a branch with a new commit, recording one logical
@@ -813,6 +817,18 @@ Placing a `progress` command immediately after a `checkpoint` will
inform the reader when the `checkpoint` has been completed and it
can safely access the refs that fast-import updated.
+`feature`
+~~~~~~~~~
+Require that fast-import supports the specified feature, or abort if
+it does not.
+
+....
+ 'feature' SP <feature> LF
+....
+
+The <feature> part of the command may be any string matching
+[a-zA-Z-] and should be understood by a version of fast-import.
+
Crash Reports
-------------
If fast-import is supplied invalid input it will terminate with a
diff --git a/fast-import.c b/fast-import.c
index 812fcf0..9bf06a4 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -2450,6 +2450,17 @@ static void parse_one_option(const char *option)
}
}
+static void parse_feature(void)
+{
+ char *feature = command_buf.buf + 8;
+
+ if (!prefixcmp(feature, "date-format=")) {
+ option_date_format(feature + 12);
+ } else {
+ die("This version of fast-import does not support feature %s.", feature);
+ }
+}
+
static int git_pack_config(const char *k, const char *v, void *cb)
{
if (!strcmp(k, "pack.depth")) {
@@ -2526,6 +2537,8 @@ int main(int argc, const char **argv)
parse_checkpoint();
else if (!prefixcmp(command_buf.buf, "progress "))
parse_progress();
+ else if (!prefixcmp(command_buf.buf, "feature "))
+ parse_feature();
else
die("Unsupported command: %s", command_buf.buf);
}
--
1.6.4.16.g72c66.dirty
^ permalink raw reply related
* [PATCH v6 1/6] fast-import: put option parsing code in separate functions
From: Sverre Rabbelier @ 2009-09-02 17:56 UTC (permalink / raw)
To: Junio C Hamano, Shawn O. Pearce, Johannes Schindelin, Git List,
Ian Clatworthy <ian.cla
Cc: Sverre Rabbelier
In-Reply-To: <1251914223-31435-1-git-send-email-srabbelier@gmail.com>
Putting the options in their own functions increases readability of
the option parsing block and makes it easier to reuse the option
parsing code later on.
Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com>
---
No change since v5.
fast-import.c | 115 +++++++++++++++++++++++++++++++++++++--------------------
1 files changed, 75 insertions(+), 40 deletions(-)
diff --git a/fast-import.c b/fast-import.c
index 7ef9865..b904f20 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -291,6 +291,7 @@ static unsigned long branch_count;
static unsigned long branch_load_count;
static int failure;
static FILE *pack_edges;
+static unsigned int show_stats = 1;
/* Memory pools */
static size_t mem_pool_alloc = 2*1024*1024 - sizeof(struct mem_pool);
@@ -2337,7 +2338,7 @@ static void parse_progress(void)
skip_optional_lf();
}
-static void import_marks(const char *input_file)
+static void option_import_marks(const char *input_file)
{
char line[512];
FILE *f = fopen(input_file, "r");
@@ -2372,6 +2373,76 @@ static void import_marks(const char *input_file)
fclose(f);
}
+static void option_date_format(const char *fmt)
+{
+ if (!strcmp(fmt, "raw"))
+ whenspec = WHENSPEC_RAW;
+ else if (!strcmp(fmt, "rfc2822"))
+ whenspec = WHENSPEC_RFC2822;
+ else if (!strcmp(fmt, "now"))
+ whenspec = WHENSPEC_NOW;
+ else
+ die("unknown --date-format argument %s", fmt);
+}
+
+static void option_max_pack_size(const char *packsize)
+{
+ max_packsize = strtoumax(packsize, NULL, 0) * 1024 * 1024;
+}
+
+static void option_depth(const char *depth)
+{
+ max_depth = strtoul(depth, NULL, 0);
+ if (max_depth > MAX_DEPTH)
+ die("--depth cannot exceed %u", MAX_DEPTH);
+}
+
+static void option_active_branches(const char *branches)
+{
+ max_active_branches = strtoul(branches, NULL, 0);
+}
+
+static void option_export_marks(const char *marks)
+{
+ mark_file = xstrdup(marks);
+}
+
+static void option_export_pack_edges(const char *edges)
+{
+ if (pack_edges)
+ fclose(pack_edges);
+ pack_edges = fopen(edges, "a");
+ if (!pack_edges)
+ die_errno("Cannot open '%s'", edges);
+}
+
+static void parse_one_option(const char *option)
+{
+ if (!prefixcmp(option, "date-format=")) {
+ option_date_format(option + 12);
+ } else if (!prefixcmp(option, "max-pack-size=")) {
+ option_max_pack_size(option + 14);
+ } else if (!prefixcmp(option, "depth=")) {
+ option_depth(option + 6);
+ } else if (!prefixcmp(option, "active-branches=")) {
+ option_active_branches(option + 16);
+ } else if (!prefixcmp(option, "import-marks=")) {
+ option_import_marks(option + 13);
+ } else if (!prefixcmp(option, "export-marks=")) {
+ option_export_marks(option + 13);
+ } else if (!prefixcmp(option, "export-pack-edges=")) {
+ option_export_pack_edges(option + 18);
+ } else if (!prefixcmp(option, "force")) {
+ force_update = 1;
+ } else if (!prefixcmp(option, "quiet")) {
+ show_stats = 0;
+ } else if (!prefixcmp(option, "stats")) {
+ show_stats = 1;
+ } else {
+ die("Unsupported option: %s", option);
+ }
+}
+
static int git_pack_config(const char *k, const char *v, void *cb)
{
if (!strcmp(k, "pack.depth")) {
@@ -2398,7 +2469,7 @@ static const char fast_import_usage[] =
int main(int argc, const char **argv)
{
- unsigned int i, show_stats = 1;
+ unsigned int i;
git_extract_argv0_path(argv[0]);
@@ -2419,44 +2490,8 @@ int main(int argc, const char **argv)
if (*a != '-' || !strcmp(a, "--"))
break;
- else if (!prefixcmp(a, "--date-format=")) {
- const char *fmt = a + 14;
- if (!strcmp(fmt, "raw"))
- whenspec = WHENSPEC_RAW;
- else if (!strcmp(fmt, "rfc2822"))
- whenspec = WHENSPEC_RFC2822;
- else if (!strcmp(fmt, "now"))
- whenspec = WHENSPEC_NOW;
- else
- die("unknown --date-format argument %s", fmt);
- }
- else if (!prefixcmp(a, "--max-pack-size="))
- max_packsize = strtoumax(a + 16, NULL, 0) * 1024 * 1024;
- else if (!prefixcmp(a, "--depth=")) {
- max_depth = strtoul(a + 8, NULL, 0);
- if (max_depth > MAX_DEPTH)
- die("--depth cannot exceed %u", MAX_DEPTH);
- }
- else if (!prefixcmp(a, "--active-branches="))
- max_active_branches = strtoul(a + 18, NULL, 0);
- else if (!prefixcmp(a, "--import-marks="))
- import_marks(a + 15);
- else if (!prefixcmp(a, "--export-marks="))
- mark_file = a + 15;
- else if (!prefixcmp(a, "--export-pack-edges=")) {
- if (pack_edges)
- fclose(pack_edges);
- pack_edges = fopen(a + 20, "a");
- if (!pack_edges)
- die_errno("Cannot open '%s'", a + 20);
- } else if (!strcmp(a, "--force"))
- force_update = 1;
- else if (!strcmp(a, "--quiet"))
- show_stats = 0;
- else if (!strcmp(a, "--stats"))
- show_stats = 1;
- else
- die("unknown option %s", a);
+
+ parse_one_option(a + 2);
}
if (i != argc)
usage(fast_import_usage);
--
1.6.4.16.g72c66.dirty
^ permalink raw reply related
* [PATCH v6 0/6] fast-import: add new feature and mark command
From: Sverre Rabbelier @ 2009-09-02 17:56 UTC (permalink / raw)
To: Junio C Hamano, Shawn O. Pearce, Johannes Schindelin, Git List,
Ian Clatworthy <ian.cla
Incorperated comments and changed 'option foo' to 'option git foo'. I
think this is ready to be merged to next if there are no objections.
Sverre Rabbelier (6):
fast-import: put option parsing code in separate functions
fast-import: put marks reading in it's own function
fast-import: add feature command
fast-import: test the new feature command
fast-import: add option command
fast-import: test the new option command
Documentation/git-fast-import.txt | 40 ++++++
fast-import.c | 262 ++++++++++++++++++++++++++-----------
t/t9300-fast-import.sh | 102 ++++++++++++++
3 files changed, 327 insertions(+), 77 deletions(-)
^ permalink raw reply
* Re: [PATCH] clone: disconnect transport after fetching
From: Junio C Hamano @ 2009-09-02 17:55 UTC (permalink / raw)
To: Daniel Barkalow
Cc: Jeff King, Junio C Hamano, git, Sverre Rabbelier,
Björn Steinbrink, Matthieu Moy, Sitaram Chamarty
In-Reply-To: <alpine.LNX.2.00.0909021228570.28290@iabervon.org>
Daniel Barkalow <barkalow@iabervon.org> writes:
> On Wed, 2 Sep 2009, Jeff King wrote:
> ...
>> Signed-off-by: Jeff King <peff@peff.net>
>> ---
>> This was suggested by Daniel, so theoretically
>>
>> Acked-by: Daniel Barkalow <barkalow@iabervon.org>
>>
>> :)
>
> This is what I intended, so:
>
> Acked-by: Daniel Barkalow <barkalow@iabervon.org>
Thanks, both.
^ permalink raw reply
* [StGit PATCH] Import git show output easily
From: Catalin Marinas @ 2009-09-02 17:50 UTC (permalink / raw)
To: Karl Hasselström, git
This patch modifies the import command to check for standard 'git show'
output and parse it accordingly.
Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
---
stgit/commands/common.py | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/stgit/commands/common.py b/stgit/commands/common.py
index d38d263..0d39148 100644
--- a/stgit/commands/common.py
+++ b/stgit/commands/common.py
@@ -355,6 +355,7 @@ def __parse_description(descr):
lasthdr = 0
end = len(descr_lines)
+ descr_strip = 0
# Parse the patch header
for pos in range(0, end):
@@ -374,12 +375,16 @@ def __parse_description(descr):
if subject:
break
# get the subject
- subject = descr_lines[pos]
+ subject = descr_lines[pos][descr_strip:]
+ if re.match('commit [\da-f]{40}$', subject):
+ # 'git show' output, look for the real subject
+ subject = ''
+ descr_strip = 4
lasthdr = pos + 1
# get the body
if lasthdr < end:
- body = reduce(lambda x, y: x + '\n' + y, descr_lines[lasthdr:], '')
+ body = '\n' + '\n'.join(l[descr_strip:] for l in descr_lines[lasthdr:])
return (subject + body, authname, authemail, authdate)
^ permalink raw reply related
* Re: What's cooking in git.git (Aug 2009, #06; Sun, 30)
From: Jakub Narebski @ 2009-09-02 17:44 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vtyzmliai.fsf@alter.siamese.dyndns.org>
On Tue, 1 Sep 2009, Junio C Hamano wrote:
> Jakub Narebski <jnareb@gmail.com> writes:
>
> > There is replacement series sent to git mailing list a little while
> > ago.
>
> Thanks; I've replaced and pushed them out on 'pu' for now. Will hopefully
> start merging earlier parts to 'next', but how widely is Hires available?
Well, if someone wants to have _optional_ 'timed' feature, ha/she can
install Time::HiRes module. I think that it is not in Perl core, but
there are RPM and deb packages with Time::HiRes available in extras.
If module is not installed, then only 'timed' feature is not available.
P.S. "Naming is the hardest thing"; should this feature be named 'timed',
or do any of you have some better name for it?
P.P.S. Originally the part about "time to generate page" was for me to be
able to benchmark new code... but then I realized that benchmarking
'blame_incremental' view on single-core computer, where server process
and AJAX-y JavaScript competes for CPU doesn't a good benchmark make.
Still, this part can be useful.
--
Jakub Narebski
Poland
^ permalink raw reply
* diff-files inconsistency with touched files
From: James Spencer @ 2009-09-02 17:27 UTC (permalink / raw)
To: git
Hi,
I am puzzled by the following behaviour:
$ git --version
git version 1.6.4.2
$ git diff-files
$ touch test
$ git diff-files
:100644 100644 9daeafb9864cf43055ae93beb0afd6c7d144bfa4
0000000000000000000000000000000000000000 M test
$ git diff
$ git diff-files
$
I don't understand why git diff-files reports a file is changed when
that file is touched nor why running git diff changes this to (what I
think is) the correct behaviour.
Thanks in advance,
--James
^ permalink raw reply
* Re: [PATCH] clone: disconnect transport after fetching
From: Daniel Barkalow @ 2009-09-02 16:38 UTC (permalink / raw)
To: Jeff King
Cc: Junio C Hamano, git, Sverre Rabbelier, Björn Steinbrink,
Matthieu Moy, Sitaram Chamarty
In-Reply-To: <20090902063647.GA29559@coredump.intra.peff.net>
On Wed, 2 Sep 2009, Jeff King wrote:
> The current code just leaves the transport in whatever state
> it was in after performing the fetch. For a non-empty clone
> over the git protocol, the transport code already
> disconnects at the end of the fetch.
>
> But for an empty clone, we leave the connection hanging, and
> eventually close the socket when clone exits. This causes
> the remote upload-pack to complain "the remote end hung up
> unexpectedly". While this message is harmless to the clone
> itself, it is unnecessarily scary for a user to see and may
> pollute git-daemon logs.
>
> This patch just explicitly calls disconnect after we are
> done with the remote end, which sends a flush packet to
> upload-pack and cleanly disconnects, avoiding the error
> message.
>
> Other transports are unaffected or slightly improved:
>
> - for a non-empty repo over the git protocol, the second
> disconnect is a no-op (since we are no longer connected)
>
> - for "walker" transports (like HTTP or FTP), we actually
> free some used memory (which previously just sat until
> the clone process exits)
>
> - for "rsync", disconnect is always a no-op anyway
>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
> This was suggested by Daniel, so theoretically
>
> Acked-by: Daniel Barkalow <barkalow@iabervon.org>
>
> :)
This is what I intended, so:
Acked-by: Daniel Barkalow <barkalow@iabervon.org>
> As you can see from the commit message, I did a little extra hunting to
> make sure we are not going to impact any other code paths, and I am
> pretty sure we are fine.
Also, builtin-fetch already does the explicit disconnect, and commonly
exercises both the "we want something" and "we don't want anything" cases,
so any problems would have to be surprisingly clone-specific.
> builtin-clone.c | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/builtin-clone.c b/builtin-clone.c
> index 991a7ae..0f231d8 100644
> --- a/builtin-clone.c
> +++ b/builtin-clone.c
> @@ -580,8 +580,10 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
> option_no_checkout = 1;
> }
>
> - if (transport)
> + if (transport) {
> transport_unlock_pack(transport);
> + transport_disconnect(transport);
> + }
>
> if (!option_no_checkout) {
> struct lock_file *lock_file = xcalloc(1, sizeof(struct lock_file));
> --
> 1.6.4.2.401.ga275f.dirty
>
^ permalink raw reply
* [ANNOUNCE] GitTogether '09 (Developer/User Summit Oct 26-28)
From: Shawn O. Pearce @ 2009-09-02 15:23 UTC (permalink / raw)
To: git; +Cc: gittogether
Google is hosting GitTogether '09, October 26th through 28th, at
its Mountain View, CA headquarters. I had posted before that were
planning for these dates; now it is certain.
Like last year, this GitTogether immediately follows the Google
Summer of Code mentor summit, so some of our end-user groups may
already have representatives in the area and might like to attend.
We've timed the GitTogether to follow the summit so we can get some
users to attend while they are still in the area.
Git contributors and users alike are welcome to attend. Admission is
free, as everything is being donated by Google, but you will need
to arrange for your own travel and lodging. If you are looking
at flights try the SJC and SFO airports. SFO usually has cheaper
flights as its a bigger, more active airport.
We are looking to solicit proposals for talks, round-table
discussions, centers of focus for patch hack-a-thons, etc.
A Git Wiki page is being used for planning:
http://git.or.cz/gitwiki/GitTogether09
and of course, so is this email thread.
If you would like to attend, please add your name to the Attendees
list on the wiki page, even if you had previously responded to the
survey that was posted a while ago.
--
Shawn.
^ permalink raw reply
* [PATCH] git-pull: fix fetch-options.txt to not document --quiet and --verbose twice in git-pull.txt
From: Emmanuel Trillaud @ 2009-09-02 14:38 UTC (permalink / raw)
To: git
Hello all!
the current man page of git-pull documents twice the --quiet and
--verbose options. fetch-options.txt and merge-options.txt which both
documents these options.
I choose to "ifndef" the paragraphs in fetch-options.txt because IMHO
they give too much details on the --quiet option (see the patch
below). Of course we could modify merge-options.txt instead (the
--quiet paragraph just says : "operate quietly"), I can provide a
patch if you want.
Best regards
-----------------
git-pull.txt includes fetch-options.txt and merge-options.txt which both
document the --quiet and --verbose parameters. So we supress the
--quiet and --verbose paragraphs if fetch-options.txt is included by
git-pull.txt.
Signed-off-by: Emmanuel Trillaud <etrillaud@gmail.com>
---
Documentation/fetch-options.txt | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/Documentation/fetch-options.txt b/Documentation/fetch-options.txt
index ea3b1bc..5eb2b0e 100644
--- a/Documentation/fetch-options.txt
+++ b/Documentation/fetch-options.txt
@@ -1,3 +1,4 @@
+ifndef::git-pull[]
-q::
--quiet::
Pass --quiet to git-fetch-pack and silence any other internally
@@ -6,6 +7,7 @@
-v::
--verbose::
Be verbose.
+endif::git-pull[]
-a::
--append::
--
1.6.4.2.253.g0b1fac
^ permalink raw reply related
* Re: [PATCH v2] status: list unmerged files last
From: Mark Brown @ 2009-09-02 12:48 UTC (permalink / raw)
To: Jeff King; +Cc: Junio C Hamano, Johannes Sixt, bill lam, git
In-Reply-To: <20090902051248.GB12046@coredump.intra.peff.net>
On Wed, Sep 02, 2009 at 01:12:48AM -0400, Jeff King wrote:
> On Tue, Sep 01, 2009 at 09:26:26PM -0700, Junio C Hamano wrote:
> > [1] It might even make sense to omit other sections and show only
> > "updated" and "unmerged" in this order when the index is unmerged, but
> > that is a lot more drastic change for 1.7.0.
> I think that is a really bad idea. The mental model of "git status"
> (versus individual diff or ls-files commands) is to see _everything_
> going on in the repo. Showing a subset breaks that model and gives a
> false sense of what is actually happening.
It would be nice to be able to explicitly ask to suppress some of the
output for cases where there's a lot of it and only a small part is
interesting (like when resolving a large merge as mentioned earlier) - I
often end up doing this by hand in those situations. I do agree that
doing this by default would be surprising.
^ permalink raw reply
* Re: [PATCH] git-submodule and --upload-pack
From: Giulio Eulisse @ 2009-09-02 12:41 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vk50jtud8.fsf@alter.siamese.dyndns.org>
>> There was a thread a while ago aboyt having --upload-pack support for
>> git-submodule.
>>
>> Given that there was no followup (as far as I can tell) and I needed
>> pretty much
>> the same functionality I ported Jason's patch to work on top of
>> 1.6.4.2.
>
> Thanks.
>
> Can you point at the original patch with a usable commit log
> message, in
> the gmane archive (i.e. http://thread.gmane.org/...) if possible? I
> do not think we have that patch queued anywhere even in 'pu'.
Ciao,
sorry for the mangled patch... Looks like Mail.app did something
weird...
http://article.gmane.org/gmane.comp.version-control.git/104188/match=git+submodule+upload+pack
> Given that it looks like a new feature, I do not think it would be
> appropriate for any of the future 1.6.4.X series, but if it is
> useful we
> may want to have it in the upcoming 1.6.5 release.
[...]
Ok. I will try to follow your suggestion and post an updated patch.
Ciao,
Giulio
^ permalink raw reply
* Re: [PATCH] git-completion.bash: prevent 'git help' from searching for git repository
From: Sverre Rabbelier @ 2009-09-02 11:47 UTC (permalink / raw)
To: Gerrit Pape; +Cc: Junio C Hamano, git
In-Reply-To: <20090902095843.28914.qmail@3cd9dde586d86b.315fe32.mid.smarden.org>
Heya,
On Wed, Sep 2, 2009 at 11:58, Gerrit Pape<pape@smarden.org> wrote:
> + for i in $(git --git-dir=/nonexistent help -a|egrep '^ ')
Wouldn't implementing "git --no-git-dir" be more appropriate?
--
Cheers,
Sverre Rabbelier
^ permalink raw reply
* Re: [PATCH v2] status: list unmerged files last
From: David Aguilar @ 2009-09-02 10:07 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Jeff King, Johannes Sixt, bill lam, git
In-Reply-To: <7vljkxdiil.fsf@alter.siamese.dyndns.org>
On Tue, Sep 01, 2009 at 10:26:26PM -0700, Junio C Hamano wrote:
>
> Here is how I would justify the change (the patch is the same as Hannes's
> first version.
>
> From: Johannes Sixt <j6t@kdbg.org>
> Date: Tue, 1 Sep 2009 22:13:53 +0200
> Subject: [PATCH] status: list unmerged files much later
>
> When resolving a conflicted merge, two lists in the status output need
> more attention from the user than other parts.
>
> - the list of updated paths is useful to review the amount of changes the
> merge brings in (the user cannot do much about them other than
> reviewing, though); and
>
> - the list of unmerged paths needs the most attention from the user; the
> user needs to resolve them in order to proceed.
>
> Since the output of git status does not by default go through the pager,
> the early parts of the output can scroll away at the top. It is better to
> put the more important information near the bottom. During a merge, local
> changes that are not in the index are minimum, and you should keep the
> untracked list small in any case, so moving the unmerged list from the top
> of the output to immediately after the list of updated paths would give us
> the optimum layout..
I agree with all of this but would also add that we can have
our cake and eat it too with respect to wanting to "keep
similar things together" and having "unmerged near bottom".
No one has suggested this, so I figured I would.
What do you think about this layout?
- untracked
- staged
- modified
- unmerged
This isn't the first thing someone would think of, but here's
why it is intuitive:
- untracked entries come first because in the git world they
are weird. We don't like to see these things and we tend to
.gitignore them away.
- staged entries come next, though we know that in practice
staged is often shown first since we tend to not care about
untracked files. This often contains entries when merging
but we do not often do much with these besides review them.
- modified entries come next because they need our attention.
When merging this list is often small or non-existant,
thus unmerged often follows immediately after staged.
- unmerged comes last for all of the reasons listed above.
We give these special treatment because they often
require even more attention than modified files.
What do you guys think?
While I've got you guys.. I have a patch for the new 1.7
status that makes it:
git status [<tree-ish>] [--] [pathspec]
(it adds support for tree-ish)
I added that because I thought that the porcelain-ish short
status output could be useful for "what does commit --amend
do" from a script-writers' pov, and thus adding <tree-ish>
enables git status -s HEAD^.
Is this a good idea? I'll send the patch if others are
interested. It seemed useful to me; my rationale was that
right now git-status is hardcoded to HEAD and thus exposing
that variable seemed useful.
BTW is status -s intended to be something plumbing-like;
something we can build upon and expect to be stable?
I'm just curious because other commands have a --porcelain
option and I wasn't sure if this was the intent.
Thanks,
--
David
^ permalink raw reply
* [PATCH] git-completion.bash: prevent 'git help' from searching for git repository
From: Gerrit Pape @ 2009-09-02 9:58 UTC (permalink / raw)
To: Junio C Hamano, git
On 'git <TAB><TAB>' the bash completion runs 'git help -a'. Since
'git help' actually doesn't need to be run inside a git repository,
this commit uses the option --git-dir=/nonexistent to prevent it
from searching a git directory. Unnecessary searching for a git
directory can be annoying in auto-mount environments.
The annoying behavior and suggested fix has been reported by Vincent
Danjean through
http://bugs.debian.org/539273
Signed-off-by: Gerrit Pape <pape@smarden.org>
---
contrib/completion/git-completion.bash | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index bf688e1..d51854a 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -500,7 +500,7 @@ __git_all_commands ()
return
fi
local i IFS=" "$'\n'
- for i in $(git help -a|egrep '^ ')
+ for i in $(git --git-dir=/nonexistent help -a|egrep '^ ')
do
case $i in
*--*) : helper pattern;;
--
1.6.0.3
^ permalink raw reply related
* [PATCH] git-cvsserver: no longer use deprecated 'git-subcommand' commands
From: Gerrit Pape @ 2009-09-02 9:23 UTC (permalink / raw)
To: Junio C Hamano, git
git-cvsserver still references git commands like 'git-config', which
is depcrecated. This commit changes git-cvsserver to use the
'git subcommand' form.
Sylvain Beucler reported the problem through
http://bugs.debian.org/536067
Signed-off-by: Gerrit Pape <pape@smarden.org>
---
git-cvsserver.perl | 40 ++++++++++++++++++++--------------------
1 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index ab6cea3..6dc45f5 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -285,7 +285,7 @@ sub req_Root
return 0;
}
- my @gitvars = `git-config -l`;
+ my @gitvars = `git config -l`;
if ($?) {
print "E problems executing git-config on the server -- this is not a git repository or the PATH is not set correctly.\n";
print "E \n";
@@ -702,7 +702,7 @@ sub req_Modified
# Save the file data in $state
$state->{entries}{$state->{directory}.$data}{modified_filename} = $filename;
$state->{entries}{$state->{directory}.$data}{modified_mode} = $mode;
- $state->{entries}{$state->{directory}.$data}{modified_hash} = `git-hash-object $filename`;
+ $state->{entries}{$state->{directory}.$data}{modified_hash} = `git hash-object $filename`;
$state->{entries}{$state->{directory}.$data}{modified_hash} =~ s/\s.*$//s;
#$log->debug("req_Modified : file=$data mode=$mode size=$size");
@@ -1289,7 +1289,7 @@ sub req_ci
# do a checkout of the file if it is part of this tree
if ($wrev) {
- system('git-checkout-index', '-f', '-u', $filename);
+ system('git', 'checkout-index', '-f', '-u', $filename);
unless ($? == 0) {
die "Error running git-checkout-index -f -u $filename : $!";
}
@@ -1331,15 +1331,15 @@ sub req_ci
{
$log->info("Removing file '$filename'");
unlink($filename);
- system("git-update-index", "--remove", $filename);
+ system("git", "update-index", "--remove", $filename);
}
elsif ( $addflag )
{
$log->info("Adding file '$filename'");
- system("git-update-index", "--add", $filename);
+ system("git", "update-index", "--add", $filename);
} else {
$log->info("Updating file '$filename'");
- system("git-update-index", $filename);
+ system("git", "update-index", $filename);
}
}
@@ -1351,7 +1351,7 @@ sub req_ci
return;
}
- my $treehash = `git-write-tree`;
+ my $treehash = `git write-tree`;
chomp $treehash;
$log->debug("Treehash : $treehash, Parenthash : $parenthash");
@@ -1368,7 +1368,7 @@ sub req_ci
}
close $msg_fh;
- my $commithash = `git-commit-tree $treehash -p $parenthash < $msg_filename`;
+ my $commithash = `git commit-tree $treehash -p $parenthash < $msg_filename`;
chomp($commithash);
$log->info("Commit hash : $commithash");
@@ -1821,7 +1821,7 @@ sub req_annotate
# TODO: if we got a revision from the client, use that instead
# to look up the commithash in sqlite (still good to default to
# the current head as we do now)
- system("git-read-tree", $lastseenin);
+ system("git", "read-tree", $lastseenin);
unless ($? == 0)
{
print "E error running git-read-tree $lastseenin $ENV{GIT_INDEX_FILE} $!\n";
@@ -1830,7 +1830,7 @@ sub req_annotate
$log->info("Created index '$ENV{GIT_INDEX_FILE}' with commit $lastseenin - exit status $?");
# do a checkout of the file
- system('git-checkout-index', '-f', '-u', $filename);
+ system('git', 'checkout-index', '-f', '-u', $filename);
unless ($? == 0) {
print "E error running git-checkout-index -f -u $filename : $!\n";
return;
@@ -1861,7 +1861,7 @@ sub req_annotate
close ANNOTATEHINTS
or (print "E failed to write $a_hints: $!\n"), return;
- my @cmd = (qw(git-annotate -l -S), $a_hints, $filename);
+ my @cmd = (qw(git annotate -l -S), $a_hints, $filename);
if (!open(ANNOTATE, "-|", @cmd)) {
print "E error invoking ". join(' ',@cmd) .": $!\n";
return;
@@ -2078,17 +2078,17 @@ sub transmitfile
die "Need filehash" unless ( defined ( $filehash ) and $filehash =~ /^[a-zA-Z0-9]{40}$/ );
- my $type = `git-cat-file -t $filehash`;
+ my $type = `git cat-file -t $filehash`;
chomp $type;
die ( "Invalid type '$type' (expected 'blob')" ) unless ( defined ( $type ) and $type eq "blob" );
- my $size = `git-cat-file -s $filehash`;
+ my $size = `git cat-file -s $filehash`;
chomp $size;
$log->debug("transmitfile($filehash) size=$size, type=$type");
- if ( open my $fh, '-|', "git-cat-file", "blob", $filehash )
+ if ( open my $fh, '-|', "git", "cat-file", "blob", $filehash )
{
if ( defined ( $options->{targetfile} ) )
{
@@ -2935,7 +2935,7 @@ sub update
push @git_log_params, $self->{module};
}
# git-rev-list is the backend / plumbing version of git-log
- open(GITLOG, '-|', 'git-rev-list', @git_log_params) or die "Cannot call git-rev-list: $!";
+ open(GITLOG, '-|', 'git', 'rev-list', @git_log_params) or die "Cannot call git-rev-list: $!";
my @commits;
@@ -3021,7 +3021,7 @@ sub update
next;
}
my $base = eval {
- safe_pipe_capture('git-merge-base',
+ safe_pipe_capture('git', 'merge-base',
$lastpicked, $parent);
};
# The two branches may not be related at all,
@@ -3033,7 +3033,7 @@ sub update
if ($base) {
my @merged;
# print "want to log between $base $parent \n";
- open(GITLOG, '-|', 'git-log', '--pretty=medium', "$base..$parent")
+ open(GITLOG, '-|', 'git', 'log', '--pretty=medium', "$base..$parent")
or die "Cannot call git-log: $!";
my $mergedhash;
while (<GITLOG>) {
@@ -3075,7 +3075,7 @@ sub update
if ( defined ( $lastpicked ) )
{
- my $filepipe = open(FILELIST, '-|', 'git-diff-tree', '-z', '-r', $lastpicked, $commit->{hash}) or die("Cannot call git-diff-tree : $!");
+ my $filepipe = open(FILELIST, '-|', 'git', 'diff-tree', '-z', '-r', $lastpicked, $commit->{hash}) or die("Cannot call git-diff-tree : $!");
local ($/) = "\0";
while ( <FILELIST> )
{
@@ -3149,7 +3149,7 @@ sub update
# this is used to detect files removed from the repo
my $seen_files = {};
- my $filepipe = open(FILELIST, '-|', 'git-ls-tree', '-z', '-r', $commit->{hash}) or die("Cannot call git-ls-tree : $!");
+ my $filepipe = open(FILELIST, '-|', 'git', 'ls-tree', '-z', '-r', $commit->{hash}) or die("Cannot call git-ls-tree : $!");
local $/ = "\0";
while ( <FILELIST> )
{
@@ -3451,7 +3451,7 @@ sub commitmessage
return $message;
}
- my @lines = safe_pipe_capture("git-cat-file", "commit", $commithash);
+ my @lines = safe_pipe_capture("git", "cat-file", "commit", $commithash);
shift @lines while ( $lines[0] =~ /\S/ );
$message = join("",@lines);
$message .= " " if ( $message =~ /\n$/ );
--
1.6.0.3
^ permalink raw reply related
* Better wang parameters!
From: Raphael Vickers @ 2009-09-02 10:17 UTC (permalink / raw)
To: git
Better than bluepilule if you can imagine that. http://zh.ghexduvitie.com/
^ permalink raw reply
* Re: unmerged files listed in the beginning of git-status
From: bill lam @ 2009-09-02 9:04 UTC (permalink / raw)
To: Johannes Sixt; +Cc: Junio C Hamano, bill lam, git
In-Reply-To: <200909012140.08953.j6t@kdbg.org>
On Tue, 01 Sep 2009, Johannes Sixt wrote:
> > But unmerged entries are something you need to deal with _first_ before
> > being able to go further, so in that sense it is more important than
> > anything else in the traditional output.
>
> This is actually an argument to place the unmerged entries *last* because this
> is what will be visible after 'git status' finished. Remember that we don't
> pass its output through the pager.
If output of git-status is read indirectly such as by gui client, then
it usually shows the top portion, in such cases, it might be desirable
to put unmerged file (the most important port) immediately visible.
But I don't have that experience.
--
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
^ permalink raw reply
* Re: [PATCH] git.el: Make it easy to add unmerged files
From: Alexandre Julliard @ 2009-09-02 8:48 UTC (permalink / raw)
To: Martin Nordholts; +Cc: git, Junio C Hamano
In-Reply-To: <4A9E0717.9040801@chromecode.com>
Martin Nordholts <martin@chromecode.com> writes:
> On 08/30/2009 05:58 PM, Alexandre Julliard wrote:
>> Martin Nordholts <martin@chromecode.com> writes:
>>
>>> (Resending as I managed to mangle the previous patch despite trying not to...)
>>>
>>> It is nice and easy to git-add ignored and unknown files in a
>>> git-status buffer. Make it equally easy to add unmerged files which is
>>> a common use case.
>>
>> That's not quite what adding a file means in git.el, unmerged files are
>> considered added already, and marking them resolved is done through the
>> git-resolve-file command. Of course that was implemented before git
>> overloaded the meaning of git-add to mean git-update-index, so maybe we
>> should follow the trend and use git-add-file for all index updates. In
>> that case git-resolve-file should probably be removed.
>
> Since git instructs the user to use git-add for marking unmerged files
> as resolved ("After resolving the conflicts, mark the corrected paths
> with 'git add <paths>' or 'git rm <paths>' and commit the result.") and
> doesn't even mention git-update-index, I think we should change git.el
> accordingly.
>
> But why do we need to also remove and disable git-resolve-file from
> git.el? It doesn't hurt to keep that function and the keybinding, does
> it?
It doesn't hurt much, but having two keybindings for the same thing is a
bit wasteful since there aren't that many simple bindings available. If
we remove it, it opens the door to later reusing the 'R' key for
something else (a git-rename function would be the obvious choice).
--
Alexandre Julliard
julliard@winehq.org
^ permalink raw reply
* Re: `Git Status`-like output for two local branches
From: Sverre Rabbelier @ 2009-09-02 8:18 UTC (permalink / raw)
To: Jeff King; +Cc: Tim Visher, Git Mailing List
In-Reply-To: <20090902075713.GA1832@coredump.intra.peff.net>
Heya,
On Wed, Sep 2, 2009 at 09:57, Jeff King<peff@peff.net> wrote:
> 2. Count the commits on each side that are not in the other.
[...]
> You can also do that by parsing the output of:
> git rev-list --left-right $a...$b --
Perhaps it is useful to introduce a --left-right-count or such?
--
Cheers,
Sverre Rabbelier
^ permalink raw reply
* Re: [BUG] 'add -u' doesn't work from untracked subdir
From: Jeff King @ 2009-09-02 8:19 UTC (permalink / raw)
To: SZEDER Gábor; +Cc: git
In-Reply-To: <20090902080305.GA11549@neumann>
On Wed, Sep 02, 2009 at 10:03:05AM +0200, SZEDER Gábor wrote:
> As the subject says, 'git add -u' does not work from an untracked
> subdir, because it doesn't add modified files to the index. The
> following script reproduces the issue:
>
> mkdir repo
> cd repo
> git init
> echo 1 >foo
> git add foo
> git commit -m first
> echo 2 >foo
> mkdir untracked_subdir
> cd untracked_subdir
> git add -u
> git diff
>
> It worked in the initial 'git add -u' implementation (dfdac5d, git-add
> -u: match the index with working tree, 2007-04-20), but 2ed2c222
> (git-add -u paths... now works from subdirectory, 2007-08-16) broke it
> later, and is broken ever since.
It is not just untracked subdirs. Try:
mkdir repo && cd repo && git init
echo 1 >foo
mkdir subdir
echo 1 >subdir/bar
git add . && git commit -m first
echo 2 >foo
echo 2 >subdir/bar
cd subdir
git add -u
git diff ;# still shows foo/1 in index
git diff --cached ;# shows subdir/bar was updated
While I have sometimes found the behavior a bit annoying[1], I always
assumed that was the intended behavior.
And indeed, in modern builtin-add.c, we find this:
if ((addremove || take_worktree_changes) && !argc) {
static const char *here[2] = { ".", NULL };
argc = 1;
argv = here;
}
which seems pretty explicit.
-Peff
[1] I would prefer "git add -u ." to add only the current directory, and
"git add -u" to touch everything. But then, I am one of the people who
turn off status.relativepaths, so I think I may be in the minority in
always wanting to think of the project as a whole.
^ 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