Git development
 help / color / mirror / Atom feed
* [PATCH] parse-opt: migrate builtin-checkout-index.
From: Miklos Vajna @ 2008-10-19 18:30 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Pierre Habouzit, git
In-Reply-To: <1224292643-28704-1-git-send-email-vmiklos@frugalware.org>

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---

On Sat, Oct 18, 2008 at 03:17:23AM +0200, Miklos Vajna <vmiklos@frugalware.org> wrote:
> > This adds a new feature to say --no-z from the command line, doesn't
> > it?
> > And I suspect the feature is broken ;-).
>
> Right, I fixed this in option_parse_z(). --no-z should set
> line_termination to \n instead of 1.

Originally in option_parse_z() I had

        line_termination = unset;

which is in fact right, because (as Pierre pointed out) unset for short
options are always false, but I changed it to

        line_termination = 0;

to make it more readable.

> > Is this comment still correct?  Do the original and your version act
> > the
> > same way when the user says "checkout --stdin -f", for example?  I
> > suspect
> > the original refused it and yours take it (and do much more sensible
> > thing), which would be an improvement, but then the error message
> > should
> > be reworded perhaps?
>
> Unless I missed something, that was a limitation of the option parser.
> checkout-index --stdin -f works fine for me after removing those two
> lines, so I left them out from the updated patch.

I still think that check is necessary, but the reasoning was false: what
we need to check is the usage of --stdin and filenames togother. But a
bit later there is a

        die("git checkout-index: don't mix '--stdin' and explicit filenames");

so the check I removed was unnecessary.

Here is a patch with the cleaned up option_parse_z().

 builtin-checkout-index.c |  149 +++++++++++++++++++++++++---------------------
 1 files changed, 80 insertions(+), 69 deletions(-)

diff --git a/builtin-checkout-index.c b/builtin-checkout-index.c
index 4ba2702..2c558dd 100644
--- a/builtin-checkout-index.c
+++ b/builtin-checkout-index.c
@@ -40,6 +40,7 @@
 #include "cache.h"
 #include "quote.h"
 #include "cache-tree.h"
+#include "parse-options.h"
 
 #define CHECKOUT_ALL 4
 static int line_termination = '\n';
@@ -153,11 +154,55 @@ static void checkout_all(const char *prefix, int prefix_length)
 		exit(128);
 }
 
-static const char checkout_cache_usage[] =
-"git checkout-index [-u] [-q] [-a] [-f] [-n] [--stage=[123]|all] [--prefix=<string>] [--temp] [--] <file>...";
+static const char * const builtin_checkout_index_usage[] = {
+	"git checkout-index [options] [--] <file>...",
+	NULL
+};
 
 static struct lock_file lock_file;
 
+static int option_parse_u(const struct option *opt,
+			      const char *arg, int unset)
+{
+	int *newfd = opt->value;
+
+	state.refresh_cache = 1;
+	if (*newfd < 0)
+		*newfd = hold_locked_index(&lock_file, 1);
+	return 0;
+}
+
+static int option_parse_z(const struct option *opt,
+			  const char *arg, int unset)
+{
+	line_termination = 0;
+	return 0;
+}
+
+static int option_parse_prefix(const struct option *opt,
+			       const char *arg, int unset)
+{
+	state.base_dir = arg;
+	state.base_dir_len = strlen(arg);
+	return 0;
+}
+
+static int option_parse_stage(const struct option *opt,
+			      const char *arg, int unset)
+{
+	if (!strcmp(arg, "all")) {
+		to_tempfile = 1;
+		checkout_stage = CHECKOUT_ALL;
+	} else {
+		int ch = arg[0];
+		if ('1' <= ch && ch <= '3')
+			checkout_stage = arg[0] - '0';
+		else
+			die("stage should be between 1 and 3 or all");
+	}
+	return 0;
+}
+
 int cmd_checkout_index(int argc, const char **argv, const char *prefix)
 {
 	int i;
@@ -165,6 +210,33 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix)
 	int all = 0;
 	int read_from_stdin = 0;
 	int prefix_length;
+	int force = 0, quiet = 0, not_new = 0;
+	struct option builtin_checkout_index_options[] = {
+		OPT_BOOLEAN('a', "all", &all,
+			"checks out all files in the index"),
+		OPT_BOOLEAN('f', "force", &force,
+			"forces overwrite of existing files"),
+		OPT__QUIET(&quiet),
+		OPT_BOOLEAN('n', "no-create", &not_new,
+			"don't checkout new files"),
+		{ OPTION_CALLBACK, 'u', "index", &newfd, NULL,
+			"update stat information in the index file",
+			PARSE_OPT_NOARG, option_parse_u },
+		{ OPTION_CALLBACK, 'z', NULL, NULL, NULL,
+			"paths are separated with NUL character",
+			PARSE_OPT_NOARG, option_parse_z },
+		OPT_BOOLEAN(0, "stdin", &read_from_stdin,
+			"read list of paths from the standard input"),
+		OPT_BOOLEAN(0, "temp", &to_tempfile,
+			"write the content to temporary files"),
+		OPT_CALLBACK(0, "prefix", NULL, "string",
+			"when creating files, prepend <string>",
+			option_parse_prefix),
+		OPT_CALLBACK(0, "stage", NULL, NULL,
+			"copy out the files from named stage",
+			option_parse_stage),
+		OPT_END()
+	};
 
 	git_config(git_default_config, NULL);
 	state.base_dir = "";
@@ -174,72 +246,11 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix)
 		die("invalid cache");
 	}
 
-	for (i = 1; i < argc; i++) {
-		const char *arg = argv[i];
-
-		if (!strcmp(arg, "--")) {
-			i++;
-			break;
-		}
-		if (!strcmp(arg, "-a") || !strcmp(arg, "--all")) {
-			all = 1;
-			continue;
-		}
-		if (!strcmp(arg, "-f") || !strcmp(arg, "--force")) {
-			state.force = 1;
-			continue;
-		}
-		if (!strcmp(arg, "-q") || !strcmp(arg, "--quiet")) {
-			state.quiet = 1;
-			continue;
-		}
-		if (!strcmp(arg, "-n") || !strcmp(arg, "--no-create")) {
-			state.not_new = 1;
-			continue;
-		}
-		if (!strcmp(arg, "-u") || !strcmp(arg, "--index")) {
-			state.refresh_cache = 1;
-			if (newfd < 0)
-				newfd = hold_locked_index(&lock_file, 1);
-			continue;
-		}
-		if (!strcmp(arg, "-z")) {
-			line_termination = 0;
-			continue;
-		}
-		if (!strcmp(arg, "--stdin")) {
-			if (i != argc - 1)
-				die("--stdin must be at the end");
-			read_from_stdin = 1;
-			i++; /* do not consider arg as a file name */
-			break;
-		}
-		if (!strcmp(arg, "--temp")) {
-			to_tempfile = 1;
-			continue;
-		}
-		if (!prefixcmp(arg, "--prefix=")) {
-			state.base_dir = arg+9;
-			state.base_dir_len = strlen(state.base_dir);
-			continue;
-		}
-		if (!prefixcmp(arg, "--stage=")) {
-			if (!strcmp(arg + 8, "all")) {
-				to_tempfile = 1;
-				checkout_stage = CHECKOUT_ALL;
-			} else {
-				int ch = arg[8];
-				if ('1' <= ch && ch <= '3')
-					checkout_stage = arg[8] - '0';
-				else
-					die("stage should be between 1 and 3 or all");
-			}
-			continue;
-		}
-		if (arg[0] == '-')
-			usage(checkout_cache_usage);
-		break;
-	}
+	argc = parse_options(argc, argv, builtin_checkout_index_options,
+			builtin_checkout_index_usage, 0);
+	state.force = force;
+	state.quiet = quiet;
+	state.not_new = not_new;
 
 	if (state.base_dir_len || to_tempfile) {
 		/* when --prefix is specified we do not
@@ -253,7 +264,7 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix)
 	}
 
 	/* Check out named files first */
-	for ( ; i < argc; i++) {
+	for (i = 0; i < argc; i++) {
 		const char *arg = argv[i];
 		const char *p;
 
-- 
1.6.0.2

^ permalink raw reply related

* Re: [PATCH] parse-opt: migrate builtin-checkout-index.
From: Miklos Vajna @ 2008-10-19 18:31 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Pierre Habouzit, git
In-Reply-To: <1224441040-5071-1-git-send-email-vmiklos@frugalware.org>

[-- Attachment #1: Type: text/plain, Size: 262 bytes --]

On Sun, Oct 19, 2008 at 08:30:40PM +0200, Miklos Vajna <vmiklos@frugalware.org> wrote:
> I still think that check is necessary, but the reasoning was false: what

                              ^ unnecessary

Sorry for not reading over my mail before sending it.

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply

* Re: [PATCH] Teach/Fix -q/-v to pull/fetch
From: Tuncer Ayaz @ 2008-10-19 18:33 UTC (permalink / raw)
  To: git
In-Reply-To: <1224440277-2469-1-git-send-email-tuncer.ayaz@gmail.com>

On Sun, Oct 19, 2008 at 8:17 PM, Tuncer Ayaz <tuncer.ayaz@gmail.com> wrote:
> After fixing clone -q I noticed that pull -q does not do what
> it's supposed to do and implemented --quiet/--verbose by
> adding it to builtin-merge and fixing two places in builtin-fetch.
>
> I have not touched/adjusted contrib/completion/git-completion.bash
> but can take a look if wanted. I think it already needs one or two
> adjustments caused by recent --OPTIONS changes in master.
>
> I've tested the following invocations with the below changes applied:
> $ git pull
> $ git pull -q
> $ git pull -v
>
> This is the next attempt trying to incorporate Junio's
> suggestions and I'm not sure about the following:
> 1) having the same option callback function in both modules
> 2) my adaption of the following two lines from
> builtin-fetch.c to the new verbosity option:
>    if (verbosity == VERBOSE)
>        transport->verbose = 1;
>    if (verbosity == QUIET)
>        transport->verbose = -1;
> 3) my usage of OPTION_CALLBACK. therefore please
> correct me if I did it wrong or my cb fun has an
> obvious defect. it may very well have one :)

it doesn't work as I expected when you supply -q and -v.
I have to redo it, I guess.

> Signed-off-by: Tuncer Ayaz <tuncer.ayaz@gmail.com>
> ---
>  Documentation/merge-options.txt |    8 ++++++++
>  builtin-fetch.c                 |   35 +++++++++++++++++++++++++----------
>  builtin-merge.c                 |   36 +++++++++++++++++++++++++++++-------
>  git-pull.sh                     |   10 ++++++++--
>  4 files changed, 70 insertions(+), 19 deletions(-)
>
> diff --git a/Documentation/merge-options.txt b/Documentation/merge-options.txt
> index 007909a..427cdef 100644
> --- a/Documentation/merge-options.txt
> +++ b/Documentation/merge-options.txt
> @@ -1,3 +1,11 @@
> +-q::
> +--quiet::
> +       Operate quietly.
> +
> +-v::
> +--verbose::
> +       Be verbose.
> +
>  --stat::
>        Show a diffstat at the end of the merge. The diffstat is also
>        controlled by the configuration option merge.stat.
> diff --git a/builtin-fetch.c b/builtin-fetch.c
> index ee93d3a..717e833 100644
> --- a/builtin-fetch.c
> +++ b/builtin-fetch.c
> @@ -22,16 +22,31 @@ enum {
>        TAGS_SET = 2
>  };
>
> -static int append, force, keep, update_head_ok, verbose, quiet;
> +static int append, force, keep, update_head_ok;
>  static int tags = TAGS_DEFAULT;
>  static const char *depth;
>  static const char *upload_pack;
>  static struct strbuf default_rla = STRBUF_INIT;
>  static struct transport *transport;
> +static enum { QUIET, NORMAL, VERBOSE } verbosity = NORMAL;
> +
> +static int option_parse_verbosity(const struct option *opt,
> +                         const char *arg, int unset)
> +{
> +       if (!strcmp("quiet", opt->long_name))
> +               verbosity = QUIET;
> +       else if (!strcmp("verbose", opt->long_name))
> +               verbosity = VERBOSE;
> +       return 0;
> +}
>
>  static struct option builtin_fetch_options[] = {
> -       OPT__QUIET(&quiet),
> -       OPT__VERBOSE(&verbose),
> +       { OPTION_CALLBACK, 'q', "quiet", NULL, NULL,
> +               "operate quietly",
> +               PARSE_OPT_NOARG, option_parse_verbosity },
> +       { OPTION_CALLBACK, 'v', "verbose", NULL, NULL,
> +               "be verbose",
> +               PARSE_OPT_NOARG, option_parse_verbosity },
>        OPT_BOOLEAN('a', "append", &append,
>                    "append to .git/FETCH_HEAD instead of overwriting"),
>        OPT_STRING(0, "upload-pack", &upload_pack, "PATH",
> @@ -192,7 +207,6 @@ static int s_update_ref(const char *action,
>
>  static int update_local_ref(struct ref *ref,
>                            const char *remote,
> -                           int verbose,
>                            char *display)
>  {
>        struct commit *current = NULL, *updated;
> @@ -210,7 +224,7 @@ static int update_local_ref(struct ref *ref,
>                die("object %s not found", sha1_to_hex(ref->new_sha1));
>
>        if (!hashcmp(ref->old_sha1, ref->new_sha1)) {
> -               if (verbose)
> +               if (verbosity == VERBOSE)
>                        sprintf(display, "= %-*s %-*s -> %s", SUMMARY_WIDTH,
>                                "[up to date]", REFCOL_WIDTH, remote,
>                                pretty_ref);
> @@ -366,18 +380,19 @@ static int store_updated_refs(const char *url, const char *remote_name,
>                        note);
>
>                if (ref)
> -                       rc |= update_local_ref(ref, what, verbose, note);
> +                       rc |= update_local_ref(ref, what, note);
>                else
>                        sprintf(note, "* %-*s %-*s -> FETCH_HEAD",
>                                SUMMARY_WIDTH, *kind ? kind : "branch",
>                                 REFCOL_WIDTH, *what ? what : "HEAD");
>                if (*note) {
> -                       if (!shown_url) {
> +                       if (verbosity > QUIET && !shown_url) {
>                                fprintf(stderr, "From %.*s\n",
>                                                url_len, url);
>                                shown_url = 1;
>                        }
> -                       fprintf(stderr, " %s\n", note);
> +                       if (verbosity > QUIET)
> +                               fprintf(stderr, " %s\n", note);
>                }
>        }
>        fclose(fp);
> @@ -622,9 +637,9 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
>                remote = remote_get(argv[0]);
>
>        transport = transport_get(remote, remote->url[0]);
> -       if (verbose >= 2)
> +       if (verbosity == VERBOSE)
>                transport->verbose = 1;
> -       if (quiet)
> +       if (verbosity == QUIET)
>                transport->verbose = -1;
>        if (upload_pack)
>                set_option(TRANS_OPT_UPLOADPACK, upload_pack);
> diff --git a/builtin-merge.c b/builtin-merge.c
> index 5e2b7f1..6966831 100644
> --- a/builtin-merge.c
> +++ b/builtin-merge.c
> @@ -50,6 +50,7 @@ static unsigned char head[20], stash[20];
>  static struct strategy **use_strategies;
>  static size_t use_strategies_nr, use_strategies_alloc;
>  static const char *branch;
> +static enum { QUIET, NORMAL, VERBOSE } verbosity = NORMAL;
>
>  static struct strategy all_strategy[] = {
>        { "recursive",  DEFAULT_TWOHEAD | NO_TRIVIAL },
> @@ -151,7 +152,23 @@ static int option_parse_n(const struct option *opt,
>        return 0;
>  }
>
> +static int option_parse_verbosity(const struct option *opt,
> +                         const char *arg, int unset)
> +{
> +       if (!strcmp("quiet", opt->long_name))
> +               verbosity = QUIET;
> +       else if (!strcmp("verbose", opt->long_name))
> +               verbosity = VERBOSE;
> +       return 0;
> +}
> +
>  static struct option builtin_merge_options[] = {
> +       { OPTION_CALLBACK, 'q', "quiet", NULL, NULL,
> +               "operate quietly",
> +               PARSE_OPT_NOARG, option_parse_verbosity },
> +       { OPTION_CALLBACK, 'v', "verbose", NULL, NULL,
> +               "be verbose",
> +               PARSE_OPT_NOARG, option_parse_verbosity },
>        { OPTION_CALLBACK, 'n', NULL, NULL, NULL,
>                "do not show a diffstat at the end of the merge",
>                PARSE_OPT_NOARG, option_parse_n },
> @@ -249,7 +266,8 @@ static void restore_state(void)
>  /* This is called when no merge was necessary. */
>  static void finish_up_to_date(const char *msg)
>  {
> -       printf("%s%s\n", squash ? " (nothing to squash)" : "", msg);
> +       if (verbosity > QUIET)
> +               printf("%s%s\n", squash ? " (nothing to squash)" : "", msg);
>        drop_save();
>  }
>
> @@ -330,14 +348,15 @@ static void finish(const unsigned char *new_head, const char *msg)
>        if (!msg)
>                strbuf_addstr(&reflog_message, getenv("GIT_REFLOG_ACTION"));
>        else {
> -               printf("%s\n", msg);
> +               if (verbosity > QUIET)
> +                       printf("%s\n", msg);
>                strbuf_addf(&reflog_message, "%s: %s",
>                        getenv("GIT_REFLOG_ACTION"), msg);
>        }
>        if (squash) {
>                squash_message();
>        } else {
> -               if (!merge_msg.len)
> +               if (verbosity > QUIET && !merge_msg.len)
>                        printf("No merge message -- not updating HEAD\n");
>                else {
>                        const char *argv_gc_auto[] = { "gc", "--auto", NULL };
> @@ -871,6 +890,8 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
>
>        argc = parse_options(argc, argv, builtin_merge_options,
>                        builtin_merge_usage, 0);
> +       if (verbosity > QUIET)
> +               show_diffstat = 0;
>
>        if (squash) {
>                if (!allow_fast_forward)
> @@ -1012,10 +1033,11 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
>
>                strcpy(hex, find_unique_abbrev(head, DEFAULT_ABBREV));
>
> -               printf("Updating %s..%s\n",
> -                       hex,
> -                       find_unique_abbrev(remoteheads->item->object.sha1,
> -                       DEFAULT_ABBREV));
> +               if (verbosity > QUIET)
> +                       printf("Updating %s..%s\n",
> +                               hex,
> +                               find_unique_abbrev(remoteheads->item->object.sha1,
> +                               DEFAULT_ABBREV));
>                strbuf_addstr(&msg, "Fast forward");
>                if (have_message)
>                        strbuf_addstr(&msg,
> diff --git a/git-pull.sh b/git-pull.sh
> index 75c3610..8e25d44 100755
> --- a/git-pull.sh
> +++ b/git-pull.sh
> @@ -16,6 +16,7 @@ cd_to_toplevel
>  test -z "$(git ls-files -u)" ||
>        die "You are in the middle of a conflicted merge."
>
> +quiet= verbose=
>  strategy_args= no_stat= no_commit= squash= no_ff= log_arg=
>  curr_branch=$(git symbolic-ref -q HEAD)
>  curr_branch_short=$(echo "$curr_branch" | sed "s|refs/heads/||")
> @@ -23,6 +24,10 @@ rebase=$(git config --bool branch.$curr_branch_short.rebase)
>  while :
>  do
>        case "$1" in
> +       -q|--quiet)
> +               quiet=-q ;;
> +       -v|--verbose)
> +               verbose=-v ;;
>        -n|--no-stat|--no-summary)
>                no_stat=-n ;;
>        --stat|--summary)
> @@ -121,7 +126,7 @@ test true = "$rebase" && {
>                "refs/remotes/$origin/$reflist" 2>/dev/null)"
>  }
>  orig_head=$(git rev-parse --verify HEAD 2>/dev/null)
> -git fetch --update-head-ok "$@" || exit 1
> +git fetch $verbose $quiet --update-head-ok "$@" || exit 1
>
>  curr_head=$(git rev-parse --verify HEAD 2>/dev/null)
>  if test "$curr_head" != "$orig_head"
> @@ -181,5 +186,6 @@ merge_name=$(git fmt-merge-msg $log_arg <"$GIT_DIR/FETCH_HEAD") || exit
>  test true = "$rebase" &&
>        exec git-rebase $strategy_args --onto $merge_head \
>        ${oldremoteref:-$merge_head}
> -exec git-merge $no_stat $no_commit $squash $no_ff $log_arg $strategy_args \
> +exec git-merge $quiet $verbose $no_stat $no_commit \
> +       $squash $no_ff $log_arg $strategy_args \
>        "$merge_name" HEAD $merge_head
> --
> 1.6.0.2.GIT
>
>

^ permalink raw reply

* Re: [PATCH] Teach/Fix -q/-v to pull/fetch
From: Tuncer Ayaz @ 2008-10-19 18:37 UTC (permalink / raw)
  To: git
In-Reply-To: <4ac8254d0810191133v79ed73b7tf09a282f44d302dd@mail.gmail.com>

On Sun, Oct 19, 2008 at 8:33 PM, Tuncer Ayaz <tuncer.ayaz@gmail.com> wrote:
> On Sun, Oct 19, 2008 at 8:17 PM, Tuncer Ayaz <tuncer.ayaz@gmail.com> wrote:
>> After fixing clone -q I noticed that pull -q does not do what
>> it's supposed to do and implemented --quiet/--verbose by
>> adding it to builtin-merge and fixing two places in builtin-fetch.
>>
>> I have not touched/adjusted contrib/completion/git-completion.bash
>> but can take a look if wanted. I think it already needs one or two
>> adjustments caused by recent --OPTIONS changes in master.
>>
>> I've tested the following invocations with the below changes applied:
>> $ git pull
>> $ git pull -q
>> $ git pull -v
>>
>> This is the next attempt trying to incorporate Junio's
>> suggestions and I'm not sure about the following:
>> 1) having the same option callback function in both modules
>> 2) my adaption of the following two lines from
>> builtin-fetch.c to the new verbosity option:
>>    if (verbosity == VERBOSE)
>>        transport->verbose = 1;
>>    if (verbosity == QUIET)
>>        transport->verbose = -1;
>> 3) my usage of OPTION_CALLBACK. therefore please
>> correct me if I did it wrong or my cb fun has an
>> obvious defect. it may very well have one :)
>
> it doesn't work as I expected when you supply -q and -v.
> I have to redo it, I guess.

Junio, what do you think?
if I call "git pull -q -v" or "git pull -v -q" verbosity will be VERBOSE.
is that ok or should I make sure that the last one overrides
verbosity?

>> Signed-off-by: Tuncer Ayaz <tuncer.ayaz@gmail.com>
>> ---
>>  Documentation/merge-options.txt |    8 ++++++++
>>  builtin-fetch.c                 |   35 +++++++++++++++++++++++++----------
>>  builtin-merge.c                 |   36 +++++++++++++++++++++++++++++-------
>>  git-pull.sh                     |   10 ++++++++--
>>  4 files changed, 70 insertions(+), 19 deletions(-)
>>
>> diff --git a/Documentation/merge-options.txt b/Documentation/merge-options.txt
>> index 007909a..427cdef 100644
>> --- a/Documentation/merge-options.txt
>> +++ b/Documentation/merge-options.txt
>> @@ -1,3 +1,11 @@
>> +-q::
>> +--quiet::
>> +       Operate quietly.
>> +
>> +-v::
>> +--verbose::
>> +       Be verbose.
>> +
>>  --stat::
>>        Show a diffstat at the end of the merge. The diffstat is also
>>        controlled by the configuration option merge.stat.
>> diff --git a/builtin-fetch.c b/builtin-fetch.c
>> index ee93d3a..717e833 100644
>> --- a/builtin-fetch.c
>> +++ b/builtin-fetch.c
>> @@ -22,16 +22,31 @@ enum {
>>        TAGS_SET = 2
>>  };
>>
>> -static int append, force, keep, update_head_ok, verbose, quiet;
>> +static int append, force, keep, update_head_ok;
>>  static int tags = TAGS_DEFAULT;
>>  static const char *depth;
>>  static const char *upload_pack;
>>  static struct strbuf default_rla = STRBUF_INIT;
>>  static struct transport *transport;
>> +static enum { QUIET, NORMAL, VERBOSE } verbosity = NORMAL;
>> +
>> +static int option_parse_verbosity(const struct option *opt,
>> +                         const char *arg, int unset)
>> +{
>> +       if (!strcmp("quiet", opt->long_name))
>> +               verbosity = QUIET;
>> +       else if (!strcmp("verbose", opt->long_name))
>> +               verbosity = VERBOSE;
>> +       return 0;
>> +}
>>
>>  static struct option builtin_fetch_options[] = {
>> -       OPT__QUIET(&quiet),
>> -       OPT__VERBOSE(&verbose),
>> +       { OPTION_CALLBACK, 'q', "quiet", NULL, NULL,
>> +               "operate quietly",
>> +               PARSE_OPT_NOARG, option_parse_verbosity },
>> +       { OPTION_CALLBACK, 'v', "verbose", NULL, NULL,
>> +               "be verbose",
>> +               PARSE_OPT_NOARG, option_parse_verbosity },
>>        OPT_BOOLEAN('a', "append", &append,
>>                    "append to .git/FETCH_HEAD instead of overwriting"),
>>        OPT_STRING(0, "upload-pack", &upload_pack, "PATH",
>> @@ -192,7 +207,6 @@ static int s_update_ref(const char *action,
>>
>>  static int update_local_ref(struct ref *ref,
>>                            const char *remote,
>> -                           int verbose,
>>                            char *display)
>>  {
>>        struct commit *current = NULL, *updated;
>> @@ -210,7 +224,7 @@ static int update_local_ref(struct ref *ref,
>>                die("object %s not found", sha1_to_hex(ref->new_sha1));
>>
>>        if (!hashcmp(ref->old_sha1, ref->new_sha1)) {
>> -               if (verbose)
>> +               if (verbosity == VERBOSE)
>>                        sprintf(display, "= %-*s %-*s -> %s", SUMMARY_WIDTH,
>>                                "[up to date]", REFCOL_WIDTH, remote,
>>                                pretty_ref);
>> @@ -366,18 +380,19 @@ static int store_updated_refs(const char *url, const char *remote_name,
>>                        note);
>>
>>                if (ref)
>> -                       rc |= update_local_ref(ref, what, verbose, note);
>> +                       rc |= update_local_ref(ref, what, note);
>>                else
>>                        sprintf(note, "* %-*s %-*s -> FETCH_HEAD",
>>                                SUMMARY_WIDTH, *kind ? kind : "branch",
>>                                 REFCOL_WIDTH, *what ? what : "HEAD");
>>                if (*note) {
>> -                       if (!shown_url) {
>> +                       if (verbosity > QUIET && !shown_url) {
>>                                fprintf(stderr, "From %.*s\n",
>>                                                url_len, url);
>>                                shown_url = 1;
>>                        }
>> -                       fprintf(stderr, " %s\n", note);
>> +                       if (verbosity > QUIET)
>> +                               fprintf(stderr, " %s\n", note);
>>                }
>>        }
>>        fclose(fp);
>> @@ -622,9 +637,9 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
>>                remote = remote_get(argv[0]);
>>
>>        transport = transport_get(remote, remote->url[0]);
>> -       if (verbose >= 2)
>> +       if (verbosity == VERBOSE)
>>                transport->verbose = 1;
>> -       if (quiet)
>> +       if (verbosity == QUIET)
>>                transport->verbose = -1;
>>        if (upload_pack)
>>                set_option(TRANS_OPT_UPLOADPACK, upload_pack);
>> diff --git a/builtin-merge.c b/builtin-merge.c
>> index 5e2b7f1..6966831 100644
>> --- a/builtin-merge.c
>> +++ b/builtin-merge.c
>> @@ -50,6 +50,7 @@ static unsigned char head[20], stash[20];
>>  static struct strategy **use_strategies;
>>  static size_t use_strategies_nr, use_strategies_alloc;
>>  static const char *branch;
>> +static enum { QUIET, NORMAL, VERBOSE } verbosity = NORMAL;
>>
>>  static struct strategy all_strategy[] = {
>>        { "recursive",  DEFAULT_TWOHEAD | NO_TRIVIAL },
>> @@ -151,7 +152,23 @@ static int option_parse_n(const struct option *opt,
>>        return 0;
>>  }
>>
>> +static int option_parse_verbosity(const struct option *opt,
>> +                         const char *arg, int unset)
>> +{
>> +       if (!strcmp("quiet", opt->long_name))
>> +               verbosity = QUIET;
>> +       else if (!strcmp("verbose", opt->long_name))
>> +               verbosity = VERBOSE;
>> +       return 0;
>> +}
>> +
>>  static struct option builtin_merge_options[] = {
>> +       { OPTION_CALLBACK, 'q', "quiet", NULL, NULL,
>> +               "operate quietly",
>> +               PARSE_OPT_NOARG, option_parse_verbosity },
>> +       { OPTION_CALLBACK, 'v', "verbose", NULL, NULL,
>> +               "be verbose",
>> +               PARSE_OPT_NOARG, option_parse_verbosity },
>>        { OPTION_CALLBACK, 'n', NULL, NULL, NULL,
>>                "do not show a diffstat at the end of the merge",
>>                PARSE_OPT_NOARG, option_parse_n },
>> @@ -249,7 +266,8 @@ static void restore_state(void)
>>  /* This is called when no merge was necessary. */
>>  static void finish_up_to_date(const char *msg)
>>  {
>> -       printf("%s%s\n", squash ? " (nothing to squash)" : "", msg);
>> +       if (verbosity > QUIET)
>> +               printf("%s%s\n", squash ? " (nothing to squash)" : "", msg);
>>        drop_save();
>>  }
>>
>> @@ -330,14 +348,15 @@ static void finish(const unsigned char *new_head, const char *msg)
>>        if (!msg)
>>                strbuf_addstr(&reflog_message, getenv("GIT_REFLOG_ACTION"));
>>        else {
>> -               printf("%s\n", msg);
>> +               if (verbosity > QUIET)
>> +                       printf("%s\n", msg);
>>                strbuf_addf(&reflog_message, "%s: %s",
>>                        getenv("GIT_REFLOG_ACTION"), msg);
>>        }
>>        if (squash) {
>>                squash_message();
>>        } else {
>> -               if (!merge_msg.len)
>> +               if (verbosity > QUIET && !merge_msg.len)
>>                        printf("No merge message -- not updating HEAD\n");
>>                else {
>>                        const char *argv_gc_auto[] = { "gc", "--auto", NULL };
>> @@ -871,6 +890,8 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
>>
>>        argc = parse_options(argc, argv, builtin_merge_options,
>>                        builtin_merge_usage, 0);
>> +       if (verbosity > QUIET)
>> +               show_diffstat = 0;
>>
>>        if (squash) {
>>                if (!allow_fast_forward)
>> @@ -1012,10 +1033,11 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
>>
>>                strcpy(hex, find_unique_abbrev(head, DEFAULT_ABBREV));
>>
>> -               printf("Updating %s..%s\n",
>> -                       hex,
>> -                       find_unique_abbrev(remoteheads->item->object.sha1,
>> -                       DEFAULT_ABBREV));
>> +               if (verbosity > QUIET)
>> +                       printf("Updating %s..%s\n",
>> +                               hex,
>> +                               find_unique_abbrev(remoteheads->item->object.sha1,
>> +                               DEFAULT_ABBREV));
>>                strbuf_addstr(&msg, "Fast forward");
>>                if (have_message)
>>                        strbuf_addstr(&msg,
>> diff --git a/git-pull.sh b/git-pull.sh
>> index 75c3610..8e25d44 100755
>> --- a/git-pull.sh
>> +++ b/git-pull.sh
>> @@ -16,6 +16,7 @@ cd_to_toplevel
>>  test -z "$(git ls-files -u)" ||
>>        die "You are in the middle of a conflicted merge."
>>
>> +quiet= verbose=
>>  strategy_args= no_stat= no_commit= squash= no_ff= log_arg=
>>  curr_branch=$(git symbolic-ref -q HEAD)
>>  curr_branch_short=$(echo "$curr_branch" | sed "s|refs/heads/||")
>> @@ -23,6 +24,10 @@ rebase=$(git config --bool branch.$curr_branch_short.rebase)
>>  while :
>>  do
>>        case "$1" in
>> +       -q|--quiet)
>> +               quiet=-q ;;
>> +       -v|--verbose)
>> +               verbose=-v ;;
>>        -n|--no-stat|--no-summary)
>>                no_stat=-n ;;
>>        --stat|--summary)
>> @@ -121,7 +126,7 @@ test true = "$rebase" && {
>>                "refs/remotes/$origin/$reflist" 2>/dev/null)"
>>  }
>>  orig_head=$(git rev-parse --verify HEAD 2>/dev/null)
>> -git fetch --update-head-ok "$@" || exit 1
>> +git fetch $verbose $quiet --update-head-ok "$@" || exit 1
>>
>>  curr_head=$(git rev-parse --verify HEAD 2>/dev/null)
>>  if test "$curr_head" != "$orig_head"
>> @@ -181,5 +186,6 @@ merge_name=$(git fmt-merge-msg $log_arg <"$GIT_DIR/FETCH_HEAD") || exit
>>  test true = "$rebase" &&
>>        exec git-rebase $strategy_args --onto $merge_head \
>>        ${oldremoteref:-$merge_head}
>> -exec git-merge $no_stat $no_commit $squash $no_ff $log_arg $strategy_args \
>> +exec git-merge $quiet $verbose $no_stat $no_commit \
>> +       $squash $no_ff $log_arg $strategy_args \
>>        "$merge_name" HEAD $merge_head
>> --
>> 1.6.0.2.GIT
>>
>>
>

^ permalink raw reply

* Re: Usability of git stash
From: Shawn O. Pearce @ 2008-10-19 18:40 UTC (permalink / raw)
  To: Anders Melchiorsen; +Cc: Brandon Casey, David Kastrup, git
In-Reply-To: <87prly5k5r.fsf@cup.kalibalik.dk>

Anders Melchiorsen <mail@cup.kalibalik.dk> wrote:
> Brandon Casey <casey@nrlssc.navy.mil> writes:
> 
> > In exchange for allowing new users to stub their toe on new commands, the
> > work flow of more experienced users is made a little easier.
> 
> I wonder whether experienced users even use stash a lot. Personally,
> after getting my head around the DAG, and thus getting more
> comfortable with git reset, I tend to make "WIP" commits instead.

Ditto.  I never use "git stash".  Its command line usage is too
unfriendly for me, so I tend to prefer making WIP commits.  If I
need to stash something I'll do:

  git commit -a -m wip
  ... some time later ..
  git checkout branch
  git reset --soft HEAD^

> The primary thing that stash does for me is preserve the index state.
> Unfortunately, --index is not default for stash apply, so I often
> forget it.

I never find the index saving useful.  My commits are frequent
enough that losing the index state usually only costs me a few
minutes when I go back to the branch and pop the wip commit.
 
> Sometimes, I also want stash to store away changes to untracked files
> (to get a clean working directory), but that is not possible.

Indeed, that's an advantage of the wip commit approach, you can shove
the untracked files quickly into the wip commit, especially with 1.6:

	git commit -A -m wip


Personally I wish git-stash wasn't invented the way it is.  I would
have rather seen it as macros to do a quick:

	git commit -m wip-index-state
	git commit -A -m wip-worktree-state

and unwind it with essentially:

	git reset --mixed HEAD^
	git reset --soft HEAD^

then its a lot less black magic to users, as they can see it in the
DAG, and its more explicitly tied to the branch they were on at the
time they ran the stash.  I think its rare you'd stash something
then switch to another branch to apply it.  But that could easily
be done with cherry-pick.

-- 
Shawn.

^ permalink raw reply

* [PATCH stgit] revised patch for importing series from tarball
From: Clark Williams @ 2008-10-19 19:16 UTC (permalink / raw)
  To: Git Mailing List

[-- Attachment #1: Type: text/plain, Size: 1057 bytes --]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Catalin,

Attached is my revised patch (v2 I believe) for importing a series directly from a tarball. I looked at the critique offered by Karl (pretty hard actually), but I decided in the end to keep extracting the tarball to a temp directory. It's possible that it would be desirable to extract members directly from a tarball (although as far as I can tell, you still have to extract them to a file) but I didn't judge the churn in imprt.py to be worth it for now. This version is pretty simple, in that you just detect that the input to to import_series is a tarball, call import_tarfile, then return. 

I added a simple test to the test harness for import as well. 

Oh and I added '*.elc' to the .gitignore file. May not be that many folks using emacs with stgit, but hey, I am! :)

Clark
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)

iEYEARECAAYFAkj7h4QACgkQqA4JVb61b9dq4ACbB9tl0FbHq5igNIPIbzALhyLf
Aw8An3weTNye7yzQ/wU2Hyt1agzCzTtC
=7WjV
-----END PGP SIGNATURE-----

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: tarfiles.patch --]
[-- Type: text/x-patch; name=tarfiles.patch, Size: 13375 bytes --]

patch to allow importing a series from a tar archive

From: Clark Williams <williams@redhat.com>

Signed-off-by: Clark Williams <williams@redhat.com>
---
 .gitignore                                      |    1 
 stgit/commands/imprt.py                         |   47 ++++++++++++++++++++++-
 t/t1800-import.sh                               |   12 ++++++
 t/t1800-import/patches/attribution.patch        |   21 ++++++++++
 t/t1800-import/patches/delete-extra-lines.patch |   22 +++++++++++
 t/t1800-import/patches/fifth-stanza.patch       |   22 +++++++++++
 t/t1800-import/patches/first-stanza.patch       |   18 +++++++++
 t/t1800-import/patches/fourth-stanza.patch      |   22 +++++++++++
 t/t1800-import/patches/second-stanza.patch      |   22 +++++++++++
 t/t1800-import/patches/series                   |   10 +++++
 t/t1800-import/patches/seventh-stanza.patch     |   24 ++++++++++++
 t/t1800-import/patches/sixth-stanza.patch       |   22 +++++++++++
 t/t1800-import/patches/third-stanza.patch       |   22 +++++++++++
 13 files changed, 263 insertions(+), 2 deletions(-)
 create mode 100644 t/t1800-import/patches/attribution.patch
 create mode 100644 t/t1800-import/patches/delete-extra-lines.patch
 create mode 100644 t/t1800-import/patches/fifth-stanza.patch
 create mode 100644 t/t1800-import/patches/first-stanza.patch
 create mode 100644 t/t1800-import/patches/fourth-stanza.patch
 create mode 100644 t/t1800-import/patches/second-stanza.patch
 create mode 100644 t/t1800-import/patches/series
 create mode 100644 t/t1800-import/patches/seventh-stanza.patch
 create mode 100644 t/t1800-import/patches/sixth-stanza.patch
 create mode 100644 t/t1800-import/patches/third-stanza.patch

diff --git a/.gitignore b/.gitignore
index 91dbad2..f0e5d30 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,4 @@ patches-*
 release.sh
 setup.cfg.rpm
 snapshot.sh
+*.elc
diff --git a/stgit/commands/imprt.py b/stgit/commands/imprt.py
index 227743f..6860d0e 100644
--- a/stgit/commands/imprt.py
+++ b/stgit/commands/imprt.py
@@ -19,6 +19,7 @@ import sys, os, re, email
 from mailbox import UnixMailbox
 from StringIO import StringIO
 from optparse import OptionParser, make_option
+import tarfile
 
 from stgit.commands.common import *
 from stgit.utils import *
@@ -52,7 +53,7 @@ options = [make_option('-m', '--mail',
                        help = 'import a series of patches from an mbox file',
                        action = 'store_true'),
            make_option('-s', '--series',
-                       help = 'import a series of patches',
+                       help = 'import a series of patches from a series file or a tar archive',
                        action = 'store_true'),
            make_option('-u', '--url',
                        help = 'import a patch from a URL',
@@ -87,7 +88,7 @@ options = [make_option('-m', '--mail',
            make_option('--commname',
                        help = 'use COMMNAME as the committer name'),
            make_option('--commemail',
-                       help = 'use COMMEMAIL as the committer e-mail')
+                       help = 'use COMMEMAIL as the committer e-mail'),
            ] + make_sign_options()
 
 
@@ -234,6 +235,9 @@ def __import_series(filename, options):
     applied = crt_series.get_applied()
 
     if filename:
+        if tarfile.is_tarfile(filename):
+            __import_tarfile(filename, options)
+            return
         f = file(filename)
         patchdir = os.path.dirname(filename)
     else:
@@ -287,6 +291,45 @@ def __import_url(url, options):
     urllib.urlretrieve(url, filename)
     __import_file(filename, options)
 
+def __import_tarfile(tar, options):
+    """Import patch series from a tar archive
+    """
+    import tempfile
+    import shutil
+
+    if not tarfile.is_tarfile(tar):
+        raise CmdException, "%s is not a tarfile!" % tar
+
+
+    t = tarfile.open(tar, 'r')
+    names = t.getnames()
+
+    # verify paths in the tarfile are safe
+    for n in names:
+        if n.startswith('/'):
+            raise CmdException, "Absolute path found in %s" % tar
+        if n.find("..") > -1:
+            raise CmdException, "Relative path found in %s" % tar
+
+    # find the series file
+    seriesfile = '';
+    for m in names:
+        if m.endswith('/series') or m == 'series':
+            seriesfile = m
+            break
+    if seriesfile == '':
+        raise CmdException, "no 'series' file found in %s" % tar
+
+    # unpack into a tmp dir
+    tmpdir = tempfile.mkdtemp('.stg')
+    t.extractall(tmpdir)
+
+    # apply the series
+    __import_series(os.path.join(tmpdir, seriesfile), options)
+
+    # cleanup the tmpdir
+    shutil.rmtree(tmpdir)
+
 def func(parser, options, args):
     """Import a GNU diff file as a new patch
     """
diff --git a/t/t1800-import.sh b/t/t1800-import.sh
index 1352743..5a3384f 100755
--- a/t/t1800-import.sh
+++ b/t/t1800-import.sh
@@ -122,4 +122,16 @@ test_expect_success \
     stg delete ..
     '
 
+test_expect_success \
+    'apply a series from a tarball' \
+    '
+    rm -f jabberwocky.txt && touch jabberwocky.txt &&
+    git add jabberwocky.txt && git commit -m "empty file" jabberwocky.txt &&
+    (cd ../t1800-import; tar -cjf jabberwocky.tar.bz2 patches) &&
+    stg import --series ../t1800-import/jabberwocky.tar.bz2
+    [ $(git cat-file -p $(stg id) \
+        | grep -c "tree 2c33937252a21f1550c0bf21f1de534b68f69635") = 1 ] &&
+    rm ../t1800-import/jabberwocky.tar.bz2
+    '
+    
 test_done
diff --git a/t/t1800-import/patches/attribution.patch b/t/t1800-import/patches/attribution.patch
new file mode 100644
index 0000000..2b7c8f9
--- /dev/null
+++ b/t/t1800-import/patches/attribution.patch
@@ -0,0 +1,21 @@
+attribution
+
+From: Clark Williams <williams@redhat.com>
+
+
+---
+ jabberwocky.txt |    4 ++++
+ 1 files changed, 4 insertions(+), 0 deletions(-)
+
+diff --git a/jabberwocky.txt b/jabberwocky.txt
+index 066d2e8..a9dd1f3 100644
+--- a/jabberwocky.txt
++++ b/jabberwocky.txt
+@@ -32,3 +32,7 @@ O frabjous day! Callooh! Callay!'
+   Did gyre and gimble in the wabe;
+ All mimsy were the borogoves,
+   And the mome raths outgrabe.
++
++	JABBERWOCKY
++	Lewis Carroll
++	(from Through the Looking-Glass and What Alice Found There, 1872) 
diff --git a/t/t1800-import/patches/delete-extra-lines.patch b/t/t1800-import/patches/delete-extra-lines.patch
new file mode 100644
index 0000000..e5b7a65
--- /dev/null
+++ b/t/t1800-import/patches/delete-extra-lines.patch
@@ -0,0 +1,22 @@
+delete extra lines
+
+From: Clark Williams <williams@redhat.com>
+
+
+---
+ jabberwocky.txt |    2 --
+ 1 files changed, 0 insertions(+), 2 deletions(-)
+
+diff --git a/jabberwocky.txt b/jabberwocky.txt
+index 98cb716..066d2e8 100644
+--- a/jabberwocky.txt
++++ b/jabberwocky.txt
+@@ -28,8 +28,6 @@ He left it dead, and with its head
+ O frabjous day! Callooh! Callay!'
+   He chortled in his joy.
+ 
+-
+-
+ `Twas brillig, and the slithy toves
+   Did gyre and gimble in the wabe;
+ All mimsy were the borogoves,
diff --git a/t/t1800-import/patches/fifth-stanza.patch b/t/t1800-import/patches/fifth-stanza.patch
new file mode 100644
index 0000000..4f0e77c
--- /dev/null
+++ b/t/t1800-import/patches/fifth-stanza.patch
@@ -0,0 +1,22 @@
+fifth stanza
+
+From: Clark Williams <williams@redhat.com>
+
+
+---
+ jabberwocky.txt |    5 +++++
+ 1 files changed, 5 insertions(+), 0 deletions(-)
+
+diff --git a/jabberwocky.txt b/jabberwocky.txt
+index b1c2ad3..f1416dc 100644
+--- a/jabberwocky.txt
++++ b/jabberwocky.txt
+@@ -17,3 +17,8 @@ And, as in uffish thought he stood,
+   The Jabberwock, with eyes of flame,
+ Came whiffling through the tulgey wood,
+   And burbled as it came!
++
++One, two! One, two! And through and through
++  The vorpal blade went snicker-snack!
++He left it dead, and with its head
++  He went galumphing back.
diff --git a/t/t1800-import/patches/first-stanza.patch b/t/t1800-import/patches/first-stanza.patch
new file mode 100644
index 0000000..ee7818f
--- /dev/null
+++ b/t/t1800-import/patches/first-stanza.patch
@@ -0,0 +1,18 @@
+first stanza
+
+From: Clark Williams <williams@redhat.com>
+
+
+---
+ jabberwocky.txt |    4 ++++
+ 1 files changed, 4 insertions(+), 0 deletions(-)
+
+diff --git a/jabberwocky.txt b/jabberwocky.txt
+index e69de29..fba24dc 100644
+--- a/jabberwocky.txt
++++ b/jabberwocky.txt
+@@ -0,0 +1,4 @@
++`Twas brillig, and the slithy toves
++  Did gyre and gimble in the wabe:
++All mimsy were the borogoves,
++  And the mome raths outgrabe.
diff --git a/t/t1800-import/patches/fourth-stanza.patch b/t/t1800-import/patches/fourth-stanza.patch
new file mode 100644
index 0000000..eb2f8f2
--- /dev/null
+++ b/t/t1800-import/patches/fourth-stanza.patch
@@ -0,0 +1,22 @@
+fourth stanza
+
+From: Clark Williams <williams@redhat.com>
+
+
+---
+ jabberwocky.txt |    5 +++++
+ 1 files changed, 5 insertions(+), 0 deletions(-)
+
+diff --git a/jabberwocky.txt b/jabberwocky.txt
+index 6405f36..b1c2ad3 100644
+--- a/jabberwocky.txt
++++ b/jabberwocky.txt
+@@ -12,3 +12,8 @@ He took his vorpal sword in hand:
+   Long time the manxome foe he sought --
+ So rested he by the Tumtum tree,
+   And stood awhile in thought.
++
++And, as in uffish thought he stood,
++  The Jabberwock, with eyes of flame,
++Came whiffling through the tulgey wood,
++  And burbled as it came!
diff --git a/t/t1800-import/patches/second-stanza.patch b/t/t1800-import/patches/second-stanza.patch
new file mode 100644
index 0000000..bec1622
--- /dev/null
+++ b/t/t1800-import/patches/second-stanza.patch
@@ -0,0 +1,22 @@
+second stanza
+
+From: Clark Williams <williams@redhat.com>
+
+
+---
+ jabberwocky.txt |    5 +++++
+ 1 files changed, 5 insertions(+), 0 deletions(-)
+
+diff --git a/jabberwocky.txt b/jabberwocky.txt
+index fba24dc..9ed0b49 100644
+--- a/jabberwocky.txt
++++ b/jabberwocky.txt
+@@ -2,3 +2,8 @@
+   Did gyre and gimble in the wabe:
+ All mimsy were the borogoves,
+   And the mome raths outgrabe.
++
++"Beware the Jabberwock, my son!
++  The jaws that bite, the claws that catch!
++Beware the Jubjub bird, and shun
++  The frumious Bandersnatch!"
diff --git a/t/t1800-import/patches/series b/t/t1800-import/patches/series
new file mode 100644
index 0000000..5945c98
--- /dev/null
+++ b/t/t1800-import/patches/series
@@ -0,0 +1,10 @@
+# This series applies on GIT commit 6a8b6f6e2ecbcab26de7656b66b7f30eeba1ee96
+first-stanza.patch
+second-stanza.patch
+third-stanza.patch
+fourth-stanza.patch
+fifth-stanza.patch
+sixth-stanza.patch
+seventh-stanza.patch
+delete-extra-lines.patch
+attribution.patch
diff --git a/t/t1800-import/patches/seventh-stanza.patch b/t/t1800-import/patches/seventh-stanza.patch
new file mode 100644
index 0000000..555c200
--- /dev/null
+++ b/t/t1800-import/patches/seventh-stanza.patch
@@ -0,0 +1,24 @@
+seventh stanza
+
+From: Clark Williams <williams@redhat.com>
+
+
+---
+ jabberwocky.txt |    7 +++++++
+ 1 files changed, 7 insertions(+), 0 deletions(-)
+
+diff --git a/jabberwocky.txt b/jabberwocky.txt
+index bf732f5..98cb716 100644
+--- a/jabberwocky.txt
++++ b/jabberwocky.txt
+@@ -27,3 +27,10 @@ He left it dead, and with its head
+   Come to my arms, my beamish boy!
+ O frabjous day! Callooh! Callay!'
+   He chortled in his joy.
++
++
++
++`Twas brillig, and the slithy toves
++  Did gyre and gimble in the wabe;
++All mimsy were the borogoves,
++  And the mome raths outgrabe.
diff --git a/t/t1800-import/patches/sixth-stanza.patch b/t/t1800-import/patches/sixth-stanza.patch
new file mode 100644
index 0000000..2349b7e
--- /dev/null
+++ b/t/t1800-import/patches/sixth-stanza.patch
@@ -0,0 +1,22 @@
+sixth stanza
+
+From: Clark Williams <williams@redhat.com>
+
+
+---
+ jabberwocky.txt |    5 +++++
+ 1 files changed, 5 insertions(+), 0 deletions(-)
+
+diff --git a/jabberwocky.txt b/jabberwocky.txt
+index f1416dc..bf732f5 100644
+--- a/jabberwocky.txt
++++ b/jabberwocky.txt
+@@ -22,3 +22,8 @@ One, two! One, two! And through and through
+   The vorpal blade went snicker-snack!
+ He left it dead, and with its head
+   He went galumphing back.
++
++"And, has thou slain the Jabberwock?
++  Come to my arms, my beamish boy!
++O frabjous day! Callooh! Callay!'
++  He chortled in his joy.
diff --git a/t/t1800-import/patches/third-stanza.patch b/t/t1800-import/patches/third-stanza.patch
new file mode 100644
index 0000000..d942353
--- /dev/null
+++ b/t/t1800-import/patches/third-stanza.patch
@@ -0,0 +1,22 @@
+third stanza
+
+From: Clark Williams <williams@redhat.com>
+
+
+---
+ jabberwocky.txt |    5 +++++
+ 1 files changed, 5 insertions(+), 0 deletions(-)
+
+diff --git a/jabberwocky.txt b/jabberwocky.txt
+index 9ed0b49..6405f36 100644
+--- a/jabberwocky.txt
++++ b/jabberwocky.txt
+@@ -7,3 +7,8 @@ All mimsy were the borogoves,
+   The jaws that bite, the claws that catch!
+ Beware the Jubjub bird, and shun
+   The frumious Bandersnatch!"
++
++He took his vorpal sword in hand:
++  Long time the manxome foe he sought --
++So rested he by the Tumtum tree,
++  And stood awhile in thought.

^ permalink raw reply related

* Re: [PATCH] parse-opt: migrate builtin-checkout-index.
From: Raphael Zimmerer @ 2008-10-19 19:29 UTC (permalink / raw)
  To: Miklos Vajna; +Cc: Junio C Hamano, Pierre Habouzit, git
In-Reply-To: <1224292643-28704-1-git-send-email-vmiklos@frugalware.org>

On Sat, Oct 18, 2008 at 03:17:23AM +0200, Miklos Vajna wrote:
> Right, I fixed this in option_parse_z(). --no-z should set
> line_termination to \n instead of 1.

How about "--no-null"?

The long option name for "-z" is "--null", as used in git-config and
git-grep. So I suggest to use that as the long option name for "-z",
as the enhanced option parser automatically will recongnize
"--no-null", when used. That helps avoid further confusion with git
option names.

 - Raphael

^ permalink raw reply

* Re: [PATCH] parse-opt: migrate builtin-checkout-index.
From: Pierre Habouzit @ 2008-10-19 19:34 UTC (permalink / raw)
  To: Raphael Zimmerer; +Cc: Miklos Vajna, Junio C Hamano, git
In-Reply-To: <20081019192906.GA26073@rdrz.de>

[-- Attachment #1: Type: text/plain, Size: 872 bytes --]

On Sun, Oct 19, 2008 at 07:29:08PM +0000, Raphael Zimmerer wrote:
> On Sat, Oct 18, 2008 at 03:17:23AM +0200, Miklos Vajna wrote:
> > Right, I fixed this in option_parse_z(). --no-z should set
> > line_termination to \n instead of 1.
> 
> How about "--no-null"?
> 
> The long option name for "-z" is "--null", as used in git-config and
> git-grep. So I suggest to use that as the long option name for "-z",
> as the enhanced option parser automatically will recongnize
> "--no-null", when used. That helps avoid further confusion with git
> option names.

git checkout-index has no --null option. If you make --null be the long
form for -z then --no-null will be "autogenerated".
-- 
·O·  Pierre Habouzit
··O                                                madcoder@debian.org
OOO                                                http://www.madism.org

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply

* Re: Detached checkout will clobber branch head when using symlink HEAD
From: Junio C Hamano @ 2008-10-19 19:36 UTC (permalink / raw)
  To: Jeff King; +Cc: Matt Draisey, git
In-Reply-To: <20081019130050.GA1822@coredump.intra.peff.net>

Jeff King <peff@peff.net> writes:

> But if I am reading your patch right, you are actually enabling detached
> HEAD in this instance, which is much better. Unfortunately, I had quite
> a few conflicts in applying your patches on top of master (with or
> without the patch from "checkout --track -b broken"), and when I thought
> I had fixed up the result, the test actually still failed.
>
> So I will take your word that it actually works, and that I screwed up
> resolving the conflicts.

It's the three-patch series that leads to 684968c (Fix checkout not to
clobber the branch when using symlinked HEAD upon detaching, 2008-10-17).

> PS If you are rebasing or resolving anyway, as I suspect you will have
> to, there is a typo in the test: s/detch/detach/

Thanks; the series was only in 'pu', so I will.

^ permalink raw reply

* [PATCH] Teach/Fix pull/fetch -q/-v options
From: Tuncer Ayaz @ 2008-10-19 19:48 UTC (permalink / raw)
  To: git; +Cc: gitster

After fixing clone -q I noticed that pull -q does not do what
it's supposed to do and implemented --quiet/--verbose by
adding it to builtin-merge and fixing two places in builtin-fetch.

I have not touched/adjusted contrib/completion/git-completion.bash
but can take a look if wanted. I think it already needs one or two
adjustments caused by recent --OPTIONS changes in master.

I've tested the following invocations with the below changes applied:
$ git pull
$ git pull -q
$ git pull -v

This is the next attempt trying to incorporate Junio's
suggestions and I'm not sure about the following:
1) having the same option callback function in both modules
2) my adaption of the following two lines from
builtin-fetch.c to the new verbosity option:
    if (verbosity == VERBOSE)
        transport->verbose = 1;
    if (verbosity == QUIET)
        transport->verbose = -1;
3) my usage of OPTION_CALLBACK
4) my support for overriding -q or -v
as implemented in git-pull.sh by appending
-q or -v as it is passed to the script

therefore please correct me if I did it wrong or my
cb fun has an obvious defect. it may very well
have one :)

This revision does actually override verbosity
based on what was supplied later in argv (-q or -v).

Signed-off-by: Tuncer Ayaz <tuncer.ayaz@gmail.com>
---
 Documentation/merge-options.txt |    8 +++++++
 builtin-fetch.c                 |   39 ++++++++++++++++++++++++++++---------
 builtin-merge.c                 |   40 ++++++++++++++++++++++++++++++++------
 git-pull.sh                     |   10 +++++++-
 4 files changed, 78 insertions(+), 19 deletions(-)

diff --git a/Documentation/merge-options.txt b/Documentation/merge-options.txt
index 007909a..427cdef 100644
--- a/Documentation/merge-options.txt
+++ b/Documentation/merge-options.txt
@@ -1,3 +1,11 @@
+-q::
+--quiet::
+	Operate quietly.
+
+-v::
+--verbose::
+	Be verbose.
+
 --stat::
 	Show a diffstat at the end of the merge. The diffstat is also
 	controlled by the configuration option merge.stat.
diff --git a/builtin-fetch.c b/builtin-fetch.c
index ee93d3a..2596aee 100644
--- a/builtin-fetch.c
+++ b/builtin-fetch.c
@@ -22,16 +22,35 @@ enum {
 	TAGS_SET = 2
 };
 
-static int append, force, keep, update_head_ok, verbose, quiet;
+static int append, force, keep, update_head_ok;
 static int tags = TAGS_DEFAULT;
 static const char *depth;
 static const char *upload_pack;
 static struct strbuf default_rla = STRBUF_INIT;
 static struct transport *transport;
+static enum { QUIET, NORMAL, VERBOSE } verbosity = NORMAL;
+
+static int option_parse_quiet(const struct option *opt,
+			  const char *arg, int unset)
+{
+	verbosity = QUIET;
+	return 0;
+}
+
+static int option_parse_verbose(const struct option *opt,
+			  const char *arg, int unset)
+{
+	verbosity = VERBOSE;
+	return 0;
+}
 
 static struct option builtin_fetch_options[] = {
-	OPT__QUIET(&quiet),
-	OPT__VERBOSE(&verbose),
+	{ OPTION_CALLBACK, 'q', "quiet", NULL, NULL,
+		"operate quietly",
+		PARSE_OPT_NOARG, option_parse_quiet },
+	{ OPTION_CALLBACK, 'v', "verbose", NULL, NULL,
+		"be verbose",
+		PARSE_OPT_NOARG, option_parse_verbose },
 	OPT_BOOLEAN('a', "append", &append,
 		    "append to .git/FETCH_HEAD instead of overwriting"),
 	OPT_STRING(0, "upload-pack", &upload_pack, "PATH",
@@ -192,7 +211,6 @@ static int s_update_ref(const char *action,
 
 static int update_local_ref(struct ref *ref,
 			    const char *remote,
-			    int verbose,
 			    char *display)
 {
 	struct commit *current = NULL, *updated;
@@ -210,7 +228,7 @@ static int update_local_ref(struct ref *ref,
 		die("object %s not found", sha1_to_hex(ref->new_sha1));
 
 	if (!hashcmp(ref->old_sha1, ref->new_sha1)) {
-		if (verbose)
+		if (verbosity == VERBOSE)
 			sprintf(display, "= %-*s %-*s -> %s", SUMMARY_WIDTH,
 				"[up to date]", REFCOL_WIDTH, remote,
 				pretty_ref);
@@ -366,18 +384,19 @@ static int store_updated_refs(const char *url, const char *remote_name,
 			note);
 
 		if (ref)
-			rc |= update_local_ref(ref, what, verbose, note);
+			rc |= update_local_ref(ref, what, note);
 		else
 			sprintf(note, "* %-*s %-*s -> FETCH_HEAD",
 				SUMMARY_WIDTH, *kind ? kind : "branch",
 				 REFCOL_WIDTH, *what ? what : "HEAD");
 		if (*note) {
-			if (!shown_url) {
+			if (verbosity > QUIET && !shown_url) {
 				fprintf(stderr, "From %.*s\n",
 						url_len, url);
 				shown_url = 1;
 			}
-			fprintf(stderr, " %s\n", note);
+			if (verbosity > QUIET)
+				fprintf(stderr, " %s\n", note);
 		}
 	}
 	fclose(fp);
@@ -622,9 +641,9 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
 		remote = remote_get(argv[0]);
 
 	transport = transport_get(remote, remote->url[0]);
-	if (verbose >= 2)
+	if (verbosity == VERBOSE)
 		transport->verbose = 1;
-	if (quiet)
+	if (verbosity == QUIET)
 		transport->verbose = -1;
 	if (upload_pack)
 		set_option(TRANS_OPT_UPLOADPACK, upload_pack);
diff --git a/builtin-merge.c b/builtin-merge.c
index 5e2b7f1..8259acb 100644
--- a/builtin-merge.c
+++ b/builtin-merge.c
@@ -50,6 +50,7 @@ static unsigned char head[20], stash[20];
 static struct strategy **use_strategies;
 static size_t use_strategies_nr, use_strategies_alloc;
 static const char *branch;
+static enum { QUIET, NORMAL, VERBOSE } verbosity = NORMAL;
 
 static struct strategy all_strategy[] = {
 	{ "recursive",  DEFAULT_TWOHEAD | NO_TRIVIAL },
@@ -151,7 +152,27 @@ static int option_parse_n(const struct option *opt,
 	return 0;
 }
 
+static int option_parse_quiet(const struct option *opt,
+			  const char *arg, int unset)
+{
+	verbosity = QUIET;
+	return 0;
+}
+
+static int option_parse_verbose(const struct option *opt,
+			  const char *arg, int unset)
+{
+	verbosity = VERBOSE;
+	return 0;
+}
+
 static struct option builtin_merge_options[] = {
+	{ OPTION_CALLBACK, 'q', "quiet", NULL, NULL,
+		"operate quietly",
+		PARSE_OPT_NOARG, option_parse_quiet },
+	{ OPTION_CALLBACK, 'v', "verbose", NULL, NULL,
+		"be verbose",
+		PARSE_OPT_NOARG, option_parse_verbose },
 	{ OPTION_CALLBACK, 'n', NULL, NULL, NULL,
 		"do not show a diffstat at the end of the merge",
 		PARSE_OPT_NOARG, option_parse_n },
@@ -249,7 +270,8 @@ static void restore_state(void)
 /* This is called when no merge was necessary. */
 static void finish_up_to_date(const char *msg)
 {
-	printf("%s%s\n", squash ? " (nothing to squash)" : "", msg);
+	if (verbosity > QUIET)
+		printf("%s%s\n", squash ? " (nothing to squash)" : "", msg);
 	drop_save();
 }
 
@@ -330,14 +352,15 @@ static void finish(const unsigned char *new_head, const char *msg)
 	if (!msg)
 		strbuf_addstr(&reflog_message, getenv("GIT_REFLOG_ACTION"));
 	else {
-		printf("%s\n", msg);
+		if (verbosity > QUIET)
+			printf("%s\n", msg);
 		strbuf_addf(&reflog_message, "%s: %s",
 			getenv("GIT_REFLOG_ACTION"), msg);
 	}
 	if (squash) {
 		squash_message();
 	} else {
-		if (!merge_msg.len)
+		if (verbosity > QUIET && !merge_msg.len)
 			printf("No merge message -- not updating HEAD\n");
 		else {
 			const char *argv_gc_auto[] = { "gc", "--auto", NULL };
@@ -871,6 +894,8 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
 
 	argc = parse_options(argc, argv, builtin_merge_options,
 			builtin_merge_usage, 0);
+	if (verbosity > QUIET)
+		show_diffstat = 0;
 
 	if (squash) {
 		if (!allow_fast_forward)
@@ -1012,10 +1037,11 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
 
 		strcpy(hex, find_unique_abbrev(head, DEFAULT_ABBREV));
 
-		printf("Updating %s..%s\n",
-			hex,
-			find_unique_abbrev(remoteheads->item->object.sha1,
-			DEFAULT_ABBREV));
+		if (verbosity > QUIET)
+			printf("Updating %s..%s\n",
+				hex,
+				find_unique_abbrev(remoteheads->item->object.sha1,
+				DEFAULT_ABBREV));
 		strbuf_addstr(&msg, "Fast forward");
 		if (have_message)
 			strbuf_addstr(&msg,
diff --git a/git-pull.sh b/git-pull.sh
index 75c3610..dc613db 100755
--- a/git-pull.sh
+++ b/git-pull.sh
@@ -16,6 +16,7 @@ cd_to_toplevel
 test -z "$(git ls-files -u)" ||
 	die "You are in the middle of a conflicted merge."
 
+verbosity=
 strategy_args= no_stat= no_commit= squash= no_ff= log_arg=
 curr_branch=$(git symbolic-ref -q HEAD)
 curr_branch_short=$(echo "$curr_branch" | sed "s|refs/heads/||")
@@ -23,6 +24,10 @@ rebase=$(git config --bool branch.$curr_branch_short.rebase)
 while :
 do
 	case "$1" in
+	-q|--quiet)
+		verbosity="$verbosity -q" ;;
+	-v|--verbose)
+		verbosity="$verbosity -v" ;;
 	-n|--no-stat|--no-summary)
 		no_stat=-n ;;
 	--stat|--summary)
@@ -121,7 +126,7 @@ test true = "$rebase" && {
 		"refs/remotes/$origin/$reflist" 2>/dev/null)"
 }
 orig_head=$(git rev-parse --verify HEAD 2>/dev/null)
-git fetch --update-head-ok "$@" || exit 1
+git fetch $verbosity --update-head-ok "$@" || exit 1
 
 curr_head=$(git rev-parse --verify HEAD 2>/dev/null)
 if test "$curr_head" != "$orig_head"
@@ -181,5 +186,6 @@ merge_name=$(git fmt-merge-msg $log_arg <"$GIT_DIR/FETCH_HEAD") || exit
 test true = "$rebase" &&
 	exec git-rebase $strategy_args --onto $merge_head \
 	${oldremoteref:-$merge_head}
-exec git-merge $no_stat $no_commit $squash $no_ff $log_arg $strategy_args \
+exec git-merge $verbosity $no_stat $no_commit \
+	$squash $no_ff $log_arg $strategy_args \
 	"$merge_name" HEAD $merge_head
-- 
1.6.0.2.GIT

^ permalink raw reply related

* Moving a 5 person dev team from CVS to git
From: Francis Galiegue @ 2008-10-19 19:27 UTC (permalink / raw)
  To: git

Hello,

I work for a software company with a dev team of 5, and right now a CVS 
repository is used for all the code which covers 8 years of history among 52 
modules and 1.6 GB data.

All devs use Eclipse, and its featureful CVS plugin. As for myself, I also 
write to the CVS tree, but in a CVS-to-git-to-CVS cycle (I don't use Eclipse 
but command line). I have talked about git, shown some of its capabilities, 
and my boss agreed to give it a shot, but with the following conditions:

* it must provide CVS access (branching and tagging included), as a transition 
measure;
* there must be an Eclipse plugin.

I have successfully imported all CVS modules into an equivalent number of git 
repositories so far. Unfortunately, I have two problems:

* the git-cvsserver does not support branching and tagging;
* I have successfully built the Eclipse plugin (Java 6, Eclipse 3.4), but am 
unable to make it clone a repository and see it in a project, despite quite a 
few hours googling around (it _does_ clone, I see the repo in the workspace; 
but it's invisible within Eclipse).

Is branching and tagging support a planned feature for git-cvsserver? Also, is 
there a step-by-step guide on using egit to clone an existing repository? 
(I'm a total beginner with Eclipse, so it may well be that I need to google 
some more.)

Thanks,
-- 
fge

^ permalink raw reply

* Re: [PATCH v2] Fix testcase failure when extended attributes are in use
From: Junio C Hamano @ 2008-10-19 19:59 UTC (permalink / raw)
  To: Deskin Miller; +Cc: git, heikki.orsila
In-Reply-To: <20081019122419.GA2015@riemann.deskinm.fdns.net>

Deskin Miller <deskinm@umich.edu> writes:

> My patch, on the other hand, is to deal with 'ls' output in case a file has
> certain filesystem extended attributes.  These could be e.g. POSIX ACLs, or a
> SELinux security context, or perhaps others.  If such an extended attribute is
> present, 'ls -l' will print permissions with a '+' appended, e.g.
> -rw-r--r--+
> Instead of
> -rw-r--r--
> ...
> For what it's worth, I've experienced this failure on my Ubuntu 8.04 laptop
> with SELinux permissive mode, so it's possible ls behaves slightly differently
> on other systems; I've not been able to determine this one way or another.

Is there way to explicitly tell "ls -l" not to do this, I have to wonder?

POSIX.1 says that the file mode written under the -l option is
"%c%s%s%s%c" (where the first %c is for type, three %s are for owner,
group and other perm, and the last %c is "optional alternate access method
flag").  If there is no alternate or additional access control method
associated with the file, the "optional alternate access method flag"
would be a single SP, otherwise it would be a printable character.

If we drop the default ACL from the trash directory like Matt's patch
does, does a file created in there (i.e. the ones we check with /bin/ls)
still have "alternate or additional access control method associated with"
it?

Somehow it feels wrong that you need your patch, but if you do, stripping
only the trailing '+' as your patch does not look sufficient, either.
Shouldn't we be stripping the last letter if the length of actual is
longer than strlen("-rwxrwxrwx"), as any printable can come there?

 t/t1301-shared-repo.sh |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git c/t/t1301-shared-repo.sh i/t/t1301-shared-repo.sh
index 2275caa..653362b 100755
--- c/t/t1301-shared-repo.sh
+++ i/t/t1301-shared-repo.sh
@@ -20,6 +20,10 @@ test_expect_success 'shared = 0400 (faulty permission u-w)' '
 	test $ret != "0"
 '
 
+modebits () {
+	ls -l "$1" | sed -e 's|^\(..........\).*|\1|'
+}
+
 for u in 002 022
 do
 	test_expect_success "shared=1 does not clear bits preset by umask $u" '
@@ -85,8 +89,7 @@ do
 
 		rm -f .git/info/refs &&
 		git update-server-info &&
-		actual="$(ls -l .git/info/refs)" &&
-		actual=${actual%% *} &&
+		actual="$(modebits .git/info/refs)" &&
 		test "x$actual" = "x-$y" || {
 			ls -lt .git/info
 			false
@@ -98,8 +101,7 @@ do
 
 		rm -f .git/info/refs &&
 		git update-server-info &&
-		actual="$(ls -l .git/info/refs)" &&
-		actual=${actual%% *} &&
+		actual="$(modebits .git/info/refs)" &&
 		test "x$actual" = "x-$x" || {
 			ls -lt .git/info
 			false

^ permalink raw reply related

* Re: [RFC PATCH v3] Documentation: add manpage about workflows
From: Junio C Hamano @ 2008-10-19 20:07 UTC (permalink / raw)
  To: Thomas Rast; +Cc: git, santi, Dmitry Potapov
In-Reply-To: <1224429622-1548-1-git-send-email-trast@student.ethz.ch>

Thomas Rast <trast@student.ethz.ch> writes:

> This attempts to make a manpage about workflows that is both handy to
> point people at it and as a beginner's introduction.

Is this still "RFC PATCH" or meant for application?

I did not find many things that I find objectionable.  On the other hand,
I am not a good person to judge if this documentation is easily
understandable by beginners (anymore).  Do others who interact regularly
with new people have comments?

^ permalink raw reply

* Re: [PATCH] parse-opt: migrate builtin-checkout-index.
From: Junio C Hamano @ 2008-10-19 20:11 UTC (permalink / raw)
  To: Miklos Vajna; +Cc: Pierre Habouzit, git
In-Reply-To: <1224441040-5071-1-git-send-email-vmiklos@frugalware.org>

Miklos Vajna <vmiklos@frugalware.org> writes:

> Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
> ---
>
> On Sat, Oct 18, 2008 at 03:17:23AM +0200, Miklos Vajna <vmiklos@frugalware.org> wrote:
>> > This adds a new feature to say --no-z from the command line, doesn't
>> > it?
>> > And I suspect the feature is broken ;-).
>>
>> Right, I fixed this in option_parse_z(). --no-z should set
>> line_termination to \n instead of 1.
>
> Originally in option_parse_z() I had
>
>         line_termination = unset;
>
> which is in fact right, because (as Pierre pointed out) unset for short
> options are always false, but I changed it to
>
>         line_termination = 0;
>
> to make it more readable.

I think Pierre's comment is short-sighted.  Think of what would happen
when somebody adds "--nul" as a longer equivalent to "-z", since it is
extremely easy to do things like that with the use of parse-opt API?

^ permalink raw reply

* Re: [PATCH] parse-opt: migrate builtin-checkout-index.
From: Pierre Habouzit @ 2008-10-19 20:19 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Miklos Vajna, git
In-Reply-To: <7vabd073bg.fsf@gitster.siamese.dyndns.org>

[-- Attachment #1: Type: text/plain, Size: 1509 bytes --]

On Sun, Oct 19, 2008 at 08:11:31PM +0000, Junio C Hamano wrote:
> Miklos Vajna <vmiklos@frugalware.org> writes:
> 
> > Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
> > ---
> >
> > On Sat, Oct 18, 2008 at 03:17:23AM +0200, Miklos Vajna <vmiklos@frugalware.org> wrote:
> >> > This adds a new feature to say --no-z from the command line, doesn't
> >> > it?
> >> > And I suspect the feature is broken ;-).
> >>
> >> Right, I fixed this in option_parse_z(). --no-z should set
> >> line_termination to \n instead of 1.
> >
> > Originally in option_parse_z() I had
> >
> >         line_termination = unset;
> >
> > which is in fact right, because (as Pierre pointed out) unset for short
> > options are always false, but I changed it to
> >
> >         line_termination = 0;
> >
> > to make it more readable.
> 
> I think Pierre's comment is short-sighted.  Think of what would happen
> when somebody adds "--nul" as a longer equivalent to "-z", since it is
> extremely easy to do things like that with the use of parse-opt API?

Err I was only pointing out that --no-z would no nothing, I actually
didn't really read the argument :)  I didn't say having --null was a bad
idea, and I think we have -z/--null at a couple of places already, and
it's probably a good thing to actually _add_ --null.

-- 
·O·  Pierre Habouzit
··O                                                madcoder@debian.org
OOO                                                http://www.madism.org

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply

* Re: Moving a 5 person dev team from CVS to git
From: Shawn O. Pearce @ 2008-10-19 20:20 UTC (permalink / raw)
  To: Francis Galiegue; +Cc: git
In-Reply-To: <200810192127.55954.fg@one2team.net>

Francis Galiegue <fg@one2team.net> wrote:
> 
> I have successfully imported all CVS modules into an equivalent number of git 
> repositories so far. Unfortunately, I have two problems:
> 
> * the git-cvsserver does not support branching and tagging;
> * I have successfully built the Eclipse plugin (Java 6, Eclipse 3.4), but am 
> unable to make it clone a repository and see it in a project, despite quite a 
> few hours googling around (it _does_ clone, I see the repo in the workspace; 
> but it's invisible within Eclipse).

After a clone is complete you need to import the projects from your
the directory you cloned into.  File->Import; General->Existing
projects; select the directory in your workspace where the repo
is housed, or just select your workspace and let Eclipse search
recursively for the projects.

We'd like to support automatically importing the projects after
the clone is complete, but thus far we haven't put the effort into
restarting the import wizard UI after the download is done.
 
> Is branching and tagging support a planned feature for git-cvsserver?

No.  Nor is it likely to ever get added.  Development on
git-cvsserver is stalled as the code is complete enough for anyone
who actively uses it today.  Patches for it are welcome if you are
willing to take over development and maintenance of it.  But its
more-or-less frozen at this point.

> Also, is 
> there a step-by-step guide on using egit to clone an existing repository? 
> (I'm a total beginner with Eclipse, so it may well be that I need to google 
> some more.)

No, not yet.  You could try adding it to the egit wiki page(s):

  http://git.or.cz/gitwiki/EclipsePlugin

-- 
Shawn.

^ permalink raw reply

* Re: [PATCH] parse-opt: migrate builtin-checkout-index.
From: Junio C Hamano @ 2008-10-19 20:59 UTC (permalink / raw)
  To: Pierre Habouzit; +Cc: Miklos Vajna, git
In-Reply-To: <20081019201934.GO16610@artemis.corp>

Pierre Habouzit <madcoder@debian.org> writes:

> On Sun, Oct 19, 2008 at 08:11:31PM +0000, Junio C Hamano wrote:
>> Miklos Vajna <vmiklos@frugalware.org> writes:
>
>> >> Right, I fixed this in option_parse_z(). --no-z should set
>> >> line_termination to \n instead of 1.
>> >
>> > Originally in option_parse_z() I had
>> >
>> >         line_termination = unset;
>> >
>> > which is in fact right, because (as Pierre pointed out) unset for short
>> > options are always false, but I changed it to
>> >
>> >         line_termination = 0;
>> >
>> > to make it more readable.
>> 
>> I think Pierre's comment is short-sighted.  Think of what would happen
>> when somebody adds "--nul" as a longer equivalent to "-z", since it is
>> extremely easy to do things like that with the use of parse-opt API?
>
> Err I was only pointing out that --no-z would no nothing, I actually
> didn't really read the argument :)  I didn't say having --null was a bad
> idea,...

It is a good practice to anticipate potential future breakages, assess the
cost to avoid them, avoid the ones that can be avoided with minimum cost
(and document the others you know will be broken).  That's the key to
produce maintainable piece of code.  The change necessary to Miklos's
original code to do this is quite simple (i.e. flip between '\0' and
'\n'), and I didn't see any room for argument like "short option won't let
you say --no-z".  That's where my comment about "short-sighted"-ness comes
from.

^ permalink raw reply

* Re: [PATCH v2] Add command line option --chdir/-C to allow setting git process work directory.
From: Jeff King @ 2008-10-19 21:02 UTC (permalink / raw)
  To: Maciej Pasternacki; +Cc: git
In-Reply-To: <20081019161819.GA12495@charybdis.dreamhost.com>

On Sun, Oct 19, 2008 at 09:18:19AM -0700, Maciej Pasternacki wrote:

> When "git pull" is ran outside of work tree, it is unable to update work tree
> with pulled changes; specifying --git-dir and --work-tree does not help here
> because "cd_to_toplevel" call in git-pull occurs after "require_work_tree";
> changing order may break the commend if there is no working tree.  Some more
> commands behave in a similar way.

I took a closer look at this. I'm not sure that there is actually a
problem with moving the cd_to_toplevel before require_work_tree.
cd_to_toplevel makes sure there is actually something to cdup to. In my
test without a work-tree, "git rev-parse --show-cdup" simply printed
nothing, causing no "cd" to occur.

Moreover, git-pull is not the only script with this problem. There are
quite a few with

  require_work_tree
  cd_to_toplevel

which will break in the same way with --work-tree. And there are even
more with just require_work_tree that don't cd_to_toplevel at all. So I
suspect that --work-tree is largely broken in our scripts and nobody has
actually tried it.

So:

  1. I think we can fix this breakage by swapping the two.

  2. There is still breakage in other scripts, some of which may need
     quite in-depth fixes (e.g., git-bisect requires a work tree but
     does not chdir at all. For the require_work_tree test to work, it
     needs to be inside the work tree, and the script will need a
     careful looking over to see what ramifications that has).

  3. I think your -C option has some merit independent of this, since
     it allows you to chdir and still use the usual lookup rules (e.g.,
     see if it is bare vs a regular repository). But I don't feel
     strongly about it one way or the other.

-Peff

^ permalink raw reply

* Re: Usability of git stash
From: Leo Razoumov @ 2008-10-19 21:08 UTC (permalink / raw)
  To: Shawn O. Pearce, git; +Cc: Anders Melchiorsen, Brandon Casey, David Kastrup
In-Reply-To: <20081019184029.GF14786@spearce.org>

On 10/19/08, Shawn O. Pearce <spearce@spearce.org> wrote:
> [..snip..]
> Indeed, that's an advantage of the wip commit approach, you can shove
>  the untracked files quickly into the wip commit, especially with 1.6:
>
>         git commit -A -m wip
>
> [..snip..]

What version of git are you using?
I am using git-1.6.0.2 on Linux and "-A" is illegal option for "git commit"

--Leo--

^ permalink raw reply

* [GITK PATCH] Add menu accelerators
From: Robin Rosenberg @ 2008-10-19 21:19 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: git
In-Reply-To: <18681.53866.855255.688290@cargo.ozlabs.ibm.com>

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---

lördagen den 18 oktober 2008 14.11.22 skrev Paul Mackerras:
> Have a look at what I just pushed out.  It adds infrastructure to let
> us use "&" in menu items to specify an alt+letter accelerator, but in
> a different way to your patches.  If you'd like to redo your patch to
> add "&" to the menu items, that would be good.

Looks fine. Seems to work too. Then we want to do the same thing
with buttons. Btw, is it only for me that the "popup menu key" does
not work for in gitk?

This patch does not include re-generated po's, nor the updated swedish translation.

-- robin

 gitk |   72 +++++++++++++++++++++++++++++++++---------------------------------
 1 files changed, 36 insertions(+), 36 deletions(-)

diff --git a/gitk b/gitk
index 3678de1..e65c0ce 100755
--- a/gitk
+++ b/gitk
@@ -1817,26 +1817,26 @@ proc makewindow {} {
     # The "mc" arguments here are purely so that xgettext
     # sees the following string as needing to be translated
     makemenu .bar {
-	{mc "File" cascade {
-	    {mc "Update" command updatecommits -accelerator F5}
-	    {mc "Reload" command reloadcommits}
-	    {mc "Reread references" command rereadrefs}
-	    {mc "List references" command showrefs}
-	    {mc "Quit" command doquit}
+	{mc "&File" cascade {
+	    {mc "&Update" command updatecommits -accelerator F5}
+	    {mc "&Reload" command reloadcommits}
+	    {mc "R&eread references" command rereadrefs}
+	    {mc "&List references" command showrefs}
+	    {mc "&Quit" command doquit}
 	}}
-	{mc "Edit" cascade {
-	    {mc "Preferences" command doprefs}
+	{mc "&Edit" cascade {
+	    {mc "&Preferences" command doprefs}
 	}}
-	{mc "View" cascade {
-	    {mc "New view..." command {newview 0}}
-	    {mc "Edit view..." command editview -state disabled}
-	    {mc "Delete view" command delview -state disabled}
+	{mc "&View" cascade {
+	    {mc "&New view..." command {newview 0}}
+	    {mc "&Edit view..." command editview -state disabled}
+	    {mc "&Delete view" command delview -state disabled}
 	    {xx "" separator}
-	    {mc "All files" radiobutton {selectedview 0} -command {showview 0}}
+	    {mc "&All files" radiobutton {selectedview 0} -command {showview 0}}
 	}}
-	{mc "Help" cascade {
-	    {mc "About gitk" command about}
-	    {mc "Key bindings" command keys}
+	{mc "&Help" cascade {
+	    {mc "&About gitk" command about}
+	    {mc "&Key bindings" command keys}
 	}}
     }
     . configure -menu .bar
@@ -2220,39 +2220,39 @@ proc makewindow {} {
 
     set rowctxmenu .rowctxmenu
     makemenu $rowctxmenu {
-	{mc "Diff this -> selected" command {diffvssel 0}}
-	{mc "Diff selected -> this" command {diffvssel 1}}
-	{mc "Make patch" command mkpatch}
-	{mc "Create tag" command mktag}
-	{mc "Write commit to file" command writecommit}
-	{mc "Create new branch" command mkbranch}
-	{mc "Cherry-pick this commit" command cherrypick}
-	{mc "Reset HEAD branch to here" command resethead}
+	{mc "Diff &this -> selected" command {diffvssel 0}}
+	{mc "Diff &selected -> this" command {diffvssel 1}}
+	{mc "Make &patch" command mkpatch}
+	{mc "Create ta&g" command mktag}
+	{mc "&Write commit to file" command writecommit}
+	{mc "Create new &branch" command mkbranch}
+	{mc "&Cherry-pick this commit" command cherrypick}
+	{mc "&Reset HEAD branch to here" command resethead}
     }
     $rowctxmenu configure -tearoff 0
 
     set fakerowmenu .fakerowmenu
     makemenu $fakerowmenu {
-	{mc "Diff this -> selected" command {diffvssel 0}}
-	{mc "Diff selected -> this" command {diffvssel 1}}
-	{mc "Make patch" command mkpatch}
+	{mc "Diff &this -> selected" command {diffvssel 0}}
+	{mc "Diff &selected -> this" command {diffvssel 1}}
+	{mc "Make &patch" command mkpatch}
     }
     $fakerowmenu configure -tearoff 0
 
     set headctxmenu .headctxmenu
     makemenu $headctxmenu {
-	{mc "Check out this branch" command cobranch}
-	{mc "Remove this branch" command rmbranch}
+	{mc "&Check out this branch" command cobranch}
+	{mc "&Remove this branch" command rmbranch}
     }
     $headctxmenu configure -tearoff 0
 
     global flist_menu
     set flist_menu .flistctxmenu
     makemenu $flist_menu {
-	{mc "Highlight this too" command {flist_hl 0}}
-	{mc "Highlight this only" command {flist_hl 1}}
-	{mc "External diff" command {external_diff}}
-	{mc "Blame parent commit" command {external_blame 1}}
+	{mc "Highlight this &too" command {flist_hl 0}}
+	{mc "Highlight this &only" command {flist_hl 1}}
+	{mc "E&xternal diff" command {external_diff}}
+	{mc "&Blame parent commit" command {external_blame 1}}
     }
     $flist_menu configure -tearoff 0
 }
@@ -7361,9 +7361,9 @@ proc rowmenu {x y id} {
     } else {
 	set menu $fakerowmenu
     }
-    $menu entryconfigure [mca "Diff this -> selected"] -state $state
-    $menu entryconfigure [mca "Diff selected -> this"] -state $state
-    $menu entryconfigure [mca "Make patch"] -state $state
+    $menu entryconfigure [mca "Diff &this -> selected"] -state $state
+    $menu entryconfigure [mca "Diff &selected -> this"] -state $state
+    $menu entryconfigure [mca "Make &patch"] -state $state
     tk_popup $menu $x $y
 }
 
-- 
1.6.0.2.308.gef4a

^ permalink raw reply related

* Re: [PATCH] Teach/Fix pull/fetch -q/-v options
From: Junio C Hamano @ 2008-10-19 21:26 UTC (permalink / raw)
  To: Tuncer Ayaz; +Cc: git
In-Reply-To: <1224445691-1366-1-git-send-email-tuncer.ayaz@gmail.com>

Tuncer Ayaz <tuncer.ayaz@gmail.com> writes:

> 2) my adaption of the following two lines from
> builtin-fetch.c to the new verbosity option:
>     if (verbosity == VERBOSE)
>         transport->verbose = 1;
>     if (verbosity == QUIET)
>         transport->verbose = -1;

Hmm, what's wrong with it?  Looks Ok to me...

>  static struct option builtin_fetch_options[] = {
> -	OPT__QUIET(&quiet),
> -	OPT__VERBOSE(&verbose),
> +	{ OPTION_CALLBACK, 'q', "quiet", NULL, NULL,
> +		"operate quietly",
> +		PARSE_OPT_NOARG, option_parse_quiet },
> +	{ OPTION_CALLBACK, 'v', "verbose", NULL, NULL,
> +		"be verbose",
> +		PARSE_OPT_NOARG, option_parse_verbose },

Isn't there a OPTION_FOO that assigns a constant to the given variable?

> @@ -192,7 +211,6 @@ static int s_update_ref(const char *action,
>  
>  static int update_local_ref(struct ref *ref,
>  			    const char *remote,
> -			    int verbose,
>  			    char *display)
>  {
>  	struct commit *current = NULL, *updated;
> ...
> @@ -366,18 +384,19 @@ static int store_updated_refs(const char *url, const char *remote_name,
>  			note);
>  
>  		if (ref)
> -			rc |= update_local_ref(ref, what, verbose, note);
> +			rc |= update_local_ref(ref, what, note);

Hmph, in the existing code, do_fetch()->fetch_refs()->store_updated_refs()
callchain relies on the "verbose" to be global anyway, so losing the
ability to call update_local_ref() with verbosity as parameter is not a
huge deal.

I however think it would be more beneficial in the longer term to keep
"verbosity" as parameter so the caller can tweak what the callee does, and
making large part of what cmd_fetch() does callable from outside.  That
would involve making the builtin_fetch_options[] on-stack, and passing
verbosity (and possibly other variables currently used as file-scope
global) as parameters, which is outside of the scope of your patch, but it
is something to keep in mind.

> diff --git a/git-pull.sh b/git-pull.sh
> index 75c3610..dc613db 100755
> --- a/git-pull.sh
> +++ b/git-pull.sh
> @@ -16,6 +16,7 @@ cd_to_toplevel
>  test -z "$(git ls-files -u)" ||
>  	die "You are in the middle of a conflicted merge."
>  
> +verbosity=
>  strategy_args= no_stat= no_commit= squash= no_ff= log_arg=
>  curr_branch=$(git symbolic-ref -q HEAD)
>  curr_branch_short=$(echo "$curr_branch" | sed "s|refs/heads/||")

It would fit at the end of the next line just fine, wouldn't it?

> @@ -23,6 +24,10 @@ rebase=$(git config --bool branch.$curr_branch_short.rebase)
>  while :
>  do
>  	case "$1" in
> +	-q|--quiet)
> +		verbosity="$verbosity -q" ;;
> +	-v|--verbose)
> +		verbosity="$verbosity -v" ;;

You know verbosity flags (-q and -v) are "the last one wins", so I do not
see much point in this concatenation.

^ permalink raw reply

* Re: [PATCH] parse-opt: migrate builtin-checkout-index.
From: Junio C Hamano @ 2008-10-19 21:45 UTC (permalink / raw)
  To: Miklos Vajna; +Cc: Pierre Habouzit, git
In-Reply-To: <1224292643-28704-1-git-send-email-vmiklos@frugalware.org>

Miklos Vajna <vmiklos@frugalware.org> writes:

>> > +   if (argc && read_from_stdin)
>> > +           die("--stdin must be at the end");
>>
>> Is this comment still correct?  Do the original and your version act
>> the
>> same way when the user says "checkout --stdin -f", for example?  I
>> suspect
>> the original refused it and yours take it (and do much more sensible
>> thing), which would be an improvement, but then the error message
>> should
>> be reworded perhaps?
>
> Unless I missed something, that was a limitation of the option parser.
> checkout-index --stdin -f works fine for me after removing those two
> lines, so I left them out from the updated patch.

Thanks.  I think you got what I meant and dropping the part is right.

"--stdin -f" was rejected by the original code, and you improved to take
it with the new parser.  In fact, the above quoted if() statement should
not trigger when "--stdin -f" is given, due to the way the new option
parser is structured.  The original had an explicit "break" in the loop
when it saw "--stdin".  The above would still trigger if "--stdin foo" is
given, but there is a code to catch that already, so it is not necessary.

^ permalink raw reply

* Re: Usability of git stash
From: Shawn O. Pearce @ 2008-10-19 21:49 UTC (permalink / raw)
  To: Leo Razoumov; +Cc: git, Anders Melchiorsen, Brandon Casey, David Kastrup
In-Reply-To: <ee2a733e0810191408m2cbe1ba5n540ad0fb99b49708@mail.gmail.com>

Leo Razoumov <slonik.az@gmail.com> wrote:
> On 10/19/08, Shawn O. Pearce <spearce@spearce.org> wrote:
> > [..snip..]
> > Indeed, that's an advantage of the wip commit approach, you can shove
> >  the untracked files quickly into the wip commit, especially with 1.6:
> >
> >         git commit -A -m wip
> >
> > [..snip..]
> 
> What version of git are you using?
> I am using git-1.6.0.2 on Linux and "-A" is illegal option for "git commit"

Oh.  Sorry.  I thought I saw a patch for that go by.  I guess I mean:

	git add -A && git commit

-- 
Shawn.

^ permalink raw reply

* Re: [PATCH] git-merge-recursive: honor merge.conflictstyle once again
From: Junio C Hamano @ 2008-10-19 21:50 UTC (permalink / raw)
  To: Matt McCutchen; +Cc: git
In-Reply-To: <1224376850.19061.1.camel@mattlaptop2.local>

Matt McCutchen <matt@mattmccutchen.net> writes:

> This was originally implemented in c236bcd06138bcbc929b86ad1a513635bf4847b2
> but was lost to a mismerge in 9ba929ed652f5ed7707f1c684999af4ad02c4925.

Good eyes; thanks.

^ permalink raw reply

* [GITK PATCH v2] Add menu accelerators
From: Robin Rosenberg @ 2008-10-19 22:00 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: git
In-Reply-To: <18681.53866.855255.688290@cargo.ozlabs.ibm.com>

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
 gitk |   80 +++++++++++++++++++++++++++++++++---------------------------------
 1 files changed, 40 insertions(+), 40 deletions(-)

This one is slightly better than the first one.  Works with gitk id...id too.

-- robin

diff --git a/gitk b/gitk
index 3678de1..df039b9 100755
--- a/gitk
+++ b/gitk
@@ -1817,26 +1817,26 @@ proc makewindow {} {
     # The "mc" arguments here are purely so that xgettext
     # sees the following string as needing to be translated
     makemenu .bar {
-	{mc "File" cascade {
-	    {mc "Update" command updatecommits -accelerator F5}
-	    {mc "Reload" command reloadcommits}
-	    {mc "Reread references" command rereadrefs}
-	    {mc "List references" command showrefs}
-	    {mc "Quit" command doquit}
+	{mc "&File" cascade {
+	    {mc "&Update" command updatecommits -accelerator F5}
+	    {mc "&Reload" command reloadcommits}
+	    {mc "R&eread references" command rereadrefs}
+	    {mc "&List references" command showrefs}
+	    {mc "&Quit" command doquit}
 	}}
-	{mc "Edit" cascade {
-	    {mc "Preferences" command doprefs}
+	{mc "&Edit" cascade {
+	    {mc "&Preferences" command doprefs}
 	}}
-	{mc "View" cascade {
-	    {mc "New view..." command {newview 0}}
-	    {mc "Edit view..." command editview -state disabled}
-	    {mc "Delete view" command delview -state disabled}
+	{mc "&View" cascade {
+	    {mc "&New view..." command {newview 0}}
+	    {mc "&Edit view..." command editview -state disabled}
+	    {mc "&Delete view" command delview -state disabled}
 	    {xx "" separator}
-	    {mc "All files" radiobutton {selectedview 0} -command {showview 0}}
+	    {mc "&All files" radiobutton {selectedview 0} -command {showview 0}}
 	}}
-	{mc "Help" cascade {
-	    {mc "About gitk" command about}
-	    {mc "Key bindings" command keys}
+	{mc "&Help" cascade {
+	    {mc "&About gitk" command about}
+	    {mc "&Key bindings" command keys}
 	}}
     }
     . configure -menu .bar
@@ -2220,39 +2220,39 @@ proc makewindow {} {
 
     set rowctxmenu .rowctxmenu
     makemenu $rowctxmenu {
-	{mc "Diff this -> selected" command {diffvssel 0}}
-	{mc "Diff selected -> this" command {diffvssel 1}}
-	{mc "Make patch" command mkpatch}
-	{mc "Create tag" command mktag}
-	{mc "Write commit to file" command writecommit}
-	{mc "Create new branch" command mkbranch}
-	{mc "Cherry-pick this commit" command cherrypick}
-	{mc "Reset HEAD branch to here" command resethead}
+	{mc "Diff &this -> selected" command {diffvssel 0}}
+	{mc "Diff &selected -> this" command {diffvssel 1}}
+	{mc "Make &patch" command mkpatch}
+	{mc "Create ta&g" command mktag}
+	{mc "&Write commit to file" command writecommit}
+	{mc "Create new &branch" command mkbranch}
+	{mc "&Cherry-pick this commit" command cherrypick}
+	{mc "&Reset HEAD branch to here" command resethead}
     }
     $rowctxmenu configure -tearoff 0
 
     set fakerowmenu .fakerowmenu
     makemenu $fakerowmenu {
-	{mc "Diff this -> selected" command {diffvssel 0}}
-	{mc "Diff selected -> this" command {diffvssel 1}}
-	{mc "Make patch" command mkpatch}
+	{mc "Diff &this -> selected" command {diffvssel 0}}
+	{mc "Diff &selected -> this" command {diffvssel 1}}
+	{mc "Make &patch" command mkpatch}
     }
     $fakerowmenu configure -tearoff 0
 
     set headctxmenu .headctxmenu
     makemenu $headctxmenu {
-	{mc "Check out this branch" command cobranch}
-	{mc "Remove this branch" command rmbranch}
+	{mc "&Check out this branch" command cobranch}
+	{mc "&Remove this branch" command rmbranch}
     }
     $headctxmenu configure -tearoff 0
 
     global flist_menu
     set flist_menu .flistctxmenu
     makemenu $flist_menu {
-	{mc "Highlight this too" command {flist_hl 0}}
-	{mc "Highlight this only" command {flist_hl 1}}
-	{mc "External diff" command {external_diff}}
-	{mc "Blame parent commit" command {external_blame 1}}
+	{mc "Highlight this &too" command {flist_hl 0}}
+	{mc "Highlight this &only" command {flist_hl 1}}
+	{mc "E&xternal diff" command {external_diff}}
+	{mc "&Blame parent commit" command {external_blame 1}}
     }
     $flist_menu configure -tearoff 0
 }
@@ -3414,8 +3414,8 @@ proc showview {n} {
 
     set curview $n
     set selectedview $n
-    .bar.view entryconf [mca "Edit view..."] -state [expr {$n == 0? "disabled": "normal"}]
-    .bar.view entryconf [mca "Delete view"] -state [expr {$n == 0? "disabled": "normal"}]
+    .bar.view entryconf [mca "&Edit view..."] -state [expr {$n == 0? "disabled": "normal"}]
+    .bar.view entryconf [mca "&Delete view"] -state [expr {$n == 0? "disabled": "normal"}]
 
     run refill_reflist
     if {![info exists viewcomplete($n)]} {
@@ -7361,9 +7361,9 @@ proc rowmenu {x y id} {
     } else {
 	set menu $fakerowmenu
     }
-    $menu entryconfigure [mca "Diff this -> selected"] -state $state
-    $menu entryconfigure [mca "Diff selected -> this"] -state $state
-    $menu entryconfigure [mca "Make patch"] -state $state
+    $menu entryconfigure [mca "Diff &this -> selected"] -state $state
+    $menu entryconfigure [mca "Diff &selected -> this"] -state $state
+    $menu entryconfigure [mca "Make &patch"] -state $state
     tk_popup $menu $x $y
 }
 
@@ -10184,8 +10184,8 @@ if {$cmdline_files ne {} || $revtreeargs ne {} || $revtreeargscmd ne {}} {
     set viewperm(1) 0
     set vdatemode(1) 0
     addviewmenu 1
-    .bar.view entryconf [mca "Edit view..."] -state normal
-    .bar.view entryconf [mca "Delete view"] -state normal
+    .bar.view entryconf [mca "&Edit view..."] -state normal
+    .bar.view entryconf [mca "&Delete view"] -state normal
 }
 
 if {[info exists permviews]} {
-- 
1.6.0.2.308.gef4a

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox