* [PATCH 1/6] builtin-commit: fix author date with --amend --author=<author>
From: Johannes Schindelin @ 2007-11-11 17:35 UTC (permalink / raw)
To: git, krh, gitster
In-Reply-To: <Pine.LNX.4.64.0711111730580.4362@racer.site>
When amending a commit with a new author, the author date is taken
from the original commit.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
builtin-commit.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/builtin-commit.c b/builtin-commit.c
index a84a729..6be6def 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -527,6 +527,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
} else if (amend) {
struct commit_list *c;
struct commit *commit;
+ const char *author;
reflog_msg = "commit (amend)";
commit = lookup_commit(head_sha1);
@@ -536,6 +537,21 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
for (c = commit->parents; c; c = c->next)
strbuf_addf(&sb, "parent %s\n",
sha1_to_hex(c->item->object.sha1));
+
+ /* determine author date */
+ author = strstr(commit->buffer, "\nauthor");
+ if (author && !memmem(commit->buffer,
+ author + 1 - commit->buffer,
+ "\n\n", 2)) {
+ const char *email_end = strchr(author + 1, '>');
+ const char *line_end = strchr(author + 1, '\n');
+ if (email_end && line_end && email_end < line_end) {
+ char *date = xstrndup(email_end + 1,
+ line_end - email_end - 1);
+ setenv("GIT_AUTHOR_DATE", date, 1);
+ free(date);
+ }
+ }
} else if (in_merge) {
struct strbuf m;
FILE *fp;
--
1.5.3.5.1693.g26ed
^ permalink raw reply related
* [PATCH 2/6] git status: show relative paths when run in a subdirectory
From: Johannes Schindelin @ 2007-11-11 17:35 UTC (permalink / raw)
To: git, krh, gitster
In-Reply-To: <Pine.LNX.4.64.0711111730580.4362@racer.site>
To show the relative paths, the function formerly called quote_crlf()
(now called quote_path()) takes the prefix as an additional argument.
While at it, the static buffers were replaced by strbufs.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
builtin-commit.c | 13 ++++---
builtin-runstatus.c | 1 +
t/t7502-status.sh | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++
wt-status.c | 69 ++++++++++++++++++++++++++-------------
wt-status.h | 1 +
5 files changed, 146 insertions(+), 29 deletions(-)
create mode 100755 t/t7502-status.sh
diff --git a/builtin-commit.c b/builtin-commit.c
index 6be6def..5c7d4df 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -118,11 +118,12 @@ static char *prepare_index(const char **files, const char *prefix)
return next_index_lock->filename;
}
-static int run_status(FILE *fp, const char *index_file)
+static int run_status(FILE *fp, const char *index_file, const char *prefix)
{
struct wt_status s;
wt_status_prepare(&s);
+ s.prefix = prefix;
if (amend) {
s.amend = 1;
@@ -140,7 +141,7 @@ static int run_status(FILE *fp, const char *index_file)
static const char sign_off_header[] = "Signed-off-by: ";
-static int prepare_log_message(const char *index_file)
+static int prepare_log_message(const char *index_file, const char *prefix)
{
struct stat statbuf;
int commitable;
@@ -216,7 +217,7 @@ static int prepare_log_message(const char *index_file)
if (only_include_assumed)
fprintf(fp, "# %s\n", only_include_assumed);
- commitable = run_status(fp, index_file);
+ commitable = run_status(fp, index_file, prefix);
fclose(fp);
@@ -409,7 +410,7 @@ int cmd_status(int argc, const char **argv, const char *prefix)
index_file = prepare_index(argv, prefix);
- commitable = run_status(stdout, index_file);
+ commitable = run_status(stdout, index_file, prefix);
rollback_lock_file(&lock_file);
@@ -503,8 +504,8 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
if (!no_verify && run_hook(index_file, "pre-commit", NULL))
exit(1);
- if (!prepare_log_message(index_file) && !in_merge) {
- run_status(stdout, index_file);
+ if (!prepare_log_message(index_file, prefix) && !in_merge) {
+ run_status(stdout, index_file, prefix);
unlink(commit_editmsg);
return 1;
}
diff --git a/builtin-runstatus.c b/builtin-runstatus.c
index 2db25c8..8d167a9 100644
--- a/builtin-runstatus.c
+++ b/builtin-runstatus.c
@@ -14,6 +14,7 @@ int cmd_runstatus(int argc, const char **argv, const char *prefix)
git_config(git_status_config);
wt_status_prepare(&s);
+ s.prefix = prefix;
for (i = 1; i < argc; i++) {
if (!strcmp(argv[i], "--color"))
diff --git a/t/t7502-status.sh b/t/t7502-status.sh
new file mode 100755
index 0000000..269b334
--- /dev/null
+++ b/t/t7502-status.sh
@@ -0,0 +1,91 @@
+#!/bin/sh
+#
+# Copyright (c) 2007 Johannes E. Schindelin
+#
+
+test_description='git-status'
+
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+ : > tracked &&
+ : > modified &&
+ mkdir dir1 &&
+ : > dir1/tracked &&
+ : > dir1/modified &&
+ mkdir dir2 &&
+ : > dir1/tracked &&
+ : > dir1/modified &&
+ git add . &&
+ test_tick &&
+ git commit -m initial &&
+ : > untracked &&
+ : > dir1/untracked &&
+ : > dir2/untracked &&
+ echo 1 > dir1/modified &&
+ echo 2 > dir2/modified &&
+ echo 3 > dir2/added &&
+ git add dir2/added
+'
+
+cat > expect << \EOF
+# On branch master
+# Changes to be committed:
+# (use "git reset HEAD <file>..." to unstage)
+#
+# new file: dir2/added
+#
+# Changed but not updated:
+# (use "git add <file>..." to update what will be committed)
+#
+# modified: dir1/modified
+#
+# Untracked files:
+# (use "git add <file>..." to include in what will be committed)
+#
+# dir1/untracked
+# dir2/modified
+# dir2/untracked
+# expect
+# output
+# untracked
+EOF
+
+test_expect_success 'status' '
+
+ git status > output &&
+ git diff expect output
+
+'
+
+cat > expect << \EOF
+# On branch master
+# Changes to be committed:
+# (use "git reset HEAD <file>..." to unstage)
+#
+# new file: ../dir2/added
+#
+# Changed but not updated:
+# (use "git add <file>..." to update what will be committed)
+#
+# modified: ../dir1/modified
+#
+# Untracked files:
+# (use "git add <file>..." to include in what will be committed)
+#
+# untracked
+# ../dir2/modified
+# ../dir2/untracked
+# ../expect
+# ../output
+# ../untracked
+EOF
+
+test_expect_success 'status with relative paths' '
+
+ (cd dir1 && git status) > output &&
+ git diff expect output
+
+'
+
+test_done
diff --git a/wt-status.c b/wt-status.c
index 03b5ec4..0d25362 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -82,33 +82,46 @@ static void wt_status_print_trailer(struct wt_status *s)
color_fprintf_ln(s->fp, color(WT_STATUS_HEADER), "#");
}
-static const char *quote_crlf(const char *in, char *buf, size_t sz)
+static char *quote_path(const char *in, int len,
+ struct strbuf *out, const char *prefix)
{
- const char *scan;
- char *out;
- const char *ret = in;
+ if (len > 0)
+ strbuf_grow(out, len);
+ strbuf_setlen(out, 0);
+
+ if (prefix) {
+ int off = 0;
+ while (prefix[off] && off < len && prefix[off] == in[off])
+ if (prefix[off] == '/') {
+ prefix += off + 1;
+ in += off + 1;
+ len -= off + 1;
+ off = 0;
+ } else
+ off++;
+
+ for (; *prefix; prefix++)
+ if (*prefix == '/')
+ strbuf_addstr(out, "../");
+ }
- for (scan = in, out = buf; *scan; scan++) {
- int ch = *scan;
- int quoted;
+ for (; (len < 0 && *in) || len > 0; in++, len--) {
+ int ch = *in;
switch (ch) {
case '\n':
- quoted = 'n';
+ strbuf_addstr(out, "\\n");
break;
case '\r':
- quoted = 'r';
+ strbuf_addstr(out, "\\r");
break;
default:
- *out++ = ch;
+ strbuf_addch(out, ch);
continue;
}
- *out++ = '\\';
- *out++ = quoted;
- ret = buf;
}
- *out = '\0';
- return ret;
+
+ return out->buf;
}
static void wt_status_print_filepair(struct wt_status *s,
@@ -116,10 +129,12 @@ static void wt_status_print_filepair(struct wt_status *s,
{
const char *c = color(t);
const char *one, *two;
- char onebuf[PATH_MAX], twobuf[PATH_MAX];
+ struct strbuf onebuf, twobuf;
- one = quote_crlf(p->one->path, onebuf, sizeof(onebuf));
- two = quote_crlf(p->two->path, twobuf, sizeof(twobuf));
+ strbuf_init(&onebuf, 0);
+ strbuf_init(&twobuf, 0);
+ one = quote_path(p->one->path, -1, &onebuf, s->prefix);
+ two = quote_path(p->two->path, -1, &twobuf, s->prefix);
color_fprintf(s->fp, color(WT_STATUS_HEADER), "#\t");
switch (p->status) {
@@ -151,6 +166,8 @@ static void wt_status_print_filepair(struct wt_status *s,
die("bug: unhandled diff status %c", p->status);
}
fprintf(s->fp, "\n");
+ strbuf_release(&onebuf);
+ strbuf_release(&twobuf);
}
static void wt_status_print_updated_cb(struct diff_queue_struct *q,
@@ -205,8 +222,9 @@ static void wt_read_cache(struct wt_status *s)
static void wt_status_print_initial(struct wt_status *s)
{
int i;
- char buf[PATH_MAX];
+ struct strbuf buf;
+ strbuf_init(&buf, 0);
wt_read_cache(s);
if (active_nr) {
s->commitable = 1;
@@ -215,11 +233,12 @@ static void wt_status_print_initial(struct wt_status *s)
for (i = 0; i < active_nr; i++) {
color_fprintf(s->fp, color(WT_STATUS_HEADER), "#\t");
color_fprintf_ln(s->fp, color(WT_STATUS_UPDATED), "new file: %s",
- quote_crlf(active_cache[i]->name,
- buf, sizeof(buf)));
+ quote_path(active_cache[i]->name, -1,
+ &buf, s->prefix));
}
if (active_nr)
wt_status_print_trailer(s);
+ strbuf_release(&buf);
}
static void wt_status_print_updated(struct wt_status *s)
@@ -254,7 +273,9 @@ static void wt_status_print_untracked(struct wt_status *s)
const char *x;
int i;
int shown_header = 0;
+ struct strbuf buf;
+ strbuf_init(&buf, 0);
memset(&dir, 0, sizeof(dir));
dir.exclude_per_dir = ".gitignore";
@@ -291,9 +312,11 @@ static void wt_status_print_untracked(struct wt_status *s)
shown_header = 1;
}
color_fprintf(s->fp, color(WT_STATUS_HEADER), "#\t");
- color_fprintf_ln(s->fp, color(WT_STATUS_UNTRACKED), "%.*s",
- ent->len, ent->name);
+ color_fprintf_ln(s->fp, color(WT_STATUS_UNTRACKED), "%s",
+ quote_path(ent->name, ent->len,
+ &buf, s->prefix));
}
+ strbuf_release(&buf);
}
static void wt_status_print_verbose(struct wt_status *s)
diff --git a/wt-status.h b/wt-status.h
index 7744932..f58ebcb 100644
--- a/wt-status.h
+++ b/wt-status.h
@@ -23,6 +23,7 @@ struct wt_status {
int workdir_untracked;
const char *index_file;
FILE *fp;
+ const char *prefix;
};
int git_status_config(const char *var, const char *value);
--
1.5.3.5.1693.g26ed
^ permalink raw reply related
* [PATCH 3/6] builtin-commit: fix --signoff
From: Johannes Schindelin @ 2007-11-11 17:35 UTC (permalink / raw)
To: git, krh, gitster
In-Reply-To: <Pine.LNX.4.64.0711111730580.4362@racer.site>
The Signed-off-by: line contained a spurious timestamp. The reason was
a call to git_committer_info(1), which automatically added the
timestamp.
Instead, fmt_ident() was taught to interpret an empty string for the
date (as opposed to NULL, which still triggers the default behavior)
as "do not bother with the timestamp", and builtin-commit.c uses it.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
builtin-commit.c | 29 ++++++++++++++++++-----------
ident.c | 10 +++++++---
t/t7500-commit.sh | 13 +++++++++++++
3 files changed, 38 insertions(+), 14 deletions(-)
diff --git a/builtin-commit.c b/builtin-commit.c
index 5c7d4df..6b1507d 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -183,21 +183,28 @@ static int prepare_log_message(const char *index_file, const char *prefix)
die("could not open %s\n", git_path(commit_editmsg));
stripspace(&sb, 0);
- if (fwrite(sb.buf, 1, sb.len, fp) < sb.len)
- die("could not write commit template: %s\n",
- strerror(errno));
if (signoff) {
- const char *info, *bol;
-
- info = git_committer_info(1);
- strbuf_addch(&sb, '\0');
- bol = strrchr(sb.buf + sb.len - 1, '\n');
- if (!bol || prefixcmp(bol, sign_off_header))
- fprintf(fp, "\n");
- fprintf(fp, "%s%s\n", sign_off_header, git_committer_info(1));
+ struct strbuf sob;
+ int i;
+
+ strbuf_init(&sob, 0);
+ strbuf_addstr(&sob, sign_off_header);
+ strbuf_addstr(&sob, fmt_ident(getenv("GIT_COMMITTER_NAME"),
+ getenv("GIT_COMMITTER_EMAIL"), "", 1));
+ strbuf_addch(&sob, '\n');
+
+ for (i = sb.len - 1; i > 0 && sb.buf[i - 1] != '\n'; i--)
+ ; /* do nothing */
+ if (prefixcmp(sb.buf + i, sob.buf))
+ strbuf_addbuf(&sb, &sob);
+ strbuf_release(&sob);
}
+ if (fwrite(sb.buf, 1, sb.len, fp) < sb.len)
+ die("could not write commit template: %s\n",
+ strerror(errno));
+
strbuf_release(&sb);
if (in_merge && !no_edit)
diff --git a/ident.c b/ident.c
index 9b2a852..5be7533 100644
--- a/ident.c
+++ b/ident.c
@@ -224,13 +224,17 @@ const char *fmt_ident(const char *name, const char *email,
}
strcpy(date, git_default_date);
- if (date_str)
- parse_date(date_str, date, sizeof(date));
+ if (date_str) {
+ if (*date_str)
+ parse_date(date_str, date, sizeof(date));
+ else
+ date[0] = '\0';
+ }
i = copy(buffer, sizeof(buffer), 0, name);
i = add_raw(buffer, sizeof(buffer), i, " <");
i = copy(buffer, sizeof(buffer), i, email);
- i = add_raw(buffer, sizeof(buffer), i, "> ");
+ i = add_raw(buffer, sizeof(buffer), i, date[0] ? "> " : ">");
i = copy(buffer, sizeof(buffer), i, date);
if (i >= sizeof(buffer))
die("Impossibly long personal identifier");
diff --git a/t/t7500-commit.sh b/t/t7500-commit.sh
index abbf54b..13d5a0c 100755
--- a/t/t7500-commit.sh
+++ b/t/t7500-commit.sh
@@ -93,4 +93,17 @@ test_expect_success 'commit message from file should override template' '
commit_msg_is "standard input msg"
'
+cat > expect << EOF
+zort
+Signed-off-by: C O Mitter <committer@example.com>
+EOF
+
+test_expect_success '--signoff' '
+ echo "yet another content *narf*" >> foo &&
+ echo "zort" |
+ GIT_EDITOR=../t7500/add-content git commit -s -F - foo &&
+ git cat-file commit HEAD | sed "1,/^$/d" > output &&
+ git diff expect output
+'
+
test_done
--
1.5.3.5.1693.g26ed
^ permalink raw reply related
* [PATCH 4/6] builtin-commit --s: add a newline if the last line was no S-O-B
From: Johannes Schindelin @ 2007-11-11 17:36 UTC (permalink / raw)
To: git, krh, gitster
In-Reply-To: <Pine.LNX.4.64.0711111730580.4362@racer.site>
The rule is this: if the last line already contains the sign off by the
current committer, do nothing. If it contains another sign off, just
add the sign off of the current committer. If the last line does not
contain a sign off, add a new line before adding the sign off.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
builtin-commit.c | 5 ++++-
t/t7500-commit.sh | 1 +
2 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/builtin-commit.c b/builtin-commit.c
index 6b1507d..66d7e5e 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -196,8 +196,11 @@ static int prepare_log_message(const char *index_file, const char *prefix)
for (i = sb.len - 1; i > 0 && sb.buf[i - 1] != '\n'; i--)
; /* do nothing */
- if (prefixcmp(sb.buf + i, sob.buf))
+ if (prefixcmp(sb.buf + i, sob.buf)) {
+ if (prefixcmp(sb.buf + i, sign_off_header))
+ strbuf_addch(&sb, '\n');
strbuf_addbuf(&sb, &sob);
+ }
strbuf_release(&sob);
}
diff --git a/t/t7500-commit.sh b/t/t7500-commit.sh
index 13d5a0c..e0be2ed 100755
--- a/t/t7500-commit.sh
+++ b/t/t7500-commit.sh
@@ -95,6 +95,7 @@ test_expect_success 'commit message from file should override template' '
cat > expect << EOF
zort
+
Signed-off-by: C O Mitter <committer@example.com>
EOF
--
1.5.3.5.1693.g26ed
^ permalink raw reply related
* [PATCH 5/6] builtin-commit: resurrect behavior for multiple -m options
From: Johannes Schindelin @ 2007-11-11 17:36 UTC (permalink / raw)
To: git, krh, gitster
In-Reply-To: <Pine.LNX.4.64.0711111730580.4362@racer.site>
When more than one -m option is given, the message does not replace
the previous, but is appended.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
builtin-commit.c | 26 ++++++++++++++++++++------
1 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/builtin-commit.c b/builtin-commit.c
index 66d7e5e..069d180 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -30,13 +30,27 @@ static char *use_message_buffer;
static const char commit_editmsg[] = "COMMIT_EDITMSG";
static struct lock_file lock_file;
-static char *logfile, *force_author, *message, *template_file;
+static char *logfile, *force_author, *template_file;
static char *edit_message, *use_message;
static int all, edit_flag, also, interactive, only, amend, signoff;
static int quiet, verbose, untracked_files, no_verify;
static int no_edit, initial_commit, in_merge;
const char *only_include_assumed;
+struct strbuf message;
+
+static int opt_parse_m(const struct option *opt, const char *arg, int unset)
+{
+ struct strbuf *buf = opt->value;
+ if (unset)
+ strbuf_setlen(buf, 0);
+ else {
+ strbuf_addstr(buf, arg);
+ strbuf_addch(buf, '\n');
+ strbuf_addch(buf, '\n');
+ }
+ return 0;
+}
static struct option builtin_commit_options[] = {
OPT__QUIET(&quiet),
@@ -45,7 +59,7 @@ static struct option builtin_commit_options[] = {
OPT_STRING('F', "file", &logfile, "FILE", "read log from file"),
OPT_STRING(0, "author", &force_author, "AUTHOR", "override author for commit"),
- OPT_STRING('m', "message", &message, "MESSAGE", "specify commit message"),
+ OPT_CALLBACK('m', "message", &message, "MESSAGE", "specify commit message", opt_parse_m),
OPT_STRING('c', "reedit-message", &edit_message, "COMMIT", "reuse and edit message from specified commit "),
OPT_STRING('C', "reuse-message", &use_message, "COMMIT", "reuse message from specified commit"),
OPT_BOOLEAN('s', "signoff", &signoff, "add Signed-off-by: header"),
@@ -150,8 +164,8 @@ static int prepare_log_message(const char *index_file, const char *prefix)
FILE *fp;
strbuf_init(&sb, 0);
- if (message) {
- strbuf_add(&sb, message, strlen(message));
+ if (message.len) {
+ strbuf_addbuf(&sb, &message);
} else if (logfile && !strcmp(logfile, "-")) {
if (isatty(0))
fprintf(stderr, "(reading log message from standard input)\n");
@@ -321,7 +335,7 @@ static int parse_and_validate_options(int argc, const char *argv[])
argc = parse_options(argc, argv, builtin_commit_options,
builtin_commit_usage, 0);
- if (logfile || message || use_message)
+ if (logfile || message.len || use_message)
no_edit = 1;
if (edit_flag)
no_edit = 0;
@@ -346,7 +360,7 @@ static int parse_and_validate_options(int argc, const char *argv[])
f++;
if (f > 1)
die("Only one of -c/-C/-F can be used.");
- if (message && f > 0)
+ if (message.len && f > 0)
die("Option -m cannot be combined with -c/-C/-F.");
if (edit_message)
use_message = edit_message;
--
1.5.3.5.1693.g26ed
^ permalink raw reply related
* [PATCH 6/6] builtin-commit: Add newline when showing which commit was created
From: Johannes Schindelin @ 2007-11-11 17:36 UTC (permalink / raw)
To: git, krh, gitster
In-Reply-To: <Pine.LNX.4.64.0711111730580.4362@racer.site>
The function log_tree_commit() does not break the line, so we have to
do it ourselves.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
builtin-commit.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/builtin-commit.c b/builtin-commit.c
index 069d180..3739bfc 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -493,6 +493,7 @@ static void print_summary(const char *prefix, const unsigned char *sha1)
printf("Created %scommit ", initial_commit ? "initial " : "");
log_tree_commit(&rev, commit);
+ printf("\n");
}
int git_commit_config(const char *k, const char *v)
--
1.5.3.5.1693.g26ed
^ permalink raw reply related
* [PATCH] t7005-editor.sh: Don't invoke real vi when it is in GIT_EXEC_PATH
From: Björn Steinbrink @ 2007-11-11 17:38 UTC (permalink / raw)
To: benji; +Cc: aroben, dak, Johannes.Schindelin, git
In-Reply-To: <9A9986E7-E03D-458A-9A19-A3EF0E7B203D@silverinsanity.com>
The git wrapper executable always prepends the GIT_EXEC_PATH build
variable to the current PATH, so prepending "." to the PATH is not
enough to give precedence to the fake vi executable.
The --exec-path option allows to prepend a directory to PATH even before
GIT_EXEC_PATH (which is added anyway), so we can use that instead.
Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>
---
t/t7005-editor.sh | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/t/t7005-editor.sh b/t/t7005-editor.sh
index 01cc0c0..0b36ee1 100755
--- a/t/t7005-editor.sh
+++ b/t/t7005-editor.sh
@@ -61,7 +61,7 @@ do
;;
esac
test_expect_success "Using $i" '
- git commit --amend &&
+ git --exec-path=. commit --amend &&
git show -s --pretty=oneline |
sed -e "s/^[0-9a-f]* //" >actual &&
diff actual expect
@@ -83,7 +83,7 @@ do
;;
esac
test_expect_success "Using $i (override)" '
- git commit --amend &&
+ git --exec-path=. commit --amend &&
git show -s --pretty=oneline |
sed -e "s/^[0-9a-f]* //" >actual &&
diff actual expect
--
1.5.3.5.622.g6fd7a
^ permalink raw reply related
* Re: [PATCH] t7005-editor.sh: Don't invoke real vi when it is in GIT_EXEC_PATH
From: Johannes Schindelin @ 2007-11-11 17:44 UTC (permalink / raw)
To: Björn Steinbrink; +Cc: benji, aroben, dak, git
In-Reply-To: <1194802691-27610-1-git-send-email-B.Steinbrink@gmx.de>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 675 bytes --]
Hi,
On Sun, 11 Nov 2007, Björn Steinbrink wrote:
> The git wrapper executable always prepends the GIT_EXEC_PATH build
> variable to the current PATH, so prepending "." to the PATH is not
> enough to give precedence to the fake vi executable.
>
> The --exec-path option allows to prepend a directory to PATH even before
> GIT_EXEC_PATH (which is added anyway), so we can use that instead.
Hmm. This will probably stop working when you do not have git installed,
because you now tell git to search for git programs in ".", where they are
not. Probably git-commit executes your installed write-tree, commit-tree
and friends, instead of the compiled ones.
Ciao,
Dscho
^ permalink raw reply
* Re: [PATCH] t7005-editor.sh: Don't invoke real vi when it is in GIT_EXEC_PATH
From: Brian Gernhardt @ 2007-11-11 17:49 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Björn Steinbrink, aroben, dak, git
In-Reply-To: <Pine.LNX.4.64.0711111742010.4362@racer.site>
On Nov 11, 2007, at 12:44 PM, Johannes Schindelin wrote:
> Hi,
>
> On Sun, 11 Nov 2007, Björn Steinbrink wrote:
>
>> The git wrapper executable always prepends the GIT_EXEC_PATH build
>> variable to the current PATH, so prepending "." to the PATH is not
>> enough to give precedence to the fake vi executable.
>>
>> The --exec-path option allows to prepend a directory to PATH even
>> before
>> GIT_EXEC_PATH (which is added anyway), so we can use that instead.
>
> Hmm. This will probably stop working when you do not have git
> installed,
> because you now tell git to search for git programs in ".", where
> they are
> not. Probably git-commit executes your installed write-tree, commit-
> tree
> and friends, instead of the compiled ones.
You are wrong there. From exec_cmd.c:setup_path() (lines 51-54):
add_path(&new_path, argv_exec_path);
add_path(&new_path, getenv(EXEC_PATH_ENVIRONMENT));
add_path(&new_path, builtin_exec_path);
add_path(&new_path, cmd_path);
So the path with this patch will still include the build directory
before the install location.
~~ Brian
^ permalink raw reply
* Local branch to remote branch translation
From: Jon Smirl @ 2007-11-11 17:54 UTC (permalink / raw)
To: Git Mailing List
What am I doing wrong in this sequence?
In my local repo I have two remotes:
jonsmirl@terra:~/mpc5200b$ git remote
dreamhost
linus
I create branches off from these using:
git branch -b m29 linus/master
I update them with
stg rebase linus/master
My repo has a .git/packed-refs file
When I push this repo to a remote server my local branches get renamed.
jonsmirl@terra:~/mpc5200b$ git push dreamhost
To ssh://jonsmirl1@git.digispeaker.com/~/mpc5200b.git
* [new branch] m24 -> linus/m24
* [new branch] m25 -> linus/m25
* [new branch] m26 -> linus/m26
* [new branch] m28 -> linus/m28
* [new branch] m29 -> linus/m29
Counting objects: 619084, done.
...
So one the remote server I see this:
[daedalus]$ git remote
[daedalus]$ git branch
[daedalus]$ git branch -r
linus/m24
linus/m25
linus/m26
linus/m28
linus/m29
[daedalus]$
With the repo in this state at the remote server gitweb thinks the
repo is empty.
Why are these branches getting renamed?
git head is in use on both ends.
--
Jon Smirl
jonsmirl@gmail.com
^ permalink raw reply
* Re: [PATCH] t7005-editor.sh: Don't invoke real vi when it is in GIT_EXEC_PATH
From: Björn Steinbrink @ 2007-11-11 18:01 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: benji, aroben, dak, git
In-Reply-To: <Pine.LNX.4.64.0711111742010.4362@racer.site>
On 2007.11.11 17:44:14 +0000, Johannes Schindelin wrote:
> Hi,
>
> On Sun, 11 Nov 2007, Björn Steinbrink wrote:
>
> > The git wrapper executable always prepends the GIT_EXEC_PATH build
> > variable to the current PATH, so prepending "." to the PATH is not
> > enough to give precedence to the fake vi executable.
> >
> > The --exec-path option allows to prepend a directory to PATH even before
> > GIT_EXEC_PATH (which is added anyway), so we can use that instead.
>
> Hmm. This will probably stop working when you do not have git installed,
> because you now tell git to search for git programs in ".", where they are
> not. Probably git-commit executes your installed write-tree, commit-tree
> and friends, instead of the compiled ones.
The . is prepended to PATH in _addition_ to the usual paths (as I wrote,
see setup_path() in exec_cmd.c). It does not replace anything AFAICT.
$ echo $PATH
/home/doener/bin:/usr/local/bin:/usr/bin:/bin:/usr/games
$ GIT_EXEC_PATH=.. GIT_EDITOR="env;" ../git commit | grep ^PATH=
PATH=/home/doener/src/git:/home/doener/bin:/home/doener/src/git:/home/doener/bin:/usr/local/bin:/usr/bin:/bin:/usr/games
$ GIT_EXEC_PATH=.. GIT_EDITOR="env;" ../git --exec-path=. commit | grep
^PATH=
PATH=/home/doener/src/git/t:/home/doener/src/git:/home/doener/bin:/home/doener/src/git:/home/doener/bin:/usr/local/bin:/usr/bin:/bin:/usr/games
Looks good to me...
Björn
^ permalink raw reply
* Re: Local branch to remote branch translation
From: Jon Smirl @ 2007-11-11 18:02 UTC (permalink / raw)
To: Git Mailing List
In-Reply-To: <9e4733910711110954m3ed3f9adtf19ca15dff61f0@mail.gmail.com>
Is the remote config not correct?
[remote "dreamhost"]
url = ssh://jonsmirl1@git.digispeaker.com/~/mpc5200b.git
fetch = +refs/heads/*:refs/remotes/dreamhost/*
push = +refs/heads/*:refs/remotes/linus/*
--
Jon Smirl
jonsmirl@gmail.com
^ permalink raw reply
* Re: Local branch to remote branch translation
From: Steffen Prohaska @ 2007-11-11 18:19 UTC (permalink / raw)
To: Jon Smirl; +Cc: Git Mailing List
In-Reply-To: <9e4733910711111002x2f8cabf7yce263faf7b33bde1@mail.gmail.com>
On Nov 11, 2007, at 7:02 PM, Jon Smirl wrote:
> Is the remote config not correct?
This is the configuration for remote "dreamhost". In your
previous mail you also mentioned a remote "linus". But
this seems to be unrelated to your question.
> [remote "dreamhost"]
> url = ssh://jonsmirl1@git.digispeaker.com/~/mpc5200b.git
> fetch = +refs/heads/*:refs/remotes/dreamhost/*
correct. This fetches the branches from the remote and stores
them locally as remote tracking branches "dreamhost/<branch>".
> push = +refs/heads/*:refs/remotes/linus/*
This "renames" your branches when you push. Your local branches
get pushed to "dreamhost" and are stored there as remote branches
"linus/<branch>". From your previous mail I assume you like to store
them as normal branches. You'd need to say
push = +refs/heads/*:refs/heads/*
But most likely you don't want to force here, that is drop '+'.
And you don't need to explicitly say that you want to store a branch
under the same name. So, probably you want
push = refs/heads/*
But maybe you could even drop the push line completely. Then, only
existing branches would be pushed and if you want to create a new
remote branch on "dreamhost" you'd need to explicitly tell git with
git push dreamhost <new-branch>
Does this help?
Steffen
^ permalink raw reply
* Re: [PATCH] t7005-editor.sh: Don't invoke real vi when it is in GIT_EXEC_PATH
From: Johannes Schindelin @ 2007-11-11 18:31 UTC (permalink / raw)
To: Brian Gernhardt; +Cc: Bj?rn Steinbrink, aroben, git
In-Reply-To: <2AE2E502-7942-449E-B847-75876A5DAF37@silverinsanity.com>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 648 bytes --]
Hi Brian, hi Björn,
On Sun, 11 Nov 2007, Brian Gernhardt wrote:
> On Nov 11, 2007, at 12:44 PM, Johannes Schindelin wrote:
>
> > Probably git-commit executes your installed write-tree, commit-tree
> > and friends, instead of the compiled ones.
>
> You are wrong there. From exec_cmd.c:setup_path() (lines 51-54):
>
> add_path(&new_path, argv_exec_path);
> add_path(&new_path, getenv(EXEC_PATH_ENVIRONMENT));
> add_path(&new_path, builtin_exec_path);
> add_path(&new_path, cmd_path);
Ah, I forgot that --exec-path=<path> did not override GIT_EXEC_PATH.
Thanks for clarifying! Your patch is obviously good, then.
Ciao,
Dscho
^ permalink raw reply
* [PATCH] git-svn: prevent dcommitting if the index is dirty.
From: Benoit Sigoure @ 2007-11-11 18:41 UTC (permalink / raw)
To: git; +Cc: normalperson, Benoit Sigoure
dcommit uses rebase `sync' the history with what has just been pushed to
SVN. Trying to dcommit with a dirty index is troublesome for rebase, so now
the user will get an error message if he attempts to dcommit with a dirty
index.
Signed-off-by: Benoit Sigoure <tsuna@lrde.epita.fr>
---
git-svn.perl | 3 +++
t/t9106-git-svn-dcommit-clobber-series.sh | 6 ++++++
2 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/git-svn.perl b/git-svn.perl
index dd93e32..a15df4f 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -390,6 +390,9 @@ sub cmd_set_tree {
sub cmd_dcommit {
my $head = shift;
+ git_cmd_try { command_oneline(qw/diff-index --quiet HEAD/) }
+ 'Cannot dcommit with a dirty index. Commit your changes first'
+ . "or stash them with `git stash'.\n";
$head ||= 'HEAD';
my @refs;
my ($url, $rev, $uuid, $gs) = working_head_info($head, \@refs);
diff --git a/t/t9106-git-svn-dcommit-clobber-series.sh b/t/t9106-git-svn-dcommit-clobber-series.sh
index 7eff4cd..44fae3b 100755
--- a/t/t9106-git-svn-dcommit-clobber-series.sh
+++ b/t/t9106-git-svn-dcommit-clobber-series.sh
@@ -53,4 +53,10 @@ test_expect_success 'change file but in unrelated area' "
test x\"\`sed -n -e 61p < file\`\" = x6611
"
+test_expect_failure 'attempt to dcommit with a dirty index' "
+ echo foo >>file &&
+ git add file &&
+ git svn dcommit
+ "
+
test_done
--
1.5.3.5.654.gdd5ec
^ permalink raw reply related
* Re: [PATCH] for-each-ref: fix setup of option-parsing for --sort
From: Johannes Schindelin @ 2007-11-11 19:19 UTC (permalink / raw)
To: Lars Hjemli; +Cc: Junio C Hamano, Jakub Narebski, Jon Smirl, git
In-Reply-To: <1194713274-31200-1-git-send-email-hjemli@gmail.com>
Hi,
On Sat, 10 Nov 2007, Lars Hjemli wrote:
> The option value for --sort is already a pointer to a pointer to struct
> ref_sort, so just use it.
>
> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
> ---
>
> On Nov 10, 2007 5:25 PM, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> > Could you add a test for that too, please?
>
> Is this ok?
That's exactly what I had in mind.
Thank you,
Dscho
^ permalink raw reply
* Re: git-branch silently ignores --track on local branches
From: Johannes Schindelin @ 2007-11-11 19:23 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Wayne Davison, git
In-Reply-To: <7vfxzelz5b.fsf@gitster.siamese.dyndns.org>
Hi,
On Sat, 10 Nov 2007, Junio C Hamano wrote:
> Wayne Davison <wayne@opencoder.net> writes:
>
> > ... Is there
> > a problem with local branches being supported when explicitly
> > requested?
>
> Maybe this one?
>
> commit 6f084a56fcb3543d88d252bb49c1d2bbf2bd0cf3
> Author: Johannes Schindelin <Johannes.Schindelin@gmx.de>
> Date: Tue Jul 10 18:50:44 2007 +0100
>
> branch --track: code cleanup and saner handling of local branches
>
> This patch cleans up some complicated code, and replaces it with a
> cleaner version, using code from remote.[ch], which got extended a
> little in the process. This also enables us to fix two cases:
>
> The earlier "fix" to setup tracking only when the original ref started
> with "refs/remotes" is wrong. You are absolutely allowed to use a
> separate layout for your tracking branches. The correct fix, of course,
> is to set up tracking information only when there is a matching
> remote.<nick>.fetch line containing a colon.
>
> Another corner case was not handled properly. If two remotes write to
> the original ref, just warn the user and do not set up tracking.
>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
>
> As a local branch does not have to be "fetched", the restriction
> on "remote.<nick>.fetch" is sort of pointless.
IIRC it was you, Junio, who complained first that the local branches have
tracking set up.
> Also why remote.<nick>.fetch needs a colon, I begin to wonder. You can
> be keep fetching and merging from the same branch of the same remote
> without keeping a remote tracking branch for that, but the above
> "correct fix" forbids that.
The point here was to find out what to track when we do a "git branch
--track <name> <origname>". So we definitely only want to find those
remotes that fetch to a certain tracking branch.
Sure, you can set up branch.<x>.merge to a branch that is not tracked.
But git cannot find out which one it is in the command "branch".
> Dscho, what were we smoking when we made this change?
Dude, I, uh, I think I, uh, don't remember. Peace.
Ciao,
Dscho
^ permalink raw reply
* Re: Local branch to remote branch translation
From: Jon Smirl @ 2007-11-11 19:36 UTC (permalink / raw)
To: Steffen Prohaska; +Cc: Git Mailing List
In-Reply-To: <A1B9CE91-15E0-4298-A606-68BB31541574@zib.de>
On 11/11/07, Steffen Prohaska <prohaska@zib.de> wrote:
>
> On Nov 11, 2007, at 7:02 PM, Jon Smirl wrote:
>
> > Is the remote config not correct?
>
> This is the configuration for remote "dreamhost". In your
> previous mail you also mentioned a remote "linus". But
> this seems to be unrelated to your question.
>
>
> > [remote "dreamhost"]
> > url = ssh://jonsmirl1@git.digispeaker.com/~/mpc5200b.git
> > fetch = +refs/heads/*:refs/remotes/dreamhost/*
>
> correct. This fetches the branches from the remote and stores
> them locally as remote tracking branches "dreamhost/<branch>".
>
> > push = +refs/heads/*:refs/remotes/linus/*
>
> This "renames" your branches when you push. Your local branches
> get pushed to "dreamhost" and are stored there as remote branches
> "linus/<branch>". From your previous mail I assume you like to store
> them as normal branches. You'd need to say
I did this part incorrectly. I was trying to push my local definition
of the linus remote to the dreamhost repo so that when someone clones
dreamhost linus would be defined in their repo.
jonsmirl@terra:~/mpc5200b$ git remote show linus
* remote linus
URL: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
How do I push the definition of the linus remote repo?
>
> push = +refs/heads/*:refs/heads/*
>
> But most likely you don't want to force here, that is drop '+'.
> And you don't need to explicitly say that you want to store a branch
> under the same name. So, probably you want
>
> push = refs/heads/*
>
> But maybe you could even drop the push line completely. Then, only
> existing branches would be pushed and if you want to create a new
> remote branch on "dreamhost" you'd need to explicitly tell git with
>
> git push dreamhost <new-branch>
>
> Does this help?
>
> Steffen
>
--
Jon Smirl
jonsmirl@gmail.com
^ permalink raw reply
* Re: [PATCH 1/6] push: mention --verbose option in documentation
From: Junio C Hamano @ 2007-11-11 19:39 UTC (permalink / raw)
To: Steffen Prohaska; +Cc: Git Mailing List
In-Reply-To: <FAB11CE3-B834-45A9-9D29-A37C302A9E1D@zib.de>
Steffen Prohaska <prohaska@zib.de> writes:
> The Author line was already wrong in Junio's pu branch, commit
> f31447f5f06200305393ca16e2eb9485e65dcccc, and I carried this
> over without noticing.
Yes, I know I pushed out a faulty one on 'pu' in the past. I am
suspecting that it probably was a misuse of "git commit --author"
after _not_ applying a WS mangled patch and instead of typing,
or something like that.
^ permalink raw reply
* Re: [PATCH 5/6] builtin-commit: resurrect behavior for multiple -m options
From: Pierre Habouzit @ 2007-11-11 19:42 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git, krh, gitster
In-Reply-To: <Pine.LNX.4.64.0711111736310.4362@racer.site>
[-- Attachment #1: Type: text/plain, Size: 2091 bytes --]
On Sun, Nov 11, 2007 at 05:36:39PM +0000, Johannes Schindelin wrote:
>
> When more than one -m option is given, the message does not replace
> the previous, but is appended.
>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
> builtin-commit.c | 26 ++++++++++++++++++++------
> 1 files changed, 20 insertions(+), 6 deletions(-)
>
> diff --git a/builtin-commit.c b/builtin-commit.c
> index 66d7e5e..069d180 100644
> --- a/builtin-commit.c
> +++ b/builtin-commit.c
> @@ -30,13 +30,27 @@ static char *use_message_buffer;
> static const char commit_editmsg[] = "COMMIT_EDITMSG";
> static struct lock_file lock_file;
>
> -static char *logfile, *force_author, *message, *template_file;
> +static char *logfile, *force_author, *template_file;
> static char *edit_message, *use_message;
> static int all, edit_flag, also, interactive, only, amend, signoff;
> static int quiet, verbose, untracked_files, no_verify;
>
> static int no_edit, initial_commit, in_merge;
> const char *only_include_assumed;
> +struct strbuf message;
Unless I'm mistaken `static` keywords are missign for`message` and
`only_include_assumed`.
And you _have_ to initialize message with STRBUF_INIT (remember of the
slop).
> +static int opt_parse_m(const struct option *opt, const char *arg, int unset)
> +{
> + struct strbuf *buf = opt->value;
> + if (unset)
> + strbuf_setlen(buf, 0);
> + else {
> + strbuf_addstr(buf, arg);
> + strbuf_addch(buf, '\n');
> + strbuf_addch(buf, '\n');
> + }
> + return 0;
> +}
I believe such a callback could live in parse-options.[hc]. The need
to aggregate all string arguments into a strbuf looks generic enough to
me. Why are you adding two '\n' btw ? Isn't one enough ?
Oh and last nitpicking, strbuf_addstr(buf, "\n\n"); is more efficient
than the two addchar (the strlen it generates is inlined).
--
·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: t7005 and vi in GIT_EXEC_PATH
From: Junio C Hamano @ 2007-11-11 19:43 UTC (permalink / raw)
To: Brian Gernhardt; +Cc: Johannes Schindelin, Git Mailing List
In-Reply-To: <FCFF59B3-D3F1-4BEB-B3C3-D07DD5D5D8EF@silverinsanity.com>
Brian Gernhardt <benji@silverinsanity.com> writes:
> I'm sorry, I should have been more clear. I was referring to the
> GIT_EXEC_PATH build variable, not the environment variable. The git
> wrapper always adds the path determined during build to the front of
> PATH. When I was changing my build script, this got set to "/usr/
> local/bin" (I usually use /usr/local/stow/git, instead). Since I have
> a /usr/local/bin/vim, PATH for git-commit.sh during the test was:
>
> - my git build directory
> - /usr/local/bin (containing a symlink vi -> vim)
> - the t/trash directory, added by the test via `PATH=".:$PATH"`
> (containing the test vi script)
> - my normal path
Maybe that is what is broken. t/test-lib.sh makes the
environment variable point at the build directory, and that
should override the path that is compiled in, shouldn't it?
^ permalink raw reply
* [StGit PATCH 0/5] A few small fixes
From: Karl Hasselström @ 2007-11-11 19:43 UTC (permalink / raw)
To: Catalin Marinas; +Cc: git, David Kågedal
These are available from
git://repo.or.cz/stgit/kha.git safe
The clean test and the assimilare/repair stuff are new, the rest have
been sitting in kha/safe for a while now.
David: I believe the repair patch should fix the situation you
encountered.
---
Note how the actual patch that renames assimilate to repair looks fine
-- I gave stg mail --diff-opts='-M -C -C'. But the diffstats
apparently don't get those flags, neither the aggregate one below nor
the one just for that patch. We ought to fix that ...
Karl Hasselström (5):
stg repair: Patchify non-patch commits between patches
Rename "stg assimilate" to "stg repair"
Let some commands work with detached HEAD
Cogito is deprecated, so don't point to it
Simple test for "stg clean"
Documentation/stg.txt | 4 -
README | 4 -
contrib/stgit-completion.bash | 2
stgit/commands/add.py | 2
stgit/commands/assimilate.py | 198 -----------------------------------------
stgit/commands/common.py | 2
stgit/commands/repair.py | 192 ++++++++++++++++++++++++++++++++++++++++
stgit/commands/resolved.py | 2
stgit/commands/status.py | 2
stgit/main.py | 4 -
t/t1301-assimilate.sh | 84 -----------------
t/t1301-repair.sh | 80 +++++++++++++++++
t/t1302-assimilate-interop.sh | 59 ------------
t/t1302-repair-interop.sh | 59 ++++++++++++
t/t2500-clean.sh | 27 ++++++
15 files changed, 368 insertions(+), 353 deletions(-)
delete mode 100644 stgit/commands/assimilate.py
create mode 100644 stgit/commands/repair.py
delete mode 100755 t/t1301-assimilate.sh
create mode 100755 t/t1301-repair.sh
delete mode 100755 t/t1302-assimilate-interop.sh
create mode 100755 t/t1302-repair-interop.sh
create mode 100755 t/t2500-clean.sh
--
Karl Hasselström, kha@treskal.com
www.treskal.com/kalle
^ permalink raw reply
* [StGit PATCH 1/5] Simple test for "stg clean"
From: Karl Hasselström @ 2007-11-11 19:43 UTC (permalink / raw)
To: Catalin Marinas; +Cc: git, David Kågedal
In-Reply-To: <20071111193545.18868.62490.stgit@yoghurt>
Signed-off-by: Karl Hasselström <kha@treskal.com>
---
t/t2500-clean.sh | 27 +++++++++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
create mode 100755 t/t2500-clean.sh
diff --git a/t/t2500-clean.sh b/t/t2500-clean.sh
new file mode 100755
index 0000000..3364c18
--- /dev/null
+++ b/t/t2500-clean.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+test_description='Run "stg clean"'
+
+. ./test-lib.sh
+
+test_expect_success 'Initialize StGit stack' '
+ stg init &&
+ stg new e0 -m e0 &&
+ stg new p0 -m p0 &&
+ echo foo > foo.txt &&
+ git add foo.txt &&
+ stg refresh &&
+ stg new e1 -m e1 &&
+ stg new e2 -m e2 &&
+ stg pop
+'
+
+test_expect_success 'Clean empty patches' '
+ [ "$(echo $(stg applied))" = "e0 p0 e1" ] &&
+ [ "$(echo $(stg unapplied))" = "e2" ] &&
+ stg clean &&
+ [ "$(echo $(stg applied))" = "p0" ] &&
+ [ "$(echo $(stg unapplied))" = "" ]
+'
+
+test_done
^ permalink raw reply related
* [StGit PATCH 2/5] Cogito is deprecated, so don't point to it
From: Karl Hasselström @ 2007-11-11 19:43 UTC (permalink / raw)
To: Catalin Marinas; +Cc: git, David Kågedal
In-Reply-To: <20071111193545.18868.62490.stgit@yoghurt>
Signed-off-by: Karl Hasselström <kha@treskal.com>
---
README | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/README b/README
index 0e648f5..4f20154 100644
--- a/README
+++ b/README
@@ -6,9 +6,7 @@ other repositories using standard GIT functionality.
Note that StGIT is not an SCM interface on top of GIT and it expects a
previously initialised GIT repository (unless it is cloned using StGIT
-directly). For standard SCM operations, either use plain GIT commands
-or the Cogito tool but it is not recommended to mix them with the
-StGIT commands.
+directly). For standard SCM operations, use plain GIT commands.
For the latest version see http://www.procode.org/stgit/
For a tutorial see http://wiki.procode.org/cgi-bin/wiki.cgi/StGIT_Tutorial
^ permalink raw reply related
* [StGit PATCH 4/5] Rename "stg assimilate" to "stg repair"
From: Karl Hasselström @ 2007-11-11 19:43 UTC (permalink / raw)
To: Catalin Marinas; +Cc: git, David Kågedal
In-Reply-To: <20071111193545.18868.62490.stgit@yoghurt>
With the capabilities it's gained lately, this is a better name.
Signed-off-by: Karl Hasselström <kha@treskal.com>
---
Documentation/stg.txt | 4 -
contrib/stgit-completion.bash | 2
stgit/commands/assimilate.py | 198 -----------------------------------------
stgit/commands/common.py | 2
stgit/commands/repair.py | 197 +++++++++++++++++++++++++++++++++++++++++
stgit/main.py | 4 -
t/t1301-assimilate.sh | 84 -----------------
t/t1301-repair.sh | 80 +++++++++++++++++
t/t1302-assimilate-interop.sh | 59 ------------
t/t1302-repair-interop.sh | 59 ++++++++++++
10 files changed, 342 insertions(+), 347 deletions(-)
delete mode 100644 stgit/commands/assimilate.py
create mode 100644 stgit/commands/repair.py
delete mode 100755 t/t1301-assimilate.sh
create mode 100755 t/t1301-repair.sh
delete mode 100755 t/t1302-assimilate-interop.sh
create mode 100755 t/t1302-repair-interop.sh
diff --git a/Documentation/stg.txt b/Documentation/stg.txt
index 4f9d18e..f6cd815 100644
--- a/Documentation/stg.txt
+++ b/Documentation/stg.txt
@@ -146,8 +146,8 @@ stglink:commit[]::
stgdesc:commit[]
stglink:uncommit[]::
stgdesc:uncommit[]
-stglink:assimilate[]::
- stgdesc:assimilate[]
+stglink:repair[]::
+ stgdesc:repair[]
Controlling what patches are applied
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/contrib/stgit-completion.bash b/contrib/stgit-completion.bash
index b1d2730..b3b23d4 100644
--- a/contrib/stgit-completion.bash
+++ b/contrib/stgit-completion.bash
@@ -13,7 +13,6 @@
_stg_commands="
add
applied
- assimilate
branch
delete
diff
@@ -42,6 +41,7 @@ _stg_commands="
rebase
refresh
rename
+ repair
resolved
rm
series
diff --git a/stgit/commands/common.py b/stgit/commands/common.py
index 2a80e8c..2672dcf 100644
--- a/stgit/commands/common.py
+++ b/stgit/commands/common.py
@@ -114,7 +114,7 @@ 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
- modify a branch with git. The "assimilate" command can
+ modify a branch with git. The "repair" command can
fix this situation.""")
def check_conflicts():
diff --git a/stgit/commands/assimilate.py b/stgit/commands/repair.py
similarity index 90%
rename from stgit/commands/assimilate.py
rename to stgit/commands/repair.py
index be992aa..f8fe624 100644
--- a/stgit/commands/assimilate.py
+++ b/stgit/commands/repair.py
@@ -29,28 +29,28 @@ from stgit import stack, git
help = 'StGit-ify any git commits made on top of your StGit stack'
usage = """%prog [options]
-"assimilate" will repair three kinds of inconsistencies in your StGit
+"repair" will repair three kinds of inconsistencies in your StGit
stack, all of them caused by using plain git commands on the branch:
1. If you have made regular git commits on top of your stack of
- StGit patches, "assimilate" converts them to StGit patches,
+ StGit patches, "repair" converts them to StGit patches,
preserving their contents.
2. Merge commits cannot become patches; if you have committed a
- merge on top of your stack, "assimilate" will simply mark all
+ merge on top of your stack, "repair" will simply mark all
patches below the merge unapplied, since they are no longer
reachable. If this is not what you want, use "git reset" to get
- rid of the merge and run "assimilate" again.
+ rid of the merge and run "repair" again.
3. The applied patches are supposed to be precisely those that are
reachable from the branch head. If you have used e.g. "git reset"
to move the head, some applied patches may no longer be
reachable, and some unapplied patches may have become reachable.
- "assimilate" will correct the appliedness of such patches.
+ "repair" will correct the appliedness of such patches.
Note that these are "inconsistencies", not "errors"; furthermore,
-"assimilate" will repair them reliably. As long as you are satisfied
-with the way "assimilate" handles them, you have no reason to avoid
+"repair" will repair them reliably. As long as you are satisfied
+with the way "repair" handles them, you have no reason to avoid
causing them in the first place if that is convenient for you."""
directory = DirectoryGotoToplevel()
@@ -99,11 +99,10 @@ def read_commit_dag(branch):
return commits, patches
def func(parser, options, args):
- """Assimilate a number of patches.
- """
+ """Repair inconsistencies in StGit metadata."""
def nothing_to_do():
- out.info('No commits to assimilate')
+ out.info('Nothing to repair')
orig_applied = crt_series.get_applied()
orig_unapplied = crt_series.get_unapplied()
@@ -118,7 +117,7 @@ def func(parser, options, args):
raise CmdException(
'This branch is protected. Modification is not permitted.')
- # Find commits to assimilate, and applied patches.
+ # Find commits that aren't patches, and applied patches.
commits, patches = read_commit_dag(crt_series.get_name())
c = commits[head]
patchify = []
@@ -149,7 +148,7 @@ def func(parser, options, args):
% (len(hidden), ['es', ''][len(hidden) == 1])),
'%s,' % merge.id, 'and will be considered unapplied.')
- # Assimilate any linear sequence of commits on top of a patch.
+ # Make patches of any linear sequence of commits on top of a patch.
names = set(p.patch for p in patches)
def name_taken(name):
return name in names
diff --git a/stgit/main.py b/stgit/main.py
index e8242c2..a03447f 100644
--- a/stgit/main.py
+++ b/stgit/main.py
@@ -60,7 +60,6 @@ class Commands(dict):
commands = Commands({
'add': 'add',
'applied': 'applied',
- 'assimilate': 'assimilate',
'branch': 'branch',
'delete': 'delete',
'diff': 'diff',
@@ -89,6 +88,7 @@ commands = Commands({
'rebase': 'rebase',
'refresh': 'refresh',
'rename': 'rename',
+ 'repair': 'repair',
'resolved': 'resolved',
'rm': 'rm',
'series': 'series',
@@ -109,7 +109,6 @@ repocommands = (
)
stackcommands = (
'applied',
- 'assimilate',
'branch',
'clean',
'commit',
@@ -122,6 +121,7 @@ stackcommands = (
'pull',
'push',
'rebase',
+ 'repair',
'series',
'sink',
'top',
diff --git a/t/t1301-assimilate.sh b/t/t1301-repair.sh
similarity index 70%
rename from t/t1301-assimilate.sh
rename to t/t1301-repair.sh
index 7f47c31..5d9bdbd 100755
--- a/t/t1301-assimilate.sh
+++ b/t/t1301-repair.sh
@@ -1,19 +1,19 @@
#!/bin/sh
# Copyright (c) 2006 Karl Hasselström
-test_description='Test the assimilate command.'
+test_description='Test the repair command.'
. ./test-lib.sh
test_expect_success \
- 'Assimilate in a non-initialized repository' \
- '! stg assimilate'
+ 'Repair in a non-initialized repository' \
+ '! stg repair'
test_expect_success \
'Initialize the StGIT repository' \
'stg init'
test_expect_success \
- 'Assimilate in a repository without patches' \
- 'stg assimilate'
+ 'Repair in a repository without patches' \
+ 'stg repair'
test_expect_success \
'Create a patch' \
@@ -25,8 +25,8 @@ test_expect_success \
'
test_expect_success \
- 'Assimilate when there is nothing to do' \
- 'stg assimilate'
+ 'Repair when there is nothing to do' \
+ 'stg repair'
test_expect_success \
'Create a GIT commit' \
@@ -36,11 +36,9 @@ test_expect_success \
git commit -a -m bar
'
-test_expect_success \
- 'Assimilate one GIT commit' \
- '
+test_expect_success 'Turn one GIT commit into a patch' '
[ $(stg applied | wc -l) -eq 1 ] &&
- stg assimilate &&
+ stg repair &&
[ $(stg applied | wc -l) -eq 2 ]
'
@@ -56,11 +54,9 @@ test_expect_success \
git commit -a -m three
'
-test_expect_success \
- 'Assimilate three GIT commits' \
- '
+test_expect_success 'Turn three GIT commits into patches' '
[ $(stg applied | wc -l) -eq 2 ] &&
- stg assimilate &&
+ stg repair &&
[ $(stg applied | wc -l) -eq 5 ]
'
@@ -75,9 +71,9 @@ test_expect_success \
git pull . br
'
-test_expect_success 'Assimilate in the presence of a merge commit' '
+test_expect_success 'Repair in the presence of a merge commit' '
[ $(stg applied | wc -l) -eq 5 ] &&
- stg assimilate &&
+ stg repair &&
[ $(stg applied | wc -l) -eq 0 ]
'
diff --git a/t/t1302-assimilate-interop.sh b/t/t1302-repair-interop.sh
similarity index 91%
rename from t/t1302-assimilate-interop.sh
rename to t/t1302-repair-interop.sh
index 31f8b78..82c5ed2 100755
--- a/t/t1302-assimilate-interop.sh
+++ b/t/t1302-repair-interop.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-test_description='Test git/StGit interoperability with "stg assimilate"'
+test_description='Test git/StGit interoperability with "stg repair"'
. ./test-lib.sh
test_expect_success 'Create some git-only history' '
@@ -28,7 +28,7 @@ test_expect_success 'Create five patches' '
test_expect_success 'Pop two patches with git-reset' '
git reset --hard HEAD~2 &&
! stg refresh &&
- stg assimilate &&
+ stg repair &&
stg refresh &&
[ "$(echo $(stg applied))" = "p0 p1 p2" ] &&
[ "$(echo $(stg unapplied))" = "p3 p4" ]
@@ -43,7 +43,7 @@ test_expect_success 'Create a new patch' '
test_expect_success 'Go to an unapplied patch with with git-reset' '
git reset --hard $(stg id p3) &&
! stg refresh &&
- stg assimilate &&
+ stg repair &&
stg refresh &&
[ "$(echo $(stg applied))" = "p0 p1 p2 p3" ] &&
[ "$(echo $(stg unapplied))" = "q0 p4" ]
@@ -51,7 +51,7 @@ test_expect_success 'Go to an unapplied patch with with git-reset' '
test_expect_success 'Go back to below the stack base with git-reset' '
git reset --hard foo-tag &&
- stg assimilate &&
+ stg repair &&
[ "$(echo $(stg applied))" = "" ] &&
[ "$(echo $(stg unapplied))" = "p0 p1 p2 p3 q0 p4" ]
'
^ permalink raw reply related
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