* [PATCH/RFC] shortlog: add option to group together different names/emails of an author
From: Adeodato Simó @ 2009-01-10 15:16 UTC (permalink / raw)
To: git; +Cc: Adeodato Simó
It's common for repositories to contain commits with different spellings of
an author name, or different email addresses. The shortlog command tries to
alleviate this by using .mailmap files. However, maintaining a .mailmap file
up to date is a manual process, and it does not help when shortlog is
invoked with the -e option and different email addresses for an author are
involved.
This commit introduces a -j/--join-uids option that uses a very dumb logic
to detect different spellings and addresses of a same author. In particular,
it just joins commits when either the name or the address had been
previously seen, attaching the commit to that previous id. In other words,
these three ids will be joined:
Author: Joe Developer <joe@example.com>
Author: Joe R. Developer <joe_r@example.com>
Author: Joe R. Developer <joe@example.com>
but only because of the third spelling. The first two alone would be left
separate. When the names and addresses are printed, the most common spelling
and address are used.
Incidentally, there is f817546 in git.git which has this author information:
Author: Wincent Colaiuta <gitster@pobox.com>
Which makes all of Wincent's commits to be assigned to Junio with -j. This
is easily fixed with an entry for gitster@pobox.com in .mailmap, which this
commit includes. (And then, only f817546 is be assigned to Junio.)
Signed-off-by: Adeodato Simó <dato@net.com.org.es>
---
This is my scratching of my own itch: I was used to `bzr author-stats`,
which is equivalent to `git shortlog -jsne`. I realize -sn comes close,
but I like having the email address listed. Please let me know what you
think.
Tests and a mention in git-shortlog.txt are missing. That'll come next
when/if I'm told this has a chance of inclusion. :-)
The code is valgrind'ed. I'm not completely confident, though, bugs will
not be hiding in corner cases. Also, I don't see any appreciable
slowdown with this version in git.git, particularly not between the
current git-shortlog and this new when run without -j (not when run with
-j either, but that's less critical).
This patch applies on top of my as/maint-shortlog-cleanup branch.
.mailmap | 1 +
builtin-shortlog.c | 280 +++++++++++++++++++++++++++++++++++++++++++++-------
shortlog.h | 14 ++-
3 files changed, 256 insertions(+), 39 deletions(-)
diff --git a/.mailmap b/.mailmap
index 373476b..f86d8a7 100644
--- a/.mailmap
+++ b/.mailmap
@@ -27,6 +27,7 @@ Joachim Berdal Haga <cjhaga@fys.uio.no>
Jon Loeliger <jdl@freescale.com>
Jon Seymour <jon@blackcubes.dyndns.org>
Jonathan Nieder <jrnieder@uchicago.edu>
+Junio C Hamano <gitster@pobox.com>
Junio C Hamano <junio@twinsun.com>
Karl Hasselström <kha@treskal.com>
Kent Engstrom <kent@lysator.liu.se>
diff --git a/builtin-shortlog.c b/builtin-shortlog.c
index 90e76ae..af155b9 100644
--- a/builtin-shortlog.c
+++ b/builtin-shortlog.c
@@ -9,24 +9,79 @@
#include "shortlog.h"
#include "parse-options.h"
+struct idinfo {
+ int count;
+ size_t idx;
+};
+
static char const * const shortlog_usage[] = {
"git shortlog [-n] [-s] [-e] [-w] [rev-opts] [--] [<commit-id>... ]",
"",
"[rev-opts] are documented in git-rev-list(1)",
NULL
};
-
-static int compare_by_number(const void *a1, const void *a2)
-{
- const struct string_list_item *i1 = a1, *i2 = a2;
- const struct string_list *l1 = i1->util, *l2 = i2->util;
+
+static int compare_by_count(const void *a1, const void *a2)
+{
+ const struct idinfo *i1 = a1, *i2 = a2;
+
+ if (i1->count < i2->count)
+ return 1;
+ else if (i1->count == i2->count)
+ return 0;
+ else
+ return -1;
+}
+
+static int compare_by_idx_and_count(const void *a1, const void *a2)
+{
+ const struct string_list_item *it1 = a1, *it2 = a2;
+ const struct idinfo *i1 = it1->util, *i2 = it2->util;
+
+ if (i1->idx < i2->idx)
+ return -1;
+ else if (i1->idx > i2->idx)
+ return 1;
+ else if (i1->count < i2->count)
+ return 1;
+ else if (i1->count > i2->count)
+ return -1;
+ else
+ return 0;
+}
+
+static int compare_by_nr(const void *a1, const void *a2)
+{
+ const struct string_list *l1 = a1, *l2 = a2;
if (l1->nr < l2->nr)
return 1;
- else if (l1->nr == l2->nr)
+ else if (l1->nr > l2->nr)
+ return -1;
+ else if (l1->nr == 0)
return 0;
else
+ return strcmp(l1->items[0].util, l2->items[0].util);
+}
+
+static int compare_by_first_util_str(const void *a1, const void *a2)
+{
+ const struct string_list *l1 = a1, *l2 = a2;
+ if (l1->nr && l2->nr)
+ return strcmp(l1->items[0].util, l2->items[0].util);
+ else if (!l1->nr && !l2->nr)
+ return 0;
+ else if (l1->nr)
return -1;
+ else
+ return 1;
+}
+
+static inline void alloc_grow_all_lines(struct shortlog *log)
+{
+ ALLOC_GROW(log->all_lines, log->nr + 1, log->alloc);
+ memset(log->all_lines + log->nr,
+ 0, (log->alloc - log->nr) * sizeof(struct string_list));
}
static void insert_one_record(struct shortlog *log,
@@ -35,9 +90,11 @@ static void insert_one_record(struct shortlog *log,
{
const char *dot3 = log->common_repo_prefix;
char *buffer, *p;
- struct string_list_item *item;
+ struct string_list_item *item, *name, *email;
char namebuf[1024];
- size_t len;
+ char emailbuf[1024];
+ struct idinfo *nu, *eu;
+ size_t len, idx;
const char *eol;
const char *boemail, *eoemail;
@@ -61,16 +118,117 @@ static void insert_one_record(struct shortlog *log,
else
len = strlen(namebuf);
- if (log->email) {
- size_t room = sizeof(namebuf) - len - 1;
- int maillen = eoemail - boemail + 1;
- snprintf(namebuf + len, room, " %.*s", maillen, boemail);
- }
-
- item = string_list_insert(namebuf, &log->list);
- if (item->util == NULL)
- item->util = xcalloc(1, sizeof(struct string_list));
-
+ /*
+ * log->all_lines is an array of string_lists where each list
+ * contains all the records by an author. The author information
+ * for all_lines[i] is in the element in log->names that has
+ * the "idx" member set to i.
+ *
+ * If join_uids is on, we try to detect different spellings and
+ * different email addresses of a same author: when saving a
+ * record, we check if we've already seen either the name or the
+ * address. If we have, we append to that author (and save the
+ * new name/address as alternative spelling). If we have seen
+ * both, but they point to different authors, we merge the
+ * entries, and always associate the result with the address.
+ *
+ * To merge in the right order, each record in all_lines[x] has
+ * an id (autocounter) in the "util" member.
+ */
+ if (!log->join_uids) {
+ if (log->email) {
+ size_t room = sizeof(namebuf) - len - 1;
+ int maillen = eoemail - boemail + 1;
+ snprintf(namebuf + len, room,
+ " %.*s", maillen, boemail);
+ }
+ name = string_list_insert(namebuf, &log->names);
+
+ if (name->util == NULL) {
+ alloc_grow_all_lines(log);
+ name->util = nu = xcalloc(1, sizeof(struct idinfo));
+ nu->idx = idx = log->nr++;
+ nu->count = 1;
+ }
+ else {
+ nu = name->util;
+ idx = nu->idx;
+ nu->count++;
+ }
+ goto write_line; /* Save one precious level of indentation. */
+ }
+
+ int maillen = eoemail - boemail - 1;
+ snprintf(emailbuf, sizeof(emailbuf), "%.*s", maillen, boemail+1);
+
+ name = string_list_insert(namebuf, &log->names);
+ email = string_list_insert(emailbuf, &log->emails);
+
+ if (name->util == NULL && email->util == NULL) {
+ alloc_grow_all_lines(log);
+ nu = xcalloc(1, sizeof(struct idinfo));
+ eu = xcalloc(1, sizeof(struct idinfo));
+ idx = nu->idx = eu->idx = log->nr++;
+ }
+ else if (name->util == NULL) {
+ nu = xcalloc(1, sizeof(struct idinfo));
+ eu = email->util;
+ idx = nu->idx = eu->idx;
+ }
+ else if (email->util == NULL) {
+ nu = name->util;
+ eu = xcalloc(1, sizeof(struct idinfo));
+ idx = eu->idx = nu->idx;
+ }
+ else {
+ nu = name->util;
+ eu = email->util;
+
+ if (nu->idx != eu->idx) {
+ /* Merge both entries. */
+ int i, j, oldidx;
+ struct idinfo *info;
+ struct string_list new = { NULL, 0, 0, 0 };
+ struct string_list *l1 = &log->all_lines[nu->idx];
+ struct string_list *l2 = &log->all_lines[eu->idx];
+
+ for (i = 0, j = 0; i < l1->nr && j < l2->nr; ) {
+ int c1 = (intptr_t) l1->items[i].util;
+ int c2 = (intptr_t) l2->items[j].util;
+ if (c1 < c2)
+ string_list_append(l1->items[i++].string, &new);
+ else
+ string_list_append(l2->items[j++].string, &new);
+ }
+ while (i < l1->nr) {
+ string_list_append(l1->items[i++].string, &new);
+ }
+ while (j < l2->nr) {
+ string_list_append(l2->items[j++].string, &new);
+ }
+
+ oldidx = nu->idx; /* Always favour the email. */
+
+ for (i = 0; i < log->names.nr; i++)
+ if ((info = log->names.items[i].util)->idx == oldidx)
+ info->idx = eu->idx;
+
+ for (i = 0; i < log->emails.nr; i++)
+ if ((info = log->emails.items[i].util)->idx == oldidx)
+ info->idx = eu->idx;
+
+ string_list_clear(l1, 0);
+ string_list_clear(l2, 0);
+ memcpy(l2, &new, sizeof(struct string_list));
+ }
+ idx = nu->idx;
+ }
+ nu->count++;
+ eu->count++;
+ name->util = nu;
+ email->util = eu;
+
+write_line:
/* Skip any leading whitespace, including any blank lines. */
while (*oneline && isspace(*oneline))
oneline++;
@@ -100,7 +258,8 @@ static void insert_one_record(struct shortlog *log,
}
}
- string_list_append(buffer, item->util);
+ item = string_list_append(buffer, &log->all_lines[idx]);
+ item->util = (void*)(intptr_t) log->commit_count++;
}
static void read_from_stdin(struct shortlog *log)
@@ -218,10 +377,12 @@ void shortlog_init(struct shortlog *log)
read_mailmap(&log->mailmap, ".mailmap", &log->common_repo_prefix);
- log->list.strdup_strings = 1;
log->wrap = DEFAULT_WRAPLEN;
log->in1 = DEFAULT_INDENT1;
log->in2 = DEFAULT_INDENT2;
+
+ log->names.strdup_strings = 1;
+ log->emails.strdup_strings = 1;
}
int cmd_shortlog(int argc, const char **argv, const char *prefix)
@@ -237,6 +398,8 @@ int cmd_shortlog(int argc, const char **argv, const char *prefix)
"Suppress commit descriptions, only provides commit count"),
OPT_BOOLEAN('e', "email", &log.email,
"Show the email address of each author"),
+ OPT_BOOLEAN('j', "join-uids", &log.join_uids,
+ "Group together different spellings and addresses of an author"),
{ OPTION_CALLBACK, 'w', NULL, &log, "w[,i1[,i2]]",
"Linewrap output", PARSE_OPT_OPTARG, &parse_wrap_args },
OPT_END(),
@@ -285,16 +448,65 @@ parse_done:
void shortlog_output(struct shortlog *log)
{
int i, j;
- if (log->sort_by_number)
- qsort(log->list.items, log->list.nr, sizeof(struct string_list_item),
- compare_by_number);
- for (i = 0; i < log->list.nr; i++) {
- struct string_list *onelines = log->list.items[i].util;
-
+
+ /*
+ * We do some pre-processing to find the author name for each item
+ * in log->all_lines, saving it in all_lines[i].util. If join_uids
+ * is on, the most common spelling and address will be used.
+ */
+ qsort(log->names.items, log->names.nr,
+ sizeof(struct string_list_item), compare_by_idx_and_count);
+
+ if (log->join_uids && log->email)
+ qsort(log->emails.items, log->emails.nr,
+ sizeof(struct string_list_item), compare_by_idx_and_count);
+
+ for (i = 0, j = 0; ; i++) {
+ static int idx = -1;
+ static const struct idinfo *info = NULL;
+ while (i < log->names.nr &&
+ (info = log->names.items[i].util)->idx == idx)
+ i++;
+ if (!info || info->idx == idx)
+ break;
+ idx = info->idx;
+ if (log->join_uids && log->email) {
+ int len;
+ char *name, *email, *newname;
+ while (j < log->emails.nr &&
+ (info = log->emails.items[j].util)->idx != idx)
+ j++;
+ if (j == log->emails.nr)
+ die("Could not find email address for '%s'",
+ log->names.items[i].string);
+ name = log->names.items[i].string;
+ email = log->emails.items[j].string;
+ len = strlen(name) + strlen(email) + 4;
+ newname = xmalloc(len);
+ snprintf(newname, len, "%s <%s>", name, email);
+ free(name);
+ log->names.items[i].string = newname;
+ }
+ log->all_lines[idx].items[0].util = log->names.items[i].string;
+ }
+
+ qsort(log->all_lines, log->nr, sizeof(struct string_list),
+ log->sort_by_number ? compare_by_nr : compare_by_first_util_str);
+
+ for (i = 0; i < log->nr; i++) {
+ const char *name;
+ struct string_list *onelines = &log->all_lines[i];
+
+ if (onelines->nr == 0)
+ /* There can be empty lists for merged names. */
+ continue;
+ else
+ name = onelines->items[0].util;
+
if (log->summary) {
- printf("%6d\t%s\n", onelines->nr, log->list.items[i].string);
+ printf("%6d\t%s\n", onelines->nr, name);
} else {
- printf("%s (%d):\n", log->list.items[i].string, onelines->nr);
+ printf("%s (%d):\n", name, onelines->nr);
for (j = onelines->nr - 1; j >= 0; j--) {
const char *msg = onelines->items[j].string;
@@ -308,15 +520,13 @@ void shortlog_output(struct shortlog *log)
}
putchar('\n');
}
-
onelines->strdup_strings = 1;
string_list_clear(onelines, 0);
- free(onelines);
- log->list.items[i].util = NULL;
- }
-
- log->list.strdup_strings = 1;
- string_list_clear(&log->list, 1);
+ }
+
+ free(log->all_lines);
+ string_list_clear(&log->names, 1);
+ string_list_clear(&log->emails, 1);
log->mailmap.strdup_strings = 1;
string_list_clear(&log->mailmap, 1);
}
diff --git a/shortlog.h b/shortlog.h
index bc02cc2..f539bf0 100644
--- a/shortlog.h
+++ b/shortlog.h
@@ -4,18 +4,24 @@
#include "string-list.h"
struct shortlog {
- struct string_list list;
int summary;
int wrap_lines;
int sort_by_number;
int wrap;
int in1;
int in2;
- int user_format;
-
+ int email;
+ int join_uids;
+
+ int user_format;
char *common_repo_prefix;
- int email;
struct string_list mailmap;
+
+ int nr, alloc;
+ int commit_count;
+ struct string_list names;
+ struct string_list emails;
+ struct string_list *all_lines;
};
void shortlog_init(struct shortlog *log);
--
1.6.1.134.g55c35
^ permalink raw reply related
* Re: [PATCH 3/6] Glean libexec path from argv[0] for git-upload-pack and git-receive-pack.
From: Steffen Prohaska @ 2009-01-10 15:55 UTC (permalink / raw)
To: Steve Haslam
Cc: Junio C Hamano, Git Mailing List, Johannes Sixt,
Johannes Schindelin
In-Reply-To: <alpine.DEB.1.00.0901101532430.30769@pacific.mpi-cbg.de>
On Jan 10, 2009, at 3:34 PM, Johannes Schindelin wrote:
> On Sat, 10 Jan 2009, Steffen Prohaska wrote:
>
>> From: Steve Haslam <shaslam@lastminute.com>
>>
>> If the user specified the full path to git-upload-pack as the -u
>> option to
>> "git clone" when cloning a remote repository, and git was not on
>> the default
>> PATH on the remote machine, git-upload-pack was failing to exec
>> git-pack-objects.
>>
>> By making the argv[0] path (if any) available to setup_path(), this
>> will
>> allow finding the "git" executable in the same directory as
>> "git-upload-pack". The default built in to exec_cmd.c is to look
>> for "git"
>> in the ".../libexec/git-core" directory, but it is not installed
>> there (any
>> longer).
>>
>> Much the same applies to invoking git-receive-pack from a non-PATH
>> location
>> using the "--exec" argument to "git push".
>>
>> [ spr: split Steve's original commit into two commits. ]
>
> I think you do not want to have that [ ... ] in the commit message,
> but
> after the "--".
>
> Further, it would make sense to have these 2 patches independently,
> provided that a test is added with which we could verify that the
> patches
> are actually necessary for upload-pack/receive-pack.
Steve,
could you comment on this. You are the original author of the patch.
Steffen
^ permalink raw reply
* Re: [PATCH] format-patch: avoid generation of empty patches
From: Nathan W. Panike @ 2009-01-10 16:01 UTC (permalink / raw)
To: Alexander Potashev; +Cc: Junio C Hamano, git
In-Reply-To: <20090110113903.GB25723@myhost>
Hi:
On Sat, Jan 10, 2009 at 5:39 AM, Alexander Potashev
<aspotashev@gmail.com> wrote:
...
>
> + if (!commit->parents && !rev.show_root_diff)
> + break;
Do you really want to stop getting commits? It seems like the break
statement here should be a continue.
Nathan Panike
^ permalink raw reply
* Re: [PATCH 3/6] Glean libexec path from argv[0] for git-upload-pack and git-receive-pack.
From: Steffen Prohaska @ 2009-01-10 16:01 UTC (permalink / raw)
To: Johannes Schindelin
Cc: Junio C Hamano, Git Mailing List, Johannes Sixt, Steve Haslam
In-Reply-To: <alpine.DEB.1.00.0901101532430.30769@pacific.mpi-cbg.de>
On Jan 10, 2009, at 3:34 PM, Johannes Schindelin wrote:
> Logically, and to avoid committing a broken revision, 1/6 should come
> last, methinks.
RUNTIME_PREFIX is not defined before 6/6. But I agree,
1/6 should probably be moved after 5/6.
Steffen
^ permalink raw reply
* Re: [PATCH] format-patch: avoid generation of empty patches
From: Alexander Potashev @ 2009-01-10 16:17 UTC (permalink / raw)
To: Nathan W. Panike; +Cc: Junio C Hamano, git
In-Reply-To: <d77df1110901100801s463bb43bt701a95df14f167d8@mail.gmail.com>
On 10:01 Sat 10 Jan , Nathan W. Panike wrote:
> Hi:
>
> On Sat, Jan 10, 2009 at 5:39 AM, Alexander Potashev
> <aspotashev@gmail.com> wrote:
> ...
> >
> > + if (!commit->parents && !rev.show_root_diff)
> > + break;
>
> Do you really want to stop getting commits? It seems like the break
> statement here should be a continue.
AFAIU get_revision stops revision iteration when it appears to stay at
the root commit. So, if we will replace 'break' with 'continue', the
'while' loop will finish right after that 'continue'.
However, I might be wrong... please, correct me then.
>
> Nathan Panike
^ permalink raw reply
* Re: Main branch being maintained with 'git am', how do mere mortals interact without too much conflicts?
From: Sitaram Chamarty @ 2009-01-10 16:18 UTC (permalink / raw)
To: git
In-Reply-To: <87vdsntnyd.dancerj%dancer@netfort.gr.jp>
On 2009-01-10, Junichi Uekawa <dancer@netfort.gr.jp> wrote:
> I've been maintaining my Git repository (monthlyreport.git) where most
> people do not have push access, and I'm taking patches through e-mail
> with 'git am'.
In general, if inputs are bunched up and arrive all
together, there's bound to be conflicts.
> It often happens that I'm receiving patches which won't apply without
> a merge ('git am -3') and happen to be conflict-resolving often,
> because people work off a branch a few days before, and try to send
That's the key phrase, the delay between when they pulled
and when they committed. I'm not sure of the nature of the
data, and how close it is to "source code" but normally this
is a case for a rebase.
If you don't want them to use branches, you can sort of get
away with these changes to your current flow:
> User does
> git pull xxxx
use "git pull --rebase xxxx" instead of plain pull;
resolve conflicts if needed
> edit ...
(I'm assuming there's a long gap between the pull above
and the add below)
> git add
> git commit
git fetch # update from origin
git rebase origin/master
(they may have to resolve conflicts, but it's easiest
when done at this point)
> git format-patch -o ... HEAD^
> I do bunch of
> git am -3 (which usually has a conflict of some way or other)
> git add XXXX
> git am -3 --resolve
> git push
The less the time gap between their "git format-patch" and
your "git am", the less conflicts you will have. If you're
working almost in "real time", the next user gets the latest
tree when he does his "git rebase origin/master" -- and in
fact that becomes pretty much the only point at which any
conflicts even happen.
...and you don't usually have to resolve a single conflict
;-)
^ permalink raw reply
* Re: Main branch being maintained with 'git am', how do mere mortals interact without too much conflicts?
From: Sitaram Chamarty @ 2009-01-10 16:29 UTC (permalink / raw)
To: git
In-Reply-To: <eaa105840901100647y70b53ae0w495af69b7281cae7@mail.gmail.com>
On 2009-01-10, Peter Harris <git@peter.is-a-geek.org> wrote:
> On Sat, Jan 10, 2009 at 6:11 AM, Junichi Uekawa wrote:
>> I am thinking of recommending the users to create a branch
> ...
>> and throw away their branches when they are included upstream.
>
> Yes, with a patch based workflow, this is almost required; all of the
> commits will at least have different committer information.
>
> There's nothing wrong with this approach.
That is almost exactly what a rebase does. Each patch on
your local "master" that eventually made it upstream gets
discarded during the rebase (which is a pretty cool thing!),
and what remains are commits that did not make it upstream
-- their current "work in progress".
The difference between "origin/master" and "master", after
each rebase, is their "private branch".
Except you don't have to confuse them by saying so ;-)
>> Something tells me the problem is that I'm probably using a workflow
>> that resembles SVN too much, and users aren't used to branches yet.
>> Has anybody found this to be a problem, or better yet, is there a
>> better workflow?
>
> If you need the commits to be identical, and you don't mind your email
> consisting of a binary blob attachment, you can ask your contributors
> to send you a bundle instead of a series of patches. "git help bundle"
> for details.
Excellent idea. But it only works for the first user who
sends him a bundle. The next one that he gets, assuming
that user also started from the same "upstream" commit as
the starting point, will be a merge, and he has to resolve
conflicts anyway.
Essentially, two things have to happen to reduce conflict
resolution overall. The users must rebase against the
latest upstream before sending the patch, and the supervisor
must process and push received patches asap.
^ permalink raw reply
* Re: [RFC/PATCH 2/3] replace_object: add mechanism to replace objects found in "refs/replace/"
From: Jakub Narebski @ 2009-01-10 16:30 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Christian Couder, git, Tim Ansell
In-Reply-To: <7v8wpl4akr.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
> Christian Couder <chriscool@tuxfamily.org> writes:
>
> > Yeah, but read_sha1_file is called to read all object files, not just
> > commits. So putting the hook there will:
> >
> > 1) add a lookup overhead when reading any object,
> > 2) make it possible to replace any object,
>
> I actually see (2) as an improvement, and (1) as an associated cost.
I just had an idea: we can use this mechanism to better manage large
binary files in Git, by using replacements for _blobs_.
We want to be able to have two flavours of repository: one with large
blobs (media files usually), and one without. We can use stubs in the
place of large binary files in 'no-megablobs' flavor, and add contents
of those files via refs/replace/* for _blobs_ in 'with-megablobs'
flavour. We can control which objects we want to have, and which
objects to transfer.
What do you think about this (abuse of) an idea?
--
Jakub Narebski
Poland
ShadeHawk on #git
^ permalink raw reply
* [PATCH] Add new testcases for format-patch root commits
From: Alexander Potashev @ 2009-01-10 16:39 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Git Mailing List, Alexander Potashev
In-Reply-To: <20090110113903.GB25723@myhost>
1. format-patch'ing root commit shouldn't create empty patches
2. With --root it should create a patch for the root commit
3. Similar testcases with two commits in the tree
Signed-off-by: Alexander Potashev <aspotashev@gmail.com>
---
git format-patch lacks a '--no-root' option, so I used
'git config log.showroot false' to emulate it.
t/t4033-format-patch-root-commit.sh | 52 +++++++++++++++++++++++++++++++++++
1 files changed, 52 insertions(+), 0 deletions(-)
create mode 100755 t/t4033-format-patch-root-commit.sh
diff --git a/t/t4033-format-patch-root-commit.sh b/t/t4033-format-patch-root-commit.sh
new file mode 100755
index 0000000..846c11c
--- /dev/null
+++ b/t/t4033-format-patch-root-commit.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+test_description='Format-patch root commit skipping/allowing'
+
+. ./test-lib.sh
+
+test_expect_success setup '
+ git config log.showroot false
+ git config format.numbered false
+ echo A > file &&
+ git add file &&
+ git commit -m First
+'
+
+test_patch_count() {
+ cnt=$(grep "^Subject: \[PATCH\]" $1 | wc -l) &&
+ test $cnt = $2
+}
+
+test_patch_is_single() {
+ cnt=$(grep "^Subject: \[PATCH\] $2" $1 | wc -l) &&
+ test $cnt = 1
+}
+
+test_expect_success 'format-patch root commit with showroot = false' '
+ git format-patch -1 &&
+ test_must_fail cat 0001-First.patch
+'
+
+test_expect_success 'format-patch root commit' '
+ git format-patch --root --stdout -5 >root-only.patch &&
+ test_patch_count root-only.patch 1 &&
+ test_patch_is_single root-only.patch First
+'
+
+test_expect_success 'format-patch 2 commits without root' '
+ echo B > file &&
+ git commit -a -m Second &&
+
+ git format-patch --stdout -2 >two-except-root.patch &&
+ test_patch_count two-except-root.patch 1 &&
+ test_patch_is_single two-except-root.patch Second
+'
+
+test_expect_success 'format-patch 2 commits including root' '
+ git format-patch --root --stdout -2 >two-with-root.patch &&
+ test_patch_count two-with-root.patch 2 &&
+ test_patch_is_single two-with-root.patch First &&
+ test_patch_is_single two-with-root.patch Second
+'
+
+test_done
--
1.6.1.81.g61cf1
^ permalink raw reply related
* Re: SSH_ASKPASS
From: Changsheng Jiang @ 2009-01-10 17:13 UTC (permalink / raw)
To: Henk; +Cc: git
In-Reply-To: <1231584934701-2137400.post@n2.nabble.com>
Why you don't setup a pair of keys, then you will not need to enter
passwords?
Yours Sincerely,
Changsheng Jiang
On Sat, Jan 10, 2009 at 18:55, Henk <henk_westhuis@hotmail.com> wrote:
>
> Hi,
>
> I'm trying to get "git push" to use git-gui--askpass to ask me for the
> password instead of promting me on the command promt. I need this because I
> start the "git push" command from code and there is no terminal where ssh
> can ask the user for a password. I tried writing the following tcl script
> that allmost is what I need:
>
> set env(SSH_ASKPASS) "C:/Program
> Files/Git/libexec/git-core/git-gui--askpass"
> exec ssh git@github.com
>
> Ssh will now ask me for the password using git-gui--askpass. But now the
> standardout is also shown in a dialog, and not on the standardout of the
> process. Looking at the git-gui scripts didn't help me, because I have
> absolutely zero experience in tcl.
>
> I also tried not using a tcl script, but setting SSH_ASKPASS as an
> environment variable in windows. This doesn't seem to work, ssh will still
> prompt me for a password.
>
> Anyone can help me write a script that asks for the password using
> SSH_ASKPASS but still prints the output on standardout?
>
> I use Windows btw.
>
> Henk
> --
> View this message in context: http://n2.nabble.com/SSH_ASKPASS-tp2137400p2137400.html
> Sent from the git mailing list archive at Nabble.com.
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* [EGIT PATCH] Make SHA-1 selectable using double-click in the commit message viewer.
From: Robin Rosenberg @ 2009-01-10 17:20 UTC (permalink / raw)
To: spearce; +Cc: git, Robin Rosenberg
The default behaviour does not consider a sequence of numbers and letters
to be a word. Installing the DefaultTextDoubleClickStrategy and activating
"plugins" in the textviewer solves the problem.
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
.../ui/internal/history/CommitMessageViewer.java | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/history/CommitMessageViewer.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/history/CommitMessageViewer.java
index 76d57bd..d21555c 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/history/CommitMessageViewer.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/history/CommitMessageViewer.java
@@ -15,7 +15,9 @@
import java.util.regex.Pattern;
import org.eclipse.core.runtime.ListenerList;
+import org.eclipse.jface.text.DefaultTextDoubleClickStrategy;
import org.eclipse.jface.text.Document;
+import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.TextViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyleRange;
@@ -98,6 +100,9 @@ public void mouseDown(final MouseEvent e) {
}
}
});
+ setTextDoubleClickStrategy(new DefaultTextDoubleClickStrategy(),
+ IDocument.DEFAULT_CONTENT_TYPE);
+ activatePlugins();
}
void addCommitNavigationListener(final CommitNavigationListener l) {
--
1.6.1.rc3.56.gd0306
^ permalink raw reply related
* [EGIT PATCH] Use text resources for the Commit dialog and add shortcuts.
From: Robin Rosenberg @ 2009-01-10 17:21 UTC (permalink / raw)
To: spearce; +Cc: git, Robin Rosenberg
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
.../src/org/spearce/egit/ui/UIText.java | 75 ++++++++++++++++++++
.../egit/ui/internal/dialogs/CommitDialog.java | 67 +++++++++---------
.../src/org/spearce/egit/ui/uitext.properties | 25 +++++++
3 files changed, 134 insertions(+), 33 deletions(-)
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/UIText.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/UIText.java
index 30122d2..0abb209 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/UIText.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/UIText.java
@@ -566,6 +566,81 @@
public static String PushWizard_windowTitleWithDestination;
/** */
+ public static String CommitDialog_AddFileOnDiskToIndex;
+
+ /** */
+ public static String CommitDialog_AddSOB;
+
+ /** */
+ public static String CommitDialog_AmendPreviousCommit;
+
+ /** */
+ public static String CommitDialog_Author;
+
+ /** */
+ public static String CommitDialog_Commit;
+
+ /** */
+ public static String CommitDialog_CommitChanges;
+
+ /** */
+ public static String CommitDialog_CommitMessage;
+
+ /** */
+ public static String CommitDialog_DeselectAll;
+
+ /** */
+ public static String CommitDialog_ErrorInvalidAuthor;
+
+ /** */
+ public static String CommitDialog_ErrorInvalidAuthorSpecified;
+
+ /** */
+ public static String CommitDialog_ErrorMustEnterCommitMessage;
+
+ /** */
+ public static String CommitDialog_ErrorNoItemsSelected;
+
+ /** */
+ public static String CommitDialog_ErrorNoItemsSelectedToBeCommitted;
+
+ /** */
+ public static String CommitDialog_ErrorNoMessage;
+
+ /** */
+ public static String CommitDialog_File;
+
+ /** */
+ public static String CommitDialog_SelectAll;
+
+ /** */
+ public static String CommitDialog_Status;
+
+ /** */
+ public static String CommitDialog_StatusAdded;
+
+ /** */
+ public static String CommitDialog_StatusAddedIndexDiff;
+
+ /** */
+ public static String CommitDialog_StatusModified;
+
+ /** */
+ public static String CommitDialog_StatusModifiedIndexDiff;
+
+ /** */
+ public static String CommitDialog_StatusModifiedNotStaged;
+
+ /** */
+ public static String CommitDialog_StatusRemoved;
+
+ /** */
+ public static String CommitDialog_StatusRemovedNotStaged;
+
+ /** */
+ public static String CommitDialog_StatusUnknown;
+
+ /** */
public static String ConfirmationPage_cantConnectToAnyTitle;
/** */
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/dialogs/CommitDialog.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/dialogs/CommitDialog.java
index f32112b..fede948 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/dialogs/CommitDialog.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/dialogs/CommitDialog.java
@@ -52,6 +52,7 @@
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.model.WorkbenchLabelProvider;
import org.spearce.egit.core.project.RepositoryMapping;
+import org.spearce.egit.ui.UIText;
import org.spearce.jgit.lib.Constants;
import org.spearce.jgit.lib.GitIndex;
import org.spearce.jgit.lib.PersonIdent;
@@ -92,7 +93,7 @@ public String getColumnText(Object obj, int columnIndex) {
return item.status;
case 1:
- return item.file.getProject().getName() + ": "
+ return item.file.getProject().getName() + ": " //$NON-NLS-1$
+ item.file.getProjectRelativePath();
default:
@@ -118,10 +119,10 @@ public CommitDialog(Shell parentShell) {
@Override
protected void createButtonsForButtonBar(Composite parent) {
- createButton(parent, IDialogConstants.SELECT_ALL_ID, "Select All", false);
- createButton(parent, IDialogConstants.DESELECT_ALL_ID, "Deselect All", false);
+ createButton(parent, IDialogConstants.SELECT_ALL_ID, UIText.CommitDialog_SelectAll, false);
+ createButton(parent, IDialogConstants.DESELECT_ALL_ID, UIText.CommitDialog_DeselectAll, false);
- createButton(parent, IDialogConstants.OK_ID, "Commit", true);
+ createButton(parent, IDialogConstants.OK_ID, UIText.CommitDialog_Commit, true);
createButton(parent, IDialogConstants.CANCEL_ID,
IDialogConstants.CANCEL_LABEL, false);
}
@@ -130,19 +131,19 @@ createButton(parent, IDialogConstants.CANCEL_ID,
Text authorText;
Button amendingButton;
Button signedOffButton;
-
+
CheckboxTableViewer filesViewer;
@Override
protected Control createDialogArea(Composite parent) {
Composite container = (Composite) super.createDialogArea(parent);
- parent.getShell().setText("Commit Changes");
+ parent.getShell().setText(UIText.CommitDialog_CommitChanges);
GridLayout layout = new GridLayout(2, false);
container.setLayout(layout);
Label label = new Label(container, SWT.LEFT);
- label.setText("Commit Message:");
+ label.setText(UIText.CommitDialog_CommitMessage);
label.setLayoutData(GridDataFactory.fillDefaults().span(2, 1).grab(true, false).create());
commitText = new Text(container, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL);
@@ -163,7 +164,7 @@ public void keyPressed(KeyEvent arg0) {
}
});
- new Label(container, SWT.LEFT).setText("Author: ");
+ new Label(container, SWT.LEFT).setText(UIText.CommitDialog_Author);
authorText = new Text(container, SWT.BORDER);
authorText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
if (author != null)
@@ -186,24 +187,24 @@ public void widgetSelected(SelectionEvent arg0) {
alreadyAdded = true;
String curText = commitText.getText();
if (curText.length() > 0)
- curText += "\n";
+ curText += "\n"; //$NON-NLS-1$
commitText.setText(curText + previousCommitMessage);
}
}
-
+
public void widgetDefaultSelected(SelectionEvent arg0) {
// Empty
}
});
-
- amendingButton.setText("Amend previous commit");
+
+ amendingButton.setText(UIText.CommitDialog_AmendPreviousCommit);
amendingButton.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).span(2, 1).create());
signedOffButton = new Button(container, SWT.CHECK);
signedOffButton.setSelection(signedOff);
- signedOffButton.setText("Add Signed-off-by");
+ signedOffButton.setText(UIText.CommitDialog_AddSOB);
signedOffButton.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).span(2, 1).create());
-
+
Table resourcesTable = new Table(container, SWT.H_SCROLL | SWT.V_SCROLL
| SWT.FULL_SELECTION | SWT.MULTI | SWT.CHECK | SWT.BORDER);
resourcesTable.setLayoutData(GridDataFactory.fillDefaults().hint(600,
@@ -211,12 +212,12 @@ public void widgetDefaultSelected(SelectionEvent arg0) {
resourcesTable.setHeaderVisible(true);
TableColumn statCol = new TableColumn(resourcesTable, SWT.LEFT);
- statCol.setText("Status");
+ statCol.setText(UIText.CommitDialog_Status);
statCol.setWidth(150);
statCol.addSelectionListener(new HeaderSelectionListener(CommitItem.Order.ByStatus));
TableColumn resourceCol = new TableColumn(resourcesTable, SWT.LEFT);
- resourceCol.setText("File");
+ resourceCol.setText(UIText.CommitDialog_File);
resourceCol.setWidth(415);
resourceCol.addSelectionListener(new HeaderSelectionListener(CommitItem.Order.ByFile));
@@ -234,7 +235,7 @@ public void widgetDefaultSelected(SelectionEvent arg0) {
private Menu getContextMenu() {
Menu menu = new Menu(filesViewer.getTable());
MenuItem item = new MenuItem(menu, SWT.PUSH);
- item.setText("Add file on disk to index");
+ item.setText(UIText.CommitDialog_AddFileOnDiskToIndex);
item.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event arg0) {
IStructuredSelection sel = (IStructuredSelection) filesViewer.getSelection();
@@ -271,12 +272,12 @@ public void handleEvent(Event arg0) {
}
}
});
-
+
return menu;
}
private static String getFileStatus(IFile file) {
- String prefix = "Unknown";
+ String prefix = UIText.CommitDialog_StatusUnknown;
try {
RepositoryMapping repositoryMapping = RepositoryMapping
@@ -292,22 +293,22 @@ private static String getFileStatus(IFile file) {
Entry indexEntry = index.getEntry(repoPath);
if (headEntry == null) {
- prefix = "Added";
+ prefix = UIText.CommitDialog_StatusAdded;
if (indexEntry.isModified(repositoryMapping.getWorkDir()))
- prefix = "Added, index diff";
+ prefix = UIText.CommitDialog_StatusAddedIndexDiff;
} else if (indexEntry == null) {
- prefix = "Removed";
+ prefix = UIText.CommitDialog_StatusRemoved;
} else if (headExists
&& !headEntry.getId().equals(indexEntry.getObjectId())) {
- prefix = "Modified";
+ prefix = UIText.CommitDialog_StatusModified;
if (indexEntry.isModified(repositoryMapping.getWorkDir()))
- prefix = "Mod., index diff";
+ prefix = UIText.CommitDialog_StatusModifiedIndexDiff;
} else if (!new File(repositoryMapping.getWorkDir(), indexEntry
.getName()).isFile()) {
- prefix = "Rem., not staged";
+ prefix = UIText.CommitDialog_StatusRemovedNotStaged;
} else if (indexEntry.isModified(repositoryMapping.getWorkDir())) {
- prefix = "Mod., not staged";
+ prefix = UIText.CommitDialog_StatusModifiedNotStaged;
}
} catch (Exception e) {
@@ -331,14 +332,14 @@ public void setCommitMessage(String s) {
this.commitMessage = s;
}
- private String commitMessage = "";
+ private String commitMessage = ""; //$NON-NLS-1$
private String author = null;
private boolean signedOff = false;
private boolean amending = false;
private boolean amendAllowed = true;
private ArrayList<IFile> selectedFiles = new ArrayList<IFile>();
- private String previousCommitMessage = "";
+ private String previousCommitMessage = ""; //$NON-NLS-1$
/**
* Pre-select suggested set of resources to commit
@@ -398,28 +399,28 @@ protected void okPressed() {
author = authorText.getText().trim();
signedOff = signedOffButton.getSelection();
amending = amendingButton.getSelection();
-
+
Object[] checkedElements = filesViewer.getCheckedElements();
selectedFiles.clear();
for (Object obj : checkedElements)
selectedFiles.add(((CommitItem) obj).file);
if (commitMessage.trim().length() == 0) {
- MessageDialog.openWarning(getShell(), "No message", "You must enter a commit message");
+ MessageDialog.openWarning(getShell(), UIText.CommitDialog_ErrorNoMessage, UIText.CommitDialog_ErrorMustEnterCommitMessage);
return;
}
-
+
if (author.length() > 0) {
try {
new PersonIdent(author);
} catch (IllegalArgumentException e) {
- MessageDialog.openWarning(getShell(), "Invalid author", "Invalid author specified. Please use the form:\nA U Thor <author@example.com>");
+ MessageDialog.openWarning(getShell(), UIText.CommitDialog_ErrorInvalidAuthor, UIText.CommitDialog_ErrorInvalidAuthorSpecified);
return;
}
} else author = null;
if (selectedFiles.isEmpty() && !amending) {
- MessageDialog.openWarning(getShell(), "No items selected", "No items are currently selected to be committed.");
+ MessageDialog.openWarning(getShell(), UIText.CommitDialog_ErrorNoItemsSelected, UIText.CommitDialog_ErrorNoItemsSelectedToBeCommitted);
return;
}
super.okPressed();
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/uitext.properties b/org.spearce.egit.ui/src/org/spearce/egit/ui/uitext.properties
index 3819047..3c9a21c 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/uitext.properties
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/uitext.properties
@@ -216,6 +216,31 @@ PushWizard_unexpectedError=Unexpected error occurred.
PushWizard_windowTitleDefault=Push To Another Repositories
PushWizard_windowTitleWithDestination=Push To: {0}
+CommitDialog_AddFileOnDiskToIndex=Add file on &disk to index
+CommitDialog_AddSOB=Add Signed-off-&by
+CommitDialog_AmendPreviousCommit=A&mend previous commit
+CommitDialog_Author=&Author:
+CommitDialog_Commit=&Commit
+CommitDialog_CommitChanges=Commit Changes
+CommitDialog_CommitMessage=Commit &Message:
+CommitDialog_DeselectAll=&Deselect All
+CommitDialog_ErrorInvalidAuthor=Invalid author
+CommitDialog_ErrorInvalidAuthorSpecified=Invalid author specified. Please use the form:\nA U Thor <author@example.com>
+CommitDialog_ErrorMustEnterCommitMessage=You must enter a commit message
+CommitDialog_ErrorNoItemsSelected=No items selected
+CommitDialog_ErrorNoItemsSelectedToBeCommitted=No items are currently selected to be committed.
+CommitDialog_ErrorNoMessage=No message
+CommitDialog_File=File
+CommitDialog_SelectAll=&Select All
+CommitDialog_Status=Status
+CommitDialog_StatusAdded=Added
+CommitDialog_StatusAddedIndexDiff=Added, index diff
+CommitDialog_StatusModified=Modified
+CommitDialog_StatusModifiedIndexDiff=Mod., index diff
+CommitDialog_StatusModifiedNotStaged=Mod., not staged
+CommitDialog_StatusRemoved=Removed
+CommitDialog_StatusRemovedNotStaged=Rem., not staged
+CommitDialog_StatusUnknown=Unknown
ConfirmationPage_cantConnectToAnyTitle=Can't Connect
ConfirmationPage_cantConnectToAny=Can't connect to any URI: {0}
ConfirmationPage_description=Confirm following expected push result.
--
1.6.1.rc3.56.gd0306
^ permalink raw reply related
* [PATCH] git-cache-meta -- file owner and permissions caching, minimalist approach
From: jidanni @ 2009-01-10 17:43 UTC (permalink / raw)
To: gitster; +Cc: git
In-Reply-To: <200901082229.46433.bss@iguanasuicide.net>
Signed-off-by: jidanni <jidanni@jidanni.org>
---
contrib/metadata/git-cache-meta | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
create mode 100755 contrib/metadata/git-cache-meta
diff --git a/contrib/metadata/git-cache-meta b/contrib/metadata/git-cache-meta
new file mode 100755
index 0000000..5e1b740
--- /dev/null
+++ b/contrib/metadata/git-cache-meta
@@ -0,0 +1,19 @@
+#!/bin/sh -e
+# git-cache-meta -- file owner and permissions caching, minimalist approach
+: ${GIT_CACHE_META_FILE=.git_cache_meta} #simpler not to git-add it
+case $@ in
+ --store|--stdout)
+ case $1 in --store) exec > $GIT_CACHE_META_FILE; esac
+ git ls-files|xargs -I{} find {} \
+ \( -user ${USER?} -o -printf "chown %u '%p'\n" \) \
+ \( -group $USER -o -printf "chgrp %g '%p'\n" \) \
+ \( \( -type l -o -perm 755 -o -perm 644 \) \
+ -o -printf "chmod %#m '%p'\n" \);;#requires GNU Find
+ --apply) sh -e $GIT_CACHE_META_FILE;;
+ *) 1>&2 cat <<EOF; exit 1;;
+Usage: $0 --store|--stdout|--apply #Example:
+# git bundle create mybundle.bdl master; git-cache-meta --store
+# scp mybundle.bdl .git_cache_meta machine2: #then on machine2:
+# git init; git pull mybundle.bdl master; git-cache-meta --apply
+EOF
+esac
--
1.6.0.6
^ permalink raw reply related
* Re: [PATCH v2] make diff --color-words customizable
From: Davide Libenzi @ 2009-01-10 17:53 UTC (permalink / raw)
To: Jakub Narebski; +Cc: Johannes Schindelin, git, Thomas Rast
In-Reply-To: <200901101436.48149.jnareb@gmail.com>
On Sat, 10 Jan 2009, Jakub Narebski wrote:
> On Sat, 10 Jan 2009, Johannes Schindelin wrote:
> > On Sat, 10 Jan 2009, Jakub Narebski wrote:
> > > Thomas Rast wrote:
> > >
> > > > --color-words works (and always worked) by splitting words onto one
> > > > line each, and using the normal line-diff machinery to get a word
> > > > diff.
> > >
> > > Cannot we generalize diff machinery / use underlying LCS diff engine
> > > instead of going through line diff?
> >
> > What do you think we're doing? libxdiff is pretty hardcoded to newlines.
> > That's why we're substituting non-word characters with newlines.
>
> Isn't Meyers algorithm used by libxdiff based on LCS, largest common
> subsequence, and doesn't it generate from the mathematical point of
> view "diff" between two sequences (two arrays) which just happen to
> be lines? It is a bit strange that libxdiff doesn't export its low
> level algorithm...
The core doesn't know anything about lines. Only pre-processing (setting
up the hash by tokenizing the input) and post-processing (adding '\n' to
the end of each token), knows about newlines. Memory consumption would
increase significantly though, since there is a per-token cost, and a
word-based diff will create more of them WRT the same input.
- Davide
^ permalink raw reply
* Re: SSH_ASKPASS
From: Alexander Gavrilov @ 2009-01-10 18:02 UTC (permalink / raw)
To: Henk; +Cc: git
In-Reply-To: <1231584934701-2137400.post@n2.nabble.com>
On Saturday 10 January 2009 13:55:34 Henk wrote:
> I'm trying to get "git push" to use git-gui--askpass to ask me for the
> password instead of promting me on the command promt. I need this because I
> start the "git push" command from code and there is no terminal where ssh
> can ask the user for a password. I tried writing the following tcl script
> that allmost is what I need:
>
> set env(SSH_ASKPASS) "C:/Program
> Files/Git/libexec/git-core/git-gui--askpass"
> exec ssh git@github.com
>
> Ssh will now ask me for the password using git-gui--askpass. But now the
> standardout is also shown in a dialog, and not on the standardout of the
> process. Looking at the git-gui scripts didn't help me, because I have
> absolutely zero experience in tcl.
>
> I also tried not using a tcl script, but setting SSH_ASKPASS as an
> environment variable in windows. This doesn't seem to work, ssh will still
> prompt me for a password.
>
> Anyone can help me write a script that asks for the password using
> SSH_ASKPASS but still prints the output on standardout?
OpenSSH won't even try to use SSH_ASKPASS if it has access to a terminal.
Tcl makes it work precisely because the Tcl interpreter is a GUI application
that is detached from the console.
You should set the SSH_ASKPASS variable, and try running the commands as
you actually plan to do it from your code.
Alexander
^ permalink raw reply
* Re: [PATCH] format-patch: avoid generation of empty patches
From: Nathan W. Panike @ 2009-01-10 18:07 UTC (permalink / raw)
To: Alexander Potashev; +Cc: Junio C Hamano, git
In-Reply-To: <20090110161722.GA18859@myhost>
Hi:
On Sat, Jan 10, 2009 at 10:17 AM, Alexander Potashev
<aspotashev@gmail.com> wrote:
...
> AFAIU get_revision stops revision iteration when it appears to stay at
> the root commit. So, if we will replace 'break' with 'continue', the
> 'while' loop will finish right after that 'continue'.
> However, I might be wrong... please, correct me then.
I was thinking of the case where there is more than one root. Maybe
the code does the right thing then, but I confess I have not looked at
it deeply enough to know.
Nathan Panike
^ permalink raw reply
* Re: [PATCH] Add new testcases for format-patch root commits
From: Alexander Potashev @ 2009-01-10 18:33 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Git Mailing List
In-Reply-To: <1231605577-26148-1-git-send-email-aspotashev@gmail.com>
On 19:39 Sat 10 Jan , Alexander Potashev wrote:
> 1. format-patch'ing root commit shouldn't create empty patches
> 2. With --root it should create a patch for the root commit
> 3. Similar testcases with two commits in the tree
>
> Signed-off-by: Alexander Potashev <aspotashev@gmail.com>
> ---
>
> git format-patch lacks a '--no-root' option, so I used
> 'git config log.showroot false' to emulate it.
Sorry, --root option has nothing in common with log.showroot, but the
testcases are still valid.
>
>
>
> t/t4033-format-patch-root-commit.sh | 52 +++++++++++++++++++++++++++++++++++
> 1 files changed, 52 insertions(+), 0 deletions(-)
> create mode 100755 t/t4033-format-patch-root-commit.sh
>
> diff --git a/t/t4033-format-patch-root-commit.sh b/t/t4033-format-patch-root-commit.sh
> new file mode 100755
> index 0000000..846c11c
> --- /dev/null
> +++ b/t/t4033-format-patch-root-commit.sh
> @@ -0,0 +1,52 @@
> +#!/bin/sh
> +
> +test_description='Format-patch root commit skipping/allowing'
> +
> +. ./test-lib.sh
> +
> +test_expect_success setup '
> + git config log.showroot false
> + git config format.numbered false
> + echo A > file &&
> + git add file &&
> + git commit -m First
> +'
> +
> +test_patch_count() {
> + cnt=$(grep "^Subject: \[PATCH\]" $1 | wc -l) &&
> + test $cnt = $2
> +}
> +
> +test_patch_is_single() {
> + cnt=$(grep "^Subject: \[PATCH\] $2" $1 | wc -l) &&
> + test $cnt = 1
> +}
> +
> +test_expect_success 'format-patch root commit with showroot = false' '
> + git format-patch -1 &&
> + test_must_fail cat 0001-First.patch
> +'
> +
> +test_expect_success 'format-patch root commit' '
> + git format-patch --root --stdout -5 >root-only.patch &&
> + test_patch_count root-only.patch 1 &&
> + test_patch_is_single root-only.patch First
> +'
> +
> +test_expect_success 'format-patch 2 commits without root' '
> + echo B > file &&
> + git commit -a -m Second &&
> +
> + git format-patch --stdout -2 >two-except-root.patch &&
> + test_patch_count two-except-root.patch 1 &&
> + test_patch_is_single two-except-root.patch Second
> +'
> +
> +test_expect_success 'format-patch 2 commits including root' '
> + git format-patch --root --stdout -2 >two-with-root.patch &&
> + test_patch_count two-with-root.patch 2 &&
> + test_patch_is_single two-with-root.patch First &&
> + test_patch_is_single two-with-root.patch Second
> +'
> +
> +test_done
> --
> 1.6.1.81.g61cf1
>
^ permalink raw reply
* Re: [PATCH] gitweb: suggest name for OPML view
From: Giuseppe Bilotta @ 2009-01-10 19:15 UTC (permalink / raw)
To: Jakub Narebski; +Cc: git, Petr Baudis, Junio C Hamano
In-Reply-To: <200901101510.20918.jnareb@gmail.com>
On Sat, Jan 10, 2009 at 9:10 AM, Jakub Narebski <jnareb@gmail.com> wrote:
> On Fri, 2 Jan 2009, Giuseppe Bilotta wrote:
>
>> Suggest opml.xml as name for OPML view by providing the appropriate
>> header, consistently with similar usage in project_index view.
>
> It is not name for a view, but more of default filename when saving
> it. While it is good idea to have consistency, I guess that while
> 'project_index' view and other non-HTML views are meant to be
> downloaded and saved (snapshots, patches, patchsets), OPML view
> is meant to be used on-line, just like web feeds in RSS and Atom
> formats which are non-HTML too but do not have Content-Disposition
> header set.
OPML is used for import/export of RSS feed lists between aggregators
(e.g. moving your reading list from knewsreader to google reader). As
such, it can also be comfortable to save it to disk for import by some
tools. IMO, of course. And there's also the consistency thing, and not
actual reason _not_ to offer the filename, since it comes pretty
cheap.
--
Giuseppe "Oblomov" Bilotta
^ permalink raw reply
* Re: Google Summer of Code 2009
From: Jakub Narebski @ 2009-01-10 19:33 UTC (permalink / raw)
To: Shawn O. Pearce; +Cc: git
In-Reply-To: <20090107183033.GB10790@spearce.org>
"Shawn O. Pearce" <spearce@spearce.org> writes:
> The application answers really need to be reworked; we need to
> address our 2008 results in these parts.
By the way, do you know what happened with git-sequencer project?
If I remember correctly there was agreement on sequences mini-language
(I think), and there was git-sequencer prototype in shell, using
git-cherry-pick if I remember correctly, and even git-rebase and
git-am etc reworked to make use of git-sequencer. Stephan Beyer wrote
that he has some preliminary version of builtin git-sequencer (in C),
and that it makes git-rebase--interactive and like faster than current
implementation... but builtin sequencer never materialized on git
mailing list as a patch, if I remember correctly, and of course it was
not merged into git either.
> The ideas box is once again open for suggestions. Please start
> proposing student projects, and possible mentors.
Hmm... take a look what features competition has (Darcs, Bazaar-NG,
Subversion, Mercurial, Monotone)...
>
>
> Since the program is smaller, there is a chance we won't be accepted
> this year due to space constraints. But I think its still worthwhile
> to prepare everything and hope for the best. And before you can
> ask, no, my employee status with OSPO doesn't improve our odds
> for acceptance. :-)
Perhaps at least _one_ project. I think that resumable clone /
resumable fetch would be a good thing to have...
--
Jakub Narebski
Poland
ShadeHawk on #git
^ permalink raw reply
* Re: [PATCH] gitweb: suggest name for OPML view
From: Jakub Narebski @ 2009-01-10 19:45 UTC (permalink / raw)
To: Giuseppe Bilotta; +Cc: git, Petr Baudis, Junio C Hamano
In-Reply-To: <cb7bb73a0901101115i541f0911o42f08fc47820fb82@mail.gmail.com>
Giuseppe Bilotta wrote:
> On Sat, Jan 10, 2009 at 9:10 AM, Jakub Narebski <jnareb@gmail.com> wrote:
>> On Fri, 2 Jan 2009, Giuseppe Bilotta wrote:
>>
>>> Suggest opml.xml as name for OPML view by providing the appropriate
>>> header, consistently with similar usage in project_index view.
>>
>> It is not name for a view, but more of default filename when saving
>> it. While it is good idea to have consistency, I guess that while
>> 'project_index' view and other non-HTML views are meant to be
>> downloaded and saved (snapshots, patches, patchsets), OPML view
>> is meant to be used on-line, just like web feeds in RSS and Atom
>> formats which are non-HTML too but do not have Content-Disposition
>> header set.
>
> OPML is used for import/export of RSS feed lists between aggregators
> (e.g. moving your reading list from knewsreader to google reader). As
> such, it can also be comfortable to save it to disk for import by some
> tools. IMO, of course. [...]
If it is used in such way, then I am all for it (and of course for
consistency with 'projects_index' view).
Acked-by: Jakub Narebski <jnareb@gmail.com>
--
Jakub Narebski
Poland
^ permalink raw reply
* Re: Google Summer of Code 2009
From: Johannes Schindelin @ 2009-01-10 19:58 UTC (permalink / raw)
To: Jakub Narebski; +Cc: Shawn O. Pearce, git
In-Reply-To: <m3privyn20.fsf@localhost.localdomain>
Hi,
On Sat, 10 Jan 2009, Jakub Narebski wrote:
> "Shawn O. Pearce" <spearce@spearce.org> writes:
>
> > The application answers really need to be reworked; we need to
> > address our 2008 results in these parts.
>
> By the way, do you know what happened with git-sequencer project?
-- snip --
commit 3bfd6761ce2f769746c6b84be97f7da0cad7cad1
Author: Stephan Beyer <s-beyer@gmx.net>
Date: Wed Jan 7 19:07:31 2009 +0100
builtin-sequencer.c/prepare_commit_msg_hook: tiny simplification
Thanks to Christian.
-- snap --
Ciao,
Dscho
^ permalink raw reply
* Re: [PATCH EGIT Allow for git config to not error when lines have '/r' in them.]
From: Robin Rosenberg @ 2009-01-10 20:34 UTC (permalink / raw)
To: Ryan Alberts; +Cc: git, spearce
In-Reply-To: <142772020901071910ha95d53fo2454f8685908338c@mail.gmail.com>
torsdag 08 januari 2009 04:10:05 skrev Ryan Alberts:
> I have attached a small fix for when a git config has /r lines in the file.
> I have to admit that I do not usually submit patches to the open source
> community and I am not very familiar with the process :-) Please, please,
> let me know if I can do something different next time!
1) Inline the patch
No, need for such a large sign-off. It's good you declare that you have
understand the SOB-line.
You can add "extra" comments that should not go into the cBommit after the
comment like this:
From:.. etc
"This" goes into the commit
Signed-off-by: Whom Ever <whom.ever@example.com>
---
The three dashes ends the comment. Anything after it and the actual patch
will be ignored by git am, but might be useful to the maintainer.
Back to the patch. I think we should only ignore \r (not /r, but could say CR in
a comment) before an LF.
-- robin
^ permalink raw reply
* Re: [PATCH 3/6] Glean libexec path from argv[0] for git-upload-pack and git-receive-pack.
From: Junio C Hamano @ 2009-01-10 20:36 UTC (permalink / raw)
To: Steffen Prohaska
Cc: Johannes Schindelin, Git Mailing List, Johannes Sixt,
Steve Haslam
In-Reply-To: <9CECD102-6D3E-487D-BA1E-C0269D055965@zib.de>
Steffen Prohaska <prohaska@zib.de> writes:
> On Jan 10, 2009, at 3:34 PM, Johannes Schindelin wrote:
>
>> Logically, and to avoid committing a broken revision, 1/6 should come
>> last, methinks.
>
> RUNTIME_PREFIX is not defined before 6/6. But I agree,
> 1/6 should probably be moved after 5/6.
>
> Steffen
Hmm, I actually was thinking about applying that (and that one only) early
to my tree, to make sure it is regression-free.
^ permalink raw reply
* Re: [PATCH 2/2] grep: don't call regexec() for fixed strings
From: Junio C Hamano @ 2009-01-10 20:37 UTC (permalink / raw)
To: René Scharfe; +Cc: Git Mailing List
In-Reply-To: <4967DB4A.2000702@lsrfire.ath.cx>
René Scharfe <rene.scharfe@lsrfire.ath.cx> writes:
> Add the new flag "fixed" to struct grep_pat and set it if the pattern
> is doesn't contain any regex control characters in addition to if the
> flag -F/--fixed-strings was specified.
>
> This gives a nice speed up on msysgit, where regexec() seems to be
> extra slow. Before (best of five runs):
Thanks, and...
> static void compile_regexp(struct grep_pat *p, struct grep_opt *opt)
> {
> - int err = regcomp(&p->regexp, p->pattern, opt->regflags);
> + int err;
> +
> + if (opt->fixed || is_fixed(p->pattern))
> + p->fixed = 1;
> + if (opt->regflags & REG_ICASE)
> + p->fixed = 0;
... thanks again for being extra careful. That's why I *love* your
patches.
^ permalink raw reply
* Re: [PATCH] format-patch: avoid generation of empty patches
From: Junio C Hamano @ 2009-01-10 20:41 UTC (permalink / raw)
To: Nathan W. Panike; +Cc: Alexander Potashev, git
In-Reply-To: <d77df1110901100801s463bb43bt701a95df14f167d8@mail.gmail.com>
"Nathan W. Panike" <nathan.panike@gmail.com> writes:
> On Sat, Jan 10, 2009 at 5:39 AM, Alexander Potashev
> <aspotashev@gmail.com> wrote:
> ...
>>
>> + if (!commit->parents && !rev.show_root_diff)
>> + break;
>
> Do you really want to stop getting commits? It seems like the break
> statement here should be a continue.
You can give a commit range that has two independent roots. The above
"break" is wrong.
The variable is called show_root_DIFF, not show_root_COMMIT; even if you
have "log.showroot = false", "git log -p" output would still give you the
initial commit, but without the patch text, no?
But that is not Alexander's fault; it is mine.
I think "log -p" and "format-patch" can and should behave differently in
this case. "log -p" is for people who already _have_ the history and
would want to inspect how it evolved, and it is reasonable if some people
want to say "the very initial huge import is not interesting to me while
reviewing the history", and turning it off makes sense for them (in fact,
the default was initially that way).
On the other hand, "format-patch" is about exporting a part of your
history so that you can mechanincally replay it elsewhere, and I do not
think of a reasonable justification not to export a root commit fully if
the range user asked for happens to contain one.
I agree with Alexander that we should not output just the message without
the patch text, but I think the right solution is to show both. not to
skip root.
-- >8 --
format-patch: show patch text for the root commit
Even without --root specified, if the range given on the command line
happens to include a root commit, we should include its patch text in the
output.
This fix deliberately ignores log.showroot configuration variable because
"format-patch" and "log -p" can and should behave differently in this
case, as the former is about exporting a part of your history in a form
that is replayable elsewhere and just giving the commit log message
without the patch text does not make any sense for that purpose.
Noticed and fix originally attempted by Nathan W. Panike; credit goes to
Alexander Potashev for injecting sanity to my initial (broken) fix that
used the value from log.showroot configuration, which was misguided.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
builtin-log.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git c/builtin-log.c w/builtin-log.c
index 4a02ee9..91e5412 100644
--- c/builtin-log.c
+++ w/builtin-log.c
@@ -935,6 +935,13 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
* get_revision() to do the usual traversal.
*/
}
+
+ /*
+ * We cannot move this anywhere earlier because we do want to
+ * know if --root was given explicitly from the comand line.
+ */
+ rev.show_root_diff = 1;
+
if (cover_letter) {
/* remember the range */
int i;
^ 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