* Re: [PATCH] Fix regression in fast-import.c due to strbufs.
From: Pierre Habouzit @ 2007-10-29 6:29 UTC (permalink / raw)
To: Shun Kei Leung
Cc: Junio C Hamano, Johannes Schindelin, Shawn O. Pearce, Git ML
In-Reply-To: <e66701d40710281959q517eabecm87bcf54c7fe47741@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 403 bytes --]
On Mon, Oct 29, 2007 at 02:59:02AM +0000, Shun Kei Leung wrote:
> Hi Pierre,
>
> Thanks. You are the man! It works perfectly now.
Actually, I also was the one breaking it in the first place, but
you're welcome :)
--
·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: New features in gitk
From: Pierre Habouzit @ 2007-10-29 6:24 UTC (permalink / raw)
To: Paul Mackerras; +Cc: git
In-Reply-To: <18213.6055.235067.730640@cargo.ozlabs.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 698 bytes --]
On dim, oct 28, 2007 at 11:13:43 +0000, Paul Mackerras wrote:
> Pierre Habouzit writes:
>
> > As you seem to be the guy to ask for, I've a couple of requests wrt
> > gitk.
> >
> > * the diff window is quite bad with merge commits, the colorization is
> > rather poor, and the last version you just merged isn't especially
> > better.
>
> That's not a request, that's a grizzle. :)
Right, would have I known a single word of Tcl, I would have provided
patches for that long time ago btw :P
--
·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: New features in gitk
From: Pierre Habouzit @ 2007-10-29 6:20 UTC (permalink / raw)
To: Paul Mackerras; +Cc: git
In-Reply-To: <18213.6055.235067.730640@cargo.ozlabs.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 3758 bytes --]
On Sun, Oct 28, 2007 at 11:13:43PM +0000, Paul Mackerras wrote:
> Pierre Habouzit writes:
>
> > As you seem to be the guy to ask for, I've a couple of requests wrt
> > gitk.
> >
> > * the diff window is quite bad with merge commits, the colorization is
> > rather poor, and the last version you just merged isn't especially
> > better.
>
> That's not a request, that's a grizzle. :) What would you like it to
> look like?
I believe that git show/diff has it right: lines with a + should be in
the "added" color, and lines with a '-' in the "removed" one. gitk only
take the first "column" of +/- into account or sth I find awkward at
best, and I often go to the console to see a merge commit because of
that.
> > * the 'sha1' input field is a major pain in the UI: the cut&paste
> > interaction is very poor. I don't know why, but it's often very very
> > hard to really copy the sha id, probably because it's selected by
> > default.
>
> It's selected so that the contents are in the cut buffer and you can
> paste them in an xterm with middle-button. Possibly I need to check
> that control-C (or command-C under macos) is properly bound to copy.
Well, doing ^C doesn't always copy it (probably a glitch wrt which
input has the focus), and it certainly doesn't synchronize with the cut
buffer for me. And it doesn't work for anyone at work either. I use ion
with the KDE clipboard manager (klipper -- because I never managed to
find a clipboard manager that is as good yet, not depending upon KDE),
and at work most people use KDE, with the same klipper. Maybe it's a bad
interaction, I should try to use it under gnome or so to see if it is.
> > * the fact that it remembers the position where it was in the WM when
> > it was closed is really annoying. the WM is supposed to place the
> > window. With at least ion3 and xinerama it often shows up on the
> > wrong screen. Remembering the window size though is fine.
>
> That came in with some changes that make gitk start up correctly under
> windows. I could see about making it set the window position only
> under windows.
That'd be really great.
> > * still wrt the layout, the focus is quite cumbersome. Gitk would be
> > really really really nice to be used only from the keyboard, but
> > because of a very unclear focus policy, it really isn't for me.
> > Maybe it's just me, and I know this may not be 100% helpful, but I
> > never know which part of gitk will receive my keys (history part,
> > diff part, tree, ...).
>
> What focus policy would you like?
Well, what would make sense (to _me_ at least) would be some shortcuts
to move to the history panel (say e.g. using F1), or to the diff view
(using e.g. F2), or in the file list (say F3).
That would hilight with a black 1px line (like it does for other
inputs fields) to say that this is the primary window part that takes
the keyboard inputs atm. And when doing that, if you press 'down' or
'up' it would scroll the adequate panel. It's really confusing that the
keyboard (or hjkl) right now always make the history change.
This way you can make the difference between the keyboard shortcuts
that apply to the focused part of the window (up/down, pgup/pgdown are
IMHO of that kind), and the one that the user (or the default gitk) has
associated to a specific part, no matter if it has the focus. E.g. J/K
(or for emacsish people ^N/^P) could always move the history, that would
make sense.
Cheers,
--
·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: [RFH] gcc constant expression warning...
From: Linus Torvalds @ 2007-10-29 4:37 UTC (permalink / raw)
To: Nicolas Pitre; +Cc: Antti-Juhani Kaijanaho, git
In-Reply-To: <alpine.LFD.0.9999.0710282053590.22100@xanadu.home>
On Sun, 28 Oct 2007, Nicolas Pitre wrote:
>
> The test must also make sure off_t isn't signed, since in that case it
> can only hold 31 bits.
Sinc eneither 31 _nor_ 32 bits is really enough, it's perfectly fine to
just check that the size of "off_t" is *bigger* than 4 bytes, which my
pseudo-patch did.
Linus
^ permalink raw reply
* Re: [PATCH] Bisect: add "skip" to the short usage string.
From: David Symonds @ 2007-10-29 4:35 UTC (permalink / raw)
To: Christian Couder; +Cc: Junio Hamano, git
In-Reply-To: <20071029053153.fe400886.chriscool@tuxfamily.org>
On 10/29/07, Christian Couder <chriscool@tuxfamily.org> wrote:
>
> -USAGE='[start|bad|good|next|reset|visualize|replay|log|run]'
> +USAGE='[start|bad|good|next|reset|visualize|replay|log|skip|run]'
> LONG_USAGE='git bisect start [<bad> [<good>...]] [--] [<pathspec>...]
> reset bisect state and start bisection.
"skip" should be closer to the "bad" and "good" options, since it's
most similar to them in that list.
Dave.
^ permalink raw reply
* [PATCH] Bisect: add "skip" to the short usage string.
From: Christian Couder @ 2007-10-29 4:31 UTC (permalink / raw)
To: Junio Hamano; +Cc: git
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
git-bisect.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/git-bisect.sh b/git-bisect.sh
index 180c6c2..f2bae53 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-USAGE='[start|bad|good|next|reset|visualize|replay|log|run]'
+USAGE='[start|bad|good|next|reset|visualize|replay|log|skip|run]'
LONG_USAGE='git bisect start [<bad> [<good>...]] [--] [<pathspec>...]
reset bisect state and start bisection.
git bisect bad [<rev>]
--
1.5.3.4.1406.g1369
^ permalink raw reply related
* [PATCH 6/7] include $PATH in generating list of commands for "help -a"
From: Scott R Parish @ 2007-10-29 3:30 UTC (permalink / raw)
To: git; +Cc: Scott R Parish
In-Reply-To: <1193474215-6728-6-git-send-email-srp@srparish.net>
Git had previously been using the $PATH for scripts--a previous
patch moved exec'ed commands to also use the $PATH. For consistency
"help -a" should also list commands in the $PATH.
The main commands are still listed from the git_exec_path(), but
the $PATH is walked and other git commands (probably extensions) are
listed.
Signed-off-by: Scott R Parish <srp@srparish.net>
---
help.c | 157 +++++++++++++++++++++++++++++++++++++++++++++++++---------------
1 files changed, 120 insertions(+), 37 deletions(-)
diff --git a/help.c b/help.c
index 34ac5db..855aeef 100644
--- a/help.c
+++ b/help.c
@@ -37,24 +37,25 @@ static inline void mput_char(char c, unsigned int num)
putchar(c);
}
-static struct cmdname {
- size_t len;
- char name[1];
-} **cmdname;
-static int cmdname_alloc, cmdname_cnt;
-
-static void add_cmdname(const char *name, int len)
+static struct cmdnames {
+ int alloc;
+ int cnt;
+ struct cmdname {
+ size_t len;
+ char name[1];
+ } **names;
+} main_cmds, other_cmds;
+
+static void add_cmdname(struct cmdnames *cmds, const char *name, int len)
{
- struct cmdname *ent;
- if (cmdname_alloc <= cmdname_cnt) {
- cmdname_alloc = cmdname_alloc + 200;
- cmdname = xrealloc(cmdname, cmdname_alloc * sizeof(*cmdname));
- }
- ent = xmalloc(sizeof(*ent) + len);
+ struct cmdname *ent = xmalloc(sizeof(*ent) + len);
+
ent->len = len;
memcpy(ent->name, name, len);
ent->name[len] = 0;
- cmdname[cmdname_cnt++] = ent;
+
+ ALLOC_GROW(cmds->names, cmds->cnt + 1, cmds->alloc);
+ cmds->names[cmds->cnt++] = ent;
}
static int cmdname_compare(const void *a_, const void *b_)
@@ -64,7 +65,42 @@ static int cmdname_compare(const void *a_, const void *b_)
return strcmp(a->name, b->name);
}
-static void pretty_print_string_list(struct cmdname **cmdname, int longest)
+static void uniq(struct cmdnames *cmds)
+{
+ int i, j;
+
+ if (!cmds->cnt)
+ return;
+
+ for (i = j = 1; i < cmds->cnt; i++)
+ if (strcmp(cmds->names[i]->name, cmds->names[i-1]->name))
+ cmds->names[j++] = cmds->names[i];
+
+ cmds->cnt = j;
+}
+
+static void exclude_cmds(struct cmdnames *cmds, struct cmdnames *excludes) {
+ int ci, cj, ei;
+ int cmp;
+
+ ci = cj = ei = 0;
+ while (ci < cmds->cnt && ei < excludes->cnt) {
+ cmp = strcmp(cmds->names[ci]->name, excludes->names[ei]->name);
+ if (cmp < 0)
+ cmds->names[cj++] = cmds->names[ci++];
+ else if (cmp == 0)
+ ci++, ei++;
+ else if (cmp > 0)
+ ei++;
+ }
+
+ while (ci < cmds->cnt)
+ cmds->names[cj++] = cmds->names[ci++];
+
+ cmds->cnt = cj;
+}
+
+static void pretty_print_string_list(struct cmdnames *cmds, int longest)
{
int cols = 1, rows;
int space = longest + 1; /* min 1 SP between words */
@@ -73,9 +109,7 @@ static void pretty_print_string_list(struct cmdname **cmdname, int longest)
if (space < max_cols)
cols = max_cols / space;
- rows = (cmdname_cnt + cols - 1) / cols;
-
- qsort(cmdname, cmdname_cnt, sizeof(*cmdname), cmdname_compare);
+ rows = (cmds->cnt + cols - 1) / cols;
for (i = 0; i < rows; i++) {
printf(" ");
@@ -83,28 +117,27 @@ static void pretty_print_string_list(struct cmdname **cmdname, int longest)
for (j = 0; j < cols; j++) {
int n = j * rows + i;
int size = space;
- if (n >= cmdname_cnt)
+ if (n >= cmds->cnt)
break;
- if (j == cols-1 || n + rows >= cmdname_cnt)
+ if (j == cols-1 || n + rows >= cmds->cnt)
size = 1;
- printf("%-*s", size, cmdname[n]->name);
+ printf("%-*s", size, cmds->names[n]->name);
}
putchar('\n');
}
}
-static void list_commands(const char *exec_path)
+static unsigned int list_commands_in_dir(struct cmdnames *cmds,
+ const char *path)
{
unsigned int longest = 0;
const char *prefix = "git-";
int prefix_len = strlen(prefix);
- DIR *dir = opendir(exec_path);
+ DIR *dir = opendir(path);
struct dirent *de;
- if (!dir || chdir(exec_path)) {
- fprintf(stderr, "git: '%s': %s\n", exec_path, strerror(errno));
- exit(1);
- }
+ if (!dir || chdir(path))
+ return 0;
while ((de = readdir(dir)) != NULL) {
struct stat st;
@@ -125,16 +158,68 @@ static void list_commands(const char *exec_path)
if (longest < entlen)
longest = entlen;
- add_cmdname(de->d_name + prefix_len, entlen);
+ add_cmdname(cmds, de->d_name + prefix_len, entlen);
}
closedir(dir);
- printf("git commands available in '%s'\n", exec_path);
- printf("----------------------------");
- mput_char('-', strlen(exec_path));
- putchar('\n');
- pretty_print_string_list(cmdname, longest);
- putchar('\n');
+ return longest;
+}
+
+static void list_commands(void)
+{
+ unsigned int longest = 0;
+ unsigned int len;
+ const char *env_path = getenv("PATH");
+ char *paths, *path, *colon;
+ const char *exec_path = git_exec_path();
+
+ if (exec_path)
+ longest = list_commands_in_dir(&main_cmds, exec_path);
+
+ if (!env_path) {
+ fprintf(stderr, "PATH not set\n");
+ exit(1);
+ }
+
+ path = paths = xstrdup(env_path);
+ while (1) {
+ if ((colon = strchr(path, ':')))
+ *colon = 0;
+
+ len = list_commands_in_dir(&other_cmds, path);
+ if (len > longest)
+ longest = len;
+
+ if (!colon)
+ break;
+ path = colon + 1;
+ }
+ free(paths);
+
+ qsort(main_cmds.names, main_cmds.cnt,
+ sizeof(*main_cmds.names), cmdname_compare);
+ uniq(&main_cmds);
+
+ qsort(other_cmds.names, other_cmds.cnt,
+ sizeof(*other_cmds.names), cmdname_compare);
+ uniq(&other_cmds);
+ exclude_cmds(&other_cmds, &main_cmds);
+
+ if (main_cmds.cnt) {
+ printf("available git commands in '%s'\n", exec_path);
+ printf("----------------------------");
+ mput_char('-', strlen(exec_path));
+ putchar('\n');
+ pretty_print_string_list(&main_cmds, longest);
+ putchar('\n');
+ }
+
+ if (other_cmds.cnt) {
+ printf("git commands available from elsewhere on your $PATH\n");
+ printf("---------------------------------------------------\n");
+ pretty_print_string_list(&other_cmds, longest);
+ putchar('\n');
+ }
}
void list_common_cmds_help(void)
@@ -188,7 +273,6 @@ int cmd_version(int argc, const char **argv, const char *prefix)
int cmd_help(int argc, const char **argv, const char *prefix)
{
const char *help_cmd = argc > 1 ? argv[1] : NULL;
- const char *exec_path = git_exec_path();
if (!help_cmd) {
printf("usage: %s\n\n", git_usage_string);
@@ -198,8 +282,7 @@ int cmd_help(int argc, const char **argv, const char *prefix)
else if (!strcmp(help_cmd, "--all") || !strcmp(help_cmd, "-a")) {
printf("usage: %s\n\n", git_usage_string);
- if(exec_path)
- list_commands(exec_path);
+ list_commands();
exit(0);
}
--
1.5.3.4.401.g19778-dirty
^ permalink raw reply related
* Re: [PATCH] Fix regression in fast-import.c due to strbufs.
From: Shun Kei Leung @ 2007-10-29 2:59 UTC (permalink / raw)
To: Pierre Habouzit
Cc: Junio C Hamano, Johannes Schindelin, Shawn O. Pearce, Git ML
In-Reply-To: <20071026172523.GB5496@artemis.corp>
Hi Pierre,
Thanks. You are the man! It works perfectly now.
Regards,
Kevin
^ permalink raw reply
* Re: [PATCH 6/7] include $PATH in generating list of commands for "help -a"
From: Scott Parish @ 2007-10-29 2:44 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git
In-Reply-To: <Pine.LNX.4.64.0710281642220.4362@racer.site>
On Sun, Oct 28, 2007 at 04:51:00PM +0000, Johannes Schindelin wrote:
> > +static void subtract_cmds(struct cmdnames *a, struct cmdnames *b) {
>
> Maybe "exclude_cmds()", and choose more suggestive names for the
> parameters?
I was thinking set operations when i named this (hense "a" and "b"),
but i'll try this out.
sRp
--
Scott Parish
http://srparish.net/
^ permalink raw reply
* Re: [RFH] gcc constant expression warning...
From: Stephen Rothwell @ 2007-10-29 2:41 UTC (permalink / raw)
To: Nicolas Pitre; +Cc: Linus Torvalds, Antti-Juhani Kaijanaho, git
In-Reply-To: <alpine.LFD.0.9999.0710282053590.22100@xanadu.home>
[-- Attachment #1: Type: text/plain, Size: 361 bytes --]
On Sun, 28 Oct 2007 20:55:32 -0400 (EDT) Nicolas Pitre <nico@cam.org> wrote:
>
> The test must also make sure off_t isn't signed, since in that case it
> can only hold 31 bits.
Posix says:
"blkcnt_t and off_t shall be signed integer types."
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* Re: [RFH] gcc constant expression warning...
From: Nicolas Pitre @ 2007-10-29 0:55 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Antti-Juhani Kaijanaho, git
In-Reply-To: <alpine.LFD.0.999.0710281000260.30120@woody.linux-foundation.org>
On Sun, 28 Oct 2007, Linus Torvalds wrote:
>
>
> On Sun, 28 Oct 2007, Antti-Juhani Kaijanaho wrote:
> >
> > A correct fix would be to check for the size of off_t in some other (and
> > defined) manner, but I don't know off_t well enough to suggest one.
>
> In this case, it's trying to make sense that "off_t" can hold more than 32
> bits. So I think that test can just be rewritten as
>
> if (sizeof(off_t) <= 4) {
> munmap(idx_map, idx_size);
> return error("pack too large for current definition of off_t in %s", path);
> }
>
> instead.
The test must also make sure off_t isn't signed, since in that case it
can only hold 31 bits.
Nicolas
^ permalink raw reply
* Re: New features in gitk
From: Paul Mackerras @ 2007-10-28 23:13 UTC (permalink / raw)
To: Pierre Habouzit; +Cc: git
In-Reply-To: <20071028183216.GA4310@artemis.corp>
Pierre Habouzit writes:
> As you seem to be the guy to ask for, I've a couple of requests wrt
> gitk.
>
> * the diff window is quite bad with merge commits, the colorization is
> rather poor, and the last version you just merged isn't especially
> better.
That's not a request, that's a grizzle. :) What would you like it to
look like?
> * the 'sha1' input field is a major pain in the UI: the cut&paste
> interaction is very poor. I don't know why, but it's often very very
> hard to really copy the sha id, probably because it's selected by
> default.
It's selected so that the contents are in the cut buffer and you can
paste them in an xterm with middle-button. Possibly I need to check
that control-C (or command-C under macos) is properly bound to copy.
> * the fact that it remembers the position where it was in the WM when
> it was closed is really annoying. the WM is supposed to place the
> window. With at least ion3 and xinerama it often shows up on the
> wrong screen. Remembering the window size though is fine.
That came in with some changes that make gitk start up correctly under
windows. I could see about making it set the window position only
under windows.
> * still wrt the layout, the focus is quite cumbersome. Gitk would be
> really really really nice to be used only from the keyboard, but
> because of a very unclear focus policy, it really isn't for me.
> Maybe it's just me, and I know this may not be 100% helpful, but I
> never know which part of gitk will receive my keys (history part,
> diff part, tree, ...).
What focus policy would you like?
Paul.
^ permalink raw reply
* Re: [PATCH 5/8] push, send-pack: support pushing HEAD to real ref name
From: Junio C Hamano @ 2007-10-28 20:58 UTC (permalink / raw)
To: Steffen Prohaska; +Cc: git
In-Reply-To: <55CCFD12-C10F-46A6-8D65-544231DEBF3F@zib.de>
Steffen Prohaska <prohaska@zib.de> writes:
> On Oct 28, 2007, at 5:03 PM, Junio C Hamano wrote:
> ...
>> An alternative, just to let me keep my nicer public image by
>> pretending to be constructive ;-)
>>
>> Introduce a configuration "remote.$name.push_default" whose
>> value can be a list of refs. Teach the push command without
>> refspecs:
>>
>> $ git push
>> $ git push $remote
>>
>> to pretend as if the listed refspecs are given, instead of the
>> traditional "matching branches" behaviour.
>>
>> Then, introduce another option
>>
>> $ git push --matching
>> $ git push --matching $remote
>>
>> to override that configuration, if set, so that the user who
>> usually pushes only the selected branches can use the "matching
>> branches" behaviour when needed.
>>
>> Along with your earlier "git push $remote HEAD" patch, this will
>> allow you to say:
>>
>> [remote "origin"]
>> push_default = HEAD
>>
>> and your
>>
>> $ git push
>>
>> will push only the current branch.
>
> Sounds reasonable; but it is more work. I'm not starting to
> implement this today.
Take your time; nobody is in a hurry.
If somebody usually uses "matching" behaviour, i.e. without
remote.$name.push_default configuration, but wants to push only
the current branch as a one-shot operation, we can obviously use
"git push $remote HEAD". But to be complete, it may make sense
to have another option
$ git push --current
that lets you omit $remote (and default to the value configured
with branch.$name.remote).
^ permalink raw reply
* Re: New features in gitk
From: Mike Hommey @ 2007-10-28 18:38 UTC (permalink / raw)
To: Pierre Habouzit, Paul Mackerras, git
In-Reply-To: <20071028183216.GA4310@artemis.corp>
On Sun, Oct 28, 2007 at 07:32:16PM +0100, Pierre Habouzit wrote:
> On dim, oct 28, 2007 at 01:39:34 +0000, Paul Mackerras wrote:
> > I just pulled the dev branch of gitk into the master branch, so the
> > master branch now has the new features and improvements that I have
> > been working on, namely: [...]
>
> As you seem to be the guy to ask for, I've a couple of requests wrt
> gitk.
(...)
* When running gitk --all, it would be nice if the current branch
was selected, instead of the topmost commit.
Mike
^ permalink raw reply
* Re: New features in gitk
From: Pierre Habouzit @ 2007-10-28 18:32 UTC (permalink / raw)
To: Paul Mackerras; +Cc: git
In-Reply-To: <18211.59478.188419.397886@cargo.ozlabs.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 2629 bytes --]
On dim, oct 28, 2007 at 01:39:34 +0000, Paul Mackerras wrote:
> I just pulled the dev branch of gitk into the master branch, so the
> master branch now has the new features and improvements that I have
> been working on, namely: [...]
As you seem to be the guy to ask for, I've a couple of requests wrt
gitk.
* the diff window is quite bad with merge commits, the colorization is
rather poor, and the last version you just merged isn't especially
better.
* the 'sha1' input field is a major pain in the UI: the cut&paste
interaction is very poor. I don't know why, but it's often very very
hard to really copy the sha id, probably because it's selected by
default.
* hjkl in the history list do very very very curious things, whereas I
would expect j/k to do the same as (resp) down/up. Note that in
[Help->Key bindings] it's said it should work that way, but it
doesn't here at least. A way to customize bindings would be much
appreciated (I like vi bindings, and I miss ^U/^D, and ^E/^Y e.g.).
* I really really really miss an option to ignore whitespaces in
diffs, a small checkbox to view the full blown diff, or the one
without spaces changes (-w -b) would be _really_ great.
* the fact that it remembers the position where it was in the WM when
it was closed is really annoying. the WM is supposed to place the
window. With at least ion3 and xinerama it often shows up on the
wrong screen. Remembering the window size though is fine.
* wrt the layout, when the gitk window is resized, the resizing of the
three columns (subjects, commiter, date) is really cumbersome. I
would expect that the subject one would be the sole one to be
resized.
* still wrt the layout, the focus is quite cumbersome. Gitk would be
really really really nice to be used only from the keyboard, but
because of a very unclear focus policy, it really isn't for me.
Maybe it's just me, and I know this may not be 100% helpful, but I
never know which part of gitk will receive my keys (history part,
diff part, tree, ...).
* in the diff [lines of context] input, if you hit "down" it
decrements the number of lines which is okay, but _also_ moves the
selected history line which is not.
This list may sound harsh, I hope not, I love gitk, it's one of the
10 git commands I use the most.
Cheers,
--
·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: How to merge git://repo.or.cz/git-gui into git.git
From: Miklos Vajna @ 2007-10-28 18:13 UTC (permalink / raw)
To: Yin Ping; +Cc: Peter Baumann, git
In-Reply-To: <46dff0320710280544r7f99ddf7xfd5aa7cefb39a9fe@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 335 bytes --]
On Sun, Oct 28, 2007 at 08:44:44PM +0800, Yin Ping <pkufranky@gmail.com> wrote:
> 3x. I have seen that subtree stategy is introduced in commit 68fa.
> However, I don't find any description in manual of git-merge. Should
> this be added to this manual or any other document?
i think the git-merge manpage should mention it.
- VMiklos
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* [PATCH] honor the http.sslVerify option in shell scripts
From: Aurelien Bompard @ 2007-10-28 17:47 UTC (permalink / raw)
To: git, gitster
Signed-off-by: Aurélien Bompard <aurelien@bompard.org>
---
git-clone.sh | 3 ++-
git-ls-remote.sh | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/git-clone.sh b/git-clone.sh
index 5e582fe..3bb683d 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -28,7 +28,8 @@ get_repo_base() {
) 2>/dev/null
}
-if [ -n "$GIT_SSL_NO_VERIFY" ]; then
+if [ -n "$GIT_SSL_NO_VERIFY" -o \
+ "`git config --bool http.sslVerify`" = false ]; then
curl_extra_args="-k"
fi
diff --git a/git-ls-remote.sh b/git-ls-remote.sh
index d56cf92..3eb18d1 100755
--- a/git-ls-remote.sh
+++ b/git-ls-remote.sh
@@ -54,7 +54,8 @@ tmpdir=$tmp-d
case "$peek_repo" in
http://* | https://* | ftp://* )
- if [ -n "$GIT_SSL_NO_VERIFY" ]; then
+ if [ -n "$GIT_SSL_NO_VERIFY" -o \
+ "`git config --bool http.sslVerify`" = false ]; then
curl_extra_args="-k"
fi
if [ -n "$GIT_CURL_FTP_NO_EPSV" -o \
--
1.5.3.3
^ permalink raw reply related
* [PATCH 04/10] push: add "git push HEAD" shorthand for 'push current branch to default repo'
From: Steffen Prohaska @ 2007-10-28 17:46 UTC (permalink / raw)
To: git; +Cc: Steffen Prohaska
In-Reply-To: <1193593581486-git-send-email-prohaska@zib.de>
Sometimes it is handy to push only the current branch to the
default remote repository. For example, if you created a branch
using the '--track' option git knows that the current branch
is linked to a specific remote. But up to now you needed to say
"git push <defaultremote> <thisbranch>", which was quite
annoying. You could have said "git push" but then _all_ branches
would have been pushed to the default remote.
This commit introduces "git push HEAD", which resolves HEAD to
the current branch and pushes only the current branch to its
default remote.
Setups that have a remote named HEAD will break. But such a setup
if unlikely to exist; and is not very sensible anyway.
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
---
Documentation/git-push.txt | 6 +++++-
builtin-push.c | 2 ++
t/t5516-fetch-push.sh | 12 ++++++++++++
3 files changed, 19 insertions(+), 1 deletions(-)
diff --git a/Documentation/git-push.txt b/Documentation/git-push.txt
index 67b354b..236898f 100644
--- a/Documentation/git-push.txt
+++ b/Documentation/git-push.txt
@@ -10,7 +10,7 @@ SYNOPSIS
--------
[verse]
'git-push' [--all] [--dry-run] [--create] [--tags] [--receive-pack=<git-receive-pack>]
- [--repo=all] [-f | --force] [-v] [<repository> <refspec>...]
+ [--repo=all] [-f | --force] [-v] [HEAD | <repository> <refspec>...]
DESCRIPTION
-----------
@@ -25,6 +25,10 @@ documentation for gitlink:git-receive-pack[1].
OPTIONS
-------
+HEAD::
+ Tells push to push the current branch to the default
+ remote repository.
+
<repository>::
The "remote" repository that is destination of a push
operation. See the section <<URLS,GIT URLS>> below.
diff --git a/builtin-push.c b/builtin-push.c
index 2e3c8c6..7c08e19 100644
--- a/builtin-push.c
+++ b/builtin-push.c
@@ -102,6 +102,8 @@ int cmd_push(int argc, const char **argv, const char *prefix)
const char *arg = argv[i];
if (arg[0] != '-') {
+ if (!strcmp("HEAD", arg))
+ break;
repo = arg;
i++;
break;
diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index 8becaf8..2650e36 100755
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
@@ -291,6 +291,18 @@ test_expect_success 'push with HEAD' '
'
+test_expect_success 'push HEAD' '
+
+ mk_test heads/track &&
+ git remote add test testrepo &&
+ git fetch test &&
+ git checkout -b track test/track &&
+ git reset --hard master &&
+ git push HEAD &&
+ check_push_result $the_commit heads/track
+
+'
+
test_expect_success 'push with HEAD (--create)' '
mk_test &&
--
1.5.3.4.439.ge8b49
^ permalink raw reply related
* [PATCH 09/10] push: teach push to pass --verbose option to transport layer
From: Steffen Prohaska @ 2007-10-28 17:46 UTC (permalink / raw)
To: git; +Cc: Steffen Prohaska
In-Reply-To: <11935935821800-git-send-email-prohaska@zib.de>
A --verbose option to push should also be passed to the
transport layer, i.e. git-send-pack, git-http-push.
git push is modified to do so.
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
---
builtin-push.c | 2 ++
transport.c | 8 ++++++--
transport.h | 1 +
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/builtin-push.c b/builtin-push.c
index 9103d57..27eaca5 100644
--- a/builtin-push.c
+++ b/builtin-push.c
@@ -110,10 +110,12 @@ int cmd_push(int argc, const char **argv, const char *prefix)
}
if (!strcmp(arg, "-v")) {
verbose=1;
+ flags |= TRANSPORT_PUSH_VERBOSE;
continue;
}
if (!strcmp(arg, "--verbose")) {
verbose=1;
+ flags |= TRANSPORT_PUSH_VERBOSE;
continue;
}
if (!prefixcmp(arg, "--repo=")) {
diff --git a/transport.c b/transport.c
index fbdbd0d..e6bca93 100644
--- a/transport.c
+++ b/transport.c
@@ -385,7 +385,7 @@ static int curl_transport_push(struct transport *transport, int refspec_nr, cons
int argc;
int err;
- argv = xmalloc((refspec_nr + 12) * sizeof(char *));
+ argv = xmalloc((refspec_nr + 13) * sizeof(char *));
argv[0] = "http-push";
argc = 1;
if (flags & TRANSPORT_PUSH_ALL)
@@ -396,6 +396,8 @@ static int curl_transport_push(struct transport *transport, int refspec_nr, cons
argv[argc++] = "--dry-run";
if (flags & TRANSPORT_PUSH_CREATE)
argv[argc++] = "--create";
+ if (flags & TRANSPORT_PUSH_VERBOSE)
+ argv[argc++] = "--verbose";
argv[argc++] = transport->url;
while (refspec_nr--)
argv[argc++] = *refspec++;
@@ -660,7 +662,7 @@ static int git_transport_push(struct transport *transport, int refspec_nr, const
int argc;
int err;
- argv = xmalloc((refspec_nr + 12) * sizeof(char *));
+ argv = xmalloc((refspec_nr + 13) * sizeof(char *));
argv[0] = "send-pack";
argc = 1;
if (flags & TRANSPORT_PUSH_ALL)
@@ -671,6 +673,8 @@ static int git_transport_push(struct transport *transport, int refspec_nr, const
argv[argc++] = "--dry-run";
if (flags & TRANSPORT_PUSH_CREATE)
argv[argc++] = "--create";
+ if (flags & TRANSPORT_PUSH_VERBOSE)
+ argv[argc++] = "--verbose";
if (data->receivepack) {
char *rp = xmalloc(strlen(data->receivepack) + 16);
sprintf(rp, "--receive-pack=%s", data->receivepack);
diff --git a/transport.h b/transport.h
index 1d6a926..a387eed 100644
--- a/transport.h
+++ b/transport.h
@@ -31,6 +31,7 @@ struct transport {
#define TRANSPORT_PUSH_FORCE 2
#define TRANSPORT_PUSH_DRY_RUN 4
#define TRANSPORT_PUSH_CREATE 8
+#define TRANSPORT_PUSH_VERBOSE 16
/* Returns a transport suitable for the url */
struct transport *transport_get(struct remote *, const char *);
--
1.5.3.4.439.ge8b49
^ permalink raw reply related
* [PATCH 08/10] push: teach push to accept --verbose option
From: Steffen Prohaska @ 2007-10-28 17:46 UTC (permalink / raw)
To: git; +Cc: Steffen Prohaska
In-Reply-To: <11935935823045-git-send-email-prohaska@zib.de>
Before this commit, git push only knew '-v'.
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
---
Documentation/git-push.txt | 4 ++--
builtin-push.c | 4 ++++
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/Documentation/git-push.txt b/Documentation/git-push.txt
index 236898f..865f183 100644
--- a/Documentation/git-push.txt
+++ b/Documentation/git-push.txt
@@ -10,7 +10,7 @@ SYNOPSIS
--------
[verse]
'git-push' [--all] [--dry-run] [--create] [--tags] [--receive-pack=<git-receive-pack>]
- [--repo=all] [-f | --force] [-v] [HEAD | <repository> <refspec>...]
+ [--repo=all] [-f | --force] [-v | --verbose] [HEAD | <repository> <refspec>...]
DESCRIPTION
-----------
@@ -105,7 +105,7 @@ the remote repository.
transfer spends extra cycles to minimize the number of
objects to be sent and meant to be used on slower connection.
--v::
+-v, \--verbose::
Run verbosely.
include::urls-remotes.txt[]
diff --git a/builtin-push.c b/builtin-push.c
index 7c08e19..9103d57 100644
--- a/builtin-push.c
+++ b/builtin-push.c
@@ -112,6 +112,10 @@ int cmd_push(int argc, const char **argv, const char *prefix)
verbose=1;
continue;
}
+ if (!strcmp(arg, "--verbose")) {
+ verbose=1;
+ continue;
+ }
if (!prefixcmp(arg, "--repo=")) {
repo = arg+7;
continue;
--
1.5.3.4.439.ge8b49
^ permalink raw reply related
* [PATCH 06/10] add ref_abbrev_matches_full_with_rev_parse_rules() comparing abbrev with full ref name
From: Steffen Prohaska @ 2007-10-28 17:46 UTC (permalink / raw)
To: git; +Cc: Steffen Prohaska
In-Reply-To: <11935935822846-git-send-email-prohaska@zib.de>
ref_abbrev_matches_full_with_rev_parse_rules(abbrev_name, full_name)
expands abbrev_name according to the rules documented in
git-rev-parse and compares the expanded name with full_name. It
reports a match by returning 0.
This function makes the rules for resolving refs to sha1s available
for string comparison. Before this change, the rules were buried in
get_sha1*() and dwim_ref().
The function name is very long to make the rule set used
explicit. We have a different set of rules for matching refspecs.
It would be a good thing to unify all different rule sets. But
this commit doesn't address this challenge. It only makes the
git-rev-parse rules available for string comparison.
ref_abbrev_matches_full_with_rev_parse_rules() will be used for
matching refspecs in git-send-pack.
Thanks to Daniel Barkalow <barkalow@iabervon.org> for pointing
out that ref_matches_abbrev in remote.c solves a similar problem
and care should be take to avoid confusion.
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
---
cache.h | 1 +
sha1_name.c | 14 ++++++++++++++
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/cache.h b/cache.h
index 27485d3..bb10ade 100644
--- a/cache.h
+++ b/cache.h
@@ -405,6 +405,7 @@ extern int get_sha1_hex(const char *hex, unsigned char *sha1);
extern char *sha1_to_hex(const unsigned char *sha1); /* static buffer result! */
extern int read_ref(const char *filename, unsigned char *sha1);
extern const char *resolve_ref(const char *path, unsigned char *sha1, int, int *);
+extern int ref_abbrev_matches_full_with_rev_parse_rules(const char *abbrev_name, const char *full_name);
extern int dwim_ref(const char *str, int len, unsigned char *sha1, char **ref);
extern int dwim_log(const char *str, int len, unsigned char *sha1, char **ref);
diff --git a/sha1_name.c b/sha1_name.c
index 2d727d5..944e318 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -249,6 +249,20 @@ static const char *ref_fmt[] = {
NULL
};
+int ref_abbrev_matches_full_with_rev_parse_rules(const char *abbrev_name, const char *full_name)
+{
+ const char **p;
+ const int abbrev_name_len = strlen(abbrev_name);
+
+ for (p = ref_fmt; *p; p++) {
+ if (!strcmp(full_name, mkpath(*p, abbrev_name_len, abbrev_name))) {
+ return 0;
+ }
+ }
+
+ return -1;
+}
+
int dwim_ref(const char *str, int len, unsigned char *sha1, char **ref)
{
const char **p, *r;
--
1.5.3.4.439.ge8b49
^ permalink raw reply related
* [PATCH 07/10] push: use same rules as git-rev-parse to resolve refspecs
From: Steffen Prohaska @ 2007-10-28 17:46 UTC (permalink / raw)
To: git; +Cc: Steffen Prohaska
In-Reply-To: <11935935821136-git-send-email-prohaska@zib.de>
This commit changes the rules for resolving refspecs to match the
rules for resolving refs in rev-parse. git-rev-parse uses clear rules
to resolve a short ref to its full name, which are well documented.
The rules for resolving refspecs documented in git-send-pack were
less strict and harder to understand. This commit replaces them by
the rules of git-rev-parse.
The unified rules are easier to understand and better resolve ambiguous
cases. You can now push from a repository containing several branches
ending on the same short name.
Note, this may break existing setups. For example "master" will no longer
resolve to "origin/master".
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
---
Documentation/git-send-pack.txt | 4 +++-
remote.c | 5 +----
t/t5516-fetch-push.sh | 12 +++++++++++-
3 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/Documentation/git-send-pack.txt b/Documentation/git-send-pack.txt
index 01495df..08bcc25 100644
--- a/Documentation/git-send-pack.txt
+++ b/Documentation/git-send-pack.txt
@@ -91,7 +91,9 @@ Each pattern pair consists of the source side (before the colon)
and the destination side (after the colon). The ref to be
pushed is determined by finding a match that matches the source
side, and where it is pushed is determined by using the
-destination side.
+destination side. The rules used to match a ref are the same
+rules used by gitlink:git-rev-parse[1] to resolve a symbolic ref
+name.
- It is an error if <src> does not match exactly one of the
local refs.
diff --git a/remote.c b/remote.c
index 59e6485..9c33fcf 100644
--- a/remote.c
+++ b/remote.c
@@ -519,10 +519,7 @@ static int count_refspec_match(const char *pattern,
char *name = refs->name;
int namelen = strlen(name);
- if (namelen < patlen ||
- memcmp(name + namelen - patlen, pattern, patlen))
- continue;
- if (namelen != patlen && name[namelen - patlen - 1] != '/')
+ if (ref_abbrev_matches_full_with_rev_parse_rules(pattern, name))
continue;
/* A match is "weak" if it is with refs outside
diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index 2650e36..6708ec1 100755
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
@@ -183,11 +183,21 @@ test_expect_success 'push with no ambiguity (1)' '
test_expect_success 'push with no ambiguity (2)' '
mk_test remotes/origin/master &&
- git push testrepo master:master &&
+ git push testrepo master:origin/master &&
check_push_result $the_commit remotes/origin/master
'
+test_expect_success 'push with colon-less refspec, no ambiguity' '
+
+ mk_test heads/master heads/t/master &&
+ git branch -f t/master master &&
+ git push testrepo master &&
+ check_push_result $the_commit heads/master &&
+ check_push_result $the_first_commit heads/t/master
+
+'
+
test_expect_success 'push with weak ambiguity (1)' '
mk_test heads/master remotes/origin/master &&
--
1.5.3.4.439.ge8b49
^ permalink raw reply related
* [PATCH 01/10] push: change push to fail if short refname does not exist
From: Steffen Prohaska @ 2007-10-28 17:46 UTC (permalink / raw)
To: git; +Cc: Steffen Prohaska
In-Reply-To: <1193593581312-git-send-email-prohaska@zib.de>
Pushing a short refname used to create a new ref on on the
remote side if it did not yet exist. If you specified the wrong
branch accidentally it was created. A safety valve that pushes
only existing branches may help to avoid errors.
This commit changes push to fail if the remote ref does not yet
exist and the refspec does not start with refs/. Remote refs must
explicitly be created with their full name. If you specify a
branch name that does not yet exist on the remote side, git push
will print a suggestion to push the full refname instead.
The new behaviour is more defensive than the old one. You can
now explicitly distinguish between "push existing branch" and
"create new branch on the remote side". The old implementation
allowed the same command line in both cases.
A follow-up patch will add a flag '--create' that provides an
alternative to using full refnames if creation of new refs is
intended.
Another follow-up patch will support "push origin HEAD". In this
case, the existence check is important. If you're on the wrong
branch and push HEAD you may be surprised if a new branch is
created. This can be avoided by requiring either a full ref or
the '--create' flag.
The implementation in this patch is less "clever" and hopefully
better readable than an ealier version of the patch. Thanks for
the suggestions to Daniel Barkalow <barkalow@iabervon.org>.
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
---
remote.c | 25 ++++++++++++++++---------
t/t5516-fetch-push.sh | 34 ++++++++++++++++++++++++++++++++--
2 files changed, 48 insertions(+), 11 deletions(-)
diff --git a/remote.c b/remote.c
index 170015a..cf6441a 100644
--- a/remote.c
+++ b/remote.c
@@ -610,7 +610,8 @@ static int match_explicit(struct ref *src, struct ref *dst,
{
struct ref *matched_src, *matched_dst;
- const char *dst_value = rs->dst;
+ const char *lit_dst_value;
+ const char *search_dst_value;
if (rs->pattern)
return errs;
@@ -637,27 +638,33 @@ static int match_explicit(struct ref *src, struct ref *dst,
if (!matched_src)
errs = 1;
- if (!dst_value) {
+ if (rs->dst) {
+ lit_dst_value = search_dst_value = rs->dst;
+ } else {
if (!matched_src)
return errs;
- dst_value = matched_src->name;
+ lit_dst_value = rs->src;
+ search_dst_value = matched_src->name;
}
- switch (count_refspec_match(dst_value, dst, &matched_dst)) {
+ switch (count_refspec_match(search_dst_value, dst, &matched_dst)) {
case 1:
break;
case 0:
- if (!memcmp(dst_value, "refs/", 5))
- matched_dst = make_linked_ref(dst_value, dst_tail);
- else
+ if (!memcmp(lit_dst_value , "refs/", 5))
+ matched_dst = make_linked_ref(lit_dst_value, dst_tail);
+ else {
error("dst refspec %s does not match any "
"existing ref on the remote and does "
- "not start with refs/.", dst_value);
+ "not start with refs/.", lit_dst_value);
+ if (!rs->dst)
+ error("Did you mean %s?\n", search_dst_value);
+ }
break;
default:
matched_dst = NULL;
error("dst refspec %s matches more than one.",
- dst_value);
+ lit_dst_value);
break;
}
if (errs || !matched_dst)
diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index 4fbd5b1..5ba09e2 100755
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
@@ -126,6 +126,36 @@ test_expect_success 'push with wildcard' '
)
'
+test_expect_success 'push nonexisting (1)' '
+
+ mk_test &&
+ if git push testrepo master
+ then
+ echo "Oops, should have failed"
+ false
+ fi
+
+'
+
+test_expect_success 'push nonexisting (2)' '
+
+ mk_test &&
+ if git push testrepo heads/master
+ then
+ echo "Oops, should have failed"
+ false
+ fi
+
+'
+
+test_expect_success 'push nonexisting (3)' '
+
+ mk_test &&
+ git push testrepo refs/heads/master &&
+ check_push_result $the_commit heads/master
+
+'
+
test_expect_success 'push with matching heads' '
mk_test heads/master &&
@@ -225,7 +255,7 @@ test_expect_success 'push with colon-less refspec (3)' '
git tag -d frotz
fi &&
git branch -f frotz master &&
- git push testrepo frotz &&
+ git push testrepo refs/heads/frotz &&
check_push_result $the_commit heads/frotz &&
test 1 = $( cd testrepo && git show-ref | wc -l )
'
@@ -238,7 +268,7 @@ test_expect_success 'push with colon-less refspec (4)' '
git branch -D frotz
fi &&
git tag -f frotz &&
- git push testrepo frotz &&
+ git push testrepo refs/tags/frotz &&
check_push_result $the_commit tags/frotz &&
test 1 = $( cd testrepo && git show-ref | wc -l )
--
1.5.3.4.439.ge8b49
^ permalink raw reply related
* [PATCH 0/10 v3] improve refspec handling in push
From: Steffen Prohaska @ 2007-10-28 17:46 UTC (permalink / raw)
To: git
This is a replacement for sp/push-refspec
(93e296613306311ef02dabb19a6538be2f52aa1c).
Compared to the v2 series the following changed (v2 patch numbers):
1/8 implementation should be better readable.
2/8 adjusted to 1/8 changes.
3/8 removed.
4/8 removed.
5/8 much simpler implementation, second patch "git push HEAD" added.
6/8 chose more explicit naming
ref_abbrev_matches_full_with_rev_parse_rules;
unified argument order with ref_matches_abbrev,
which was renamed to ref_abbrev_matches_full_with_fetch_rules.
7/8 adjusted to 6/8 changes.
8/8 report summary;
--verbose fixed;
added test that remote tracking branches are unchanged.
All tests pass.
Here's a summary of the series:
Documentation/git-http-push.txt | 6 ++
Documentation/git-push.txt | 16 +++-
Documentation/git-send-pack.txt | 18 +++-
builtin-push.c | 23 +++++-
cache.h | 1 +
http-push.c | 9 ++-
remote.c | 50 +++++++-----
remote.h | 2 +-
send-pack.c | 77 +++++++++++++----
sha1_name.c | 14 +++
t/t5516-fetch-push.sh | 181 ++++++++++++++++++++++++++++++++++++++-
transport.c | 12 ++-
transport.h | 2 +
13 files changed, 358 insertions(+), 53 deletions(-)
[PATCH 01/10] push: change push to fail if short refname does not exist
[PATCH 02/10] push: teach push new flag --create
[PATCH 03/10] push: support pushing HEAD to real branch name
[PATCH 04/10] push: add "git push HEAD" shorthand for 'push current branch to default repo'
Junio doesn't like this patch. But I had it ready, so here it is.
Junio described an alternative in
http://marc.info/?l=git&m=119358745026345&w=2
[PATCH 05/10] rename ref_matches_abbrev() to ref_abbrev_matches_full_with_fetch_rules()
[PATCH 06/10] add ref_abbrev_matches_full_with_rev_parse_rules() comparing abbrev with full ref name
[PATCH 07/10] push: use same rules as git-rev-parse to resolve refspecs
Maybe the matching rules could be further unified.
Code cleanup would be needed here.
But this is a different story.
[PATCH 08/10] push: teach push to accept --verbose option
[PATCH 09/10] push: teach push to pass --verbose option to transport layer
[PATCH 10/10] push: teach push to be quiet if local ref is strict subset of remote ref
Steffen
^ permalink raw reply
* [PATCH 02/10] push: teach push new flag --create
From: Steffen Prohaska @ 2007-10-28 17:46 UTC (permalink / raw)
To: git; +Cc: Steffen Prohaska
In-Reply-To: <11935935812741-git-send-email-prohaska@zib.de>
If you want to push a branch that does not yet exist on the
remote side you can push using a full refspec. For example you
can "push origin refs/heads/master".
This commit changes push such that refs that do not start with
'refs/' will be created at the remote as the matching local ref
if --create is used. If you want to create a new ref at the
remote, you can now say "git push --create origin master".
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
---
Documentation/git-http-push.txt | 6 ++++++
Documentation/git-push.txt | 8 +++++++-
Documentation/git-send-pack.txt | 14 +++++++++++---
builtin-push.c | 6 +++++-
http-push.c | 9 +++++++--
remote.c | 24 +++++++++++++++---------
remote.h | 2 +-
send-pack.c | 9 +++++++--
t/t5516-fetch-push.sh | 8 ++++++++
transport.c | 8 ++++++--
transport.h | 1 +
11 files changed, 74 insertions(+), 21 deletions(-)
diff --git a/Documentation/git-http-push.txt b/Documentation/git-http-push.txt
index 3a69b71..8753611 100644
--- a/Documentation/git-http-push.txt
+++ b/Documentation/git-http-push.txt
@@ -30,6 +30,12 @@ OPTIONS
the remote repository can lose commits; use it with
care.
+\--create::
+ Usually, the command refuses to create a remote ref that is
+ not specified by its full name, i.e. starting with 'refs/'.
+ This flag tells the command to create the remote ref under
+ the full name of the local matching ref.
+
--dry-run::
Do everything except actually send the updates.
diff --git a/Documentation/git-push.txt b/Documentation/git-push.txt
index e5dd4c1..67b354b 100644
--- a/Documentation/git-push.txt
+++ b/Documentation/git-push.txt
@@ -9,7 +9,7 @@ git-push - Update remote refs along with associated objects
SYNOPSIS
--------
[verse]
-'git-push' [--all] [--dry-run] [--tags] [--receive-pack=<git-receive-pack>]
+'git-push' [--all] [--dry-run] [--create] [--tags] [--receive-pack=<git-receive-pack>]
[--repo=all] [-f | --force] [-v] [<repository> <refspec>...]
DESCRIPTION
@@ -86,6 +86,12 @@ the remote repository.
This flag disables the check. This can cause the
remote repository to lose commits; use it with care.
+\--create::
+ Usually, the command refuses to create a remote ref that is
+ not specified by its full name, i.e. starting with 'refs/'.
+ This flag tells the command to create the remote ref under
+ the full name of the local matching ref.
+
\--repo=<repo>::
When no repository is specified the command defaults to
"origin"; this overrides it.
diff --git a/Documentation/git-send-pack.txt b/Documentation/git-send-pack.txt
index 2fa01d4..01495df 100644
--- a/Documentation/git-send-pack.txt
+++ b/Documentation/git-send-pack.txt
@@ -44,6 +44,12 @@ OPTIONS
the remote repository can lose commits; use it with
care.
+\--create::
+ Usually, the command refuses to create a remote ref that is
+ not specified by its full name, i.e. starting with 'refs/'.
+ This flag tells the command to create the remote ref under
+ the full name of the local matching ref.
+
\--verbose::
Run verbosely.
@@ -97,9 +103,11 @@ destination side.
* it has to start with "refs/"; <dst> is used as the
destination literally in this case.
- * <src> == <dst> and the ref that matched the <src> must not
- exist in the set of remote refs; the ref matched <src>
- locally is used as the name of the destination.
+ * Only <src> is specified and the ref that matched
+ <src> must not exist in the set of remote refs;
+ and the '--create' flag is used;
+ the ref matched <src> locally is used as the name of
+ the destination.
Without '--force', the <src> ref is stored at the remote only if
<dst> does not exist, or <dst> is a proper subset (i.e. an
diff --git a/builtin-push.c b/builtin-push.c
index 4b39ef3..4ab1401 100644
--- a/builtin-push.c
+++ b/builtin-push.c
@@ -8,7 +8,7 @@
#include "remote.h"
#include "transport.h"
-static const char push_usage[] = "git-push [--all] [--dry-run] [--tags] [--receive-pack=<git-receive-pack>] [--repo=all] [-f | --force] [-v] [<repository> <refspec>...]";
+static const char push_usage[] = "git-push [--all] [--dry-run] [--create] [--tags] [--receive-pack=<git-receive-pack>] [--repo=all] [-f | --force] [-v] [<repository> <refspec>...]";
static int thin, verbose;
static const char *receivepack;
@@ -113,6 +113,10 @@ int cmd_push(int argc, const char **argv, const char *prefix)
flags |= TRANSPORT_PUSH_DRY_RUN;
continue;
}
+ if (!strcmp(arg, "--create")) {
+ flags |= TRANSPORT_PUSH_CREATE;
+ continue;
+ }
if (!strcmp(arg, "--tags")) {
add_refspec("refs/tags/*");
continue;
diff --git a/http-push.c b/http-push.c
index c02a3af..4ad9f26 100644
--- a/http-push.c
+++ b/http-push.c
@@ -13,7 +13,7 @@
#include <expat.h>
static const char http_push_usage[] =
-"git-http-push [--all] [--dry-run] [--force] [--verbose] <remote> [<head>...]\n";
+"git-http-push [--all] [--dry-run] [--create] [--force] [--verbose] <remote> [<head>...]\n";
#ifndef XML_STATUS_OK
enum XML_Status {
@@ -81,6 +81,7 @@ static int push_verbosely;
static int push_all;
static int force_all;
static int dry_run;
+static int create;
static struct object_list *objects;
@@ -2307,6 +2308,10 @@ int main(int argc, char **argv)
dry_run = 1;
continue;
}
+ if (!strcmp(arg, "--create")) {
+ create = 1;
+ continue;
+ }
if (!strcmp(arg, "--verbose")) {
push_verbosely = 1;
continue;
@@ -2389,7 +2394,7 @@ int main(int argc, char **argv)
if (!remote_tail)
remote_tail = &remote_refs;
if (match_refs(local_refs, remote_refs, &remote_tail,
- nr_refspec, refspec, push_all))
+ nr_refspec, refspec, push_all, create))
return -1;
if (!remote_refs) {
fprintf(stderr, "No refs in common and none specified; doing nothing.\n");
diff --git a/remote.c b/remote.c
index cf6441a..687eb8e 100644
--- a/remote.c
+++ b/remote.c
@@ -606,7 +606,7 @@ static struct ref *make_linked_ref(const char *name, struct ref ***tail)
static int match_explicit(struct ref *src, struct ref *dst,
struct ref ***dst_tail,
struct refspec *rs,
- int errs)
+ int errs, int create)
{
struct ref *matched_src, *matched_dst;
@@ -653,13 +653,19 @@ static int match_explicit(struct ref *src, struct ref *dst,
case 0:
if (!memcmp(lit_dst_value , "refs/", 5))
matched_dst = make_linked_ref(lit_dst_value, dst_tail);
- else {
+ else if (!memcmp(search_dst_value, "refs/", 5))
+ if (create)
+ matched_dst = make_linked_ref(search_dst_value, dst_tail);
+ else
+ error("dst refspec %s does not match any "
+ "existing ref on the remote.\n"
+ "To create it use --create "
+ "or the full ref %s.",
+ lit_dst_value, search_dst_value);
+ else
error("dst refspec %s does not match any "
"existing ref on the remote and does "
"not start with refs/.", lit_dst_value);
- if (!rs->dst)
- error("Did you mean %s?\n", search_dst_value);
- }
break;
default:
matched_dst = NULL;
@@ -683,11 +689,11 @@ static int match_explicit(struct ref *src, struct ref *dst,
static int match_explicit_refs(struct ref *src, struct ref *dst,
struct ref ***dst_tail, struct refspec *rs,
- int rs_nr)
+ int rs_nr, int create)
{
int i, errs;
for (i = errs = 0; i < rs_nr; i++)
- errs |= match_explicit(src, dst, dst_tail, &rs[i], errs);
+ errs |= match_explicit(src, dst, dst_tail, &rs[i], errs, create);
return -errs;
}
@@ -717,12 +723,12 @@ static const struct refspec *check_pattern_match(const struct refspec *rs,
* without thinking.
*/
int match_refs(struct ref *src, struct ref *dst, struct ref ***dst_tail,
- int nr_refspec, char **refspec, int all)
+ int nr_refspec, char **refspec, int all, int create)
{
struct refspec *rs =
parse_ref_spec(nr_refspec, (const char **) refspec);
- if (match_explicit_refs(src, dst, dst_tail, rs, nr_refspec))
+ if (match_explicit_refs(src, dst, dst_tail, rs, nr_refspec, create))
return -1;
/* pick the remainder */
diff --git a/remote.h b/remote.h
index c62636d..7d731b1 100644
--- a/remote.h
+++ b/remote.h
@@ -57,7 +57,7 @@ void ref_remove_duplicates(struct ref *ref_map);
struct refspec *parse_ref_spec(int nr_refspec, const char **refspec);
int match_refs(struct ref *src, struct ref *dst, struct ref ***dst_tail,
- int nr_refspec, char **refspec, int all);
+ int nr_refspec, char **refspec, int all, int create);
/*
* Given a list of the remote refs and the specification of things to
diff --git a/send-pack.c b/send-pack.c
index e9b9a39..77acae1 100644
--- a/send-pack.c
+++ b/send-pack.c
@@ -7,7 +7,7 @@
#include "remote.h"
static const char send_pack_usage[] =
-"git-send-pack [--all] [--dry-run] [--force] [--receive-pack=<git-receive-pack>] [--verbose] [--thin] [<host>:]<directory> [<ref>...]\n"
+"git-send-pack [--all] [--dry-run] [--create] [--force] [--receive-pack=<git-receive-pack>] [--verbose] [--thin] [<host>:]<directory> [<ref>...]\n"
" --all and explicit <ref> specification are mutually exclusive.";
static const char *receivepack = "git-receive-pack";
static int verbose;
@@ -15,6 +15,7 @@ static int send_all;
static int force_update;
static int use_thin_pack;
static int dry_run;
+static int create;
/*
* Make a pack stream and spit it out into file descriptor fd
@@ -201,7 +202,7 @@ static int send_pack(int in, int out, struct remote *remote, int nr_refspec, cha
if (!remote_tail)
remote_tail = &remote_refs;
if (match_refs(local_refs, remote_refs, &remote_tail,
- nr_refspec, refspec, send_all))
+ nr_refspec, refspec, send_all, create))
return -1;
if (!remote_refs) {
@@ -398,6 +399,10 @@ int main(int argc, char **argv)
dry_run = 1;
continue;
}
+ if (!strcmp(arg, "--create")) {
+ create = 1;
+ continue;
+ }
if (!strcmp(arg, "--force")) {
force_update = 1;
continue;
diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index 5ba09e2..42ca0ff 100755
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
@@ -156,6 +156,14 @@ test_expect_success 'push nonexisting (3)' '
'
+test_expect_success 'push nonexisting (4)' '
+
+ mk_test &&
+ git push testrepo --create master &&
+ check_push_result $the_commit heads/master
+
+'
+
test_expect_success 'push with matching heads' '
mk_test heads/master &&
diff --git a/transport.c b/transport.c
index 400af71..fbdbd0d 100644
--- a/transport.c
+++ b/transport.c
@@ -385,7 +385,7 @@ static int curl_transport_push(struct transport *transport, int refspec_nr, cons
int argc;
int err;
- argv = xmalloc((refspec_nr + 11) * sizeof(char *));
+ argv = xmalloc((refspec_nr + 12) * sizeof(char *));
argv[0] = "http-push";
argc = 1;
if (flags & TRANSPORT_PUSH_ALL)
@@ -394,6 +394,8 @@ static int curl_transport_push(struct transport *transport, int refspec_nr, cons
argv[argc++] = "--force";
if (flags & TRANSPORT_PUSH_DRY_RUN)
argv[argc++] = "--dry-run";
+ if (flags & TRANSPORT_PUSH_CREATE)
+ argv[argc++] = "--create";
argv[argc++] = transport->url;
while (refspec_nr--)
argv[argc++] = *refspec++;
@@ -658,7 +660,7 @@ static int git_transport_push(struct transport *transport, int refspec_nr, const
int argc;
int err;
- argv = xmalloc((refspec_nr + 11) * sizeof(char *));
+ argv = xmalloc((refspec_nr + 12) * sizeof(char *));
argv[0] = "send-pack";
argc = 1;
if (flags & TRANSPORT_PUSH_ALL)
@@ -667,6 +669,8 @@ static int git_transport_push(struct transport *transport, int refspec_nr, const
argv[argc++] = "--force";
if (flags & TRANSPORT_PUSH_DRY_RUN)
argv[argc++] = "--dry-run";
+ if (flags & TRANSPORT_PUSH_CREATE)
+ argv[argc++] = "--create";
if (data->receivepack) {
char *rp = xmalloc(strlen(data->receivepack) + 16);
sprintf(rp, "--receive-pack=%s", data->receivepack);
diff --git a/transport.h b/transport.h
index df12ea7..1d6a926 100644
--- a/transport.h
+++ b/transport.h
@@ -30,6 +30,7 @@ struct transport {
#define TRANSPORT_PUSH_ALL 1
#define TRANSPORT_PUSH_FORCE 2
#define TRANSPORT_PUSH_DRY_RUN 4
+#define TRANSPORT_PUSH_CREATE 8
/* Returns a transport suitable for the url */
struct transport *transport_get(struct remote *, const char *);
--
1.5.3.4.439.ge8b49
^ 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