* [PATCH v4 00/15] complete reroll of my "port rebase -i to C" series
From: Christian Couder @ 2009-08-28 4:47 UTC (permalink / raw)
To: Junio C Hamano
Cc: git, Johannes Schindelin, Stephan Beyer, Daniel Barkalow,
Jakub Narebski
So unlike previous series, this is a complete reroll of all my previous
patches to port rebase -i to C using code from the sequencer project.
The main changes are in the commit messages that I tried to improve
according to Junio's feedback. But some patches were also squashed
together and there are a few minor changes too:
- comments have been added before the pick_commit() function (patch
11/15: revert: libify cherry-pick and revert functionnality),
- and a line in the usage message as been removed from patch 13/15
(sequencer: add "do_commit()" and related functions) because it should
be added by the next patch instead.
Christian Couder (9):
sequencer: add "builtin-sequencer--helper.c"
rebase -i: use "git sequencer--helper --make-patch"
sequencer: add "--reset-hard" option to "git sequencer--helper"
rebase -i: use "git sequencer--helper --reset-hard"
sequencer: add "--fast-forward" option to "git sequencer--helper"
sequencer: let "git sequencer--helper" callers set "allow_dirty"
rebase -i: use "git sequencer--helper --fast-forward"
pick: libify "pick_help_msg()"
rebase -i: use "git sequencer--helper --cherry-pick"
Stephan Beyer (6):
sequencer: add "make_patch" function to save a patch
sequencer: add "reset_almost_hard()" and related functions
sequencer: add "do_fast_forward()" to perform a fast forward
revert: libify cherry-pick and revert functionnality
sequencer: add "do_commit()" and related functions working on
"next_commit"
sequencer: add "--cherry-pick" option to "git sequencer--helper"
.gitignore | 1 +
Makefile | 3 +
builtin-revert.c | 293 ++++--------------------
builtin-sequencer--helper.c | 543 +++++++++++++++++++++++++++++++++++++++++++
builtin.h | 1 +
git-rebase--interactive.sh | 42 ++--
git.c | 1 +
pick.c | 240 +++++++++++++++++++
pick.h | 14 ++
9 files changed, 865 insertions(+), 273 deletions(-)
create mode 100644 builtin-sequencer--helper.c
create mode 100644 pick.c
create mode 100644 pick.h
^ permalink raw reply
* [PATCH v4 04/15] sequencer: add "reset_almost_hard()" and related functions
From: Christian Couder @ 2009-08-28 4:47 UTC (permalink / raw)
To: Junio C Hamano
Cc: git, Johannes Schindelin, Stephan Beyer, Daniel Barkalow,
Jakub Narebski
In-Reply-To: <20090828043913.4307.34708.chriscool@tuxfamily.org>
From: Stephan Beyer <s-beyer@gmx.net>
This patch adds the "reset_almost_hard()" function, some related
static variables and the related following functions:
- parse_and_init_tree_desc()
- reset_index_file()
- set_verbosity()
"reset_almost_hard()" can be used to do a "git reset --hard". It
should be faster as it calls "unpack_trees()" directly, and it can
optionnaly preserve changes in the work tree if the "allow_dirty"
global is set. Preserving changes in the work tree can be usefull
if for example you want to get rid of the last commit but keep
your current not yet commited work.
In this patch the "allow_dirty" global is not used but a following
patch will make it possible to set it, and in the end the code
should be simpler with a global.
The code comes as is from the sequencer GSoC project:
git://repo.or.cz/git/sbeyer.git
(at commit 5a78908b70ceb5a4ea9fd4b82f07ceba1f019079)
Mentored-by: Daniel Barkalow <barkalow@iabervon.org>
Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
builtin-sequencer--helper.c | 107 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 107 insertions(+), 0 deletions(-)
diff --git a/builtin-sequencer--helper.c b/builtin-sequencer--helper.c
index 1dda525..a15139c 100644
--- a/builtin-sequencer--helper.c
+++ b/builtin-sequencer--helper.c
@@ -2,16 +2,108 @@
#include "cache.h"
#include "parse-options.h"
#include "run-command.h"
+#include "refs.h"
+#include "diff.h"
+#include "unpack-trees.h"
#define SEQ_DIR "rebase-merge"
#define PATCH_FILE git_path(SEQ_DIR "/patch")
+static char *reflog;
+
+static int allow_dirty = 0, verbosity = 1, advice = 1;
+
+static unsigned char head_sha1[20];
+
static const char * const git_sequencer_helper_usage[] = {
"git sequencer--helper --make-patch <commit>",
NULL
};
+static int parse_and_init_tree_desc(const unsigned char *sha1,
+ struct tree_desc *desc)
+{
+ struct tree *tree = parse_tree_indirect(sha1);
+ if (!tree)
+ return 1;
+ init_tree_desc(desc, tree->buffer, tree->size);
+ return 0;
+}
+
+static int reset_index_file(const unsigned char *sha1, int update, int dirty)
+{
+ int nr = 1;
+ int newfd;
+ struct tree_desc desc[2];
+ struct unpack_trees_options opts;
+ struct lock_file *lock = xcalloc(1, sizeof(struct lock_file));
+
+ memset(&opts, 0, sizeof(opts));
+ opts.head_idx = 1;
+ opts.src_index = &the_index;
+ opts.dst_index = &the_index;
+ opts.reset = 1; /* ignore unmerged entries and overwrite wt files */
+ opts.merge = 1;
+ opts.fn = oneway_merge;
+ if (verbosity > 2)
+ opts.verbose_update = 1;
+ if (update) /* update working tree */
+ opts.update = 1;
+
+ newfd = hold_locked_index(lock, 1);
+
+ read_cache_unmerged();
+
+ if (dirty) {
+ if (get_sha1("HEAD", head_sha1))
+ return error("You do not have a valid HEAD.");
+ if (parse_and_init_tree_desc(head_sha1, desc))
+ return error("Failed to find tree of HEAD.");
+ nr++;
+ opts.fn = twoway_merge;
+ }
+
+ if (parse_and_init_tree_desc(sha1, desc + nr - 1))
+ return error("Failed to find tree of %s.", sha1_to_hex(sha1));
+ if (unpack_trees(nr, desc, &opts))
+ return -1;
+ if (write_cache(newfd, active_cache, active_nr) ||
+ commit_locked_index(lock))
+ return error("Could not write new index file.");
+
+ return 0;
+}
+
+/*
+ * Realize reset --hard behavior.
+ * If allow_dirty is set and there is a dirty work tree,
+ * then the changes in the work tree are to be kept.
+ *
+ * This should be faster than calling "git reset --hard" because
+ * this calls "unpack_trees()" directly (instead of forking and
+ * execing "git read-tree").
+ *
+ * Unmerged entries in the index will be discarded.
+ *
+ * If allow_dirty is set and fast forwarding the work tree
+ * fails because it is dirty, then the work tree will not be
+ * updated.
+ *
+ * No need to read or discard the index before calling this
+ * function.
+ */
+static int reset_almost_hard(const unsigned char *sha)
+{
+ int err = allow_dirty ?
+ (reset_index_file(sha, 1, 1) || reset_index_file(sha, 0, 0)) :
+ reset_index_file(sha, 1, 0);
+ if (err)
+ return error("Could not reset index.");
+
+ return update_ref(reflog, "HEAD", sha, NULL, 0, MSG_ON_ERR);
+}
+
/* Generate purely informational patch file */
static void make_patch(struct commit *commit)
{
@@ -78,6 +170,21 @@ static struct commit *get_commit(const char *arg)
return lookup_commit_reference(sha1);
}
+static int set_verbosity(int verbose)
+{
+ char tmp[] = "0";
+ verbosity = verbose;
+ if (verbosity <= 0) {
+ verbosity = 0;
+ advice = 0;
+ } else if (verbosity > 5)
+ verbosity = 5;
+ /* Git does not run on EBCDIC, so we rely on ASCII: */
+ tmp[0] += verbosity;
+ setenv("GIT_MERGE_VERBOSITY", tmp, 1);
+ return 0;
+}
+
int cmd_sequencer__helper(int argc, const char **argv, const char *prefix)
{
char *commit = NULL;
--
1.6.4.271.ge010d
^ permalink raw reply related
* [PATCH v4 01/15] sequencer: add "builtin-sequencer--helper.c"
From: Christian Couder @ 2009-08-28 4:47 UTC (permalink / raw)
To: Junio C Hamano
Cc: git, Johannes Schindelin, Stephan Beyer, Daniel Barkalow,
Jakub Narebski
In-Reply-To: <20090828043913.4307.34708.chriscool@tuxfamily.org>
This a helper builtin that will be used to port some parts of
"git-rebase--interactive.sh" to C.
It currently does nothing except checking arguments it is passed.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
.gitignore | 1 +
Makefile | 1 +
builtin-sequencer--helper.c | 27 +++++++++++++++++++++++++++
builtin.h | 1 +
git.c | 1 +
5 files changed, 31 insertions(+), 0 deletions(-)
create mode 100644 builtin-sequencer--helper.c
diff --git a/.gitignore b/.gitignore
index c446290..adbe7cc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -119,6 +119,7 @@ git-revert
git-rm
git-send-email
git-send-pack
+git-sequencer--helper
git-sh-setup
git-shell
git-shortlog
diff --git a/Makefile b/Makefile
index 4190a5d..4aab6bc 100644
--- a/Makefile
+++ b/Makefile
@@ -628,6 +628,7 @@ BUILTIN_OBJS += builtin-rev-parse.o
BUILTIN_OBJS += builtin-revert.o
BUILTIN_OBJS += builtin-rm.o
BUILTIN_OBJS += builtin-send-pack.o
+BUILTIN_OBJS += builtin-sequencer--helper.o
BUILTIN_OBJS += builtin-shortlog.o
BUILTIN_OBJS += builtin-show-branch.o
BUILTIN_OBJS += builtin-show-ref.o
diff --git a/builtin-sequencer--helper.c b/builtin-sequencer--helper.c
new file mode 100644
index 0000000..721c0d8
--- /dev/null
+++ b/builtin-sequencer--helper.c
@@ -0,0 +1,27 @@
+#include "builtin.h"
+#include "cache.h"
+#include "parse-options.h"
+
+static const char * const git_sequencer_helper_usage[] = {
+ "git sequencer--helper --make-patch <commit>",
+ NULL
+};
+
+int cmd_sequencer__helper(int argc, const char **argv, const char *prefix)
+{
+ char *commit = NULL;
+ struct option options[] = {
+ OPT_STRING(0, "make-patch", &commit, "commit",
+ "create a patch from commit"),
+ OPT_END()
+ };
+
+ argc = parse_options(argc, argv, prefix, options,
+ git_sequencer_helper_usage, 0);
+
+ if (!commit)
+ usage_with_options(git_sequencer_helper_usage, options);
+
+ /* Nothing to do yet */
+ return 0;
+}
diff --git a/builtin.h b/builtin.h
index 51e4ba7..0a60e81 100644
--- a/builtin.h
+++ b/builtin.h
@@ -91,6 +91,7 @@ extern int cmd_rev_parse(int argc, const char **argv, const char *prefix);
extern int cmd_revert(int argc, const char **argv, const char *prefix);
extern int cmd_rm(int argc, const char **argv, const char *prefix);
extern int cmd_send_pack(int argc, const char **argv, const char *prefix);
+extern int cmd_sequencer__helper(int argc, const char **argv, const char *prefix);
extern int cmd_shortlog(int argc, const char **argv, const char *prefix);
extern int cmd_show(int argc, const char **argv, const char *prefix);
extern int cmd_show_branch(int argc, const char **argv, const char *prefix);
diff --git a/git.c b/git.c
index 0021a29..d510758 100644
--- a/git.c
+++ b/git.c
@@ -345,6 +345,7 @@ static void handle_internal_command(int argc, const char **argv)
{ "revert", cmd_revert, RUN_SETUP | NEED_WORK_TREE },
{ "rm", cmd_rm, RUN_SETUP },
{ "send-pack", cmd_send_pack, RUN_SETUP },
+ { "sequencer--helper", cmd_sequencer__helper, RUN_SETUP | NEED_WORK_TREE },
{ "shortlog", cmd_shortlog, USE_PAGER },
{ "show-branch", cmd_show_branch, RUN_SETUP },
{ "show", cmd_show, RUN_SETUP | USE_PAGER },
--
1.6.4.271.ge010d
^ permalink raw reply related
* [PATCH v4 02/15] sequencer: add "make_patch" function to save a patch
From: Christian Couder @ 2009-08-28 4:47 UTC (permalink / raw)
To: Junio C Hamano
Cc: git, Johannes Schindelin, Stephan Beyer, Daniel Barkalow,
Jakub Narebski
In-Reply-To: <20090828043913.4307.34708.chriscool@tuxfamily.org>
From: Stephan Beyer <s-beyer@gmx.net>
This function generates an informational patch file. The file name
is fixed to "$SEQ_DIR/patch".
The "make_patch" and the "get_commit" functions are copied from the
GSoC sequencer project:
git://repo.or.cz/git/sbeyer.git
(at commit 5a78908b70ceb5a4ea9fd4b82f07ceba1f019079)
Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Mentored-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
builtin-sequencer--helper.c | 79 ++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 78 insertions(+), 1 deletions(-)
diff --git a/builtin-sequencer--helper.c b/builtin-sequencer--helper.c
index 721c0d8..1dda525 100644
--- a/builtin-sequencer--helper.c
+++ b/builtin-sequencer--helper.c
@@ -1,15 +1,87 @@
#include "builtin.h"
#include "cache.h"
#include "parse-options.h"
+#include "run-command.h"
+
+#define SEQ_DIR "rebase-merge"
+
+#define PATCH_FILE git_path(SEQ_DIR "/patch")
static const char * const git_sequencer_helper_usage[] = {
"git sequencer--helper --make-patch <commit>",
NULL
};
+/* Generate purely informational patch file */
+static void make_patch(struct commit *commit)
+{
+ struct commit_list *parents = commit->parents;
+ const char **args;
+ struct child_process chld;
+ int i;
+ int fd = open(PATCH_FILE, O_WRONLY | O_CREAT, 0666);
+ if (fd < 0)
+ return;
+
+ memset(&chld, 0, sizeof(chld));
+ if (!parents) {
+ write(fd, "Root commit\n", 12);
+ close(fd);
+ return;
+ } else if (!parents->next) {
+ args = xcalloc(5, sizeof(char *));
+ args[0] = "diff-tree";
+ args[1] = "-p";
+ args[2] = xstrdup(sha1_to_hex(parents->item->object.sha1));
+ args[3] = xstrdup(sha1_to_hex(((struct object *)commit)->sha1));
+ } else {
+ int count = 1;
+
+ for (; parents; parents = parents->next)
+ ++count;
+
+ i = 0;
+ args = xcalloc(count + 3, sizeof(char *));
+ args[i++] = "diff";
+ args[i++] = "--cc";
+ args[i++] = xstrdup(sha1_to_hex(commit->object.sha1));
+
+ for (parents = commit->parents; parents;
+ parents = parents->next) {
+ char *hex = sha1_to_hex(parents->item->object.sha1);
+ args[i++] = xstrdup(hex);
+ }
+ }
+
+ chld.argv = args;
+ chld.git_cmd = 1;
+ chld.out = fd;
+
+ /* Run, ignore errors. */
+ if (!start_command(&chld))
+ finish_command(&chld);
+
+ for (i = 2; args[i]; i++)
+ free((char *)args[i]);
+ free(args);
+}
+
+/* Return a commit object of "arg" */
+static struct commit *get_commit(const char *arg)
+{
+ unsigned char sha1[20];
+
+ if (get_sha1(arg, sha1)) {
+ error("Could not find '%s'", arg);
+ return NULL;
+ }
+ return lookup_commit_reference(sha1);
+}
+
int cmd_sequencer__helper(int argc, const char **argv, const char *prefix)
{
char *commit = NULL;
+ struct commit *c;
struct option options[] = {
OPT_STRING(0, "make-patch", &commit, "commit",
"create a patch from commit"),
@@ -22,6 +94,11 @@ int cmd_sequencer__helper(int argc, const char **argv, const char *prefix)
if (!commit)
usage_with_options(git_sequencer_helper_usage, options);
- /* Nothing to do yet */
+ c = get_commit(commit);
+ if (!c)
+ return 1;
+
+ make_patch(c);
+
return 0;
}
--
1.6.4.271.ge010d
^ permalink raw reply related
* Re: [PATCH] Fix overridable written with an extra 'e'
From: Junio C Hamano @ 2009-08-28 4:53 UTC (permalink / raw)
To: Todd Zullinger; +Cc: Nanako Shiraishi, git, Junio C Hamano
In-Reply-To: <20090828034305.GQ4297@inocybe.localdomain>
Hmph, I don't know. Googling "overrideable" suggests "Did you mean
overridable?" which is enough clue for me.
^ permalink raw reply
* Re: [PATCH] Fix overridable written with an extra 'e'
From: Todd Zullinger @ 2009-08-28 3:43 UTC (permalink / raw)
To: Nanako Shiraishi; +Cc: git, Junio C Hamano
In-Reply-To: <20090828121849.6117@nanako3.lavabit.com>
[-- Attachment #1: Type: text/plain, Size: 1571 bytes --]
Nanako Shiraishi wrote:
> Found during the lunch break by one of my students...
Is overridable a word itself? While English is my native language, I
wouldn't call myself an expert on its proper usage. ;)
However, I can't find 'overridable' in several online dictionaries:
http://dictionary.reference.com/browse/overridable
http://www.merriam-webster.com/dictionary/overridable
http://www.google.com/dictionary?aq=f&langpair=en|en&q=overridable&hl=en
http://dictionary.cambridge.org/results.asp?searchword=overridable&x=0&y=0
Perhaps using overridden would be more accurate?
> Prune loose objects older than date (default is 2 weeks ago,
> - overrideable by the config variable `gc.pruneExpire`). This
> + overridable by the config variable `gc.pruneExpire`). This
> option is on by default.
Prune loose objects older than date (default is 2 weeks ago,
- overrideable by the config variable `gc.pruneExpire`). This
+ which can be overridden by the config variable `gc.pruneExpire`). This
option is on by default.
> - warn "feature $name is not overrideable";
> + warn "feature $name is not overridable";
and
- warn "feature $name is not overrideable";
+ warn "feature $name cannot be overridden";
?
--
Todd OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I got stopped by a cop the other day. He said, "Why'd you run that
stop sign?" I said, "Because I don't believe everything I read."
-- Stephen Wright
[-- Attachment #2: Type: application/pgp-signature, Size: 542 bytes --]
^ permalink raw reply
* Re: [PATCHv4 08/12] Teach the notes lookup code to parse notes trees with various fanout schemes
From: Junio C Hamano @ 2009-08-28 3:35 UTC (permalink / raw)
To: Sverre Rabbelier
Cc: Jeff King, Johan Herland, git, Shawn O. Pearce,
Johannes.Schindelin, trast, tavestbo, git, chriscool
In-Reply-To: <fabb9a1e0908272005i4bf9b906xba08a711d384dd83@mail.gmail.com>
Sverre Rabbelier <srabbelier@gmail.com> writes:
> On Thu, Aug 27, 2009 at 20:02, Junio C Hamano<gitster@pobox.com> wrote:
>> In such a case would you rather want to see the commit itself first, or at
>> least, commit _and_ notes _together_?
>
> Assuming you do download all notes, I think it would be nice to be
> able to read the note; and since there's no way to download the commit
> separately it would require one to guess which head the commit belongs
> to and fetch the entire branch...?
Some random thoughts...
* If there are very many branches (in the worst case, they are so many
that the upstream uses the expand extention to serve the project),
maybe the notes namespace will also have many branches. It is unclear
how a user is expected to know which notes branch a note to a
particular commit is to be found.
* Perhaps to solve that problem, such a project may use notes in the
corresponding "notes branch"? Then your assumption does not hold, as
you first guess which notes branch to fetch to find the note that may
not even exist for this issue to become a real problem.
* If you assume all the notes are downloaded in such a project, you can
still go through all the top-level trees (that are date based fan-out)
and find the note to the commit object you do not have. At that point,
it only becomes performance issue for an unusual case where you have
a note but the commit the note applies to.
^ permalink raw reply
* [PATCH] Fix overridable written with an extra 'e'
From: Nanako Shiraishi @ 2009-08-28 3:18 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano
Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
---
Found during the lunch break by one of my students...
diff --git a/Documentation/git-gc.txt b/Documentation/git-gc.txt
index b292e98..dcac8c8 100644
--- a/Documentation/git-gc.txt
+++ b/Documentation/git-gc.txt
@@ -61,7 +61,7 @@ automatic consolidation of packs.
--prune=<date>::
Prune loose objects older than date (default is 2 weeks ago,
- overrideable by the config variable `gc.pruneExpire`). This
+ overridable by the config variable `gc.pruneExpire`). This
option is on by default.
--no-prune::
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 33ef190..43fa791 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -376,7 +376,7 @@ sub gitweb_get_feature {
@{$feature{$name}{'default'}});
if (!$override) { return @defaults; }
if (!defined $sub) {
- warn "feature $name is not overrideable";
+ warn "feature $name is not overridable";
return @defaults;
}
return $sub->(@defaults);
--
Nanako Shiraishi
http://ivory.ap.teacup.com/nanako3/
^ permalink raw reply related
* Re: [PATCHv4 08/12] Teach the notes lookup code to parse notes trees with various fanout schemes
From: Sverre Rabbelier @ 2009-08-28 3:05 UTC (permalink / raw)
To: Junio C Hamano
Cc: Jeff King, Johan Herland, git, Shawn O. Pearce,
Johannes.Schindelin, trast, tavestbo, git, chriscool
In-Reply-To: <7v4orsbpzd.fsf@alter.siamese.dyndns.org>
Heya,
On Thu, Aug 27, 2009 at 20:02, Junio C Hamano<gitster@pobox.com> wrote:
> In such a case would you rather want to see the commit itself first, or at
> least, commit _and_ notes _together_?
Assuming you do download all notes, I think it would be nice to be
able to read the note; and since there's no way to download the commit
separately it would require one to guess which head the commit belongs
to and fetch the entire branch...?
--
Cheers,
Sverre Rabbelier
^ permalink raw reply
* Re: [PATCHv4 08/12] Teach the notes lookup code to parse notes trees with various fanout schemes
From: Junio C Hamano @ 2009-08-28 3:02 UTC (permalink / raw)
To: Sverre Rabbelier
Cc: Junio C Hamano, Jeff King, Johan Herland, git, Shawn O. Pearce,
Johannes.Schindelin, trast, tavestbo, git, chriscool
In-Reply-To: <fabb9a1e0908271951t1f2db976jb1de1e7687ad9791@mail.gmail.com>
Sverre Rabbelier <srabbelier@gmail.com> writes:
> On Thu, Aug 27, 2009 at 18:43, Junio C Hamano<gitster@pobox.com> wrote:
>> Did you mean "a commit in branch bar referred to a commit in branch foo",
>> similar to the way the "cherry-picked from X" comment can refer to a
>> missing commit?
>
> Yes, sorry, I meant referred to in the commit message.
In such a case would you rather want to see the commit itself first, or at
least, commit _and_ notes _together_?
I admit that this all depends on what application the notes are used for,
but I am suffering from lack of imagination to come up with a plausible
scenario in which you would want to look at the notes to that missing
commit first, without getting the commit itself.
^ permalink raw reply
* [PATCH] Documentation: git-archive: mark --format as optional in summary
From: Wesley J. Landaker @ 2009-08-28 2:55 UTC (permalink / raw)
To: git, Junio C Hamano; +Cc: Wesley J. Landaker
In-Reply-To: <1251414520-28519-1-git-send-email-wjl@icecavern.net>
The --format option was made optional in v1.5.1-105-g8ff21b1, but it was
not marked as optional in the summary. This trival patch just changes
the summary to match the rest of the documentation.
Signed-off-by: Wesley J. Landaker <wjl@icecavern.net>
---
Junio pointed out that I missed the Signed-off-by in my previous patch. So
here it is again with that fixed.
Documentation/git-archive.txt | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/Documentation/git-archive.txt b/Documentation/git-archive.txt
index bc132c8..92444dd 100644
--- a/Documentation/git-archive.txt
+++ b/Documentation/git-archive.txt
@@ -9,7 +9,7 @@ git-archive - Create an archive of files from a named tree
SYNOPSIS
--------
[verse]
-'git archive' --format=<fmt> [--list] [--prefix=<prefix>/] [<extra>]
+'git archive' [--format=<fmt>] [--list] [--prefix=<prefix>/] [<extra>]
[--output=<file>] [--worktree-attributes]
[--remote=<repo> [--exec=<git-upload-archive>]] <tree-ish>
[path...]
--
1.6.3.3
^ permalink raw reply related
* Re: [PATCHv4 08/12] Teach the notes lookup code to parse notes trees with various fanout schemes
From: Sverre Rabbelier @ 2009-08-28 2:51 UTC (permalink / raw)
To: Junio C Hamano
Cc: Jeff King, Johan Herland, git, Shawn O. Pearce,
Johannes.Schindelin, trast, tavestbo, git, chriscool
In-Reply-To: <7vocq0d86p.fsf@alter.siamese.dyndns.org>
Heya,
On Thu, Aug 27, 2009 at 18:43, Junio C Hamano<gitster@pobox.com> wrote:
> Did you mean "a commit in branch bar referred to a commit in branch foo",
> similar to the way the "cherry-picked from X" comment can refer to a
> missing commit?
Yes, sorry, I meant referred to in the commit message.
--
Cheers,
Sverre Rabbelier
^ permalink raw reply
* Re: finding unmerged branches
From: Joey Hess @ 2009-08-28 2:08 UTC (permalink / raw)
To: git
In-Reply-To: <20090827220241.GA1413@gnu.kitenet.net>
[-- Attachment #1: Type: text/plain, Size: 343 bytes --]
Joey Hess wrote:
> * Is this situation somewhat common, or an I doing something wrong?
> (Assuming that I have a good reason to want to look at remote
> branches rather than waiting to get merge requests.)
Come to think, the github fork queue serves basically the same purpose,
but only for branches in github.
--
see shy jo
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* [PATCH v3 2/3] gitweb: split test suite into library and tests
From: Mark Rada @ 2009-08-28 2:07 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
I just fixed a typo in the commit message, a really obvious typo
that had to be pointed out to me...
I hope this is not too late.
--
Mark A Rada (ferrous26)
marada@uwaterloo.ca
--->8---
To accommodate additions to the test cases for gitweb, the preamble
from t9500 is now in its own library so that new sets of tests for
gitweb can use the same setup without copying the code.
Signed-off-by: Mark Rada <marada@uwaterloo.ca>
---
t/gitweb-lib.sh | 73 ++++++++++++++++++++++++++++++++
t/t9500-gitweb-standalone-no-errors.sh | 67 +----------------------------
2 files changed, 74 insertions(+), 66 deletions(-)
create mode 100644 t/gitweb-lib.sh
diff --git a/t/gitweb-lib.sh b/t/gitweb-lib.sh
new file mode 100644
index 0000000..8452532
--- /dev/null
+++ b/t/gitweb-lib.sh
@@ -0,0 +1,73 @@
+#!/bin/sh
+#
+# Copyright (c) 2007 Jakub Narebski
+#
+
+gitweb_init () {
+ safe_pwd="$(perl -MPOSIX=getcwd -e 'print quotemeta(getcwd)')"
+ cat >gitweb_config.perl <<EOF
+#!/usr/bin/perl
+
+# gitweb configuration for tests
+
+our \$version = 'current';
+our \$GIT = 'git';
+our \$projectroot = "$safe_pwd";
+our \$project_maxdepth = 8;
+our \$home_link_str = 'projects';
+our \$site_name = '[localhost]';
+our \$site_header = '';
+our \$site_footer = '';
+our \$home_text = 'indextext.html';
+our @stylesheets = ('file:///$TEST_DIRECTORY/../gitweb/gitweb.css');
+our \$logo = 'file:///$TEST_DIRECTORY/../gitweb/git-logo.png';
+our \$favicon = 'file:///$TEST_DIRECTORY/../gitweb/git-favicon.png';
+our \$projects_list = '';
+our \$export_ok = '';
+our \$strict_export = '';
+
+EOF
+
+ cat >.git/description <<EOF
+$0 test repository
+EOF
+}
+
+gitweb_run () {
+ GATEWAY_INTERFACE='CGI/1.1'
+ HTTP_ACCEPT='*/*'
+ REQUEST_METHOD='GET'
+ SCRIPT_NAME="$TEST_DIRECTORY/../gitweb/gitweb.perl"
+ QUERY_STRING=""$1""
+ PATH_INFO=""$2""
+ export GATEWAY_INTERFACE HTTP_ACCEPT REQUEST_METHOD \
+ SCRIPT_NAME QUERY_STRING PATH_INFO
+
+ GITWEB_CONFIG=$(pwd)/gitweb_config.perl
+ export GITWEB_CONFIG
+
+ # some of git commands write to STDERR on error, but this is not
+ # written to web server logs, so we are not interested in that:
+ # we are interested only in properly formatted errors/warnings
+ rm -f gitweb.log &&
+ perl -- "$SCRIPT_NAME" \
+ >gitweb.output 2>gitweb.log &&
+ if grep '^[[]' gitweb.log >/dev/null 2>&1; then false; else true; fi
+
+ # gitweb.log is left for debugging
+ # gitweb.output is used to parse http output
+}
+
+. ./test-lib.sh
+
+if ! test_have_prereq PERL; then
+ say 'skipping gitweb tests, perl not available'
+ test_done
+fi
+
+perl -MEncode -e 'decode_utf8("", Encode::FB_CROAK)' >/dev/null 2>&1 || {
+ say 'skipping gitweb tests, perl version is too old'
+ test_done
+}
+
+gitweb_init
diff --git a/t/t9500-gitweb-standalone-no-errors.sh b/t/t9500-gitweb-standalone-no-errors.sh
index 6275181..2fc7fdb 100755
--- a/t/t9500-gitweb-standalone-no-errors.sh
+++ b/t/t9500-gitweb-standalone-no-errors.sh
@@ -9,73 +9,8 @@ This test runs gitweb (git web interface) as CGI script from
commandline, and checks that it would not write any errors
or warnings to log.'
-gitweb_init () {
- safe_pwd="$(perl -MPOSIX=getcwd -e 'print quotemeta(getcwd)')"
- cat >gitweb_config.perl <<EOF
-#!/usr/bin/perl
-
-# gitweb configuration for tests
-
-our \$version = "current";
-our \$GIT = "git";
-our \$projectroot = "$safe_pwd";
-our \$project_maxdepth = 8;
-our \$home_link_str = "projects";
-our \$site_name = "[localhost]";
-our \$site_header = "";
-our \$site_footer = "";
-our \$home_text = "indextext.html";
-our @stylesheets = ("file:///$TEST_DIRECTORY/../gitweb/gitweb.css");
-our \$logo = "file:///$TEST_DIRECTORY/../gitweb/git-logo.png";
-our \$favicon = "file:///$TEST_DIRECTORY/../gitweb/git-favicon.png";
-our \$projects_list = "";
-our \$export_ok = "";
-our \$strict_export = "";
-EOF
-
- cat >.git/description <<EOF
-$0 test repository
-EOF
-}
-
-gitweb_run () {
- GATEWAY_INTERFACE="CGI/1.1"
- HTTP_ACCEPT="*/*"
- REQUEST_METHOD="GET"
- SCRIPT_NAME="$TEST_DIRECTORY/../gitweb/gitweb.perl"
- QUERY_STRING=""$1""
- PATH_INFO=""$2""
- export GATEWAY_INTERFACE HTTP_ACCEPT REQUEST_METHOD \
- SCRIPT_NAME QUERY_STRING PATH_INFO
-
- GITWEB_CONFIG=$(pwd)/gitweb_config.perl
- export GITWEB_CONFIG
-
- # some of git commands write to STDERR on error, but this is not
- # written to web server logs, so we are not interested in that:
- # we are interested only in properly formatted errors/warnings
- rm -f gitweb.log &&
- perl -- "$SCRIPT_NAME" \
- >/dev/null 2>gitweb.log &&
- if grep "^[[]" gitweb.log >/dev/null 2>&1; then false; else true; fi
-
- # gitweb.log is left for debugging
-}
-
-. ./test-lib.sh
-
-if ! test_have_prereq PERL; then
- say 'skipping gitweb tests, perl not available'
- test_done
-fi
-
-perl -MEncode -e 'decode_utf8("", Encode::FB_CROAK)' >/dev/null 2>&1 || {
- say 'skipping gitweb tests, perl version is too old'
- test_done
-}
-
-gitweb_init
+. ./gitweb-lib.sh
# ----------------------------------------------------------------------
# no commits (empty, just initialized repository)
--
1.6.4.1
^ permalink raw reply related
* [PATCH] Round-down years in "years+months" relative date view
From: David Reiss @ 2009-08-27 23:39 UTC (permalink / raw)
To: git
Previously, a commit from 1 year and 7 months ago would display as
"2 years, 7 months ago".
Signed-off-by: David Reiss <dreiss@facebook.com>
---
Here's my test script. Let me know if you'd rather have it as part
of the test suite.
#!/bin/sh
set -e
REPO="git-relative-dates-test"
rm -rf "$REPO"
mkdir "$REPO"
cd "$REPO"
git init
NOW=`date +%s`
env GIT_AUTHOR_DATE=`expr $NOW - \( 365 + 220 \) \* 24 \* 60 \* 60` git commit --allow-empty -m old-commit
git log --date=relative
date.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/date.c b/date.c
index 1de1845..e848d96 100644
--- a/date.c
+++ b/date.c
@@ -137,7 +137,7 @@ const char *show_date(unsigned long time, int tz, enum date_mode mode)
}
/* Give years and months for 5 years or so */
if (diff < 1825) {
- unsigned long years = (diff + 183) / 365;
+ unsigned long years = diff / 365;
unsigned long months = (diff % 365 + 15) / 30;
int n;
n = snprintf(timebuf, sizeof(timebuf), "%lu year%s",
--
1.6.0.4
^ permalink raw reply related
* Re: [PATCHv4 08/12] Teach the notes lookup code to parse notes trees with various fanout schemes
From: Junio C Hamano @ 2009-08-28 1:43 UTC (permalink / raw)
To: Sverre Rabbelier
Cc: Jeff King, Johan Herland, git, Shawn O. Pearce,
Johannes.Schindelin, trast, tavestbo, git, chriscool
In-Reply-To: <fabb9a1e0908271740i53ec7d69td696d955366ad23c@mail.gmail.com>
Sverre Rabbelier <srabbelier@gmail.com> writes:
> Heya,
>
> On Thu, Aug 27, 2009 at 17:30, Junio C Hamano<gitster@pobox.com> wrote:
>> So, how?
>
> A note in branch foo (which you do not follow) was referenced by a
> commit in branch bar (which you do follow)?
Sorry, I do not follow. How does a note be _in_ branch foo, and how does
a commit _reference_ a note?
Did you mean "a commit in branch bar referred to a commit in branch foo",
similar to the way the "cherry-picked from X" comment can refer to a
missing commit?
^ permalink raw reply
* Re: [PATCH v3] import-tars: Allow per-tar author and commit message.
From: Junio C Hamano @ 2009-08-28 1:38 UTC (permalink / raw)
To: Peter Krefting; +Cc: git
In-Reply-To: <alpine.DEB.2.00.0908270741170.6459@perkele.intern.softwolves.pp.se>
Peter Krefting <peter@softwolves.pp.se> writes:
> Junio C Hamano:
>
>> Do you really want to slurp Committer:/Author: lines from _anywhere_
>> in the file? Wouldn't it make more sense to vaguely emulate e-mail
>> message format with headers, empty-line and then body that is free
>> form?
>
> I just tried not to overdo it, and keep the parsing code as simple as
> possible. I wasn't trying to implement an RFC 5322 compliant parser...
It is not about overdoing, but about not glossly underdoing.
Don't you at least want to avoid misparsing a msg file that looks like
this?
Author: Peter Krefting <peter@softwolves.pp.se>
import-tars: Allow per-tar author and commit message
This version updates the import-tars program so that another
file next to the archive can be read for the log message and
other meta information. A line that begins with Committer: or
Author: is used as long as it consists of name and <email>
to override the corresponding metainformation. Remaining lines
are used as the commit log message.
And I do not think you need a complex parser. Stop paying attention to a
line that begins with Author:/Committer:, once you see a line that does
not match the pattern; and you would be Ok.
IOW, something like...
my $reading_metainfo = 1;
my $squashing_empty = 0;
while (<>) {
if ($reading_metainfo) {
if (/^Committer:.../) {
...
next;
} elsif (/^Author:.../) {
...
next;
} else {
$reading_metainfo = 0;
}
}
if (/^$/) {
$squashing_empty = 1;
next;
}
if ($squashing_empty && $commit_msg ne '') {
$commit_msg .= "\n";
}
$commit_msg .= $_;
$squashing_empty = 0;
}
^ permalink raw reply
* Re: finding unmerged branches
From: Joey Hess @ 2009-08-28 0:54 UTC (permalink / raw)
To: git
In-Reply-To: <32541b130908271522u1048dcb1h67b79049e46df1ac@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 580 bytes --]
Avery Pennarun wrote:
> How about:
>
> gitk $(git for-each-ref --format='%(refname)' 'refs/remotes/'; git
> for-each-ref --format='^%(refname)' 'refs/heads/')
>
> You could also replace 'gitk' with 'git log', and mess with the
> --pretty=format:whatever parameter.
I added 'refs/remotes/origin/' 'refs/tags/' to the list, and that's
almost perfect, thanks.
Though there was one remote branch where gitk showed a lot of commits
from origin/master before the unmerged changes in the branch. Could not
figure out why, git log doesn't show them.
--
see shy jo
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* Re: finding unmerged branches
From: Joey Hess @ 2009-08-28 0:44 UTC (permalink / raw)
To: git
In-Reply-To: <20090827223504.GA18307@atjola.homenet>
[-- Attachment #1: Type: text/plain, Size: 482 bytes --]
Björn Steinbrink wrote:
> Hm, not sure if I'd call it "better", but probably at least a bit
> faster. You could create a "fake" merge to combine all the branches.
>
> git branch -r --no-merged $(
> : | git commit-tree HEAD^{tree} $(
> git for-each-ref --format='-p %(refname)' \
> refs/heads/ \
> refs/remotes/origin
> )
> )
That does run fast. Has some warnings about duplicate parents. The gitk
method seems more useful.
--
see shy jo
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* Re: [PATCHv4 08/12] Teach the notes lookup code to parse notes trees with various fanout schemes
From: Sverre Rabbelier @ 2009-08-28 0:40 UTC (permalink / raw)
To: Junio C Hamano
Cc: Jeff King, Johan Herland, git, Shawn O. Pearce,
Johannes.Schindelin, trast, tavestbo, git, chriscool
In-Reply-To: <7viqg8hj98.fsf@alter.siamese.dyndns.org>
Heya,
On Thu, Aug 27, 2009 at 17:30, Junio C Hamano<gitster@pobox.com> wrote:
> So, how?
A note in branch foo (which you do not follow) was referenced by a
commit in branch bar (which you do follow)?
--
Cheers,
Sverre Rabbelier
^ permalink raw reply
* Re: [PATCHv4 08/12] Teach the notes lookup code to parse notes trees with various fanout schemes
From: Junio C Hamano @ 2009-08-28 0:30 UTC (permalink / raw)
To: Jeff King
Cc: Johan Herland, git, Shawn O. Pearce, Johannes.Schindelin, trast,
tavestbo, git, chriscool
In-Reply-To: <20090827233900.GA7347@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
> On Fri, Aug 28, 2009 at 01:03:05AM +0200, Johan Herland wrote:
>
>> Agreed. I'm starting to come around to the idea of storing them in subtrees
>> based on commit dates. For one, you don't have multiple notes for one commit
>> in the same notes tree. Also, the common-case access pattern seems tempting.
>>
>> Dscho: Were there other problems with the date-based approach other than not
>> supporting notes on trees and blobs?
>>
>> If not, I'll start preparing another series with the date-based approach.
>
> Would you ever want to load a note for a commit when you did not have
> that commit present (in which case you would not know its date)?
You cannot "git show" nor "git checkout" it, nor have reached it via "git
bisect". How did you get interested in the commit in the first place?
What is the reason you are not fetching the commit after you somehow got
interested in the commit?
Here is one possible scenario I can think of. The notes tree is published
and distributed more widely than the project's main source. You fetch and
usually follow notes tree (which would probably be more lightweight) but
not the source. Perhaps your bug tracking system is based on notes, and
the project is throwing all the bugs in one such notes tree. You are a
bug tracking person, and you are following the notes tree closely, but are
only following the 'master' branch but not 'next' nor 'pu'.
And you somehow browse through the 'notes' tree, and learn that a note
refers to an interesting commit. But the commit the note applies to is
not yet in 'master' so you do not have it. Even though you would want to
fetch 'next' and 'pu', you are having connection problem and you cannot
fetch the source until your ISP gets back online tomorrow morning.
Nah, that's not a plausible scenario---at that point you already have read
the note.
So, how?
^ permalink raw reply
* Re: [PATCHv4 08/12] Teach the notes lookup code to parse notes trees with various fanout schemes
From: Jeff King @ 2009-08-27 23:39 UTC (permalink / raw)
To: Johan Herland
Cc: git, Junio C Hamano, Shawn O. Pearce, Johannes.Schindelin, trast,
tavestbo, git, chriscool
In-Reply-To: <200908280103.06015.johan@herland.net>
On Fri, Aug 28, 2009 at 01:03:05AM +0200, Johan Herland wrote:
> Agreed. I'm starting to come around to the idea of storing them in subtrees
> based on commit dates. For one, you don't have multiple notes for one commit
> in the same notes tree. Also, the common-case access pattern seems tempting.
>
> Dscho: Were there other problems with the date-based approach other than not
> supporting notes on trees and blobs?
>
> If not, I'll start preparing another series with the date-based approach.
Would you ever want to load a note for a commit when you did not have
that commit present (in which case you would not know its date)?
-Peff
^ permalink raw reply
* Re: finding unmerged branches
From: Junio C Hamano @ 2009-08-27 23:25 UTC (permalink / raw)
To: Björn Steinbrink; +Cc: Joey Hess, git
In-Reply-To: <20090827223504.GA18307@atjola.homenet>
Björn Steinbrink <B.Steinbrink@gmx.de> writes:
> Hm, not sure if I'd call it "better", but probably at least a bit
> faster. You could create a "fake" merge to combine all the branches.
>
> git branch -r --no-merged $(
> : | git commit-tree HEAD^{tree} $(
> git for-each-ref --format='-p %(refname)' \
> refs/heads/ \
> refs/remotes/origin
> )
> )
Heh, that is certainly a cute hack ;-)
^ permalink raw reply
* [PATCH] Documentation: git-archive: mark --format as optional in summary
From: Wesley J. Landaker @ 2009-08-27 23:08 UTC (permalink / raw)
To: git, Junio C Hamano; +Cc: Wesley J. Landaker
The --format option was made optional in v1.5.1-105-g8ff21b1, but it was
not marked as optional in the summary. This trival patch just changes
the summary to match the rest of the documentation.
---
Documentation/git-archive.txt | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/Documentation/git-archive.txt b/Documentation/git-archive.txt
index bc132c8..92444dd 100644
--- a/Documentation/git-archive.txt
+++ b/Documentation/git-archive.txt
@@ -9,7 +9,7 @@ git-archive - Create an archive of files from a named tree
SYNOPSIS
--------
[verse]
-'git archive' --format=<fmt> [--list] [--prefix=<prefix>/] [<extra>]
+'git archive' [--format=<fmt>] [--list] [--prefix=<prefix>/] [<extra>]
[--output=<file>] [--worktree-attributes]
[--remote=<repo> [--exec=<git-upload-archive>]] <tree-ish>
[path...]
--
1.6.3.3
^ permalink raw reply related
* Re: [PATCHv4 08/12] Teach the notes lookup code to parse notes trees with various fanout schemes
From: Johan Herland @ 2009-08-27 23:03 UTC (permalink / raw)
To: git
Cc: Junio C Hamano, Shawn O. Pearce, Johannes.Schindelin, trast,
tavestbo, git, chriscool
In-Reply-To: <7vy6p5ncz0.fsf@alter.siamese.dyndns.org>
On Thursday 27 August 2009, Junio C Hamano wrote:
> "Shawn O. Pearce" <spearce@spearce.org> writes:
> > Yea, it was me. I still think it might be a useful idea, since
> > it allows you better density of loading notes when parsing the
> > recent commits. In theory the last 256 commits can easly be in
> > each of the 2/ fanout buckets, making 2/38 pointless for reducing
> > the search space. Commit date on the other hand can probably force
> > all of them into the same bucket, making it easy to have the last
> > 256 commits in cache, from a single bucket.
> >
> > But I thought you shot it down, by saying that we also wanted to
> > support notes on blobs. I happen to see no value in a note on
> > a blob, a blob alone doesn't make much sense without at least an
> > annotated tag or commit to provide it some named context, and the
> > latter two have dates.
>
> Yeah, and in this thread everybody seems to be talking about commits so I
> think it is fine to limit notes only to commits.
Agreed. I'm starting to come around to the idea of storing them in subtrees
based on commit dates. For one, you don't have multiple notes for one commit
in the same notes tree. Also, the common-case access pattern seems tempting.
Dscho: Were there other problems with the date-based approach other than not
supporting notes on trees and blobs?
If not, I'll start preparing another series with the date-based approach.
Thanks for the input, guys. :)
...Johan
--
Johan Herland, <johan@herland.net>
www.herland.net
^ 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