* Re: [PATCH 2/2] Bisect: implement "bisect dunno" to mark untestable revisions.
From: Johannes Schindelin @ 2007-10-08 3:49 UTC (permalink / raw)
To: Christian Couder; +Cc: Junio Hamano, git
In-Reply-To: <20071008053450.a52d7c5e.chriscool@tuxfamily.org>
Hi,
On Mon, 8 Oct 2007, Christian Couder wrote:
> diff --git a/git-bisect.sh b/git-bisect.sh
> index 388887a..c556318 100755
> --- a/git-bisect.sh
> +++ b/git-bisect.sh
> @@ -143,7 +145,7 @@ bisect_write_bad() {
>
> bisect_good() {
> bisect_autostart
> - case "$#" in
> + case "$#" in
White space breakage.
> @@ -153,7 +155,6 @@ bisect_good() {
> rev=$(git rev-parse --verify "$rev^{commit}") || exit
> bisect_write_good "$rev"
> echo "git-bisect good $rev" >>"$GIT_DIR/BISECT_LOG"
> -
?
> @@ -164,6 +165,28 @@ bisect_write_good() {
> echo "# good: "$(git show-branch $rev) >>"$GIT_DIR/BISECT_LOG"
> }
>
> +bisect_dunno() {
> + bisect_autostart
> + case "$#" in
> + 0) revs=$(git rev-parse --verify HEAD) || exit ;;
> + *) revs=$(git rev-parse --revs-only --no-flags "$@") &&
> + test '' != "$revs" || die "Bad rev input: $@" ;;
> + esac
> + for rev in $revs
> + do
> + rev=$(git rev-parse --verify "$rev^{commit}") || exit
> + bisect_write_dunno "$rev"
> + echo "git-bisect dunno $rev" >>"$GIT_DIR/BISECT_LOG"
Should the last line not be put into bisect_write_dunno? OTOH this is the
only call site of that function, so I strongly doubt that the function
(consisting of 3 lines, where the first is 'rev="$1"') is necessary at
all.
> @@ -206,17 +229,104 @@ bisect_auto_next() {
> bisect_next_check && bisect_next || :
> }
>
> +search_dunno() {
> + _hash="$1"
> + _dunno="$2"
> +
> + for _val in $_dunno ; do
> + case $_hash in $_val) return 1 ;; esac
> + done
This would be faster as
case " $1" in " $2") return 1 ;; esac
I guess.
But as I said in the other reply, I think this logic belongs into the C
core, instead of generating mostly useless information, passing it down to
the script, and filtering it out again.
Thanks,
Dscho
^ permalink raw reply
* Re: [PATCH] Make git-clean a builtin
From: Johannes Schindelin @ 2007-10-08 3:57 UTC (permalink / raw)
To: Shawn Bohrer; +Cc: git, frank, gitster
In-Reply-To: <11918014664038-git-send-email-shawn.bohrer@gmail.com>
Hi,
On Sun, 7 Oct 2007, Shawn Bohrer wrote:
> + if (ignored && ignored_only)
> + usage(builtin_clean_usage);
Maybe a helpful message in that case, too? (It is not apparent from the
usage what the user has done wrong here.)
> + if (disabled) {
> + die("clean.requireForce set and -n or -f not given; refusing to clean");
> + }
Please lose the curly brackets here. They are absolutely useless, and the
rest of the git source code avoids unnecessary curly brackets.
> + /* Paths (argc - i) + 8 (Possible arguments)*/
> + argv_ls_files = xmalloc((argc - i + 8) * sizeof(const char *));
> + argv_ls_files[0] = "ls-files";
> + argv_ls_files[1] = "--others";
> + argv_ls_files[2] = "--directory";
> [...]
As Linus already noted, it is probably easy, and much more efficient, to
call read_directory() here. The best example how to use
read_directory() is... builtin-ls-files.c.
> diff --git a/git.c b/git.c
> index d7c6bca..4e39169 100644
> --- a/git.c
> +++ b/git.c
> @@ -320,6 +320,7 @@ static void handle_internal_command(int argc, const char **argv)
> { "check-attr", cmd_check_attr, RUN_SETUP | NEED_WORK_TREE },
> { "cherry", cmd_cherry, RUN_SETUP },
> { "cherry-pick", cmd_cherry_pick, RUN_SETUP | NEED_WORK_TREE },
> + { "clean", cmd_clean, RUN_SETUP },
You definitely want to have NEED_WORK_TREE here, too.
Ciao,
Dscho
^ permalink raw reply
* [PATCH] Remove duplicate ref matches in fetch
From: Daniel Barkalow @ 2007-10-08 4:25 UTC (permalink / raw)
To: Andy Whitcroft; +Cc: git, Junio C Hamano, Johannes Schindelin
If multiple refspecs matched the same ref, the update would be
processed multiple times. Now having the same destination for the same
source has no additional effect, and having the same destination for
different sources is an error.
Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
---
I tested this with the usual tests, but (a) they don't include this case
(yet), and (b) they passed before I fixed a bug. So this should get some
good testing, and probably by somebody with valgrind --leak-check to make
sure I'm deallocating things correctly.
builtin-fetch.c | 1 +
remote.c | 27 +++++++++++++++++++++++++++
remote.h | 5 +++++
3 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/builtin-fetch.c b/builtin-fetch.c
index cf7498b..caaca63 100644
--- a/builtin-fetch.c
+++ b/builtin-fetch.c
@@ -112,6 +112,7 @@ static struct ref *get_ref_map(struct transport *transport,
ref_map->merge = 1;
}
}
+ ref_remove_duplicates(ref_map);
return ref_map;
}
diff --git a/remote.c b/remote.c
index e7d735b..e2ca4d3 100644
--- a/remote.c
+++ b/remote.c
@@ -380,6 +380,33 @@ int for_each_remote(each_remote_fn fn, void *priv)
return result;
}
+void ref_remove_duplicates(struct ref *ref_map)
+{
+ struct ref **posn;
+ struct ref *next;
+ for (; ref_map; ref_map = ref_map->next) {
+ if (!ref_map->peer_ref)
+ continue;
+ posn = &ref_map->next;
+ while (*posn) {
+ if ((*posn)->peer_ref &&
+ !strcmp((*posn)->peer_ref->name,
+ ref_map->peer_ref->name)) {
+ if (strcmp((*posn)->name, ref_map->name))
+ die("%s tracks both %s and %s",
+ ref_map->peer_ref->name,
+ (*posn)->name, ref_map->name);
+ next = (*posn)->next;
+ free((*posn)->peer_ref);
+ free(*posn);
+ *posn = next;
+ } else {
+ posn = &(*posn)->next;
+ }
+ }
+ }
+}
+
int remote_has_url(struct remote *remote, const char *url)
{
int i;
diff --git a/remote.h b/remote.h
index 05add06..c62636d 100644
--- a/remote.h
+++ b/remote.h
@@ -49,6 +49,11 @@ struct ref *alloc_ref(unsigned namelen);
*/
void free_refs(struct ref *ref);
+/*
+ * Removes and frees any duplicate refs in the map.
+ */
+void ref_remove_duplicates(struct ref *ref_map);
+
struct refspec *parse_ref_spec(int nr_refspec, const char **refspec);
int match_refs(struct ref *src, struct ref *dst, struct ref ***dst_tail,
--
1.5.3.4.1155.gfe96ee
^ permalink raw reply related
* Re: [PATCH] git-shell and git-cvsserver
From: Johannes Schindelin @ 2007-10-08 4:51 UTC (permalink / raw)
To: Jan Wielemaker; +Cc: Git Mailing List
In-Reply-To: <200710051453.47622.wielemak@science.uva.nl>
Hi,
On Fri, 5 Oct 2007, Jan Wielemaker wrote:
> Hi,
>
> I know, I shouldn't be using git-cvsserver :-( Anyway, I patched
> git-shell to start git-cvsserver if it is started interactively and the
> one and only line given to it is "cvs server".
>
> The patch to shell.c is below. The trick with the EXEC_PATH is needed
> because git-cvsserver doesn't appear to be working if you do not include
> the git bindir in $PATH. I think that should be fixed in git-cvsserver
> and otherwise we should at least make the value come from the prefix
> make variable. With this patch I was able to use both Unix and Windows
> cvs clients using git-shell as login shell.
>
> Note that you must provide ~/.gitconfig with user and email in the
> restricted environment.
>
> Enjoy --- Jan
I think this is a valuable contribution. That's why I comment...
Please put a useful commit message (less like an email, more like
something you want to read in git-log) at the beginning of the email, then
a line containing _just_ "---", and after that some comments that are not
meant to be stored in the history, like (I know this does not belong
to...)
After that, there should be a diffstat, and then the patch.
The easiest to have this layout is to do a proper commit in git, use "git
format-patch" to produce the patch, and then insert what you want to say
in addition to the commit message between the "---" marker and the
diffstat.
I strongly disagree (as you yourself, probably) with the notion that this
does not belong into git-shell.
> +#define EXEC_PATH "/usr/local/bin"
This is definitely wrong. Use git_exec_path() instead.
> +static int do_cvs_cmd(const char *me, char *arg)
> +{
> + const char *my_argv[4];
Maybe rename this to cvsserver_args?
> + const char *oldpath;
> +
> + if ( !arg )
> + die("no argument");
> + if ( strcmp(arg, "server") )
> + die("only allows git-cvsserver server: %s", arg);
> +
> + my_argv[0] = "cvsserver";
> + my_argv[1] = "server";
> + my_argv[2] = NULL;
> +
> + if ( (oldpath=getenv("PATH")) ) {
Please lose the spaces after the opening and before the closing brackets.
And put spaces around the "=" sign.
It is really distracting to read different styles of code in the same
project, and that's why we're pretty anal about coding styles. Just have
a look (in the same file) how we write things, and imitate it as closely
as possible.
> + char *newpath = malloc(strlen(oldpath)+strlen(EXEC_PATH)+5+1+1); > +
> + sprintf(newpath, "PATH=%s:%s", EXEC_PATH, oldpath);
> + putenv(newpath);
> + } else {
> + char *newpath = malloc(strlen(EXEC_PATH)+5+1);
> +
> + sprintf(newpath, "PATH=%s", EXEC_PATH);
> + putenv(newpath);
> + }
You have redundant "putenv(newpath);" in both clauses. AFAICT putenv() is
deprecated, too, and we use setenv() elsewhere.
In addition, I strongly suggest using strbuf:
struct strbuf newpath = STRBUF_INIT;
strbuf_addstr(&newpath, git_exec_path());
if ((oldpath = getenv("PATH"))) {
strbuf_addch(&newpath, ':');
strbuf_addstr(&newpath, oldpath);
}
setenv("PATH", strbuf_detach(&newpath, NULL), 1);
> + return execv_git_cmd(my_argv);
... and then you call execv_git_cmd(), which already does all the details
of setting up the exec dir correctly AFAIR.
> int main(int argc, char **argv)
> {
> char *prog;
> + char buf[256];
> struct commands *cmd;
>
> /* We want to see "-c cmd args", and nothing else */
> - if (argc != 3 || strcmp(argv[1], "-c"))
> - die("What do you think I am? A shell?");
> + if (argc == 1) {
> + if (fgets(buf, sizeof(buf)-1, stdin)) {
> + char *end;
> +
> + if ( (end=strchr(buf, '\n')) )
> + { while(end>buf && end[-1] <= ' ')
> + end--;
> + *end = '\0';
> + } else {
> + die("Bad command");
> + }
> +
> + prog = buf;
> + } else {
> + die("No command");
> + }
> + } else {
> + if (argc != 3 || strcmp(argv[1], "-c"))
> + die("What do you think I am? A shell?");
> +
> + prog = argv[2];
> + argv += 2;
> + argc -= 2;
> + }
And this is ugly. If you want to support "cvs server", then just check
for that string, and if it matches, return execl_git_cmd("cvsserver");
Otherwise proceed as in the original code.
Ciao,
Dscho
^ permalink raw reply
* Re: [PATCH 1/2] rev-list: implement --bisect-all
From: Christian Couder @ 2007-10-08 5:08 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Junio Hamano, git
In-Reply-To: <Pine.LNX.4.64.0710080442420.4174@racer.site>
Hi Dscho,
Le lundi 8 octobre 2007, Johannes Schindelin a écrit :
> Hi,
>
> On Mon, 8 Oct 2007, Christian Couder wrote:
> > This option makes it possible to see all the potential bisection
> > points. The best ones are displayed first.
>
> Would it not be better to pass --bisect-vars a list of commits that we do
> not want to see? It could then mark them as "DUNNO", and still just
> output a single commit.
The problem is that after --bisect-vars we already pass some "good" and then
a bad commit. So we have to use another flag like --bisect-dunno and put
the dunno commits after this one.
Then there is the problem that revision.c reorders arguments and doesn't
know about "--bisect-*" flags. It is also used by a lot of other commands.
After struggling with revision.c for some time, I thought it would be
simpler and safer to come up first with something in shell.
Also please note that in some cases we cannot just output a single commit,
because we just dunno which commit is the first bad one.
> IMHO such a logic does not belong into a shell script, but into the C
> core.
There is a lot of the bisect logic implemented in git-bisect.sh already. The
long term plan is to rewrite it in C, but I am not sure that the "dunno"
logic should be the first part of it to be done in C.
Also I thought it was still fine to prototype new features in shell.
Best regards,
Christian.
^ permalink raw reply
* [PATCH] Make git-clean a builtin
From: Shawn Bohrer @ 2007-10-07 23:57 UTC (permalink / raw)
To: git; +Cc: Johannes.Schindelin, frank, gitster, Shawn Bohrer
This replaces git-clean.sh with builtin-clean.c, and moves git-clean.sh to the
examples.
Signed-off-by: Shawn Bohrer <shawn.bohrer@gmail.com>
---
Rewritten to use remove_directory_recursively() per Dscho's suggestion. Patch
is now based ontop of 'next'.
Makefile | 3 +-
builtin-clean.c | 161 +++++++++++++++++++++++++
builtin.h | 1 +
git-clean.sh => contrib/examples/git-clean.sh | 0
git.c | 1 +
5 files changed, 165 insertions(+), 1 deletions(-)
create mode 100644 builtin-clean.c
rename git-clean.sh => contrib/examples/git-clean.sh (100%)
diff --git a/Makefile b/Makefile
index 62bdac6..bed4c78 100644
--- a/Makefile
+++ b/Makefile
@@ -206,7 +206,7 @@ BASIC_LDFLAGS =
SCRIPT_SH = \
git-bisect.sh git-checkout.sh \
- git-clean.sh git-clone.sh git-commit.sh \
+ git-clone.sh git-commit.sh \
git-ls-remote.sh \
git-merge-one-file.sh git-mergetool.sh git-parse-remote.sh \
git-pull.sh git-rebase.sh git-rebase--interactive.sh \
@@ -324,6 +324,7 @@ BUILTIN_OBJS = \
builtin-check-attr.o \
builtin-checkout-index.o \
builtin-check-ref-format.o \
+ builtin-clean.o \
builtin-commit-tree.o \
builtin-count-objects.o \
builtin-describe.o \
diff --git a/builtin-clean.c b/builtin-clean.c
new file mode 100644
index 0000000..af61de0
--- /dev/null
+++ b/builtin-clean.c
@@ -0,0 +1,161 @@
+/*
+ * "git clean" builtin command
+ *
+ * Copyright (C) 2007 Shawn Bohrer
+ *
+ * Based on git-clean.sh by Pavel Roskin
+ */
+
+#include "builtin.h"
+#include "cache.h"
+#include "run-command.h"
+#include "dir.h"
+
+static int disabled = 0;
+static int show_only = 0;
+static int remove_directories = 0;
+static int quiet = 0;
+static int ignored = 0;
+static int ignored_only = 0;
+
+static const char builtin_clean_usage[] =
+"git-clean [-d] [-f] [-n] [-q] [-x | -X] [--] <paths>...";
+
+static int git_clean_config(const char *var, const char *value)
+{
+ if (!strcmp(var, "clean.requireforce")) {
+ disabled = git_config_bool(var, value);
+ }
+ return 0;
+}
+
+int cmd_clean(int argc, const char **argv, const char *prefix)
+{
+ int i;
+ int j;
+ struct child_process cmd;
+ const char **argv_ls_files;
+ char *buf = NULL;
+ char path[1024];
+ FILE *cmd_fout;
+ struct strbuf dir;
+
+ git_config(git_clean_config);
+
+ for (i = 1; i < argc; i++) {
+ const char *arg = argv[i];
+
+ if (arg[0] != '-')
+ break;
+ if (!strcmp(arg, "--")) {
+ i++;
+ break;
+ }
+ if (!strcmp(arg, "-n")) {
+ show_only = 1;
+ disabled = 0;
+ continue;
+ }
+ if (!strcmp(arg, "-f")) {
+ disabled = 0;
+ continue;
+ }
+ if (!strcmp(arg, "-d")) {
+ remove_directories = 1;
+ continue;
+ }
+ if (!strcmp(arg, "-q")) {
+ quiet = 1;
+ continue;
+ }
+ if (!strcmp(arg, "-x")) {
+ ignored = 1;
+ continue;
+ }
+ if (!strcmp(arg, "-X")) {
+ ignored_only = 1;
+ continue;
+ }
+ usage(builtin_clean_usage);
+ }
+
+ if (ignored && ignored_only)
+ usage(builtin_clean_usage);
+
+ if (disabled) {
+ die("clean.requireForce set and -n or -f not given; refusing to clean");
+ }
+
+ /* Paths (argc - i) + 8 (Possible arguments)*/
+ argv_ls_files = xmalloc((argc - i + 8) * sizeof(const char *));
+ argv_ls_files[0] = "ls-files";
+ argv_ls_files[1] = "--others";
+ argv_ls_files[2] = "--directory";
+ j = 3;
+ if (!ignored) {
+ argv_ls_files[j++] = "--exclude-per-directory=.gitignore";
+ if (ignored_only)
+ argv_ls_files[j++] = "--ignored";
+ if (!access(git_path("info/exclude"), F_OK)) {
+ char *exclude_path = git_path("info/exclude");
+ int len = strlen(exclude_path);
+ buf = (char*)malloc(len+16);
+ sprintf(buf, "--exclude-from=%s", exclude_path);
+ argv_ls_files[j++] = buf;
+ }
+ }
+ argv_ls_files[j++] = "--";
+ /* Add remaining paths passed in as arguments */
+ if (argc - i)
+ memcpy(argv_ls_files + j++, argv + i, (argc - i) * sizeof(const char *));
+ argv_ls_files[j + argc - i] = NULL;
+
+ memset(&cmd, 0, sizeof(cmd));
+ cmd.argv = argv_ls_files;
+ cmd.git_cmd = 1;
+ cmd.out = -1;
+ if (start_command(&cmd))
+ die("Could not run sub-command: git ls-files");
+
+ strbuf_init(&dir, 0);
+ cmd_fout = fdopen(cmd.out, "r");
+ while (fgets(path, sizeof(path), cmd_fout) != NULL) {
+ struct stat st;
+ char *p;
+ p = strrchr(path, '\n');
+ if ( p != NULL )
+ *p = '\0';
+ if (!lstat(path, &st) && (S_ISDIR(st.st_mode))) {
+ strbuf_addstr(&dir, path);
+ if (show_only && remove_directories) {
+ printf("Would remove %s\n", dir.buf);
+ } else if (quiet && remove_directories) {
+ remove_dir_recursively(&dir, 0);
+ } else if (remove_directories) {
+ printf("Removing %s\n", path);
+ remove_dir_recursively(&dir, 0);
+ } else if (show_only) {
+ printf("Would not remove %s\n", dir.buf);
+ } else {
+ printf("Not removing %s\n", dir.buf);
+ }
+ strbuf_reset(&dir);
+ } else {
+ if (show_only) {
+ printf("Would remove %s\n", path);
+ continue;
+ } else if (!quiet) {
+ printf("Removing %s\n", path);
+ }
+ unlink(path);
+ }
+ }
+
+ strbuf_release(&dir);
+ fclose(cmd_fout);
+ finish_command(&cmd);
+ if (buf != NULL)
+ free(buf);
+ free(argv_ls_files);
+ return 0;
+}
diff --git a/builtin.h b/builtin.h
index 65cc0fb..cdefdc0 100644
--- a/builtin.h
+++ b/builtin.h
@@ -23,6 +23,7 @@ extern int cmd_check_attr(int argc, const char **argv, const char *prefix);
extern int cmd_check_ref_format(int argc, const char **argv, const char *prefix);
extern int cmd_cherry(int argc, const char **argv, const char *prefix);
extern int cmd_cherry_pick(int argc, const char **argv, const char *prefix);
+extern int cmd_clean(int argc, const char **argv, const char *prefix);
extern int cmd_commit_tree(int argc, const char **argv, const char *prefix);
extern int cmd_count_objects(int argc, const char **argv, const char *prefix);
extern int cmd_describe(int argc, const char **argv, const char *prefix);
diff --git a/git-clean.sh b/contrib/examples/git-clean.sh
similarity index 100%
rename from git-clean.sh
rename to contrib/examples/git-clean.sh
diff --git a/git.c b/git.c
index d7c6bca..4e39169 100644
--- a/git.c
+++ b/git.c
@@ -320,6 +320,7 @@ static void handle_internal_command(int argc, const char **argv)
{ "check-attr", cmd_check_attr, RUN_SETUP | NEED_WORK_TREE },
{ "cherry", cmd_cherry, RUN_SETUP },
{ "cherry-pick", cmd_cherry_pick, RUN_SETUP | NEED_WORK_TREE },
+ { "clean", cmd_clean, RUN_SETUP },
{ "commit-tree", cmd_commit_tree, RUN_SETUP },
{ "config", cmd_config },
{ "count-objects", cmd_count_objects, RUN_SETUP },
--
1.5.3.GIT
^ permalink raw reply related
* Re: [PATCH 1/2] rev-list: implement --bisect-all
From: Johannes Schindelin @ 2007-10-08 5:08 UTC (permalink / raw)
To: Christian Couder; +Cc: Junio Hamano, git
In-Reply-To: <200710080708.46579.chriscool@tuxfamily.org>
Hi,
On Mon, 8 Oct 2007, Christian Couder wrote:
> > IMHO such a logic does not belong into a shell script, but into the C
> > core.
>
> There is a lot of the bisect logic implemented in git-bisect.sh already.
> The long term plan is to rewrite it in C,
Oh? Did I miss something?
> but I am not sure that the "dunno" logic should be the first part of it
> to be done in C.
The thing is, git-bisect is porcelain-ish. And by having a lot of the
functionality there, which is not really porcelain, but plumbing, you
prevent other porcelains, such as git-gui or qgit, from using that
function.
Which is bad.
Ciao,
Dscho
^ permalink raw reply
* Re: [PATCH 2/2] Bisect: implement "bisect dunno" to mark untestable revisions.
From: Christian Couder @ 2007-10-08 5:34 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Junio Hamano, git
In-Reply-To: <Pine.LNX.4.64.0710080444290.4174@racer.site>
Le lundi 8 octobre 2007, Johannes Schindelin a écrit :
> Hi,
>
> On Mon, 8 Oct 2007, Christian Couder wrote:
> > diff --git a/git-bisect.sh b/git-bisect.sh
> > index 388887a..c556318 100755
> > --- a/git-bisect.sh
> > +++ b/git-bisect.sh
> > @@ -143,7 +145,7 @@ bisect_write_bad() {
> >
> > bisect_good() {
> > bisect_autostart
> > - case "$#" in
> > + case "$#" in
>
> White space breakage.
The patch tries to fix some white space breakages.
> > @@ -153,7 +155,6 @@ bisect_good() {
> > rev=$(git rev-parse --verify "$rev^{commit}") || exit
> > bisect_write_good "$rev"
> > echo "git-bisect good $rev" >>"$GIT_DIR/BISECT_LOG"
> > -
>
> ?
It also removes this unneeded blank line.
> > @@ -164,6 +165,28 @@ bisect_write_good() {
> > echo "# good: "$(git show-branch $rev) >>"$GIT_DIR/BISECT_LOG"
> > }
> >
> > +bisect_dunno() {
> > + bisect_autostart
> > + case "$#" in
> > + 0) revs=$(git rev-parse --verify HEAD) || exit ;;
> > + *) revs=$(git rev-parse --revs-only --no-flags "$@") &&
> > + test '' != "$revs" || die "Bad rev input: $@" ;;
> > + esac
> > + for rev in $revs
> > + do
> > + rev=$(git rev-parse --verify "$rev^{commit}") || exit
> > + bisect_write_dunno "$rev"
> > + echo "git-bisect dunno $rev" >>"$GIT_DIR/BISECT_LOG"
>
> Should the last line not be put into bisect_write_dunno? OTOH this is
> the only call site of that function, so I strongly doubt that the
> function (consisting of 3 lines, where the first is 'rev="$1"') is
> necessary at all.
Well, there are "bisect_write_bad" and "bisect_write_good" that already do
the same thing as "bisect_write_dunno". In fact I thought that it was
better to just copy "bisect_dunno" from "bisect_good"
and "bisect_write_dunno" from "bisect_write_good".
If needed I can send another patch to factorise these functions.
> > @@ -206,17 +229,104 @@ bisect_auto_next() {
> > bisect_next_check && bisect_next || :
> > }
> >
> > +search_dunno() {
> > + _hash="$1"
> > + _dunno="$2"
> > +
> > + for _val in $_dunno ; do
> > + case $_hash in $_val) return 1 ;; esac
> > + done
>
> This would be faster as
>
> case " $1" in " $2") return 1 ;; esac
>
> I guess.
I will try your suggestion and send an updated patch. Thanks.
> But as I said in the other reply, I think this logic belongs into the C
> core, instead of generating mostly useless information, passing it down
> to the script, and filtering it out again.
Yeah, it's not efficient.
Best regards,
Christian.
^ permalink raw reply
* Re: [PATCH 2/2] Bisect: implement "bisect dunno" to mark untestable revisions.
From: Johannes Schindelin @ 2007-10-08 5:36 UTC (permalink / raw)
To: Christian Couder; +Cc: Junio Hamano, git
In-Reply-To: <200710080734.23878.chriscool@tuxfamily.org>
Hi,
On Mon, 8 Oct 2007, Christian Couder wrote:
> Le lundi 8 octobre 2007, Johannes Schindelin a ?crit :
>
> > On Mon, 8 Oct 2007, Christian Couder wrote:
> > > diff --git a/git-bisect.sh b/git-bisect.sh
> > > index 388887a..c556318 100755
> > > --- a/git-bisect.sh
> > > +++ b/git-bisect.sh
> > > @@ -143,7 +145,7 @@ bisect_write_bad() {
> > >
> > > bisect_good() {
> > > bisect_autostart
> > > - case "$#" in
> > > + case "$#" in
> >
> > White space breakage.
>
> The patch tries to fix some white space breakages.
>
> > > @@ -153,7 +155,6 @@ bisect_good() {
> > > rev=$(git rev-parse --verify "$rev^{commit}") || exit
> > > bisect_write_good "$rev"
> > > echo "git-bisect good $rev" >>"$GIT_DIR/BISECT_LOG"
> > > -
> >
> > ?
>
> It also removes this unneeded blank line.
Both laudable changes; alas, they distracted me.
> > > @@ -164,6 +165,28 @@ bisect_write_good() {
> > > echo "# good: "$(git show-branch $rev) >>"$GIT_DIR/BISECT_LOG"
> > > }
> > >
> > > +bisect_dunno() {
> > > + bisect_autostart
> > > + case "$#" in
> > > + 0) revs=$(git rev-parse --verify HEAD) || exit ;;
> > > + *) revs=$(git rev-parse --revs-only --no-flags "$@") &&
> > > + test '' != "$revs" || die "Bad rev input: $@" ;;
> > > + esac
> > > + for rev in $revs
> > > + do
> > > + rev=$(git rev-parse --verify "$rev^{commit}") || exit
> > > + bisect_write_dunno "$rev"
> > > + echo "git-bisect dunno $rev" >>"$GIT_DIR/BISECT_LOG"
> >
> > Should the last line not be put into bisect_write_dunno? OTOH this is
> > the only call site of that function, so I strongly doubt that the
> > function (consisting of 3 lines, where the first is 'rev="$1"') is
> > necessary at all.
>
> Well, there are "bisect_write_bad" and "bisect_write_good" that already
> do the same thing as "bisect_write_dunno". In fact I thought that it was
> better to just copy "bisect_dunno" from "bisect_good" and
> "bisect_write_dunno" from "bisect_write_good".
If they also are called by just one site, and also do not do the complete
printing to the log in the function (but also in the caller), I think they
are not really worth it, either.
> If needed I can send another patch to factorise these functions.
That's not up to me to decide. I'm just saying what I dislike.
Please do not take my criticism as a sign of a personal attack; if I did
not find your patch worthwhile, I would not bother to respond. So in a
way, it is my way to show my appreciation for your work that I review and
criticize it; for efficiency, I do not mention what I like ;-)
Ciao,
Dscho
^ permalink raw reply
* Re: Trying to use git-filter-branch to compress history by removing large, obsolete binary files
From: Alex Riesen @ 2007-10-08 6:15 UTC (permalink / raw)
To: Elijah Newren; +Cc: Frank Lichtenheld, git
In-Reply-To: <51419b2c0710071709s2f797df0u986447f5455f306d@mail.gmail.com>
Elijah Newren, Mon, Oct 08, 2007 02:09:50 +0200:
> On 10/7/07, Alex Riesen <raa.lkml@gmail.com> wrote:
> > you missed something. Your example compresses to about 124k.
>
> What version of git are you running? I reran all the steps to which
git version 1.5.3.4.225.g31b973 (irrelevant custom modifications)
> you responded (repeated below for clarity) with git-1.5.3.3 and still
> get 11MB. Also, you must have different filesystem extents than me
> since an empty git repo takes 196k here[1], so I don't think any repo
> is going to get down to 124k.
it is ext3. I do not install the hooks (~8k apparent, ~32k fs blocks)
and never activate logs by default.
> # Use vi to remove the line referring to refs/original...
> git reflog expire --all
another part of the suggestion re reflogs was to look into the logs,
to check if expire actually removed anything. It seems to have been
the culprit.
^ permalink raw reply
* Re: Trying to use git-filter-branch to compress history by removing large, obsolete binary files
From: Johannes Sixt @ 2007-10-08 6:22 UTC (permalink / raw)
To: Johannes Schindelin
Cc: J. Bruce Fields, Elijah Newren, Frank Lichtenheld, git
In-Reply-To: <Pine.LNX.4.64.0710080204140.4174@racer.site>
Johannes Schindelin schrieb:
> The rationale was this: filter-branch recently learnt how to rewrite many
> branches, and it might be tedious to find out which ones. But then, there
> is git log --no-walk --all, so maybe I really should get rid of
> refs/original/*?
>
> I'd like to have some comments from the heavier filter-branch users on
> that...
IMHO, a backup of the original refs is needed. However, it may be wise to
store them in the refs/heads namespace so that 'git branch -d' can delete
them and 'git branch -m' can move them back if something went wrong.
-- Hannes
^ permalink raw reply
* Re: [PATCH] Make git-clean a builtin
From: Johannes Sixt @ 2007-10-08 6:37 UTC (permalink / raw)
To: Jeff King; +Cc: Linus Torvalds, Shawn Bohrer, git, gitster
In-Reply-To: <20071008022205.GA21277@coredump.intra.peff.net>
Jeff King schrieb:
> On Sun, Oct 07, 2007 at 07:17:50PM -0700, Linus Torvalds wrote:
>
>> fchdir() is not portable.
>
> I was using the "even Solaris has it!" test, but yes, it's not POSIX. I
> don't know how common it actually is (for curiosity's sake, do you know
> of a common platform that lacks it?).
Windows. ;)
-- Hannes
^ permalink raw reply
* Re: [StGit PATCH 4/8] Don't split long and short description in "stg edit"
From: Karl Hasselström @ 2007-10-08 6:41 UTC (permalink / raw)
To: Catalin Marinas, git
In-Reply-To: <20071007234009.GA19073@old.davidb.org>
On 2007-10-07 16:40:10 -0700, David Brown wrote:
> On Mon, Oct 08, 2007 at 01:17:35AM +0200, Karl Hasselström wrote:
>
> > "stg edit" used to present the patch information like this:
>
> I think this fix is better to begin with. I found it especially
> confusing when there was only a single line commit message. Now the
> header looks like a header :-)
Yes, that case was confusing too.
--
Karl Hasselström, kha@treskal.com
www.treskal.com/kalle
^ permalink raw reply
* Re: [PATCH] Make strbuf_cmp inline, constify its arguments and optimize it a bit
From: Pierre Habouzit @ 2007-10-08 7:23 UTC (permalink / raw)
To: Miles Bader
Cc: Alex Riesen, Wincent Colaiuta, David Kastrup, Timo Hirvonen, git,
Junio C Hamano
In-Reply-To: <87odfapefc.fsf@catnip.gol.com>
[-- Attachment #1: Type: text/plain, Size: 1482 bytes --]
On Mon, Oct 08, 2007 at 01:45:27AM +0000, Miles Bader wrote:
> Alex Riesen <raa.lkml@gmail.com> writes:
> > int strbuf_cmp2(struct strbuf *a, struct strbuf *b)
> > {
> > int len = a->len < b->len ? a->len: b->len;
> > int cmp = memcmp(a->buf, b->buf, len);
> > if (cmp)
> > return cmp;
> > return a->len < b->len ? -1: a->len != b->len;
> > }
>
> BTW, why are you making such effort to return only -1, 0, or 1 in the
> last line? memcmp/strcmp make no such guarantee; e.g. glibc says:
>
> The `strcmp' function compares the string S1 against S2, returning
> a value that has the same sign as the difference between the first
> differing pair of characters (interpreted as `unsigned char'
> objects, then promoted to `int').
>
> If the two strings are equal, `strcmp' returns `0'.
>
> A consequence of the ordering used by `strcmp' is that if S1 is an
> initial substring of S2, then S1 is considered to be "less than"
> S2.
>
> So I think the last line can just be:
>
> return a->len - b->len;
Won't work because ->len are size_t and return value is int, so on 64
bits platform, this has chances to overflow.
FWIW I believe we are doing micro-benchs in a function that is used in
2 places in git right now.
--
·O· Pierre Habouzit
··O madcoder@debian.org
OOO http://www.madism.org
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* Re: [PATCH 1/2] Have a filter_start/filter_end API.
From: Pierre Habouzit @ 2007-10-08 7:29 UTC (permalink / raw)
To: Alex Riesen; +Cc: Linus Torvalds, Junio C Hamano, git
In-Reply-To: <20071007215041.GB2765@steel.home>
[-- Attachment #1: Type: text/plain, Size: 1664 bytes --]
On Sun, Oct 07, 2007 at 09:50:41PM +0000, Alex Riesen wrote:
> Pierre Habouzit, Sun, Oct 07, 2007 18:52:18 +0200:
> > Though, those are both things that I find ugly to "know" in convert.c.
> > How things are allocated in strbufs is one of the few things we don't
> > want to assume anywhere outside of the strbuf module.
>
> src is outside of strbuf scope. It is not internal to struct strbuf.
> The caller must already know if it is inside of the given strbuf
> instance.
>
> need_realloc is covered by make_room, isn't it?
Internally yes, but make_room may move the buffer, if that happens,
there is nothing we can do, in the case where we point inside (or at the
begining of - fwiw it's the same here) the buffer
> I'd suggest just fix the caller, it is simple in convert.c: just use
> ret, which contains exactly this information. If you insist on editing
> in-place, which makes your routines really need the in-placeability
> informaion. Just give it to them, better explicitely. All of this
> makes the routines very convert.c specific, which is the reason why I
> argument to have them just there and nowhere else.
>
> Alternatively, one can memdup ->buf (as it is the input for next
> filter) every time a filter modifies it (which is safe, but simple,
> slow, requires memory, and may fragment heap):
This is exactly what we are trying to avoid with the current form.
Given how you try to micro-optimize strbuf_cmp I'm a bit lost here…
--
·O· Pierre Habouzit
··O madcoder@debian.org
OOO http://www.madism.org
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* Re: [PATCH] Make strbuf_cmp inline, constify its arguments and optimize it a bit
From: Florian Weimer @ 2007-10-08 8:54 UTC (permalink / raw)
To: Pierre Habouzit
Cc: Miles Bader, Alex Riesen, Wincent Colaiuta, David Kastrup,
Timo Hirvonen, git, Junio C Hamano
In-Reply-To: <20071008072312.GA22552@artemis.corp>
* Pierre Habouzit:
>> So I think the last line can just be:
>>
>> return a->len - b->len;
>
> Won't work because ->len are size_t and return value is int, so on 64
> bits platform, this has chances to overflow.
Nit: It can overflow on 32-bit, too.
And "int len" in the first line of the function body should be
"size_t len".
Moving that to a compare_int/compare_size_t function should help;
AFAIK there's no short idiom which does the job.
--
Florian Weimer <fweimer@bfk.de>
BFK edv-consulting GmbH http://www.bfk.de/
Kriegsstraße 100 tel: +49-721-96201-1
D-76133 Karlsruhe fax: +49-721-96201-99
^ permalink raw reply
* [StGit PATCH 2/6] Use our nice message printout wrapping system
From: Karl Hasselström @ 2007-10-08 8:55 UTC (permalink / raw)
To: Catalin Marinas; +Cc: git
In-Reply-To: <20071008085430.9734.75797.stgit@yoghurt>
Signed-off-by: Karl Hasselström <kha@treskal.com>
---
stgit/main.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/stgit/main.py b/stgit/main.py
index 15582dd..8e00217 100644
--- a/stgit/main.py
+++ b/stgit/main.py
@@ -282,7 +282,7 @@ def main():
command.func(parser, options, args)
except (StgException, IOError, ParsingError, NoSectionError), err:
- print >> sys.stderr, '%s %s: %s' % (prog, cmd, err)
+ out.error(str(err), title = '%s %s' % (prog, cmd))
if debug_level > 0:
raise
else:
^ permalink raw reply related
* [StGit PATCH 0/6] Survive capital punishment
From: Karl Hasselström @ 2007-10-08 8:55 UTC (permalink / raw)
To: Catalin Marinas; +Cc: git
This series allows StGit to deal with a detached HEAD: in most cases
it will just exit with a nice error message, but in some cases it will
actually handle it.
Preceded by some more or less related cleanups. (The "explicit
crt_series" patch was needed so that I could grep for the files that
didn't contain crt_series.)
---
Karl Hasselström (6):
Let some commands work with detached HEAD
Don't have a global crt_series in stgit.commans.common
Refactor crt_series creation
Properly detect that HEAD is detached
Use our nice message printout wrapping system
Allow caller to customize title of error/warning message
stgit/commands/add.py | 2 +-
stgit/commands/branch.py | 8 ++++----
stgit/commands/clean.py | 4 ++--
stgit/commands/clone.py | 2 +-
stgit/commands/commit.py | 2 +-
stgit/commands/common.py | 24 ++++++++++++------------
stgit/commands/delete.py | 4 ++--
stgit/commands/diff.py | 9 +++++----
stgit/commands/edit.py | 6 +++---
stgit/commands/files.py | 4 ++--
stgit/commands/float.py | 6 +++---
stgit/commands/fold.py | 5 +++--
stgit/commands/goto.py | 8 ++++----
stgit/commands/id.py | 2 +-
stgit/commands/imprt.py | 7 ++++---
stgit/commands/mail.py | 16 +++++++++-------
stgit/commands/new.py | 2 +-
stgit/commands/pick.py | 12 ++++++------
stgit/commands/pop.py | 8 ++++----
stgit/commands/pull.py | 14 +++++++-------
stgit/commands/push.py | 8 ++++----
stgit/commands/rebase.py | 12 ++++++------
stgit/commands/refresh.py | 10 +++++-----
stgit/commands/resolved.py | 2 +-
stgit/commands/series.py | 5 +++--
stgit/commands/show.py | 2 +-
stgit/commands/sink.py | 6 +++---
stgit/commands/status.py | 2 +-
stgit/commands/sync.py | 8 ++++----
stgit/commands/uncommit.py | 2 +-
stgit/git.py | 23 +++++++++++++++++------
stgit/main.py | 8 +++-----
stgit/out.py | 12 ++++++------
33 files changed, 130 insertions(+), 115 deletions(-)
--
Karl Hasselström, kha@treskal.com
www.treskal.com/kalle
^ permalink raw reply
* [StGit PATCH 1/6] Allow caller to customize title of error/warning message
From: Karl Hasselström @ 2007-10-08 8:55 UTC (permalink / raw)
To: Catalin Marinas; +Cc: git
In-Reply-To: <20071008085430.9734.75797.stgit@yoghurt>
Signed-off-by: Karl Hasselström <kha@treskal.com>
---
stgit/out.py | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/stgit/out.py b/stgit/out.py
index 3464175..d3c86b4 100644
--- a/stgit/out.py
+++ b/stgit/out.py
@@ -85,12 +85,12 @@ class MessagePrinter(object):
def info(self, *msgs):
for msg in msgs:
self.__out.single_line(msg)
- def note(self, *msgs):
- self.__out.tagged_lines('Notice', msgs)
- def warn(self, *msgs):
- self.__err.tagged_lines('Warning', msgs)
- def error(self, *msgs):
- self.__err.tagged_lines('Error', msgs)
+ def note(self, *msgs, **kw):
+ self.__out.tagged_lines(kw.get('title', 'Notice'), msgs)
+ def warn(self, *msgs, **kw):
+ self.__err.tagged_lines(kw.get('title', 'Warning'), msgs)
+ def error(self, *msgs, **kw):
+ self.__err.tagged_lines(kw.get('title', 'Error'), msgs)
def start(self, msg):
"""Start a long-running operation."""
self.__out.single_line('%s ... ' % msg, print_newline = False)
^ permalink raw reply related
* [StGit PATCH 3/6] Properly detect that HEAD is detached
From: Karl Hasselström @ 2007-10-08 8:55 UTC (permalink / raw)
To: Catalin Marinas; +Cc: git
In-Reply-To: <20071008085430.9734.75797.stgit@yoghurt>
We still error out on a lot of places we shouldn't, e.g. "stg branch"
when on a detached HEAD, but at least now we give a sane error
message.
Signed-off-by: Karl Hasselström <kha@treskal.com>
---
stgit/git.py | 23 +++++++++++++++++------
1 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/stgit/git.py b/stgit/git.py
index 812b77a..cc6acb1 100644
--- a/stgit/git.py
+++ b/stgit/git.py
@@ -246,11 +246,19 @@ def get_head():
__head = rev_parse('HEAD')
return __head
+class DetachedHeadException(GitException):
+ def __init__(self):
+ GitException.__init__(self, 'Not on any branch')
+
def get_head_file():
- """Returns the name of the file pointed to by the HEAD link
- """
- return strip_prefix('refs/heads/',
- GRun('git-symbolic-ref', 'HEAD').output_one_line())
+ """Return the name of the file pointed to by the HEAD symref.
+ Throw an exception if HEAD is detached."""
+ try:
+ return strip_prefix(
+ 'refs/heads/', GRun('git-symbolic-ref', '-q', 'HEAD'
+ ).output_one_line())
+ except GitRunException:
+ raise DetachedHeadException()
def set_head_file(ref):
"""Resets HEAD to point to a new ref
@@ -385,8 +393,11 @@ def rename_ref(from_ref, to_ref):
def rename_branch(from_name, to_name):
"""Rename a git branch."""
rename_ref('refs/heads/%s' % from_name, 'refs/heads/%s' % to_name)
- if get_head_file() == from_name:
- set_head_file(to_name)
+ try:
+ if get_head_file() == from_name:
+ set_head_file(to_name)
+ except DetachedHeadException:
+ pass # detached HEAD, so the renamee can't be the current branch
reflog_dir = os.path.join(basedir.get(), 'logs', 'refs', 'heads')
if os.path.exists(reflog_dir) \
and os.path.exists(os.path.join(reflog_dir, from_name)):
^ permalink raw reply related
* [StGit PATCH 4/6] Refactor crt_series creation
From: Karl Hasselström @ 2007-10-08 8:55 UTC (permalink / raw)
To: Catalin Marinas; +Cc: git
In-Reply-To: <20071008085430.9734.75797.stgit@yoghurt>
Instead of hard-coding in main.py which commands do and don't need a
current series, let them speak for themselves.
Signed-off-by: Karl Hasselström <kha@treskal.com>
---
stgit/commands/clone.py | 2 +-
stgit/commands/common.py | 2 ++
stgit/main.py | 5 ++---
3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/stgit/commands/clone.py b/stgit/commands/clone.py
index a150010..c3b0bbe 100644
--- a/stgit/commands/clone.py
+++ b/stgit/commands/clone.py
@@ -29,7 +29,7 @@ usage = """%prog [options] <repository> <dir>
Clone a GIT <repository> into the local <dir> and initialise the
patch stack."""
-directory = DirectoryAnywhere()
+directory = DirectoryAnywhere(needs_current_series = False)
options = []
diff --git a/stgit/commands/common.py b/stgit/commands/common.py
index 27ef465..652039f 100644
--- a/stgit/commands/common.py
+++ b/stgit/commands/common.py
@@ -497,6 +497,8 @@ class DirectoryException(StgException):
pass
class _Directory(object):
+ def __init__(self, needs_current_series = True):
+ self.needs_current_series = needs_current_series
@readonly_constant_property
def git_dir(self):
try:
diff --git a/stgit/main.py b/stgit/main.py
index 8e00217..db327f1 100644
--- a/stgit/main.py
+++ b/stgit/main.py
@@ -271,9 +271,8 @@ def main():
directory.setup()
config_setup()
- # 'clone' doesn't expect an already initialised GIT tree. A Series
- # object will be created after the GIT tree is cloned
- if cmd != 'clone':
+ # Some commands don't (always) need an initialized series.
+ if directory.needs_current_series:
if hasattr(options, 'branch') and options.branch:
command.crt_series = Series(options.branch)
else:
^ permalink raw reply related
* [StGit PATCH 5/6] Don't have a global crt_series in stgit.commans.common
From: Karl Hasselström @ 2007-10-08 8:55 UTC (permalink / raw)
To: Catalin Marinas; +Cc: git
In-Reply-To: <20071008085430.9734.75797.stgit@yoghurt>
Global variables baaad. Instead, pass it as a parameter to the
functions that need it.
Signed-off-by: Karl Hasselström <kha@treskal.com>
---
stgit/commands/branch.py | 8 ++++----
stgit/commands/clean.py | 4 ++--
stgit/commands/commit.py | 2 +-
stgit/commands/common.py | 22 ++++++++++------------
stgit/commands/delete.py | 4 ++--
stgit/commands/diff.py | 7 ++++---
stgit/commands/edit.py | 6 +++---
stgit/commands/files.py | 4 ++--
stgit/commands/float.py | 6 +++---
stgit/commands/fold.py | 5 +++--
stgit/commands/goto.py | 8 ++++----
stgit/commands/id.py | 2 +-
stgit/commands/imprt.py | 7 ++++---
stgit/commands/mail.py | 16 +++++++++-------
stgit/commands/new.py | 2 +-
stgit/commands/pick.py | 12 ++++++------
stgit/commands/pop.py | 8 ++++----
stgit/commands/pull.py | 14 +++++++-------
stgit/commands/push.py | 8 ++++----
stgit/commands/rebase.py | 12 ++++++------
stgit/commands/refresh.py | 10 +++++-----
stgit/commands/series.py | 5 +++--
stgit/commands/show.py | 2 +-
stgit/commands/sink.py | 6 +++---
stgit/commands/sync.py | 8 ++++----
stgit/commands/uncommit.py | 2 +-
stgit/main.py | 1 -
27 files changed, 97 insertions(+), 94 deletions(-)
diff --git a/stgit/commands/branch.py b/stgit/commands/branch.py
index 6e0a6d8..cbb97f6 100644
--- a/stgit/commands/branch.py
+++ b/stgit/commands/branch.py
@@ -112,7 +112,7 @@ def func(parser, options, args):
check_local_changes()
check_conflicts()
- check_head_top_equal()
+ check_head_top_equal(crt_series)
tree_id = None
if len(args) >= 2:
@@ -141,7 +141,7 @@ def func(parser, options, args):
# exception in branch = rev_parse() leaves branchpoint unbound
branchpoint = None
- tree_id = branchpoint or git_id(args[1])
+ tree_id = branchpoint or git_id(crt_series, args[1])
if parentbranch:
out.info('Recording "%s" as parent branch' % parentbranch)
@@ -182,7 +182,7 @@ def func(parser, options, args):
check_local_changes()
check_conflicts()
- check_head_top_equal()
+ check_head_top_equal(crt_series)
out.start('Cloning current branch to "%s"' % clone)
crt_series.clone(clone)
@@ -294,7 +294,7 @@ def func(parser, options, args):
check_local_changes()
check_conflicts()
- check_head_top_equal()
+ check_head_top_equal(crt_series)
out.start('Switching to branch "%s"' % args[0])
git.switch_branch(args[0])
diff --git a/stgit/commands/clean.py b/stgit/commands/clean.py
index d8bbe71..4484ecd 100644
--- a/stgit/commands/clean.py
+++ b/stgit/commands/clean.py
@@ -61,7 +61,7 @@ def func(parser, options, args):
check_local_changes()
check_conflicts()
- check_head_top_equal()
+ check_head_top_equal(crt_series)
if not (options.applied or options.unapplied):
options.applied = options.unapplied = True
@@ -74,4 +74,4 @@ def func(parser, options, args):
unapplied = crt_series.get_unapplied()
__delete_empty(unapplied, False)
- print_crt_patch()
+ print_crt_patch(crt_series)
diff --git a/stgit/commands/commit.py b/stgit/commands/commit.py
index 2b45c0d..23b4dc1 100644
--- a/stgit/commands/commit.py
+++ b/stgit/commands/commit.py
@@ -45,7 +45,7 @@ def func(parser, options, args):
check_local_changes()
check_conflicts()
- check_head_top_equal()
+ check_head_top_equal(crt_series)
applied = crt_series.get_applied()
if not applied:
diff --git a/stgit/commands/common.py b/stgit/commands/common.py
index 652039f..2a80e8c 100644
--- a/stgit/commands/common.py
+++ b/stgit/commands/common.py
@@ -28,8 +28,6 @@ from stgit.run import *
from stgit import stack, git, basedir
from stgit.config import config, file_extensions
-crt_series = None
-
# Command exception class
class CmdException(StgException):
@@ -74,7 +72,7 @@ def parse_rev(rev):
# No, we can't parse that.
raise RevParseException
-def git_id(rev):
+def git_id(crt_series, rev):
"""Return the GIT id
"""
if not rev:
@@ -112,7 +110,7 @@ def check_local_changes():
raise CmdException, \
'local changes in the tree. Use "refresh" or "status --reset"'
-def check_head_top_equal():
+def check_head_top_equal(crt_series):
if not crt_series.head_top_equal():
raise CmdException(
"""HEAD and top are not the same. This can happen if you
@@ -125,7 +123,7 @@ def check_conflicts():
'Unsolved conflicts. Please resolve them first or\n' \
' revert the changes with "status --reset"'
-def print_crt_patch(branch = None):
+def print_crt_patch(crt_series, branch = None):
if not branch:
patch = crt_series.get_current()
else:
@@ -158,7 +156,7 @@ def resolved_all(reset = None):
resolved(filename, reset)
os.remove(os.path.join(basedir.get(), 'conflicts'))
-def push_patches(patches, check_merged = False):
+def push_patches(crt_series, patches, check_merged = False):
"""Push multiple patches onto the stack. This function is shared
between the push and pull commands
"""
@@ -197,7 +195,7 @@ def push_patches(patches, check_merged = False):
else:
out.done()
-def pop_patches(patches, keep = False):
+def pop_patches(crt_series, patches, keep = False):
"""Pop the patches in the list from the stack. It is assumed that
the patches are listed in the stack reverse order.
"""
@@ -319,7 +317,7 @@ def address_or_alias(addr_str):
for addr in addr_str.split(',')]
return ', '.join([addr for addr in addr_list if addr])
-def prepare_rebase():
+def prepare_rebase(crt_series):
# pop all patches
applied = crt_series.get_applied()
if len(applied) > 0:
@@ -328,9 +326,9 @@ def prepare_rebase():
out.done()
return applied
-def rebase(target):
+def rebase(crt_series, target):
try:
- tree_id = git_id(target)
+ tree_id = git_id(crt_series, target)
except:
# it might be that we use a custom rebase command with its own
# target type
@@ -345,12 +343,12 @@ def rebase(target):
git.rebase(tree_id = tree_id)
out.done()
-def post_rebase(applied, nopush, merged):
+def post_rebase(crt_series, applied, nopush, merged):
# memorize that we rebased to here
crt_series._set_field('orig-base', git.get_head())
# push the patches back
if not nopush:
- push_patches(applied, merged)
+ push_patches(crt_series, applied, merged)
#
# Patch description/e-mail/diff parsing
diff --git a/stgit/commands/delete.py b/stgit/commands/delete.py
index 8462857..fdb254e 100644
--- a/stgit/commands/delete.py
+++ b/stgit/commands/delete.py
@@ -71,7 +71,7 @@ def func(parser, options, args):
if applied and not options.branch:
check_local_changes()
check_conflicts()
- check_head_top_equal()
+ check_head_top_equal(crt_series)
# delete the patches
for patch in applied + patches:
@@ -79,4 +79,4 @@ def func(parser, options, args):
out.info('Patch "%s" successfully deleted' % patch)
if not options.branch:
- print_crt_patch()
+ print_crt_patch(crt_series)
diff --git a/stgit/commands/diff.py b/stgit/commands/diff.py
index f3b0ea2..42e8367 100644
--- a/stgit/commands/diff.py
+++ b/stgit/commands/diff.py
@@ -86,9 +86,10 @@ def func(parser, options, args):
diff_flags = []
if options.stat:
- out.stdout_raw(git.diffstat(args, git_id(rev1), git_id(rev2)) + '\n')
+ out.stdout_raw(git.diffstat(args, git_id(crt_series, rev1),
+ git_id(crt_series, rev2)) + '\n')
else:
- diff_str = git.diff(args, git_id(rev1), git_id(rev2),
- diff_flags = diff_flags )
+ diff_str = git.diff(args, git_id(crt_series, rev1),
+ git_id(crt_series, rev2), diff_flags = diff_flags )
if diff_str:
pager(diff_str)
diff --git a/stgit/commands/edit.py b/stgit/commands/edit.py
index 02970bc..89d534a 100644
--- a/stgit/commands/edit.py
+++ b/stgit/commands/edit.py
@@ -203,13 +203,13 @@ def func(parser, options, args):
check_local_changes()
check_conflicts()
- check_head_top_equal()
+ check_head_top_equal(crt_series)
if pname != crt_pname:
# Go to the patch to be edited
applied = crt_series.get_applied()
between = applied[:applied.index(pname):-1]
- pop_patches(between)
+ pop_patches(crt_series, between)
if options.author:
options.authname, options.authemail = name_email(options.author)
@@ -241,4 +241,4 @@ def func(parser, options, args):
if pname != crt_pname:
# Push the patches back
between.reverse()
- push_patches(between)
+ push_patches(crt_series, between)
diff --git a/stgit/commands/files.py b/stgit/commands/files.py
index 07cc955..4550251 100644
--- a/stgit/commands/files.py
+++ b/stgit/commands/files.py
@@ -57,8 +57,8 @@ def func(parser, options, args):
else:
parser.error('incorrect number of arguments')
- rev1 = git_id('%s//bottom' % patch)
- rev2 = git_id('%s//top' % patch)
+ rev1 = git_id(crt_series, '%s//bottom' % patch)
+ rev2 = git_id(crt_series, '%s//top' % patch)
if options.stat:
out.stdout_raw(git.diffstat(rev1 = rev1, rev2 = rev2) + '\n')
diff --git a/stgit/commands/float.py b/stgit/commands/float.py
index d5299fb..6c07136 100644
--- a/stgit/commands/float.py
+++ b/stgit/commands/float.py
@@ -46,7 +46,7 @@ def func(parser, options, args):
check_local_changes()
check_conflicts()
- check_head_top_equal()
+ check_head_top_equal(crt_series)
unapplied = crt_series.get_unapplied()
applied = crt_series.get_applied()
@@ -85,7 +85,7 @@ def func(parser, options, args):
# check whether the operation is really needed
if topop != topush:
if topop:
- pop_patches(topop)
+ pop_patches(crt_series, topop)
if topush:
topush.reverse()
- push_patches(topush)
+ push_patches(crt_series, topush)
diff --git a/stgit/commands/fold.py b/stgit/commands/fold.py
index 6e43101..3930a1f 100644
--- a/stgit/commands/fold.py
+++ b/stgit/commands/fold.py
@@ -50,7 +50,7 @@ def func(parser, options, args):
check_local_changes()
check_conflicts()
- check_head_top_equal()
+ check_head_top_equal(crt_series)
if len(args) == 1:
filename = args[0]
@@ -74,7 +74,8 @@ def func(parser, options, args):
bottom = crt_patch.get_bottom()
git.apply_patch(filename = filename, base = bottom)
elif options.base:
- git.apply_patch(filename = filename, base = git_id(options.base))
+ git.apply_patch(filename = filename,
+ base = git_id(crt_series, options.base))
else:
git.apply_patch(filename = filename)
diff --git a/stgit/commands/goto.py b/stgit/commands/goto.py
index 9e008a9..e7aa588 100644
--- a/stgit/commands/goto.py
+++ b/stgit/commands/goto.py
@@ -44,7 +44,7 @@ def func(parser, options, args):
parser.error('incorrect number of arguments')
check_conflicts()
- check_head_top_equal()
+ check_head_top_equal(crt_series)
if not options.keep:
check_local_changes()
@@ -56,13 +56,13 @@ def func(parser, options, args):
if patch in applied:
applied.reverse()
patches = applied[:applied.index(patch)]
- pop_patches(patches, options.keep)
+ pop_patches(crt_series, patches, options.keep)
elif patch in unapplied:
if options.keep:
raise CmdException, 'Cannot use --keep with patch pushing'
patches = unapplied[:unapplied.index(patch)+1]
- push_patches(patches)
+ push_patches(crt_series, patches)
else:
raise CmdException, 'Patch "%s" does not exist' % patch
- print_crt_patch()
+ print_crt_patch(crt_series)
diff --git a/stgit/commands/id.py b/stgit/commands/id.py
index 3e28f2f..94b0229 100644
--- a/stgit/commands/id.py
+++ b/stgit/commands/id.py
@@ -48,4 +48,4 @@ def func(parser, options, args):
else:
parser.error('incorrect number of arguments')
- out.stdout(git_id(id_str))
+ out.stdout(git_id(crt_series, id_str))
diff --git a/stgit/commands/imprt.py b/stgit/commands/imprt.py
index 045f185..d6e950c 100644
--- a/stgit/commands/imprt.py
+++ b/stgit/commands/imprt.py
@@ -165,7 +165,8 @@ def __create_patch(filename, message, author_name, author_email,
else:
out.start('Importing patch "%s"' % patch)
if options.base:
- git.apply_patch(diff = diff, base = git_id(options.base))
+ git.apply_patch(diff = diff,
+ base = git_id(crt_series, options.base))
else:
git.apply_patch(diff = diff)
crt_series.refresh_patch(edit = options.edit,
@@ -270,7 +271,7 @@ def func(parser, options, args):
check_local_changes()
check_conflicts()
- check_head_top_equal()
+ check_head_top_equal(crt_series)
if len(args) == 1:
filename = args[0]
@@ -286,4 +287,4 @@ def func(parser, options, args):
else:
__import_file(filename, options)
- print_crt_patch()
+ print_crt_patch(crt_series)
diff --git a/stgit/commands/mail.py b/stgit/commands/mail.py
index 4a4158a..883a4f3 100644
--- a/stgit/commands/mail.py
+++ b/stgit/commands/mail.py
@@ -350,8 +350,8 @@ def __build_cover(tmpl, patches, msg_id, options):
'shortlog': stack.shortlog(crt_series.get_patch(p)
for p in patches),
'diffstat': git.diffstat(
- rev1 = git_id('%s//bottom' % patches[0]),
- rev2 = git_id('%s//top' % patches[-1]))}
+ rev1 = git_id(crt_series, '%s//bottom' % patches[0]),
+ rev2 = git_id(crt_series, '%s//top' % patches[-1]))}
try:
msg_string = tmpl % tmpl_dict
@@ -435,11 +435,13 @@ def __build_message(tmpl, patch, patch_nr, total_nr, msg_id, ref_id, options):
'longdescr': long_descr,
# for backward template compatibility
'endofheaders': '',
- 'diff': git.diff(rev1 = git_id('%s//bottom' % patch),
- rev2 = git_id('%s//top' % patch),
- diff_flags = diff_flags ),
- 'diffstat': git.diffstat(rev1 = git_id('%s//bottom'%patch),
- rev2 = git_id('%s//top' % patch)),
+ 'diff': git.diff(
+ rev1 = git_id(crt_series, '%s//bottom' % patch),
+ rev2 = git_id(crt_series, '%s//top' % patch),
+ diff_flags = diff_flags),
+ 'diffstat': git.diffstat(
+ rev1 = git_id(crt_series, '%s//bottom'%patch),
+ rev2 = git_id(crt_series, '%s//top' % patch)),
# for backward template compatibility
'date': '',
'version': version_str,
diff --git a/stgit/commands/new.py b/stgit/commands/new.py
index ccc8141..b0a57d1 100644
--- a/stgit/commands/new.py
+++ b/stgit/commands/new.py
@@ -70,7 +70,7 @@ def func(parser, options, args):
parser.error('incorrect number of arguments')
check_conflicts()
- check_head_top_equal()
+ check_head_top_equal(crt_series)
if options.author:
options.authname, options.authemail = name_email(options.author)
diff --git a/stgit/commands/pick.py b/stgit/commands/pick.py
index 3acec32..1fcc2e2 100644
--- a/stgit/commands/pick.py
+++ b/stgit/commands/pick.py
@@ -65,10 +65,10 @@ def func(parser, options, args):
if not options.unapplied:
check_local_changes()
check_conflicts()
- check_head_top_equal()
+ check_head_top_equal(crt_series)
commit_str = args[0]
- commit_id = git_id(commit_str)
+ commit_id = git_id(crt_series, commit_str)
commit = git.Commit(commit_id)
if options.fold or options.update:
@@ -84,7 +84,7 @@ def func(parser, options, args):
patchname = None
if options.parent:
- parent = git_id(options.parent)
+ parent = git_id(crt_series, options.parent)
else:
parent = commit.get_parent()
@@ -104,8 +104,8 @@ def func(parser, options, args):
out.done()
elif options.update:
- rev1 = git_id('//bottom')
- rev2 = git_id('//top')
+ rev1 = git_id(crt_series, '//bottom')
+ rev2 = git_id(crt_series, '//top')
files = git.barefiles(rev1, rev2).split('\n')
out.start('Updating with commit %s' % commit_id)
@@ -163,4 +163,4 @@ def func(parser, options, args):
else:
out.done()
- print_crt_patch()
+ print_crt_patch(crt_series)
diff --git a/stgit/commands/pop.py b/stgit/commands/pop.py
index a1d73e4..246cc34 100644
--- a/stgit/commands/pop.py
+++ b/stgit/commands/pop.py
@@ -51,7 +51,7 @@ def func(parser, options, args):
"""Pop the topmost patch from the stack
"""
check_conflicts()
- check_head_top_equal()
+ check_head_top_equal(crt_series)
if not options.keep:
check_local_changes()
@@ -83,8 +83,8 @@ def func(parser, options, args):
raise CmdException, 'Cannot pop arbitrary patches with --keep'
topop.reverse()
- pop_patches(topop, options.keep)
+ pop_patches(crt_series, topop, options.keep)
if topush:
- push_patches(topush)
+ push_patches(crt_series, topush)
- print_crt_patch()
+ print_crt_patch(crt_series)
diff --git a/stgit/commands/pull.py b/stgit/commands/pull.py
index 5fcf2cc..e5ee17d 100644
--- a/stgit/commands/pull.py
+++ b/stgit/commands/pull.py
@@ -74,12 +74,12 @@ def func(parser, options, args):
check_local_changes()
check_conflicts()
- check_head_top_equal()
+ check_head_top_equal(crt_series)
if policy not in ['pull', 'fetch-rebase', 'rebase']:
raise GitConfigException, 'Unsupported pull-policy "%s"' % policy
- applied = prepare_rebase()
+ applied = prepare_rebase(crt_series)
# pull the remote changes
if policy == 'pull':
@@ -92,17 +92,17 @@ def func(parser, options, args):
target = git.fetch_head()
except git.GitException:
out.error('Could not find the remote head to rebase onto, pushing any patches back...')
- post_rebase(applied, False, False)
+ post_rebase(crt_series, applied, False, False)
raise CmdException, 'Could not find the remote head to rebase onto - fix branch.%s.merge in .git/config' % crt_series.get_name()
- rebase(target)
+ rebase(crt_series, target)
elif policy == 'rebase':
- rebase(crt_series.get_parent_branch())
+ rebase(crt_series, crt_series.get_parent_branch())
- post_rebase(applied, options.nopush, options.merged)
+ post_rebase(crt_series, applied, options.nopush, options.merged)
# maybe tidy up
if config.get('stgit.keepoptimized') == 'yes':
git.repack()
- print_crt_patch()
+ print_crt_patch(crt_series)
diff --git a/stgit/commands/push.py b/stgit/commands/push.py
index 4d5de26..979835b 100644
--- a/stgit/commands/push.py
+++ b/stgit/commands/push.py
@@ -72,13 +72,13 @@ def func(parser, options, args):
out.done()
else:
out.done('patch unchanged')
- print_crt_patch()
+ print_crt_patch(crt_series)
return
check_local_changes()
check_conflicts()
- check_head_top_equal()
+ check_head_top_equal(crt_series)
unapplied = crt_series.get_unapplied()
if not unapplied:
@@ -99,6 +99,6 @@ def func(parser, options, args):
if options.reverse:
patches.reverse()
- push_patches(patches, options.merged)
+ push_patches(crt_series, patches, options.merged)
- print_crt_patch()
+ print_crt_patch(crt_series)
diff --git a/stgit/commands/rebase.py b/stgit/commands/rebase.py
index bbb3e12..c4d74b7 100644
--- a/stgit/commands/rebase.py
+++ b/stgit/commands/rebase.py
@@ -48,14 +48,14 @@ def func(parser, options, args):
check_local_changes()
check_conflicts()
- check_head_top_equal()
+ check_head_top_equal(crt_series)
# ensure an exception is raised before popping on non-existent target
- if git_id(args[0]) == None:
+ if git_id(crt_series, args[0]) == None:
raise GitException, 'Unknown revision: %s' % args[0]
- applied = prepare_rebase()
- rebase(args[0])
- post_rebase(applied, options.nopush, options.merged)
+ applied = prepare_rebase(crt_series)
+ rebase(crt_series, args[0])
+ post_rebase(crt_series, applied, options.nopush, options.merged)
- print_crt_patch()
+ print_crt_patch(crt_series)
diff --git a/stgit/commands/refresh.py b/stgit/commands/refresh.py
index f032375..7cde392 100644
--- a/stgit/commands/refresh.py
+++ b/stgit/commands/refresh.py
@@ -73,7 +73,7 @@ def func(parser, options, args):
raise CmdException, 'No patches applied'
if not options.force:
- check_head_top_equal()
+ check_head_top_equal(crt_series)
if options.undo:
out.start('Undoing the refresh of "%s"' % patch)
@@ -89,10 +89,10 @@ def func(parser, options, args):
if options.patch:
applied = crt_series.get_applied()
between = applied[:applied.index(patch):-1]
- pop_patches(between, keep = True)
+ pop_patches(crt_series, between, keep = True)
elif options.update:
- rev1 = git_id('//bottom')
- rev2 = git_id('//top')
+ rev1 = git_id(crt_series, '//bottom')
+ rev2 = git_id(crt_series, '//top')
patch_files = git.barefiles(rev1, rev2).split('\n')
files = [f for f in files if f in patch_files]
if not files:
@@ -113,7 +113,7 @@ def func(parser, options, args):
if options.patch:
between.reverse()
- push_patches(between)
+ push_patches(crt_series, between)
elif options.annotate:
# only annotate the top log entry as there is no need to
# refresh the patch and generate a full commit
diff --git a/stgit/commands/series.py b/stgit/commands/series.py
index 2c75876..4c6d07e 100644
--- a/stgit/commands/series.py
+++ b/stgit/commands/series.py
@@ -195,12 +195,13 @@ def func(parser, options, args):
raise CmdException, '--graphical not supported with --missing'
if applied:
- gitk_args = ' %s^..%s' % (git_id(applied[0]), git_id(applied[-1]))
+ gitk_args = ' %s^..%s' % (git_id(crt_series, applied[0]),
+ git_id(crt_series, applied[-1]))
else:
gitk_args = ''
for p in unapplied:
- patch_id = git_id(p)
+ patch_id = git_id(crt_series, p)
gitk_args += ' %s^..%s' % (patch_id, patch_id)
if os.system('gitk%s' % gitk_args) != 0:
diff --git a/stgit/commands/show.py b/stgit/commands/show.py
index 7efb4e1..e4e70a5 100644
--- a/stgit/commands/show.py
+++ b/stgit/commands/show.py
@@ -69,7 +69,7 @@ def func(parser, options, args):
else:
diff_flags = []
- commit_ids = [git_id(patch) for patch in patches]
+ commit_ids = [git_id(crt_series, patch) for patch in patches]
commit_str = '\n'.join([git.pretty_commit(commit_id, diff_flags=diff_flags)
for commit_id in commit_ids])
if commit_str:
diff --git a/stgit/commands/sink.py b/stgit/commands/sink.py
index 737dde0..b177337 100644
--- a/stgit/commands/sink.py
+++ b/stgit/commands/sink.py
@@ -45,7 +45,7 @@ def func(parser, options, args):
check_local_changes()
check_conflicts()
- check_head_top_equal()
+ check_head_top_equal(crt_series)
oldapplied = crt_series.get_applied()
unapplied = crt_series.get_unapplied()
@@ -61,10 +61,10 @@ def func(parser, options, args):
patches = [ crt_series.get_current() ]
crt_series.pop_patch(options.to or oldapplied[0])
- push_patches(patches)
+ push_patches(crt_series, patches)
if not options.nopush:
newapplied = crt_series.get_applied()
def not_reapplied_yet(p):
return not p in newapplied
- push_patches(filter(not_reapplied_yet, oldapplied))
+ push_patches(crt_series, filter(not_reapplied_yet, oldapplied))
diff --git a/stgit/commands/sync.py b/stgit/commands/sync.py
index 8a31c29..6066f82 100644
--- a/stgit/commands/sync.py
+++ b/stgit/commands/sync.py
@@ -51,7 +51,7 @@ options = [make_option('-a', '--all',
def __check_all():
check_local_changes()
check_conflicts()
- check_head_top_equal()
+ check_head_top_equal(crt_series)
def __branch_merge_patch(remote_series, pname):
"""Merge a patch from a remote branch into the current tree.
@@ -131,13 +131,13 @@ def func(parser, options, args):
# pop to the one before the first patch to be synchronised
popped = applied[applied.index(sync_patches[0]) + 1:]
if popped:
- pop_patches(popped[::-1])
+ pop_patches(crt_series, popped[::-1])
for p in sync_patches:
if p in popped:
# push to this patch
idx = popped.index(p) + 1
- push_patches(popped[:idx])
+ push_patches(crt_series, popped[:idx])
del popped[:idx]
# the actual sync
@@ -166,4 +166,4 @@ def func(parser, options, args):
# push the remaining patches
if popped:
- push_patches(popped)
+ push_patches(crt_series, popped)
diff --git a/stgit/commands/uncommit.py b/stgit/commands/uncommit.py
index a23ae20..8e62d23 100644
--- a/stgit/commands/uncommit.py
+++ b/stgit/commands/uncommit.py
@@ -66,7 +66,7 @@ def func(parser, options, args):
if len(args) != 0:
parser.error('cannot specify patch name with --to')
patch_nr = patchnames = None
- to_commit = git_id(options.to)
+ to_commit = git_id(crt_series, options.to)
elif options.number:
if options.number <= 0:
parser.error('invalid value passed to --number')
diff --git a/stgit/main.py b/stgit/main.py
index db327f1..e8242c2 100644
--- a/stgit/main.py
+++ b/stgit/main.py
@@ -277,7 +277,6 @@ def main():
command.crt_series = Series(options.branch)
else:
command.crt_series = Series()
- stgit.commands.common.crt_series = command.crt_series
command.func(parser, options, args)
except (StgException, IOError, ParsingError, NoSectionError), err:
^ permalink raw reply related
* [StGit PATCH 6/6] Let some commands work with detached HEAD
From: Karl Hasselström @ 2007-10-08 8:55 UTC (permalink / raw)
To: Catalin Marinas; +Cc: git
In-Reply-To: <20071008085430.9734.75797.stgit@yoghurt>
add, diff, resolved, and status didn't use the crt_series that was
initialized for them. So don't initialize it, since that means (1)
less work and (2) they won't fail when HEAD is detached.
Note that this doesn't completely fix the problem with detached HEAD:
a number of other commands (e.g. branch) don't always need to refer to
a current series, but currently fails on a detached HEAD even in those
situations.
Signed-off-by: Karl Hasselström <kha@treskal.com>
---
stgit/commands/add.py | 2 +-
stgit/commands/diff.py | 2 +-
stgit/commands/resolved.py | 2 +-
stgit/commands/status.py | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/stgit/commands/add.py b/stgit/commands/add.py
index 264ab9f..ceea188 100644
--- a/stgit/commands/add.py
+++ b/stgit/commands/add.py
@@ -31,7 +31,7 @@ Add the files or directories passed as arguments to the
repository. When a directory name is given, all the files and
subdirectories are recursively added."""
-directory = DirectoryHasRepository()
+directory = DirectoryHasRepository(needs_current_series = False)
options = []
diff --git a/stgit/commands/diff.py b/stgit/commands/diff.py
index 42e8367..9ffbb4a 100644
--- a/stgit/commands/diff.py
+++ b/stgit/commands/diff.py
@@ -42,7 +42,7 @@ rev = '([patch][//[bottom | top]]) | <tree-ish> | base'
If neither bottom nor top are given but a '//' is present, the command
shows the specified patch (defaulting to the current one)."""
-directory = DirectoryHasRepository()
+directory = DirectoryHasRepository(needs_current_series = False)
options = [make_option('-r', '--range',
metavar = 'rev1[..[rev2]]', dest = 'revs',
help = 'show the diff between revisions'),
diff --git a/stgit/commands/resolved.py b/stgit/commands/resolved.py
index c2ef678..8b2aba2 100644
--- a/stgit/commands/resolved.py
+++ b/stgit/commands/resolved.py
@@ -34,7 +34,7 @@ Mark a merge conflict as resolved. The conflicts can be seen with the
'C'. This command also removes any <file>.{ancestor,current,patched}
files."""
-directory = DirectoryHasRepository()
+directory = DirectoryHasRepository(needs_current_series = False)
options = [make_option('-a', '--all',
help = 'mark all conflicts as solved',
action = 'store_true'),
diff --git a/stgit/commands/status.py b/stgit/commands/status.py
index a688f7e..360fabf 100644
--- a/stgit/commands/status.py
+++ b/stgit/commands/status.py
@@ -40,7 +40,7 @@ under revision control. The files are prefixed as follows:
A 'refresh' command clears the status of the modified, new and deleted
files."""
-directory = DirectoryHasRepository()
+directory = DirectoryHasRepository(needs_current_series = False)
options = [make_option('-m', '--modified',
help = 'show modified files only',
action = 'store_true'),
^ permalink raw reply related
* Re: [StGit PATCH 0/6] Survive capital punishment
From: Karl Hasselström @ 2007-10-08 8:58 UTC (permalink / raw)
To: Catalin Marinas; +Cc: git
In-Reply-To: <20071008085430.9734.75797.stgit@yoghurt>
On 2007-10-08 10:55:02 +0200, Karl Hasselström wrote:
> Karl Hasselström (6):
> Let some commands work with detached HEAD
> Don't have a global crt_series in stgit.commans.common
> Refactor crt_series creation
> Properly detect that HEAD is detached
> Use our nice message printout wrapping system
> Allow caller to customize title of error/warning message
Will be available from
git://repo.or.cz/stgit/kha.git safe
momentarily (I just need to rebase the experimental branch on top of
it).
--
Karl Hasselström, kha@treskal.com
www.treskal.com/kalle
^ permalink raw reply
* Re: Trying to use git-filter-branch to compress history by removing large, obsolete binary files
From: Andreas Ericsson @ 2007-10-08 9:23 UTC (permalink / raw)
To: Alex Riesen; +Cc: Elijah Newren, Frank Lichtenheld, git
In-Reply-To: <20071008061511.GA2859@steel.home>
Alex Riesen wrote:
> Elijah Newren, Mon, Oct 08, 2007 02:09:50 +0200:
>> On 10/7/07, Alex Riesen <raa.lkml@gmail.com> wrote:
>>> you missed something. Your example compresses to about 124k.
>> What version of git are you running? I reran all the steps to which
>
> git version 1.5.3.4.225.g31b973 (irrelevant custom modifications)
>
>> you responded (repeated below for clarity) with git-1.5.3.3 and still
>> get 11MB. Also, you must have different filesystem extents than me
>> since an empty git repo takes 196k here[1], so I don't think any repo
>> is going to get down to 124k.
>
> it is ext3. I do not install the hooks (~8k apparent, ~32k fs blocks)
> and never activate logs by default.
>
>> # Use vi to remove the line referring to refs/original...
>> git reflog expire --all
>
> another part of the suggestion re reflogs was to look into the logs,
> to check if expire actually removed anything. It seems to have been
> the culprit.
>
On my system, running git version 1.5.3.3.131.g34c6d,
git reflog expire --all
does absolutely nothing.
git reflog expire --expire=0 --all
truncates all the reflogs. I'm not sure if this is intended or not.
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
^ 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